Annotation of pkgsrc/doc/pkgsrc.html, revision 1.270
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.259 jnemeth 33: <div><p class="copyright">Copyright © 1994-2019 The NetBSD Foundation, Inc</p></div>
1.268 sevan 34: <div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.35 2019/04/28 15:22:24 rillig 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>
88: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
89: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
90: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
91: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
92: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1.75 rillig 93: </dl></dd>
1.267 rillig 94: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.75 rillig 95: <dd><dl>
1.267 rillig 96: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
97: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
98: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.75 rillig 99: </dl></dd>
100: </dl></dd>
1.267 rillig 101: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.75 rillig 102: <dd><dl>
1.267 rillig 103: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
104: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
105: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
106: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.88 wiz 107: <dd><dl>
1.267 rillig 108: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
109: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
110: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 111: </dl></dd>
1.267 rillig 112: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
113: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75 rillig 114: </dl></dd>
1.267 rillig 115: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.75 rillig 116: <dd><dl>
1.267 rillig 117: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
118: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.106 rillig 119: </dl></dd>
1.267 rillig 120: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.106 rillig 121: builds)</a></span></dt>
1.75 rillig 122: <dd><dl>
1.267 rillig 123: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
124: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt>
125: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
126: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
127: <dt><span class="sect1"><a href="#creating-cdroms">8.4. Creating a multiple CD-ROM packages collection</a></span></dt>
128: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.4.1. Example of cdpack</a></span></dt></dl></dd>
129: </dl></dd>
130: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
131: <dd><dl>
132: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
133: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
134: </dl></dd>
135: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
136: <dd><dl>
137: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
138: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
139: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
140: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
141: <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>
142: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
143: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
144: <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>
145: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
146: <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 147: /usr/share/tmac/tmac.andoc</span>”</span> mean?</a></span></dt>
1.267 rillig 148: <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>
149: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
150: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
151: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
152: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
153: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
154: <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 155: </dl></dd>
156: </dl></dd>
157: <dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt>
158: <dd><dl>
1.267 rillig 159: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
160: <dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
1.91 rillig 161: <dd><dl>
1.267 rillig 162: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.91 rillig 163: <dd><dl>
1.267 rillig 164: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
165: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.91 rillig 166: </dl></dd>
1.267 rillig 167: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
168: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.106 rillig 169: </dl></dd>
1.267 rillig 170: <dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
1.106 rillig 171: <dd><dl>
1.267 rillig 172: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
173: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
174: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
1.106 rillig 175: <dd><dl>
1.267 rillig 176: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
177: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
178: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
179: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
180: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
1.106 rillig 181: </dl></dd>
1.267 rillig 182: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
183: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
1.106 rillig 184: <dd><dl>
1.267 rillig 185: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
186: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
187: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.106 rillig 188: </dl></dd>
1.267 rillig 189: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
190: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.106 rillig 191: </dl></dd>
1.267 rillig 192: <dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106 rillig 193: <dd><dl>
1.267 rillig 194: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
195: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
196: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
197: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
1.106 rillig 198: <dd><dl>
1.267 rillig 199: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
200: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
201: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
202: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.106 rillig 203: </dl></dd>
204: </dl></dd>
1.267 rillig 205: <dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
1.106 rillig 206: <dd><dl>
1.267 rillig 207: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
208: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
209: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
210: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
211: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
212: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
213: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
214: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
215: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.106 rillig 216: </dl></dd>
1.267 rillig 217: <dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
1.106 rillig 218: <dd><dl>
1.267 rillig 219: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
220: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 221: <dd><dl>
1.267 rillig 222: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
223: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.133 wiz 224: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
225: and
226: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
227: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 228: </dl></dd>
1.267 rillig 229: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.106 rillig 230: <dd><dl>
1.267 rillig 231: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
232: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.106 rillig 233: </dl></dd>
234: </dl></dd>
1.267 rillig 235: <dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
1.106 rillig 236: <dd><dl>
1.267 rillig 237: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
238: <dd><dl>
239: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
240: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
241: </dl></dd>
242: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
243: <dd><dl>
244: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
245: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
246: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
247: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
248: </dl></dd>
249: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
250: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
251: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
252: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
253: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
254: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
255: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
256: </dl></dd>
257: <dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
258: <dd><dl>
259: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
260: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
261: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
262: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
263: </dl></dd>
264: <dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
265: <dd><dl>
266: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
267: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
268: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
269: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
270: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
271: <dd><dl>
272: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
273: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
274: </dl></dd>
275: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
276: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
277: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
278: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
279: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
280: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
281: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
282: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
283: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
284: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
285: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
286: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
287: </dl></dd>
288: <dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
289: <dd><dl>
290: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
291: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
292: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
293: </dl></dd>
294: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
295: <dd><dl>
296: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
297: <dd><dl>
298: <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>
299: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
300: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
301: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
302: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
303: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
304: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
305: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
306: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
307: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
308: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
309: </dl></dd>
310: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
311: <dd><dl>
312: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
313: <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>
314: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
315: </dl></dd>
316: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
317: <dd><dl>
318: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
319: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
320: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
321: </dl></dd>
322: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
323: <dd><dl>
324: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
325: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
326: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
327: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
328: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
329: </dl></dd>
330: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
331: <dd><dl>
332: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
333: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
334: <dt><span class="sect2"><a href="#undefined-reference">21.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
335: <dt><span class="sect2"><a href="#out-of-memory">21.5.4. Running out of memory</a></span></dt>
336: </dl></dd>
337: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
338: <dd><dl>
339: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
340: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
341: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
342: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
343: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
344: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
345: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
346: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
347: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
348: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
349: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
350: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
351: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
352: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
353: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
354: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
355: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
356: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.87 wiz 357: emulation</a></span></dt>
1.267 rillig 358: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
359: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.77 rillig 360: </dl></dd>
1.267 rillig 361: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77 rillig 362: </dl></dd>
1.267 rillig 363: <dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
364: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77 rillig 365: <dd><dl>
1.267 rillig 366: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
367: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
368: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
369: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
370: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
371: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
372: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
373: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
374: </dl></dd>
375: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
376: <dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
377: <dd><dl>
378: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
379: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
380: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
381: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.85 jmmv 382: </dl></dd>
1.75 rillig 383: </dl></dd>
384: <dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt>
385: <dd><dl>
1.267 rillig 386: <dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
1.75 rillig 387: <dd><dl>
1.267 rillig 388: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
389: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
390: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.81 rillig 391: <dd><dl>
1.267 rillig 392: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
393: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.81 rillig 394: </dl></dd>
1.267 rillig 395: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
396: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 397: <dd><dl>
1.267 rillig 398: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
399: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.75 rillig 400: </dl></dd>
1.267 rillig 401: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.75 rillig 402: <dd><dl>
1.267 rillig 403: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
404: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75 rillig 405: </dl></dd>
406: </dl></dd>
1.267 rillig 407: <dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
1.75 rillig 408: <dd><dl>
1.267 rillig 409: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
410: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.75 rillig 411: <dd><dl>
1.267 rillig 412: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
413: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.75 rillig 414: </dl></dd>
415: </dl></dd>
1.267 rillig 416: <dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
417: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.75 rillig 418: </dl></dd>
419: <dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt>
420: <dd><dl>
421: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
422: <dd><dl>
423: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
424: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
425: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.128 wiz 426: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span></a></span></dt>
1.75 rillig 427: </dl></dd>
428: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
429: </dl></dd>
430: <dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt>
431: <dd><dl>
432: <dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
433: <dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
434: </dl></dd>
1.76 rillig 435: <dt><span class="appendix"><a href="#ftp-layout">C. Directory layout of the pkgsrc FTP server</a></span></dt>
436: <dd><dl>
1.128 wiz 437: <dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
438: <dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
439: <dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
440: <dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
441: <dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
1.261 leot 442: <code class="filename">stable</code>,
1.128 wiz 443: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 444: source packages</a></span></dt>
445: </dl></dd>
1.267 rillig 446: <dt><span class="appendix"><a href="#help-topics">D. Help topics</a></span></dt>
447: <dt><span class="appendix"><a href="#editing">E. Editing guidelines for the pkgsrc guide</a></span></dt>
1.75 rillig 448: <dd><dl>
1.267 rillig 449: <dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
450: <dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
1.75 rillig 451: </dl></dd>
452: </dl>
453: </div>
1.82 rillig 454: <div class="list-of-tables">
455: <p><b>List of Tables</b></p>
456: <dl>
457: <dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a>
458: </dt>
1.267 rillig 459: <dt>13.1. <a href="#patch-examples">Patching examples</a>
1.85 jmmv 460: </dt>
1.267 rillig 461: <dt>25.1. <a href="#plist-handling">PLIST handling for GNOME packages</a>
1.85 jmmv 462: </dt>
1.82 rillig 463: </dl>
464: </div>
1.148 asau 465: <div class="chapter">
466: <div class="titlepage"><div><div><h1 class="title">
467: <a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div>
1.75 rillig 468: <div class="toc">
469: <p><b>Table of Contents</b></p>
1.210 leot 470: <dl class="toc">
1.75 rillig 471: <dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
1.82 rillig 472: <dd><dl>
473: <dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
474: <dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
475: </dl></dd>
1.75 rillig 476: <dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
477: <dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
1.88 wiz 478: <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 479: <dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
480: </dl>
481: </div>
1.148 asau 482: <div class="sect1">
1.75 rillig 483: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
484: <a name="introduction-section"></a>1.1. Introduction</h2></div></div></div>
1.82 rillig 485: <p>There is a lot of software freely available for Unix-based
486: systems, which is usually available in form of the source code. Before
487: such software can be used, it needs to be configured to the local
488: system, compiled and installed, and this is exactly what The NetBSD
489: Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
490: to handle binary packages, so that not every user has to build the
491: packages for himself, which is a time-costly task.</p>
1.75 rillig 492: <p>pkgsrc currently contains several thousand packages,
493: including:</p>
1.148 asau 494: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 495: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a> - The Apache
1.75 rillig 496: web server</p></li>
1.250 leot 497: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> - The Firefox
1.75 rillig 498: web browser</p></li>
1.250 leot 499: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a> - The GNOME
1.75 rillig 500: Desktop Environment</p></li>
1.250 leot 501: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a> - The K
1.75 rillig 502: Desktop Environment</p></li>
503: </ul></div>
1.219 rillig 504: <p>… just to name a few.</p>
1.75 rillig 505: <p>pkgsrc has built-in support for handling varying dependencies,
506: such as pthreads and X11, and extended features such as IPv6 support on
507: a range of platforms.</p>
1.148 asau 508: <div class="sect2">
1.82 rillig 509: <div class="titlepage"><div><div><h3 class="title">
510: <a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
511: <p>
512: pkgsrc provides the following key features:
513: </p>
1.148 asau 514: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 515: <li class="listitem"><p>Easy building of software from source as well as the creation
1.82 rillig 516: and installation of binary packages. The source and latest
517: patches are retrieved from a master or mirror download site, checksum
518: verified, then built on your system. Support for binary-only
519: distributions is available for both native platforms and NetBSD
520: emulated platforms.</p></li>
1.128 wiz 521: <li class="listitem"><p>All packages are installed in a consistent directory tree,
1.82 rillig 522: including binaries, libraries, man pages and other
523: documentation.</p></li>
1.214 sevan 524: <li class="listitem"><p>Tracking of package dependencies automatically, including when
525: performing updates, to ensure required packages are installed. The
526: configuration files of various packages are handled automatically during
527: updates, so local changes are preserved.</p></li>
1.128 wiz 528: <li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and
1.82 rillig 529: consists of highly portable code. This allows the greatest speed of
1.132 spz 530: development when porting to a new platform. This portability also
1.82 rillig 531: ensures that pkgsrc is <span class="emphasis"><em>consistent across all
532: platforms</em></span>.</p></li>
1.128 wiz 533: <li class="listitem"><p>The installation prefix, acceptable software licenses,
1.82 rillig 534: international encryption requirements and build-time options for a
535: large number of packages are all set in a simple, central
536: configuration file.</p></li>
1.128 wiz 537: <li class="listitem"><p>The entire source (not including the distribution files) is
1.82 rillig 538: freely available under a BSD license, so you may extend and adapt
539: pkgsrc to your needs. Support for local packages and patches is
540: available right out of the box, so you can configure it specifically
541: for your environment.</p></li>
542: </ul></div>
1.91 rillig 543: <p>The following principles are basic to pkgsrc:</p>
1.148 asau 544: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 545: <li class="listitem"><p><span class="quote">“<span class="quote">It should only work if it's right.</span>”</span>
1.126 jakllsch 546: — That means, if a package contains bugs, it's better to find
1.91 rillig 547: them and to complain about them rather than to just install the package
548: and hope that it works. There are numerous checks in pkgsrc that try to
1.250 leot 549: find such bugs: Static analysis tools (<a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>), build-time checks (portability
1.91 rillig 550: of shell scripts), and post-installation checks (installed files,
551: references to shared libraries, script interpreters).</p></li>
1.128 wiz 552: <li class="listitem"><p><span class="quote">“<span class="quote">If it works, it should work everywhere</span>”</span>
1.126 jakllsch 553: — Like NetBSD has been ported to many hardware architectures,
1.91 rillig 554: pkgsrc has been ported to many operating systems. Care is taken that
555: packages behave the same on all platforms.</p></li>
556: </ul></div>
1.82 rillig 557: </div>
1.148 asau 558: <div class="sect2">
1.82 rillig 559: <div class="titlepage"><div><div><h3 class="title">
560: <a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div>
561: <p>pkgsrc consists of both a source distribution and a binary
562: distribution for these operating systems. After retrieving the required
563: source or binaries, you can be up and running with pkgsrc in just
564: minutes!</p>
1.75 rillig 565: <p>pkgsrc was derived from FreeBSD's ports system, and
566: initially developed for NetBSD only. Since then, pkgsrc has
567: grown a lot, and now supports the following platforms:</p>
1.82 rillig 568: <div class="table">
569: <a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p>
1.216 tnn 570: <div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1">
1.82 rillig 571: <colgroup>
572: <col>
573: <col>
1.202 sevan 574: <col>
1.82 rillig 575: </colgroup>
576: <thead><tr>
577: <th>Platform</th>
578: <th>Date Support Added</th>
1.202 sevan 579: <th>Notes</th>
1.82 rillig 580: </tr></thead>
581: <tbody>
582: <tr>
1.110 hubertf 583: <td><a class="ulink" href="http://www.NetBSD.org/" target="_top">NetBSD</a></td>
1.82 rillig 584: <td align="center">Aug 1997</td>
1.202 sevan 585: <td class="auto-generated"> </td>
1.82 rillig 586: </tr>
587: <tr>
1.110 hubertf 588: <td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
1.82 rillig 589: <td align="center">Mar 1999</td>
1.264 sevan 590: <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 591: </tr>
592: <tr>
1.110 hubertf 593: <td><a class="ulink" href="http://www.kernel.org/" target="_top">Linux</a></td>
1.82 rillig 594: <td align="center">Jun 1999</td>
1.264 sevan 595: <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 596: </tr>
597: <tr>
598: <td>
1.230 sevan 599: <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a>
1.82 rillig 600: </td>
601: <td align="center">Oct 2001</td>
1.264 sevan 602: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.MacOSX" target="_top">README.MacOSX</a></td>
1.82 rillig 603: </tr>
604: <tr>
1.110 hubertf 605: <td><a class="ulink" href="http://www.freebsd.org/" target="_top">FreeBSD</a></td>
1.82 rillig 606: <td align="center">Nov 2002</td>
1.264 sevan 607: <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 608: </tr>
609: <tr>
1.110 hubertf 610: <td><a class="ulink" href="http://www.openbsd.org/" target="_top">OpenBSD</a></td>
1.82 rillig 611: <td align="center">Nov 2002</td>
1.264 sevan 612: <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 613: </tr>
614: <tr>
1.110 hubertf 615: <td><a class="ulink" href="http://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
1.82 rillig 616: <td align="center">Dec 2002</td>
1.202 sevan 617: <td>
1.264 sevan 618: <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a>
619: <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX5.3" target="_top">README.IRIX5.3</a>
1.202 sevan 620: </td>
1.82 rillig 621: </tr>
622: <tr>
623: <td>BSD/OS</td>
624: <td align="center">Dec 2003</td>
1.202 sevan 625: <td class="auto-generated"> </td>
1.82 rillig 626: </tr>
627: <tr>
1.110 hubertf 628: <td><a class="ulink" href="http://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
1.82 rillig 629: <td align="center">Dec 2003</td>
1.264 sevan 630: <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 631: </tr>
632: <tr>
633: <td>
1.110 hubertf 634: <a class="ulink" href="http://www.microsoft.com/windows/sfu/" target="_top">Interix</a>
1.82 rillig 635: (Microsoft Windows Services for Unix)
636: </td>
637: <td align="center">Mar 2004</td>
1.264 sevan 638: <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 639: </tr>
640: <tr>
1.110 hubertf 641: <td><a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
1.82 rillig 642: <td align="center">Oct 2004</td>
1.202 sevan 643: <td class="auto-generated"> </td>
1.82 rillig 644: </tr>
645: <tr>
1.110 hubertf 646: <td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td>
1.82 rillig 647: <td align="center">Nov 2004</td>
1.264 sevan 648: <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 649: </tr>
1.98 wiz 650: <tr>
1.110 hubertf 651: <td><a class="ulink" href="http://www.hp.com/products1/unix/" target="_top">HP-UX</a></td>
1.98 wiz 652: <td align="center">Apr 2007</td>
1.264 sevan 653: <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 654: </tr>
1.128 wiz 655: <tr>
656: <td><a class="ulink" href="http://www.haiku-os.org/" target="_top">Haiku</a></td>
657: <td align="center">Sep 2010</td>
1.264 sevan 658: <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 659: </tr>
1.151 obache 660: <tr>
661: <td><a class="ulink" href="http://www.mirbsd.org/" target="_top">MirBSD</a></td>
1.163 bsiegert 662: <td align="center">Jan 2011</td>
1.202 sevan 663: <td class="auto-generated"> </td>
1.151 obache 664: </tr>
665: <tr>
666: <td><a class="ulink" href="http://www.minix3.org/" target="_top">Minix3</a></td>
667: <td align="center">Nov 2011</td>
1.264 sevan 668: <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 669: </tr>
670: <tr>
671: <td><a class="ulink" href="http://cygwin.com/" target="_top">Cygwin</a></td>
672: <td align="center">Mar 2013</td>
1.264 sevan 673: <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 674: </tr>
1.166 jnemeth 675: <tr>
676: <td><a class="ulink" href="http://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td>
677: <td align="center">Jul 2013</td>
1.264 sevan 678: <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 679: </tr>
1.214 sevan 680: <tr>
681: <td><a class="ulink" href="http://www.bitrig.org/" target="_top">Bitrig</a></td>
682: <td align="center">Jun 2014</td>
1.264 sevan 683: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Bitrig" target="_top">README.Bitrig</a></td>
1.214 sevan 684: </tr>
1.82 rillig 685: </tbody>
1.91 rillig 686: </table></div>
1.82 rillig 687: </div>
1.91 rillig 688: <br class="table-break">
1.82 rillig 689: </div>
1.75 rillig 690: </div>
1.148 asau 691: <div class="sect1">
1.75 rillig 692: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
693: <a name="overview"></a>1.2. Overview</h2></div></div></div>
694: <p>This document is divided into three parts. The first,
1.110 hubertf 695: <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>,
1.75 rillig 696: describes how one can use one of the packages in the Package
697: Collection, either by installing a precompiled binary package,
1.93 rillig 698: or by building one's own copy using the NetBSD package system.
1.110 hubertf 699: 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 700: package so it can be easily built by other NetBSD users without
701: knowing about the package's building details. The third part,
1.110 hubertf 702: <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a>
1.75 rillig 703: is intended for those who want to understand how pkgsrc is
704: implemented.</p>
705: <p>This document is available in various formats:
1.110 hubertf 706: <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 707: </div>
1.148 asau 708: <div class="sect1">
1.75 rillig 709: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
710: <a name="terminology"></a>1.3. Terminology</h2></div></div></div>
1.128 wiz 711: <p>There has been a lot of talk about <span class="quote">“<span class="quote">ports</span>”</span>,
712: <span class="quote">“<span class="quote">packages</span>”</span>, etc. so far. Here is a description of all the
1.75 rillig 713: terminology used within this document.</p>
1.148 asau 714: <div class="variablelist"><dl class="variablelist">
1.75 rillig 715: <dt><span class="term">Package</span></dt>
716: <dd><p>A set of files and building instructions
717: that describe what's necessary
718: to build a certain piece of software using
719: pkgsrc. Packages are traditionally stored under
1.236 wiz 720: <code class="filename">/usr/pkgsrc</code>,
721: but may be stored in any location,
722: referred to as <code class="varname">PKGSRCDIR</code>.</p></dd>
1.75 rillig 723: <dt><span class="term">The NetBSD package system</span></dt>
1.128 wiz 724: <dd><p>This is the former name of <span class="quote">“<span class="quote">pkgsrc</span>”</span>. It
1.87 wiz 725: is part of the NetBSD operating system and can be bootstrapped
726: to run on non-NetBSD operating systems as well. It handles
727: building (compiling), installing, and removing of
728: packages.</p></dd>
1.75 rillig 729: <dt><span class="term">Distfile</span></dt>
730: <dd><p>This term describes the file or files that are
731: provided by the author of the piece of software to
732: distribute his work. All the changes necessary to build on
733: NetBSD are reflected in the corresponding package. Usually
734: the distfile is in the form of a compressed tar-archive,
735: but other types are possible, too. Distfiles are usually
736: stored below
1.76 rillig 737: <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd>
1.75 rillig 738: <dt><span class="term">Port</span></dt>
739: <dd><p>This is the term used by FreeBSD and OpenBSD people
740: for what we call a package.
1.128 wiz 741: In NetBSD terminology, <span class="quote">“<span class="quote">port</span>”</span> refers to a different
1.75 rillig 742: architecture.</p></dd>
743: <dt><span class="term">Precompiled/binary package</span></dt>
744: <dd>
745: <p>A set of binaries built with pkgsrc from a distfile
1.76 rillig 746: and stuffed together in a single <code class="filename">.tgz</code>
1.75 rillig 747: file so it can be installed on machines of the same
748: machine architecture without the need to
749: recompile. Packages are usually generated in
1.76 rillig 750: <code class="filename">/usr/pkgsrc/packages</code>; there is also
1.132 spz 751: an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p>
1.128 wiz 752: <p>Sometimes, this is referred to by the term <span class="quote">“<span class="quote">package</span>”</span> too,
1.75 rillig 753: especially in the context of precompiled packages.</p>
754: </dd>
755: <dt><span class="term">Program</span></dt>
1.88 wiz 756: <dd><p>The piece of software to be installed which will be
757: constructed from all the files in the distfile by the
758: actions defined in the corresponding package.</p></dd>
1.75 rillig 759: </dl></div>
1.148 asau 760: <div class="sect2">
1.75 rillig 761: <div class="titlepage"><div><div><h3 class="title">
1.88 wiz 762: <a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div>
1.148 asau 763: <div class="variablelist"><dl class="variablelist">
1.75 rillig 764: <dt><span class="term">pkgsrc users</span></dt>
765: <dd>
766: <p>The
767: pkgsrc users are people who use the packages provided by pkgsrc.
768: Typically they are system administrators. The people using the
1.128 wiz 769: software that is inside the packages (maybe called <span class="quote">“<span class="quote">end
770: users</span>”</span>) are not covered by the pkgsrc guide.</p>
1.75 rillig 771: <p>There are two kinds of pkgsrc users: Some only want to
772: install pre-built binary packages. Others build the pkgsrc
773: packages from source, either for installing them directly or for
1.110 hubertf 774: 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 775: documentation.</p>
776: </dd>
777: <dt><span class="term">package maintainers</span></dt>
778: <dd><p>A
1.110 hubertf 779: 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 780: <dt><span class="term">infrastructure developers</span></dt>
781: <dd><p>These people are involved in all those files
1.76 rillig 782: that live in the <code class="filename">mk/</code> directory and below.
1.110 hubertf 783: 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 784: too.</p></dd>
785: </dl></div>
786: </div>
787: </div>
1.148 asau 788: <div class="sect1">
1.75 rillig 789: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
790: <a name="typography"></a>1.4. Typography</h2></div></div></div>
791: <p>When giving examples for commands, shell prompts are used to
792: show if the command should/can be issued as root, or if
1.128 wiz 793: <span class="quote">“<span class="quote">normal</span>”</span> user privileges are sufficient. We use a
1.226 sevan 794: <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users'
795: shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for
796: bourne shell and derivatives.</p>
1.75 rillig 797: </div>
798: </div>
1.148 asau 799: <div class="part">
1.75 rillig 800: <div class="titlepage"><div><div><h1 class="title">
801: <a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div>
802: <div class="toc">
803: <p><b>Table of Contents</b></p>
1.210 leot 804: <dl class="toc">
1.267 rillig 805: <dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
806: <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 807: <dd><dl>
1.267 rillig 808: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75 rillig 809: <dd><dl>
1.267 rillig 810: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
811: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.75 rillig 812: </dl></dd>
1.267 rillig 813: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75 rillig 814: <dd><dl>
1.267 rillig 815: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
816: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.75 rillig 817: </dl></dd>
818: </dl></dd>
1.267 rillig 819: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.75 rillig 820: <dd><dl>
1.267 rillig 821: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
822: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.75 rillig 823: </dl></dd>
1.267 rillig 824: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.75 rillig 825: <dd><dl>
1.267 rillig 826: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75 rillig 827: <dd><dl>
1.267 rillig 828: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
829: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
830: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
831: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
832: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
833: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
834: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1.75 rillig 835: </dl></dd>
1.267 rillig 836: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.75 rillig 837: <dd><dl>
1.267 rillig 838: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
839: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
840: <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 841: </dl></dd>
842: </dl></dd>
1.267 rillig 843: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.75 rillig 844: <dd><dl>
1.267 rillig 845: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
846: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
847: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
848: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.88 wiz 849: <dd><dl>
1.267 rillig 850: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
851: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
852: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 853: </dl></dd>
1.267 rillig 854: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
855: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75 rillig 856: </dl></dd>
1.267 rillig 857: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.75 rillig 858: <dd><dl>
1.267 rillig 859: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
860: <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 861: </dl></dd>
1.267 rillig 862: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.106 rillig 863: builds)</a></span></dt>
1.75 rillig 864: <dd><dl>
1.267 rillig 865: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
866: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt>
867: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
868: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
869: <dt><span class="sect1"><a href="#creating-cdroms">8.4. Creating a multiple CD-ROM packages collection</a></span></dt>
870: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.4.1. Example of cdpack</a></span></dt></dl></dd>
871: </dl></dd>
872: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
873: <dd><dl>
874: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
875: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
876: </dl></dd>
877: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
878: <dd><dl>
879: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
880: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
881: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
882: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
883: <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>
884: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
885: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
886: <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>
887: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
888: <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 889: /usr/share/tmac/tmac.andoc</span>”</span> mean?</a></span></dt>
1.267 rillig 890: <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>
891: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
892: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
893: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
894: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
895: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
896: <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 897: </dl></dd>
898: </dl>
899: </div>
1.148 asau 900: <div class="chapter">
1.75 rillig 901: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 902: <a name="help-user"></a>Chapter 2. Getting help</h2></div></div></div>
903: <p>
904: To get help when using pkgsrc, the definitive source is this
905: document, the pkgsrc guide. If you don't find anything here,
906: there are alternatives:
907: </p>
908: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
909: <li class="listitem">
910: <p>
911: The built-in pkgsrc help, which is available after bootstrapping
912: pkgsrc. Run <span class="command"><strong>bmake help topic=…</strong></span> to get
913: help for any topic, such as a variable name like
914: <code class="varname">BUILD_DEFS</code>, a make target like
915: <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
916: <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
917: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix D. Help topics">Appendix D, <i>Help topics</i></a>.</p>
918: </li>
919: <li class="listitem"><p>
920: The pkgsrc-users mailing list, to which
921: <a class="ulink" href="https://www.NetBSD.org/mailinglists/#pkgsrc-users" target="_top">you
922: can subscribe</a> and then <a class="ulink" href="mailto:pkgsrc-users@NetBSD.org" target="_top">ask your
923: questions</a>.</p></li>
924: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
925: <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
926: or by using a specialized chat program such as
927: <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
928: Pick any user name and join the channel #pkgsrc.</p></li>
929: </ul></div>
930: </div>
931: <div class="chapter">
932: <div class="titlepage"><div><div><h2 class="title">
933: <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 934: <div class="toc">
935: <p><b>Table of Contents</b></p>
1.210 leot 936: <dl class="toc">
1.267 rillig 937: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75 rillig 938: <dd><dl>
1.267 rillig 939: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
940: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.75 rillig 941: </dl></dd>
1.267 rillig 942: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75 rillig 943: <dd><dl>
1.267 rillig 944: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
945: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.75 rillig 946: </dl></dd>
947: </dl>
948: </div>
1.91 rillig 949: <p>Before you download and extract the files, you need to decide
950: where you want to extract them. When using pkgsrc as root user, pkgsrc
951: is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
952: free to install the sources and binary packages wherever you want in
953: your filesystem, provided that the pathname does not contain white-space
954: or other characters that are interpreted specially by the shell and some
955: other programs. A safe bet is to use only letters, digits, underscores
956: and dashes.</p>
1.148 asau 957: <div class="sect1">
1.75 rillig 958: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 959: <a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div>
1.75 rillig 960: <p>Before you download any pkgsrc files, you should decide
961: whether you want the <span class="emphasis"><em>current</em></span> branch or the
962: <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
963: quarterly basis from the current branch and only gets modified
964: for security updates. The names of the stable branches are built
965: from the year and the quarter, for example
1.270 ! leot 966: <code class="literal">2019Q2</code>.</p>
1.75 rillig 967: <p>The second step is to decide <span class="emphasis"><em>how</em></span> you
1.128 wiz 968: want to download pkgsrc. You can get it as a tar file or via CVS.
969: Both ways are described here.</p>
1.157 asau 970: <p>Note that tar archive contains CVS working copy.
971: Thus you can switch to using CVS at any later time.</p>
1.148 asau 972: <div class="sect2">
1.75 rillig 973: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 974: <a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div>
1.75 rillig 975: <p>The primary download location for all pkgsrc files is
1.264 sevan 976: <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or
1.157 asau 977: <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>
978: (it points to the same location).
979: There are a number of subdirectories for different purposes,
980: which are described in detail in <a class="xref" href="#ftp-layout" title="Appendix C. Directory layout of the pkgsrc FTP server">Appendix C, <i>Directory layout of the pkgsrc FTP server</i></a>.</p>
981: <p>The tar archive for the current branch is in the directory
1.264 sevan 982: <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 983: It is autogenerated weekly.</p>
1.157 asau 984: <p>To save download time we provide bzip2- and
985: xz-compressed archives which are published at
1.264 sevan 986: <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 987: and
1.264 sevan 988: <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 989: respectively.
990: </p>
991: <p>You can fetch the same files using FTP.</p>
1.270 ! leot 992: <p>The tar file for the stable branch 2019Q2 is in the
! 993: directory <code class="filename">pkgsrc-2019Q2</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2019Q2/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1.249 leot 994: <p>To download the latest pkgsrc stable tarball, run:</p>
1.112 weinem 995: <pre class="screen">
1.270 ! leot 996: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2019Q2/pkgsrc.tar.gz</code></strong></pre>
1.188 snj 997: <p>If you prefer, you can also fetch it using "wget", "curl",
1.157 asau 998: or your web browser.</p>
1.112 weinem 999: <p>Then, extract it with:</p>
1.188 snj 1000: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1.112 weinem 1001: <p>This will create the directory <code class="filename">pkgsrc/</code>
1002: in <code class="filename">/usr/</code> and all the package source will be
1003: stored under <code class="filename">/usr/pkgsrc/</code>.</p>
1004: <p>To download pkgsrc-current, run:</p>
1005: <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 1006: </div>
1.148 asau 1007: <div class="sect2">
1.75 rillig 1008: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1009: <a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div>
1.128 wiz 1010: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.270 ! leot 1011: <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-2019Q2 -P pkgsrc</code></strong>
1.128 wiz 1012: </pre>
1013: <p>This will create the directory <code class="filename">pkgsrc/</code>
1014: in your <code class="filename">/usr/</code> directory and all the package source
1015: will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
1016: <p>To fetch the pkgsrc current branch, run:</p>
1.146 wiz 1017: <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 1018: </pre>
1.188 snj 1019: <p>Refer to the <a class="ulink" href="http://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1.128 wiz 1020: <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 1021: <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 1022: </pre>
1023: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
1024: For Bourne shells, you can set it in your <code class="filename">.profile</code>
1025: or better globally in <code class="filename">/etc/profile</code>:</p>
1026: <pre class="programlisting">
1027: # set CVS remote shell command
1028: CVS_RSH=ssh
1029: export CVS_RSH
1030: </pre>
1031: <p>By default, CVS doesn't do things like most people would expect it to do.
1032: But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
1033: in your home directory and saving the following lines to it.
1034: This file will save you lots of headache and some bug reports, so we strongly recommend it.
1035: You can find an explanation of this file in the CVS documentation.</p>
1.101 rillig 1036: <pre class="programlisting">
1037: # recommended CVS configuration file from the pkgsrc guide
1.268 sevan 1038: cvs -q
1.101 rillig 1039: checkout -P
1.103 wiz 1040: update -dP
1041: diff -upN
1.101 rillig 1042: rdiff -u
1.128 wiz 1043: release -d
1.101 rillig 1044: </pre>
1.75 rillig 1045: </div>
1046: </div>
1.148 asau 1047: <div class="sect1">
1.75 rillig 1048: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1049: <a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div>
1.75 rillig 1050: <p>The preferred way to keep pkgsrc up-to-date is via CVS
1051: (which also works if you have first installed it via a tar
1052: file). It saves bandwidth and hard disk activity, compared to
1053: downloading the tar file again.</p>
1.148 asau 1054: <div class="sect2">
1.75 rillig 1055: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1056: <a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div>
1.148 asau 1057: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 1058: <h3 class="title">Warning</h3>
1.77 rillig 1059: <p>When updating from a tar file, you first need to
1060: completely remove the old pkgsrc directory. Otherwise those
1061: files that have been removed from pkgsrc in the mean time will
1062: not be removed on your local disk, resulting in inconsistencies.
1063: When removing the old files, any changes that you have done to
1064: the pkgsrc files will be lost after updating. Therefore updating
1065: via CVS is strongly recommended.</p>
1.75 rillig 1066: </div>
1.82 rillig 1067: <p>Note that by default the distfiles and the binary packages
1068: are saved in the pkgsrc tree, so don't forget to rescue them
1.188 snj 1069: before updating. You can also configure pkgsrc to store distfiles
1070: and packages in directories outside the pkgsrc tree by setting the
1.82 rillig 1071: <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.267 rillig 1072: 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 1073: <p>To update pkgsrc from a tar file, download the tar file as
1074: explained above. Then, make sure that you have not made any
1075: changes to the files in the pkgsrc directory. Remove the pkgsrc
1076: directory and extract the new tar file. Done.</p>
1077: </div>
1.148 asau 1078: <div class="sect2">
1.75 rillig 1079: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1080: <a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div>
1.132 spz 1081: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
1082: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc && cvs update -dP</code></strong>
1083: </pre>
1084: <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>
1085: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP</code></strong>
1086: </pre>
1.148 asau 1087: <div class="sect3">
1.75 rillig 1088: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 1089: <a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
1.75 rillig 1090: <p>When updating pkgsrc, the CVS program keeps track of the
1091: branch you selected. But if you, for whatever reason, want to
1092: switch from the stable branch to the current one, you can do it
1.128 wiz 1093: by adding the option <span class="quote">“<span class="quote">-A</span>”</span> after the
1094: <span class="quote">“<span class="quote">update</span>”</span> keyword. To switch from the current branch
1.75 rillig 1095: back to the stable branch, add the
1.270 ! leot 1096: <span class="quote">“<span class="quote">-rpkgsrc-2019Q2</span>”</span> option.</p>
1.75 rillig 1097: </div>
1.148 asau 1098: <div class="sect3">
1.75 rillig 1099: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 1100: <a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div>
1.75 rillig 1101: <p>When you update pkgsrc, the CVS program will only touch
1102: those files that are registered in the CVS repository. That
1103: means that any packages that you created on your own will stay
1104: unmodified. If you change files that are managed by CVS, later
1105: updates will try to merge your changes with those that have been
1106: done by others. See the CVS manual, chapter
1.128 wiz 1107: <span class="quote">“<span class="quote">update</span>”</span> for details.</p>
1.75 rillig 1108: </div>
1109: </div>
1110: </div>
1111: </div>
1.148 asau 1112: <div class="chapter">
1.75 rillig 1113: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 1114: <a name="platforms"></a>Chapter 4. Using pkgsrc on systems other than NetBSD</h2></div></div></div>
1.75 rillig 1115: <div class="toc">
1116: <p><b>Table of Contents</b></p>
1.210 leot 1117: <dl class="toc">
1.267 rillig 1118: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
1119: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.75 rillig 1120: </dl>
1121: </div>
1.148 asau 1122: <div class="sect1">
1.75 rillig 1123: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1124: <a name="binarydist"></a>4.1. Binary distribution</h2></div></div></div>
1125: <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 1126: </div>
1.148 asau 1127: <div class="sect1">
1.82 rillig 1128: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1129: <a name="bootstrapping-pkgsrc"></a>4.2. Bootstrapping pkgsrc</h2></div></div></div>
1.149 asau 1130: <p>pkgsrc can be bootstrapped for use in two different modes:
1131: privileged and unprivileged one. In unprivileged mode in contrast
1.150 asau 1132: to privileged one all programs are installed under one particular user
1.149 asau 1133: and cannot utilise privileged operations (packages don't create
1134: special users and all special file permissions like setuid are ignored).
1135: </p>
1.82 rillig 1136: <p>Installing the bootstrap kit from source should be as simple as:</p>
1.75 rillig 1137: <pre class="screen">
1.167 asau 1138: <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 1139: <code class="prompt">#</code> <strong class="userinput"><code>cd pkgsrc/bootstrap</code></strong>
1.87 wiz 1140: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap</code></strong>
1141: </pre>
1.149 asau 1142: <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>
1143: <p>By default, in privileged mode pkgsrc uses
1144: <code class="filename">/usr/pkg</code> for <span class="emphasis"><em>prefix</em></span>
1145: where programs will be installed in,
1.230 sevan 1146: and <code class="filename">/usr/pkg/pkgdb</code> for the package database
1.149 asau 1147: directory where pkgsrc will do its internal bookkeeping,
1148: <code class="filename">/var</code> is used as <span class="emphasis"><em>varbase</em></span>,
1149: where packages install their persistent data.
1150: In unprivileged mode pkgsrc uses
1151: <code class="filename">~/pkg</code> for <span class="emphasis"><em>prefix</em></span>,
1.230 sevan 1152: <code class="filename">~/pkg/pkgdb</code> for the package database,
1.149 asau 1153: and <code class="filename">~/pkg/var</code> for <span class="emphasis"><em>varbase</em></span>.
1154: </p>
1155: <p>You can change default layout using command-line arguments.
1156: Run <span class="quote">“<span class="quote">./bootstrap --help</span>”</span> to get details.
1157: </p>
1.148 asau 1158: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 1159: <h3 class="title">Note</h3>
1.110 hubertf 1160: <p>The bootstrap installs a <span class="command"><strong>bmake</strong></span> tool.
1161: Use this <span class="command"><strong>bmake</strong></span> when building via pkgsrc.
1162: For examples in this guide, use <span class="command"><strong>bmake</strong></span>
1.128 wiz 1163: instead of <span class="quote">“<span class="quote">make</span>”</span>.</p>
1.75 rillig 1164: </div>
1.149 asau 1165: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1166: <h3 class="title">Note</h3>
1167: <p>It is possible to bootstrap multiple instances of pkgsrc
1168: using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span>
1169: corresponding to the installation you're working with to build
1170: and install packages.
1171: </p>
1172: </div>
1.75 rillig 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="using"></a>Chapter 5. Using pkgsrc</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="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75 rillig 1182: <dd><dl>
1.267 rillig 1183: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
1184: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
1185: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
1186: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
1187: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
1188: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
1189: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1190: </dl></dd>
1191: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1192: <dd><dl>
1193: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
1194: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
1195: <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 1196: </dl></dd>
1197: </dl>
1198: </div>
1199: <p>Basically, there are two ways of using pkgsrc. The first
1.88 wiz 1200: is to only install the package tools and to use binary packages
1.128 wiz 1201: that someone else has prepared. This is the <span class="quote">“<span class="quote">pkg</span>”</span>
1202: in pkgsrc. The second way is to install the <span class="quote">“<span class="quote">src</span>”</span>
1.88 wiz 1203: of pkgsrc, too. Then you are able to build your own packages,
1204: and you can still use binary packages from someone else.</p>
1.148 asau 1205: <div class="sect1">
1.75 rillig 1206: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1207: <a name="using-pkg"></a>5.1. Using binary packages</h2></div></div></div>
1.264 sevan 1208: <p>On the <a class="ulink" href="https://cdn.NetBSD.org/" target="_top">cdn.NetBSD.org</a>
1209: site and mirrors, there are collections of binary packages,
1.109 rillig 1210: ready to be installed. These binary packages have been built using the
1211: default settings for the directories, that is:</p>
1.148 asau 1212: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1213: <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>
1214: <li class="listitem"><p><code class="filename">/usr/pkg/etc</code> for configuration files,</p></li>
1215: <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 1216: </ul></div>
1217: <p>If you cannot use these directories for whatever reasons (maybe
1218: because you're not root), you cannot use these binary packages, but
1.267 rillig 1219: 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 1220: <div class="sect2">
1.75 rillig 1221: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1222: <a name="finding-binary-packages"></a>5.1.1. Finding binary packages</h3></div></div></div>
1.105 weinem 1223: <p>To install binary packages, you first need to know from where
1224: to get them. The first place where you should look is on the main
1.264 sevan 1225: pkgsrc FTP server 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 1226: <p>This directory contains binary packages for multiple
1227: platforms. First, select your operating system. (Ignore the
1228: directories with version numbers attached to it, they just exist for
1229: legacy reasons.) Then, select your hardware architecture, and in the
1.128 wiz 1230: third step, the OS version and the <span class="quote">“<span class="quote">version</span>”</span> of pkgsrc.</p>
1.109 rillig 1231: <p>In this directory, you often find a file called
1232: <code class="filename">bootstrap.tar.gz</code> which contains the package
1233: management tools. If the file is missing, it is likely that your
1234: operating system already provides those tools. Download the file and
1235: extract it in the <code class="filename">/</code> directory. It will create
1236: the directories <code class="filename">/usr/pkg</code> (containing the tools
1.230 sevan 1237: for managing binary packages and the database of installed packages).</p>
1.75 rillig 1238: </div>
1.148 asau 1239: <div class="sect2">
1.75 rillig 1240: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1241: <a name="installing-binary-packages"></a>5.1.2. Installing binary packages</h3></div></div></div>
1.109 rillig 1242: <p>In the directory from the last section, there is a
1.196 wiz 1243: subdirectory called <code class="filename">All/</code>, which contains all the
1.109 rillig 1244: binary packages that are available for the platform, excluding those
1245: that may not be distributed via FTP or CDROM (depending on which
1.128 wiz 1246: medium you are using).</p>
1.109 rillig 1247: <p>To install packages directly from an FTP or HTTP server, run
1248: the following commands in a Bourne-compatible shell (be sure to
1.110 hubertf 1249: <span class="command"><strong>su</strong></span> to root first):</p>
1.109 rillig 1250: <pre class="screen">
1251: <code class="prompt">#</code> <strong class="userinput"><code>PATH="/usr/pkg/sbin:$PATH"</code></strong>
1.264 sevan 1252: <code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/<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 1253: <code class="prompt">#</code> <strong class="userinput"><code>export PATH PKG_PATH</code></strong>
1254: </pre>
1255: <p>Instead of URLs, you can also use local paths, for example if
1256: you are installing from a set of CDROMs, DVDs or an NFS-mounted
1257: repository. If you want to install packages from multiple sources,
1258: you can separate them by a semicolon in
1259: <code class="varname">PKG_PATH</code>.</p>
1260: <p>After these preparations, installing a package is very
1261: easy:</p>
1262: <pre class="screen">
1.230 sevan 1263: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add libreoffice</code></strong>
1264: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add ap24-php71-*</code></strong>
1.109 rillig 1265: </pre>
1.75 rillig 1266: <p>Note that any prerequisite packages needed to run the
1.88 wiz 1267: package in question will be installed, too, assuming they are
1268: present where you install from.</p>
1.128 wiz 1269: <p>Adding packages might install vulnerable packages.
1270: Thus you should run <span class="command"><strong>pkg_admin audit</strong></span>
1271: regularly, especially after installing new packages, and verify
1272: that the vulnerabilities are acceptable for your configuration.</p>
1.75 rillig 1273: <p>After you've installed packages, be sure to have
1.88 wiz 1274: <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your
1275: <code class="varname">PATH</code> so you can actually start the just
1276: installed program.</p>
1.75 rillig 1277: </div>
1.148 asau 1278: <div class="sect2">
1.75 rillig 1279: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1280: <a name="using.pkg_delete"></a>5.1.3. Deinstalling packages</h3></div></div></div>
1.82 rillig 1281: <p>To deinstall a package, it does not matter whether it was
1.88 wiz 1282: installed from source code or from a binary package. The
1.110 hubertf 1283: <span class="command"><strong>pkg_delete</strong></span> command does not know it anyway.
1284: To delete a package, you can just run <span class="command"><strong>pkg_delete
1.88 wiz 1285: <em class="replaceable"><code>package-name</code></em></strong></span>. The package
1286: name can be given with or without version number. Wildcards can
1287: also be used to deinstall a set of packages, for example
1288: <code class="literal">*emacs*</code>. Be sure to include them in quotes,
1289: so that the shell does not expand them before
1290: <code class="literal">pkg_delete</code> sees them.</p>
1.82 rillig 1291: <p>The <code class="option">-r</code> option is very powerful: it
1.88 wiz 1292: removes all the packages that require the package in question
1293: and then removes the package itself. For example:
1.82 rillig 1294:
1.88 wiz 1295: </p>
1.82 rillig 1296: <pre class="screen">
1.88 wiz 1297: <code class="prompt">#</code> <strong class="userinput"><code>pkg_delete -r jpeg</code></strong>
1298: </pre>
1.82 rillig 1299: <p>
1300:
1.88 wiz 1301: will remove jpeg and all the packages that used it; this allows
1302: upgrading the jpeg package.</p>
1.82 rillig 1303: </div>
1.148 asau 1304: <div class="sect2">
1.82 rillig 1305: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1306: <a name="using.pkg_info"></a>5.1.4. Getting information about installed packages</h3></div></div></div>
1.110 hubertf 1307: <p>The <span class="command"><strong>pkg_info</strong></span> shows information about
1.88 wiz 1308: installed packages or binary package files.</p>
1.82 rillig 1309: </div>
1.148 asau 1310: <div class="sect2">
1.82 rillig 1311: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1312: <a name="vulnerabilities"></a>5.1.5. Checking for security vulnerabilities in installed packages</h3></div></div></div>
1.82 rillig 1313: <p>
1.88 wiz 1314: The NetBSD Security-Officer and Packages Groups maintain a list of
1315: known security vulnerabilities to packages which are (or have been)
1316: included in pkgsrc. The list is available from the NetBSD
1.264 sevan 1317: FTP site at <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">http://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities</a>.
1.88 wiz 1318: </p>
1.82 rillig 1319: <p>
1.125 wiz 1320: Through <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1.88 wiz 1321: this list can be downloaded
1322: automatically, and a security audit of all packages installed on a system
1323: can take place.
1324: </p>
1.82 rillig 1325: <p>
1.125 wiz 1326: There are two components to auditing. The first
1327: step, <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1328: is for downloading
1.88 wiz 1329: the list of vulnerabilities from the NetBSD FTP site. The second
1.125 wiz 1330: step, <span class="command"><strong>pkg_admin audit</strong></span>, checks to see if any of your
1.88 wiz 1331: installed packages are vulnerable. If a package is vulnerable, you
1332: will see output similar to the following:
1333: </p>
1.82 rillig 1334: <pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see
1.88 wiz 1335: http://www.samba.org/samba/whatsnew/macroexploit.html</pre>
1.82 rillig 1336: <p>
1.125 wiz 1337: You may wish to have the
1.264 sevan 1338: <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a>
1.125 wiz 1339: file downloaded daily so that
1340: it remains current. This may be done by adding an appropriate entry
1.270 ! leot 1341: to the root users <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?crontab+5.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span></a> entry. For example the entry
1.125 wiz 1342: </p>
1343: <pre class="screen">
1.233 sevan 1344: # Download vulnerabilities file
1.230 sevan 1345: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.233 sevan 1346: # Audit the installed packages and email results to root
1347: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1348: root >/dev/null 2>&1
1.125 wiz 1349: </pre>
1350: <p>
1.230 sevan 1351: will update the vulnerability list every day at 3AM, followed by an audit
1352: at 3:09AM. The result of the audit are then emailed to root.
1.125 wiz 1353:
1.230 sevan 1354: On NetBSD this may be accomplished instead by adding the following
1355: line to <code class="filename">/etc/daily.conf</code>:
1356: </p>
1357: <pre class="screen">
1358: fetch_pkg_vulnerabilities=YES
1359: </pre>
1360: <p>
1361: to fetch the vulnerability list from the daily security script. The system
1362: is set to audit the packages by default but can be set explicitly, if
1.235 yyamano 1363: desired (not required), by adding the following line to
1.230 sevan 1364: <code class="filename">/etc/security.conf</code>:
1.125 wiz 1365: </p>
1366: <pre class="screen">
1.230 sevan 1367: check_pkg_vulnerabilities=YES
1.125 wiz 1368: </pre>
1369: <p>
1.270 ! leot 1370: see <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?daily.conf+5.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">daily.conf</span>(5)</span></a> and <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?security.conf+5.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">security.conf</span>(5)</span></a> for more details.
1.88 wiz 1371: </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.267 rillig 1375: <a name="pkg_versions"></a>5.1.6. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div>
1.82 rillig 1376: <p>
1.250 leot 1377: Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/README.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a> and run
1.128 wiz 1378: <span class="command"><strong>lintpkgsrc</strong></span> with the <span class="quote">“<span class="quote">-i</span>”</span>
1.88 wiz 1379: argument to check if your packages are up-to-date, e.g.
1380: </p>
1381: <pre class="screen">
1382: <code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong>
1.82 rillig 1383: ...
1.88 wiz 1384: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1385: </pre>
1.110 hubertf 1386: <p>You can then use <span class="command"><strong>make update</strong></span> to update the
1.88 wiz 1387: package on your system and rebuild any dependencies.
1388: </p>
1.82 rillig 1389: </div>
1.148 asau 1390: <div class="sect2">
1.82 rillig 1391: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1392: <a name="using.pkg_admin"></a>5.1.7. Other administrative functions</h3></div></div></div>
1.110 hubertf 1393: <p>The <span class="command"><strong>pkg_admin</strong></span> executes various
1.88 wiz 1394: administrative functions on the package system.</p>
1.82 rillig 1395: </div>
1.75 rillig 1396: </div>
1.148 asau 1397: <div class="sect1">
1.75 rillig 1398: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1399: <a name="building-packages-from-source"></a>5.2. Building packages from source</h2></div></div></div>
1.88 wiz 1400: <p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
1401: directory now contains a set of packages, organized into
1402: categories. You can browse the online index of packages, or run
1.110 hubertf 1403: <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code>
1.88 wiz 1404: directory to build local <code class="filename">README.html</code> files for
1.250 leot 1405: all packages, viewable with any web browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p>
1.88 wiz 1406: <p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
1407: is <code class="filename">/usr/pkg</code>. If you wish to change this, you
1408: should do so by setting <code class="varname">LOCALBASE</code> in
1.110 hubertf 1409: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. You should not try to use multiple
1.88 wiz 1410: different <code class="varname">LOCALBASE</code> definitions on the same
1411: system (inside a chroot is an exception). </p>
1412: <p>The rest of this chapter assumes that the package is already
1.110 hubertf 1413: 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 1414: instructions how to create your own packages.</p>
1.148 asau 1415: <div class="sect2">
1.75 rillig 1416: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1417: <a name="requirements"></a>5.2.1. Requirements</h3></div></div></div>
1.82 rillig 1418: <p>To build packages from source, you need a working C
1.88 wiz 1419: compiler. On NetBSD, you need to install the
1.128 wiz 1420: <span class="quote">“<span class="quote">comp</span>”</span> and the <span class="quote">“<span class="quote">text</span>”</span> distribution
1.88 wiz 1421: sets. If you want to build X11-related packages, the
1.128 wiz 1422: <span class="quote">“<span class="quote">xbase</span>”</span> and <span class="quote">“<span class="quote">xcomp</span>”</span> distribution
1.88 wiz 1423: sets are required, too.</p>
1.75 rillig 1424: </div>
1.148 asau 1425: <div class="sect2">
1.75 rillig 1426: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1427: <a name="fetching-distfiles"></a>5.2.2. Fetching distfiles</h3></div></div></div>
1.75 rillig 1428: <p>The first step for building a package is downloading the
1.88 wiz 1429: distfiles (i.e. the unmodified source). If they have not yet been
1430: downloaded, pkgsrc will fetch them automatically.</p>
1431: <p>If you have all files that you need in the
1432: <code class="filename">distfiles</code> directory,
1433: you don't need to connect. If the distfiles are on CD-ROM, you can
1434: mount the CD-ROM on <code class="filename">/cdrom</code> and add:
1435: </p>
1.82 rillig 1436: <pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre>
1437: <p>
1.110 hubertf 1438: to your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.91 rillig 1439: <p>By default a list of distribution sites will be randomly
1440: intermixed to prevent huge load on servers which holding popular
1441: packages (for example, SourceForge.net mirrors). Thus, every
1442: time when you need to fetch yet another distfile all the mirrors
1443: will be tried in new (random) order. You can turn this feature
1444: off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for
1445: <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p>
1.88 wiz 1446: <p>You can overwrite some of the major distribution sites to
1447: fit to sites that are close to your own. By setting one or two
1448: variables you can modify the order in which the master sites are
1449: accessed. <code class="varname">MASTER_SORT</code> contains a whitespace
1450: delimited list of domain suffixes.
1451: <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it
1452: contains a whitespace delimited list of regular expressions. It
1453: has higher priority than <code class="varname">MASTER_SORT</code>. Have a
1454: look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find
1455: some examples. This may save some of your bandwidth and
1456: time.</p>
1.75 rillig 1457: <p>You can change these settings either in your shell's environment, or,
1.88 wiz 1458: if you want to keep the settings, by editing the
1.110 hubertf 1459: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file,
1.88 wiz 1460: and adding the definitions there.</p>
1.82 rillig 1461: <p>
1.88 wiz 1462: If a package depends on many other packages (such as
1.250 leot 1463: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a>), the build process may
1.88 wiz 1464: alternate between periods of
1465: downloading source, and compiling. To ensure you have all the source
1466: downloaded initially you can run the command:
1467: </p>
1.82 rillig 1468: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre>
1469: <p>
1.88 wiz 1470: which will output and run a set of shell commands to fetch the
1471: necessary files into the <code class="filename">distfiles</code> directory. You can
1472: also choose to download the files manually.
1473: </p>
1.75 rillig 1474: </div>
1.148 asau 1475: <div class="sect2">
1.75 rillig 1476: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1477: <a name="how-to-build-and-install"></a>5.2.3. How to build and install</h3></div></div></div>
1.82 rillig 1478: <p>
1.88 wiz 1479: Once the software has downloaded, any patches will be applied, then it
1480: will be compiled for you. This may take some time depending on your
1481: computer, and how many other packages the software depends on and their
1482: compile time.
1483: </p>
1.148 asau 1484: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 1485: <h3 class="title">Note</h3>
1486: <p>If using bootstrap or pkgsrc on a non-NetBSD system,
1.110 hubertf 1487: use the pkgsrc <span class="command"><strong>bmake</strong></span> command instead of
1.128 wiz 1488: <span class="quote">“<span class="quote">make</span>”</span> in the examples in this guide.</p>
1.75 rillig 1489: </div>
1.87 wiz 1490: <p>For example, type</p>
1.88 wiz 1491: <pre class="screen">
1492: <code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
1493: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
1494: </pre>
1.75 rillig 1495: <p>at the shell prompt to build the various components of the
1.88 wiz 1496: package.</p>
1.82 rillig 1497: <p>The next stage is to actually install the newly compiled
1.88 wiz 1498: program onto your system. Do this by entering:
1.82 rillig 1499:
1.88 wiz 1500: </p>
1.82 rillig 1501: <pre class="screen">
1.88 wiz 1502: <code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong>
1503: </pre>
1.82 rillig 1504: <p>
1505:
1.88 wiz 1506: while you are still in the directory for whatever package you
1507: are installing.</p>
1.82 rillig 1508: <p>Installing the package on your system may require you to
1.88 wiz 1509: be root. However, pkgsrc has a
1510: <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you
1511: to only become root for the actual installation step.</p>
1.82 rillig 1512: <p>That's it, the software should now be installed and setup for use.
1.88 wiz 1513: You can now enter:
1.82 rillig 1514:
1.88 wiz 1515: </p>
1.82 rillig 1516: <pre class="screen">
1.88 wiz 1517: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong>
1518: </pre>
1.82 rillig 1519: <p>
1520:
1.88 wiz 1521: to remove the compiled files in the work directory, as you shouldn't need
1522: them any more. If other packages were also added to your system
1523: (dependencies) to allow your program to compile, you can tidy these up
1524: also with the command:</p>
1.82 rillig 1525: <pre class="screen">
1.88 wiz 1526: <code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong>
1527: </pre>
1.75 rillig 1528: <p>Taking the figlet utility as an example, we can install it on our
1.110 hubertf 1529: system by building as shown in <a class="xref" href="#logs" title="Appendix B. Build logs">Appendix B, <i>Build logs</i></a>.</p>
1.88 wiz 1530: <p>The program is installed under the default root of the
1531: packages tree - <code class="filename">/usr/pkg</code>. Should this not
1532: conform to your tastes, set the <code class="varname">LOCALBASE</code>
1533: variable in your environment, and it will use that value as the
1534: root of your packages tree. So, to use
1535: <code class="filename">/usr/local</code>, set
1536: <code class="varname">LOCALBASE=/usr/local</code> in your environment.
1537: Please note that you should use a directory which is dedicated to
1538: packages and not shared with other programs (i.e., do not try and
1539: use <code class="varname">LOCALBASE=/usr</code>). Also, you should not try
1540: to add any of your own files or directories (such as
1541: <code class="filename">src/</code>, <code class="filename">obj/</code>, or
1542: <code class="filename">pkgsrc/</code>) below the
1543: <code class="varname">LOCALBASE</code> tree. This is to prevent possible
1544: conflicts between programs and other files installed by the
1545: package system and whatever else may have been installed
1546: there.</p>
1.110 hubertf 1547: <p>Some packages look in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.88 wiz 1548: alter some configuration options at build time. Have a look at
1549: <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview
1550: of what will be set there by default. Environment variables such
1551: as <code class="varname">LOCALBASE</code> can be set in
1.110 hubertf 1552: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to save having to remember to
1.88 wiz 1553: set them each time you want to use pkgsrc.</p>
1.128 wiz 1554: <p>Occasionally, people want to <span class="quote">“<span class="quote">look under the
1555: covers</span>”</span> to see what is going on when a package is building
1.88 wiz 1556: or being installed. This may be for debugging purposes, or out of
1557: simple curiosity. A number of utility values have been added to
1558: help with this.</p>
1.128 wiz 1559: <div class="orderedlist"><ol class="orderedlist" type="1">
1560: <li class="listitem">
1.270 ! leot 1561: <p>If you invoke the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with
1.88 wiz 1562: <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of
1563: information will be displayed. For example,</p>
1.75 rillig 1564: <pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre>
1.88 wiz 1565: <p>will show all the commands that are invoked, up to and
1.128 wiz 1566: including the <span class="quote">“<span class="quote">patch</span>”</span> stage.</p>
1.75 rillig 1567: </li>
1.128 wiz 1568: <li class="listitem">
1.270 ! leot 1569: <p>If you want to know the value of a certain <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.88 wiz 1570: definition, then the <code class="varname">VARNAME</code> definition
1571: should be used, in conjunction with the show-var
1.270 ! leot 1572: target. e.g. to show the expansion of the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.88 wiz 1573: variable <code class="varname">LOCALBASE</code>:</p>
1574: <pre class="screen">
1575: <code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.75 rillig 1576: /usr/pkg
1577: <code class="prompt">%</code>
1.88 wiz 1578: </pre>
1.75 rillig 1579: </li>
1580: </ol></div>
1581: <p>If you want to install a binary package that you've either
1.88 wiz 1582: created yourself (see next section), that you put into
1583: pkgsrc/packages manually or that is located on a remote FTP
1584: server, you can use the "bin-install" target. This target will
1.270 ! leot 1585: install a binary package - if available - via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>,
1.110 hubertf 1586: else do a <span class="command"><strong>make package</strong></span>. The list of remote FTP
1.88 wiz 1587: sites searched is kept in the variable
1588: <code class="varname">BINPKG_SITES</code>, which defaults to
1.270 ! leot 1589: ftp.NetBSD.org. Any flags that should be added to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>
1.88 wiz 1590: can be put into <code class="varname">BIN_INSTALL_FLAGS</code>. See
1591: <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more
1592: details.</p>
1593: <p>A final word of warning: If you set up a system that has a
1594: non-standard setting for <code class="varname">LOCALBASE</code>, be sure to
1595: set that before any packages are installed, as you cannot use
1596: several directories for the same purpose. Doing so will result in
1597: pkgsrc not being able to properly detect your installed packages,
1598: and fail miserably. Note also that precompiled binary packages are
1599: usually built with the default <code class="varname">LOCALBASE</code> of
1600: <code class="filename">/usr/pkg</code>, and that you should
1601: <span class="emphasis"><em>not</em></span> install any if you use a non-standard
1602: <code class="varname">LOCALBASE</code>.</p>
1.75 rillig 1603: </div>
1604: </div>
1605: </div>
1.148 asau 1606: <div class="chapter">
1.75 rillig 1607: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 1608: <a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div>
1.75 rillig 1609: <div class="toc">
1610: <p><b>Table of Contents</b></p>
1.210 leot 1611: <dl class="toc">
1.267 rillig 1612: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
1613: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
1614: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
1615: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1616: <dd><dl>
1617: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
1618: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
1619: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 1620: </dl></dd>
1.267 rillig 1621: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
1622: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75 rillig 1623: </dl>
1624: </div>
1.104 rillig 1625: <a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1.89 rillig 1626: called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
1627: that file depends on the installation. On NetBSD, when you use
1.270 ! leot 1628: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory
1.89 rillig 1629: <code class="filename">/etc/</code>. In all other cases the default location is
1630: <code class="literal">${PREFIX}/etc/</code>, depending on where you told the
1631: bootstrap program to install the binary packages.</p>
1632: <p>The format of the configuration file is that of the usual
1633: BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
1634: is done by setting variables in this file. Note that you can define all
1635: kinds of variables, and no special error checking (for example for
1.223 rillig 1636: spelling mistakes) takes place.</p>
1.148 asau 1637: <div class="sect1">
1.75 rillig 1638: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1639: <a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1.223 rillig 1640: <p>The following variables apply to all
1.89 rillig 1641: pkgsrc packages. A complete list of the variables that can be
1642: configured by the user is available in
1643: <code class="filename">mk/defaults/mk.conf</code>, together with some
1644: comments that describe each variable's intent.</p>
1.148 asau 1645: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1646: <li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1.75 rillig 1647: packages will be installed. The default is
1.76 rillig 1648: <code class="filename">/usr/pkg</code>. Do not mix binary packages
1.75 rillig 1649: with different <code class="varname">LOCALBASE</code>s!</p></li>
1.128 wiz 1650: <li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
1651: <span class="quote">“<span class="quote">cross</span>”</span> category packages will be
1.75 rillig 1652: installed. The default is
1.76 rillig 1653: <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1.128 wiz 1654: <li class="listitem"><p><code class="varname">X11BASE</code>: Where
1.75 rillig 1655: X11 is installed on the system. The default is
1.194 bsiegert 1656: <code class="filename">/usr/X11R7</code>.</p></li>
1.128 wiz 1657: <li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1.75 rillig 1658: downloaded copies of the original source distributions used
1659: for building pkgsrc packages. The default is
1.76 rillig 1660: <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1.128 wiz 1661: <li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1.97 rillig 1662: database about installed packages is stored. The default is
1.230 sevan 1663: <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1.128 wiz 1664: <li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1.75 rillig 1665: If set, override the packages'
1666: <code class="varname">MASTER_SITES</code> with this value.</p></li>
1.128 wiz 1667: <li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1.75 rillig 1668: Backup location(s) for distribution files and patch files
1669: if not found locally or in
1.76 rillig 1670: <code class="filename">${MASTER_SITES}</code> or
1671: <code class="filename">${PATCH_SITES}</code> respectively.
1.230 sevan 1672: The defaults is
1673: <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1.128 wiz 1674: <li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1.93 rillig 1675: List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
1676: <em class="replaceable"><code>arch</code></em> are replaced with OS
1.128 wiz 1677: release (<span class="quote">“<span class="quote">2.0</span>”</span>, etc.) and architecture
1678: (<span class="quote">“<span class="quote">mipsel</span>”</span>, etc.).</p></li>
1679: <li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1.125 wiz 1680: List of acceptable licenses. License names are case-sensitive.
1681: Whenever you try to build a package whose license is not in this
1682: list, you will get an error message. If the license condition is
1683: simple enough, the error message will include specific
1684: instructions on how to change this variable.</p></li>
1.75 rillig 1685: </ul></div>
1686: </div>
1.148 asau 1687: <div class="sect1">
1.75 rillig 1688: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1689: <a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1.219 rillig 1690: <p>
1.75 rillig 1691: </p>
1.148 asau 1692: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1693: <li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1.75 rillig 1694: directory for the binary packages. The default is
1.76 rillig 1695: <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1.128 wiz 1696: <li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1.75 rillig 1697: The top level directory where, if defined, the separate
1698: working directories will get created, and symbolically
1.76 rillig 1699: linked to from <code class="filename">${WRKDIR}</code> (see below).
1.75 rillig 1700: This is useful for building packages on several
1.76 rillig 1701: architectures, then <code class="filename">${PKGSRCDIR}</code>
1702: can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
1.75 rillig 1703: is local to every architecture. (It should be noted that
1704: <code class="varname">PKGSRCDIR</code> should not be set by the user
1.126 jakllsch 1705: — it is an internal definition which refers to the
1.75 rillig 1706: root of the pkgsrc tree. It is possible to have many
1707: pkgsrc tree instances.)</p></li>
1.128 wiz 1708: <li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1.75 rillig 1709: Directory for local patches that aren't part of pkgsrc.
1.267 rillig 1710: See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, “<code class="filename">patches/*</code>”</a> for more
1.93 rillig 1711: information.</p></li>
1.128 wiz 1712: <li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1.110 hubertf 1713: the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1.75 rillig 1714: BSD-style Makefile. If this is not set,
1715: <code class="varname">MAKECONF</code> is set to
1.76 rillig 1716: <code class="filename">/dev/null</code> to avoid picking up
1717: settings used by builds in <code class="filename">/usr/src</code>.</p></li>
1.75 rillig 1718: </ul></div>
1719: </div>
1.148 asau 1720: <div class="sect1">
1.75 rillig 1721: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1722: <a name="variables-affecting-installation"></a>6.3. Variables affecting the installation process</h2></div></div></div>
1.256 maya 1723: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGSRC</code>:
1724: By default, binary packages of built packages are
1.263 leot 1725: preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1.256 maya 1726: this variable to "no" prevents this.</p></li></ul></div>
1.217 jnemeth 1727: <p>Packages have to support installation into a
1.103 wiz 1728: subdirectory of <code class="varname">WRKDIR</code>. This allows a package
1729: to be built, before the actual filesystem is touched. DESTDIR
1730: support exists in two variations:</p>
1.148 asau 1731: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1732: <li class="listitem"><p>Basic DESTDIR support means that the package
1.131 wiz 1733: installation and packaging is still run as root.</p></li>
1734: <li class="listitem"><p>Full DESTDIR support can run the complete
1735: build, installation and packaging as normal user. Root
1736: privileges are only needed to add packages.</p></li>
1737: </ul></div>
1.103 wiz 1738: <p>With basic DESTDIR support, <strong class="userinput"><code>make
1739: clean</code></strong> needs to be run as root.</p>
1.118 imil 1740: <p>Considering the <code class="filename">foo/bar</code> package,
1741: DESTDIR full support can be tested using the following commands
1742:
1743: </p>
1744: <pre class="programlisting">
1745: <code class="prompt">$</code> id
1746: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1747: <code class="prompt">$</code> mkdir $HOME/packages
1748: <code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
1749: </pre>
1750: <p>
1751:
1752: Verify <code class="varname">DESTDIR</code> full support, no root privileges
1753: should be needed
1754:
1755: </p>
1756: <pre class="programlisting">
1.174 asau 1757: <code class="prompt">$</code> make stage-install
1.118 imil 1758: </pre>
1759: <p>
1760:
1761: Create a package without root privileges
1762:
1763: </p>
1764: <pre class="programlisting">
1.174 asau 1765: <code class="prompt">$</code> make PACKAGES=$HOME/packages package
1.118 imil 1766: </pre>
1767: <p>
1768:
1769: For the following command, you must be able to gain root
1.270 ! leot 1770: privileges using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a>
1.118 imil 1771:
1772: </p>
1773: <pre class="programlisting">
1.174 asau 1774: <code class="prompt">$</code> make PACKAGES=$HOME/packages install
1.118 imil 1775: </pre>
1776: <p>
1777:
1778: Then, as a simple user
1779:
1780: </p>
1781: <pre class="programlisting">
1782: <code class="prompt">$</code> make clean
1783: </pre>
1784: <p>
1785:
1786: </p>
1.103 wiz 1787: </div>
1.148 asau 1788: <div class="sect1">
1.103 wiz 1789: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1790: <a name="conf.compiler"></a>6.4. Selecting and configuring the compiler</h2></div></div></div>
1.148 asau 1791: <div class="sect2">
1.78 rillig 1792: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1793: <a name="selecting-the-compiler"></a>6.4.1. Selecting the compiler</h3></div></div></div>
1.89 rillig 1794: <p>By default, pkgsrc will use GCC to build packages. This may be
1795: overridden by setting the following variables in /etc/mk.conf:</p>
1.148 asau 1796: <div class="variablelist"><dl class="variablelist">
1.89 rillig 1797: <dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
1798: <dd>
1799: <p>This is a list of values specifying the chain of
1800: compilers to invoke when building packages. Valid values
1801: are:</p>
1.148 asau 1802: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.174 asau 1803: <li class="listitem"><p><code class="varname">ccc</code>:
1804: Compaq C Compilers (Tru64)</p></li>
1805: <li class="listitem"><p><code class="varname">ccache</code>:
1806: compiler cache (chainable)</p></li>
1807: <li class="listitem"><p><code class="varname">clang</code>:
1808: Clang C and Objective-C compiler</p></li>
1.128 wiz 1809: <li class="listitem"><p><code class="varname">distcc</code>:
1.89 rillig 1810: distributed C/C++ (chainable)</p></li>
1.174 asau 1811: <li class="listitem"><p><code class="varname">f2c</code>:
1812: Fortran 77 to C compiler (chainable)</p></li>
1813: <li class="listitem"><p><code class="varname">icc</code>:
1814: Intel C++ Compiler (Linux)</p></li>
1815: <li class="listitem"><p><code class="varname">ido</code>:
1816: SGI IRIS Development Option cc (IRIX 5)</p></li>
1.128 wiz 1817: <li class="listitem"><p><code class="varname">gcc</code>:
1.89 rillig 1818: GNU C/C++ Compiler</p></li>
1.174 asau 1819: <li class="listitem"><p><code class="varname">hp</code>:
1820: HP-UX C/aC++ compilers</p></li>
1.128 wiz 1821: <li class="listitem"><p><code class="varname">mipspro</code>:
1.89 rillig 1822: Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1.174 asau 1823: <li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1.89 rillig 1824: Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1.128 wiz 1825: <li class="listitem"><p><code class="varname">sunpro</code>:
1.89 rillig 1826: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1.174 asau 1827: <li class="listitem"><p><code class="varname">xlc</code>:
1.230 sevan 1828: IBM's XL C/C++ compiler suite</p></li>
1.89 rillig 1829: </ul></div>
1830: <p>The default is
1.128 wiz 1831: <span class="quote">“<span class="quote"><code class="varname">gcc</code></span>”</span>. You can use
1.89 rillig 1832: <code class="varname">ccache</code> and/or
1833: <code class="varname">distcc</code> with an appropriate
1834: <code class="varname">PKGSRC_COMPILER</code> setting,
1.128 wiz 1835: e.g. <span class="quote">“<span class="quote"><code class="varname">ccache gcc</code></span>”</span>. This
1.94 dmcmahil 1836: variable should always be terminated with a value for
1837: a real compiler. Note that only one real compiler
1.128 wiz 1838: should be listed (e.g. <span class="quote">“<span class="quote"><code class="varname">sunpro gcc</code></span>”</span>
1.94 dmcmahil 1839: is not allowed).</p>
1.89 rillig 1840: </dd>
1841: <dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
1842: <dd><p>This specifies the minimum version of GCC to use
1843: when building packages. If the system GCC doesn't
1844: satisfy this requirement, then pkgsrc will build and
1845: install one of the GCC packages to use instead.</p></dd>
1.266 leot 1846: <dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1.225 maya 1847: <dd><p>Specifies which version of python to use when several
1848: options are available.</p></dd>
1849: <dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1850: <dd><p>Specifies the fortran compiler to use.
1851: The default is <code class="varname">g95</code>, and
1852: <code class="varname">gfortran</code> is an alternative.</p></dd>
1853: <dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
1854: <dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
1855: <code class="varname">gfortran</code> is used, this option specifies which
1856: version to use.</p></dd>
1.89 rillig 1857: </dl></div>
1858: </div>
1.148 asau 1859: <div class="sect2">
1.89 rillig 1860: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1861: <a name="conf.cflags"></a>6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1.78 rillig 1862: <p>If you wish to set the <code class="varname">CFLAGS</code> variable,
1863: please make sure to use the <code class="literal">+=</code> operator
1864: instead of the <code class="literal">=</code> operator:</p>
1865: <pre class="programlisting">
1.100 rillig 1866: CFLAGS+= -your -flags
1.78 rillig 1867: </pre>
1868: <p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1.128 wiz 1869: <span class="quote">“<span class="quote">+</span>”</span>) may lead to problems with packages that
1.117 jnemeth 1870: need to add their own flags. You may want to take a look
1.250 leot 1871: at the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/README.html" target="_top"><code class="filename">devel/cpuflags</code></a>
1.128 wiz 1872: package if you're interested in optimization specifically
1873: for the current CPU. </p>
1.78 rillig 1874: </div>
1.148 asau 1875: <div class="sect2">
1.88 wiz 1876: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 1877: <a name="conf.ldflags"></a>6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1.88 wiz 1878: <p>If you want to pass flags to the linker, both in the configure
1879: step and the build step, you can do this in two ways. Either set
1880: <code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>. The difference
1881: between the two is that <code class="varname">LIBS</code> will be appended to
1882: the command line, while <code class="varname">LDFLAGS</code> come earlier.
1883: <code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
1884: machines depending on the setting of <code class="varname">USE_IMAKE</code> or
1885: the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>. As with
1886: <code class="varname">CFLAGS</code>, if you do not wish to override these
1887: settings, use the <code class="literal">+=</code> operator:</p>
1888: <pre class="programlisting">
1.100 rillig 1889: LDFLAGS+= -your -linkerflags
1.88 wiz 1890: </pre>
1891: </div>
1.78 rillig 1892: </div>
1.148 asau 1893: <div class="sect1">
1.78 rillig 1894: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1895: <a name="developer-advanced-settings"></a>6.5. Developer/advanced settings</h2></div></div></div>
1.194 bsiegert 1896: <p>
1.75 rillig 1897: </p>
1.148 asau 1898: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1899: <li class="listitem">
1.75 rillig 1900: <p><code class="varname">PKG_DEVELOPER</code>:
1901: Run some sanity checks that package developers want:
1902: </p>
1.148 asau 1903: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1.128 wiz 1904: <li class="listitem"><p>make sure patches apply with zero
1.88 wiz 1905: fuzz</p></li>
1.128 wiz 1906: <li class="listitem"><p>run check-shlibs to see that all
1.88 wiz 1907: binaries will find their shared libs.</p></li>
1.75 rillig 1908: </ul></div>
1909: <p>
1.87 wiz 1910: </p>
1.75 rillig 1911: </li>
1.128 wiz 1912: <li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1.88 wiz 1913: of debugging output which is displayed whilst making and
1914: installing the package. The default value for this is 0,
1915: which will not display the commands as they are executed
1916: (normal, default, quiet operation); the value 1 will display
1917: all shell commands before their invocation, and the value 2
1918: will display both the shell commands before their invocation,
1.223 rillig 1919: as well as their actual execution progress with <span class="command"><strong>set
1920: -x</strong></span>.</p></li>
1.75 rillig 1921: </ul></div>
1922: <p>
1923: </p>
1924: </div>
1.148 asau 1925: <div class="sect1">
1.75 rillig 1926: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1927: <a name="selecting-build-options"></a>6.6. Selecting Build Options</h2></div></div></div>
1.88 wiz 1928: <p>Some packages have build time options, usually to select
1929: between different dependencies, enable optional support for big
1930: dependencies or enable experimental features.</p>
1.75 rillig 1931: <p>To see which options, if any, a package supports, and which
1.110 hubertf 1932: options are mutually exclusive, run <span class="command"><strong>make
1.88 wiz 1933: show-options</strong></span>, for example:</p>
1.75 rillig 1934: <pre class="programlisting">
1935: The following options are supported by this package:
1936: ssl Enable SSL support.
1937: Exactly one of the following gecko options is required:
1938: firefox Use firefox as gecko rendering engine.
1939: mozilla Use mozilla as gecko rendering engine.
1940: At most one of the following database options may be selected:
1941: mysql Enable support for MySQL database.
1942: pgsql Enable support for PostgreSQL database.
1.1 grant 1943:
1.75 rillig 1944: These options are enabled by default: firefox
1945: These options are currently enabled: mozilla ssl
1.1 grant 1946: </pre>
1.75 rillig 1947: <p>The following variables can be defined in
1.110 hubertf 1948: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1.88 wiz 1949: enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
1950: which can be used to select or disable options for all packages
1951: that support them, and
1952: <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
1953: which can be used to select or disable options specifically for
1954: package <em class="replaceable"><code>pkgbase</code></em>. Options listed in
1.128 wiz 1955: these variables are selected, options preceded by <span class="quote">“<span class="quote">-</span>”</span>
1.88 wiz 1956: are disabled. A few examples:</p>
1.75 rillig 1957: <pre class="screen">
1.110 hubertf 1958: <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 1959: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1960: PKG_OPTIONS.kdebase= debug -sasl
1961: PKG_OPTIONS.apache= suexec </pre>
1.111 rillig 1962: <p>It is important to note that options that were specifically
1.120 snj 1963: suggested by the package maintainer must be explicitly removed if
1.111 rillig 1964: you do not wish to include the option. If you are unsure you can view
1965: the current state with <span class="command"><strong>make show-options</strong></span>.</p>
1.88 wiz 1966: <p>The following settings are consulted in the order given, and
1967: the last setting that selects or disables an option is
1968: used:</p>
1.128 wiz 1969: <div class="orderedlist"><ol class="orderedlist" type="1">
1970: <li class="listitem"><p>the default options as suggested by the package
1.88 wiz 1971: maintainer</p></li>
1.128 wiz 1972: <li class="listitem"><p>the options implied by the settings of legacy
1.88 wiz 1973: variables (see below)</p></li>
1.128 wiz 1974: <li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
1975: <li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
1.75 rillig 1976: </ol></div>
1977: <p>For groups of mutually exclusive options, the last option
1.88 wiz 1978: selected is used, all others are automatically disabled. If an
1979: option of the group is explicitly disabled, the previously
1980: selected option, if any, is used. It is an error if no option
1981: from a required group of options is selected, and building the
1982: package will fail.</p>
1983: <p>Before the options framework was introduced, build options
1984: were selected by setting a variable (often named
1985: <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
1.110 hubertf 1986: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option. To ease
1.88 wiz 1987: transition to the options framework for the user, these legacy
1988: variables are converted to the appropriate options setting
1989: (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
1990: automatically. A warning is issued to prompt the user to update
1.110 hubertf 1991: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
1.88 wiz 1992: directly. Support for the legacy variables will be removed
1993: eventually.</p>
1.75 rillig 1994: </div>
1995: </div>
1.148 asau 1996: <div class="chapter">
1.75 rillig 1997: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 1998: <a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div>
1.75 rillig 1999: <div class="toc">
2000: <p><b>Table of Contents</b></p>
1.210 leot 2001: <dl class="toc">
1.267 rillig 2002: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
2003: <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 2004: </dl>
2005: </div>
1.148 asau 2006: <div class="sect1">
1.75 rillig 2007: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2008: <a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div>
1.87 wiz 2009: <p>Once you have built and installed a package, you can create
2010: a <span class="emphasis"><em>binary package</em></span> which can be installed on
1.270 ! leot 2011: another system with <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. This saves having to build
1.87 wiz 2012: the same package on a group of hosts and wasting CPU time. It also
2013: provides a simple means for others to install your package, should
2014: you distribute it.</p>
2015: <p>To create a binary package, change into the appropriate
1.110 hubertf 2016: directory in pkgsrc, and run <span class="command"><strong>make
1.87 wiz 2017: package</strong></span>:</p>
2018: <pre class="screen">
1.223 rillig 2019: <code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
2020: <code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong>
2021: </pre>
1.87 wiz 2022: <p>This will build and install your package (if not already done),
2023: and then build a binary package from what was installed. You can
1.110 hubertf 2024: then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate
1.87 wiz 2025: it. Binary packages are created by default in
2026: <code class="filename">/usr/pkgsrc/packages</code>, in the form of a
1.110 hubertf 2027: gzipped tar file. See <a class="xref" href="#logs.package" title="B.2. Packaging figlet">Section B.2, “Packaging figlet”</a> for a
1.250 leot 2028: continuation of the above <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/misc/figlet/README.html" target="_top"><code class="filename">misc/figlet</code></a> example.</p>
1.267 rillig 2029: <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 2030: such a binary package.</p>
1.75 rillig 2031: </div>
1.148 asau 2032: <div class="sect1">
1.75 rillig 2033: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2034: <a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div>
2035: <p>See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, “Other helpful targets”</a>.</p>
1.106 rillig 2036: </div>
2037: </div>
1.148 asau 2038: <div class="chapter">
1.106 rillig 2039: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2040: <a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
1.106 rillig 2041: builds)</h2></div></div></div>
2042: <div class="toc">
2043: <p><b>Table of Contents</b></p>
1.210 leot 2044: <dl class="toc">
1.267 rillig 2045: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
2046: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt>
2047: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
2048: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
2049: <dt><span class="sect1"><a href="#creating-cdroms">8.4. Creating a multiple CD-ROM packages collection</a></span></dt>
2050: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.4.1. Example of cdpack</a></span></dt></dl></dd>
1.106 rillig 2051: </dl>
2052: </div>
1.180 wiz 2053: <p>For a number of reasons you may want to build binary packages
2054: for a large selected set of packages in pkgsrc or even for all pkgsrc packages.
2055: For instance, when you have multiple machines that should run the same software,
2056: it is wasted time if they all build their packages themselves from source.
2057: Or you may want to build a list of packages you want and check them before
2058: deploying onto production system.
2059: There is a way of getting a set of binary packages:
1.223 rillig 2060: The bulk build system, or pbulk ("p" stands for "parallel").
2061: This chapter describes how to set it up.</p>
1.148 asau 2062: <div class="sect1">
1.106 rillig 2063: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2064: <a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div>
1.180 wiz 2065: <p>First of all, you have to decide whether you build all packages
2066: or a limited set of them. Full bulk builds usually consume a lot more resources,
2067: both space and time, than builds for some practical sets of packages.
2068: There exists a number of particularly heavy packages that are not actually
2069: interesting to a wide audience.
2070:
2071: For a limited bulk builds you need to make a list of packages you want to build.
1.223 rillig 2072: Note that all their dependencies will be built, so you don't need to track them manually.
1.180 wiz 2073: </p>
2074: <p>During bulk builds various packages are installed and deinstalled
2075: in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is),
2076: so make sure that you don't need any package during the builds.
1.223 rillig 2077: Essentially, you should provide a fresh system, either a chroot environment
1.180 wiz 2078: or something even more restrictive, depending on what the operating system provides,
2079: or dedicate the whole physical machine.
2080: As a useful side effect this makes sure that bulk builds cannot
2081: break anything in your system. There have been numerous cases where
1.106 rillig 2082: certain packages tried to install files outside the
2083: <code class="filename">LOCALBASE</code> or wanted to edit some files in
1.180 wiz 2084: <code class="filename">/etc</code>.
2085: </p>
1.106 rillig 2086: </div>
1.148 asau 2087: <div class="sect1">
1.106 rillig 2088: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2089: <a name="bulk.pbulk"></a>8.2. Running a pbulk-style bulk build</h2></div></div></div>
1.116 rillig 2090: <p>Running a pbulk-style bulk build works roughly as follows:</p>
1.148 asau 2091: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2092: <li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li>
2093: <li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li>
1.116 rillig 2094: </ul></div>
1.148 asau 2095: <div class="sect2">
1.116 rillig 2096: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 2097: <a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div>
1.223 rillig 2098: <p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p>
1.178 asau 2099: <p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine).
2100: Configure network access to fetch distribution files.
1.223 rillig 2101: Create a user with name "pbulk".</p>
1.178 asau 2102: <p>Fetch and extract pkgsrc. Use a command like one of these:</p>
2103: <pre class="screen">
1.264 sevan 2104: <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>
2105: <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 2106: <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 2107: </pre>
2108: <p>Or any other way that fits (e.g., curl, wget).</p>
2109: <p>Deploy and configure pbulk tools, e.g.:</p>
2110: <pre class="screen">
1.230 sevan 2111: <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 2112: <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>
2113: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong>
2114: </pre>
2115: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2116: <h3 class="title">Note</h3>
2117: <p><code class="filename">mk.conf.frag</code> is a fragment of
2118: <code class="filename">mk.conf</code> that contains settings you want to
2119: apply to packages you build. For instance,</p>
2120: <pre class="programlisting">
1.223 rillig 2121: PKG_DEVELOPER= yes # perform more checks
2122: X11_TYPE= modular # use pkgsrc X11
2123: SKIP_LICENSE_CHECK= yes # accept all licences (useful
2124: # when building all packages)
1.178 asau 2125: </pre>
2126: </div>
2127: <p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code>
1.223 rillig 2128: with your list of packages, one per line without empty lines or comments. E.g.:</p>
1.178 asau 2129: <pre class="programlisting">
2130: www/firefox
2131: mail/thunderbird
2132: misc/libreoffice4
2133: </pre>
1.179 asau 2134: <p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code>
2135: and make final amendments, if wanted.</p>
1.178 asau 2136: <p>Start it:</p>
2137: <pre class="screen">
2138: <code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong>
2139: </pre>
2140: <p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports,
2141: plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code>
2142: </p>
2143: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2144: <h3 class="title">Note</h3>
2145: <p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases.
2146: While being ready to run, it serves as a good starting point to understand and build more complex setups.
2147: The script is kept small enough for better understanding.</p>
2148: </div>
2149: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2150: <h3 class="title">Note</h3>
2151: <p>The <code class="filename">pbulk.sh</code> script supports running
2152: unprivileged bulk build and helps configuring distributed bulk builds.</p>
2153: </div>
1.106 rillig 2154: </div>
2155: </div>
1.148 asau 2156: <div class="sect1">
1.106 rillig 2157: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2158: <a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div>
1.180 wiz 2159: <p>A complete bulk build requires lots of disk space. Some of the
2160: disk space can be read-only, some other must be writable. Some can be on
2161: remote filesystems (such as NFS) and some should be local. Some can be
2162: temporary filesystems, others must survive a sudden reboot.</p>
2163: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2164: <li class="listitem"><p>40 GB for the distfiles (read-write, remote, temporary)</p></li>
2165: <li class="listitem"><p>30 GB for the binary packages (read-write, remote, permanent)</p></li>
2166: <li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li>
2167: <li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li>
2168: <li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li>
2169: <li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li>
2170: </ul></div>
2171: </div>
2172: <div class="sect1">
2173: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2174: <a name="creating-cdroms"></a>8.4. Creating a multiple CD-ROM packages collection</h2></div></div></div>
1.87 wiz 2175: <p>After your pkgsrc bulk-build has completed, you may wish to
2176: create a CD-ROM set of the resulting binary packages to assist
2177: in installing packages on other machines. The
1.250 leot 2178: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/cdpack/README.html" target="_top"><code class="filename">pkgtools/cdpack</code></a> package provides
1.87 wiz 2179: a simple tool for creating the ISO 9660 images.
1.110 hubertf 2180: <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a
1.87 wiz 2181: way that keeps all the dependencies for a given package on the same
2182: CD as that package.</p>
1.148 asau 2183: <div class="sect2">
1.75 rillig 2184: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 2185: <a name="cdpack-example"></a>8.4.1. Example of cdpack</h3></div></div></div>
1.87 wiz 2186: <p>Complete documentation for cdpack is found in the cdpack(1)
2187: man page. The following short example assumes that the binary
2188: packages are left in
2189: <code class="filename">/usr/pkgsrc/packages/All</code> and that
2190: sufficient disk space exists in <code class="filename">/u2</code> to
2191: hold the ISO 9660 images.</p>
2192: <pre class="screen">
2193: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong>
1.75 rillig 2194: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
1.87 wiz 2195: <code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
2196: </pre>
2197: <p>If you wish to include a common set of files
2198: (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>,
2199: etc.) on each CD in the collection, then you need to create a
2200: directory which contains these files. e.g.</p>
2201: <pre class="screen">
2202: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong>
1.75 rillig 2203: <code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
2204: <code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
2205: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong>
2206: <code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
2207: <code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
1.87 wiz 2208: <code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
2209: </pre>
1.75 rillig 2210: <p>Now create the images:</p>
2211: <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 2212: <p>Each image will contain <code class="filename">README</code>,
1.87 wiz 2213: <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code>
2214: in their root directories.</p>
1.75 rillig 2215: </div>
2216: </div>
2217: </div>
1.148 asau 2218: <div class="chapter">
1.75 rillig 2219: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2220: <a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div>
1.90 rillig 2221: <div class="toc">
2222: <p><b>Table of Contents</b></p>
1.210 leot 2223: <dl class="toc">
1.267 rillig 2224: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
2225: <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 2226: </dl>
2227: </div>
2228: <p>The files that are installed by pkgsrc are organized in a way that
2229: is similar to what you find in the <code class="filename">/usr</code> directory
2230: of the base system. But some details are different. This is because
2231: pkgsrc initially came from FreeBSD and had adopted its file system
2232: hierarchy. Later it was largely influenced by NetBSD. But no matter
2233: which operating system you are using pkgsrc with, you can expect the
2234: same layout for pkgsrc.</p>
1.91 rillig 2235: <p>There are mainly four root directories for pkgsrc, which are all
2236: configurable in the <code class="filename">bootstrap/bootstrap</code> script.
2237: When pkgsrc has been installed as root, the default locations
2238: are:</p>
2239: <pre class="programlisting">
1.100 rillig 2240: LOCALBASE= /usr/pkg
2241: PKG_SYSCONFBASE= /usr/pkg/etc
2242: VARBASE= /var
1.231 sevan 2243: PKG_DBDIR= /usr/pkg/pkgdb
1.91 rillig 2244: </pre>
2245: <p>In unprivileged mode (when pkgsrc has been installed as any other
2246: user), the default locations are:</p>
2247: <pre class="programlisting">
1.100 rillig 2248: LOCALBASE= ${HOME}/pkg
2249: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2250: VARBASE= ${HOME}/pkg/var
1.231 sevan 2251: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.91 rillig 2252: </pre>
2253: <p>What these four directories are for, and what they look like is
2254: explained below.</p>
1.148 asau 2255: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2256: <li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the
1.90 rillig 2257: <code class="filename">/usr</code> directory in the base system. It is the
1.128 wiz 2258: <span class="quote">“<span class="quote">main</span>”</span> directory where the files are installed and contains
1.90 rillig 2259: the well-known subdirectories like <code class="filename">bin</code>,
2260: <code class="filename">include</code>, <code class="filename">lib</code>,
2261: <code class="filename">share</code> and
2262: <code class="filename">sbin</code>.</p></li>
1.128 wiz 2263: <li class="listitem"><p><code class="varname">VARBASE</code> corresponds to
1.90 rillig 2264: <code class="filename">/var</code> in the base system. Some programs (especially
2265: games, network daemons) need write access to it during normal
2266: operation.</p></li>
1.128 wiz 2267: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to
1.90 rillig 2268: <code class="filename">/etc</code> in the base system. It contains configuration
1.110 hubertf 2269: 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 2270: itself.</p></li>
2271: </ul></div>
1.148 asau 2272: <div class="sect1">
1.90 rillig 2273: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2274: <a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code>
1.93 rillig 2275: </h2></div></div></div>
1.90 rillig 2276: <p>The following directories exist in a typical pkgsrc installation
1.91 rillig 2277: in <code class="filename">${LOCALBASE}</code>.</p>
1.148 asau 2278: <div class="variablelist"><dl class="variablelist">
1.90 rillig 2279: <dt><span class="term"><code class="filename">bin</code></span></dt>
2280: <dd><p>Contains executable programs that are intended to be
2281: directly used by the end user.</p></dd>
2282: <dt><span class="term"><code class="filename">emul</code></span></dt>
2283: <dd><p>Contains files for the emulation layers of various other
2284: operating systems, especially for
2285: NetBSD.</p></dd>
2286: <dt><span class="term"><code class="filename">etc</code> (the usual location of
2287: <code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt>
2288: <dd><p>Contains
2289: the configuration files.</p></dd>
2290: <dt><span class="term"><code class="filename">include</code></span></dt>
2291: <dd><p>Contains headers for the C and C++ programming
2292: languages.</p></dd>
2293: <dt><span class="term"><code class="filename">info</code></span></dt>
2294: <dd><p>Contains GNU info files of various
2295: packages.</p></dd>
2296: <dt><span class="term"><code class="filename">lib</code></span></dt>
2297: <dd><p>Contains shared and static
2298: libraries.</p></dd>
2299: <dt><span class="term"><code class="filename">libdata</code></span></dt>
2300: <dd><p>Contains data files that don't change after
2301: installation. Other data files belong into
2302: <code class="filename">${VARBASE}</code>.</p></dd>
2303: <dt><span class="term"><code class="filename">libexec</code></span></dt>
2304: <dd><p>Contains programs that are not intended to be used by
2305: end users, such as helper programs or network
2306: daemons.</p></dd>
2307: <dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt>
2308: <dd><p>Contains programs that are intended to be executed as
2309: CGI scripts by a web server.</p></dd>
2310: <dt><span class="term"><code class="filename">man</code> (the usual value of
2311: <code class="filename">${PKGMANDIR}</code>)</span></dt>
2312: <dd><p>Contains brief
2313: documentation in form of manual pages.</p></dd>
2314: <dt><span class="term"><code class="filename">sbin</code></span></dt>
2315: <dd><p>Contains programs that are intended to be used only by
2316: the super-user.</p></dd>
2317: <dt><span class="term"><code class="filename">share</code></span></dt>
2318: <dd><p>Contains platform-independent data files that don't
2319: change after installation.</p></dd>
2320: <dt><span class="term"><code class="filename">share/doc</code></span></dt>
2321: <dd><p>Contains documentation files provided by the
2322: packages.</p></dd>
2323: <dt><span class="term"><code class="filename">share/examples</code></span></dt>
2324: <dd><p>Contains example files provided by the packages. Among
2325: others, the original configuration files are saved here and copied to
2326: <code class="filename">${PKG_SYSCONFDIR}</code> during
2327: installation.</p></dd>
2328: <dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt>
2329: <dd><p>Contains the original files for rc.d
2330: scripts.</p></dd>
2331: <dt><span class="term"><code class="filename">var</code> (the usual location of
2332: <code class="filename">${VARBASE}</code>)</span></dt>
2333: <dd><p>Contains files
2334: that may be modified after
2335: installation.</p></dd>
2336: </dl></div>
2337: </div>
1.148 asau 2338: <div class="sect1">
1.90 rillig 2339: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2340: <a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code>
1.93 rillig 2341: </h2></div></div></div>
1.148 asau 2342: <div class="variablelist"><dl class="variablelist">
1.90 rillig 2343: <dt><span class="term"><code class="filename">db/pkg</code> (the usual location of
2344: <code class="filename">${PKG_DBDIR}</code>)</span></dt>
2345: <dd><p>Contains
2346: information about the currently installed
2347: packages.</p></dd>
2348: <dt><span class="term"><code class="filename">games</code></span></dt>
2349: <dd><p>Contains highscore
2350: files.</p></dd>
2351: <dt><span class="term"><code class="filename">log</code></span></dt>
2352: <dd><p>Contains log files.</p></dd>
2353: <dt><span class="term"><code class="filename">run</code></span></dt>
2354: <dd><p>Contains informational files about daemons that are
2355: currently running.</p></dd>
2356: </dl></div>
2357: </div>
2358: </div>
1.148 asau 2359: <div class="chapter">
1.90 rillig 2360: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2361: <a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div>
1.75 rillig 2362: <div class="toc">
2363: <p><b>Table of Contents</b></p>
1.210 leot 2364: <dl class="toc">
1.267 rillig 2365: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
2366: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
2367: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
2368: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
2369: <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>
2370: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
2371: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
2372: <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>
2373: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
2374: <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 2375: /usr/share/tmac/tmac.andoc</span>”</span> mean?</a></span></dt>
1.267 rillig 2376: <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>
2377: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
2378: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
2379: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
2380: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
2381: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
2382: <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 2383: </dl>
2384: </div>
2385: <p>This section contains hints, tips & tricks on special things in
2386: pkgsrc that we didn't find a better place for in the previous chapters, and
2387: it contains items for both pkgsrc users and developers.</p>
1.148 asau 2388: <div class="sect1">
1.75 rillig 2389: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2390: <a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div>
1.75 rillig 2391: <p>The following mailing lists may be of interest to pkgsrc users:</p>
1.148 asau 2392: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2393: <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 2394: This is a general purpose list for most issues regarding
2395: pkgsrc, regardless of platform, e.g. soliciting user help
2396: for pkgsrc configuration, unexpected build failures, using
2397: particular packages, upgrading pkgsrc installations,
2398: questions regarding the pkgsrc release branches, etc. General announcements or
2399: proposals for changes that impact the pkgsrc user community,
2400: e.g. major infrastructure changes, new features, package
2401: removals, etc., may also be posted.</p></li>
1.128 wiz 2402: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bulk" target="_top">pkgsrc-bulk</a>:
1.75 rillig 2403: A list where the results of pkgsrc bulk builds are sent and
2404: discussed.</p></li>
1.128 wiz 2405: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-changes" target="_top">pkgsrc-changes</a>:
1.75 rillig 2406: This list is for those who are interested in getting a
2407: commit message for every change committed to pkgsrc. It is
2408: also available in digest form, meaning one daily message
2409: containing all commit messages for changes to the package
2410: source tree in that 24 hour period.</p></li>
2411: </ul></div>
2412: <p>To subscribe, do:</p>
2413: <pre class="programlisting">
1.100 rillig 2414: <code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.75 rillig 2415: </pre>
2416: <p>Archives for all these mailing lists are available from
1.110 hubertf 2417: <a class="ulink" href="http://mail-index.NetBSD.org/" target="_top">http://mail-index.NetBSD.org/</a>.</p>
1.75 rillig 2418: </div>
1.148 asau 2419: <div class="sect1">
1.75 rillig 2420: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2421: <a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div>
1.80 rillig 2422: <p>The directory <code class="filename">pkgsrc/pkgtools</code> contains
1.75 rillig 2423: a number of useful utilities for both users and developers of pkgsrc. This
1.233 sevan 2424: section attempts only to make the reader aware of some of the utilities and when
1.75 rillig 2425: they might be useful, and not to duplicate the documentation that comes
2426: with each package.</p>
2427: <p>Utilities used by pkgsrc (automatically installed when needed):</p>
1.250 leot 2428: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/x11-links/README.html" target="_top"><code class="filename">pkgtools/x11-links</code></a>:
1.75 rillig 2429: Symlinks for use by buildlink.</p></li></ul></div>
2430: <p>OS tool augmentation (automatically installed when needed):</p>
1.148 asau 2431: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 2432: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/digest/README.html" target="_top"><code class="filename">pkgtools/digest</code></a>:
1.233 sevan 2433: Calculates various kinds of checksums (including SHA3).</p></li>
1.250 leot 2434: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libnbcompat/README.html" target="_top"><code class="filename">pkgtools/libnbcompat</code></a>:
1.75 rillig 2435: Compatibility library for pkgsrc tools.</p></li>
1.250 leot 2436: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/README.html" target="_top"><code class="filename">pkgtools/mtree</code></a>: Installed on
1.87 wiz 2437: non-BSD systems due to lack of native mtree.</p></li>
1.250 leot 2438: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>:
1.75 rillig 2439: Up-to-date replacement for
1.76 rillig 2440: <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating
1.75 rillig 2441: systems where pkg_install is not present.</p></li>
2442: </ul></div>
2443: <p>Utilities used by pkgsrc (not automatically installed):</p>
1.148 asau 2444: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 2445: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a>:
1.75 rillig 2446: Create a binary package from an
1.110 hubertf 2447: already-installed package. Used by <span class="command"><strong>make replace</strong></span> to
1.75 rillig 2448: save the old package.</p></li>
1.250 leot 2449: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/dfdisk/README.html" target="_top"><code class="filename">pkgtools/dfdisk</code></a>:
1.75 rillig 2450: Adds extra functionality to pkgsrc, allowing it to fetch distfiles
2451: from multiple locations. It currently supports the following
2452: methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li>
1.250 leot 2453: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/README.html" target="_top"><code class="filename">devel/cpuflags</code></a>: Determine
1.117 jnemeth 2454: the best compiler flags to optimise code for your current
1.128 wiz 2455: CPU and compiler. </p></li>
1.75 rillig 2456: </ul></div>
2457: <p>Utilities for keeping track of installed packages, being up to date,
2458: etc:</p>
1.148 asau 2459: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 2460: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgin/README.html" target="_top"><code class="filename">pkgtools/pkgin</code></a>: A package
1.173 wiz 2461: update tool similar to apt(1). Download, install, and upgrade
2462: binary packages easily.</p></li>
1.250 leot 2463: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a>: Reports on
1.75 rillig 2464: packages whose installed versions do not match the latest pkgsrc
2465: entries.</p></li>
1.250 leot 2466: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/README.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a>: Makes
1.75 rillig 2467: dependency graphs of packages, to aid in choosing a strategy for
2468: updating.</p></li>
1.250 leot 2469: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdepgraph/README.html" target="_top"><code class="filename">pkgtools/pkgdepgraph</code></a>: Makes
2470: graphs from the output of <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/README.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a> (uses graphviz).</p></li>
2471: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>: The
1.112 weinem 2472: pkglint(1) program checks a pkgsrc entry for errors.</p></li>
1.250 leot 2473: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/README.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a>: The lintpkgsrc(1) program
1.75 rillig 2474: does various checks on the complete pkgsrc system.</p></li>
1.250 leot 2475: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgsurvey/README.html" target="_top"><code class="filename">pkgtools/pkgsurvey</code></a>: Report what
1.75 rillig 2476: packages you have installed.</p></li>
2477: </ul></div>
2478: <p>Utilities for people maintaining or creating individual packages:</p>
1.148 asau 2479: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 2480: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>: Automate
1.75 rillig 2481: making and maintaining patches for a package (includes pkgdiff,
2482: pkgvi, mkpatches, etc.).</p></li>
1.250 leot 2483: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>: Aids in
1.75 rillig 2484: converting to pkgsrc.</p></li>
2485: </ul></div>
2486: <p>Utilities for people maintaining pkgsrc (or: more obscure pkg
2487: utilities)</p>
1.148 asau 2488: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 2489: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_comp/README.html" target="_top"><code class="filename">pkgtools/pkg_comp</code></a>: Build
1.75 rillig 2490: packages in a chrooted area.</p></li>
1.250 leot 2491: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libkver/README.html" target="_top"><code class="filename">pkgtools/libkver</code></a>: Spoof
1.75 rillig 2492: kernel version for chrooted cross builds.</p></li>
2493: </ul></div>
2494: </div>
1.148 asau 2495: <div class="sect1">
1.75 rillig 2496: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2497: <a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div>
1.219 rillig 2498: <p>To install packages from source as a non-root user, download
1.267 rillig 2499: 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 2500: directory and run the command <span class="command"><strong>./bootstrap/bootstrap
2501: --unprivileged</strong></span>.</p>
2502: <p>This will install the binary part of pkgsrc to
2503: <code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
2504: into <code class="filename">~/pkg/etc</code>.</p>
2505: <p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
1.75 rillig 2506: </div>
1.148 asau 2507: <div class="sect1">
1.75 rillig 2508: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2509: <a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
1.75 rillig 2510: <p>By default, resuming transfers in pkgsrc is disabled, but you can
2511: enable this feature by adding the option
2512: <code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
1.110 hubertf 2513: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete
1.75 rillig 2514: distfile is found, pkgsrc will try to resume it.</p>
2515: <p>You can also
1.168 wiz 2516: use a different program than the platform default program by changing the
1.117 jnemeth 2517: <code class="varname">FETCH_USING</code> variable. You can specify the program by
2518: using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled
2519: by using the value manual. A value of custom disables the system defaults
2520: and dependency tracking for the fetch program. In that case you have to
2521: provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>,
2522: <code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>,
2523: <code class="varname">FETCH_AFTER_ARGS</code>.</p>
1.75 rillig 2524: <p>For example, if you want to use
1.117 jnemeth 2525: <code class="filename">wget</code> to download, you'll have to use something
1.75 rillig 2526: like:</p>
2527: <pre class="programlisting">
1.223 rillig 2528: FETCH_USING= wget
1.1 grant 2529: </pre>
1.75 rillig 2530: </div>
1.148 asau 2531: <div class="sect1">
1.75 rillig 2532: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2533: <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 2534: <p>If you want to use modular X.org from pkgsrc instead of your system's own X11
1.76 rillig 2535: (<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...)
1.75 rillig 2536: you will have to add the following line into
1.110 hubertf 2537: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.75 rillig 2538: <pre class="programlisting">
1.103 wiz 2539: X11_TYPE=modular
1.1 grant 2540: </pre>
1.75 rillig 2541: </div>
1.148 asau 2542: <div class="sect1">
1.75 rillig 2543: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2544: <a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div>
1.75 rillig 2545: <p>If you are sitting behind a firewall which does not allow direct
2546: connections to Internet hosts (i.e. non-NAT), you may specify the
2547: relevant proxy hosts. This is done using an environment variable in the
2548: form of a URL, e.g. in Amdahl, the machine
1.128 wiz 2549: <span class="quote">“<span class="quote">orpheus.amdahl.com</span>”</span> is one of the firewalls, and it uses
1.75 rillig 2550: port 80 as the proxy port number. So the proxy environment variables
2551: are:</p>
2552: <pre class="programlisting">
1.100 rillig 2553: ftp_proxy=ftp://orpheus.amdahl.com:80/
2554: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 2555: </pre>
1.75 rillig 2556: </div>
1.148 asau 2557: <div class="sect1">
1.75 rillig 2558: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2559: <a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div>
1.173 wiz 2560: <p>Some fetch tools are not prepared to support HTTPS by default
2561: (for example, the one in NetBSD 6.0), or the one installed by the
2562: pkgsrc bootstrap (to avoid an openssl dependency that low in the
2563: dependency graph).</p>
2564: <p>Usually you won't notice, because distribution files are
2565: mirrored weekly to <span class="quote">“<span class="quote">ftp.NetBSD.org</span>”</span>, but that might not
2566: be often enough if you are following pkgsrc-current. In that case, set
2567: <code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to
2568: <span class="quote">“<span class="quote">curl</span>”</span> or <span class="quote">“<span class="quote">wget</span>”</span>, which are both compiled
2569: with HTTPS support by default. Of course, these tools need to be
2570: installed before you can use them this way.</p>
2571: </div>
2572: <div class="sect1">
2573: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2574: <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 2575: <p>This depends on which utility is used to retrieve distfiles. From
1.76 rillig 2576: <code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned
1.75 rillig 2577: the first available command from the following list:</p>
1.148 asau 2578: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2579: <li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li>
2580: <li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li>
1.75 rillig 2581: </ul></div>
2582: <p>On a default NetBSD installation, this will be
1.76 rillig 2583: <code class="filename">/usr/bin/ftp</code>, which automatically tries passive
1.75 rillig 2584: connections first, and falls back to active connections if the server
2585: refuses to do passive. For the other tools, add the following to your
1.110 hubertf 2586: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file:
1.75 rillig 2587: <code class="varname">PASSIVE_FETCH=1</code>.</p>
2588: <p>Having that option present will prevent
1.76 rillig 2589: <code class="filename">/usr/bin/ftp</code> from falling back to active
1.75 rillig 2590: transfers.</p>
2591: </div>
1.148 asau 2592: <div class="sect1">
1.75 rillig 2593: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2594: <a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div>
1.88 wiz 2595: <p>You would like to download all the distfiles in a single batch
1.110 hubertf 2596: from work or university, where you can't run a <span class="command"><strong>make
1.132 spz 2597: 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 2598: but downloading the entire directory may not be appropriate.</p>
1.110 hubertf 2599: <p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in
1.76 rillig 2600: <code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the
1.75 rillig 2601: resulting list to your machine at work/school and use it there. If you
1.270 ! leot 2602: don't have a NetBSD-compatible <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a> (like tnftp) at work, don't
1.75 rillig 2603: forget to set <code class="varname">FETCH_CMD</code> to something that fetches a
2604: URL:</p>
2605: <p>At home:</p>
2606: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
2607: <code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
2608: <code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre>
2609: <p>At work:</p>
2610: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre>
1.76 rillig 2611: <p>then tar up <code class="filename">/tmp/distfiles</code> and take it
1.75 rillig 2612: home.</p>
2613: <p>If you have a machine running NetBSD, and you want to get
1.88 wiz 2614: <span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your
2615: machine architecture), you can do so by using the above-mentioned
1.110 hubertf 2616: <span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles
1.88 wiz 2617: directly by running:</p>
1.75 rillig 2618: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre>
2619: <p>If you even decide to ignore
2620: <code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything
2621: by running:</p>
2622: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre>
2623: </div>
1.148 asau 2624: <div class="sect1">
1.75 rillig 2625: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2626: <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 2627: /usr/share/tmac/tmac.andoc</span>”</span> mean?</h2></div></div></div>
1.250 leot 2628: <p>When compiling the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>
1.75 rillig 2629: package, you get the error from make that it doesn't know how to make
1.76 rillig 2630: <code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that
1.128 wiz 2631: you don't have installed the <span class="quote">“<span class="quote">text</span>”</span> set (nroff, ...) from
1.75 rillig 2632: the NetBSD base distribution on your machine. It is recommended to do
2633: that to format man pages.</p>
1.250 leot 2634: <p>In the case of the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package, you
1.75 rillig 2635: can get away with setting <code class="varname">NOMAN=YES</code> either in the
1.110 hubertf 2636: environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75 rillig 2637: </div>
1.148 asau 2638: <div class="sect1">
1.75 rillig 2639: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2640: <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 2641: <p>You didn't install the compiler set, <code class="filename">comp.tgz</code>,
1.75 rillig 2642: when you installed your NetBSD machine. Please get and install it, by
1.76 rillig 2643: extracting it in <code class="filename">/</code>:</p>
1.75 rillig 2644: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong>
2645: <code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre>
1.76 rillig 2646: <p><code class="filename">comp.tgz</code> is part of every NetBSD release. Get
1.110 hubertf 2647: the one that corresponds to your release (determine via <span class="command"><strong>uname
1.75 rillig 2648: -r</strong></span>).</p>
2649: </div>
1.148 asau 2650: <div class="sect1">
1.75 rillig 2651: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2652: <a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' with pkgsrc</h2></div></div></div>
1.75 rillig 2653: <p>When installing packages as non-root user and using the just-in-time
1.270 ! leot 2654: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-8.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 2655: password for each required package installed. To avoid this, the sudo
2656: package can be used, which does password caching over a limited time. To
2657: use it, install sudo (either as binary package or from
1.250 leot 2658: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/sudo/README.html" target="_top"><code class="filename">security/sudo</code></a>) and then put the
1.110 hubertf 2659: following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere
1.98 wiz 2660: <span class="emphasis"><em>after</em></span> the definition of the
2661: <code class="varname">LOCALBASE</code> variable:</p>
1.75 rillig 2662: <pre class="programlisting">
1.100 rillig 2663: .if exists(${LOCALBASE}/bin/sudo)
2664: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2665: .endif
1.1 grant 2666: </pre>
1.75 rillig 2667: </div>
1.148 asau 2668: <div class="sect1">
1.75 rillig 2669: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2670: <a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div>
1.75 rillig 2671: <p>As the system administrator, you can choose where configuration files
2672: are installed. The default settings make all these files go into
1.76 rillig 2673: <code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may
1.75 rillig 2674: be suboptimal depending on your expectations (e.g., a read-only,
2675: NFS-exported <code class="varname">PREFIX</code> with a need of per-machine
2676: configuration of the provided packages).</p>
2677: <p>In order to change the defaults, you can modify the
2678: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.110 hubertf 2679: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration
1.76 rillig 2680: directory; some common examples include <code class="filename">/etc</code> or
2681: <code class="filename">/etc/pkg</code>.</p>
1.75 rillig 2682: <p>Furthermore, you can change this value on a per-package basis by
2683: setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable.
2684: <code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the
2685: package you would like to modify, that is, the contents of
2686: <code class="varname">PKGBASE</code>.</p>
2687: <p>Note that after changing these settings, you must rebuild and
2688: reinstall any affected packages.</p>
2689: </div>
1.148 asau 2690: <div class="sect1">
1.75 rillig 2691: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2692: <a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div>
1.75 rillig 2693: <p>Please be aware that there can often be bugs in third-party software,
2694: and some of these bugs can leave a machine vulnerable to exploitation by
2695: attackers. In an effort to lessen the exposure, the NetBSD packages team
2696: maintains a database of known-exploits to packages which have at one time
2697: been included in pkgsrc. The database can be downloaded automatically, and
2698: a security audit of all packages installed on a system can take place. To
1.114 jmcneill 2699: do this, refer to the following two tools (installed as part of the
1.250 leot 2700: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package):</p>
1.128 wiz 2701: <div class="orderedlist"><ol class="orderedlist" type="1">
2702: <li class="listitem">
1.122 reed 2703: <p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to
1.75 rillig 2704: download a list of the security vulnerabilities information. This list
1.132 spz 2705: is kept up to date by the pkgsrc security team, and is distributed
2706: from the NetBSD ftp server:</p>
2707: <p><a class="ulink" href="ftp://ftp.NetBSD.org/pkgsrc/distfiles/pkg-vulnerabilities" target="_top">ftp://ftp.NetBSD.org/pkgsrc/distfiles/pkg-vulnerabilities</a></p>
1.75 rillig 2708: </li>
1.128 wiz 2709: <li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the
2710: current machine, checking each known vulnerability. If a
1.75 rillig 2711: vulnerable package is installed, it will be shown by output to stdout,
2712: including a description of the type of vulnerability, and a URL
2713: containing more information.</p></li>
2714: </ol></div>
1.233 sevan 2715: <p>Use of these tools is strongly recommended!
1.267 rillig 2716: See <a class="xref" href="#vulnerabilities" title="5.1.5. Checking for security vulnerabilities in installed packages">Section 5.1.5, “Checking for security vulnerabilities in installed packages”</a> for instructions on how to automate checking and
1.233 sevan 2717: reporting.</p>
2718: <p>If this database is installed, pkgsrc builds will use it to
2719: perform a security check before building any package.</p>
1.75 rillig 2720: </div>
1.148 asau 2721: <div class="sect1">
1.75 rillig 2722: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2723: <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 2724: <p>When you add your own preferences to the
2725: <code class="varname">CFLAGS</code> variable in your
1.110 hubertf 2726: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in
1.76 rillig 2727: environment variables to the <code class="filename">./configure</code>
1.270 ! leot 2728: scripts and to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>. Some package authors ignore the
1.75 rillig 2729: <code class="varname">CFLAGS</code> from the environment variable by
1.76 rillig 2730: overriding them in the <code class="filename">Makefile</code>s of their
1.75 rillig 2731: package.</p>
2732: <p>Currently there is no solution to this problem. If you
2733: really need the package to use your <code class="varname">CFLAGS</code>
1.110 hubertf 2734: you should run <span class="command"><strong>make patch</strong></span> in the package
1.76 rillig 2735: directory and then inspect any <code class="filename">Makefile</code> and
2736: <code class="filename">Makefile.in</code> for whether they define
1.75 rillig 2737: <code class="varname">CFLAGS</code> explicitly. Usually you can remove
1.128 wiz 2738: these lines. But be aware that some <span class="quote">“<span class="quote">smart</span>”</span>
1.75 rillig 2739: programmers write so bad code that it only works for the
2740: specific combination of <code class="varname">CFLAGS</code> they have
2741: chosen.</p>
2742: </div>
1.148 asau 2743: <div class="sect1">
1.80 rillig 2744: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2745: <a name="ufaq-fail"></a>10.16. A package does not build. What shall I do?</h2></div></div></div>
1.128 wiz 2746: <div class="procedure"><ol class="procedure" type="1">
1.148 asau 2747: <li class="step"><p>Make sure that your copy of pkgsrc is consistent. A
1.80 rillig 2748: case that occurs often is that people only update pkgsrc in
2749: parts, because of performance reasons. Since pkgsrc is one large
2750: system, not a collection of many small systems, there are
2751: sometimes changes that only work when the whole pkgsrc tree is
2752: updated.</p></li>
1.148 asau 2753: <li class="step"><p>Make sure that you don't have any CVS conflicts.
1.128 wiz 2754: Search for <span class="quote">“<span class="quote"><<<<<<</span>”</span> or
2755: <span class="quote">“<span class="quote">>>>>>></span>”</span> in all your pkgsrc
1.80 rillig 2756: files.</p></li>
1.148 asau 2757: <li class="step"><p>Make sure that you don't have old copies of the packages
1.110 hubertf 2758: extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to
1.80 rillig 2759: verify this.</p></li>
1.218 rillig 2760: <li class="step"><p>If you are a package developer who wants to invest
1.267 rillig 2761: 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 2762: <li class="step"><p>If the problem still exists, write a mail to the
1.80 rillig 2763: <code class="literal">pkgsrc-users</code> mailing list.</p></li>
2764: </ol></div>
2765: </div>
1.148 asau 2766: <div class="sect1">
1.88 wiz 2767: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2768: <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 2769: <p>You have modified a file from pkgsrc, and someone else has
2770: modified that same file afterwards in the CVS repository. Both changes
2771: are in the same region of the file, so when you updated pkgsrc, the
2772: <code class="literal">cvs</code> command marked the conflicting changes in the
2773: file. Because of these markers, the file is no longer a valid
2774: <code class="filename">Makefile</code>.</p>
2775: <p>Have a look at that file, and if you don't need your local changes
1.110 hubertf 2776: anymore, you can remove that file and run <span class="command"><strong>cvs -q update
1.89 rillig 2777: -dP</strong></span> in that directory to download the current version.</p>
2778: </div>
1.75 rillig 2779: </div>
2780: </div>
1.148 asau 2781: <div class="part">
1.75 rillig 2782: <div class="titlepage"><div><div><h1 class="title">
2783: <a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div>
1.148 asau 2784: <div class="partintro">
1.77 rillig 2785: <div></div>
2786: <p>This part of the book deals with creating and
1.128 wiz 2787: modifying packages. It starts with a <span class="quote">“<span class="quote">HOWTO</span>”</span>-like
1.77 rillig 2788: guide on creating a new package. The remaining chapters are more
2789: like a reference manual for pkgsrc.</p>
1.75 rillig 2790: <div class="toc">
2791: <p><b>Table of Contents</b></p>
1.210 leot 2792: <dl class="toc">
1.267 rillig 2793: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
2794: <dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
1.91 rillig 2795: <dd><dl>
1.267 rillig 2796: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.91 rillig 2797: <dd><dl>
1.267 rillig 2798: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
2799: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.91 rillig 2800: </dl></dd>
1.267 rillig 2801: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
2802: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.106 rillig 2803: </dl></dd>
1.267 rillig 2804: <dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
1.106 rillig 2805: <dd><dl>
1.267 rillig 2806: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
2807: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
2808: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
1.106 rillig 2809: <dd><dl>
1.267 rillig 2810: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
2811: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
2812: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
2813: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
2814: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
1.106 rillig 2815: </dl></dd>
1.267 rillig 2816: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
2817: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
1.106 rillig 2818: <dd><dl>
1.267 rillig 2819: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
2820: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
2821: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.106 rillig 2822: </dl></dd>
1.267 rillig 2823: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
2824: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.106 rillig 2825: </dl></dd>
1.267 rillig 2826: <dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106 rillig 2827: <dd><dl>
1.267 rillig 2828: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
2829: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
2830: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
2831: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
1.106 rillig 2832: <dd><dl>
1.267 rillig 2833: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
2834: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
2835: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
2836: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.106 rillig 2837: </dl></dd>
2838: </dl></dd>
1.267 rillig 2839: <dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
1.106 rillig 2840: <dd><dl>
1.267 rillig 2841: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
2842: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
2843: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
2844: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
2845: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
2846: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
2847: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
2848: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
2849: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.106 rillig 2850: </dl></dd>
1.267 rillig 2851: <dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
1.106 rillig 2852: <dd><dl>
1.267 rillig 2853: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
2854: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 2855: <dd><dl>
1.267 rillig 2856: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
2857: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.133 wiz 2858: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
2859: and
2860: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
2861: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 2862: </dl></dd>
1.267 rillig 2863: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.106 rillig 2864: <dd><dl>
1.267 rillig 2865: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
2866: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.106 rillig 2867: </dl></dd>
2868: </dl></dd>
1.267 rillig 2869: <dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
1.106 rillig 2870: <dd><dl>
1.267 rillig 2871: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
2872: <dd><dl>
2873: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
2874: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
2875: </dl></dd>
2876: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
2877: <dd><dl>
2878: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
2879: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
2880: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
2881: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
2882: </dl></dd>
2883: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
2884: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
2885: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
2886: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
2887: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
2888: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
2889: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
2890: </dl></dd>
2891: <dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
2892: <dd><dl>
2893: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
2894: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
2895: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
2896: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
2897: </dl></dd>
2898: <dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
2899: <dd><dl>
2900: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
2901: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
2902: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
2903: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
2904: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
2905: <dd><dl>
2906: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
2907: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
2908: </dl></dd>
2909: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
2910: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
2911: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
2912: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
2913: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
2914: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
2915: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
2916: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
2917: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
2918: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
2919: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
2920: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
2921: </dl></dd>
2922: <dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
2923: <dd><dl>
2924: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
2925: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
2926: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
2927: </dl></dd>
2928: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
2929: <dd><dl>
2930: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
2931: <dd><dl>
2932: <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>
2933: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
2934: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
2935: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
2936: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
2937: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
2938: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
2939: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
2940: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
2941: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
2942: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
2943: </dl></dd>
2944: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
2945: <dd><dl>
2946: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
2947: <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>
2948: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
2949: </dl></dd>
2950: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
2951: <dd><dl>
2952: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
2953: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
2954: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
2955: </dl></dd>
2956: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
2957: <dd><dl>
2958: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
2959: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
2960: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
2961: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
2962: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
2963: </dl></dd>
2964: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
2965: <dd><dl>
2966: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
2967: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
2968: <dt><span class="sect2"><a href="#undefined-reference">21.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
2969: <dt><span class="sect2"><a href="#out-of-memory">21.5.4. Running out of memory</a></span></dt>
2970: </dl></dd>
2971: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
2972: <dd><dl>
2973: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
2974: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
2975: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
2976: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
2977: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
2978: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
2979: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
2980: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
2981: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
2982: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
2983: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
2984: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
2985: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
2986: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
2987: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
2988: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
2989: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
2990: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.87 wiz 2991: emulation</a></span></dt>
1.267 rillig 2992: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
2993: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.77 rillig 2994: </dl></dd>
1.267 rillig 2995: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77 rillig 2996: </dl></dd>
1.267 rillig 2997: <dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
2998: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77 rillig 2999: <dd><dl>
1.267 rillig 3000: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
3001: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
3002: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
3003: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
3004: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
3005: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
3006: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
3007: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
3008: </dl></dd>
3009: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
3010: <dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
3011: <dd><dl>
3012: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
3013: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
3014: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
3015: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.85 jmmv 3016: </dl></dd>
1.75 rillig 3017: </dl>
3018: </div>
1.77 rillig 3019: </div>
1.148 asau 3020: <div class="chapter">
1.77 rillig 3021: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 3022: <a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div>
3023: <p>
3024: To get help when developing pkgsrc, the definitive source is this
3025: document, the pkgsrc guide. If you don't find anything here,
3026: there are alternatives:
3027: </p>
3028: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3029: <li class="listitem">
3030: <p>
3031: The built-in pkgsrc help, which is available after bootstrapping
3032: pkgsrc. Run <span class="command"><strong>bmake help topic=…</strong></span> to get
3033: help for any topic, such as a variable name like
3034: <code class="varname">BUILD_DEFS</code>, a make target like
3035: <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
3036: <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
3037: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix D. Help topics">Appendix D, <i>Help topics</i></a>.</p>
3038: </li>
3039: <li class="listitem"><p>
3040: The tech-pkg mailing list, to which
3041: <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you
3042: can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your
3043: questions</a>.</p></li>
3044: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
3045: <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
3046: or by using a specialized chat program such as
3047: <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
3048: Pick any user name and join the channel #pkgsrc.</p></li>
3049: </ul></div>
3050: </div>
3051: <div class="chapter">
3052: <div class="titlepage"><div><div><h2 class="title">
3053: <a name="creating"></a>Chapter 12. Creating a new pkgsrc package from scratch</h2></div></div></div>
1.91 rillig 3054: <div class="toc">
3055: <p><b>Table of Contents</b></p>
1.210 leot 3056: <dl class="toc">
1.267 rillig 3057: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.91 rillig 3058: <dd><dl>
1.267 rillig 3059: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
3060: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.91 rillig 3061: </dl></dd>
1.267 rillig 3062: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
3063: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.91 rillig 3064: </dl>
3065: </div>
1.77 rillig 3066: <p>When you find a package that is not yet in pkgsrc, you
1.91 rillig 3067: most likely have a URL from where you can download the source
3068: code. Starting with this URL, creating a package involves only a
3069: few steps.</p>
1.128 wiz 3070: <div class="procedure"><ol class="procedure" type="1">
1.250 leot 3071: <li class="step"><p>First, install the packages <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>.</p></li>
1.148 asau 3072: <li class="step"><p>Then, choose one of the top-level directories as the
1.91 rillig 3073: category in which you want to place your package. You can also create a
3074: directory of your own (maybe called <code class="filename">local</code>). In that
3075: category directory, create another directory for your package and change
3076: into it.</p></li>
1.148 asau 3077: <li class="step"><p>Run the program <span class="command"><strong>url2pkg</strong></span>, which will ask
1.91 rillig 3078: you for a URL. Enter the URL of the distribution file (in most cases a
3079: <code class="filename">.tar.gz</code> file) and watch how the basic ingredients
3080: of your package are created automatically. The distribution file is
3081: extracted automatically to fill in some details in the
3082: <code class="filename">Makefile</code> that would otherwise have to be done
3083: manually.</p></li>
1.148 asau 3084: <li class="step">
1.91 rillig 3085: <p>Examine the extracted files to determine the dependencies of
3086: your package. Ideally, this is mentioned in some
3087: <code class="filename">README</code> file, but things may differ. For each of
3088: these dependencies, look where it exists in pkgsrc, and if there is a
3089: file called <code class="filename">buildlink3.mk</code> in that directory, add a
3090: line to your package <code class="filename">Makefile</code> which includes that
3091: file just before the last line. If the
1.132 spz 3092: <code class="filename">buildlink3.mk</code> file does not exist, it must be
3093: created first. The <code class="filename">buildlink3.mk</code> file makes sure that the package's include files and libraries are provided.</p>
3094: <p>If you just need binaries from a package, add a
1.91 rillig 3095: <code class="varname">DEPENDS</code> line to the Makefile, which specifies the
3096: version of the dependency and where it can be found in pkgsrc. This line
3097: should be placed in the third paragraph. If the dependency is only
3098: needed for building the package, but not when using it, use
1.269 leot 3099: <code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
3100: instead of <code class="varname">DEPENDS</code>.
3101: The difference between <code class="varname">TOOL_DEPENDS</code> and
3102: <code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
3103: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
3104: packages, i.e. packages for the architecture where the package
3105: is built;
3106: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
3107: packages, i.e. packages for the architecture for which the package
3108: is built.
1.91 rillig 3109: Your package may then look like this:</p>
1.77 rillig 3110: <pre class="programlisting">
1.100 rillig 3111: [...]
1.77 rillig 3112:
1.269 leot 3113: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
1.100 rillig 3114: DEPENDS+= screen-[0-9]*:../../misc/screen
3115: DEPENDS+= screen>=4.0:../../misc/screen
1.77 rillig 3116:
1.100 rillig 3117: [...]
1.77 rillig 3118:
1.100 rillig 3119: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
3120: .include "../../devel/glib2/buildlink3.mk"
3121: .include "../../mk/bsd.pkg.mk"
1.77 rillig 3122: </pre>
3123: </li>
1.148 asau 3124: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
1.128 wiz 3125: to be done to make your package a <span class="quote">“<span class="quote">good</span>”</span> one. If you don't
1.110 hubertf 3126: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
3127: --explain</strong></span> or <span class="command"><strong>pkglint
1.91 rillig 3128: -e</strong></span>, which outputs additional
3129: explanations.</p></li>
1.148 asau 3130: <li class="step"><p>In many cases the package is not yet ready to build. You can
1.267 rillig 3131: find instructions for the most common cases in the next section, <a class="xref" href="#creating.common" title="12.1. Common types of packages">Section 12.1, “Common types of packages”</a>. After you have followed the instructions
1.91 rillig 3132: over there, you can hopefully continue here.</p></li>
1.148 asau 3133: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
1.91 rillig 3134: directory from the extracted files. Besides these files, a lot of cache
3135: files and other system information has been saved in the working
3136: directory, which may become wrong after you edited the
3137: <code class="filename">Makefile</code>.</p></li>
1.148 asau 3138: <li class="step"><p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
1.267 rillig 3139: the various things that can go wrong in this phase, consult <a class="xref" href="#fixes" title="Chapter 21. Making your package work">Chapter 21, <i>Making your package work</i></a>.</p></li>
1.148 asau 3140: <li class="step"><p>When the package builds fine, the next step is to install
1.110 hubertf 3141: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
1.91 rillig 3142: everything works.</p></li>
1.148 asau 3143: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
1.91 rillig 3144: contains a list of the files that are installed by the package, is
1.110 hubertf 3145: nearly empty. Run <span class="command"><strong>bmake print-PLIST
1.91 rillig 3146: >PLIST</strong></span> to generate a probably correct list. Check
3147: the file using your preferred text editor to see if the list of
3148: files looks plausible.</p></li>
1.148 asau 3149: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
1.91 rillig 3150: <code class="filename">PLIST</code> contains garbage or not.</p></li>
1.148 asau 3151: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
1.91 rillig 3152: has been registered in the database of installed files, but with an
1.110 hubertf 3153: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
3154: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
1.91 rillig 3155: registered with the list of files from
3156: <code class="filename">PLIST</code>.</p></li>
1.148 asau 3157: <li class="step"><p>Run <span class="command"><strong>bmake package</strong></span> to create a binary
1.91 rillig 3158: package from the set of installed files.</p></li>
1.77 rillig 3159: </ol></div>
1.148 asau 3160: <div class="sect1">
1.91 rillig 3161: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3162: <a name="creating.common"></a>12.1. Common types of packages</h2></div></div></div>
1.148 asau 3163: <div class="sect2">
1.91 rillig 3164: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3165: <a name="creating.perl-module"></a>12.1.1. Perl modules</h3></div></div></div>
1.91 rillig 3166: <p>Simple Perl modules are handled automatically by
1.110 hubertf 3167: <span class="command"><strong>url2pkg</strong></span>, including dependencies.</p>
1.91 rillig 3168: </div>
1.148 asau 3169: <div class="sect2">
1.91 rillig 3170: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3171: <a name="creating.python-module"></a>12.1.2. Python modules and programs</h3></div></div></div>
1.118 imil 3172: <p>Python modules and programs packages are easily created using a
3173: set of predefined variables.</p>
3174: <p>
1.171 wiz 3175: If some Python versions are not supported by the software, set the
3176: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
3177: that are not supported, e.g.
1.118 imil 3178: </p>
3179: <pre class="programlisting">
1.203 sevan 3180: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.118 imil 3181: </pre>
3182: <p>
1.213 wiz 3183: If the packaged software is a Python module, include one of
3184: <code class="filename">../../lang/python/egg.mk</code>,
3185: <code class="filename">../../lang/python/distutils.mk</code>, or
3186: <code class="filename">../../lang/python/extension.mk</code>.</p>
3187: <p>Most Python packages use either <span class="quote">“<span class="quote">distutils</span>”</span> or
3188: easy-setup/setuptools (<span class="quote">“<span class="quote">eggs</span>”</span>).
3189: if the packaged software is using setuptools, you only need
3190: to include <span class="quote">“<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>”</span>.
3191: Otherwise, if the software uses <span class="quote">“<span class="quote">distutils</span>”</span>, include
3192: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/distutils.mk</code></span>”</span>.
3193: so pkgsrc will use this framework.
3194: <span class="quote">“<span class="quote">distutils</span>”</span> uses a script called <code class="filename">setup.py</code>,
3195: if the <span class="quote">“<span class="quote">distutils</span>”</span> driver is not called
3196: <code class="filename">setup.py</code>, set the <code class="varname">PYSETUP</code> variable
3197: to the name of the script.</p>
3198: <p>Either way, the package directory should be called
1.128 wiz 3199: <span class="quote">“<span class="quote">py-software</span>”</span> and <code class="varname">PKGNAME</code> should be set to
3200: <span class="quote">“<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>”</span>, e.g.
1.118 imil 3201: </p>
3202: <pre class="programlisting">
3203: DISTNAME= foopymodule-1.2.10
3204: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
3205: </pre>
1.171 wiz 3206: <p>If it is an application, include
3207: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>”</span>.
3208: In order to correctly set the path to the Python interpreter, use the
1.118 imil 3209: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
1.142 wiz 3210: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
1.171 wiz 3211: For example:
1.118 imil 3212: </p>
3213: <pre class="programlisting">
1.142 wiz 3214: REPLACE_PYTHON= *.py
1.118 imil 3215: </pre>
1.171 wiz 3216: <p>Some Python modules have separate distributions for Python-2.x
3217: and Python-3.x support. In pkgsrc this is handled by the
3218: <code class="filename">versioned_dependencies.mk</code> file. Set
3219: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
3220: packages that should be depended upon and include
3221: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>”</span>,
3222: then the pkgsrc infrastructure will depend on the appropriate package
3223: version. For example:
3224: </p>
3225: <pre class="programlisting">
1.248 wiz 3226: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.171 wiz 3227: </pre>
3228: <p>
3229: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
3230: of supported packages.</p>
1.118 imil 3231: </div>
1.91 rillig 3232: </div>
1.148 asau 3233: <div class="sect1">
1.91 rillig 3234: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3235: <a name="creating.examples"></a>12.2. Examples</h2></div></div></div>
1.148 asau 3236: <div class="sect2">
1.91 rillig 3237: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3238: <a name="creating.nvu"></a>12.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
1.148 asau 3239: <div class="sect3">
1.91 rillig 3240: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 3241: <a name="creating.nvu.init"></a>12.2.1.1. The initial package</h4></div></div></div>
1.91 rillig 3242: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
1.128 wiz 3243: that the <span class="quote">“<span class="quote">nvu</span>”</span> package has not yet been imported into
1.91 rillig 3244: pkgsrc. As the description says it has to do with the web, the obvious
1.128 wiz 3245: choice for the category is <span class="quote">“<span class="quote">www</span>”</span>.</p>
1.91 rillig 3246: <pre class="programlisting">
1.100 rillig 3247: <code class="prompt">$</code> mkdir www/nvu
3248: <code class="prompt">$</code> cd www/nvu
1.91 rillig 3249: </pre>
3250: <p>The web site says that the sources are available as a tar file, so
1.110 hubertf 3251: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
1.91 rillig 3252: <pre class="programlisting">
1.100 rillig 3253: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.91 rillig 3254: </pre>
3255: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
3256: below the <code class="varname">DISTNAME</code> line, as the package name should
1.128 wiz 3257: not have the word <span class="quote">“<span class="quote">sources</span>”</span> in it. I also filled in the
1.91 rillig 3258: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
3259: <code class="varname">COMMENT</code> fields. Then the package
3260: <code class="filename">Makefile</code> looked like that:</p>
3261: <pre class="programlisting">
1.233 sevan 3262: # $NetBSD $
1.100 rillig 3263: #
1.91 rillig 3264:
1.100 rillig 3265: DISTNAME= nvu-1.0-sources
3266: PKGNAME= nvu-1.0
3267: CATEGORIES= www
3268: MASTER_SITES= http://cvs.nvu.com/download/
3269: EXTRACT_SUFX= .tar.bz2
3270:
3271: MAINTAINER= rillig@NetBSD.org
3272: HOMEPAGE= http://cvs.nvu.com/
3273: COMMENT= Web Authoring System
1.91 rillig 3274:
1.100 rillig 3275: # url2pkg-marker (please do not remove this line.)
3276: .include "../../mk/bsd.pkg.mk"
1.91 rillig 3277: </pre>
1.237 wiz 3278: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
1.233 sevan 3279: this is a workaround to prevent CVS expanding to the filename of the
3280: guide.</p>
1.91 rillig 3281: <p>Then, I quit the editor and watched pkgsrc downloading a large
3282: source archive:</p>
3283: <pre class="programlisting">
1.100 rillig 3284: url2pkg> Running "make makesum" ...
3285: => Required installed package digest>=20010302: digest-20060826 found
3286: => Fetching nvu-1.0-sources.tar.bz2
3287: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
3288: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
3289: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
3290: url2pkg> Running "make extract" ...
3291: => Required installed package digest>=20010302: digest-20060826 found
3292: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3293: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3294: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
3295: ===> Installing dependencies for nvu-1.0
3296: ===> Overriding tools for nvu-1.0
3297: ===> Extracting for nvu-1.0
3298: url2pkg> Adjusting the Makefile.
1.91 rillig 3299:
1.100 rillig 3300: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.91 rillig 3301:
1.100 rillig 3302: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.91 rillig 3303: </pre>
3304: </div>
1.148 asau 3305: <div class="sect3">
1.91 rillig 3306: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 3307: <a name="creating.nvu.problems"></a>12.2.1.2. Fixing all kinds of problems to make the package work</h4></div></div></div>
1.91 rillig 3308: <p>Now that the package has been extracted, let's see what's inside
3309: it. The package has a <code class="filename">README.txt</code>, but that only
3310: says something about mozilla, so it's probably useless for seeing what
3311: dependencies this package has. But since there is a GNU configure script
3312: in the package, let's hope that it will complain about everything it
3313: needs.</p>
3314: <pre class="programlisting">
1.100 rillig 3315: <code class="prompt">$</code> bmake
3316: => Required installed package digest>=20010302: digest-20060826 found
3317: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3318: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3319: ===> Patching for nvu-1.0
3320: ===> Creating toolchain wrappers for nvu-1.0
3321: ===> Configuring for nvu-1.0
3322: [...]
3323: configure: error: Perl 5.004 or higher is required.
3324: [...]
3325: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
3326: [...]
1.91 rillig 3327: </pre>
3328: <p>That worked quite well. So I opened the package Makefile in my
3329: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
1.128 wiz 3330: just appended <span class="quote">“<span class="quote">perl</span>”</span> to it. Since the dependencies of the
1.91 rillig 3331: package have changed now, and since a perl wrapper is automatically
1.128 wiz 3332: installed in the <span class="quote">“<span class="quote">tools</span>”</span> phase, I need to build the package
1.91 rillig 3333: from scratch.</p>
3334: <pre class="programlisting">
1.100 rillig 3335: <code class="prompt">$</code> bmake clean
3336: ===> Cleaning for nvu-1.0
3337: <code class="prompt">$</code> bmake
3338: [...]
3339: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
3340: GNU Make. You will not be able to build Mozilla without GNU Make.
3341: [...]
1.91 rillig 3342: </pre>
1.128 wiz 3343: <p>So I added <span class="quote">“<span class="quote">gmake</span>”</span> to the
1.91 rillig 3344: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
3345: <pre class="programlisting">
1.100 rillig 3346: [...]
3347: checking for GTK - version >= 1.2.0... no
3348: *** Could not run GTK test program, checking why...
3349: [...]
1.91 rillig 3350: </pre>
3351: <p>Now to the other dependencies. The first question is: Where is the
3352: GTK package hidden in pkgsrc?</p>
3353: <pre class="programlisting">
1.100 rillig 3354: <code class="prompt">$</code> echo ../../*/gtk*
3355: [many packages ...]
3356: <code class="prompt">$</code> echo ../../*/gtk
3357: ../../x11/gtk
3358: <code class="prompt">$</code> echo ../../*/gtk2
3359: ../../x11/gtk2
3360: <code class="prompt">$</code> echo ../../*/gtk2/bui*
3361: ../../x11/gtk2/buildlink3.mk
1.91 rillig 3362: </pre>
3363: <p>The first try was definitely too broad. The second one had exactly
3364: one result, which is very good. But there is one pitfall with GNOME
3365: packages. Before GNOME 2 had been released, there were already many
3366: GNOME 1 packages in pkgsrc. To be able to continue to use these
3367: packages, the GNOME 2 packages were imported as separate packages, and
1.128 wiz 3368: their names usually have a <span class="quote">“<span class="quote">2</span>”</span> appended. So I checked
1.91 rillig 3369: whether this was the case here, and indeed it was.</p>
3370: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
3371: file, adding the dependency is very easy. I just inserted an
3372: <code class="literal">.include</code> line before the last line of the package
3373: <code class="filename">Makefile</code>, so that it now looks like this:</p>
3374: <pre class="programlisting">
1.100 rillig 3375: [...]
3376: .include "../../x11/gtk2/buildlink3.mk"
3377: .include "../../mk/bsd.pkg.mk
1.91 rillig 3378: </pre>
1.110 hubertf 3379: <p>After another <span class="command"><strong>bmake clean && bmake</strong></span>, the answer
1.91 rillig 3380: was:</p>
3381: <pre class="programlisting">
1.100 rillig 3382: [...]
3383: checking for gtk-config... /home/roland/pkg/bin/gtk-config
3384: checking for GTK - version >= 1.2.0... no
3385: *** Could not run GTK test program, checking why...
3386: *** The test program failed to compile or link. See the file config.log for the
3387: *** exact error that occured. This usually means GTK was incorrectly installed
3388: *** or that you have moved GTK since it was installed. In the latter case, you
3389: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
3390: configure: error: Test for GTK failed.
3391: [...]
1.91 rillig 3392: </pre>
1.128 wiz 3393: <p>In this particular case, the assumption that <span class="quote">“<span class="quote">every package
3394: prefers GNOME 2</span>”</span> had been wrong. The first of the lines above
1.91 rillig 3395: told me that this package really wanted to have the GNOME 1 version of
3396: GTK. If the package had looked for GTK2, it would have looked for
1.110 hubertf 3397: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
1.91 rillig 3398: So I changed the <code class="literal">x11/gtk2</code> to
3399: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
3400: and tried again.</p>
3401: <pre class="programlisting">
1.100 rillig 3402: [...]
1.166 jnemeth 3403: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
1.100 rillig 3404: In file included from xpidl.c:42:
3405: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
3406: In file included from xpidl.c:42:
3407: xpidl.h:132: error: parse error before "IDL_ns"
3408: [...]
1.91 rillig 3409: </pre>
3410: <p>The package still does not find all of its dependencies. Now the
3411: question is: Which package provides the
3412: <code class="filename">libIDL/IDL.h</code> header file?</p>
3413: <pre class="programlisting">
1.100 rillig 3414: <code class="prompt">$</code> echo ../../*/*idl*
3415: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
3416: <code class="prompt">$</code> echo ../../*/*IDL*
3417: ../../net/libIDL
1.91 rillig 3418: </pre>
3419: <p>Let's take the one from the second try. So I included the
3420: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
3421: again. But the error didn't change. After digging through some of the
3422: code, I concluded that the build process of the package was broken and
3423: couldn't have ever worked, but since the Mozilla source tree is quite
3424: large, I didn't want to fix it. So I added the following to the package
3425: <code class="filename">Makefile</code> and tried again:</p>
3426: <pre class="programlisting">
1.100 rillig 3427: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.252 leot 3428: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.91 rillig 3429: </pre>
3430: <p>The latter line is needed because the package expects the library
3431: <code class="filename">libIDL.so</code>, but only
3432: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
3433: wrapper to rewrite that on the fly.</p>
3434: <p>The next problem was related to a recent change of the FreeType
1.250 leot 3435: interface. I looked up in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/seamonkey/README.html" target="_top"><code class="filename">www/seamonkey</code></a>
1.91 rillig 3436: which patch files were relevant for this issue and copied them to the
3437: <code class="filename">patches</code> directory. Then I retried, fixed the
3438: patches so that they applied cleanly and retried again. This time,
3439: everything worked.</p>
3440: </div>
1.148 asau 3441: <div class="sect3">
1.91 rillig 3442: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 3443: <a name="creating.nvu.inst"></a>12.2.1.3. Installing the package</h4></div></div></div>
1.91 rillig 3444: <pre class="programlisting">
1.100 rillig 3445: <code class="prompt">$</code> bmake CHECK_FILES=no install
3446: [...]
3447: <code class="prompt">$</code> bmake print-PLIST >PLIST
3448: <code class="prompt">$</code> bmake deinstall
3449: <code class="prompt">$</code> bmake install
1.91 rillig 3450: </pre>
3451: </div>
3452: </div>
3453: </div>
1.77 rillig 3454: </div>
1.148 asau 3455: <div class="chapter">
1.75 rillig 3456: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 3457: <a name="components"></a>Chapter 13. Package components - files, directories and contents</h2></div></div></div>
1.75 rillig 3458: <div class="toc">
3459: <p><b>Table of Contents</b></p>
1.210 leot 3460: <dl class="toc">
1.267 rillig 3461: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
3462: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
3463: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
3464: <dd><dl>
3465: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
3466: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
3467: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
3468: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
3469: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
3470: </dl></dd>
3471: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
3472: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
3473: <dd><dl>
3474: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
3475: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
3476: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.78 rillig 3477: </dl></dd>
1.267 rillig 3478: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
3479: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.75 rillig 3480: </dl>
3481: </div>
1.87 wiz 3482: <p>Whenever you're preparing a package, there are a number of
3483: files involved which are described in the following
3484: sections.</p>
1.148 asau 3485: <div class="sect1">
1.75 rillig 3486: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3487: <a name="components.Makefile"></a>13.1. <code class="filename">Makefile</code>
1.93 rillig 3488: </h2></div></div></div>
1.75 rillig 3489: <p>Building, installation and creation of a binary package are all
1.87 wiz 3490: controlled by the package's <code class="filename">Makefile</code>.
3491: The <code class="filename">Makefile</code> describes various things about
3492: a package, for example from where to get it, how to configure,
3493: build, and install it.</p>
1.76 rillig 3494: <p>A package <code class="filename">Makefile</code> contains several
1.87 wiz 3495: sections that describe the package.</p>
1.75 rillig 3496: <p>In the first section there are the following variables, which
1.87 wiz 3497: should appear exactly in the order given here. The order and
3498: grouping of the variables is mostly historical and has no further
3499: meaning.</p>
1.148 asau 3500: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3501: <li class="listitem"><p><code class="varname">DISTNAME</code> is the basename of the
1.87 wiz 3502: distribution file to be downloaded from the package's
3503: website.</p></li>
1.128 wiz 3504: <li class="listitem"><p><code class="varname">PKGNAME</code> is the name of the
1.174 asau 3505: package, as used by pkgsrc. You need to provide it if
1.87 wiz 3506: <code class="varname">DISTNAME</code> (which is the default) is not a good
1.174 asau 3507: name for the package in pkgsrc or <code class="varname">DISTNAME</code> is not
3508: provided (no distribution file is required). Usually it is the pkgsrc
1.87 wiz 3509: directory name together with the version number. It must match the
3510: regular expression
3511: <code class="varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>, that is, it
3512: starts with a letter or digit, and contains only letters, digits,
3513: dashes, underscores, dots and plus signs.</p></li>
1.128 wiz 3514: <li class="listitem">
1.75 rillig 3515: <p><code class="varname">CATEGORIES</code> is a list of categories
1.87 wiz 3516: which the package fits in. You can choose any of the top-level
3517: directories of pkgsrc for it.</p>
1.75 rillig 3518: <p>Currently the following values are available for
1.87 wiz 3519: <code class="varname">CATEGORIES</code>. If more than
3520: one is used, they need to be separated by spaces:</p>
1.75 rillig 3521: <pre class="programlisting">
1.100 rillig 3522: archivers cross geography meta-pkgs security
3523: audio databases graphics misc shells
3524: benchmarks devel ham multimedia sysutils
3525: biology editors inputmethod net textproc
3526: cad emulators lang news time
3527: chat finance mail parallel wm
3528: comms fonts math pkgtools www
3529: converters games mbone print x11
3530: </pre>
1.75 rillig 3531: </li>
1.128 wiz 3532: <li class="listitem"><p><code class="varname">MASTER_SITES</code>,
1.87 wiz 3533: <code class="varname">DYNAMIC_MASTER_SITES</code>,
3534: <code class="varname">DIST_SUBDIR</code>, <code class="varname">EXTRACT_SUFX</code>
3535: and <code class="varname">DISTFILES</code> are discussed in detail in
1.267 rillig 3536: <a class="xref" href="#build.fetch" title="19.5. The fetch phase">Section 19.5, “The <span class="emphasis"><em>fetch</em></span> phase”</a>.</p></li>
1.75 rillig 3537: </ul></div>
3538: <p>The second section contains information about separately
1.87 wiz 3539: downloaded patches, if any.
3540: </p>
1.148 asau 3541: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.190 wiz 3542: <li class="listitem"><p><code class="varname">PATCHFILES</code>:
1.87 wiz 3543: Name(s) of additional files that contain distribution patches.
3544: There is no default. pkgsrc will look for them at
3545: <code class="varname">PATCH_SITES</code>.
3546: They will automatically be uncompressed before patching if
3547: the names end with <code class="filename">.gz</code> or
3548: <code class="filename">.Z</code>.</p></li>
1.128 wiz 3549: <li class="listitem"><p><code class="varname">PATCH_SITES</code>:
1.87 wiz 3550: Primary location(s) for distribution patch files (see
1.190 wiz 3551: <code class="varname">PATCHFILES</code> above) if not found locally.</p></li>
3552: <li class="listitem"><p><code class="varname">PATCH_DIST_STRIP</code>:
1.270 ! leot 3553: an argument to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> that sets the pathname strip count to
1.190 wiz 3554: help find the correct files to patch. It defaults to
3555: <span class="command"><strong>-p0</strong></span>.</p></li>
1.75 rillig 3556: </ul></div>
3557: <p>The third section contains the following variables.
1.87 wiz 3558: </p>
1.148 asau 3559: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3560: <li class="listitem"><p><code class="varname">MAINTAINER</code> is the email
1.114 jmcneill 3561: address of the person who feels responsible for this package,
3562: and who is most likely to look at problems or questions regarding
1.270 ! leot 3563: this package which have been reported with <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a>.
1.114 jmcneill 3564: Other developers may contact the <code class="varname">MAINTAINER</code>
3565: before making changes to the package, but are not required to
3566: do so. When packaging a new program, set <code class="varname">MAINTAINER</code>
3567: to yourself. If you really can't maintain the package for future
3568: updates, set it to
1.110 hubertf 3569: <code class="email"><<a class="email" href="mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p></li>
1.128 wiz 3570: <li class="listitem"><p><code class="varname">OWNER</code> should be used instead
1.114 jmcneill 3571: of <code class="varname">MAINTAINER</code> when you do not want other
3572: developers to update or change the package without contacting
3573: you first. A package Makefile should contain one of
3574: <code class="varname">MAINTAINER</code> or <code class="varname">OWNER</code>, but
3575: not both. </p></li>
1.128 wiz 3576: <li class="listitem"><p><code class="varname">HOMEPAGE</code> is a URL where users can
1.87 wiz 3577: find more information about the package.</p></li>
1.128 wiz 3578: <li class="listitem"><p><code class="varname">COMMENT</code> is a one-line
1.87 wiz 3579: description of the package (should not include the package
3580: name).</p></li>
1.234 leot 3581: <li class="listitem"><p><code class="varname">LICENSE</code> indicates the license(s)
1.267 rillig 3582: 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>
1.75 rillig 3583: </ul></div>
3584: <p>Other variables that affect the build:
1.87 wiz 3585: </p>
1.148 asau 3586: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.75 rillig 3587: <p><code class="varname">WRKSRC</code>: The directory where the
1.87 wiz 3588: interesting distribution files of the package are found. The
3589: default is <code class="filename">${WRKDIR}/${DISTNAME}</code>, which
3590: works for most packages.</p>
1.75 rillig 3591: <p>If a package doesn't create a subdirectory for itself
1.87 wiz 3592: (most GNU software does, for instance), but extracts itself in
3593: the current directory, you should set
3594: <code class="varname">WRKSRC=${WRKDIR}</code>.</p>
3595: <p>If a package doesn't create a subdirectory with the
3596: name of <code class="varname">DISTNAME</code> but some different name,
3597: set <code class="varname">WRKSRC</code> to point to the proper name in
3598: <code class="filename">${WRKDIR}</code>, for example
3599: <code class="varname">WRKSRC=${WRKDIR}/${DISTNAME}/unix</code>. See
1.250 leot 3600: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/tcl/README.html" target="_top"><code class="filename">lang/tcl</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/tk/README.html" target="_top"><code class="filename">x11/tk</code></a> for other examples.</p>
1.75 rillig 3601: <p>The name of the working directory created by pkgsrc is
1.87 wiz 3602: taken from the <code class="varname">WRKDIR_BASENAME</code>
3603: variable. By default, its value is
3604: <code class="filename">work</code>. If you want to use the same
3605: pkgsrc tree for building different kinds of binary packages,
3606: you can change the variable according to your needs. Two
3607: other variables handle common cases of setting
3608: <code class="varname">WRKDIR_BASENAME</code> individually. If
3609: <code class="varname">OBJHOSTNAME</code> is defined in
1.110 hubertf 3610: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the first component of
1.87 wiz 3611: the host's name is attached to the directory name. If
3612: <code class="varname">OBJMACHINE</code> is defined, the platform name
3613: is attached, which might look like
3614: <code class="filename">work.i386</code> or
3615: <code class="filename">work.sparc</code>.</p>
1.75 rillig 3616: </li></ul></div>
3617: <p>Please pay attention to the following gotchas:</p>
1.148 asau 3618: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3619: <li class="listitem"><p>Add <code class="varname">MANCOMPRESSED</code> if man pages are
1.88 wiz 3620: installed in compressed form by the package. For packages using
3621: BSD-style makefiles which honor MANZ, there is
3622: <code class="varname">MANCOMPRESSED_IF_MANZ</code>.</p></li>
1.128 wiz 3623: <li class="listitem"><p>Replace <code class="filename">/usr/local</code> with
3624: <span class="quote">“<span class="quote">${PREFIX}</span>”</span> in all files (see patches,
1.88 wiz 3625: below).</p></li>
1.267 rillig 3626: <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>
1.75 rillig 3627: </ul></div>
3628: </div>
1.148 asau 3629: <div class="sect1">
1.75 rillig 3630: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3631: <a name="components.distinfo"></a>13.2. <code class="filename">distinfo</code>
1.93 rillig 3632: </h2></div></div></div>
1.76 rillig 3633: <p>The <code class="filename">distinfo</code> file contains the message
1.87 wiz 3634: digest, or checksum, of each distfile needed for the package. This
3635: ensures that the distfiles retrieved from the Internet have not been
3636: corrupted during transfer or altered by a malign force to introduce
1.219 rillig 3637: a security hole. To provide maximum security, all distfiles are
3638: protected using three different message digest algorithms (SHA1,
3639: RMD160, SHA512), as well as the file size.</p>
1.76 rillig 3640: <p>The <code class="filename">distinfo</code> file also contains the
1.87 wiz 3641: checksums for all the patches found in the
1.267 rillig 3642: <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, “<code class="filename">patches/*</code>”</a>). These checksums ensure that patches
1.258 leot 3643: are only applied intentionally and that they don't accidentally change,
3644: e.g. when merging different changes together. They also make sure that
3645: new patches are actually added to CVS and old ones are removed.
3646: Too see whether the patches and the <code class="filename">distinfo</code> file
3647: match, run <span class="command"><strong>pkglint</strong></span> after changing the patches.</p>
1.76 rillig 3648: <p>To regenerate the <code class="filename">distinfo</code> file, use the
1.219 rillig 3649: <span class="command"><strong>make distinfo</strong></span> command.</p>
1.75 rillig 3650: <p>Some packages have different sets of distfiles depending on
1.250 leot 3651: the platform, for example <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/openjdk7/README.html" target="_top"><code class="filename">lang/openjdk7</code></a>. These are kept in the same
1.87 wiz 3652: <code class="filename">distinfo</code> file and care should be taken when
3653: upgrading such a package to ensure distfile information is not
3654: lost.</p>
1.75 rillig 3655: </div>
1.148 asau 3656: <div class="sect1">
1.75 rillig 3657: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3658: <a name="components.patches"></a>13.3. <code class="filename">patches/*</code>
1.219 rillig 3659: </h2></div></div></div>
3660: <p>Some packages don't work out-of-the box on the various
3661: platforms that are supported by pkgsrc. These packages need
3662: to be patched to make them work. The patch files can be
1.93 rillig 3663: found in the <code class="filename">patches/</code> directory.</p>
3664: <p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
3665: applied to the files in <code class="varname">WRKSRC</code> directory after
1.219 rillig 3666: extracting them, in alphabetic order.</p>
1.148 asau 3667: <div class="sect2">
1.93 rillig 3668: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3669: <a name="components.patch.structure"></a>13.3.1. Structure of a single patch file</h3></div></div></div>
1.76 rillig 3670: <p>The <code class="filename">patch-*</code> files should be in
1.110 hubertf 3671: <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
1.93 rillig 3672: problems. (To force patches to apply with fuzz you can set
3673: <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
1.94 dmcmahil 3674: should contain only changes for a single file, and no file should be
1.93 rillig 3675: patched by more than one patch file. This helps to keep future
3676: modifications simple.</p>
3677: <p>Each patch file is structured as follows: In the first line,
3678: there is the RCS Id of the patch itself. The second line should be
3679: empty for aesthetic reasons. After that, there should be a comment for
3680: each change that the patch does. There are a number of standard
3681: cases:</p>
1.148 asau 3682: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3683: <li class="listitem"><p>Patches for commonly known vulnerabilities should
1.93 rillig 3684: mention the vulnerability ID (CAN, CVE).</p></li>
1.128 wiz 3685: <li class="listitem"><p>Patches that change source code should mention the
1.93 rillig 3686: platform and other environment (for example, the compiler) that the
3687: patch is needed for.</p></li>
3688: </ul></div>
1.219 rillig 3689: <p>The patch should be commented so that any
1.93 rillig 3690: developer who knows the code of the application can make some use of
3691: the patch. Special care should be taken for the upstream developers,
3692: since we generally want that they accept our patches, so we have less
3693: work in the future.</p>
3694: </div>
1.148 asau 3695: <div class="sect2">
1.93 rillig 3696: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3697: <a name="components.patches.caveats"></a>13.3.2. Creating patch files</h3></div></div></div>
1.93 rillig 3698: <p>One important thing to mention is to pay attention that no RCS
3699: IDs get stored in the patch files, as these will cause problems when
1.87 wiz 3700: later checked into the NetBSD CVS tree. Use the
1.250 leot 3701: <span class="command"><strong>pkgdiff</strong></span> command from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package to avoid these
1.93 rillig 3702: problems.</p>
1.87 wiz 3703: <p>For even more automation, we recommend using
1.110 hubertf 3704: <span class="command"><strong>mkpatches</strong></span> from the same package to make a
1.87 wiz 3705: whole set of patches. You just have to backup files before you
3706: edit them to <code class="filename">filename.orig</code>, e.g. with
1.110 hubertf 3707: <span class="command"><strong>cp -p filename filename.orig</strong></span> or, easier, by
3708: using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
1.87 wiz 3709: you upgrade a package this way, you can easily compare the new
3710: set of patches with the previously existing one with
1.130 wiz 3711: <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
3712: are replaced by new files, so carefully check if you want to take all
3713: the changes.</p>
1.87 wiz 3714: <p>When you have finished a package, remember to generate
1.110 hubertf 3715: the checksums for the patch files by using the <span class="command"><strong>make
1.267 rillig 3716: makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="13.2. distinfo">Section 13.2, “<code class="filename">distinfo</code>”</a>.</p>
1.87 wiz 3717: <p>When adding a patch that corrects a problem in the
3718: distfile (rather than e.g. enforcing pkgsrc's view of where
3719: man pages should go), send the patch as a bug report to the
3720: maintainer. This benefits non-pkgsrc users of the package,
3721: and usually makes it possible to remove the patch in future
3722: version.</p>
1.101 rillig 3723: <p>The file names of the patch files are usually of the form
1.130 wiz 3724: <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
3725: Many packages still use the previous convention
3726: <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
3727: but new patches should be of the form containing the filename.
1.250 leot 3728: <span class="command"><strong>mkpatches</strong></span> included in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> takes care of the name
1.130 wiz 3729: automatically.</p>
1.93 rillig 3730: </div>
1.148 asau 3731: <div class="sect2">
1.93 rillig 3732: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3733: <a name="components.patches.sources"></a>13.3.3. Sources where the patch files come from</h3></div></div></div>
1.87 wiz 3734: <p>If you want to share patches between multiple packages
3735: in pkgsrc, e.g. because they use the same distfiles, set
3736: <code class="varname">PATCHDIR</code> to the path where the patch files
3737: can be found, e.g.:</p>
3738: <pre class="programlisting">
1.100 rillig 3739: PATCHDIR= ${.CURDIR}/../xemacs/patches
1.93 rillig 3740: </pre>
1.75 rillig 3741: <p>Patch files that are distributed by the author or other
1.87 wiz 3742: maintainers can be listed in
3743: <code class="varname">PATCHFILES</code>.</p>
3744: <p>If it is desired to store any patches that should not be
3745: committed into pkgsrc, they can be kept outside the pkgsrc
3746: tree in the <code class="filename">$LOCALPATCHES</code> directory. The
3747: directory tree there is expected to have the same
1.128 wiz 3748: <span class="quote">“<span class="quote">category/package</span>”</span> structure as pkgsrc, and
1.87 wiz 3749: patches are expected to be stored inside these dirs (also
3750: known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
3751: example, if you want to keep a private patch for
3752: <code class="filename">pkgsrc/graphics/png</code>, keep it in
3753: <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
3754: files in the named directory are expected to be patch files,
3755: and <span class="emphasis"><em>they are applied after pkgsrc patches are
3756: applied</em></span>.</p>
1.93 rillig 3757: </div>
1.148 asau 3758: <div class="sect2">
1.85 jmmv 3759: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3760: <a name="components.patches.guidelines"></a>13.3.4. Patching guidelines</h3></div></div></div>
1.85 jmmv 3761: <p>When fixing a portability issue in the code do not use
3762: preprocessor magic to check for the current operating system nor
3763: platform. Doing so hurts portability to other platforms because
3764: the OS-specific details are not abstracted appropriately.</p>
3765: <p>The general rule to follow is: instead of checking for the
3766: operating system the application is being built on, check for the
3767: specific <span class="emphasis"><em>features</em></span> you need. For example,
3768: instead of assuming that kqueue is available under NetBSD and
3769: using the <code class="varname">__NetBSD__</code> macro to conditionalize
1.126 jakllsch 3770: kqueue support, add a check that detects kqueue itself —
1.85 jmmv 3771: yes, this generally involves patching the
1.110 hubertf 3772: <span class="command"><strong>configure</strong></span> script. There is absolutely nothing
1.85 jmmv 3773: that prevents some OSes from adopting interfaces from other OSes
3774: (e.g. Linux implementing kqueue), something that the above checks
3775: cannot take into account.</p>
3776: <p>Of course, checking for features generally involves more
3777: work on the developer's side, but the resulting changes are
1.87 wiz 3778: cleaner and there are chances they will work on many other
1.85 jmmv 3779: platforms. Not to mention that there are higher chances of being
3780: later integrated into the mainstream sources. Remember:
3781: <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
3782: <p>Some typical examples:</p>
3783: <div class="table">
1.267 rillig 3784: <a name="patch-examples"></a><p class="title"><b>Table 13.1. Patching examples</b></p>
1.216 tnn 3785: <div class="table-contents"><table class="table" summary="Patching examples" border="1">
1.85 jmmv 3786: <colgroup>
3787: <col>
3788: <col>
3789: <col>
3790: </colgroup>
3791: <thead><tr>
3792: <th>Where</th>
3793: <th>Incorrect</th>
3794: <th>Correct</th>
3795: </tr></thead>
3796: <tbody>
3797: <tr>
3798: <td>configure script</td>
3799: <td>
1.100 rillig 3800: <pre class="programlisting">
3801: case ${target_os} in
3802: netbsd*) have_kvm=yes ;;
3803: *) have_kvm=no ;;
3804: esac
3805: </pre>
1.85 jmmv 3806: </td>
3807: <td>
1.100 rillig 3808: <pre class="programlisting">
3809: AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
3810: </pre>
1.85 jmmv 3811: </td>
3812: </tr>
3813: <tr>
3814: <td>C source file</td>
3815: <td>
1.100 rillig 3816: <pre class="programlisting">
3817: #if defined(__NetBSD__)
3818: # include <sys/event.h>
3819: #endif
3820: </pre>
1.85 jmmv 3821: </td>
3822: <td>
1.100 rillig 3823: <pre class="programlisting">
3824: #if defined(HAVE_SYS_EVENT_H)
3825: # include <sys/event.h>
3826: #endif
3827: </pre>
1.85 jmmv 3828: </td>
3829: </tr>
3830: <tr>
3831: <td>C source file</td>
3832: <td>
1.100 rillig 3833: <pre class="programlisting">
3834: int
3835: monitor_file(...)
3836: {
3837: #if defined(__NetBSD__)
3838: int fd = kqueue();
3839: ...
3840: #else
3841: ...
3842: #endif
3843: }
3844: </pre>
1.85 jmmv 3845: </td>
3846: <td>
1.100 rillig 3847: <pre class="programlisting">
3848: int
3849: monitor_file(...)
3850: {
3851: #if defined(HAVE_KQUEUE)
3852: int fd = kqueue();
3853: ...
3854: #else
1.223 rillig 3855: ...
1.100 rillig 3856: #endif
3857: }
3858: </pre>
1.85 jmmv 3859: </td>
3860: </tr>
3861: </tbody>
1.91 rillig 3862: </table></div>
1.85 jmmv 3863: </div>
1.254 maya 3864: <br class="table-break">
1.85 jmmv 3865: </div>
1.148 asau 3866: <div class="sect2">
1.85 jmmv 3867: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3868: <a name="components.patches.feedback"></a>13.3.5. Feedback to the author</h3></div></div></div>
1.85 jmmv 3869: <p>Always, always, <span class="strong"><strong>always</strong></span>
3870: feed back any <span class="emphasis"><em>portability fixes</em></span> or
3871: improvements you do to a package to the mainstream developers.
3872: This is the only way to get their attention on portability issues
3873: and to ensure that future versions can be built out-of-the box on
3874: NetBSD. Furthermore, any user that gets newer distfiles will get
3875: the fixes straight from the packaged code.</p>
1.93 rillig 3876: <p>This generally involves cleaning up the patches
3877: (because sometimes the patches that are
1.147 wiz 3878: added to pkgsrc are quick hacks), filing bug reports in the
1.85 jmmv 3879: appropriate trackers for the projects and working with the
3880: mainstream authors to accept your changes. It is
3881: <span class="emphasis"><em>extremely important</em></span> that you do it so that
3882: the packages in pkgsrc are kept simple and thus further changes
3883: can be done without much hassle.</p>
1.130 wiz 3884: <p>When you have done this, please add a URL to the upstream
3885: bug report to the patch comment.</p>
1.85 jmmv 3886: <p>Support the idea of free software!</p>
3887: </div>
1.75 rillig 3888: </div>
1.148 asau 3889: <div class="sect1">
1.75 rillig 3890: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3891: <a name="other-mandatory-files"></a>13.4. Other mandatory files</h2></div></div></div>
1.148 asau 3892: <div class="variablelist"><dl class="variablelist">
1.76 rillig 3893: <dt><span class="term"><code class="filename">DESCR</code></span></dt>
1.75 rillig 3894: <dd><p>A multi-line description of the piece of software. This should include
1.87 wiz 3895: any credits where they are due. Please bear in mind that others do not
3896: share your sense of humour (or spelling idiosyncrasies), and that others
3897: will read everything that you write here.</p></dd>
1.76 rillig 3898: <dt><span class="term"><code class="filename">PLIST</code></span></dt>
1.87 wiz 3899: <dd><p>This file governs the files that are installed on your
3900: system: all the binaries, manual pages, etc. There are other
3901: directives which may be entered in this file, to control the
3902: creation and deletion of directories, and the location of
1.267 rillig 3903: inserted files. See <a class="xref" href="#plist" title="Chapter 15. PLIST issues">Chapter 15, <i>PLIST issues</i></a> for more
1.87 wiz 3904: information.</p></dd>
1.75 rillig 3905: </dl></div>
3906: </div>
1.148 asau 3907: <div class="sect1">
1.75 rillig 3908: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3909: <a name="components.optional"></a>13.5. Optional files</h2></div></div></div>
1.148 asau 3910: <div class="sect2">
1.78 rillig 3911: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3912: <a name="components.optional.bin"></a>13.5.1. Files affecting the binary package</h3></div></div></div>
1.148 asau 3913: <div class="variablelist"><dl class="variablelist">
1.76 rillig 3914: <dt><span class="term"><code class="filename">INSTALL</code></span></dt>
1.135 wiz 3915: <dd>
1.270 ! leot 3916: <p>This shell script is invoked twice by <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>.
1.87 wiz 3917: First time after package extraction and before files are
3918: moved in place, the second time after the files to install
3919: are moved in place. This can be used to do any custom
3920: procedures not possible with @exec commands in
1.270 ! leot 3921: <code class="filename">PLIST</code>. See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> and
! 3922: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.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="17.1. Files and directories outside the installation prefix">Section 17.1, “Files and directories outside the installation prefix”</a>.
1.135 wiz 3923: Please note that you can modify variables in it easily by using
3924: <code class="varname">FILES_SUBST</code> in the package's
3925: <code class="filename">Makefile</code>:</p>
3926: <pre class="programlisting">
3927: FILES_SUBST+= SOMEVAR="somevalue"
3928: </pre>
3929: <p>replaces "@SOMEVAR@" with <span class="quote">“<span class="quote">somevalue</span>”</span> in the
3930: <code class="filename">INSTALL</code>. By default, substitution is
3931: performed for <code class="varname">PREFIX</code>,
3932: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
3933: <code class="varname">VARBASE</code>, and a few others, type
3934: <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
3935: complete list.</p>
3936: </dd>
1.76 rillig 3937: <dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
1.75 rillig 3938: <dd><p>This script is executed before and after any files are removed. It is
1.87 wiz 3939: this script's responsibility to clean up any additional messy details
3940: around the package's installation, since all pkg_delete knows is how to
3941: delete the files created in the original distribution.
1.270 ! leot 3942: See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
! 3943: and <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information.
1.135 wiz 3944: The same methods to replace variables can be used as for
3945: the <code class="filename">INSTALL</code> file.</p></dd>
1.76 rillig 3946: <dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
1.75 rillig 3947: <dd>
3948: <p>This file is displayed after installation of the package.
1.87 wiz 3949: Useful for things like legal notices on almost-free
3950: software and hints for updating config files after
3951: installing modules for apache, PHP etc.
3952: Please note that you can modify variables in it easily by using
3953: <code class="varname">MESSAGE_SUBST</code> in the package's
3954: <code class="filename">Makefile</code>:</p>
1.75 rillig 3955: <pre class="programlisting">
1.100 rillig 3956: MESSAGE_SUBST+= SOMEVAR="somevalue"
3957: </pre>
1.128 wiz 3958: <p>replaces "${SOMEVAR}" with <span class="quote">“<span class="quote">somevalue</span>”</span> in
1.87 wiz 3959: <code class="filename">MESSAGE</code>. By default, substitution is
3960: performed for <code class="varname">PKGNAME</code>,
3961: <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
1.209 sevan 3962: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
1.87 wiz 3963: <code class="varname">PKG_SYSCONFDIR</code>,
3964: <code class="varname">ROOT_GROUP</code>, and
1.117 jnemeth 3965: <code class="varname">ROOT_USER</code>.</p>
1.87 wiz 3966: <p>You can display a different or additional files by
3967: setting the <code class="varname">MESSAGE_SRC</code> variable. Its
3968: default is <code class="filename">MESSAGE</code>, if the file
3969: exists.</p>
1.75 rillig 3970: </dd>
1.78 rillig 3971: <dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
1.174 asau 3972: <dd>
3973: <p>This file is used by the alternatives framework.
3974: It creates, configures, and destroys generic wrappers used to
3975: run programs with similar interfaces.
3976: See pkg_alternatives(8) from pkgtools/pkg_alternatives
3977: for more information.</p>
3978: <p>Each line of the file contains two filenames, first
3979: the wrapper and then the alternative provided by the package.
3980: Both paths are relative to <code class="varname">PREFIX</code>.</p>
3981: </dd>
1.78 rillig 3982: </dl></div>
3983: </div>
1.148 asau 3984: <div class="sect2">
1.78 rillig 3985: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 3986: <a name="components.optional.build"></a>13.5.2. Files affecting the build process</h3></div></div></div>
1.148 asau 3987: <div class="variablelist"><dl class="variablelist">
1.78 rillig 3988: <dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
3989: <dd><p>This file contains arbitrary things that could
3990: also go into a <code class="filename">Makefile</code>, but its purpose is
3991: to be used by more than one package. This file should only be
3992: used when the packages that will use the file are known in
3993: advance. For other purposes it is often better to write a
3994: <code class="filename">*.mk</code> file and give it a good name that
3995: describes what it does.</p></dd>
3996: <dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
3997: <dd><p>This file contains the dependency information
1.267 rillig 3998: for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a>).</p></dd>
1.78 rillig 3999: <dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
4000: <dd><p>This file contains workarounds for compiler bugs
4001: and similar things. It is included automatically by the pkgsrc
4002: infrastructure, so you don't need an extra
4003: <code class="literal">.include</code> line for
4004: it.</p></dd>
4005: <dt><span class="term"><code class="filename">options.mk</code></span></dt>
4006: <dd><p>This file contains the code for the
1.267 rillig 4007: package-specific options (see <a class="xref" href="#options" title="Chapter 18. Options handling">Chapter 18, <i>Options handling</i></a>) that can be
1.78 rillig 4008: selected by the user. If a package has only one or two options,
4009: it is equally acceptable to put the code directly into the
4010: <code class="filename">Makefile</code>.</p></dd>
4011: </dl></div>
4012: </div>
1.148 asau 4013: <div class="sect2">
1.78 rillig 4014: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4015: <a name="components.optional.none"></a>13.5.3. Files affecting nothing at all</h3></div></div></div>
1.148 asau 4016: <div class="variablelist"><dl class="variablelist">
1.78 rillig 4017: <dt><span class="term"><code class="filename">README*</code></span></dt>
4018: <dd><p>These files do not take place in the creation of
4019: a package and thus are purely informative to the package
4020: developer.</p></dd>
4021: <dt><span class="term"><code class="filename">TODO</code></span></dt>
4022: <dd><p>This file contains things that need to be done
4023: to make the package even
4024: better.</p></dd>
1.75 rillig 4025: </dl></div>
4026: </div>
1.78 rillig 4027: </div>
1.148 asau 4028: <div class="sect1">
1.75 rillig 4029: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4030: <a name="work-dir"></a>13.6. <code class="filename">work*</code>
1.93 rillig 4031: </h2></div></div></div>
1.110 hubertf 4032: <p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
1.87 wiz 4033: unpacked into the directory denoted by
4034: <code class="varname">WRKDIR</code>. It can be removed by running
1.110 hubertf 4035: <span class="command"><strong>make clean</strong></span>. Besides the sources, this
1.87 wiz 4036: directory is also used to keep various timestamp files.
4037: The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
4038: The default is <code class="filename">${.CURDIR}/work</code>
4039: or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
4040: if <code class="varname">OBJMACHINE</code> is set.</p>
1.75 rillig 4041: </div>
1.148 asau 4042: <div class="sect1">
1.75 rillig 4043: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4044: <a name="files-dir"></a>13.7. <code class="filename">files/*</code>
1.93 rillig 4045: </h2></div></div></div>
1.75 rillig 4046: <p>If you have any files that you wish to be placed in the package prior
1.87 wiz 4047: to configuration or building, you could place these files here and use
1.110 hubertf 4048: a <span class="command"><strong>${CP}</strong></span> command in the
1.128 wiz 4049: <span class="quote">“<span class="quote">pre-configure</span>”</span> target to achieve
1.87 wiz 4050: this. Alternatively, you could simply diff the file against
4051: <code class="filename">/dev/null</code> and use the patch mechanism to manage
4052: the creation of this file.</p>
4053: <p>If you want to share files in this way with other
4054: packages, set the <code class="varname">FILESDIR</code> variable to point
4055: to the other package's <code class="filename">files</code> directory,
4056: e.g.:</p>
4057: <pre class="programlisting">
1.100 rillig 4058: FILESDIR=${.CURDIR}/../xemacs/files
4059: </pre>
1.75 rillig 4060: </div>
4061: </div>
1.148 asau 4062: <div class="chapter">
1.75 rillig 4063: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 4064: <a name="makefile"></a>Chapter 14. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
1.75 rillig 4065: <div class="toc">
4066: <p><b>Table of Contents</b></p>
1.210 leot 4067: <dl class="toc">
1.267 rillig 4068: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
4069: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
4070: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
4071: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
4072: <dd><dl>
4073: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
4074: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
4075: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
4076: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.75 rillig 4077: </dl></dd>
4078: </dl>
4079: </div>
1.76 rillig 4080: <p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
1.75 rillig 4081: each of which forms a well-defined part of the pkgsrc system. Using
1.270 ! leot 4082: the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system
1.75 rillig 4083: like pkgsrc requires some discipline to keep the code correct and
4084: understandable.</p>
1.76 rillig 4085: <p>The basic ingredients for <code class="filename">Makefile</code>
1.267 rillig 4086: programming are variables and shell
1.75 rillig 4087: commands. Among these shell commands may even be more complex ones
1.270 ! leot 4088: like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?awk+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs
1.75 rillig 4089: as intended it is necessary to quote all variables correctly when they
4090: are used.</p>
1.267 rillig 4091: <p>This chapter describes some patterns that appear quite often in
1.76 rillig 4092: <code class="filename">Makefile</code>s, including the pitfalls that come along
1.75 rillig 4093: with them.</p>
1.148 asau 4094: <div class="sect1">
1.75 rillig 4095: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4096: <a name="makefile.style"></a>14.1. Caveats</h2></div></div></div>
1.148 asau 4097: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.97 rillig 4098: <p>When you are creating a file as a
4099: target of a rule, always write the data to a temporary file first
4100: and finally rename that file. Otherwise there might occur an error
4101: in the middle of generating the file, and when the user runs
1.270 ! leot 4102: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> for the second time, the file exists and will not be
1.97 rillig 4103: regenerated properly. Example:</p>
4104: <pre class="programlisting">
1.100 rillig 4105: wrong:
4106: @echo "line 1" > ${.TARGET}
4107: @echo "line 2" >> ${.TARGET}
4108: @false
4109:
4110: correct:
4111: @echo "line 1" > ${.TARGET}.tmp
4112: @echo "line 2" >> ${.TARGET}.tmp
4113: @false
4114: @mv ${.TARGET}.tmp ${.TARGET}
1.97 rillig 4115: </pre>
1.110 hubertf 4116: <p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
1.97 rillig 4117: <code class="filename">wrong</code> will exist, although there was an error
1.110 hubertf 4118: message in the first run. On the other hand, running <span class="command"><strong>make
1.97 rillig 4119: correct</strong></span> gives an error message twice, as expected.</p>
1.270 ! leot 4120: <p>You might remember that <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> sometimes removes
1.97 rillig 4121: <code class="literal">${.TARGET}</code> in case of error, but this only
4122: happens when it is interrupted, for example by pressing
1.267 rillig 4123: <code class="literal">Ctrl+C</code>. This does <span class="emphasis"><em>not</em></span> happen
1.270 ! leot 4124: when one of the commands fails (like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?false+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p>
1.97 rillig 4125: </li></ul></div>
4126: </div>
1.148 asau 4127: <div class="sect1">
1.97 rillig 4128: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4129: <a name="makefile.variables"></a>14.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
1.76 rillig 4130: <p><code class="filename">Makefile</code> variables contain strings that
1.267 rillig 4131: can be processed using the five operators <code class="code">=</code>,
4132: <code class="code">+=</code>, <code class="code">?=</code>, <code class="code">:=</code> and
1.270 ! leot 4133: <code class="code">!=</code>, which are described in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man
1.75 rillig 4134: page.</p>
4135: <p>When a variable's value is parsed from a
1.267 rillig 4136: <code class="filename">Makefile</code>, the hash character <code class="code">#</code> and
4137: the backslash character <code class="code">\</code> are handled specially. If a
4138: backslash is the last character in a line, that backslash is removed
4139: from the line and the line continues with the next line of the file.</p>
4140: <p>The <code class="code">#</code> character starts a comment that reaches
4141: until the end of the line. To get an actual <code class="code">#</code> character,
4142: such as in a URL, write <code class="code">\#</code> instead.</p>
1.219 rillig 4143: <p>The evaluation of variables either happens immediately or lazy.
1.267 rillig 4144: It happens immediately when the variable occurs on the right-hand
4145: side of the <code class="code">:=</code> or the <code class="code">!=</code> operator, in a
1.219 rillig 4146: <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
4147: In the other cases, it is evaluated lazily.</p>
1.75 rillig 4148: <p>Some of the modifiers split the string into words and then
1.267 rillig 4149: operate on the words, others operate on the string as a whole. When a
4150: string is split into words, double quotes and single quotes are
1.270 ! leot 4151: interpreted as delimiters, just like in <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sh+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p>
1.148 asau 4152: <div class="sect2">
1.75 rillig 4153: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4154: <a name="makefile.variables.names"></a>14.2.1. Naming conventions</h3></div></div></div>
1.148 asau 4155: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4156: <li class="listitem"><p>All variable names starting with an underscore
1.75 rillig 4157: are reserved for use by the pkgsrc infrastructure. They shall
1.267 rillig 4158: not be used by packages.</p></li>
1.128 wiz 4159: <li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
1.75 rillig 4160: lowercase variable names for the iteration
4161: variables.</p></li>
1.267 rillig 4162: <li class="listitem"><p>All list variables should have a plural name,
4163: such as <code class="varname">PKG_OPTIONS</code> or
1.75 rillig 4164: <code class="varname">DISTFILES</code>.</p></li>
4165: </ul></div>
4166: </div>
4167: </div>
1.148 asau 4168: <div class="sect1">
1.75 rillig 4169: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4170: <a name="makefile.code"></a>14.3. Code snippets</h2></div></div></div>
1.148 asau 4171: <div class="sect2">
1.75 rillig 4172: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4173: <a name="adding-to-list"></a>14.3.1. Adding things to a list</h3></div></div></div>
1.220 wiz 4174: <p>When adding a string that possibly contains whitespace or quotes to
4175: a list (example 1), it must be quoted using the <code class="code">:Q</code>
4176: modifier.</p>
4177: <p>When adding another list to a list (example 2), it must not be
4178: quoted, since its elements are already quoted.</p>
1.75 rillig 4179: <pre class="programlisting">
1.220 wiz 4180: STRING= foo * bar `date`
4181: LIST= # empty
4182: ANOTHER_LIST= a=b c=d
4183:
4184: LIST+= ${STRING:Q} # 1
4185: LIST+= ${ANOTHER_LIST} # 2
4186: </pre>
1.75 rillig 4187: </div>
1.148 asau 4188: <div class="sect2">
1.75 rillig 4189: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4190: <a name="echo-literal"></a>14.3.2. Echoing a string exactly as-is</h3></div></div></div>
1.220 wiz 4191: <p>Echoing a string containing special characters needs special
4192: work.</p>
1.75 rillig 4193: <pre class="programlisting">
1.100 rillig 4194: STRING= foo bar < > * `date` $$HOME ' "
1.219 rillig 4195: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 grant 4196:
1.100 rillig 4197: all:
4198: echo ${STRING} # 1
1.219 rillig 4199: echo ${STRING:Q} # 2
4200: printf '%s\n' ${STRING:Q}'' # 3
1.220 wiz 4201: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 grant 4202: </pre>
1.220 wiz 4203: <p>Example 1 leads to a syntax error in the shell, as the characters
4204: are just copied.</p>
4205: <p>Example 2 quotes the string so that the shell interprets it
4206: correctly. But the echo command may additionally interpret strings with a
4207: leading dash or those containing backslashes.</p>
1.270 ! leot 4208: <p>Example 3 can handle arbitrary strings, since <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?printf+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> only
1.252 leot 4209: interprets the format string, but not the next argument. The trailing
4210: single quotes handle the case when the string is empty. In that case, the
4211: :Q modifier would result in an empty string too, which would then be
1.270 ! leot 4212: skipped by the shell. For <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?printf+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> this doesn't make a difference,
1.252 leot 4213: but other programs may care.</p>
1.220 wiz 4214: <p>In example 4, the <code class="varname">EXAMPLE_ENV</code> does not
4215: need to be quoted because the quoting has already been done
4216: when adding elements to the list.</p>
1.75 rillig 4217: </div>
1.148 asau 4218: <div class="sect2">
1.75 rillig 4219: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4220: <a name="cflags-gnu-configure"></a>14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</h3></div></div></div>
1.220 wiz 4221: <p>When passing <code class="varname">CFLAGS</code> or similar variables to a
4222: GNU-style configure script (especially those that call other configure
4223: scripts), it must not have leading or trailing whitespace, since
4224: otherwise the configure script gets confused. To trim leading and
4225: trailing whitespace, use the <code class="code">:M</code> modifier, as in the
4226: following example:</p>
1.75 rillig 4227: <pre class="programlisting">
1.100 rillig 4228: CPPFLAGS= # empty
1.220 wiz 4229: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
1.100 rillig 4230: CPPFLAGS+= ${MY_CPPFLAGS}
4231:
4232: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
4233:
4234: all:
4235: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
1.220 wiz 4236: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 grant 4237: </pre>
1.220 wiz 4238: <p>In this example, <code class="varname">CPPFLAGS</code> has both leading and
4239: trailing whitespace because the <code class="code">+=</code> operator always adds a
4240: space.</p>
4241: </div>
4242: <div class="sect2">
4243: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4244: <a name="empty-variables"></a>14.3.4. Handling possibly empty variables</h3></div></div></div>
1.220 wiz 4245: <p>When a possibly empty variable is used in a shell program, it may
4246: lead to a syntax error.</p>
4247: <pre class="programlisting">
4248: EGFILES= # empty
4249:
4250: install-examples: # produces a syntax error in the shell
4251: for egfile in ${EGFILES}; do \
4252: echo "Installing $$egfile"; \
4253: done
4254: </pre>
4255: <p>The shell only sees the text <code class="code">for egfile in ; do</code>, since
1.270 ! leot 4256: <code class="code">${EGFILES}</code> is replaced with an empty string by <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>.
1.220 wiz 4257: To fix this syntax error, use one of the snippets below.</p>
4258: <pre class="programlisting">
4259: EMPTY= # empty
4260:
4261: install-examples:
4262: for egfile in ${EGFILES} ""; do \
4263: [ -n "$$egfile" ] || continue; \
4264: echo "Installing $$egfile"; \
1.100 rillig 4265: done
1.220 wiz 4266: </pre>
4267: <p>In this case, an empty string is appended to the iteration list (to
4268: prevent the syntax error) and filtered out later.</p>
4269: <pre class="programlisting">
4270: EGFILES= # empty
1.100 rillig 4271:
1.220 wiz 4272: install-examples:
4273: .for egfile in ${EGFILES}
4274: echo "Installing ${egfile}"
1.100 rillig 4275: .endfor
1.1 grant 4276: </pre>
1.267 rillig 4277: <p>If one of the filenames contains special characters, it should be
4278: enclosed in single or double quotes.</p>
1.220 wiz 4279: <p>To have a shell command test whether a make variable is empty, use
4280: the following code: <code class="code">${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</p>
1.75 rillig 4281: </div>
4282: </div>
4283: </div>
1.148 asau 4284: <div class="chapter">
1.75 rillig 4285: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 4286: <a name="plist"></a>Chapter 15. PLIST issues</h2></div></div></div>
1.75 rillig 4287: <div class="toc">
4288: <p><b>Table of Contents</b></p>
1.210 leot 4289: <dl class="toc">
1.267 rillig 4290: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
4291: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
4292: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
4293: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
4294: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
4295: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
4296: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
4297: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
4298: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.75 rillig 4299: </dl>
4300: </div>
1.87 wiz 4301: <p>The <code class="filename">PLIST</code> file contains a package's
1.128 wiz 4302: <span class="quote">“<span class="quote">packing list</span>”</span>, i.e. a list of files that belong to
1.87 wiz 4303: the package (relative to the <code class="filename">${PREFIX}</code>
4304: directory it's been installed in) plus some additional statements
1.270 ! leot 4305: - see the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list.
1.87 wiz 4306: This chapter addresses some issues that need attention when
4307: dealing with the <code class="filename">PLIST</code> file (or files, see
4308: below!).</p>
1.148 asau 4309: <div class="sect1">
1.75 rillig 4310: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4311: <a name="rcs-id"></a>15.1. RCS ID</h2></div></div></div>
1.87 wiz 4312: <p>Be sure to add a RCS ID line as the first thing in any
4313: <code class="filename">PLIST</code> file you write:</p>
1.75 rillig 4314: <pre class="programlisting">
1.233 sevan 4315: @comment $NetBSD $
1.222 sevan 4316: </pre>
1.235 yyamano 4317: <p>An artificial space has been added between NetBSD and $, this is a
1.233 sevan 4318: workaround here to prevent CVS expanding to the filename of the guide. When
1.238 leot 4319: adding the RCS ID the space should be omitted.</p>
1.75 rillig 4320: </div>
1.148 asau 4321: <div class="sect1">
1.75 rillig 4322: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4323: <a name="automatic-plist-generation"></a>15.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
1.110 hubertf 4324: <p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
1.87 wiz 4325: to output a PLIST that matches any new files since the package
1.267 rillig 4326: was extracted. See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, “Other helpful targets”</a> for
1.87 wiz 4327: more information on this target.</p>
1.75 rillig 4328: </div>
1.148 asau 4329: <div class="sect1">
1.75 rillig 4330: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4331: <a name="print-PLIST"></a>15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
1.93 rillig 4332: </h2></div></div></div>
1.87 wiz 4333: <p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
4334: of AWK patterns and actions that are used to filter the output of
4335: print-PLIST. You can <span class="emphasis"><em>append</em></span> any chunk of AWK
4336: scripting you like to it, but be careful with quoting.</p>
4337: <p>For example, to get all files inside the
4338: <code class="filename">libdata/foo</code> directory removed from the
4339: resulting PLIST:</p>
4340: <pre class="programlisting">
1.100 rillig 4341: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.222 sevan 4342: </pre>
1.75 rillig 4343: </div>
1.148 asau 4344: <div class="sect1">
1.75 rillig 4345: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4346: <a name="plist.misc"></a>15.4. Variable substitution in PLIST</h2></div></div></div>
1.87 wiz 4347: <p>A number of variables are substituted automatically in
4348: PLISTs when a package is installed on a system. This includes the
4349: following variables:</p>
1.148 asau 4350: <div class="variablelist"><dl class="variablelist">
1.75 rillig 4351: <dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
4352: <dd>
4353: <p>Some packages like emacs and perl embed information
1.87 wiz 4354: about which architecture they were built on into the
4355: pathnames where they install their files. To handle this
4356: case, PLIST will be preprocessed before actually used, and
4357: the symbol
1.128 wiz 4358: <span class="quote">“<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>”</span> will be
1.110 hubertf 4359: replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
1.87 wiz 4360: same is done if the string
4361: <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
4362: PLIST somewhere - use this on packages that have GNU
4363: autoconf-created configure scripts.</p>
1.148 asau 4364: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 4365: <h3 class="title">Legacy note</h3>
4366: <p>There used to be a symbol
1.128 wiz 4367: <span class="quote">“<span class="quote"><code class="varname">$ARCH</code></span>”</span> that
1.110 hubertf 4368: was replaced by the output of <span class="command"><strong>uname
1.87 wiz 4369: -m</strong></span>, but that's no longer supported and has
4370: been removed.</p>
1.75 rillig 4371: </div>
4372: </dd>
4373: <dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
4374: <dd>
4375: <p>Some packages want to embed the OS name and version
1.87 wiz 4376: into some paths. To do this, use these variables in the
4377: <code class="filename">PLIST</code>:
4378: </p>
1.148 asau 4379: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4380: <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>
4381: <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>
4382: <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>
1.75 rillig 4383: </ul></div>
4384: </dd>
4385: </dl></div>
1.199 tnn 4386: <p>For a list of values which are replaced by
4387: default, the output of <span class="command"><strong>make help topic=PLIST_SUBST</strong></span> as
4388: well as searching the <code class="filename">pkgsrc/mk</code> directory with <span class="command"><strong>grep</strong></span> for
4389: <code class="varname">PLIST_SUBST</code> should help.</p>
1.87 wiz 4390: <p>If you want to change other variables not listed above, you
4391: can add variables and their expansions to this variable in the
1.267 rillig 4392: following way, similar to <code class="varname">MESSAGE_SUBST</code> (see <a class="xref" href="#components.optional" title="13.5. Optional files">Section 13.5, “Optional files”</a>):</p>
1.75 rillig 4393: <pre class="programlisting">
1.100 rillig 4394: PLIST_SUBST+= SOMEVAR="somevalue"
1.222 sevan 4395: </pre>
1.128 wiz 4396: <p>This replaces all occurrences of <span class="quote">“<span class="quote">${SOMEVAR}</span>”</span>
1.87 wiz 4397: in the <code class="filename">PLIST</code> with
1.128 wiz 4398: <span class="quote">“<span class="quote">somevalue</span>”</span>.</p>
1.120 snj 4399: <p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
1.119 mishka 4400: the common case of conditionally including some
4401: <code class="filename">PLIST</code> entries. It can be done by adding
4402: <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
1.120 snj 4403: setting the corresponding <code class="varname">PLIST.foo</code> variable
4404: to <code class="literal">yes</code> if the entry should be included.
1.128 wiz 4405: This will substitute <span class="quote">“<span class="quote"><code class="varname">${PLIST.foo}</code></span>”</span>
1.119 mishka 4406: in the <code class="filename">PLIST</code> with either
1.128 wiz 4407: <span class="quote">“<span class="quote"><code class="literal">""</code></span>”</span> or
4408: <span class="quote">“<span class="quote"><code class="literal">"@comment "</code></span>”</span>.
1.119 mishka 4409: For example, in <code class="filename">Makefile</code>:</p>
4410: <pre class="programlisting">
1.223 rillig 4411: PLIST_VARS+= foo
1.119 mishka 4412: .if <em class="replaceable"><code>condition</code></em>
1.223 rillig 4413: PLIST.foo= yes
1.119 mishka 4414: .else
1.222 sevan 4415: </pre>
1.119 mishka 4416: <p>And then in <code class="filename">PLIST</code>:</p>
4417: <pre class="programlisting">
1.233 sevan 4418: @comment $NetBSD $
1.119 mishka 4419: bin/bar
4420: man/man1/bar.1
4421: ${PLIST.foo}bin/foo
4422: ${PLIST.foo}man/man1/foo.1
4423: ${PLIST.foo}share/bar/foo.data
1.222 sevan 4424: </pre>
1.235 yyamano 4425: <p>An artificial space has been added between NetBSD and $, this is a
1.233 sevan 4426: workaround here to prevent CVS expanding to the filename of the guide. When
4427: adding the RCS ID the space should be ommited.</p>
1.75 rillig 4428: </div>
1.148 asau 4429: <div class="sect1">
1.75 rillig 4430: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4431: <a name="manpage-compression"></a>15.5. Man page compression</h2></div></div></div>
1.75 rillig 4432: <p>Man pages should be installed in compressed form if
1.87 wiz 4433: <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
4434: and uncompressed otherwise. To handle this in the
1.128 wiz 4435: <code class="filename">PLIST</code> file, the suffix <span class="quote">“<span class="quote">.gz</span>”</span> is
1.87 wiz 4436: appended/removed automatically for man pages according to
4437: <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
4438: or not, see above for details. This modification of the
4439: <code class="filename">PLIST</code> file is done on a copy of it, not
4440: <code class="filename">PLIST</code> itself.</p>
1.75 rillig 4441: </div>
1.148 asau 4442: <div class="sect1">
1.75 rillig 4443: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4444: <a name="using-PLIST_SRC"></a>15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
1.93 rillig 4445: </h2></div></div></div>
1.76 rillig 4446: <p>To use one or more files as source for the <code class="filename">PLIST</code> used
1.87 wiz 4447: in generating the binary package, set the variable
4448: <code class="varname">PLIST_SRC</code> to the names of that file(s).
1.270 ! leot 4449: The files are later concatenated using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cat+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is
1.87 wiz 4450: important. The default for <code class="varname">PLIST_SRC</code> is
4451: <code class="filename">${PKGDIR}/PLIST</code>.</p>
1.75 rillig 4452: </div>
1.148 asau 4453: <div class="sect1">
1.75 rillig 4454: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4455: <a name="platform-specific-plist"></a>15.7. Platform-specific and differing PLISTs</h2></div></div></div>
1.75 rillig 4456: <p>Some packages decide to install a different set of files based on
1.87 wiz 4457: the operating system being used. These differences can be
4458: automatically handled by using the following files:</p>
1.148 asau 4459: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4460: <li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
4461: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
4462: <li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
4463: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
4464: <li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
1.75 rillig 4465: </ul></div>
4466: </div>
1.148 asau 4467: <div class="sect1">
1.75 rillig 4468: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4469: <a name="build-plist"></a>15.8. Build-specific PLISTs</h2></div></div></div>
1.197 wiz 4470: <p>Some packages decide to generate hard-to-guess file names
4471: during installation that are hard to wire down.</p>
4472: <p>In such cases, you can set the
4473: <code class="varname">GENERATE_PLIST</code> variable to shell code
4474: terminated (with a semicolon) that will output PLIST entries which
4475: will be appended to the PLIST</p>
4476: <p>You can find one example in editors/xemacs:</p>
4477: <pre class="programlisting">
1.222 sevan 4478: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
4479: </pre>
1.197 wiz 4480: <p>which will append something like
4481: <code class="filename">bin/xemacs-21.4.23-54e8ea71.dmp</code> to the
4482: <code class="filename">PLIST</code>.
4483: </p>
4484: </div>
4485: <div class="sect1">
4486: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4487: <a name="faq.common-dirs"></a>15.9. Sharing directories between packages</h2></div></div></div>
1.128 wiz 4488: <p>A <span class="quote">“<span class="quote">shared directory</span>”</span> is a directory where
1.87 wiz 4489: multiple (and unrelated) packages install files. These
1.125 wiz 4490: directories were problematic because you had to add special
4491: tricks in the PLIST to conditionally remove them, or have some
1.87 wiz 4492: centralized package handle them.</p>
1.125 wiz 4493: <p>In pkgsrc, it is now easy: Each package should create
4494: directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
4495: will remove any directories left empty after uninstalling a
4496: package.</p>
4497: <p>If a package needs an empty directory to work, create
4498: the directory during installation as usual, and also add an
4499: entry to the PLIST:
1.222 sevan 4500:
4501: </p>
1.87 wiz 4502: <pre class="programlisting">
1.125 wiz 4503: @pkgdir path/to/empty/directory
1.222 sevan 4504: </pre>
1.125 wiz 4505: <p>
1.222 sevan 4506:
1.197 wiz 4507: or take a look at <code class="varname">MAKE_DIRS</code> and
4508: <code class="varname">OWN_DIRS</code>.
1.125 wiz 4509: </p>
1.75 rillig 4510: </div>
4511: </div>
1.148 asau 4512: <div class="chapter">
1.75 rillig 4513: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 4514: <a name="buildlink"></a>Chapter 16. Buildlink methodology</h2></div></div></div>
1.75 rillig 4515: <div class="toc">
4516: <p><b>Table of Contents</b></p>
1.210 leot 4517: <dl class="toc">
1.267 rillig 4518: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
4519: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.75 rillig 4520: <dd><dl>
1.267 rillig 4521: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
4522: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.133 wiz 4523: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4524: and
4525: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4526: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.75 rillig 4527: </dl></dd>
1.267 rillig 4528: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.75 rillig 4529: <dd><dl>
1.267 rillig 4530: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
4531: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.75 rillig 4532: </dl></dd>
4533: </dl>
4534: </div>
4535: <p>Buildlink is a framework in pkgsrc that controls what headers and libraries
1.87 wiz 4536: are seen by a package's configure and build processes. This is implemented
4537: in a two step process:</p>
1.128 wiz 4538: <div class="orderedlist"><ol class="orderedlist" type="1">
4539: <li class="listitem"><p>Symlink headers and libraries for dependencies into
1.87 wiz 4540: <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
4541: of <code class="varname">WRKDIR</code>.</p></li>
1.128 wiz 4542: <li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
1.87 wiz 4543: tools that translate <code class="option">-I${LOCALBASE}/include</code> and
4544: <code class="option">-L${LOCALBASE}/lib</code> into references to
4545: <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
4546: native compiler on some operating systems look like GCC, so that
4547: packages that expect GCC won't require modifications to build with
4548: those native compilers.</p></li>
1.75 rillig 4549: </ol></div>
4550: <p>This normalizes the environment in which a package is built so that the
1.87 wiz 4551: package may be built consistently despite what other software may be
4552: installed. Please note that the normal system header and library paths,
4553: e.g. <code class="filename">/usr/include</code>,
4554: <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
4555: designed to insulate the package build from non-system-supplied
4556: software.</p>
1.148 asau 4557: <div class="sect1">
1.75 rillig 4558: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4559: <a name="converting-to-buildlink3"></a>16.1. Converting packages to use buildlink3</h2></div></div></div>
1.75 rillig 4560: <p>The process of converting packages to use the buildlink3
1.128 wiz 4561: framework (<span class="quote">“<span class="quote">bl3ifying</span>”</span>) is fairly straightforward.
1.87 wiz 4562: The things to keep in mind are:</p>
1.128 wiz 4563: <div class="orderedlist"><ol class="orderedlist" type="1">
4564: <li class="listitem"><p>Ensure that the build always calls the wrapper scripts
1.87 wiz 4565: instead of the actual toolchain. Some packages are tricky,
4566: and the only way to know for sure is the check
4567: <code class="filename">${WRKDIR}/.work.log</code> to see if the
4568: wrappers are being invoked.</p></li>
1.128 wiz 4569: <li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
1.87 wiz 4570: the package Makefile, e.g. Java VMs, standalone shells,
4571: etc., because the code to symlink files into
4572: <code class="filename">${BUILDLINK_DIR}</code> looks for files
1.128 wiz 4573: relative to <span class="quote">“<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>”</span>.
1.87 wiz 4574: </p></li>
1.128 wiz 4575: <li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
1.87 wiz 4576: <code class="filename">buildlink3.mk</code> files that you list in a
4577: package's Makefile are added as dependencies for that package.
4578: </p></li>
1.75 rillig 4579: </ol></div>
1.87 wiz 4580: <p>If a dependency on a particular package is required for its libraries and
4581: headers, then we replace:</p>
1.75 rillig 4582: <pre class="programlisting">
1.100 rillig 4583: DEPENDS+= foo>=1.1.0:../../category/foo
4584: </pre>
1.75 rillig 4585: <p>with</p>
4586: <pre class="programlisting">
1.100 rillig 4587: .include "../../category/foo/buildlink3.mk"
4588: </pre>
1.75 rillig 4589: <p>The buildlink3.mk files usually define the required dependencies.
4590: If you need a newer version of the dependency when using buildlink3.mk
1.87 wiz 4591: files, then you can define it in your Makefile; for example:</p>
1.75 rillig 4592: <pre class="programlisting">
1.100 rillig 4593: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
4594: .include "../../category/foo/buildlink3.mk"
4595: </pre>
1.76 rillig 4596: <p>There are several <code class="filename">buildlink3.mk</code>
1.87 wiz 4597: files in <code class="filename">pkgsrc/mk</code>
4598: that handle special package issues:</p>
1.148 asau 4599: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4600: <li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
1.87 wiz 4601: the native or a pkgsrc Berkeley DB implementation based on
4602: the values of <code class="varname">BDB_ACCEPTED</code> and
4603: <code class="varname">BDB_DEFAULT</code>.</p></li>
1.128 wiz 4604: <li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
1.87 wiz 4605: comes with neither Curses nor NCurses, this will take care
1.250 leot 4606: to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/ncurses/README.html" target="_top"><code class="filename">devel/ncurses</code></a> package.</p></li>
1.128 wiz 4607: <li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
1.87 wiz 4608: of <code class="varname">KRB5_ACCEPTED</code> to choose between
4609: adding a dependency on Heimdal or MIT-krb5 for packages that
4610: require a Kerberos 5 implementation.</p></li>
1.128 wiz 4611: <li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
1.88 wiz 4612: system-provided Motif installation or adds a dependency on
1.250 leot 4613: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/lesstif/README.html" target="_top"><code class="filename">x11/lesstif</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/motif/README.html" target="_top"><code class="filename">x11/motif</code></a>. The user can set
1.128 wiz 4614: <code class="varname">MOTIF_TYPE</code> to <span class="quote">“<span class="quote">dt</span>”</span>,
1.239 leot 4615: <span class="quote">“<span class="quote">lesstif</span>”</span> or <span class="quote">“<span class="quote">motif</span>”</span>
4616: to choose which Motif version will be used.</p></li>
1.161 ryoon 4617: <li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
1.162 wiz 4618: system-provided GNU readline or editline (libedit) installation,
1.250 leot 4619: or adds a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/readline/README.html" target="_top"><code class="filename">devel/readline</code></a>,
4620: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/editline/README.html" target="_top"><code class="filename">devel/editline</code></a>. The user can set
1.161 ryoon 4621: <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
4622: If your package really needs GNU readline library, its Makefile
4623: should include <code class="filename">devel/readline/buildlink3.mk</code>
4624: instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
1.128 wiz 4625: <li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
1.87 wiz 4626: variables that may be used by packages that use the
4627: Open Sound System (OSS) API.</p></li>
1.128 wiz 4628: <li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
1.142 wiz 4629: any of the Postgres versions in the variable
4630: <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
4631: the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
1.87 wiz 4632: the file for more information.</p></li>
1.128 wiz 4633: <li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
1.87 wiz 4634: <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
1.250 leot 4635: a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pth/README.html" target="_top"><code class="filename">devel/pth</code></a> as needed.</p></li>
1.128 wiz 4636: <li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
1.87 wiz 4637: <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
4638: library.</p></li>
1.75 rillig 4639: </ul></div>
1.76 rillig 4640: <p>The comments in those <code class="filename">buildlink3.mk</code>
1.87 wiz 4641: files provide a more complete
4642: description of how to use them properly.</p>
1.75 rillig 4643: </div>
1.148 asau 4644: <div class="sect1">
1.75 rillig 4645: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4646: <a name="creating-buildlink3.mk"></a>16.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
1.107 rillig 4647: <a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
1.87 wiz 4648: included by Makefiles to indicate the need to compile and link
4649: against header files and libraries provided by the package. A
4650: <code class="filename">buildlink3.mk</code> file should always provide
4651: enough information to add the correct type of dependency
4652: relationship and include any other
4653: <code class="filename">buildlink3.mk</code> files that it needs to find
4654: headers and libraries that it needs in turn.</p>
4655: <p>To generate an initial <code class="filename">buildlink3.mk</code>
1.250 leot 4656: file for further editing, Rene Hexel's <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/createbuildlink/README.html" target="_top"><code class="filename">pkgtools/createbuildlink</code></a>
1.87 wiz 4657: package is highly recommended. For most packages, the following
4658: command will generate a good starting point for
4659: <code class="filename">buildlink3.mk</code> files:</p>
4660: <pre class="screen">
4661: <code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
4662: <code class="prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
4663: </pre>
1.148 asau 4664: <div class="sect2">
1.75 rillig 4665: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4666: <a name="anatomy-of-bl3"></a>16.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
1.75 rillig 4667: <p>The following real-life example
1.87 wiz 4668: <code class="filename">buildlink3.mk</code> is taken
4669: from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.75 rillig 4670: <pre class="programlisting">
1.120 snj 4671: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 grant 4672:
1.223 rillig 4673: BUILDLINK_TREE+= tiff
1.1 grant 4674:
1.120 snj 4675: .if !defined(TIFF_BUILDLINK3_MK)
4676: TIFF_BUILDLINK3_MK:=
1.87 wiz 4677:
1.223 rillig 4678: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
4679: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
4680: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.87 wiz 4681:
1.100 rillig 4682: .include "../../devel/zlib/buildlink3.mk"
4683: .include "../../graphics/jpeg/buildlink3.mk"
1.120 snj 4684: .endif # TIFF_BUILDLINK3_MK
1.87 wiz 4685:
1.223 rillig 4686: BUILDLINK_TREE+= -tiff
1.100 rillig 4687: </pre>
1.87 wiz 4688: <p>The header and footer manipulate
1.120 snj 4689: <code class="varname">BUILDLINK_TREE</code>, which is common across all
1.87 wiz 4690: <code class="filename">buildlink3.mk</code> files and is used to track
1.120 snj 4691: the dependency tree.</p>
4692: <p>The main section is protected from multiple inclusion
1.87 wiz 4693: and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
4694: added. Several important variables are set in the section:</p>
1.148 asau 4695: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4696: <li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4697: is the actual dependency recorded in the installed
4698: package; this should always be set using
1.110 hubertf 4699: <span class="command"><strong>+=</strong></span> to ensure that
1.87 wiz 4700: we're appending to any pre-existing list of values. This
4701: variable should be set to the first version of the
1.133 wiz 4702: package that had an backwards-incompatible API change.
1.87 wiz 4703: </p></li>
1.128 wiz 4704: <li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4705: is the location of the <em class="replaceable"><code>pkg</code></em>
4706: pkgsrc directory.</p></li>
1.128 wiz 4707: <li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4708: (not shown above) controls whether we use
4709: <code class="varname">BUILD_DEPENDS</code> or
4710: <code class="varname">DEPENDS</code> to add the dependency on
4711: <em class="replaceable"><code>pkg</code></em>. The build dependency is
4712: selected by setting
4713: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4714: to <span class="quote">“<span class="quote">build</span>”</span>. By default, the full dependency is
1.87 wiz 4715: used.</p></li>
1.128 wiz 4716: <li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4717: and
4718: <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
4719: (not shown above) are lists of subdirectories of
1.76 rillig 4720: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.75 rillig 4721: to add to the header and library search paths. These
1.128 wiz 4722: default to <span class="quote">“<span class="quote">include</span>”</span> and <span class="quote">“<span class="quote">lib</span>”</span>
1.87 wiz 4723: respectively.</p></li>
1.128 wiz 4724: <li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4725: (not shown above) is the list of preprocessor flags to add
4726: to <code class="varname">CPPFLAGS</code>, which are passed on to the
1.128 wiz 4727: configure and build phases. The <span class="quote">“<span class="quote">-I</span>”</span> option
1.75 rillig 4728: should be avoided and instead be handled using
4729: <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
1.87 wiz 4730: above.</p></li>
1.75 rillig 4731: </ul></div>
1.87 wiz 4732: <p>The following variables are all optionally defined within
4733: this second section (protected against multiple inclusion) and
4734: control which package files are symlinked into
4735: <code class="filename">${BUILDLINK_DIR}</code> and how their names are
4736: transformed during the symlinking:</p>
1.148 asau 4737: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4738: <li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4739: (not shown above) is a shell glob pattern relative to
1.76 rillig 4740: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.75 rillig 4741: to be symlinked into
1.76 rillig 4742: <code class="filename">${BUILDLINK_DIR}</code>,
1.87 wiz 4743: e.g. <code class="filename">include/*.h</code>.</p></li>
1.128 wiz 4744: <li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4745: (not shown above) is a shell pipeline that
4746: outputs to stdout a list of files relative to
4747: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
4748: The resulting files are to be symlinked
4749: into <code class="filename">${BUILDLINK_DIR}</code>. By default,
4750: this takes the <code class="filename">+CONTENTS</code> of a
4751: <em class="replaceable"><code>pkg</code></em> and filters it through
4752: <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
1.128 wiz 4753: <li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4754: (not shown above) is a filter command that filters
1.76 rillig 4755: <code class="filename">+CONTENTS</code> input into a list of files
1.75 rillig 4756: relative to
1.76 rillig 4757: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.194 bsiegert 4758: on stdout. By default,
1.75 rillig 4759: <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
1.76 rillig 4760: outputs the contents of the <code class="filename">include</code>
4761: and <code class="filename">lib</code> directories in the package
1.194 bsiegert 4762: <code class="filename">+CONTENTS</code>.</p></li>
1.128 wiz 4763: <li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4764: (not shown above) is a list of sed arguments used to
4765: transform the name of the source filename into a
1.110 hubertf 4766: destination filename, e.g. <span class="command"><strong>-e
1.87 wiz 4767: "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
1.75 rillig 4768: </ul></div>
1.120 snj 4769: <p>This section can additionally include any
1.87 wiz 4770: <code class="filename">buildlink3.mk</code> needed for
4771: <em class="replaceable"><code>pkg</code></em>'s library dependencies.
4772: Including these <code class="filename">buildlink3.mk</code> files
4773: means that the headers and libraries for these
4774: dependencies are also symlinked into
4775: <code class="filename">${BUILDLINK_DIR}</code>
4776: whenever the <em class="replaceable"><code>pkg</code></em>
4777: <code class="filename">buildlink3.mk</code>
1.120 snj 4778: file is included. Dependencies are only added for directly
4779: include <code class="filename">buildlink3.mk</code> files.</p>
1.153 wiz 4780: <p>When providing a <code class="filename">buildlink3.mk</code> and
4781: including other <code class="filename">buildlink3.mk</code> files in it,
1.156 wiz 4782: please only add necessary ones, i.e., those whose libraries or
1.153 wiz 4783: header files are automatically exposed when the package is
4784: use.</p>
4785: <p>In particular, if only an executable
4786: (<code class="filename">bin/foo</code>) is linked against a library, that
4787: library does not need to be propagated in the
4788: <code class="filename">buildlink3.mk</code> file.</p>
4789: <p>The following steps should help you decide if a
4790: <code class="filename">buildlink3.mk</code> file needs to be included:
4791: </p>
4792: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4793: <li class="listitem"><p>Look at the installed header files: What
4794: headers do they include? The packages providing these files
4795: must be buildlinked.</p></li>
1.155 wiz 4796: <li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
4797: libraries and look against what other libraries they link.
4798: Some of the packages providing these probably need to be
4799: buildlinked; however, it's not automatic, since e.g. GTK on
4800: some systems pulls in the X libraries, so they will show up in
4801: the <code class="filename">ldd</code> output, while on others (like OS
1.156 wiz 4802: X) it won't. <code class="filename">ldd</code> output can thus only be
1.155 wiz 4803: used as a hint.</p></li>
1.153 wiz 4804: </ul></div>
4805: <p>
4806: </p>
1.75 rillig 4807: </div>
1.148 asau 4808: <div class="sect2">
1.75 rillig 4809: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4810: <a name="updating-buildlink-depends"></a>16.2.2. Updating
1.87 wiz 4811: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.133 wiz 4812: and
4813: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4814: in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
4815: <p>These two variables differ in that one describes source
4816: compatibility (API) and the other binary compatibility (ABI).
4817: The difference is that a change in the API breaks compilation of
4818: programs while changes in the ABI stop compiled programs from
4819: running.</p>
4820: <p>Changes to the
1.134 wiz 4821: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.133 wiz 4822: variable in a <code class="filename">buildlink3.mk</code> file happen
4823: very rarely. One possible reason is that all packages depending
4824: on this already need a newer version. In case it is bumped see
4825: the description below.</p>
4826: <p>The most common example of an ABI change is that the major
4827: version of a shared library is increased. In this case,
4828: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4829: should be adjusted to require at least the new package version.
4830: Then the packages that depend on this package need their
4831: <code class="varname">PKGREVISION</code>s increased and, if they have
4832: <code class="filename">buildlink3.mk</code> files, their
4833: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4834: adjusted, too. This is needed so pkgsrc will require the correct
4835: package dependency and not settle for an older one when building
4836: the source.</p>
1.267 rillig 4837: <p>See <a class="xref" href="#dependencies" title="21.1.5. Handling dependencies">Section 21.1.5, “Handling dependencies”</a> for
1.133 wiz 4838: more information about dependencies on other packages,
4839: including the <code class="varname">BUILDLINK_ABI_DEPENDS</code> and
1.87 wiz 4840: <code class="varname">ABI_DEPENDS</code> definitions.</p>
4841: <p>Please take careful consideration before adjusting
4842: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4843: or
4844: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4845: as we don't want to cause unneeded package deletions and
4846: rebuilds. In many cases, new versions of packages work just
4847: fine with older dependencies.</p>
4848: <p>Also it is not needed to set
1.133 wiz 4849: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4850: when it is identical to
1.87 wiz 4851: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. </p>
1.75 rillig 4852: </div>
4853: </div>
1.148 asau 4854: <div class="sect1">
1.75 rillig 4855: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 4856: <a name="writing-builtin.mk"></a>16.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
1.87 wiz 4857: <p>Some packages in pkgsrc install headers and libraries that
1.75 rillig 4858: coincide with headers and libraries present in the base system.
1.76 rillig 4859: Aside from a <code class="filename">buildlink3.mk</code> file, these
4860: packages should also include a <code class="filename">builtin.mk</code>
1.75 rillig 4861: file that includes the necessary checks to decide whether using
4862: the built-in software or the pkgsrc software is
1.87 wiz 4863: appropriate.</p>
4864: <p>The only requirements of a builtin.mk file for
4865: <em class="replaceable"><code>pkg</code></em> are:</p>
1.128 wiz 4866: <div class="orderedlist"><ol class="orderedlist" type="1">
4867: <li class="listitem"><p>It should set
1.87 wiz 4868: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4869: to either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span>
1.87 wiz 4870: after it is included.</p></li>
1.128 wiz 4871: <li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
1.87 wiz 4872: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4873: which is already set before the
4874: <code class="filename">builtin.mk</code> file is included.</p></li>
1.128 wiz 4875: <li class="listitem"><p>It should be written to allow multiple inclusion. This
1.87 wiz 4876: is <span class="emphasis"><em>very</em></span> important and takes careful
4877: attention to <code class="filename">Makefile</code> coding.</p></li>
1.75 rillig 4878: </ol></div>
1.148 asau 4879: <div class="sect2">
1.75 rillig 4880: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4881: <a name="anatomy-of-builtin.mk"></a>16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div>
1.75 rillig 4882: <p>The following is the recommended template for builtin.mk
1.87 wiz 4883: files:</p>
1.75 rillig 4884: <pre class="programlisting">
1.100 rillig 4885: .if !defined(IS_BUILTIN.foo)
4886: #
4887: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
4888: # genuinely exists in the system or not.
4889: #
4890: IS_BUILTIN.foo?= no
4891:
4892: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
4893: # version can be determined.
4894: #
4895: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
4896: BUILTIN_PKG.foo?= foo-1.0
4897: . endif
4898: .endif # IS_BUILTIN.foo
4899:
4900: .if !defined(USE_BUILTIN.foo)
4901: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
4902: . if defined(BUILTIN_PKG.foo)
4903: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
4904: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
4905: USE_BUILTIN.foo!= \
4906: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
4907: && ${ECHO} "yes" || ${ECHO} "no"
4908: . endif
4909: . endfor
4910: . endif
4911: .endif # USE_BUILTIN.foo
4912:
4913: CHECK_BUILTIN.foo?= no
4914: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
4915: #
4916: # Here we place code that depends on whether USE_BUILTIN.foo is set to
4917: # "yes" or "no".
4918: #
4919: .endif # CHECK_BUILTIN.foo
4920: </pre>
1.87 wiz 4921: <p>The first section sets
4922: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4923: depending on if <em class="replaceable"><code>pkg</code></em> really exists
4924: in the base system. This should not be a base system software
4925: with similar functionality to <em class="replaceable"><code>pkg</code></em>;
1.128 wiz 4926: it should only be <span class="quote">“<span class="quote">yes</span>”</span> if the actual package is
1.87 wiz 4927: included as part of the base system. This variable is only
4928: used internally within the <code class="filename">builtin.mk</code>
4929: file.</p>
4930: <p>The second section sets
4931: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
4932: to the version of <em class="replaceable"><code>pkg</code></em> in the base
4933: system if it exists (if
4934: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4935: is <span class="quote">“<span class="quote">yes</span>”</span>). This variable is only used internally
1.87 wiz 4936: within the <code class="filename">builtin.mk</code> file.</p>
4937: <p>The third section sets
4938: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4939: and is <span class="emphasis"><em>required</em></span> in all
4940: <code class="filename">builtin.mk</code> files. The code in this
4941: section must make the determination whether the built-in
4942: software is adequate to satisfy the dependencies listed in
4943: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
4944: This is typically done by comparing
4945: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
4946: against each of the dependencies in
4947: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
4948: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4949: <span class="emphasis"><em>must</em></span> be set to the correct value by the
4950: end of the <code class="filename">builtin.mk</code> file. Note that
4951: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4952: may be <span class="quote">“<span class="quote">yes</span>”</span> even if
1.87 wiz 4953: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4954: is <span class="quote">“<span class="quote">no</span>”</span> because we may make the determination
1.87 wiz 4955: that the built-in version of the software is similar enough to
4956: be used as a replacement.</p>
4957: <p>The last section is guarded by
4958: <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
4959: and includes code that uses the value of
4960: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4961: set in the previous section. This typically includes, e.g.,
4962: adding additional dependency restrictions and listing additional
4963: files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
4964: <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
1.75 rillig 4965: </div>
1.148 asau 4966: <div class="sect2">
1.75 rillig 4967: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 4968: <a name="native-or-pkgsrc-preference"></a>16.3.2. Global preferences for native or pkgsrc software</h3></div></div></div>
1.87 wiz 4969: <p>When building packages, it's possible to choose whether to set
4970: a global preference for using either the built-in (native)
4971: version or the pkgsrc version of software to satisfy a
4972: dependency. This is controlled by setting
4973: <code class="varname">PREFER_PKGSRC</code> and
4974: <code class="varname">PREFER_NATIVE</code>. These variables take values
1.128 wiz 4975: of either <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">no</span>”</span>, or a list of
1.87 wiz 4976: packages. <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to
4977: use the pkgsrc versions of software, while
4978: <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the
4979: built-in versions. Preferences are determined by the most
4980: specific instance of the package in either
4981: <code class="varname">PREFER_PKGSRC</code> or
4982: <code class="varname">PREFER_NATIVE</code>. If a package is specified
4983: in neither or in both variables, then
4984: <code class="varname">PREFER_PKGSRC</code> has precedence over
4985: <code class="varname">PREFER_NATIVE</code>. For example, to require
4986: using pkgsrc versions of software for all but the most basic
4987: bits on a NetBSD system, you can set:</p>
4988: <pre class="programlisting">
1.100 rillig 4989: PREFER_PKGSRC= yes
4990: PREFER_NATIVE= getopt skey tcp_wrappers
4991: </pre>
1.87 wiz 4992: <p>A package <span class="emphasis"><em>must</em></span> have a
4993: <code class="filename">builtin.mk</code>
4994: file to be listed in <code class="varname">PREFER_NATIVE</code>,
4995: otherwise it is simply ignored in that list.</p>
1.229 sevan 4996: <p>Setting <code class="varname">PREFER_NATIVE</code> should be performed
4997: straight after bootstrap and <code class="varname">PREFER_PKGSRC</code> during
4998: bootstrap.
4999: Switching between settings globally at a later date can introduce
5000: complications with dependency resolution. This is caused by packages
5001: built with the opposite preference being installed alongside each other.</p>
5002: <pre class="screen">
5003: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes</code></strong>
5004: </pre>
1.75 rillig 5005: </div>
5006: </div>
5007: </div>
1.148 asau 5008: <div class="chapter">
1.75 rillig 5009: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 5010: <a name="pkginstall"></a>Chapter 17. The pkginstall framework</h2></div></div></div>
1.75 rillig 5011: <div class="toc">
5012: <p><b>Table of Contents</b></p>
1.210 leot 5013: <dl class="toc">
1.267 rillig 5014: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
1.75 rillig 5015: <dd><dl>
1.267 rillig 5016: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
5017: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
1.75 rillig 5018: </dl></dd>
1.267 rillig 5019: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
1.75 rillig 5020: <dd><dl>
1.267 rillig 5021: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
5022: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
5023: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
5024: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
5025: </dl></dd>
5026: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
5027: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
5028: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
5029: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
5030: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
5031: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
5032: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
1.75 rillig 5033: </dl>
5034: </div>
5035: <p>This chapter describes the framework known as
5036: <code class="literal">pkginstall</code>, whose key features are:</p>
1.148 asau 5037: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5038: <li class="listitem"><p>Generic installation and manipulation of directories and files
1.75 rillig 5039: outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
1.128 wiz 5040: <li class="listitem"><p>Automatic handling of configuration files during installation,
1.75 rillig 5041: provided that packages are correctly designed.</p></li>
1.128 wiz 5042: <li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
5043: <li class="listitem"><p>Registration of system users and groups.</p></li>
5044: <li class="listitem"><p>Registration of system shells.</p></li>
5045: <li class="listitem"><p>Automatic updating of fonts databases.</p></li>
1.75 rillig 5046: </ul></div>
5047: <p>The following sections inspect each of the above points in detail.</p>
5048: <p>You may be thinking that many of the things described here could be
5049: easily done with simple code in the package's post-installation target
5050: (<code class="literal">post-install</code>). <span class="emphasis"><em>This is incorrect</em></span>,
5051: as the code in them is only executed when building from source. Machines
5052: using binary packages could not benefit from it at all (as the code itself
5053: could be unavailable). Therefore, the only way to achieve any of the items
5054: described above is by means of the installation scripts, which are
5055: automatically generated by pkginstall.</p>
1.148 asau 5056: <div class="sect1">
1.75 rillig 5057: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5058: <a name="files-and-dirs-outside-prefix"></a>17.1. Files and directories outside the installation prefix</h2></div></div></div>
1.76 rillig 5059: <p>As you already know, the <code class="filename">PLIST</code> file holds a list
1.75 rillig 5060: of files and directories that belong to a package. The names used in it
1.76 rillig 5061: are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
1.75 rillig 5062: which means that it cannot register files outside this directory (absolute
5063: path names are not allowed). Despite this restriction, some packages need
5064: to install files outside this location; e.g., under
1.76 rillig 5065: <code class="filename">${VARBASE}</code> or
1.87 wiz 5066: <code class="filename">${PKG_SYSCONFDIR}</code>. The only way to achieve this
5067: is to create such files during installation time by using
5068: installation scripts.</p>
5069: <p>The generic installation scripts are shell scripts that can
5070: contain arbitrary code. The list of scripts to execute is taken from
5071: the <code class="varname">INSTALL_FILE</code> variable, which defaults to
5072: <code class="filename">INSTALL</code>. A similar variable exists for package
5073: removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
5074: <code class="filename">DEINSTALL</code>). These scripts can run arbitrary
5075: commands, so they have the potential to create and manage files
5076: anywhere in the file system.</p>
5077: <p>Using these general installation files is not recommended, but
5078: may be needed in some special cases. One reason for avoiding them is
5079: that the user has to trust the packager that there is no unwanted or
5080: simply erroneous code included in the installation script. Also,
5081: previously there were many similar scripts for the same functionality,
5082: and fixing a common error involved finding and changing all of
5083: them.</p>
5084: <p>The pkginstall framework offers another, standardized way. It
5085: provides generic scripts to abstract the manipulation of such files
5086: and directories based on variables set in the package's
5087: <code class="filename">Makefile</code>. The rest of this section describes
5088: these variables.</p>
1.148 asau 5089: <div class="sect2">
1.75 rillig 5090: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5091: <a name="dirs-outside-prefix"></a>17.1.1. Directory manipulation</h3></div></div></div>
1.75 rillig 5092: <p>The following variables can be set to request the creation of
5093: directories anywhere in the file system:</p>
1.148 asau 5094: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.218 rillig 5095: <li class="listitem">
5096: <p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
1.75 rillig 5097: contain a list of directories that should be created and should attempt
5098: to be destroyed by the installation scripts. The difference between
5099: the two is that the latter prompts the administrator to remove any
5100: directories that may be left after deinstallation (because they were
1.218 rillig 5101: not empty), while the former does not. Example:</p>
5102: <pre class="programlisting">
5103: MAKE_DIRS+= ${VARBASE}/foo/private
5104: </pre>
5105: </li>
1.128 wiz 5106: <li class="listitem">
1.75 rillig 5107: <p><code class="varname">MAKE_DIRS_PERMS</code> and
5108: <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
5109: which directories should be created and should attempt to be destroyed
5110: by the installation scripts. Each tuple holds the following values,
5111: separated by spaces: the directory name, its owner, its group and its
5112: numerical mode. For example:</p>
5113: <pre class="programlisting">
1.218 rillig 5114: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5115: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 grant 5116: </pre>
1.75 rillig 5117: <p>The difference between the two is exactly the same as their
5118: non-<code class="varname">PERMS</code> counterparts.</p>
5119: </li>
5120: </ul></div>
5121: </div>
1.148 asau 5122: <div class="sect2">
1.75 rillig 5123: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5124: <a name="files-outside-prefix"></a>17.1.2. File manipulation</h3></div></div></div>
1.75 rillig 5125: <p>Creating non-empty files outside the installation prefix is tricky
1.76 rillig 5126: because the <code class="filename">PLIST</code> forces all files to be inside it.
1.75 rillig 5127: To overcome this problem, the only solution is to extract the file in the
5128: known place (i.e., inside the installation prefix) and copy it to the
5129: appropriate location during installation (done by the installation scripts
5130: generated by pkginstall). We will call the former the <span class="emphasis"><em>master
5131: file</em></span> in the following paragraphs, which describe the variables
5132: that can be used to automatically and consistently handle files outside the
5133: installation prefix:</p>
1.148 asau 5134: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5135: <li class="listitem">
1.75 rillig 5136: <p><code class="varname">CONF_FILES</code> and
1.137 wiz 5137: <code class="varname">REQD_FILES</code> are pairs of master and target files.
1.75 rillig 5138: During installation time, the master file is copied to the target one
5139: if and only if the latter does not exist. Upon deinstallation, the
5140: target file is removed provided that it was not modified by the
5141: installation.</p>
5142: <p>The difference between the two is that the latter prompts the
5143: administrator to remove any files that may be left after
5144: deinstallation (because they were not empty), while the former does
5145: not.</p>
5146: </li>
1.128 wiz 5147: <li class="listitem">
1.75 rillig 5148: <p><code class="varname">CONF_FILES_PERMS</code> and
1.137 wiz 5149: <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master
1.75 rillig 5150: files as well as their target locations. For each of them, it also
5151: specifies their owner, their group and their numeric permissions, in
5152: this order. For example:</p>
5153: <pre class="programlisting">
1.218 rillig 5154: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5155: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 grant 5156: </pre>
1.75 rillig 5157: <p>The difference between the two is exactly the same as their
5158: non-<code class="varname">PERMS</code> counterparts.</p>
5159: </li>
5160: </ul></div>
5161: </div>
5162: </div>
1.148 asau 5163: <div class="sect1">
1.75 rillig 5164: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5165: <a name="conf-files"></a>17.2. Configuration files</h2></div></div></div>
1.75 rillig 5166: <p>Configuration files are special in the sense that they are installed
5167: in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and
5168: need special treatment during installation (most of which is automated by
5169: pkginstall). The main concept you must bear in mind is that files marked
5170: as configuration files are automatically copied to the right place (somewhere
5171: inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if
5172: and only if</em></span> they didn't exist before. Similarly, they will not
5173: be removed if they have local modifications. This ensures that
5174: administrators never lose any custom changes they may have made.</p>
1.148 asau 5175: <div class="sect2">
1.75 rillig 5176: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5177: <a name="conf-files-sysconfdir"></a>17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div>
1.75 rillig 5178: <p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
5179: specifies where configuration files shall be installed. Its contents are
5180: set based upon the following variables:</p>
1.148 asau 5181: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5182: <li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
1.76 rillig 5183: directory. Defaults to <code class="filename">${PREFIX}/etc</code> although it may
1.75 rillig 5184: be overridden by the user to point to his preferred location (e.g.,
1.76 rillig 5185: <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
1.75 rillig 5186: Packages must not use it directly.</p></li>
1.128 wiz 5187: <li class="listitem">
1.75 rillig 5188: <p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
5189: <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
5190: for the package being built shall be installed. The definition of this
5191: variable only makes sense in the package's
1.76 rillig 5192: <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
1.75 rillig 5193: <p>As an example, consider the Apache package,
1.250 leot 5194: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a>, which places its
1.75 rillig 5195: configuration files under the
1.76 rillig 5196: <code class="filename">httpd/</code> subdirectory of
1.75 rillig 5197: <code class="varname">PKG_SYSCONFBASE</code>. This should be set in the package
5198: Makefile.</p>
5199: </li>
1.128 wiz 5200: <li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
1.75 rillig 5201: variable that holds this package's configuration directory (if
5202: different from <code class="varname">PKG_SYSCONFBASE</code>). It defaults to
5203: <code class="varname">PKGBASE</code>'s value, and is always prefixed with
5204: <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
1.128 wiz 5205: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
1.75 rillig 5206: directory where the configuration files for the package identified by
5207: <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
5208: </ul></div>
5209: <p>Based on the above variables, pkginstall determines the value of
5210: <code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
5211: variable that can be used within a package to refer to its configuration
5212: directory. The algorithm used to set its value is basically the
5213: following:</p>
1.128 wiz 5214: <div class="orderedlist"><ol class="orderedlist" type="1">
5215: <li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
1.75 rillig 5216: its value is used.</p></li>
1.128 wiz 5217: <li class="listitem"><p>If the previous variable is not defined but
1.75 rillig 5218: <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
1.76 rillig 5219: <code class="filename">Makefile</code>, the resulting value is
5220: <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
1.128 wiz 5221: <li class="listitem"><p>Otherwise, it is set to
1.76 rillig 5222: <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
1.75 rillig 5223: </ol></div>
1.76 rillig 5224: <p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
1.267 rillig 5225: automatically added to <code class="filename">OWN_DIRS</code>. See <a class="xref" href="#dirs-outside-prefix" title="17.1.1. Directory manipulation">Section 17.1.1, “Directory manipulation”</a> what this means. This does not apply to
1.117 jnemeth 5226: subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to
5227: be created with OWN_DIRS or MAKE_DIRS.</p>
1.75 rillig 5228: </div>
1.148 asau 5229: <div class="sect2">
1.75 rillig 5230: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5231: <a name="conf-files-configure"></a>17.2.2. Telling the software where configuration files are</h3></div></div></div>
1.75 rillig 5232: <p>Given that pkgsrc (and users!) expect configuration files to be in a
5233: known place, you need to teach each package where it shall install its
5234: files. In some cases you will have to patch the package Makefiles to
5235: achieve it. If you are lucky, though, it may be as easy as passing an
5236: extra flag to the configuration script; this is the case of GNU Autoconf-
5237: generated files:</p>
5238: <pre class="programlisting">
1.100 rillig 5239: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 grant 5240: </pre>
1.75 rillig 5241: <p>Note that this specifies where the package has to <span class="emphasis"><em>look
5242: for</em></span> its configuration files, not where they will be originally
5243: installed (although the difference is never explicit,
5244: unfortunately).</p>
5245: </div>
1.148 asau 5246: <div class="sect2">
1.75 rillig 5247: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5248: <a name="conf-files-patching"></a>17.2.3. Patching installations</h3></div></div></div>
1.75 rillig 5249: <p>As said before, pkginstall automatically handles configuration files.
5250: This means that <span class="strong"><strong>the packages themselves must not
1.76 rillig 5251: touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
1.75 rillig 5252: directly</strong></span>. Bad news is that many software installation scripts
5253: will, out of the box, mess with the contents of that directory. So what is
5254: the correct procedure to fix this issue?</p>
5255: <p>You must teach the package (usually by manually patching it) to
5256: install any configuration files under the examples hierarchy,
1.76 rillig 5257: <code class="filename">share/examples/${PKGBASE}/</code>. This way, the
5258: <code class="filename">PLIST</code> registers them and the administrator always
1.75 rillig 5259: has the original copies available.</p>
5260: <p>Once the required configuration files are in place (i.e., under the
5261: examples hierarchy), the pkginstall framework can use them as master copies
5262: during the package installation to update what is in
1.76 rillig 5263: <code class="filename">${PKG_SYSCONFDIR}</code>. To achieve this, the variables
1.75 rillig 5264: <code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
1.267 rillig 5265: used. Check out <a class="xref" href="#files-outside-prefix" title="17.1.2. File manipulation">Section 17.1.2, “File manipulation”</a> for information
1.75 rillig 5266: about their syntax and their purpose. Here is an example, taken from the
1.250 leot 5267: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/README.html" target="_top"><code class="filename">mail/mutt</code></a> package:</p>
1.75 rillig 5268: <pre class="programlisting">
1.100 rillig 5269: EGDIR= ${PREFIX}/share/doc/mutt/samples
5270: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 grant 5271: </pre>
1.75 rillig 5272: <p>Note that the <code class="varname">EGDIR</code> variable is specific to that
5273: package and has no meaning outside it.</p>
5274: </div>
1.148 asau 5275: <div class="sect2">
1.75 rillig 5276: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5277: <a name="conf-files-disable"></a>17.2.4. Disabling handling of configuration files</h3></div></div></div>
1.75 rillig 5278: <p>The automatic copying of config files can be toggled by setting the
5279: environment variable <code class="varname">PKG_CONFIG</code> prior to package
5280: installation.</p>
5281: </div>
5282: </div>
1.148 asau 5283: <div class="sect1">
1.75 rillig 5284: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5285: <a name="rcd-scripts"></a>17.3. System startup scripts</h2></div></div></div>
1.75 rillig 5286: <p>System startup scripts are special files because they must be
5287: installed in a place known by the underlying OS, usually outside the
1.267 rillig 5288: installation prefix. Therefore, the same rules described in <a class="xref" href="#files-and-dirs-outside-prefix" title="17.1. Files and directories outside the installation prefix">Section 17.1, “Files and directories outside the installation prefix”</a> apply, and the same solutions
1.75 rillig 5289: can be used. However, pkginstall provides a special mechanism to handle
5290: these files.</p>
5291: <p>In order to provide system startup scripts, the package has
5292: to:</p>
1.128 wiz 5293: <div class="orderedlist"><ol class="orderedlist" type="1">
5294: <li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
1.75 rillig 5295: the <code class="literal">.sh</code> suffix appended. Considering the
1.250 leot 5296: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/cups/README.html" target="_top"><code class="filename">print/cups</code></a> package as an example, it has a
1.76 rillig 5297: <code class="filename">cupsd.sh</code> in its files directory.</p></li>
1.128 wiz 5298: <li class="listitem">
1.75 rillig 5299: <p>Tell pkginstall to handle it, appending the name of the script,
5300: without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
5301: Continuing the previous example:</p>
5302: <pre class="programlisting">
1.100 rillig 5303: RCD_SCRIPTS+= cupsd
1.1 grant 5304: </pre>
1.75 rillig 5305: </li>
5306: </ol></div>
5307: <p>Once this is done, pkginstall will do the following steps for each
5308: script in an automated fashion:</p>
1.128 wiz 5309: <div class="orderedlist"><ol class="orderedlist" type="1">
5310: <li class="listitem"><p>Process the file found in the files directory applying all the
1.76 rillig 5311: substitutions described in the <code class="filename">FILES_SUBST</code>
1.75 rillig 5312: variable.</p></li>
1.128 wiz 5313: <li class="listitem"><p>Copy the script from the files directory to the examples
1.76 rillig 5314: hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>. Note
1.75 rillig 5315: that this master file must be explicitly registered in the
1.76 rillig 5316: <code class="filename">PLIST</code>.</p></li>
1.128 wiz 5317: <li class="listitem"><p>Add code to the installation scripts to copy the startup script
1.75 rillig 5318: from the examples hierarchy into the system-wide startup scripts
5319: directory.</p></li>
5320: </ol></div>
1.148 asau 5321: <div class="sect2">
1.75 rillig 5322: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5323: <a name="rcd-scripts-disable"></a>17.3.1. Disabling handling of system startup scripts</h3></div></div></div>
1.75 rillig 5324: <p>The automatic copying of config files can be toggled by setting the
5325: environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
5326: installation. Note that the scripts will be always copied inside the
1.76 rillig 5327: examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
1.75 rillig 5328: matter what the value of this variable is.</p>
5329: </div>
5330: </div>
1.148 asau 5331: <div class="sect1">
1.75 rillig 5332: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5333: <a name="users-and-groups"></a>17.4. System users and groups</h2></div></div></div>
1.75 rillig 5334: <p>If a package needs to create special users and/or groups during
5335: installation, it can do so by using the pkginstall framework.</p>
5336: <p>Users can be created by adding entries to the
5337: <code class="varname">PKG_USERS</code> variable. Each entry has the following
5338: syntax:</p>
5339: <pre class="programlisting">
1.100 rillig 5340: user:group
1.1 grant 5341: </pre>
1.87 wiz 5342: <p>Further specification of user details may be done by setting
5343: per-user variables.
5344: <code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
5345: numeric UID for the user.
5346: <code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
5347: user's description or comment.
5348: <code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
5349: user's home directory, and defaults to
5350: <code class="filename">/nonexistent</code> if not specified.
5351: <code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
1.94 dmcmahil 5352: user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
1.87 wiz 5353: not specified.</p>
1.75 rillig 5354: <p>Similarly, groups can be created by adding entries to the
5355: <code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
5356: <pre class="programlisting">
1.100 rillig 5357: group
1.1 grant 5358: </pre>
1.93 rillig 5359: <p>The numeric GID of the group may be set by defining
1.75 rillig 5360: <code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
5361: <p>If a package needs to create the users and groups at an earlier
1.227 wiz 5362: stage, then it can set <code class="varname">USERGROUP_PHASE</code> to either
5363: <code class="literal">configure</code>,<code class="literal">build</code>, or
5364: <code class="literal">pre-install</code> to indicate the phase before which the
5365: users and groups are created. In this case, the numeric UIDs and GIDs
5366: of the created users and groups are automatically hardcoded into the
5367: final installation scripts.</p>
1.75 rillig 5368: </div>
1.148 asau 5369: <div class="sect1">
1.75 rillig 5370: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5371: <a name="shells"></a>17.5. System shells</h2></div></div></div>
1.75 rillig 5372: <p>Packages that install system shells should register them in the shell
1.76 rillig 5373: database, <code class="filename">/etc/shells</code>, to make things easier to the
1.75 rillig 5374: administrator. This must be done from the installation scripts to keep
5375: binary packages working on any system. pkginstall provides an easy way to
5376: accomplish this task.</p>
5377: <p>When a package provides a shell interpreter, it has to set the
5378: <code class="varname">PKG_SHELL</code> variable to its absolute file name. This will
5379: add some hooks to the installation scripts to handle it. Consider the
1.250 leot 5380: following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/zsh/README.html" target="_top"><code class="filename">shells/zsh</code></a>:</p>
1.75 rillig 5381: <pre class="programlisting">
1.100 rillig 5382: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 grant 5383: </pre>
1.148 asau 5384: <div class="sect2">
1.75 rillig 5385: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5386: <a name="shells-disable"></a>17.5.1. Disabling shell registration</h3></div></div></div>
1.75 rillig 5387: <p>The automatic registration of shell interpreters can be disabled by
1.76 rillig 5388: the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
1.75 rillig 5389: environment variable to <code class="literal">NO</code>.</p>
5390: </div>
5391: </div>
1.148 asau 5392: <div class="sect1">
1.75 rillig 5393: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5394: <a name="fonts"></a>17.6. Fonts</h2></div></div></div>
1.75 rillig 5395: <p>Packages that install X11 fonts should update the database files
5396: that index the fonts within each fonts directory. This can easily be
5397: accomplished within the pkginstall framework.</p>
5398: <p>When a package installs X11 fonts, it must list the directories in
5399: which fonts are installed in the
5400: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
1.128 wiz 5401: where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">“<span class="quote">ttf</span>”</span>,
5402: <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
1.75 rillig 5403: installation scripts to run the appropriate commands to update the fonts
5404: database files within each of those directories. For convenience, if the
5405: directory path is relative, it is taken to be relative to the package's
1.250 leot 5406: installation prefix. Consider the following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/fonts/dbz-ttf/README.html" target="_top"><code class="filename">fonts/dbz-ttf</code></a>:</p>
1.75 rillig 5407: <pre class="programlisting">
1.175 wiz 5408: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 grant 5409: </pre>
1.148 asau 5410: <div class="sect2">
1.75 rillig 5411: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5412: <a name="fonts-disable"></a>17.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
1.75 rillig 5413: <p>The automatic update of fonts databases can be disabled by
1.76 rillig 5414: the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
1.75 rillig 5415: environment variable to <code class="literal">NO</code>.</p>
5416: </div>
5417: </div>
5418: </div>
1.148 asau 5419: <div class="chapter">
1.75 rillig 5420: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 5421: <a name="options"></a>Chapter 18. Options handling</h2></div></div></div>
1.75 rillig 5422: <div class="toc">
5423: <p><b>Table of Contents</b></p>
1.210 leot 5424: <dl class="toc">
1.267 rillig 5425: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
5426: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
5427: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
5428: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
1.75 rillig 5429: </dl>
5430: </div>
5431: <p>Many packages have the ability to be built to support different
1.76 rillig 5432: sets of features. <code class="filename">bsd.options.mk</code> is a framework
1.75 rillig 5433: in pkgsrc that provides generic handling of those options that
5434: determine different ways in which the packages can be built. It's
5435: possible for the user to specify exactly which sets of options will be
5436: built into a package or to allow a set of global default options
5437: apply.</p>
1.107 rillig 5438: <p>There are two broad classes of behaviors that one might want to
5439: control via options. One is whether some particular feature is
5440: enabled in a program that will be built anyway, often by including or
5441: not including a dependency on some other package. The other is
5442: whether or not an additional program will be built as part of the
5443: package. Generally, it is better to make a split package for such
5444: additional programs instead of using options, because it enables
5445: binary packages to be built which can then be added separately. For
5446: example, the foo package might have minimal dependencies (those
5447: packages without which foo doesn't make sense), and then the foo-gfoo
5448: package might include the GTK frontend program gfoo. This is better
5449: than including a gtk option to foo that adds gfoo, because either that
5450: option is default, in which case binary users can't get foo without
5451: gfoo, or not default, in which case they can't get gfoo. With split
5452: packages, they can install foo without having GTK, and later decide to
5453: install gfoo (pulling in GTK at that time). This is an advantage to
5454: source users too, avoiding the need for rebuilds.</p>
5455: <p>Plugins with widely varying dependencies should usually be split
5456: instead of options.</p>
5457: <p>It is often more work to maintain split packages, especially if
5458: the upstream package does not support this. The decision of split
5459: vs. option should be made based on the likelihood that users will want
5460: or object to the various pieces, the size of the dependencies that are
5461: included, and the amount of work.</p>
5462: <p>A further consideration is licensing. Non-free parts, or parts
5463: that depend on non-free dependencies (especially plugins) should
5464: almost always be split if feasible.</p>
1.148 asau 5465: <div class="sect1">
1.75 rillig 5466: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5467: <a name="global-default-options"></a>18.1. Global default options</h2></div></div></div>
1.75 rillig 5468: <p>Global default options are listed in
5469: <code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
5470: that should be built into every package if that option is supported.
1.110 hubertf 5471: This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75 rillig 5472: </div>
1.148 asau 5473: <div class="sect1">
1.75 rillig 5474: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5475: <a name="converting-to-options"></a>18.2. Converting packages to use <code class="filename">bsd.options.mk</code>
1.93 rillig 5476: </h2></div></div></div>
1.75 rillig 5477: <p>The following example shows how
1.76 rillig 5478: <code class="filename">bsd.options.mk</code> should be used
1.75 rillig 5479: by the hypothetical ``wibble'' package, either in the package
1.76 rillig 5480: <code class="filename">Makefile</code>, or in a file,
5481: e.g. <code class="filename">options.mk</code>, that is included by the
5482: main package <code class="filename">Makefile</code>.</p>
1.75 rillig 5483: <pre class="programlisting">
1.100 rillig 5484: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
5485: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
5486: PKG_OPTIONS_OPTIONAL_GROUPS= database
5487: PKG_OPTIONS_GROUP.database= mysql pgsql
5488: PKG_SUGGESTED_OPTIONS= wibble-foo
5489: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
5490: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
5491:
5492: .include "../../mk/bsd.prefs.mk"
5493:
5494: # this package was previously named wibble2
5495: .if defined(PKG_OPTIONS.wibble2)
5496: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
5497: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
5498: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
5499: .endif
5500:
5501: .include "../../mk/bsd.options.mk"
5502:
5503: # Package-specific option-handling
5504:
5505: ###
5506: ### FOO support
5507: ###
5508: .if !empty(PKG_OPTIONS:Mwibble-foo)
5509: CONFIGURE_ARGS+= --enable-foo
5510: .endif
5511:
5512: ###
5513: ### LDAP support
5514: ###
5515: .if !empty(PKG_OPTIONS:Mldap)
5516: . include "../../databases/openldap-client/buildlink3.mk"
5517: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
5518: .endif
5519:
5520: ###
5521: ### database support
5522: ###
5523: .if !empty(PKG_OPTIONS:Mmysql)
5524: . include "../../mk/mysql.buildlink3.mk"
5525: .endif
5526: .if !empty(PKG_OPTIONS:Mpgsql)
5527: . include "../../mk/pgsql.buildlink3.mk"
5528: .endif
1.75 rillig 5529: </pre>
5530: <p>The first section contains the information about which build
5531: options are supported by the package, and any default options settings
5532: if needed.</p>
1.128 wiz 5533: <div class="orderedlist"><ol class="orderedlist" type="1">
5534: <li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
1.270 ! leot 5535: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> variable that the user can set to override the default
1.75 rillig 5536: options. It should be set to
1.78 rillig 5537: PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
5538: PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
5539: at the point where the options are processed.</p></li>
1.128 wiz 5540: <li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.75 rillig 5541: build options supported by the package.</p></li>
1.128 wiz 5542: <li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
1.75 rillig 5543: list of names of groups of mutually exclusive options. The options in
5544: each group are listed in
5545: <code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
5546: The most specific setting of any option from the group takes
5547: precedence over all other options in the group. Options from the
5548: groups will be automatically added to
5549: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
1.128 wiz 5550: <li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
1.75 rillig 5551: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
5552: packages will fail if no option from the group is
5553: selected.</p></li>
1.128 wiz 5554: <li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
1.75 rillig 5555: of names of sets of options. At least one option from each set must
5556: be selected. The options in each set are listed in
5557: <code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
5558: Options from the sets will be automatically added to
5559: <code class="varname">PKG_SUPPORTED_OPTIONS</code>. Building the package will
5560: fail if no option from the set is selected.</p></li>
1.128 wiz 5561: <li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
1.75 rillig 5562: build options which are enabled by default.</p></li>
1.128 wiz 5563: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
1.75 rillig 5564: of
1.128 wiz 5565: <span class="quote">“<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”</span>
1.110 hubertf 5566: pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
1.75 rillig 5567: their option counterparts. Pairs should be added with
1.128 wiz 5568: <span class="quote">“<span class="quote">+=</span>”</span> to keep the listing of global legacy variables. A
1.75 rillig 5569: warning will be issued if the user uses a legacy
5570: variable.</p></li>
1.128 wiz 5571: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
1.75 rillig 5572: of
1.128 wiz 5573: <span class="quote">“<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”</span>
1.75 rillig 5574: pairs that map options that have been renamed to their new
1.128 wiz 5575: counterparts. Pairs should be added with <span class="quote">“<span class="quote">+=</span>”</span> to keep
1.75 rillig 5576: the listing of global legacy options. A warning will be issued if
5577: the user uses a legacy option.</p></li>
1.128 wiz 5578: <li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
1.75 rillig 5579: options implied by deprecated variables used. This can be used for
5580: cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
5581: <code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
5582: <code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
1.128 wiz 5583: <li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
1.75 rillig 5584: a list of warnings about deprecated variables or options used, and
5585: what to use instead.</p></li>
5586: </ol></div>
5587: <p>A package should never modify
5588: <code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
5589: <code class="varname">PKG_OPTIONS_VAR</code>. These are strictly user-settable.
5590: To suggest a default set of options, use
5591: <code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
5592: <p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
1.76 rillig 5593: including <code class="filename">bsd.options.mk</code>. If none of
1.75 rillig 5594: <code class="varname">PKG_SUPPORTED_OPTIONS</code>,
5595: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
5596: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
5597: happen with platform-specific options if none of them is supported on
5598: the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
5599: empty list and the package is otherwise treated as not using the
5600: options framework.</p>
1.76 rillig 5601: <p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
1.75 rillig 5602: variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
5603: build options, properly filtered to remove unsupported and duplicate
5604: options.</p>
5605: <p>The remaining sections contain the logic that is specific to
5606: each option. The correct way to check for an option is to check
5607: whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
5608: <pre class="programlisting">
1.100 rillig 5609: .if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
1.75 rillig 5610: </pre>
5611: </div>
1.148 asau 5612: <div class="sect1">
1.75 rillig 5613: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5614: <a name="option-names"></a>18.3. Option Names</h2></div></div></div>
1.75 rillig 5615: <p>Options that enable similar features in different packages (like
5616: optional support for a library) should use a common name in all
5617: packages that support it (like the name of the library). If another
5618: package already has an option with the same meaning, use the same
5619: name.</p>
5620: <p>Options that enable features specific to one package, where it's
5621: unlikely that another (unrelated) package has the same (or a similar)
5622: optional feature, should use a name prefixed with
5623: <code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
5624: <p>If a group of related packages share an optional feature
5625: specific to that group, prefix it with the name of the
1.128 wiz 5626: <span class="quote">“<span class="quote">main</span>”</span> package
1.75 rillig 5627: (e. g. <code class="varname">djbware-errno-hack</code>).</p>
5628: <p>For new options, add a line to
1.76 rillig 5629: <code class="filename">mk/defaults/options.description</code>. Lines have two
1.75 rillig 5630: fields, separated by tab. The first field is the option name, the
5631: second its description. The description should be a whole sentence
5632: (starting with an uppercase letter and ending with a period) that
1.128 wiz 5633: describes what enabling the option does. E. g. <span class="quote">“<span class="quote">Enable ispell
5634: support.</span>”</span> The file is sorted by option names.</p>
1.75 rillig 5635: </div>
1.148 asau 5636: <div class="sect1">
1.107 rillig 5637: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5638: <a name="option-build"></a>18.4. Determining the options of dependencies</h2></div></div></div>
1.110 hubertf 5639: <p>When writing <a class="link" href="#buildlink3.mk"><code class="filename">buildlink3.mk</code></a> files, it is often necessary to list
1.107 rillig 5640: different dependencies based on the options with which the package was
5641: built. For querying these options, the file
5642: <code class="filename">pkgsrc/mk/pkg-build-options.mk</code> should be used. A
5643: typical example looks like this:</p>
5644: <pre class="programlisting">
5645: pkgbase := libpurple
5646: .include "../../mk/pkg-build-options.mk"
5647:
5648: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5649: ...
5650: .endif
5651: </pre>
5652: <p>Including <code class="filename">pkg-build-options.mk</code> here will set
5653: the variable <code class="varname">PKG_BUILD_OPTIONS.libpurple</code> to the build
5654: options of the libpurple package, which can then be queried like
5655: <code class="varname">PKG_OPTIONS</code> in the <code class="filename">options.mk</code>
5656: file. See the file <code class="filename">pkg-build-options.mk</code> for more
5657: details.</p>
5658: </div>
1.75 rillig 5659: </div>
1.148 asau 5660: <div class="chapter">
1.75 rillig 5661: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 5662: <a name="build"></a>Chapter 19. The build process</h2></div></div></div>
1.75 rillig 5663: <div class="toc">
5664: <p><b>Table of Contents</b></p>
1.210 leot 5665: <dl class="toc">
1.267 rillig 5666: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
5667: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
5668: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
5669: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
5670: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
5671: <dd><dl>
5672: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
5673: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
5674: </dl></dd>
5675: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
5676: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
5677: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
5678: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
5679: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
5680: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
5681: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
5682: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
5683: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
5684: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
5685: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
5686: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
1.75 rillig 5687: </dl>
5688: </div>
1.148 asau 5689: <div class="sect1">
1.75 rillig 5690: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5691: <a name="build.intro"></a>19.1. Introduction</h2></div></div></div>
1.75 rillig 5692: <p>This chapter gives a detailed description on how a package is
1.87 wiz 5693: built. Building a package is separated into different
5694: <span class="emphasis"><em>phases</em></span> (for example <code class="varname">fetch</code>,
5695: <code class="varname">build</code>, <code class="varname">install</code>), all of which are
1.120 snj 5696: described in the following sections. Each phase is split into
1.87 wiz 5697: so-called <span class="emphasis"><em>stages</em></span>, which take the name of the
5698: containing phase, prefixed by one of <code class="varname">pre-</code>,
5699: <code class="varname">do-</code> or <code class="varname">post-</code>. (Examples are
5700: <code class="varname">pre-configure</code>, <code class="varname">post-build</code>.) Most
5701: of the actual work is done in the <code class="varname">do-*</code> stages.</p>
1.97 rillig 5702: <p>Never override the regular targets (like
5703: <code class="varname">fetch</code>), if you have to, override the
5704: <code class="varname">do-*</code> ones instead.</p>
1.75 rillig 5705: <p>The basic steps for building a program are always the same. First
1.87 wiz 5706: the program's source (<span class="emphasis"><em>distfile</em></span>) must be brought to
5707: the local system and then extracted. After any pkgsrc-specific patches
5708: to compile properly are applied, the software can be configured, then
5709: built (usually by compiling), and finally the generated binaries, etc.
5710: can be put into place on the system.</p>
1.97 rillig 5711: <p>To get more details about what is happening at each step,
5712: you can set the <code class="varname">PKG_VERBOSE</code> variable, or the
5713: <code class="varname">PATCH_DEBUG</code> variable if you are just interested
5714: in more details about the <span class="emphasis"><em>patch</em></span> step.</p>
1.75 rillig 5715: </div>
1.148 asau 5716: <div class="sect1">
1.75 rillig 5717: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5718: <a name="build.prefix"></a>19.2. Program location</h2></div></div></div>
1.75 rillig 5719: <p>Before outlining the process performed by the NetBSD package system in
1.87 wiz 5720: the next section, here's a brief discussion on where programs are
5721: installed, and which variables influence this.</p>
1.75 rillig 5722: <p>The automatic variable <code class="varname">PREFIX</code> indicates
1.87 wiz 5723: where all files of the final program shall be installed. It is
5724: usually set to <code class="varname">LOCALBASE</code>
5725: (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
1.88 wiz 5726: for pkgs in the <code class="filename">cross</code> category. The value of
1.87 wiz 5727: <code class="varname">PREFIX</code> needs to be put
5728: into the various places in the program's source where paths to
1.267 rillig 5729: these files are encoded. See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.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>
1.75 rillig 5730: <p>When choosing which of these variables to use,
1.87 wiz 5731: follow the following rules:</p>
1.148 asau 5732: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5733: <li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
1.88 wiz 5734: where the current pkg will be installed. When referring to a
5735: pkg's own installation path, use
1.128 wiz 5736: <span class="quote">“<span class="quote">${PREFIX}</span>”</span>.</p></li>
5737: <li class="listitem"><p><code class="varname">LOCALBASE</code> is where all non-X11 pkgs
1.88 wiz 5738: are installed. If you need to construct a -I or -L argument
5739: to the compiler to find includes and libraries installed by
1.128 wiz 5740: another non-X11 pkg, use <span class="quote">“<span class="quote">${LOCALBASE}</span>”</span>. The name
1.87 wiz 5741: <code class="varname">LOCALBASE</code> stems from FreeBSD, which
5742: installed all packages in <code class="filename">/usr/local</code>. As
5743: pkgsrc leaves <code class="filename">/usr/local</code> for the system
5744: administrator, this variable is a misnomer.</p></li>
1.128 wiz 5745: <li class="listitem"><p><code class="varname">X11BASE</code> is where the actual X11
1.88 wiz 5746: distribution (from xsrc, etc.) is installed. When looking for
5747: <span class="emphasis"><em>standard</em></span> X11 includes (not those
1.128 wiz 5748: installed by a package), use <span class="quote">“<span class="quote">${X11BASE}</span>”</span>.</p></li>
1.209 sevan 5749: <li class="listitem"><p>X11-based packages using imake must set
5750: <code class="varname">USE_IMAKE</code> to be installed correctly under
5751: <code class="varname">LOCALBASE</code>.</p></li>
1.128 wiz 5752: <li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
1.270 ! leot 5753: install files according to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?hier+7.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that
1.87 wiz 5754: manual pages go into <code class="filename">${PREFIX}/man</code>, not
5755: <code class="filename">${PREFIX}/share/man</code>.</p></li>
1.75 rillig 5756: </ul></div>
5757: </div>
1.148 asau 5758: <div class="sect1">
1.75 rillig 5759: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5760: <a name="build.builddirs"></a>19.3. Directories used during the build process</h2></div></div></div>
1.114 jmcneill 5761: <p>When building a package, various directories are used to store
1.87 wiz 5762: source files, temporary files, pkgsrc-internal files, and so on. These
5763: directories are explained here.</p>
1.75 rillig 5764: <p>Some of the directory variables contain relative pathnames. There
1.87 wiz 5765: are two common base directories for these relative directories:
5766: <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
5767: pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
5768: inside the package itself.</p>
1.148 asau 5769: <div class="variablelist"><dl class="variablelist">
1.75 rillig 5770: <dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
5771: <dd><p>This is an absolute pathname that points to the pkgsrc
1.87 wiz 5772: root directory. Generally, you don't need
5773: it.</p></dd>
1.97 rillig 5774: <dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
5775: <dd><p>This is an absolute pathname that points to the
5776: current package.</p></dd>
1.75 rillig 5777: <dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
5778: <dd><p>This is a pathname relative to
1.87 wiz 5779: <code class="varname">PKGSRCDIR</code> that points to the current
5780: package.</p></dd>
1.75 rillig 5781: <dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
5782: <dd><p>This is an absolute pathname pointing to the directory
1.93 rillig 5783: where all work takes place. The distfiles are extracted to this
1.87 wiz 5784: directory. It also contains temporary directories and log files used by
5785: the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
5786: the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
1.75 rillig 5787: <dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
5788: <dd><p>This is an absolute pathname pointing to the directory
1.87 wiz 5789: where the distfiles are extracted. It is usually a direct subdirectory
5790: of <code class="varname">WRKDIR</code>, and often it's the only directory entry
5791: that isn't hidden. This variable may be changed by a package
5792: <code class="filename">Makefile</code>.</p></dd>
1.75 rillig 5793: </dl></div>
1.114 jmcneill 5794: <p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
5795: the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
1.116 rillig 5796: to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
1.114 jmcneill 5797: <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
5798: If users would like to have their pkgsrc trees behave in a
5799: read-only manner, then the value of
5800: <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
5801: <span class="emphasis"><em>no</em></span>.</p>
1.75 rillig 5802: </div>
1.148 asau 5803: <div class="sect1">
1.75 rillig 5804: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5805: <a name="build.running"></a>19.4. Running a phase</h2></div></div></div>
1.110 hubertf 5806: <p>You can run a particular phase by typing <span class="command"><strong>make
1.87 wiz 5807: phase</strong></span>, where <span class="emphasis"><em>phase</em></span> is the name of the
5808: phase. This will automatically run all phases that are required for this
5809: phase. The default phase is <code class="varname">build</code>, that is, when you
1.110 hubertf 5810: run <span class="command"><strong>make</strong></span> without parameters in a package directory,
1.87 wiz 5811: the package will be built, but not installed.</p>
1.75 rillig 5812: </div>
1.148 asau 5813: <div class="sect1">
1.75 rillig 5814: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 5815: <a name="build.fetch"></a>19.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.81 rillig 5816: <p>The first step in building a package is to fetch the
1.88 wiz 5817: distribution files (distfiles) from the sites that are providing
5818: them. This is the task of the <span class="emphasis"><em>fetch</em></span>
5819: phase.</p>
1.148 asau 5820: <div class="sect2">
1.81 rillig 5821: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5822: <a name="build.fetch.what"></a>19.5.1. What to fetch and where to get it from</h3></div></div></div>
1.88 wiz 5823: <p>In simple cases, <code class="varname">MASTER_SITES</code>
5824: defines all URLs from where the distfile, whose name is
5825: derived from the <code class="varname">DISTNAME</code> variable, is
5826: fetched. The more complicated cases are described
5827: below.</p>
5828: <p>The variable <code class="varname">DISTFILES</code> specifies
5829: the list of distfiles that have to be fetched. Its value
1.174 asau 5830: defaults to <code class="literal">${DEFAULT_DISTFILES}</code> and
5831: its value is <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
1.88 wiz 5832: so that most packages don't need to define it at all.
5833: <code class="varname">EXTRACT_SUFX</code> is
5834: <code class="literal">.tar.gz</code> by default, but can be changed
5835: freely. Note that if your package requires additional
5836: distfiles to the default one, you cannot just append the
5837: additional filenames using the <code class="literal">+=</code>
5838: operator, but you have write for example:</p>
1.81 rillig 5839: <pre class="programlisting">
1.174 asau 5840: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.100 rillig 5841: </pre>
1.88 wiz 5842: <p>Each distfile is fetched from a list of sites, usually
5843: <code class="varname">MASTER_SITES</code>. If the package has multiple
5844: <code class="varname">DISTFILES</code> or multiple
5845: <code class="varname">PATCHFILES</code> from different sites, you can
5846: set
5847: <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
5848: to the list of URLs where the file
5849: <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
5850: (including the suffix) can be found.</p>
5851: <pre class="programlisting">
1.100 rillig 5852: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5853: DISTFILES+= foo-file.tar.gz
5854: SITES.foo-file.tar.gz= \
5855: http://www.somewhere.com/somehow/ \
5856: http://www.somewhereelse.com/mirror/somehow/
5857: </pre>
1.81 rillig 5858: <p>When actually fetching the distfiles, each item from
1.88 wiz 5859: <code class="varname">MASTER_SITES</code> or
5860: <code class="varname">SITES.*</code> gets the name of each distfile
5861: appended to it, without an intermediate slash. Therefore,
5862: all site values have to end with a slash or other separator
5863: character. This allows for example to set
5864: <code class="varname">MASTER_SITES</code> to a URL of a CGI script
5865: that gets the name of the distfile as a parameter. In this
5866: case, the definition would look like:</p>
1.81 rillig 5867: <pre class="programlisting">
1.100 rillig 5868: MASTER_SITES= http://www.example.com/download.cgi?file=
5869: </pre>
1.125 wiz 5870: <p> The exception to this rule are URLs starting with a dash.
1.174 asau 5871: In that case the URL is taken as is, fetched and the result
5872: stored under the name of the distfile. You can use this style
5873: for the case when the download URL style does not match the
5874: above common case. For example, if permanent download URL is a
5875: redirector to the real download URL, or the download file name
5876: is offered by an HTTP Content-Disposition header. In the
5877: following example, <code class="filename">foo-1.0.0.tar.gz</code> will be
5878: created instead of the default
5879: <code class="filename">v1.0.0.tar.gz</code>.</p>
5880: <pre class="programlisting">
5881: DISTNAME= foo-1.0.0
5882: MASTER_SITES= -http://www.example.com/archive/v1.0.0.tar.gz
5883: </pre>
1.81 rillig 5884: <p>There are some predefined values for
1.88 wiz 5885: <code class="varname">MASTER_SITES</code>, which can be used in
5886: packages. The names of the variables should speak for
5887: themselves.</p>
1.269 leot 5888: <table border="0" summary="Simple list" class="simplelist">
5889: <tr>
5890: <td>MASTER_SITE_APACHE</td>
5891: <td>MASTER_SITE_BACKUP</td>
5892: </tr>
5893: <tr>
5894: <td>MASTER_SITE_CRATESIO</td>
5895: <td>MASTER_SITE_CYGWIN</td>
5896: </tr>
5897: <tr>
5898: <td>MASTER_SITE_DEBIAN</td>
5899: <td>MASTER_SITE_FREEBSD</td>
5900: </tr>
5901: <tr>
5902: <td>MASTER_SITE_FREEBSD_LOCAL</td>
5903: <td>MASTER_SITE_GENTOO</td>
5904: </tr>
5905: <tr>
5906: <td>MASTER_SITE_GITHUB</td>
5907: <td>MASTER_SITE_GNOME</td>
5908: </tr>
5909: <tr>
5910: <td>MASTER_SITE_GNU</td>
5911: <td>MASTER_SITE_GNUSTEP</td>
5912: </tr>
5913: <tr>
5914: <td>MASTER_SITE_HASKELL_HACKAGE</td>
5915: <td>MASTER_SITE_IFARCHIVE</td>
5916: </tr>
5917: <tr>
5918: <td>MASTER_SITE_KDE</td>
5919: <td>MASTER_SITE_MOZILLA</td>
5920: </tr>
5921: <tr>
5922: <td>MASTER_SITE_MOZILLA_ALL</td>
5923: <td>MASTER_SITE_MYSQL</td>
5924: </tr>
5925: <tr>
5926: <td>MASTER_SITE_NETLIB</td>
5927: <td>MASTER_SITE_OPENBSD</td>
5928: </tr>
5929: <tr>
5930: <td>MASTER_SITE_OPENOFFICE</td>
5931: <td>MASTER_SITE_OSDN</td>
5932: </tr>
5933: <tr>
5934: <td>MASTER_SITE_PERL_CPAN</td>
5935: <td>MASTER_SITE_PGSQL</td>
5936: </tr>
5937: <tr>
5938: <td>MASTER_SITE_PYPI</td>
5939: <td>MASTER_SITE_RUBYGEMS</td>
5940: </tr>
5941: <tr>
5942: <td>MASTER_SITE_R_CRAN</td>
5943: <td>MASTER_SITE_SOURCEFORGE</td>
5944: </tr>
5945: <tr>
5946: <td>MASTER_SITE_SUNSITE</td>
5947: <td>MASTER_SITE_SUSE</td>
5948: </tr>
5949: <tr>
5950: <td>MASTER_SITE_TEX_CTAN</td>
5951: <td>MASTER_SITE_XCONTRIB</td>
5952: </tr>
5953: <tr>
5954: <td>MASTER_SITE_XEMACS</td>
5955: <td>MASTER_SITE_XORG</td>
5956: </tr>
5957: </table>
1.88 wiz 5958: <p>Some explanations for the less self-explaining ones:
5959: <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
1.133 wiz 5960: for packages that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/%24%7BDIST_SUBDIR%7D" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}</a>. <code class="varname">MASTER_SITE_LOCAL</code> contains local
1.132 spz 5961: package source distributions that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/</a>.</p>
1.88 wiz 5962: <p>If you choose one of these predefined sites, you may
5963: want to specify a subdirectory of that site. Since these
5964: macros may expand to more than one actual site, you
5965: <span class="emphasis"><em>must</em></span> use the following construct to
5966: specify a subdirectory:</p>
1.81 rillig 5967: <pre class="programlisting">
1.100 rillig 5968: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
5969: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
5970: </pre>
1.81 rillig 5971: <p>Note the trailing slash after the subdirectory
1.88 wiz 5972: name.</p>
1.81 rillig 5973: </div>
1.148 asau 5974: <div class="sect2">
1.81 rillig 5975: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 5976: <a name="build.fetch.how"></a>19.5.2. How are the files fetched?</h3></div></div></div>
1.88 wiz 5977: <p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
5978: all the distfiles exist in a local directory
1.93 rillig 5979: (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
1.88 wiz 5980: user). If the files do not exist, they are fetched using
5981: commands of the form</p>
1.75 rillig 5982: <pre class="programlisting">
1.100 rillig 5983: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
5984: </pre>
1.88 wiz 5985: <p>where <code class="literal">${site}</code> varies through
5986: several possibilities in turn: first,
5987: <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
5988: sites specified in either <code class="varname">SITES.file</code> if
5989: defined, else <code class="varname">MASTER_SITES</code> or
5990: <code class="varname">PATCH_SITES</code>, as applies, then finally the
5991: value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
1.91 rillig 5992: all except the first and the last can be optionally sorted
5993: by the user, via setting either
5994: <code class="varname">MASTER_SORT_RANDOM</code>, and
5995: <code class="varname">MASTER_SORT_AWK</code> or
1.88 wiz 5996: <code class="varname">MASTER_SORT_REGEX</code>.</p>
1.117 jnemeth 5997: <p> The specific command and arguments used depend on the
5998: <code class="varname">FETCH_USING</code> parameter. The example above is
5999: for <code class="literal">FETCH_USING=custom</code>.</p>
1.97 rillig 6000: <p>The distfiles mirror run by the NetBSD Foundation uses the
6001: <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
6002: distfiles, if they are freely distributable. Packages setting
6003: <code class="varname">NO_SRC_ON_FTP</code> (usually to
1.128 wiz 6004: <span class="quote">“<span class="quote">${RESTRICTED}</span>”</span>) will not have their distfiles
1.97 rillig 6005: mirrored.</p>
1.81 rillig 6006: </div>
1.75 rillig 6007: </div>
1.148 asau 6008: <div class="sect1">
1.75 rillig 6009: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6010: <a name="build.checksum"></a>19.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
1.88 wiz 6011: <p>After the distfile(s) are fetched, their checksum is
6012: generated and compared with the checksums stored in the
6013: distinfo file. If the checksums don't match, the build is
6014: aborted. This is to ensure the same distfile is used for
6015: building, and that the distfile wasn't changed, e.g. by some
6016: malign force, deliberately changed distfiles on the master
6017: distribution site or network lossage.</p>
1.75 rillig 6018: </div>
1.148 asau 6019: <div class="sect1">
1.75 rillig 6020: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6021: <a name="build.extract"></a>19.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
1.75 rillig 6022: <p>When the distfiles are present on the local system, they
1.88 wiz 6023: need to be extracted, as they usually come in the form of some
6024: compressed archive format.</p>
1.75 rillig 6025: <p>By default, all <code class="varname">DISTFILES</code> are
1.88 wiz 6026: extracted. If you only need some of them, you can set the
6027: <code class="varname">EXTRACT_ONLY</code> variable to the list of those
6028: files.</p>
6029: <p>Extracting the files is usually done by a little
1.93 rillig 6030: program, <code class="filename">mk/extract/extract</code>, which
1.88 wiz 6031: already knows how to extract various archive formats, so most
6032: likely you will not need to change anything here. But if you
6033: need, the following variables may help you:</p>
1.148 asau 6034: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6035: <dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
6036: <dd><p>Use these variables to override the default
1.88 wiz 6037: options for an extract command, which are defined in
1.93 rillig 6038: <code class="filename">mk/extract/extract</code>.</p></dd>
1.75 rillig 6039: <dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
6040: <dd><p>This variable can be set to
1.114 jmcneill 6041: <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
6042: (which is the default value), <code class="literal">pax</code>, or an
1.88 wiz 6043: absolute pathname pointing to the command with which tar
1.114 jmcneill 6044: archives should be extracted. It is preferred to choose bsdtar over gtar
6045: if NetBSD's pax-as-tar is not good enough.</p></dd>
1.75 rillig 6046: </dl></div>
1.88 wiz 6047: <p>If the <code class="filename">extract</code> program doesn't
6048: serve your needs, you can also override the
6049: <code class="varname">EXTRACT_CMD</code> variable, which holds the
6050: command used for extracting the files. This command is
6051: executed in the <code class="filename">${WRKSRC}</code>
6052: directory. During execution of this command, the shell
6053: variable <code class="varname">extract_file</code> holds the absolute
6054: pathname of the file that is going to be extracted.</p>
1.75 rillig 6055: <p>And if that still does not suffice, you can override the
1.88 wiz 6056: <code class="varname">do-extract</code> target in the package
6057: Makefile.</p>
1.75 rillig 6058: </div>
1.148 asau 6059: <div class="sect1">
1.75 rillig 6060: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6061: <a name="build.patch"></a>19.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
1.75 rillig 6062: <p>After extraction, all the patches named by the
1.88 wiz 6063: <code class="varname">PATCHFILES</code>, those present in the patches
6064: subdirectory of the package as well as in
6065: $LOCALPATCHES/$PKGPATH (e.g.
6066: <code class="filename">/usr/local/patches/graphics/png</code>) are
6067: applied. Patchfiles ending in <code class="filename">.Z</code> or
6068: <code class="filename">.gz</code> are uncompressed before they are
6069: applied, files ending in <code class="filename">.orig</code> or
6070: <code class="filename">.rej</code> are ignored. Any special options to
1.270 ! leot 6071: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in
1.267 rillig 6072: <code class="varname">PATCH_DIST_ARGS</code>. See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, “<code class="filename">patches/*</code>”</a> for more details.</p>
1.270 ! leot 6073: <p>By default <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special args to make
1.88 wiz 6074: it fail if the patches apply with some lines of fuzz. Please
6075: fix (regen) the patches so that they apply cleanly. The
6076: rationale behind this is that patches that don't apply cleanly
6077: may end up being applied in the wrong place, and cause severe
6078: harm there.</p>
1.75 rillig 6079: </div>
1.148 asau 6080: <div class="sect1">
1.75 rillig 6081: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6082: <a name="build.tools"></a>19.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
6083: <p>This is covered in <a class="xref" href="#tools" title="Chapter 20. Tools needed for building or running">Chapter 20, <i>Tools needed for building or running</i></a>.
1.88 wiz 6084: </p>
1.75 rillig 6085: </div>
1.148 asau 6086: <div class="sect1">
1.75 rillig 6087: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6088: <a name="build.wrapper"></a>19.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
1.75 rillig 6089: <p>This phase creates wrapper programs for the compilers and
1.88 wiz 6090: linkers. The following variables can be used to tweak the
6091: wrappers.</p>
1.148 asau 6092: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6093: <dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
6094: <dd><p>The command used to print progress
1.88 wiz 6095: messages. Does nothing by default. Set to
6096: <code class="literal">${ECHO}</code> to see the progress
6097: messages.</p></dd>
1.75 rillig 6098: <dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
6099: <dd><p>This variable can be set to
1.88 wiz 6100: <code class="literal">yes</code> (default) or <code class="literal">no</code>,
6101: depending on whether you want additional information in the
6102: wrapper log file.</p></dd>
1.75 rillig 6103: <dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
6104: <dd><p>This variable can be set to
1.88 wiz 6105: <code class="literal">yes</code> or <code class="literal">no</code>, depending
6106: on whether the wrapper should use its cache, which will
6107: improve the speed. The default value is
6108: <code class="literal">yes</code>, but is forced to
6109: <code class="literal">no</code> if the platform does not support
6110: it.</p></dd>
1.75 rillig 6111: <dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
1.88 wiz 6112: <dd><p>A list of reordering commands. A reordering
6113: command has the form
6114: <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
6115: It ensures that that
6116: <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
6117: before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
6118: </p></dd>
1.75 rillig 6119: <dt><span class="term"><code class="varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
6120: <dd><p>A list of transformation commands. [TODO:
1.88 wiz 6121: investigate further]</p></dd>
1.75 rillig 6122: </dl></div>
6123: </div>
1.148 asau 6124: <div class="sect1">
1.75 rillig 6125: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6126: <a name="build.configure"></a>19.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.88 wiz 6127: <p>Most pieces of software need information on the header
6128: files, system calls, and library routines which are available
6129: on the platform they run on. The process of determining this
6130: information is known as configuration, and is usually
6131: automated. In most cases, a script is supplied with the
6132: distfiles, and its invocation results in generation of header
6133: files, Makefiles, etc.</p>
6134: <p>If the package contains a configure script, this can be
6135: invoked by setting <code class="varname">HAS_CONFIGURE</code> to
1.128 wiz 6136: <span class="quote">“<span class="quote">yes</span>”</span>. If the configure script is a GNU autoconf
1.88 wiz 6137: script, you should set <code class="varname">GNU_CONFIGURE</code> to
1.128 wiz 6138: <span class="quote">“<span class="quote">yes</span>”</span> instead. What happens in the
1.88 wiz 6139: <span class="emphasis"><em>configure</em></span> phase is roughly:</p>
6140: <pre class="programlisting">
1.100 rillig 6141: .for d in ${CONFIGURE_DIRS}
6142: cd ${WRKSRC} \
6143: && cd ${d} \
6144: && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
6145: .endfor
6146: </pre>
1.88 wiz 6147: <p><code class="varname">CONFIGURE_DIRS</code> (default:
1.128 wiz 6148: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
1.88 wiz 6149: <code class="varname">WRKSRC</code>. In each of these directories, the
6150: configure script is run with the environment
6151: <code class="varname">CONFIGURE_ENV</code> and arguments
6152: <code class="varname">CONFIGURE_ARGS</code>. The variables
6153: <code class="varname">CONFIGURE_ENV</code>,
6154: <code class="varname">CONFIGURE_SCRIPT</code> (default:
1.128 wiz 6155: <span class="quote">“<span class="quote">./configure</span>”</span>) and
1.88 wiz 6156: <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
6157: package.</p>
1.144 wiz 6158: <p>If the program uses the Perl way of configuration (mainly Perl
6159: modules, but not only), i.e. a file called
6160: <code class="filename">Makefile.PL</code>, it should include
6161: <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
6162: <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
6163: variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
1.88 wiz 6164: <p>If the program uses an <code class="filename">Imakefile</code>
6165: for configuration, the appropriate steps can be invoked by
6166: setting <code class="varname">USE_IMAKE</code> to
1.209 sevan 6167: <span class="quote">“<span class="quote">yes</span>”</span>. If you only need xmkmf, add it to <code class="varname">USE_TOOLS</code>.
6168: You can add variables to xmkmf's environment by adding them to the
1.97 rillig 6169: <code class="varname">SCRIPTS_ENV</code> variable.</p>
1.111 rillig 6170: <p>If the program uses <code class="filename">cmake</code>
6171: for configuration, the appropriate steps can be invoked by
1.128 wiz 6172: setting <code class="varname">USE_CMAKE</code> to <span class="quote">“<span class="quote">yes</span>”</span>.
1.111 rillig 6173: You can add variables to cmake's environment by adding them to the
6174: <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
6175: by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
6176: The top directory argument is given by the
6177: <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to
1.128 wiz 6178: <span class="quote">“<span class="quote">.</span>”</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p>
1.97 rillig 6179: <p>If there is no configure step at all, set
1.128 wiz 6180: <code class="varname">NO_CONFIGURE</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.75 rillig 6181: </div>
1.148 asau 6182: <div class="sect1">
1.75 rillig 6183: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6184: <a name="build.build"></a>19.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.88 wiz 6185: <p>For building a package, a rough equivalent of the
6186: following code is executed.</p>
1.75 rillig 6187: <pre class="programlisting">
1.100 rillig 6188: .for d in ${BUILD_DIRS}
6189: cd ${WRKSRC} \
6190: && cd ${d} \
6191: && env ${MAKE_ENV} \
6192: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
6193: -f ${MAKE_FILE} \
6194: ${BUILD_TARGET}
6195: .endfor
6196: </pre>
1.88 wiz 6197: <p><code class="varname">BUILD_DIRS</code> (default:
1.128 wiz 6198: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
1.88 wiz 6199: <code class="varname">WRKSRC</code>. In each of these directories,
6200: <code class="varname">MAKE_PROGRAM</code> is run with the environment
6201: <code class="varname">MAKE_ENV</code> and arguments
6202: <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
6203: <code class="varname">MAKE_ENV</code>,
6204: <code class="varname">BUILD_MAKE_FLAGS</code>,
6205: <code class="varname">MAKE_FILE</code> and
6206: <code class="varname">BUILD_TARGET</code> may all be changed by the
6207: package.</p>
1.75 rillig 6208: <p>The default value of <code class="varname">MAKE_PROGRAM</code> is
1.128 wiz 6209: <span class="quote">“<span class="quote">gmake</span>”</span> if <code class="varname">USE_TOOLS</code> contains
6210: <span class="quote">“<span class="quote">gmake</span>”</span>, <span class="quote">“<span class="quote">make</span>”</span> otherwise. The
1.88 wiz 6211: default value of <code class="varname">MAKE_FILE</code> is
1.128 wiz 6212: <span class="quote">“<span class="quote">Makefile</span>”</span>, and <code class="varname">BUILD_TARGET</code>
6213: defaults to <span class="quote">“<span class="quote">all</span>”</span>.</p>
1.97 rillig 6214: <p>If there is no build step at all, set
1.128 wiz 6215: <code class="varname">NO_BUILD</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.75 rillig 6216: </div>
1.148 asau 6217: <div class="sect1">
1.75 rillig 6218: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6219: <a name="build.test"></a>19.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
1.75 rillig 6220: <p>[TODO]</p>
6221: </div>
1.148 asau 6222: <div class="sect1">
1.75 rillig 6223: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6224: <a name="build.install"></a>19.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.75 rillig 6225: <p>Once the build stage has completed, the final step is to
1.88 wiz 6226: install the software in public directories, so users can
6227: access the programs and files.</p>
1.75 rillig 6228: <p>In the <span class="emphasis"><em>install</em></span> phase, a rough
1.88 wiz 6229: equivalent of the following code is executed. Additionally,
6230: before and after this code, much magic is performed to do
6231: consistency checks, registering the package, and so on.</p>
6232: <pre class="programlisting">
1.100 rillig 6233: .for d in ${INSTALL_DIRS}
6234: cd ${WRKSRC} \
6235: && cd ${d} \
6236: && env ${MAKE_ENV} \
6237: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
6238: -f ${MAKE_FILE} \
6239: ${INSTALL_TARGET}
6240: .endfor
6241: </pre>
1.75 rillig 6242: <p>The variable's meanings are analogous to the ones in the
1.88 wiz 6243: <span class="emphasis"><em>build</em></span> phase.
6244: <code class="varname">INSTALL_DIRS</code> defaults to
6245: <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
1.128 wiz 6246: is <span class="quote">“<span class="quote">install</span>”</span> by default, plus
6247: <span class="quote">“<span class="quote">install.man</span>”</span> if <code class="varname">USE_IMAKE</code> is
1.88 wiz 6248: defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
6249: defined.</p>
1.75 rillig 6250: <p>In the <span class="emphasis"><em>install</em></span> phase, the following
1.88 wiz 6251: variables are useful. They are all variations of the
1.270 ! leot 6252: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and
1.88 wiz 6253: permissions preset. <code class="varname">INSTALL</code> is the plain
6254: install command. The specialized variants, together with their
6255: intended use, are:</p>
1.148 asau 6256: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6257: <dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
1.88 wiz 6258: <dd><p>directories that contain
6259: binaries</p></dd>
1.75 rillig 6260: <dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
1.88 wiz 6261: <dd><p>directories that contain
6262: scripts</p></dd>
1.75 rillig 6263: <dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
1.88 wiz 6264: <dd><p>directories that contain shared and static
6265: libraries</p></dd>
1.75 rillig 6266: <dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
1.88 wiz 6267: <dd><p>directories that contain data
6268: files</p></dd>
1.75 rillig 6269: <dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
1.88 wiz 6270: <dd><p>directories that contain man
6271: pages</p></dd>
1.210 leot 6272: <dt><span class="term"><code class="varname">INSTALL_GAME_DIR</code></span></dt>
6273: <dd><p>directories that contain data files for games
6274: </p></dd>
1.75 rillig 6275: <dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
1.88 wiz 6276: <dd><p>binaries that can be stripped from debugging
6277: symbols</p></dd>
1.75 rillig 6278: <dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
1.88 wiz 6279: <dd><p>binaries that cannot be
6280: stripped</p></dd>
1.75 rillig 6281: <dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
1.88 wiz 6282: <dd><p>game
6283: binaries</p></dd>
1.75 rillig 6284: <dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
1.88 wiz 6285: <dd><p>shared and static
6286: libraries</p></dd>
1.75 rillig 6287: <dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
6288: <dd><p>data files</p></dd>
6289: <dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
1.88 wiz 6290: <dd><p>data files for
6291: games</p></dd>
1.75 rillig 6292: <dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
6293: <dd><p>man pages</p></dd>
6294: </dl></div>
6295: <p>Some other variables are:</p>
1.148 asau 6296: <div class="variablelist"><dl class="variablelist">
1.216 tnn 6297: <dt><span class="term"><code class="varname">INSTALL_UNSTRIPPED</code></span></dt>
1.270 ! leot 6298: <dd><p>If set to <code class="literal">yes</code>, do not run <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?strip+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">strip</span>(1)</span></a>
1.216 tnn 6299: when installing binaries. Any debugging sections and symbols present in
6300: binaries will be preserved.
6301: </p></dd>
1.75 rillig 6302: <dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
6303: <dd><p>A list of directories relative to
1.88 wiz 6304: <code class="varname">PREFIX</code> that are created by pkgsrc at the
1.98 wiz 6305: beginning of the <span class="emphasis"><em>install</em></span> phase.
6306: The package is supposed to create all needed directories itself
6307: before installing files to it and list all other directories here.
6308: </p></dd>
1.75 rillig 6309: </dl></div>
1.97 rillig 6310: <p>In the rare cases that a package shouldn't install anything,
1.128 wiz 6311: set <code class="varname">NO_INSTALL</code> to <span class="quote">“<span class="quote">yes</span>”</span>. This is
1.97 rillig 6312: mostly relevant for packages in the <code class="filename">regress</code>
6313: category.</p>
1.75 rillig 6314: </div>
1.148 asau 6315: <div class="sect1">
1.75 rillig 6316: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6317: <a name="build.package"></a>19.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
1.88 wiz 6318: <p>Once the install stage has completed, a binary package of
6319: the installed files can be built. These binary packages can be
6320: used for quick installation without previous compilation, e.g. by
1.110 hubertf 6321: the <span class="command"><strong>make bin-install</strong></span> or by using
6322: <span class="command"><strong>pkg_add</strong></span>.</p>
1.88 wiz 6323: <p>By default, the binary packages are created in
6324: <code class="filename">${PACKAGES}/All</code> and symlinks are created in
6325: <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
6326: one for each category in the <code class="varname">CATEGORIES</code>
6327: variable. <code class="varname">PACKAGES</code> defaults to
6328: <code class="filename">pkgsrc/packages</code>.</p>
6329: </div>
1.148 asau 6330: <div class="sect1">
1.88 wiz 6331: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6332: <a name="build.clean"></a>19.16. Cleaning up</h2></div></div></div>
1.88 wiz 6333: <p>Once you're finished with a package, you can clean the work
1.110 hubertf 6334: directory by running <span class="command"><strong>make clean</strong></span>. If you want
1.88 wiz 6335: to clean the work directories of all dependencies too, use
1.110 hubertf 6336: <span class="command"><strong>make clean-depends</strong></span>.</p>
1.75 rillig 6337: </div>
1.148 asau 6338: <div class="sect1">
1.75 rillig 6339: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6340: <a name="build.helpful-targets"></a>19.17. Other helpful targets</h2></div></div></div>
1.148 asau 6341: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6342: <dt><span class="term">pre/post-*</span></dt>
1.88 wiz 6343: <dd><p>For any of the main targets described in the
6344: previous section, two auxiliary targets exist with
1.128 wiz 6345: <span class="quote">“<span class="quote">pre-</span>”</span> and <span class="quote">“<span class="quote">post-</span>”</span> used as a
1.87 wiz 6346: prefix for the main target's name. These targets are
1.88 wiz 6347: invoked before and after the main target is called,
6348: allowing extra configuration or installation steps be
6349: performed from a package's Makefile, for example, which
6350: a program's configure script or install target
6351: omitted.</p></dd>
1.75 rillig 6352: <dt><span class="term">do-*</span></dt>
1.88 wiz 6353: <dd><p>Should one of the main targets do the wrong thing,
6354: and should there be no variable to fix this, you can
6355: redefine it with the do-* target. (Note that redefining
6356: the target itself instead of the do-* target is a bad
6357: idea, as the pre-* and post-* targets won't be called
6358: anymore, etc.) You will not usually need to do
6359: this.</p></dd>
1.75 rillig 6360: <dt><span class="term">reinstall</span></dt>
1.88 wiz 6361: <dd>
1.110 hubertf 6362: <p>If you did a <span class="command"><strong>make install</strong></span> and
1.88 wiz 6363: you noticed some file was not installed properly, you
6364: can repeat the installation with this target, which will
1.128 wiz 6365: ignore the <span class="quote">“<span class="quote">already installed</span>”</span> flag.</p>
1.88 wiz 6366: <p>This is the default value of
6367: <code class="varname">DEPENDS_TARGET</code> except in the case of
1.110 hubertf 6368: <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
1.88 wiz 6369: package</strong></span>, where the defaults are
1.128 wiz 6370: <span class="quote">“<span class="quote">package</span>”</span> and <span class="quote">“<span class="quote">update</span>”</span>,
1.88 wiz 6371: respectively.</p>
6372: </dd>
1.75 rillig 6373: <dt><span class="term">deinstall</span></dt>
6374: <dd>
1.270 ! leot 6375: <p>This target does a <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the
1.88 wiz 6376: current directory, effectively de-installing the
6377: package. The following variables can be used to tune the
6378: behaviour:</p>
1.148 asau 6379: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6380: <dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
1.270 ! leot 6381: <dd><p>Add a "-v" to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd>
1.75 rillig 6382: <dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
1.88 wiz 6383: <dd><p>Remove all packages that require (depend on)
6384: the given package. This can be used to remove any
6385: packages that may have been pulled in by a given
1.110 hubertf 6386: package, e.g. if <span class="command"><strong>make deinstall
1.87 wiz 6387: DEINSTALLDEPENDS=1</strong></span> is done in
1.88 wiz 6388: <code class="filename">pkgsrc/x11/kde</code>, this is
6389: likely to remove whole KDE. Works by adding
1.270 ! leot 6390: <span class="quote">“<span class="quote">-R</span>”</span> to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
1.88 wiz 6391: command line.</p></dd>
1.75 rillig 6392: </dl></div>
6393: </dd>
1.88 wiz 6394: <dt><span class="term">bin-install</span></dt>
6395: <dd><p>Install a binary package from local disk and via FTP
6396: from a list of sites (see the
6397: <code class="varname">BINPKG_SITES</code> variable), and do a
1.110 hubertf 6398: <span class="command"><strong>make package</strong></span> if no binary package is
1.88 wiz 6399: available anywhere. The arguments given to
1.110 hubertf 6400: <span class="command"><strong>pkg_add</strong></span> can be set via
1.88 wiz 6401: <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
6402: operation, etc.</p></dd>
1.205 wiz 6403: <dt><span class="term">install-clean</span></dt>
6404: <dd><p>This target removes the state files for the "install" and later
6405: phases so that the "install" target may be re-invoked. This can be
6406: used after editing the PLIST to install the package without
6407: rebuilding it.</p></dd>
6408: <dt><span class="term">build-clean</span></dt>
6409: <dd><p>This target removes the state files for the "build" and later
6410: phases so that the "build" target may be re-invoked.</p></dd>
1.75 rillig 6411: <dt><span class="term">update</span></dt>
6412: <dd>
1.88 wiz 6413: <p>This target causes the current package to be
6414: updated to the latest version. The package and all
6415: depending packages first get de-installed, then current
6416: versions of the corresponding packages get compiled and
6417: installed. This is similar to manually noting which
6418: packages are currently installed, then performing a
1.110 hubertf 6419: series of <span class="command"><strong>make deinstall</strong></span> and
6420: <span class="command"><strong>make install</strong></span> (or whatever
1.88 wiz 6421: <code class="varname">UPDATE_TARGET</code> is set to) for these
6422: packages.</p>
1.128 wiz 6423: <p>You can use the <span class="quote">“<span class="quote">update</span>”</span> target to
1.110 hubertf 6424: resume package updating in case a previous <span class="command"><strong>make
1.88 wiz 6425: update</strong></span> was interrupted for some reason.
6426: However, in this case, make sure you don't call
1.110 hubertf 6427: <span class="command"><strong>make clean</strong></span> or otherwise remove the
1.88 wiz 6428: list of dependent packages in <code class="varname">WRKDIR</code>.
6429: Otherwise, you lose the ability to automatically update
6430: the current package along with the dependent packages
6431: you have installed.</p>
1.110 hubertf 6432: <p>Resuming an interrupted <span class="command"><strong>make
1.88 wiz 6433: update</strong></span> will only work as long as the package
6434: tree remains unchanged. If the source code for one of
6435: the packages to be updated has been changed, resuming
1.110 hubertf 6436: <span class="command"><strong>make update</strong></span> will most certainly
1.88 wiz 6437: fail!</p>
6438: <p>The following variables can be used either on the
1.110 hubertf 6439: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
6440: alter the behaviour of <span class="command"><strong>make
1.88 wiz 6441: update</strong></span>:</p>
1.148 asau 6442: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6443: <dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
1.88 wiz 6444: <dd><p>Install target to recursively use for the
6445: updated package and the dependent packages.
6446: Defaults to <code class="varname">DEPENDS_TARGET</code> if
1.128 wiz 6447: set, <span class="quote">“<span class="quote">install</span>”</span> otherwise for
1.110 hubertf 6448: <span class="command"><strong>make update</strong></span>. Other good
1.128 wiz 6449: targets are <span class="quote">“<span class="quote">package</span>”</span> or
6450: <span class="quote">“<span class="quote">bin-install</span>”</span>. Do not set this to
6451: <span class="quote">“<span class="quote">update</span>”</span> or you will get stuck in an
1.88 wiz 6452: endless loop!</p></dd>
1.75 rillig 6453: <dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
1.88 wiz 6454: <dd><p>Don't clean up after updating. Useful if
6455: you want to leave the work sources of the updated
6456: packages around for inspection or other purposes.
6457: Be sure you eventually clean up the source tree
1.128 wiz 6458: (see the <span class="quote">“<span class="quote">clean-update</span>”</span> target below)
1.88 wiz 6459: or you may run into troubles with old source code
6460: still lying around on your next
1.110 hubertf 6461: <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
1.88 wiz 6462: update</strong></span>.</p></dd>
1.75 rillig 6463: <dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
1.88 wiz 6464: <dd><p>Deinstall each package before installing
6465: (making <code class="varname">DEPENDS_TARGET</code>). This
6466: may be necessary if the
1.128 wiz 6467: <span class="quote">“<span class="quote">clean-update</span>”</span> target (see below) was
1.110 hubertf 6468: called after interrupting a running <span class="command"><strong>make
1.88 wiz 6469: update</strong></span>.</p></dd>
1.75 rillig 6470: <dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
1.88 wiz 6471: <dd><p>Allows you to disable recursion and hardcode
6472: the target for packages. The default is
1.128 wiz 6473: <span class="quote">“<span class="quote">update</span>”</span> for the update target,
1.88 wiz 6474: facilitating a recursive update of prerequisite
6475: packages. Only set
6476: <code class="varname">DEPENDS_TARGET</code> if you want to
6477: disable recursive updates. Use
6478: <code class="varname">UPDATE_TARGET</code> instead to just
6479: set a specific target for each package to be
1.110 hubertf 6480: installed during <span class="command"><strong>make update</strong></span>
1.88 wiz 6481: (see above).</p></dd>
1.75 rillig 6482: </dl></div>
6483: </dd>
6484: <dt><span class="term">clean-update</span></dt>
6485: <dd>
1.88 wiz 6486: <p>Clean the source tree for all packages that would
1.110 hubertf 6487: get updated if <span class="command"><strong>make update</strong></span> was called
1.88 wiz 6488: from the current directory. This target should not be
6489: used if the current package (or any of its depending
6490: packages) have already been de-installed (e.g., after
1.110 hubertf 6491: calling <span class="command"><strong>make update</strong></span>) or you may lose
1.88 wiz 6492: some packages you intended to update. As a rule of
6493: thumb: only use this target <span class="emphasis"><em>before</em></span>
1.110 hubertf 6494: the first time you run <span class="command"><strong>make update</strong></span>
1.88 wiz 6495: and only if you have a dirty package tree (e.g., if you
6496: used <code class="varname">NOCLEAN</code>).</p>
6497: <p>If you are unsure about whether your tree is
1.110 hubertf 6498: clean, you can either perform a <span class="command"><strong>make
1.88 wiz 6499: clean</strong></span> at the top of the tree, or use the
6500: following sequence of commands from the directory of the
6501: package you want to update (<span class="emphasis"><em>before</em></span>
1.110 hubertf 6502: running <span class="command"><strong>make update</strong></span> for the first
1.88 wiz 6503: time, otherwise you lose all the packages you wanted to
6504: update!):</p>
1.87 wiz 6505: <pre class="screen">
6506: <code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
1.75 rillig 6507: <code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
1.87 wiz 6508: <code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
6509: </pre>
1.88 wiz 6510: <p>The following variables can be used either on the
1.110 hubertf 6511: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
6512: <span class="command"><strong>make clean-update</strong></span>:</p>
1.148 asau 6513: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6514: <dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
1.110 hubertf 6515: <dd><p>After <span class="command"><strong>make clean</strong></span>, do not
1.88 wiz 6516: reconstruct the list of directories to update for
1.110 hubertf 6517: this package. Only use this if <span class="command"><strong>make
1.88 wiz 6518: update</strong></span> successfully installed all
6519: packages you wanted to update. Normally, this is
1.110 hubertf 6520: done automatically on <span class="command"><strong>make
1.88 wiz 6521: update</strong></span>, but may have been suppressed by
6522: the <code class="varname">NOCLEAN</code> variable (see
6523: above).</p></dd>
1.75 rillig 6524: </dl></div>
6525: </dd>
1.88 wiz 6526: <dt><span class="term">replace</span></dt>
6527: <dd>
6528: <p>Update the installation of the current package. This
6529: differs from update in that it does not replace dependent
1.250 leot 6530: packages. You will need to install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a> for this
1.88 wiz 6531: target to work.</p>
6532: <p><span class="emphasis"><em>Be careful when using this
6533: target!</em></span> There are no guarantees that dependent
6534: packages will still work, in particular they will most
1.110 hubertf 6535: certainly break if you <span class="command"><strong>make replace</strong></span> a
1.88 wiz 6536: library package whose shared library major version changed
6537: between your installed version and the new one. For this
6538: reason, this target is not officially supported and only
6539: recommended for advanced users.</p>
6540: </dd>
1.75 rillig 6541: <dt><span class="term">info</span></dt>
1.270 ! leot 6542: <dd><p>This target invokes <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current
1.88 wiz 6543: package. You can use this to check which version of a
6544: package is installed.</p></dd>
6545: <dt><span class="term">index</span></dt>
6546: <dd>
6547: <p>This is a top-level command, i.e. it should be used in
6548: the <code class="filename">pkgsrc</code> directory. It creates a
6549: database of all packages in the local pkgsrc tree, including
6550: dependencies, comment, maintainer, and some other useful
6551: information. Individual entries are created by running
1.110 hubertf 6552: <span class="command"><strong>make describe</strong></span> in the packages'
1.88 wiz 6553: directories. This index file is saved as
6554: <code class="filename">pkgsrc/INDEX</code>. It can be displayed in
1.110 hubertf 6555: verbose format by running <span class="command"><strong>make
1.88 wiz 6556: print-index</strong></span>. You can search in it with
1.110 hubertf 6557: <span class="command"><strong>make search
1.88 wiz 6558: key=<em class="replaceable"><code>something</code></em></strong></span>. You can
6559: extract a list of all packages that depend on a particular
1.110 hubertf 6560: one by running <span class="command"><strong>make show-deps
1.88 wiz 6561: PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
6562: <p>Running this command takes a very long time, some
6563: hours even on fast machines!</p>
6564: </dd>
1.75 rillig 6565: <dt><span class="term">readme</span></dt>
1.88 wiz 6566: <dd>
6567: <p>This target generates a
6568: <code class="filename">README.html</code> file, which can be
1.250 leot 6569: viewed using a browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/links/README.html" target="_top"><code class="filename">www/links</code></a>. The generated files
1.88 wiz 6570: contain references to any packages which are in the
6571: <code class="varname">PACKAGES</code> directory on the local
6572: host. The generated files can be made to refer to URLs
6573: based on <code class="varname">FTP_PKG_URL_HOST</code> and
6574: <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
6575: wanted to generate <code class="filename">README.html</code>
6576: files which pointed to binary packages on the local
6577: machine, in the directory
6578: <code class="filename">/usr/packages</code>, set
6579: <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
6580: <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
6581: <code class="varname">${PACKAGES}</code> directory and its
6582: subdirectories will be searched for all the binary
6583: packages.</p>
6584: <p>The target can be run at the toplevel or in category
6585: directories, in which case it descends recursively.</p>
6586: </dd>
1.75 rillig 6587: <dt><span class="term">readme-all</span></dt>
1.88 wiz 6588: <dd><p>This is a top-level command, run it in
6589: <code class="filename">pkgsrc</code>. Use this target to create a
6590: file <code class="filename">README-all.html</code> which contains a
6591: list of all packages currently available in the NetBSD
6592: Packages Collection, together with the category they belong
6593: to and a short description. This file is compiled from the
6594: <code class="filename">pkgsrc/*/README.html</code> files, so be sure
1.110 hubertf 6595: to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
1.88 wiz 6596: readme</strong></span>.</p></dd>
1.75 rillig 6597: <dt><span class="term">cdrom-readme</span></dt>
1.88 wiz 6598: <dd><p>This is very much the same as the
1.128 wiz 6599: <span class="quote">“<span class="quote">readme</span>”</span> target (see above), but is to be
1.88 wiz 6600: used when generating a pkgsrc tree to be written to a
6601: CD-ROM. This target also produces
6602: <code class="filename">README.html</code> files, and can be made
6603: to refer to URLs based on
6604: <code class="varname">CDROM_PKG_URL_HOST</code> and
1.87 wiz 6605: <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
1.75 rillig 6606: <dt><span class="term">show-distfiles</span></dt>
1.88 wiz 6607: <dd><p>This target shows which distfiles and patchfiles
6608: are needed to build the package
6609: (<code class="varname">ALLFILES</code>, which contains all
6610: <code class="varname">DISTFILES</code> and
1.87 wiz 6611: <code class="varname">PATCHFILES</code>, but not
6612: <code class="filename">patches/*</code>).</p></dd>
1.75 rillig 6613: <dt><span class="term">show-downlevel</span></dt>
1.88 wiz 6614: <dd><p>This target shows nothing if the package is not
6615: installed. If a version of this package is installed,
6616: but is not the version provided in this version of
6617: pkgsrc, then a warning message is displayed. This target
6618: can be used to show which of your installed packages are
6619: downlevel, and so the old versions can be deleted, and
6620: the current ones added.</p></dd>
1.75 rillig 6621: <dt><span class="term">show-pkgsrc-dir</span></dt>
1.88 wiz 6622: <dd><p>This target shows the directory in the pkgsrc
6623: hierarchy from which the package can be built and
6624: installed. This may not be the same directory as the one
6625: from which the package was installed. This target is
6626: intended to be used by people who may wish to upgrade
6627: many packages on a single host, and can be invoked from
6628: the top-level pkgsrc Makefile by using the
1.128 wiz 6629: <span class="quote">“<span class="quote">show-host-specific-pkgs</span>”</span> target.</p></dd>
1.75 rillig 6630: <dt><span class="term">show-installed-depends</span></dt>
1.88 wiz 6631: <dd><p>This target shows which installed packages match
6632: the current package's <code class="varname">DEPENDS</code>. Useful
6633: if out of date dependencies are causing build
6634: problems.</p></dd>
1.205 wiz 6635: <dt><span class="term">print-build-depends-list</span></dt>
6636: <dd><p>This target shows the list of packages that the current package
6637: depends on for building.</p></dd>
6638: <dt><span class="term">print-run-depends-list</span></dt>
6639: <dd><p>This target shows the list of packages that the current package
6640: depends on for running.</p></dd>
1.75 rillig 6641: <dt><span class="term">check-shlibs</span></dt>
1.88 wiz 6642: <dd><p>After a package is installed, check all its
6643: binaries and (on ELF platforms) shared libraries to see
6644: if they find the shared libs they need. Run by default
1.110 hubertf 6645: if <code class="varname">PKG_DEVELOPER</code> is set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></dd>
1.75 rillig 6646: <dt><span class="term">print-PLIST</span></dt>
6647: <dd>
1.128 wiz 6648: <p>After a <span class="quote">“<span class="quote">make install</span>”</span> from a new or
1.88 wiz 6649: upgraded pkg, this prints out an attempt to generate a
1.110 hubertf 6650: new <code class="filename">PLIST</code> from a <span class="command"><strong>find
1.88 wiz 6651: -newer work/.extract_done</strong></span>. An attempt is made
6652: to care for shared libs etc., but it is
1.87 wiz 6653: <span class="emphasis"><em>strongly</em></span> recommended to review the
6654: result before putting it into
6655: <code class="filename">PLIST</code>. On upgrades, it's useful to
6656: diff the output of this command against an already
6657: existing <code class="filename">PLIST</code> file.</p>
1.270 ! leot 6658: <p>If the package installs files via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
1.88 wiz 6659: other methods that don't update file access times, be
6660: sure to add these files manually to your
1.128 wiz 6661: <code class="filename">PLIST</code>, as the <span class="quote">“<span class="quote">find
6662: -newer</span>”</span> command used by this target won't catch
1.87 wiz 6663: them!</p>
1.267 rillig 6664: <p>See <a class="xref" href="#print-PLIST" title="15.3. Tweaking output of make print-PLIST">Section 15.3, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</a> for more
1.87 wiz 6665: information on this target.</p>
1.75 rillig 6666: </dd>
6667: <dt><span class="term">bulk-package</span></dt>
6668: <dd>
1.88 wiz 6669: <p>Used to do bulk builds. If an appropriate binary
6670: package already exists, no action is taken. If not, this
6671: target will compile, install and package it (and its
6672: depends, if <code class="varname">PKG_DEPENDS</code> is set
1.267 rillig 6673: properly. 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 6674: builds)</i></a>).
1.88 wiz 6675: After creating the binary package, the sources, the
6676: just-installed package and its required packages are
6677: removed, preserving free disk space.</p>
6678: <p><span class="emphasis"><em>Beware that this target may deinstall
6679: all packages installed on a system!</em></span></p>
1.75 rillig 6680: </dd>
6681: <dt><span class="term">bulk-install</span></dt>
6682: <dd>
1.88 wiz 6683: <p>Used during bulk-installs to install required
6684: packages. If an up-to-date binary package is available,
1.270 ! leot 6685: it will be installed via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. If not,
1.110 hubertf 6686: <span class="command"><strong>make bulk-package</strong></span> will be executed,
1.87 wiz 6687: but the installed binary won't be removed.</p>
1.88 wiz 6688: <p>A binary package is considered
1.128 wiz 6689: <span class="quote">“<span class="quote">up-to-date</span>”</span> to be installed via
1.270 ! leot 6690: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> if:</p>
1.148 asau 6691: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 6692: <li class="listitem"><p>None of the package's files
1.88 wiz 6693: (<code class="filename">Makefile</code>, ...) were modified
6694: since it was built.</p></li>
1.128 wiz 6695: <li class="listitem"><p>None of the package's required (binary)
1.88 wiz 6696: packages were modified since it was built.</p></li>
1.75 rillig 6697: </ul></div>
1.88 wiz 6698: <p><span class="emphasis"><em>Beware that this target may deinstall
6699: all packages installed on a system!</em></span></p>
1.75 rillig 6700: </dd>
6701: </dl></div>
6702: </div>
6703: </div>
1.148 asau 6704: <div class="chapter">
1.75 rillig 6705: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 6706: <a name="tools"></a>Chapter 20. Tools needed for building or running</h2></div></div></div>
1.75 rillig 6707: <div class="toc">
6708: <p><b>Table of Contents</b></p>
1.210 leot 6709: <dl class="toc">
1.267 rillig 6710: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
6711: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
6712: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
1.75 rillig 6713: </dl>
6714: </div>
1.87 wiz 6715: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
1.75 rillig 6716: by pkgsrc and also for individual packages to define what commands
1.269 leot 6717: are needed for building a package (like <code class="varname">TOOL_DEPENDS</code>)
1.75 rillig 6718: or for later run-time of an installed packaged (such as
6719: <code class="varname">DEPENDS</code>).
6720: If the native system provides an adequate tool, then in many cases, a pkgsrc
1.87 wiz 6721: package will not be used.</p>
6722: <p>When building a package, the replacement tools are
1.75 rillig 6723: made available in a directory (as symlinks or wrapper scripts)
6724: that is early in the executable search path. Just like the buildlink
1.87 wiz 6725: system, this helps with consistent builds.</p>
6726: <p>A tool may be needed to help build a specific package. For example,
6727: perl, GNU make (gmake) or yacc may be needed.</p>
6728: <p>Also a tool may be needed, for example, because the native system's supplied
1.75 rillig 6729: tool may be inefficient for building a package with pkgsrc.
6730: For example, a package may need GNU awk, bison (instead of
1.87 wiz 6731: yacc) or a better sed.</p>
6732: <p>The tools used by a package can be listed by running
1.110 hubertf 6733: <span class="command"><strong>make show-tools</strong></span>.</p>
1.148 asau 6734: <div class="sect1">
1.75 rillig 6735: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6736: <a name="pkgsrc-tools"></a>20.1. Tools for pkgsrc builds</h2></div></div></div>
1.87 wiz 6737: <p>The default set of tools used by pkgsrc is defined in
1.76 rillig 6738: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
1.110 hubertf 6739: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
6740: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
1.75 rillig 6741: These can be seen by running:
1.110 hubertf 6742: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
1.87 wiz 6743: <p>If a package needs a specific program to build
1.75 rillig 6744: then the <code class="varname">USE_TOOLS</code> variable can be used
1.87 wiz 6745: to define the tools needed.</p>
1.75 rillig 6746: </div>
1.148 asau 6747: <div class="sect1">
1.75 rillig 6748: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6749: <a name="package-tools"></a>20.2. Tools needed by packages</h2></div></div></div>
1.135 wiz 6750: <p>In the following examples, the :run means that it is needed at
6751: run-time (and becomes a DEPENDS).
1.75 rillig 6752: The default is a build dependency which can be set with
6753: :build. (So in this example, it is the same as gmake:build
1.87 wiz 6754: and pkg-config:build.)</p>
1.75 rillig 6755: <pre class="programlisting">
6756: USE_TOOLS+= gmake perl:run pkg-config
6757: </pre>
1.87 wiz 6758: <p>When using the tools framework, a
1.75 rillig 6759: <code class="varname">TOOLS_PATH.foo</code> variable is defined
6760: which contains the full path to the appropriate tool. For example,
1.128 wiz 6761: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
1.87 wiz 6762: on Linux systems.</p>
6763: <p>If you always need a pkgsrc version of the
1.75 rillig 6764: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
6765: </p>
6766: </div>
1.148 asau 6767: <div class="sect1">
1.75 rillig 6768: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6769: <a name="platform-tools"></a>20.3. Tools provided by platforms</h2></div></div></div>
1.87 wiz 6770: <p>When improving or porting pkgsrc to a new platform, have a look
1.75 rillig 6771: at (or create) the corresponding platform specific make file fragment under
1.76 rillig 6772: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
1.75 rillig 6773: the name of the common tools. For example:</p>
6774: <pre class="programlisting">
6775: .if exists(/usr/bin/bzcat)
6776: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
6777: .elif exists(/usr/bin/bzip2)
6778: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
6779: .endif
1.69 rillig 6780:
1.75 rillig 6781: TOOLS_PLATFORM.true?= true # shell builtin
6782: </pre>
6783: </div>
6784: </div>
1.148 asau 6785: <div class="chapter">
1.75 rillig 6786: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 6787: <a name="fixes"></a>Chapter 21. Making your package work</h2></div></div></div>
1.75 rillig 6788: <div class="toc">
6789: <p><b>Table of Contents</b></p>
1.210 leot 6790: <dl class="toc">
1.267 rillig 6791: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
1.75 rillig 6792: <dd><dl>
1.267 rillig 6793: <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>
6794: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
6795: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
6796: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
6797: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
6798: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
6799: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
6800: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
6801: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
6802: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
6803: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
6804: </dl></dd>
6805: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
6806: <dd><dl>
6807: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
6808: <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>
6809: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
6810: </dl></dd>
6811: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
6812: <dd><dl>
6813: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
6814: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
6815: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
6816: </dl></dd>
6817: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
6818: <dd><dl>
6819: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
6820: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
6821: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
6822: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
6823: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
6824: </dl></dd>
6825: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
6826: <dd><dl>
6827: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
6828: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
6829: <dt><span class="sect2"><a href="#undefined-reference">21.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
6830: <dt><span class="sect2"><a href="#out-of-memory">21.5.4. Running out of memory</a></span></dt>
6831: </dl></dd>
6832: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
6833: <dd><dl>
6834: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
6835: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
6836: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
6837: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
6838: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
6839: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
6840: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
6841: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
6842: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
6843: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
6844: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
6845: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
6846: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
6847: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
6848: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
6849: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
6850: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
6851: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.87 wiz 6852: emulation</a></span></dt>
1.267 rillig 6853: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
6854: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.75 rillig 6855: </dl></dd>
1.267 rillig 6856: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.75 rillig 6857: </dl>
6858: </div>
1.148 asau 6859: <div class="sect1">
1.75 rillig 6860: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 6861: <a name="general-operation"></a>21.1. General operation</h2></div></div></div>
1.78 rillig 6862: <p>One appealing feature of pkgsrc is that it runs on many
1.218 rillig 6863: different platforms. As a result, it is important to ensure,
6864: where possible, that packages in pkgsrc are portable. This
6865: chapter mentions some particular details you should pay
6866: attention to while working on pkgsrc.</p>
1.148 asau 6867: <div class="sect2">
1.78 rillig 6868: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 6869: <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 6870: </h3></div></div></div>
1.78 rillig 6871: <p>The pkgsrc user can configure pkgsrc by overriding several
1.87 wiz 6872: variables in the file pointed to by <code class="varname">MAKECONF</code>,
1.110 hubertf 6873: which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
1.87 wiz 6874: want to use those variables in the preprocessor directives of
1.270 ! leot 6875: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or
1.87 wiz 6876: <code class="literal">.for</code>), you need to include the file
6877: <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
6878: loads the user preferences.</p>
1.78 rillig 6879: <p>But note that some variables may not be completely defined
1.219 rillig 6880: after <code class="filename">../../mk/bsd.prefs.mk</code> has been
6881: included, as they may contain references to variables that are
6882: not yet defined. In shell commands (the lines in
6883: <code class="filename">Makefile</code> that are indented with a tab) this
6884: is no problem, since variables are only expanded when they are
6885: used. But in the preprocessor directives mentioned above and in
6886: dependency lines (of the form <code class="literal">target:
6887: dependencies</code>) the variables are expanded at load
6888: time.</p>
1.148 asau 6889: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.78 rillig 6890: <h3 class="title">Note</h3>
1.218 rillig 6891: <p>To check whether a variable can be used at load time,
6892: run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
1.78 rillig 6893: </div>
6894: </div>
1.148 asau 6895: <div class="sect2">
1.78 rillig 6896: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 6897: <a name="user-interaction"></a>21.1.2. User interaction</h3></div></div></div>
1.88 wiz 6898: <p>Occasionally, packages require interaction from the user,
6899: and this can be in a number of ways:</p>
1.148 asau 6900: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 6901: <li class="listitem"><p>When fetching the distfiles, some packages require user
1.87 wiz 6902: interaction such as entering username/password or accepting a
6903: license on a web page.</p></li>
1.128 wiz 6904: <li class="listitem"><p>When extracting the distfiles, some packages may ask for
1.88 wiz 6905: passwords.</p></li>
1.128 wiz 6906: <li class="listitem"><p>help to configure the package before it is built</p></li>
6907: <li class="listitem"><p>help during the build process</p></li>
6908: <li class="listitem"><p>help during the installation of a package</p></li>
1.78 rillig 6909: </ul></div>
1.218 rillig 6910: <p>A package can set the <code class="varname">INTERACTIVE_STAGE</code>
6911: variable to define which stages need interaction. This should be
6912: done in the package's <code class="filename">Makefile</code>, e.g.:</p>
1.75 rillig 6913: <pre class="programlisting">
1.100 rillig 6914: INTERACTIVE_STAGE= configure install
1.222 sevan 6915: </pre>
1.88 wiz 6916: <p>The user can then decide to skip this package by setting the
1.218 rillig 6917: <code class="varname">BATCH</code> variable. Packages that require interaction
6918: are also excluded from bulk builds.</p>
1.75 rillig 6919: </div>
1.148 asau 6920: <div class="sect2">
1.75 rillig 6921: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 6922: <a name="handling-licenses"></a>21.1.3. Handling licenses</h3></div></div></div>
1.222 sevan 6923: <p>Authors of software can choose the licence under which software
6924: can be copied. The Free Software Foundation has declared some
6925: licenses "Free", and the Open Source Initiative has a definition of
6926: "Open Source".</p>
6927: <p>By default, pkgsrc allows packages with Free or Open Source
6928: licenses to be built. To allow packages with other licenses to be
6929: built as well, the pkgsrc user needs to add these licenses to the
6930: <code class="varname">ACCEPTABLE_LICENSES</code> variable in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. Note
6931: that this variable only affects which packages may be
6932: <span class="emphasis"><em>built</em></span>, while the license terms often also
6933: restrict the actual use of the package and its redistribution.</p>
1.98 wiz 6934: <p>One might want to only install packages with a BSD license,
1.218 rillig 6935: or the GPL, and not the other. The free licenses are added to the
1.222 sevan 6936: default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The pkgsrc
1.121 jnemeth 6937: user can override the default by setting the
6938: <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
1.222 sevan 6939: of "+=". The licenses accepted by default are defined in the
6940: <code class="varname">DEFAULT_ACCEPTABLE_LICENSES</code> variable in the file
6941: <code class="filename">pkgsrc/mk/license.mk</code>.</p>
1.78 rillig 6942: <p>The license tag mechanism is intended to address
1.87 wiz 6943: copyright-related issues surrounding building, installing and
6944: using a package, and not to address redistribution issues (see
6945: <code class="varname">RESTRICTED</code> and
1.222 sevan 6946: <code class="varname">NO_SRC_ON_FTP</code>, etc.).
1.121 jnemeth 6947: Packages with redistribution restrictions should set these
6948: tags.</p>
1.98 wiz 6949: <p>Denoting that a package may be copied according to a
6950: particular license is done by placing the license in
1.87 wiz 6951: <code class="filename">pkgsrc/licenses</code> and setting the
6952: <code class="varname">LICENSE</code> variable to a string identifying the
1.250 leot 6953: license, e.g. in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/xv/README.html" target="_top"><code class="filename">graphics/xv</code></a>:</p>
1.87 wiz 6954: <pre class="programlisting">
1.100 rillig 6955: LICENSE= xv-license
1.222 sevan 6956: </pre>
1.87 wiz 6957: <p>When trying to build, the user will get a notice that the
1.98 wiz 6958: package is covered by a license which has not been placed in the
6959: <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
1.87 wiz 6960: <pre class="programlisting">
1.100 rillig 6961: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
6962: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6963: ===> To view the license, enter "/usr/bin/make show-license".
6964: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6965: ===> ACCEPTABLE_LICENSES+=xv-license
6966: *** Error code 1
1.222 sevan 6967: </pre>
1.110 hubertf 6968: <p>The license can be viewed with <span class="command"><strong>make
1.98 wiz 6969: show-license</strong></span>, and if the user so chooses, the line
1.110 hubertf 6970: printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.98 wiz 6971: convey to pkgsrc that it should not in the future fail because of
6972: that license:</p>
1.78 rillig 6973: <pre class="programlisting">
1.100 rillig 6974: ACCEPTABLE_LICENSES+=xv-license
1.222 sevan 6975: </pre>
6976: <p>The use of <code class="varname">LICENSE=shareware</code>,
6977: <code class="varname">LICENSE=no-commercial-use</code>, and similar language
6978: is deprecated because it does not crisply refer to a particular
6979: license text. Another problem with such usage is that it does not
6980: enable a user to tell pkgsrc to proceed for a single package
6981: without also telling pkgsrc to proceed for all packages with that
6982: tag.</p>
6983: <div class="sect3">
6984: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 6985: <a name="new-license"></a>21.1.3.1. Adding a package with a new license</h4></div></div></div>
1.154 rodent 6986: <p>When adding a package with a new license, the following steps
6987: are required:</p>
6988: <div class="orderedlist"><ol class="orderedlist" type="1">
6989: <li class="listitem">
1.222 sevan 6990: <p>Check whether the license qualifies as Free or Open
6991: Source by referencing <a class="ulink" href="http://www.gnu.org/licenses/license-list.en.html" target="_top">Various Licenses
6992: and Comments about Them</a> and <a class="ulink" href="http://opensource.org/licenses/alphabetical" target="_top">Licenses by Name |
6993: Open Source Initiative</a>. If this is the case, the filename in
6994: <code class="filename">pkgsrc/licenses/</code> does not need the
6995: <code class="filename">-license</code> suffix, and the license name should be
6996: added to:</p>
1.154 rodent 6997: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6998: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in <code class="filename">pkgsrc/mk/license.mk</code></p></li>
6999: <li class="listitem"><p>default_acceptable_licenses in <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
7000: </ul></div>
7001: </li>
7002: <li class="listitem"><p>The license text should be added to <code class="filename">pkgsrc/licenses</code> for displaying. A list of known licenses can be seen in this directory.</p></li>
7003: </ol></div>
1.222 sevan 7004: </div>
7005: <div class="sect3">
7006: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7007: <a name="change-license"></a>21.1.3.2. Change to the license</h4></div></div></div>
1.98 wiz 7008: <p>When the license changes (in a way other than formatting),
1.222 sevan 7009: make sure that the new license has a different name (e.g.,
1.98 wiz 7010: append the version number if it exists, or the date). Just
7011: because a user told pkgsrc to build programs under a previous
7012: version of a license does not mean that pkgsrc should build
1.99 rillig 7013: programs under the new licenses. The higher-level point is that
1.98 wiz 7014: pkgsrc does not evaluate licenses for reasonableness; the only
7015: test is a mechanistic test of whether a particular text has been
1.222 sevan 7016: approved by either of two bodies (FSF or OSI).</p>
7017: </div>
1.75 rillig 7018: </div>
1.148 asau 7019: <div class="sect2">
1.75 rillig 7020: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7021: <a name="restricted-packages"></a>21.1.4. Restricted packages</h3></div></div></div>
1.75 rillig 7022: <p>Some licenses restrict how software may be re-distributed.
1.222 sevan 7023: By declaring the restrictions, package tools can
1.98 wiz 7024: automatically refrain from e.g. placing binary packages on FTP
7025: sites.</p>
1.222 sevan 7026: <p>There are four possible restrictions, which are
1.98 wiz 7027: the cross product of sources (distfiles) and binaries not being
7028: placed on FTP sites and CD-ROMs. Because this is rarely the exact
7029: language in any license, and because non-Free licenses tend to be
7030: different from each other, pkgsrc adopts a definition of FTP and
1.222 sevan 7031: CD-ROM.
7032:
7033: "FTP" means making the source or binary file available over the
7034: Internet at no charge.
7035:
7036: "CD-ROM" means making the source or binary available on some kind of
7037: media, together with other source and binary packages, which is sold
7038: for a distribution charge.
1.98 wiz 7039: </p>
7040: <p>In order to encode these restrictions, the package system
1.87 wiz 7041: defines five make variables that can be set to note these
7042: restrictions:</p>
1.148 asau 7043: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7044: <li class="listitem">
1.75 rillig 7045: <p><code class="varname">RESTRICTED</code></p>
7046: <p>This variable should be set whenever a restriction
1.87 wiz 7047: exists (regardless of its kind). Set this variable to a
1.98 wiz 7048: string containing the reason for the restriction. It should
7049: be understood that those wanting to understand the restriction
7050: will have to read the license, and perhaps seek advice of
7051: counsel.</p>
1.75 rillig 7052: </li>
1.128 wiz 7053: <li class="listitem">
1.75 rillig 7054: <p><code class="varname">NO_BIN_ON_CDROM</code></p>
1.98 wiz 7055: <p>Binaries may not be placed on CD-ROM containing other
7056: binary packages, for which a distribution charge may be made.
7057: In this case, set this variable to
7058: <code class="varname">${RESTRICTED}</code>.</p>
1.75 rillig 7059: </li>
1.128 wiz 7060: <li class="listitem">
1.75 rillig 7061: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.98 wiz 7062: <p>Binaries may not made available on the Internet without
7063: charge. In this case, set this variable to
7064: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7065: binary packages will not be included on ftp.NetBSD.org.</p>
1.75 rillig 7066: </li>
1.128 wiz 7067: <li class="listitem">
1.75 rillig 7068: <p><code class="varname">NO_SRC_ON_CDROM</code></p>
1.98 wiz 7069: <p>Distfiles may not be placed on CD-ROM, together with
7070: other distfiles, for which a fee may be charged. In this
7071: case, set this variable to <code class="varname">${RESTRICTED}</code>.
7072: </p>
1.75 rillig 7073: </li>
1.128 wiz 7074: <li class="listitem">
1.75 rillig 7075: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.98 wiz 7076: <p>Distfiles may not made available via FTP at no charge.
7077: In this case, set this variable to
7078: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7079: the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
1.75 rillig 7080: </li>
7081: </ul></div>
1.222 sevan 7082: <p>Please note that packages will be removed from pkgsrc when the
7083: distfiles are not distributable and cannot be obtained for a period
7084: of one full quarter branch. Packages with manual/interactive fetch
7085: must have a maintainer and it is his/her responsibility to ensure
7086: this.</p>
1.75 rillig 7087: </div>
1.148 asau 7088: <div class="sect2">
1.75 rillig 7089: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7090: <a name="dependencies"></a>21.1.5. Handling dependencies</h3></div></div></div>
1.75 rillig 7091: <p>Your package may depend on some other package being present
1.88 wiz 7092: - and there are various ways of expressing this dependency.
7093: pkgsrc supports the <code class="varname">BUILD_DEPENDS</code> and
1.269 leot 7094: <code class="varname">DEPENDS</code> and
7095: <code class="varname">TOOL_DEPENDS</code> definitions, the
1.88 wiz 7096: <code class="varname">USE_TOOLS</code> definition, as well as dependencies
7097: via <code class="filename">buildlink3.mk</code>, which is the preferred way
7098: to handle dependencies, and which uses the variables named above.
1.267 rillig 7099: See <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a> for more information.</p>
1.75 rillig 7100: <p>The basic difference between the two variables is as
1.87 wiz 7101: follows: The <code class="varname">DEPENDS</code> definition registers
7102: that pre-requisite in the binary package so it will be pulled in
7103: when the binary package is later installed, whilst the
1.269 leot 7104: <code class="varname">BUILD_DEPENDS</code> and <code class="varname">TOOL_DEPENDS</code>
7105: definitions does not, marking a dependency that is only needed for
7106: building the package.</p>
1.75 rillig 7107: <p>This means that if you only need a package present whilst
1.87 wiz 7108: you are building, it should be noted as a
1.269 leot 7109: <code class="varname">TOOL_DEPENDS</code> or
7110: <code class="varname">BUILD_DEPENDS</code>. When cross-compiling,
7111: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
7112: packages, i.e. packages for the architecture where the package
7113: is built;
7114: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
7115: packages, i.e. packages for the architecture for which the package
7116: is built.</p>
7117: <p>The format for <code class="varname">BUILD_DEPENDS</code>,
7118: <code class="varname">DEPENDS</code> and <code class="varname">TOOL_DEPENDS</code>
7119: definition is:</p>
1.75 rillig 7120: <pre class="programlisting">
1.100 rillig 7121: <pre-req-package-name>:../../<category>/<pre-req-package>
1.222 sevan 7122: </pre>
1.128 wiz 7123: <p>Please note that the <span class="quote">“<span class="quote">pre-req-package-name</span>”</span>
1.87 wiz 7124: may include any of the wildcard version numbers recognized by
1.270 ! leot 7125: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p>
1.128 wiz 7126: <div class="orderedlist"><ol class="orderedlist" type="1">
7127: <li class="listitem">
1.75 rillig 7128: <p>If your package needs another package's binaries or
1.160 wiz 7129: libraries to build and run, and if that package has a
1.87 wiz 7130: <code class="filename">buildlink3.mk</code> file available, use it:</p>
1.75 rillig 7131: <pre class="programlisting">
1.100 rillig 7132: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7133: </pre>
1.75 rillig 7134: </li>
1.128 wiz 7135: <li class="listitem">
1.160 wiz 7136: <p>If your package needs another package's binaries or
7137: libraries only for building, and if that package has a
7138: <code class="filename">buildlink3.mk</code> file available, use it:</p>
7139: <pre class="programlisting">
7140: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7141: </pre>
1.160 wiz 7142: <p>but set
7143: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
7144: to make it a build dependency only. This case is rather
7145: rare.</p>
7146: </li>
7147: <li class="listitem">
1.132 spz 7148: <p>If your package needs binaries from another package to build,
1.269 leot 7149: use the <code class="varname">TOOL_DEPENDS</code> definition:</p>
1.75 rillig 7150: <pre class="programlisting">
1.269 leot 7151: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.222 sevan 7152: </pre>
1.75 rillig 7153: </li>
1.269 leot 7154: <li class="listitem"><p>If your package needs static libraries to link against, header
7155: files to include, etc. from another package to build,
7156: use the <code class="varname">BUILD_DEPENDS</code> definition.</p></li>
1.132 spz 7157: <li class="listitem"><p>If your package needs a library with which to link and
7158: there is no <code class="filename">buildlink3.mk</code> file
7159: available, create one. Using
7160: <code class="varname">DEPENDS</code> won't be sufficient because the
7161: include files and libraries will be hidden from the compiler.</p></li>
1.128 wiz 7162: <li class="listitem">
1.132 spz 7163: <p>If your package needs some executable to be able to run
7164: correctly and if there's no
7165: <code class="filename">buildlink3.mk</code> file, this is specified
7166: using the <code class="varname">DEPENDS</code> variable. The
1.250 leot 7167: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/lyx/README.html" target="_top"><code class="filename">print/lyx</code></a> package needs to
1.242 wiz 7168: be able to execute the latex binary from the tex-latex-bin package
1.132 spz 7169: when it runs, and that is specified:</p>
1.75 rillig 7170: <pre class="programlisting">
1.242 wiz 7171: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.222 sevan 7172: </pre>
1.132 spz 7173: </li>
7174: <li class="listitem">
7175: <p>You can use wildcards in package dependencies. Note that
7176: such wildcard dependencies are retained when creating binary
7177: packages. The dependency is checked when installing the binary
7178: package and any package which matches the pattern will be
7179: used. Wildcard dependencies should be used with care.</p>
1.128 wiz 7180: <p>The <span class="quote">“<span class="quote">-[0-9]*</span>”</span> should be used instead of
7181: <span class="quote">“<span class="quote">-*</span>”</span> to avoid potentially ambiguous matches
7182: such as <span class="quote">“<span class="quote">tk-postgresql</span>”</span> matching a
7183: <span class="quote">“<span class="quote">tk-*</span>”</span> <code class="varname">DEPENDS</code>.</p>
1.75 rillig 7184: <p>Wildcards can also be used to specify that a package
1.87 wiz 7185: will only build against a certain minimum version of a
7186: pre-requisite:</p>
1.75 rillig 7187: <pre class="programlisting">
1.132 spz 7188: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.222 sevan 7189: </pre>
1.132 spz 7190: <p>This means that the package will build using version 6.0
7191: of ImageMagick or newer. Such a dependency may be warranted
7192: if, for example, the command line options of an executable
7193: have changed.</p>
7194: <p>If you need to depend on minimum versions of libraries,
7195: see the buildlink section of the pkgsrc guide.</p>
1.75 rillig 7196: <p>For security fixes, please update the package
1.267 rillig 7197: 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 7198: information.</p>
1.75 rillig 7199: </li>
7200: </ol></div>
7201: <p>If your package needs files from another package to build,
1.87 wiz 7202: add the relevant distribution files to
7203: <code class="varname">DISTFILES</code>, so they will be extracted
1.250 leot 7204: automatically. See the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/ghostscript/README.html" target="_top"><code class="filename">print/ghostscript</code></a> package for an example.
1.87 wiz 7205: (It relies on the jpeg sources being present in source form
7206: during the build.)</p>
1.75 rillig 7207: </div>
1.148 asau 7208: <div class="sect2">
1.75 rillig 7209: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7210: <a name="conflicts"></a>21.1.6. Handling conflicts with other packages</h3></div></div></div>
1.75 rillig 7211: <p>Your package may conflict with other packages a user might
1.87 wiz 7212: already have installed on his system, e.g. if your package
1.88 wiz 7213: installs the same set of files as another package in the pkgsrc
1.190 wiz 7214: tree or has the same <code class="varname">PKGNAME</code>.</p>
1.255 leot 7215: <p>For example, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/libXaw3d/README.html" target="_top"><code class="filename">x11/libXaw3d</code></a>
7216: and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw-Xpm/README.html" target="_top"><code class="filename">x11/Xaw-Xpm</code></a>
7217: install the same shared library, thus you set in
7218: <code class="filename">pkgsrc/x11/libXaw3d/Makefile</code>:</p>
7219: <pre class="programlisting">
7220: CONFLICTS= Xaw-Xpm-[0-9]*
7221: </pre>
7222: <p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
7223: <pre class="programlisting">
7224: CONFLICTS= libXaw3d-[0-9]*
7225: </pre>
1.270 ! leot 7226: <p><a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> is able to detect attempts to install packages
1.255 leot 7227: that conflict with existing packages and abort. However, in many
7228: situations this is too late in the process. Binary package managers
7229: will not know about the conflict until they attempt to install the
7230: package after already downloading it and all its dependencies.
7231: Users may also waste time building a package and its dependencies
7232: only to find out at the end that it conflicts with another package
7233: they have installed.</p>
7234: <p>To avoid these issues <code class="varname">CONFLICTS</code> entries
7235: should be added in all cases where it is known that packages conflict
7236: with each other. These <code class="varname">CONFLICTS</code> entries are
1.270 ! leot 7237: exported in <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> files and consumed by binary package
1.255 leot 7238: managers to inform users that packages cannot be installed onto
7239: the target system.</p>
1.75 rillig 7240: </div>
1.148 asau 7241: <div class="sect2">
1.75 rillig 7242: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7243: <a name="not-building-packages"></a>21.1.7. Packages that cannot or should not be built</h3></div></div></div>
1.75 rillig 7244: <p>There are several reasons why a package might be
1.88 wiz 7245: instructed to not build under certain circumstances. If the
1.87 wiz 7246: package builds and runs on most platforms, the exceptions
1.193 dholland 7247: should be noted with <code class="varname">BROKEN_ON_PLATFORM</code>. If
7248: the package builds and runs on a small handful of platforms,
7249: set <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> instead.
7250: Both <code class="varname">BROKEN_ON_PLATFORM</code> and
7251: <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> are OS triples
7252: (OS-version-platform) that can use glob-style
7253: wildcards.</p>
7254: <p>If a package is not appropriate for some platforms (as
1.225 maya 7255: opposed to merely broken), a different set of variables should be
1.193 dholland 7256: used as this affects failure reporting and statistics.
7257: If the package is appropriate for most platforms, the exceptions
1.87 wiz 7258: should be noted with <code class="varname">NOT_FOR_PLATFORM</code>. If
1.193 dholland 7259: the package is appropriate for only a small handful of platforms
7260: (often exactly one), set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.87 wiz 7261: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
7262: <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
7263: (OS-version-platform) that can use glob-style
7264: wildcards.</p>
1.88 wiz 7265: <p>Some packages are tightly bound to a specific version of an
1.250 leot 7266: operating system, e.g. LKMs or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/lsof/README.html" target="_top"><code class="filename">sysutils/lsof</code></a>. Such binary packages are not
1.88 wiz 7267: backwards compatible with other versions of the OS, and should be
7268: uploaded to a version specific directory on the FTP server. Mark
7269: these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
1.128 wiz 7270: <span class="quote">“<span class="quote">yes</span>”</span>. This variable is not currently used by any of
1.88 wiz 7271: the package system internals, but may be used in the
7272: future.</p>
1.75 rillig 7273: <p>If the package should be skipped (for example, because it
1.87 wiz 7274: provides functionality already provided by the system), set
1.88 wiz 7275: <code class="varname">PKG_SKIP_REASON</code> to a descriptive message. If
7276: the package should fail because some preconditions are not met,
7277: set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
1.87 wiz 7278: message.</p>
1.75 rillig 7279: </div>
1.148 asau 7280: <div class="sect2">
1.75 rillig 7281: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7282: <a name="undeletable-packages"></a>21.1.8. Packages which should not be deleted, once installed</h3></div></div></div>
1.75 rillig 7283: <p>To ensure that a package may not be deleted, once it has been
1.87 wiz 7284: installed, the <code class="varname">PKG_PRESERVE</code> definition should
7285: be set in the package Makefile. This will be carried into any
7286: binary package that is made from this pkgsrc entry. A
1.128 wiz 7287: <span class="quote">“<span class="quote">preserved</span>”</span> package will
1.270 ! leot 7288: not be deleted using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the
1.128 wiz 7289: <span class="quote">“<span class="quote">-f</span>”</span> option is used.</p>
1.75 rillig 7290: </div>
1.148 asau 7291: <div class="sect2">
1.75 rillig 7292: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7293: <a name="security-handling"></a>21.1.9. Handling packages with security problems</h3></div></div></div>
1.75 rillig 7294: <p>When a vulnerability is found, this should be noted in
1.87 wiz 7295: <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.138 wiz 7296: and after committing that file, ask pkgsrc-security@NetBSD.org to
7297: update the file on ftp.NetBSD.org.</p>
1.75 rillig 7298: <p>After fixing the vulnerability by a patch, its
1.138 wiz 7299: <code class="varname">PKGREVISION</code> should be increased (this is of
7300: course not necessary if the problem is fixed by using a newer
7301: release of the software), and the pattern in the
7302: pkg-vulnerabilities file must be updated.</p>
1.75 rillig 7303: <p>Also, if the fix should be applied to the stable pkgsrc
1.87 wiz 7304: branch, be sure to submit a pullup request!</p>
1.75 rillig 7305: <p>Binary packages already on ftp.NetBSD.org will be handled
1.87 wiz 7306: semi-automatically by a weekly cron job.</p>
1.75 rillig 7307: </div>
1.148 asau 7308: <div class="sect2">
1.75 rillig 7309: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7310: <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 7311: <p>When making fixes to an existing package it can be useful
1.87 wiz 7312: to change the version number in <code class="varname">PKGNAME</code>. To
7313: avoid conflicting with future versions by the original author, a
1.128 wiz 7314: <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 7315: on package versions by setting <code class="varname">PKGREVISION=1</code>
1.128 wiz 7316: (2, ...). The <span class="quote">“<span class="quote">nb</span>”</span> is treated like a
7317: <span class="quote">“<span class="quote">.</span>”</span> by the package tools. e.g.</p>
1.87 wiz 7318: <pre class="programlisting">
1.100 rillig 7319: DISTNAME= foo-17.42
7320: PKGREVISION= 9
1.222 sevan 7321: </pre>
1.75 rillig 7322: <p>will result in a <code class="varname">PKGNAME</code> of
1.128 wiz 7323: <span class="quote">“<span class="quote">foo-17.42nb9</span>”</span>. If you want to use the original
7324: value of <code class="varname">PKGNAME</code> without the <span class="quote">“<span class="quote">nbX</span>”</span>
1.87 wiz 7325: suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
7326: <code class="varname">PKGNAME_NOREV</code>.</p>
1.75 rillig 7327: <p>When a new release of the package is released, the
1.87 wiz 7328: <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
7329: minor release of the above package, things should be like:</p>
1.75 rillig 7330: <pre class="programlisting">
1.100 rillig 7331: DISTNAME= foo-17.43
1.222 sevan 7332: </pre>
1.87 wiz 7333: <p><code class="varname">PKGREVISION</code> should be incremented for any
7334: non-trivial change in the resulting binary package. Without a
7335: <code class="varname">PKGREVISION</code> bump, someone with the previous
7336: version installed has no way of knowing that their package is out
7337: of date. Thus, changes without increasing
7338: <code class="varname">PKGREVISION</code> are essentially labeled "this is so
7339: trivial that no reasonable person would want to upgrade", and this
7340: is the rough test for when increasing
7341: <code class="varname">PKGREVISION</code> is appropriate. Examples of
7342: changes that do not merit increasing
7343: <code class="varname">PKGREVISION</code> are:</p>
1.148 asau 7344: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7345: <li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
1.114 jmcneill 7346: <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>,
1.100 rillig 7347: or comments in Makefile.</p></li>
1.128 wiz 7348: <li class="listitem"><p>
1.100 rillig 7349: Changing build variables if the resulting binary package is the same.</p></li>
1.128 wiz 7350: <li class="listitem"><p>
1.100 rillig 7351: Changing <code class="filename">DESCR</code>.</p></li>
1.128 wiz 7352: <li class="listitem"><p>
1.100 rillig 7353: Adding <code class="varname">PKG_OPTIONS</code> if the default options don't change.</p></li>
7354: </ul></div>
1.87 wiz 7355: <p>Examples of changes that do merit an increase to
7356: <code class="varname">PKGREVISION</code> include:</p>
1.148 asau 7357: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7358: <li class="listitem"><p>
1.100 rillig 7359: Security fixes</p></li>
1.128 wiz 7360: <li class="listitem"><p>
1.100 rillig 7361: Changes or additions to a patch file</p></li>
1.128 wiz 7362: <li class="listitem"><p>
1.100 rillig 7363: Changes to the <code class="filename">PLIST</code></p></li>
1.128 wiz 7364: <li class="listitem"><p>A dependency is changed or renamed.</p></li>
1.100 rillig 7365: </ul></div>
1.78 rillig 7366: <p>PKGREVISION must also be incremented when dependencies have ABI
7367: changes.</p>
1.75 rillig 7368: </div>
1.148 asau 7369: <div class="sect2">
1.79 rillig 7370: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7371: <a name="fixes.subst"></a>21.1.11. Substituting variable text in the package files (the SUBST framework)</h3></div></div></div>
1.79 rillig 7372: <p>When you want to replace the same text in multiple files
1.87 wiz 7373: or when the replacement text varies, patches alone cannot help.
7374: This is where the SUBST framework comes in. It provides an
7375: easy-to-use interface for replacing text in files.
7376: Example:</p>
7377: <pre class="programlisting">
1.100 rillig 7378: SUBST_CLASSES+= fix-paths
7379: SUBST_STAGE.fix-paths= pre-configure
7380: SUBST_MESSAGE.fix-paths= Fixing absolute paths.
7381: SUBST_FILES.fix-paths= src/*.c
7382: SUBST_FILES.fix-paths+= scripts/*.sh
7383: SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g'
7384: SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g'
1.222 sevan 7385: </pre>
1.79 rillig 7386: <p><code class="varname">SUBST_CLASSES</code> is a list of identifiers
1.87 wiz 7387: that are used to identify the different SUBST blocks that are
7388: defined. The SUBST framework is heavily used by pkgsrc, so it is
7389: important to always use the <code class="literal">+=</code> operator with
7390: this variable. Otherwise some substitutions may be
7391: skipped.</p>
1.79 rillig 7392: <p>The remaining variables of each SUBST block are
1.87 wiz 7393: parameterized with the identifier from the first line
7394: (<code class="literal">fix-paths</code> in this case.) They can be seen as
7395: parameters to a function call.</p>
1.79 rillig 7396: <p><code class="varname">SUBST_STAGE.*</code> specifies the stage at
1.87 wiz 7397: which the replacement will take place. All combinations of
7398: <code class="literal">pre-</code>, <code class="literal">do-</code> and
7399: <code class="literal">post-</code> together with a phase name are
7400: possible, though only few are actually used. Most commonly used
7401: are <code class="literal">post-patch</code> and
7402: <code class="literal">pre-configure</code>. Of these two,
7403: <code class="literal">pre-configure</code> should be preferred because
1.110 hubertf 7404: then it is possible to run <span class="command"><strong>bmake patch</strong></span> and
1.87 wiz 7405: have the state after applying the patches but before making any
7406: other changes. This is especially useful when you are debugging
7407: a package in order to create new patches for it. Similarly,
7408: <code class="literal">post-build</code> is preferred over
7409: <code class="literal">pre-install</code>, because the install phase should
7410: generally be kept as simple as possible. When you use
7411: <code class="literal">post-build</code>, you have the same files in the
7412: working directory that will be installed later, so you can check
7413: if the substitution has succeeded.</p>
1.79 rillig 7414: <p><code class="varname">SUBST_MESSAGE.*</code> is an optional text
1.87 wiz 7415: that is printed just before the substitution is done.</p>
1.79 rillig 7416: <p><code class="varname">SUBST_FILES.*</code> is the list of shell
1.87 wiz 7417: globbing patterns that specifies the files in which the
7418: substitution will take place. The patterns are interpreted
7419: relatively to the <code class="varname">WRKSRC</code> directory.</p>
1.79 rillig 7420: <p><code class="varname">SUBST_SED.*</code> is a list of arguments to
1.270 ! leot 7421: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that specify the actual substitution. Every sed
1.87 wiz 7422: command should be prefixed with <code class="literal">-e</code>, so that
7423: all SUBST blocks look uniform.</p>
1.79 rillig 7424: <p>There are some more variables, but they are so seldomly
1.87 wiz 7425: used that they are only documented in the
7426: <code class="filename">mk/subst.mk</code> file.</p>
1.79 rillig 7427: </div>
1.75 rillig 7428: </div>
1.148 asau 7429: <div class="sect1">
1.75 rillig 7430: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 7431: <a name="fixes.fetch"></a>21.2. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.148 asau 7432: <div class="sect2">
1.75 rillig 7433: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7434: <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 7435: <p>If you need to download from a dynamic URL you can set
1.110 hubertf 7436: <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
1.87 wiz 7437: fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
7438: with the name of each file to download as an argument, expecting
7439: it to output the URL of the directory from which to download
1.250 leot 7440: it. <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/ns-cult3d/README.html" target="_top"><code class="filename">graphics/ns-cult3d</code></a> is an
1.87 wiz 7441: example of this usage.</p>
1.75 rillig 7442: <p>If the download can't be automated, because the user must
1.87 wiz 7443: submit personal information to apply for a password, or must pay
7444: for the source, or whatever, you can set
7445: <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
7446: displayed to the user before aborting the build. Example:</p>
7447: <pre class="programlisting">
1.100 rillig 7448: FETCH_MESSAGE= "Please download the files"
7449: FETCH_MESSAGE+= " "${DISTFILES:Q}
7450: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
1.222 sevan 7451: </pre>
1.75 rillig 7452: </div>
1.148 asau 7453: <div class="sect2">
1.75 rillig 7454: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7455: <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 7456: <p>Sometimes authors of a software package make some
1.87 wiz 7457: modifications after the software was released, and they put up a
7458: new distfile without changing the package's version number. If a
7459: package is already in pkgsrc at that time, the checksum will
7460: no longer match. The contents of the new distfile should be
7461: compared against the old one before changing anything, to make
7462: sure the distfile was really updated on purpose, and that
7463: no trojan horse or so crept in.
1.97 rillig 7464: Please mention that the distfiles were compared and what was found
1.159 rodent 7465: in your commit message.</p>
1.220 wiz 7466: <p>Then, the correct way to work around this is to set
7467: <code class="varname">DIST_SUBDIR</code> to a unique directory name, usually
7468: based on <code class="varname">PKGNAME_NOREV</code> (but take care with
7469: python or ruby packages, where <code class="varname">PKGNAME</code> includes
7470: a variable prefix). All <code class="varname">DISTFILES</code> and
1.93 rillig 7471: <code class="varname">PATCHFILES</code> for this package will be put in that
1.267 rillig 7472: 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 7473: happens more often, <code class="varname">PKGNAME</code> can be used (thus
1.220 wiz 7474: including the <code class="filename">nbX</code> suffix) or a date stamp can
7475: be appended, like
7476: <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
1.159 rodent 7477: <p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's name does not contain a version and the distfile is apt to change. In cases where the likelihood of this is very small, <code class="varname">DIST_SUBDIR</code> might not be required. Additionally, <code class="varname">DIST_SUBDIR</code> must not be removed unless the distfile name changes, even if a package is being moved or renamed.</p>
7478: <p>Do not forget regenerating the <code class="filename">distinfo</code> file
1.87 wiz 7479: after that, since it contains the <code class="varname">DIST_SUBDIR</code>
7480: path in the filenames.
1.159 rodent 7481: Also, increase the PKGREVISION if the installed package is different.
1.87 wiz 7482: Furthermore, a mail to the package's authors seems appropriate
7483: telling them that changing distfiles after releases without
7484: changing the file names is not good practice.</p>
1.75 rillig 7485: </div>
1.199 tnn 7486: <div class="sect2">
7487: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7488: <a name="build.fetch.github"></a>21.2.3. Packages hosted on github.com</h3></div></div></div>
1.200 tnn 7489: <p>Helper methods exist for packages hosted on github.com which will often have distfile names that clash with other packages, for example <code class="filename">1.0.tar.gz</code>. Use one of the three recipes from below:
7490: </p>
1.199 tnn 7491: <div class="sect3">
7492: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7493: <a name="build.fetch.github.tag"></a>21.2.3.1. Fetch based on a tagged release</h4></div></div></div>
1.199 tnn 7494: <p>
7495: If your distfile URL looks similar to <code class="literal">http://github.com/username/exampleproject/archive/v1.0.zip</code>, then you are packaging a tagged release.
7496: </p>
7497: <pre class="programlisting">
7498: DISTNAME= exampleproject-1.0
1.200 tnn 7499: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
7500: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
7501: GITHUB_TAG= v${PKGVERSION_NOREV}
1.199 tnn 7502: EXTRACT_SUFX= .zip
7503: </pre>
7504: </div>
7505: <div class="sect3">
7506: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7507: <a name="build.fetch.github.commit"></a>21.2.3.2. Fetch based on a specific commit</h4></div></div></div>
1.199 tnn 7508: <p>
7509: If your distfile URL looks similar to <code class="literal">http://github.com/example/example/archive/988881adc9fc3655077dc2d4d757d480b5ea0e11.tar.gz</code>, then you are packaging a specific commit not tied to a release.
7510: </p>
7511: <pre class="programlisting">
7512: DISTNAME= example-1.0
1.217 jnemeth 7513: MASTER_SITES= ${MASTER_SITE_GITHUB:=example/}
1.200 tnn 7514: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
7515: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.222 sevan 7516: </pre>
1.199 tnn 7517: </div>
7518: <div class="sect3">
7519: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7520: <a name="build.fetch.github.release"></a>21.2.3.3. Fetch based on release</h4></div></div></div>
1.199 tnn 7521: <p>
7522: If your distfile URL looks similar to <code class="literal">http://github.com/username/exampleproject/releases/download/rel-1.6/offensive-1.6.zip</code>, then you are packaging a release.
7523: </p>
7524: <pre class="programlisting">
7525: DISTNAME= offensive-1.6
1.200 tnn 7526: PKGNAME= ${DISTNAME:S/offensive/proper/}
7527: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
7528: GITHUB_PROJECT= exampleproject
7529: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
7530: EXTRACT_SUFX= .zip
1.222 sevan 7531: </pre>
1.199 tnn 7532: </div>
7533: </div>
1.75 rillig 7534: </div>
1.148 asau 7535: <div class="sect1">
1.75 rillig 7536: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 7537: <a name="fixes.configure"></a>21.3. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.148 asau 7538: <div class="sect2">
1.75 rillig 7539: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7540: <a name="fixes.libtool"></a>21.3.1. Shared libraries - libtool</h3></div></div></div>
1.75 rillig 7541: <p>pkgsrc supports many different machines, with different
1.87 wiz 7542: object formats like a.out and ELF, and varying abilities to do
7543: shared library and dynamic loading at all. To accompany this,
7544: varying commands and options have to be passed to the
7545: compiler, linker, etc. to get the Right Thing, which can be
7546: pretty annoying especially if you don't have all the machines
7547: at your hand to test things. The
1.250 leot 7548: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/libtool/README.html" target="_top"><code class="filename">devel/libtool</code></a> pkg
1.128 wiz 7549: can help here, as it just <span class="quote">“<span class="quote">knows</span>”</span> how to build
1.87 wiz 7550: both static and dynamic libraries from a set of source files,
7551: thus being platform-independent.</p>
7552: <p>Here's how to use libtool in a package in seven simple
7553: steps:</p>
1.128 wiz 7554: <div class="orderedlist"><ol class="orderedlist" type="1">
7555: <li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
1.87 wiz 7556: Makefile.</p></li>
1.128 wiz 7557: <li class="listitem"><p>For library objects, use <span class="quote">“<span class="quote">${LIBTOOL} --mode=compile
7558: ${CC}</span>”</span> in place of <span class="quote">“<span class="quote">${CC}</span>”</span>. You could even
1.87 wiz 7559: add it to the definition of <code class="varname">CC</code>, if only
7560: libraries are being built in a given Makefile. This one command
7561: will build both PIC and non-PIC library objects, so you need not
7562: have separate shared and non-shared library rules.</p></li>
1.128 wiz 7563: <li class="listitem">
1.75 rillig 7564: <p>For the linking of the library, remove any
1.128 wiz 7565: <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
7566: -Bshareable</span>”</span> commands, and instead use:</p>
1.75 rillig 7567: <pre class="programlisting">
1.100 rillig 7568: ${LIBTOOL} --mode=link \
7569: ${CC} -o ${.TARGET:.a=.la} \
7570: ${OBJS:.o=.lo} \
7571: -rpath ${PREFIX}/lib \
7572: -version-info major:minor
1.222 sevan 7573: </pre>
1.75 rillig 7574: <p>Note that the library is changed to have a
1.87 wiz 7575: <code class="filename">.la</code> extension, and the objects are
7576: changed to have a <code class="filename">.lo</code>
7577: extension. Change <code class="varname">OBJS</code> as
7578: necessary. This automatically creates all of the
7579: <code class="filename">.a</code>,
7580: <code class="filename">.so.major.minor</code>, and ELF symlinks (if
7581: necessary) in the build directory. Be sure to include
1.128 wiz 7582: <span class="quote">“<span class="quote">-version-info</span>”</span>, especially when major and
1.87 wiz 7583: minor are zero, as libtool will otherwise strip off the
7584: shared library version.</p>
1.75 rillig 7585: <p>From the libtool manual:</p>
7586: <pre class="programlisting">
1.100 rillig 7587: So, libtool library versions are described by three integers:
1.69 rillig 7588:
1.100 rillig 7589: CURRENT
7590: The most recent interface number that this library implements.
1.69 rillig 7591:
1.100 rillig 7592: REVISION
7593: The implementation number of the CURRENT interface.
1.69 rillig 7594:
1.100 rillig 7595: AGE
7596: The difference between the newest and oldest interfaces that
7597: this library implements. In other words, the library implements
7598: all the interface numbers in the range from number `CURRENT -
7599: AGE' to `CURRENT'.
1.1 grant 7600:
1.100 rillig 7601: If two libraries have identical CURRENT and AGE numbers, then the
7602: dynamic linker chooses the library with the greater REVISION number.
1.222 sevan 7603: </pre>
1.128 wiz 7604: <p>The <span class="quote">“<span class="quote">-release</span>”</span> option will produce
1.87 wiz 7605: different results for a.out and ELF (excluding symlinks)
7606: in only one case. An ELF library of the form
1.128 wiz 7607: <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 7608: will have a symlink of
1.128 wiz 7609: <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 7610: on an a.out platform. This is handled
7611: automatically.</p>
1.128 wiz 7612: <p>The <span class="quote">“<span class="quote">-rpath argument</span>”</span> is the install
1.87 wiz 7613: directory of the library being built.</p>
1.76 rillig 7614: <p>In the <code class="filename">PLIST</code>, include only the
1.87 wiz 7615: <code class="filename">.la</code> file, the other files will be
7616: added automatically.</p>
1.75 rillig 7617: </li>
1.128 wiz 7618: <li class="listitem">
1.76 rillig 7619: <p>When linking shared object (<code class="filename">.so</code>)
1.270 ! leot 7620: files, i.e. files that are loaded via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT
1.128 wiz 7621: shared libraries, use <span class="quote">“<span class="quote">-module
7622: -avoid-version</span>”</span> to prevent them getting version
1.87 wiz 7623: tacked on.</p>
1.76 rillig 7624: <p>The <code class="filename">PLIST</code> file gets the
1.87 wiz 7625: <code class="filename">foo.so</code> entry.</p>
1.75 rillig 7626: </li>
1.128 wiz 7627: <li class="listitem">
1.75 rillig 7628: <p>When linking programs that depend on these libraries
1.87 wiz 7629: <span class="emphasis"><em>before</em></span> they are installed, preface
1.270 ! leot 7630: the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cc+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">cc</span>(1)</span></a> or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ld+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">“<span class="quote">${LIBTOOL}
1.128 wiz 7631: --mode=link</span>”</span>, and it will find the correct
1.87 wiz 7632: libraries (static or shared), but please be aware that
7633: libtool will not allow you to specify a relative path in
1.128 wiz 7634: -L (such as <span class="quote">“<span class="quote">-L../somelib</span>”</span>), because it
1.87 wiz 7635: expects you to change that argument to be the
7636: <code class="filename">.la</code> file. e.g.</p>
1.75 rillig 7637: <pre class="programlisting">
1.100 rillig 7638: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.222 sevan 7639: </pre>
1.75 rillig 7640: <p>should be changed to:</p>
7641: <pre class="programlisting">
1.100 rillig 7642: ${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
1.222 sevan 7643: </pre>
1.75 rillig 7644: <p>and it will do the right thing with the libraries.</p>
7645: </li>
1.128 wiz 7646: <li class="listitem">
1.270 ! leot 7647: <p>When installing libraries, preface the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a>
! 7648: or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cp+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">“<span class="quote">${LIBTOOL}
1.128 wiz 7649: --mode=install</span>”</span>, and change the library name to
1.87 wiz 7650: <code class="filename">.la</code>. e.g.</p>
1.75 rillig 7651: <pre class="programlisting">
1.126 jakllsch 7652: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.222 sevan 7653: </pre>
1.76 rillig 7654: <p>This will install the static <code class="filename">.a</code>,
1.87 wiz 7655: shared library, any needed symlinks, and run
1.270 ! leot 7656: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p>
1.75 rillig 7657: </li>
1.128 wiz 7658: <li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
1.87 wiz 7659: the <code class="filename">.la</code>
7660: file (this is a change from previous behaviour).</p></li>
1.75 rillig 7661: </ol></div>
7662: </div>
1.148 asau 7663: <div class="sect2">
1.75 rillig 7664: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7665: <a name="using-libtool"></a>21.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
1.75 rillig 7666: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
1.87 wiz 7667: package Makefile. This will override the package's own libtool
7668: in most cases. For older libtool using packages, libtool is
7669: made by ltconfig script during the do-configure step; you can
1.110 hubertf 7670: check the libtool script location by doing <span class="command"><strong>make
1.87 wiz 7671: configure; find work*/ -name libtool</strong></span>.</p>
1.75 rillig 7672: <p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
1.87 wiz 7673: scripts, relative to <code class="varname">WRKSRC</code>, to override. By
1.128 wiz 7674: default, it is set to <span class="quote">“<span class="quote">libtool */libtool
7675: */*/libtool</span>”</span>. If this does not match the location of the
1.87 wiz 7676: package's libtool script(s), set it as appropriate.</p>
1.76 rillig 7677: <p>If you do not need <code class="filename">*.a</code> static
1.87 wiz 7678: libraries built and installed, then use
7679: <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.75 rillig 7680: <p>If your package makes use of the platform-independent library
1.87 wiz 7681: for loading dynamic shared objects, that comes with libtool
7682: (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
7683: <p>Some packages use libtool incorrectly so that the package
7684: may not work or build in some circumstances. Some of the more
7685: common errors are:</p>
1.148 asau 7686: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7687: <li class="listitem">
1.75 rillig 7688: <p>The inclusion of a shared object (-module) as a dependent library in an
1.87 wiz 7689: executable or library. This in itself isn't a problem if one of two things
7690: has been done:</p>
1.128 wiz 7691: <div class="orderedlist"><ol class="orderedlist" type="1">
7692: <li class="listitem"><p>The shared object is named correctly, i.e.
1.87 wiz 7693: <code class="filename">libfoo.la</code>, not
7694: <code class="filename">foo.la</code></p></li>
1.128 wiz 7695: <li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
1.75 rillig 7696: </ol></div>
7697: </li>
1.128 wiz 7698: <li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
1.87 wiz 7699: The function lt_dlinit() should be called and the macro
7700: <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
7701: executables.</p></li>
1.75 rillig 7702: </ul></div>
7703: </div>
1.148 asau 7704: <div class="sect2">
1.75 rillig 7705: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7706: <a name="autoconf-automake"></a>21.3.3. GNU Autoconf/Automake</h3></div></div></div>
1.75 rillig 7707: <p>If a package needs GNU autoconf or automake to be executed
1.87 wiz 7708: to regenerate the configure script and Makefile.in makefile
7709: templates, then they should be executed in a pre-configure
7710: target.</p>
1.75 rillig 7711: <p>For packages that need only autoconf:</p>
7712: <pre class="programlisting">
1.100 rillig 7713: AUTOCONF_REQD= 2.50 # if default version is not good enough
7714: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
7715: ...
1.1 grant 7716:
1.100 rillig 7717: pre-configure:
7718: cd ${WRKSRC} && autoconf
1.1 grant 7719:
1.100 rillig 7720: ...
1.222 sevan 7721: </pre>
1.75 rillig 7722: <p>and for packages that need automake and autoconf:</p>
7723: <pre class="programlisting">
1.100 rillig 7724: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
7725: USE_TOOLS+= automake # use "automake14" for automake-1.4
7726: ...
7727:
7728: pre-configure:
7729: set -e; cd ${WRKSRC}; \
7730: aclocal; autoheader; automake -a --foreign -i; autoconf
1.1 grant 7731:
1.100 rillig 7732: ...
1.222 sevan 7733: </pre>
1.75 rillig 7734: <p>Packages which use GNU Automake will almost certainly
1.87 wiz 7735: require GNU Make.</p>
1.75 rillig 7736: <p>There are times when the configure process makes
1.87 wiz 7737: additional changes to the generated files, which then causes
7738: the build process to try to re-execute the automake sequence.
7739: This is prevented by touching various files in the configure
7740: stage. If this causes problems with your package you can set
7741: <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
7742: Makefile.</p>
1.75 rillig 7743: </div>
7744: </div>
1.148 asau 7745: <div class="sect1">
1.75 rillig 7746: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 7747: <a name="programming-languages"></a>21.4. Programming languages</h2></div></div></div>
1.148 asau 7748: <div class="sect2">
1.87 wiz 7749: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7750: <a name="basic-programming-languages"></a>21.4.1. C, C++, and Fortran</h3></div></div></div>
1.87 wiz 7751: <p>Compilers for the C, C++, and Fortran languages comes with
7752: the NetBSD base system. By default, pkgsrc assumes that a package
7753: is written in C and will hide all other compilers (via the wrapper
1.267 rillig 7754: framework, see <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a>).</p>
1.87 wiz 7755: <p>To declare which language's compiler a package needs, set
7756: the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
1.128 wiz 7757: currently are <span class="quote">“<span class="quote">c</span>”</span>, <span class="quote">“<span class="quote">c++</span>”</span>, and
7758: <span class="quote">“<span class="quote">fortran</span>”</span> (and any combination). The default is
7759: <span class="quote">“<span class="quote">c</span>”</span>. Packages using GNU configure scripts, even if
1.87 wiz 7760: written in C++, usually need a C compiler for the configure
7761: phase.</p>
7762: </div>
1.148 asau 7763: <div class="sect2">
1.87 wiz 7764: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7765: <a name="java-programming-language"></a>21.4.2. Java</h3></div></div></div>
1.87 wiz 7766: <p>If a program is written in Java, use the Java framework in
7767: pkgsrc. The package must include
7768: <code class="filename">../../mk/java-vm.mk</code>. This Makefile fragment
7769: provides the following variables:</p>
1.148 asau 7770: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7771: <li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
1.87 wiz 7772: dependency on the JDK is added. If
1.128 wiz 7773: <code class="varname">USE_JAVA</code> is set to <span class="quote">“<span class="quote">run</span>”</span>, then
1.87 wiz 7774: there is only a runtime dependency on the JDK. The default is
1.128 wiz 7775: <span class="quote">“<span class="quote">yes</span>”</span>, which also adds a build dependency on the
1.87 wiz 7776: JDK.</p></li>
1.128 wiz 7777: <li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
1.87 wiz 7778: a package needs a Java2 implementation. The supported values
1.128 wiz 7779: are <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">1.4</span>”</span>, and
7780: <span class="quote">“<span class="quote">1.5</span>”</span>. <span class="quote">“<span class="quote">yes</span>”</span> accepts any Java2
7781: implementation, <span class="quote">“<span class="quote">1.4</span>”</span> insists on versions 1.4 or
7782: above, and <span class="quote">“<span class="quote">1.5</span>”</span> only accepts versions 1.5 or
1.87 wiz 7783: above. This variable is not set by default.</p></li>
1.130 wiz 7784: <li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
7785: automatically set to the runtime location of the used Java
7786: implementation dependency. It may be used to set
7787: <code class="varname">JAVA_HOME</code> to a good value if the program
7788: needs this variable to be defined.
7789: </p></li>
1.87 wiz 7790: </ul></div>
7791: </div>
1.148 asau 7792: <div class="sect2">
1.87 wiz 7793: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7794: <a name="perl-scripts"></a>21.4.3. Packages containing perl scripts</h3></div></div></div>
1.87 wiz 7795: <p>If your package contains interpreted perl scripts, add
1.128 wiz 7796: <span class="quote">“<span class="quote">perl</span>”</span> to the <code class="varname">USE_TOOLS</code> variable
1.87 wiz 7797: and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
7798: interpreter path is set. <code class="varname">REPLACE_PERL</code> should
7799: contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
1.183 wiz 7800: that you want adjusted. Every occurrence of
7801: <code class="filename">*/bin/perl</code> in a she-bang line will be
7802: replaced with the full path to the perl executable.</p>
1.87 wiz 7803: <p>If a particular version of perl is needed, set the
7804: <code class="varname">PERL5_REQD</code> variable to the version number. The
1.128 wiz 7805: default is <span class="quote">“<span class="quote">5.0</span>”</span>.</p>
1.267 rillig 7806: <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.87 wiz 7807: about handling perl modules.</p>
7808: </div>
1.148 asau 7809: <div class="sect2">
1.87 wiz 7810: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7811: <a name="shell-scripts"></a>21.4.4. Packages containing shell scripts</h3></div></div></div>
1.147 wiz 7812: <p><code class="varname">REPLACE_SH</code>,
7813: <code class="varname">REPLACE_BASH</code>, <code class="varname">REPLACE_CSH</code>,
7814: and <code class="varname">REPLACE_KSH</code> can be used to replace shell
7815: hash bangs in files. Please use the appropriate one, prefering
7816: <code class="varname">REPLACE_SH</code> in case this shell is sufficient.
1.183 wiz 7817: Each should contain a list of scripts, relative to
7818: <code class="varname">WRKSRC</code>, that you want adjusted. Every
7819: occurrence of the matching shell in a she-bang line will be
7820: replaced with the full path to the shell executable.
1.147 wiz 7821: When using <code class="varname">REPLACE_BASH</code>, don't forget to add
7822: <code class="filename">bash</code> to <code class="varname">USE_TOOLS</code>.</p>
7823: </div>
1.148 asau 7824: <div class="sect2">
1.147 wiz 7825: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7826: <a name="other-programming-languages"></a>21.4.5. Other programming languages</h3></div></div></div>
1.87 wiz 7827: <p>Currently, there is no special handling for other languages
7828: in pkgsrc. If a compiler package provides a
7829: <code class="filename">buildlink3.mk</code> file, include that, otherwise
7830: just add a (build) dependency on the appropriate compiler
7831: package.</p>
7832: </div>
7833: </div>
1.148 asau 7834: <div class="sect1">
1.87 wiz 7835: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 7836: <a name="fixes.build"></a>21.5. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.77 rillig 7837: <p>The most common failures when building a package are that
7838: some platforms do not provide certain header files, functions or
7839: libraries, or they provide the functions in a library that the
7840: original package author didn't know. To work around this, you
7841: can rewrite the source code in most cases so that it does not
7842: use the missing functions or provides a replacement function.</p>
1.148 asau 7843: <div class="sect2">
1.77 rillig 7844: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7845: <a name="fixes.build.cpp"></a>21.5.1. Compiling C and C++ code conditionally</h3></div></div></div>
1.77 rillig 7846: <p>If a package already comes with a GNU configure script, the
7847: preferred way to fix the build failure is to change the
7848: configure script, not the code. In the other cases, you can
7849: utilize the C preprocessor, which defines certain macros
7850: depending on the operating system and hardware architecture it
7851: compiles for. These macros can be queried using for example
7852: <code class="varname">#if defined(__i386)</code>. Almost every operating
7853: system, hardware architecture and compiler has its own macro.
7854: For example, if the macros <code class="varname">__GNUC__</code>,
7855: <code class="varname">__i386__</code> and <code class="varname">__NetBSD__</code>
7856: are all defined, you know that you are using NetBSD on an i386
7857: compatible CPU, and your compiler is GCC.</p>
7858: <p>The list of the following macros for hardware and
7859: operating system depends on the compiler that is used. For
7860: example, if you want to conditionally compile code on Solaris,
7861: don't use <code class="varname">__sun__</code>, as the SunPro compiler
7862: does not define it. Use <code class="varname">__sun</code> instead.</p>
1.148 asau 7863: <div class="sect3">
1.75 rillig 7864: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7865: <a name="fixes.build.cpp.os"></a>21.5.1.1. C preprocessor macros to identify the operating system</h4></div></div></div>
1.75 rillig 7866: <p>To distinguish between 4.4 BSD-derived systems and the
7867: rest of the world, you should use the following code.</p>
7868: <pre class="programlisting">
1.100 rillig 7869: #include <sys/param.h>
7870: #if (defined(BSD) && BSD >= 199306)
7871: /* BSD-specific code goes here */
7872: #else
7873: /* non-BSD-specific code goes here */
7874: #endif
1.75 rillig 7875: </pre>
1.77 rillig 7876: <p>If this distinction is not fine enough, you can also test
7877: for the following macros.</p>
1.75 rillig 7878: <pre class="programlisting">
1.151 obache 7879: Cygwin __CYGWIN__
7880: DragonFly __DragonFly__
1.100 rillig 7881: FreeBSD __FreeBSD__
1.151 obache 7882: Haiku __HAIKU__
1.100 rillig 7883: Interix __INTERIX
7884: IRIX __sgi (TODO: get a definite source for this)
7885: Linux linux, __linux, __linux__
1.193 dholland 7886: Mac OS X __APPLE__
1.151 obache 7887: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7888: Minix3 __minix
1.100 rillig 7889: NetBSD __NetBSD__
7890: OpenBSD __OpenBSD__
7891: Solaris sun, __sun
1.75 rillig 7892: </pre>
7893: </div>
1.148 asau 7894: <div class="sect3">
1.75 rillig 7895: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7896: <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 7897: <pre class="programlisting">
1.100 rillig 7898: i386 i386, __i386, __i386__
7899: MIPS __mips
7900: SPARC sparc, __sparc
1.75 rillig 7901: </pre>
7902: </div>
1.148 asau 7903: <div class="sect3">
1.75 rillig 7904: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7905: <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 7906: <pre class="programlisting">
1.100 rillig 7907: GCC __GNUC__ (major version), __GNUC_MINOR__
7908: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7909: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7910: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
1.75 rillig 7911: </pre>
7912: </div>
7913: </div>
1.148 asau 7914: <div class="sect2">
1.78 rillig 7915: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7916: <a name="compiler-bugs"></a>21.5.2. How to handle compiler bugs</h3></div></div></div>
1.78 rillig 7917: <p>Some source files trigger bugs in the compiler, based on
1.87 wiz 7918: combinations of compiler version and architecture and almost
7919: always relation to optimisation being enabled. Common symptoms
7920: are gcc internal errors or never finishing compiling a
1.78 rillig 7921: file.</p>
7922: <p>Typically, a workaround involves testing the
7923: <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
7924: optimisation for that combination of file,
1.198 tnn 7925: <code class="varname">MACHINE_ARCH</code> and compiler.</p>
7926: <p>This used to be a big problem in the past, but is rarely
7927: needed now as compiler technology has matured. If you still need
7928: to add a compiler specific workaround, please do so in the file
7929: <code class="filename">hacks.mk</code> and describe the symptom and
7930: compiler version as detailed as possible.</p>
1.78 rillig 7931: </div>
1.148 asau 7932: <div class="sect2">
1.78 rillig 7933: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7934: <a name="undefined-reference"></a>21.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span>
1.128 wiz 7935: </h3></div></div></div>
1.92 rillig 7936: <p>This error message often means that a package did not
1.78 rillig 7937: link to a shared library it needs. The following functions are
7938: known to cause this error message over and over.</p>
7939: <div class="informaltable">
1.216 tnn 7940: <a name="undefined-reference-functions"></a><table class="informaltable" border="1">
1.78 rillig 7941: <colgroup>
7942: <col>
7943: <col>
7944: <col>
7945: </colgroup>
7946: <thead><tr>
7947: <th>Function</th>
7948: <th>Library</th>
7949: <th>Affected platforms</th>
7950: </tr></thead>
7951: <tbody>
7952: <tr>
7953: <td>accept, bind, connect</td>
7954: <td>-lsocket</td>
7955: <td>Solaris</td>
7956: </tr>
7957: <tr>
7958: <td>crypt</td>
7959: <td>-lcrypt</td>
7960: <td>DragonFly, NetBSD</td>
7961: </tr>
7962: <tr>
7963: <td>dlopen, dlsym</td>
7964: <td>-ldl</td>
7965: <td>Linux</td>
7966: </tr>
7967: <tr>
7968: <td>gethost*</td>
7969: <td>-lnsl</td>
7970: <td>Solaris</td>
7971: </tr>
7972: <tr>
7973: <td>inet_aton</td>
7974: <td>-lresolv</td>
7975: <td>Solaris</td>
7976: </tr>
7977: <tr>
7978: <td>nanosleep, sem_*, timer_*</td>
7979: <td>-lrt</td>
7980: <td>Solaris</td>
7981: </tr>
7982: <tr>
7983: <td>openpty</td>
7984: <td>-lutil</td>
7985: <td>Linux</td>
7986: </tr>
7987: </tbody>
7988: </table>
7989: </div>
7990: <p>To fix these linker errors, it is often sufficient to say
1.87 wiz 7991: <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
7992: -l<em class="replaceable"><code>foo</code></em></code> to the package
1.110 hubertf 7993: <code class="filename">Makefile</code> and then say <span class="command"><strong>bmake clean;
1.87 wiz 7994: bmake</strong></span>.</p>
1.148 asau 7995: <div class="sect3">
1.92 rillig 7996: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7997: <a name="undefined-reference-sunpro"></a>21.5.3.1. Special issue: The SunPro compiler</h4></div></div></div>
1.92 rillig 7998: <p>When you are using the SunPro compiler, there is another
7999: possibility. That compiler cannot handle the following code:</p>
8000: <pre class="programlisting">
1.100 rillig 8001: extern int extern_func(int);
1.93 rillig 8002:
1.100 rillig 8003: static inline int
8004: inline_func(int x)
8005: {
1.92 rillig 8006: return extern_func(x);
1.100 rillig 8007: }
1.93 rillig 8008:
1.100 rillig 8009: int main(void)
8010: {
1.92 rillig 8011: return 0;
1.100 rillig 8012: }
1.92 rillig 8013: </pre>
8014: <p>It generates the code for <code class="function">inline_func</code> even if
8015: that function is never used. This code then refers to
8016: <code class="function">extern_func</code>, which can usually not be resolved. To
8017: solve this problem you can try to tell the package to disable inlining
8018: of functions.</p>
8019: </div>
1.87 wiz 8020: </div>
1.148 asau 8021: <div class="sect2">
1.87 wiz 8022: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8023: <a name="out-of-memory"></a>21.5.4. Running out of memory</h3></div></div></div>
1.87 wiz 8024: <p>Sometimes packages fail to build because the compiler runs
8025: into an operating system specific soft limit. With the
8026: <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
1.204 wiz 8027: to unlimit the resources. Currently, the allowed values are any combination of
8028: <span class="quote">“<span class="quote">cputime</span>”</span>, <span class="quote">“<span class="quote">datasize</span>”</span>,
8029: <span class="quote">“<span class="quote">memorysize</span>”</span>, and <span class="quote">“<span class="quote">stacksize</span>”</span>.
1.87 wiz 8030: Setting this variable is similar to running the shell builtin
1.110 hubertf 8031: <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
1.87 wiz 8032: segment size or maximum stack size of a process, respectively, to
8033: their hard limits.</p>
1.78 rillig 8034: </div>
1.75 rillig 8035: </div>
1.148 asau 8036: <div class="sect1">
1.75 rillig 8037: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8038: <a name="fixes.install"></a>21.6. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.148 asau 8039: <div class="sect2">
1.75 rillig 8040: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8041: <a name="install-scripts"></a>21.6.1. Creating needed directories</h3></div></div></div>
1.110 hubertf 8042: <p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
1.87 wiz 8043: with some operating systems cannot create more than one
8044: directory at a time. As such, you should call
8045: <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
8046: <pre class="programlisting">
1.100 rillig 8047: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
8048: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.222 sevan 8049: </pre>
1.128 wiz 8050: <p>You can also just append <span class="quote">“<span class="quote"><code class="literal">dir1
8051: dir2</code></span>”</span> to the
1.87 wiz 8052: <code class="varname">INSTALLATION_DIRS</code> variable, which will
8053: automatically do the right thing.</p>
1.75 rillig 8054: </div>
1.148 asau 8055: <div class="sect2">
1.75 rillig 8056: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8057: <a name="where-to-install-documentation"></a>21.6.2. Where to install documentation</h3></div></div></div>
1.83 wiz 8058: <p>In general, documentation should be installed into
1.87 wiz 8059: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8060: <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code> (the latter
8061: includes the version number of the package).</p>
1.84 wiz 8062: <p>Many modern packages using GNU autoconf allow to set the
1.87 wiz 8063: directory where HTML documentation is installed with the
1.128 wiz 8064: <span class="quote">“<span class="quote">--with-html-dir</span>”</span> option. Sometimes using this flag
1.87 wiz 8065: is needed because otherwise the documentation ends up in
8066: <code class="filename">${PREFIX}/share/doc/html</code> or other
8067: places.</p>
8068: <p>An exception to the above is that library API documentation
1.250 leot 8069: generated with the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/textproc/gtk-doc/README.html" target="_top"><code class="filename">textproc/gtk-doc</code></a> tools, for use by special
1.87 wiz 8070: browsers (devhelp) should be left at their default location, which
8071: is <code class="filename">${PREFIX}/share/gtk-doc</code>. Such
8072: documentation can be recognized from files ending in
8073: <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
8074: (It is also acceptable to install such files in
8075: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8076: <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
8077: <code class="filename">.devhelp*</code> file must be directly in that
8078: directory then, no additional subdirectory level is allowed in
8079: this case. This is usually achieved by using
1.128 wiz 8080: <span class="quote">“<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>”</span>.
1.87 wiz 8081: <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
8082: though.)</p>
1.75 rillig 8083: </div>
1.148 asau 8084: <div class="sect2">
1.75 rillig 8085: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8086: <a name="installing-score-files"></a>21.6.3. Installing highscore files</h3></div></div></div>
1.75 rillig 8087: <p>Certain packages, most of them in the games category, install
1.87 wiz 8088: a score file that allows all users on the system to record their
8089: highscores. In order for this to work, the binaries need to be
8090: installed setgid and the score files owned by the appropriate
1.142 wiz 8091: group and/or owner (traditionally the "games" user/group). Set
8092: <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
1.87 wiz 8093: following variables, documented in more detail in
8094: <code class="filename">mk/defaults/mk.conf</code>, control this
1.142 wiz 8095: behaviour: <code class="varname">GAMEDATAMODE</code>,
8096: <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
1.210 leot 8097: <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.
8098: Other useful variables are: <code class="varname">GAMEDIR_PERMS</code>,
8099: <code class="varname">GAMEDATA_PERMS</code> and
8100: <code class="varname">SETGID_GAMES_PERMS</code>.</p>
8101: <p>An example that illustrates some of the variables described above is
8102: <code class="filename">games/moon-buggy</code>. <code class="varname">OWN_DIRS_PERMS</code> is
8103: used to properly set directory permissions of the directory where the
8104: scorefile is saved, <code class="varname">REQD_FILES_PERMS</code> is used to create a
8105: dummy scorefile (<code class="filename">mbscore</code>) with the proper permissions
8106: and <code class="varname">SPECIAL_PERMS</code> is used to install setgid the game
8107: binary:</p>
8108: <pre class="programlisting">
1.223 rillig 8109: USE_GAMESGROUP= yes
1.210 leot 8110:
1.223 rillig 8111: BUILD_DEFS+= VARBASE
1.210 leot 8112:
1.223 rillig 8113: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
8114: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
8115: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
1.222 sevan 8116: </pre>
1.210 leot 8117: <p>Various <code class="varname">INSTALL_*</code> variables are also available:
8118: <code class="varname">INSTALL_GAME</code> to install setgid game binaries,
8119: <code class="varname">INSTALL_GAME_DIR</code> to install game directories that are
8120: needed to be accessed by setgid games and
8121: <code class="varname">INSTALL_GAME_DATA</code> to install scorefiles.</p>
1.114 jmcneill 8122: <p>A package should therefore never hard code file ownership or
1.210 leot 8123: access permissions but rely on <code class="varname">*_PERMS</code> as described above
8124: or alternatively on <code class="varname">INSTALL_GAME</code>,
8125: <code class="varname">INSTALL_GAME_DATA</code> and
8126: <code class="varname">INSTALL_GAME_DIR</code> to set these correctly.</p>
1.75 rillig 8127: </div>
1.148 asau 8128: <div class="sect2">
1.75 rillig 8129: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8130: <a name="destdir-support"></a>21.6.4. Adding DESTDIR support to packages</h3></div></div></div>
1.114 jmcneill 8131: <p><code class="varname">DESTDIR</code> support means that a package
8132: installs into a staging directory, not the final location of the
8133: files. Then a binary package is created which can be used for
8134: installation as usual. There are two ways: Either the package must
1.128 wiz 8135: install as root (<span class="quote">“<span class="quote">destdir</span>”</span>) or the package can
8136: install as non-root user (<span class="quote">“<span class="quote">user-destdir</span>”</span>).</p>
1.148 asau 8137: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8138: <li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
1.224 leot 8139: set to <span class="quote">“<span class="quote">destdir</span>”</span> or <span class="quote">“<span class="quote">user-destdir</span>”</span>.
8140: By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
1.145 wiz 8141: is set to <span class="quote">“<span class="quote">user-destdir</span>”</span> to help catching more
8142: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
1.114 jmcneill 8143: <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
8144: the inclusion.</p></li>
1.128 wiz 8145: <li class="listitem"><p>All installation operations have to be prefixed with
1.103 wiz 8146: <code class="filename">${DESTDIR}</code>.</p></li>
1.128 wiz 8147: <li class="listitem"><p>automake gets this DESTDIR mostly right
1.103 wiz 8148: automatically. Many manual rules and pre/post-install often are
8149: incorrect; fix them.</p></li>
1.128 wiz 8150: <li class="listitem"><p>If files are installed with special owner/group
1.118 imil 8151: use <code class="varname">SPECIAL_PERMS</code>.</p></li>
1.128 wiz 8152: <li class="listitem"><p>In general, packages should support
1.103 wiz 8153: <code class="varname">UNPRIVILEGED</code> to be able to use
8154: DESTDIR.</p></li>
8155: </ul></div>
8156: </div>
1.148 asau 8157: <div class="sect2">
1.103 wiz 8158: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8159: <a name="hardcoded-paths"></a>21.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
1.87 wiz 8160: <p>Your package may also contain scripts with hardcoded paths to
8161: other interpreters besides (or as well as) perl. To correct the
8162: full pathname to the script interpreter, you need to set the
8163: following definitions in your <code class="filename">Makefile</code> (we
1.110 hubertf 8164: shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
1.87 wiz 8165: <pre class="programlisting">
1.100 rillig 8166: REPLACE_INTERPRETER+= tcl
8167: REPLACE.tcl.old= .*/bin/tclsh
8168: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
8169: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
8170: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.222 sevan 8171: </pre>
1.148 asau 8172: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8173: <h3 class="title">Note</h3>
8174: <p>Before March 2006, these variables were called
1.87 wiz 8175: <code class="varname">_REPLACE.*</code> and
8176: <code class="varname">_REPLACE_FILES.*</code>.</p>
1.75 rillig 8177: </div>
8178: </div>
1.148 asau 8179: <div class="sect2">
1.75 rillig 8180: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8181: <a name="perl-modules"></a>21.6.6. Packages installing perl modules</h3></div></div></div>
1.75 rillig 8182: <p>Makefiles of packages providing perl5 modules should include
1.87 wiz 8183: the Makefile fragment
8184: <code class="filename">../../lang/perl5/module.mk</code>. It provides a
1.110 hubertf 8185: <span class="command"><strong>do-configure</strong></span> target for the standard perl
1.87 wiz 8186: configuration for such modules as well as various hooks to tune
8187: this configuration. See comments in this file for
8188: details.</p>
1.75 rillig 8189: <p>Perl5 modules will install into different places depending
1.87 wiz 8190: on the version of perl used during the build process. To
8191: address this, pkgsrc will append lines to the
8192: <code class="filename">PLIST</code> corresponding to the files listed in
8193: the installed <code class="filename">.packlist</code> file generated by
8194: most perl5 modules. This is invoked by defining
8195: <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
1.153 wiz 8196: packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
8197: (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
8198: e.g.:</p>
1.75 rillig 8199: <pre class="programlisting">
1.153 wiz 8200: PERL5_PACKLIST= auto/Pg/.packlist
1.222 sevan 8201: </pre>
1.153 wiz 8202: <p>The perl5 config variables
8203: <code class="varname">installarchlib</code>,
8204: <code class="varname">installscript</code>,
8205: <code class="varname">installvendorbin</code>,
8206: <code class="varname">installvendorscript</code>,
8207: <code class="varname">installvendorarch</code>,
8208: <code class="varname">installvendorlib</code>,
8209: <code class="varname">installvendorman1dir</code>, and
8210: <code class="varname">installvendorman3dir</code> represent those
8211: locations in which components of perl5 modules may be installed,
8212: provided as variable with uppercase and prefixed with
8213: <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
8214: and may be used by perl5 packages that don't have a packlist.
8215: These variables are also substituted for in the
8216: <code class="filename">PLIST</code> as uppercase prefixed with
8217: <code class="varname">PERL5_SUB_</code>.</p>
1.75 rillig 8218: </div>
1.148 asau 8219: <div class="sect2">
1.75 rillig 8220: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8221: <a name="faq.info-files"></a>21.6.7. Packages installing info files</h3></div></div></div>
1.75 rillig 8222: <p>Some packages install info files or use the
1.128 wiz 8223: <span class="quote">“<span class="quote">makeinfo</span>”</span> or <span class="quote">“<span class="quote">install-info</span>”</span>
1.87 wiz 8224: commands. <code class="varname">INFO_FILES</code> should be defined in
8225: the package Makefile so that <code class="filename">INSTALL</code> and
8226: <code class="filename">DEINSTALL</code> scripts will be generated to
8227: handle registration of the info files in the Info directory
1.128 wiz 8228: file. The <span class="quote">“<span class="quote">install-info</span>”</span> command used for the info
1.87 wiz 8229: files registration is either provided by the system, or by a
8230: special purpose package automatically added as dependency if
8231: needed.</p>
1.75 rillig 8232: <p><code class="varname">PKGINFODIR</code> is the directory under
1.87 wiz 8233: <code class="filename">${PREFIX}</code> where info files are primarily
8234: located. <code class="varname">PKGINFODIR</code> defaults to
1.128 wiz 8235: <span class="quote">“<span class="quote">info</span>”</span> and can be overridden by the user.</p>
1.75 rillig 8236: <p>The info files for the package should be listed in the
1.87 wiz 8237: package <code class="filename">PLIST</code>; however any split info files
8238: need not be listed.</p>
1.128 wiz 8239: <p>A package which needs the <span class="quote">“<span class="quote">makeinfo</span>”</span> command
8240: at build time must add <span class="quote">“<span class="quote">makeinfo</span>”</span> to
1.87 wiz 8241: <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
1.128 wiz 8242: version of the <span class="quote">“<span class="quote">makeinfo</span>”</span> command is needed it
1.87 wiz 8243: should be noted with the <code class="varname">TEXINFO_REQD</code>
8244: variable in the package <code class="filename">Makefile</code>. By
8245: default, a minimum version of 3.12 is required. If the system
1.110 hubertf 8246: does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
1.87 wiz 8247: does not match the required minimum, a build dependency on the
1.250 leot 8248: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/gtexinfo/README.html" target="_top"><code class="filename">devel/gtexinfo</code></a> package will
1.87 wiz 8249: be added automatically.</p>
1.75 rillig 8250: <p>The build and installation process of the software provided
1.87 wiz 8251: by the package should not use the
1.110 hubertf 8252: <span class="command"><strong>install-info</strong></span> command as the registration of
1.87 wiz 8253: info files is the task of the package
8254: <code class="filename">INSTALL</code> script, and it must use the
1.110 hubertf 8255: appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
1.75 rillig 8256: <p>To achieve this goal, the pkgsrc infrastructure creates
1.110 hubertf 8257: overriding scripts for the <span class="command"><strong>install-info</strong></span> and
8258: <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
1.87 wiz 8259: in <code class="varname">PATH</code>.</p>
1.110 hubertf 8260: <p>The script overriding <span class="command"><strong>install-info</strong></span> has
1.87 wiz 8261: no effect except the logging of a message. The script overriding
1.110 hubertf 8262: <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
1.87 wiz 8263: value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
1.110 hubertf 8264: <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
1.75 rillig 8265: </div>
1.148 asau 8266: <div class="sect2">
1.75 rillig 8267: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8268: <a name="manpages"></a>21.6.8. Packages installing man pages</h3></div></div></div>
1.81 rillig 8269: <p>All packages that install manual pages should install them
1.87 wiz 8270: into the same directory, so that there is one common place to look
8271: for them. In pkgsrc, this place is
8272: <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
8273: should be used in packages. The default for
8274: <code class="varname">PKGMANDIR</code> is
1.128 wiz 8275: <span class="quote">“<span class="quote"><code class="filename">man</code></span>”</span>. Another often-used value
8276: is <span class="quote">“<span class="quote"><code class="filename">share/man</code></span>”</span>.</p>
1.148 asau 8277: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8278: <h3 class="title">Note</h3>
1.87 wiz 8279: <p>The support for a custom <code class="varname">PKGMANDIR</code>
8280: is far from complete.</p>
1.75 rillig 8281: </div>
1.81 rillig 8282: <p>The <code class="filename">PLIST</code> files can just use
1.87 wiz 8283: <code class="filename">man/</code> as the top level directory for the man
8284: page file entries, and the pkgsrc framework will convert as
8285: needed. In all other places, the correct
8286: <code class="varname">PKGMANDIR</code> must be used.</p>
8287: <p>Packages that are
8288: configured with <code class="varname">GNU_CONFIGURE</code> set as
1.128 wiz 8289: <span class="quote">“<span class="quote">yes</span>”</span>, by default will use the
1.87 wiz 8290: <code class="filename">./configure</code>
8291: --mandir switch to set where the man pages should be installed.
8292: The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
8293: to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
8294: <p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
8295: use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
1.128 wiz 8296: to <span class="quote">“<span class="quote">no</span>”</span>.
1.87 wiz 8297: Or if the <code class="filename">./configure</code> script uses
8298: a non-standard use of --mandir, you can set
8299: <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
1.267 rillig 8300: <p>See <a class="xref" href="#manpage-compression" title="15.5. Man page compression">Section 15.5, “Man page compression”</a> for
1.87 wiz 8301: information on installation of compressed manual pages.</p>
1.75 rillig 8302: </div>
1.148 asau 8303: <div class="sect2">
1.75 rillig 8304: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8305: <a name="gconf-data-files"></a>21.6.9. Packages installing GConf data files</h3></div></div></div>
1.87 wiz 8306: <p>If a package installs <code class="filename">.schemas</code> or
1.107 rillig 8307: <code class="filename">.entries</code> files, used by GConf,
1.87 wiz 8308: you need to take some extra steps to make sure they get registered
8309: in the database:</p>
1.128 wiz 8310: <div class="orderedlist"><ol class="orderedlist" type="1">
8311: <li class="listitem"><p>Include <code class="filename">../../devel/GConf/schemas.mk</code>
1.87 wiz 8312: instead of its <code class="filename">buildlink3.mk</code> file. This
1.107 rillig 8313: takes care of rebuilding the GConf database at installation and
1.87 wiz 8314: deinstallation time, and tells the package where to install
1.107 rillig 8315: GConf data files using some standard configure arguments. It
1.87 wiz 8316: also disallows any access to the database directly from the
8317: package.</p></li>
1.128 wiz 8318: <li class="listitem"><p>Ensure that the package installs its
1.87 wiz 8319: <code class="filename">.schemas</code> files under
8320: <code class="filename">${PREFIX}/share/gconf/schemas</code>. If they get
8321: installed under <code class="filename">${PREFIX}/etc</code>, you will
8322: need to manually patch the package.</p></li>
1.128 wiz 8323: <li class="listitem"><p>Check the PLIST and remove any entries under the etc/gconf
1.87 wiz 8324: directory, as they will be handled automatically. See
1.267 rillig 8325: <a class="xref" href="#faq.conf" title="10.13. How do I change the location of configuration files?">Section 10.13, “How do I change the location of configuration files?”</a> for more information.</p></li>
1.128 wiz 8326: <li class="listitem"><p>Define the <code class="varname">GCONF_SCHEMAS</code> variable in
1.87 wiz 8327: your <code class="filename">Makefile</code> with a list of all
8328: <code class="filename">.schemas</code> files installed by the package, if
8329: any. Names must not contain any directories in them.</p></li>
1.128 wiz 8330: <li class="listitem"><p>Define the <code class="varname">GCONF_ENTRIES</code> variable in
1.87 wiz 8331: your <code class="filename">Makefile</code> with a
8332: list of all <code class="filename">.entries</code> files installed by the
8333: package, if any. Names must not contain any directories in
8334: them.</p></li>
1.75 rillig 8335: </ol></div>
8336: </div>
1.148 asau 8337: <div class="sect2">
1.75 rillig 8338: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8339: <a name="scrollkeeper-data-files"></a>21.6.10. Packages installing scrollkeeper/rarian data files</h3></div></div></div>
1.87 wiz 8340: <p>If a package installs <code class="filename">.omf</code> files, used by
1.119 mishka 8341: scrollkeeper/rarian, you need to take some extra steps to make sure they
1.87 wiz 8342: get registered in the database:</p>
1.128 wiz 8343: <div class="orderedlist"><ol class="orderedlist" type="1">
8344: <li class="listitem"><p>Include
1.119 mishka 8345: <code class="filename">../../mk/omf-scrollkeeper.mk</code>
8346: instead of rarian's <code class="filename">buildlink3.mk</code> file. This
1.87 wiz 8347: takes care of rebuilding the scrollkeeper database at
8348: installation and deinstallation time, and disallows any access
8349: to it directly from the package.</p></li>
1.128 wiz 8350: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87 wiz 8351: <code class="filename">libdata/scrollkeeper</code> directory, as they
8352: will be handled automatically.</p></li>
1.128 wiz 8353: <li class="listitem"><p>Remove the <code class="filename">share/omf</code> directory from
1.119 mishka 8354: the PLIST. It will be handled by rarian. (<span class="command"><strong>make
8355: print-PLIST</strong></span> does this automatically.)</p></li>
1.75 rillig 8356: </ol></div>
8357: </div>
1.148 asau 8358: <div class="sect2">
1.75 rillig 8359: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8360: <a name="x11-fonts"></a>21.6.11. Packages installing X11 fonts</h3></div></div></div>
1.75 rillig 8361: <p>If a package installs font files, you will need to rebuild
1.87 wiz 8362: the fonts database in the directory where they get installed at
8363: installation and deinstallation time. This can be automatically
8364: done by using the pkginstall framework.</p>
1.75 rillig 8365: <p>You can list the directories where fonts are installed in the
1.87 wiz 8366: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
8367: variables, where <em class="replaceable"><code>type</code></em> can be one of
1.128 wiz 8368: <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 8369: Also make sure that the database file
8370: <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
1.75 rillig 8371: <p>Note that you should not create new directories for fonts;
1.87 wiz 8372: instead use the standard ones to avoid that the user needs to
8373: manually configure his X server to find them.</p>
1.75 rillig 8374: </div>
1.148 asau 8375: <div class="sect2">
1.75 rillig 8376: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8377: <a name="gtk2-modules"></a>21.6.12. Packages installing GTK2 modules</h3></div></div></div>
1.75 rillig 8378: <p>If a package installs GTK2 immodules or loaders, you need to
1.87 wiz 8379: take some extra steps to get them registered in the GTK2 database
8380: properly:</p>
1.128 wiz 8381: <div class="orderedlist"><ol class="orderedlist" type="1">
8382: <li class="listitem"><p>Include
1.87 wiz 8383: <code class="filename">../../x11/gtk2/modules.mk</code> instead of its
8384: <code class="filename">buildlink3.mk</code> file. This takes care of
8385: rebuilding the database at installation and deinstallation time.</p></li>
1.128 wiz 8386: <li class="listitem"><p>Set <code class="varname">GTK2_IMMODULES=YES</code> if
1.87 wiz 8387: your package installs GTK2 immodules.</p></li>
1.128 wiz 8388: <li class="listitem"><p>Set <code class="varname">GTK2_LOADERS=YES</code> if your package installs
1.87 wiz 8389: GTK2 loaders.</p></li>
1.128 wiz 8390: <li class="listitem">
1.87 wiz 8391: <p>Patch the package to not touch any of the GTK2
8392: databases directly. These are:</p>
1.148 asau 8393: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8394: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p></li>
8395: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gtk.immodules</code></p></li>
1.75 rillig 8396: </ul></div>
8397: </li>
1.128 wiz 8398: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove
1.87 wiz 8399: any entries under the <code class="filename">libdata/gtk-2.0</code>
8400: directory, as they will be handled automatically.</p></li>
1.75 rillig 8401: </ol></div>
8402: </div>
1.148 asau 8403: <div class="sect2">
1.75 rillig 8404: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8405: <a name="sgml-xml-data"></a>21.6.13. Packages installing SGML or XML data</h3></div></div></div>
1.75 rillig 8406: <p>If a package installs SGML or XML data files that need to be
1.87 wiz 8407: registered in system-wide catalogs (like DTDs, sub-catalogs,
8408: etc.), you need to take some extra steps:</p>
1.128 wiz 8409: <div class="orderedlist"><ol class="orderedlist" type="1">
8410: <li class="listitem"><p>Include
1.87 wiz 8411: <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
8412: your <code class="filename">Makefile</code>, which takes care of
8413: registering those files in system-wide catalogs at
8414: installation and deinstallation time.</p></li>
1.128 wiz 8415: <li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
1.87 wiz 8416: any SGML catalogs installed by the package.</p></li>
1.128 wiz 8417: <li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
1.87 wiz 8418: any XML catalogs installed by the package.</p></li>
1.128 wiz 8419: <li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
1.87 wiz 8420: to be added to the SGML catalog. These come in groups of
8421: three strings; see xmlcatmgr(1) for more information
8422: (specifically, arguments recognized by the 'add' action).
8423: Note that you will normally not use this variable.</p></li>
1.128 wiz 8424: <li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
1.87 wiz 8425: to be added to the XML catalog. These come in groups of three
8426: strings; see xmlcatmgr(1) for more information (specifically,
8427: arguments recognized by the 'add' action). Note that you will
8428: normally not use this variable.</p></li>
1.75 rillig 8429: </ol></div>
8430: </div>
1.148 asau 8431: <div class="sect2">
1.75 rillig 8432: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8433: <a name="mime-database"></a>21.6.14. Packages installing extensions to the MIME database</h3></div></div></div>
1.75 rillig 8434: <p>If a package provides extensions to the MIME database by
1.87 wiz 8435: installing <code class="filename">.xml</code> files inside
8436: <code class="filename">${PREFIX}/share/mime/packages</code>, you
8437: need to take some extra steps to ensure that the database is kept
8438: consistent with respect to these new files:</p>
1.128 wiz 8439: <div class="orderedlist"><ol class="orderedlist" type="1">
8440: <li class="listitem"><p>Include
1.87 wiz 8441: <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
8442: (avoid using the <code class="filename">buildlink3.mk</code> file from
8443: this same directory, which is reserved for inclusion from
8444: other <code class="filename">buildlink3.mk</code> files). It takes
8445: care of rebuilding the MIME database at installation and
8446: deinstallation time, and disallows any access to it directly
8447: from the package.</p></li>
1.128 wiz 8448: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87 wiz 8449: <code class="filename">share/mime</code> directory,
8450: <span class="emphasis"><em>except</em></span> for files saved under
8451: <code class="filename">share/mime/packages</code>. The former are
8452: handled automatically by
8453: the update-mime-database program, but the latter are
8454: package-dependent and must be removed by the package that
8455: installed them in the first place.</p></li>
1.128 wiz 8456: <li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
1.87 wiz 8457: from the PLIST. They will be handled by the shared-mime-info
8458: package.</p></li>
1.75 rillig 8459: </ol></div>
8460: </div>
1.148 asau 8461: <div class="sect2">
1.75 rillig 8462: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8463: <a name="intltool"></a>21.6.15. Packages using intltool</h3></div></div></div>
1.93 rillig 8464: <p>If a package uses intltool during its build, add
8465: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
1.87 wiz 8466: which forces it to use the intltool package provided by pkgsrc,
8467: instead of the one bundled with the distribution file.</p>
1.75 rillig 8468: <p>This tracks intltool's build-time dependencies and uses the
1.87 wiz 8469: latest available version; this way, the package benefits of any
8470: bug fixes that may have appeared since it was released.</p>
1.75 rillig 8471: </div>
1.148 asau 8472: <div class="sect2">
1.75 rillig 8473: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8474: <a name="startup-scripts"></a>21.6.16. Packages installing startup scripts</h3></div></div></div>
1.75 rillig 8475: <p>If a package contains a rc.d script, it won't be copied into
1.87 wiz 8476: the startup directory by default, but you can enable it, by adding
8477: the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
1.110 hubertf 8478: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
1.87 wiz 8479: into <code class="filename">/etc/rc.d</code> when a package is installed, and
8480: it will automatically remove the scripts when the package is
8481: deinstalled.</p>
1.75 rillig 8482: </div>
1.148 asau 8483: <div class="sect2">
1.75 rillig 8484: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8485: <a name="tex-packages"></a>21.6.17. Packages installing TeX modules</h3></div></div></div>
1.75 rillig 8486: <p>If a package installs TeX packages into the texmf tree,
1.87 wiz 8487: the <code class="filename">ls-R</code> database of the tree needs to be
8488: updated.</p>
1.148 asau 8489: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8490: <h3 class="title">Note</h3>
1.125 wiz 8491: <p>Except the main TeX packages such as kpathsea,
1.87 wiz 8492: packages should install files
1.125 wiz 8493: into <code class="filename">${PREFIX}/share/texmf-dist</code>,
8494: not <code class="filename">${PREFIX}/share/texmf</code>.</p>
1.75 rillig 8495: </div>
1.128 wiz 8496: <div class="orderedlist"><ol class="orderedlist" type="1">
8497: <li class="listitem"><p>Include
1.125 wiz 8498: <code class="filename">../../print/kpathsea/texmf.mk</code>. This
1.87 wiz 8499: takes care of rebuilding the <code class="filename">ls-R</code>
8500: database at installation and deinstallation time.</p></li>
1.128 wiz 8501: <li class="listitem">
1.75 rillig 8502: <p>If your package installs files into a texmf
1.87 wiz 8503: tree other than the one
1.125 wiz 8504: at <code class="filename">${PREFIX}/share/texmf-dist</code>,
8505: set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
1.87 wiz 8506: trees that need database update.</p>
1.75 rillig 8507: <p>If your package also installs font map files that need
1.110 hubertf 8508: to be registered using <span class="command"><strong>updmap</strong></span>,
1.136 dholland 8509: include <code class="filename">../../print/tex-tetex/map.mk</code> and
1.125 wiz 8510: set <code class="varname">TEX_MAP_FILES</code> and/or
8511: <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
1.110 hubertf 8512: such font map files. Then <span class="command"><strong>updmap</strong></span> will
1.87 wiz 8513: be run automatically at installation/deinstallation to
8514: enable/disable font map files for TeX output
8515: drivers.</p>
1.75 rillig 8516: </li>
1.128 wiz 8517: <li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
1.87 wiz 8518: databases are included in <code class="filename">PLIST</code>, as
1.136 dholland 8519: they will be removed only by the kpathsea package.</p></li>
1.75 rillig 8520: </ol></div>
8521: </div>
1.148 asau 8522: <div class="sect2">
1.85 jmmv 8523: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8524: <a name="emulation-packages"></a>21.6.18. Packages supporting running binaries in
1.87 wiz 8525: emulation</h3></div></div></div>
8526: <p>There are some packages that provide libraries and
8527: executables for running binaries from a one operating system
8528: on a different one (if the latter supports it). One example
8529: is running Linux binaries on NetBSD.</p>
1.250 leot 8530: <p>The <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/rpm2pkg/README.html" target="_top"><code class="filename">pkgtools/rpm2pkg</code></a>
1.87 wiz 8531: helps in extracting and packaging Linux rpm packages.</p>
8532: <p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
1.110 hubertf 8533: avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
1.87 wiz 8534: if all libraries for each installed executable can be found by
8535: the dynamic linker. Since the standard dynamic linker is run,
8536: this fails for emulation packages, because the libraries used
8537: by the emulation are not in the standard directories.</p>
8538: </div>
1.148 asau 8539: <div class="sect2">
1.87 wiz 8540: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8541: <a name="hicolor-theme"></a>21.6.19. Packages installing hicolor theme icons</h3></div></div></div>
1.85 jmmv 8542: <p>If a package installs images under the
1.87 wiz 8543: <code class="filename">share/icons/hicolor</code> and/or updates the
8544: <code class="filename">share/icons/hicolor/icon-theme.cache</code>
8545: database, you need to take some extra steps to make sure that the
8546: shared theme directory is handled appropriately and that the cache
8547: database is rebuilt:</p>
1.128 wiz 8548: <div class="orderedlist"><ol class="orderedlist" type="1">
8549: <li class="listitem"><p>Include
1.87 wiz 8550: <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
1.128 wiz 8551: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
1.87 wiz 8552: entry that refers to the theme cache.</p></li>
1.128 wiz 8553: <li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
1.85 jmmv 8554: directories from the <code class="filename">share/icons/hicolor</code>
8555: hierarchy because they will be handled automatically.</p></li>
8556: </ol></div>
8557: <p>The best way to verify that the PLIST is correct with
8558: respect to the last two points is to regenerate it using
1.110 hubertf 8559: <span class="command"><strong>make print-PLIST</strong></span>.</p>
1.85 jmmv 8560: </div>
1.148 asau 8561: <div class="sect2">
1.85 jmmv 8562: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8563: <a name="desktop-files"></a>21.6.20. Packages installing desktop files</h3></div></div></div>
1.85 jmmv 8564: <p>If a package installs <code class="filename">.desktop</code> files
8565: under <code class="filename">share/applications</code> and these include
1.159 rodent 8566: MIME information (MimeType key), you need to take extra steps to
8567: ensure that they are registered into the MIME database:</p>
1.128 wiz 8568: <div class="orderedlist"><ol class="orderedlist" type="1">
8569: <li class="listitem"><p>Include
1.85 jmmv 8570: <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
1.128 wiz 8571: <li class="listitem"><p>Check the PLIST and remove the entry that refers to the
1.85 jmmv 8572: <code class="filename">share/applications/mimeinfo.cache</code> file.
8573: It will be handled automatically.</p></li>
8574: </ol></div>
8575: <p>The best way to verify that the PLIST is correct with
1.110 hubertf 8576: respect to the last point is to regenerate it using <span class="command"><strong>make
1.85 jmmv 8577: print-PLIST</strong></span>.</p>
1.75 rillig 8578: </div>
8579: </div>
1.148 asau 8580: <div class="sect1">
1.87 wiz 8581: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8582: <a name="punting"></a>21.7. Marking packages as having problems</h2></div></div></div>
1.87 wiz 8583: <p>In some cases one does not have the time to solve a problem
1.125 wiz 8584: immediately. In this case, one can plainly mark a package as broken. For
8585: this, one just sets the variable <code class="varname">BROKEN</code> to the
8586: reason why the package is broken (similar to the
8587: <code class="varname">RESTRICTED</code> variable). A user trying to build
8588: the package will immediately be shown this message, and the build
8589: will not be even tried.</p>
8590: <p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
1.87 wiz 8591: intervals.</p>
8592: </div>
1.75 rillig 8593: </div>
1.148 asau 8594: <div class="chapter">
1.75 rillig 8595: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 8596: <a name="debug"></a>Chapter 22. Debugging</h2></div></div></div>
1.88 wiz 8597: <p>To check out all the gotchas when building a package, here are
8598: the steps that I do in order to get a package working. Please note
8599: this is basically the same as what was explained in the previous
8600: sections, only with some debugging aids.</p>
1.148 asau 8601: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8602: <li class="listitem"><p>Be sure to set <code class="varname">PKG_DEVELOPER=yes</code> in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></li>
8603: <li class="listitem">
1.250 leot 8604: <p>Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>,
1.88 wiz 8605: create a directory for a new package, change into it, then run
1.110 hubertf 8606: <span class="command"><strong>url2pkg</strong></span>:</p>
1.75 rillig 8607: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>mkdir /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
8608: <code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
8609: <code class="prompt">%</code> <strong class="userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong></pre>
8610: </li>
1.128 wiz 8611: <li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
8612: <li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li>
8613: <li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li>
8614: <li class="listitem"><p>Add any dependencies glimpsed from documentation and the
1.88 wiz 8615: configure step to the package's
8616: <code class="filename">Makefile</code>.</p></li>
1.128 wiz 8617: <li class="listitem">
1.75 rillig 8618: <p>Make the package compile, doing multiple rounds of</p>
8619: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
8620: <code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
8621: <code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong>
8622: <code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong>
8623: <code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
8624: <code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong>
8625: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre>
1.88 wiz 8626: <p>Doing this step as non-root user will ensure that no files
8627: are modified that shouldn't be, especially during the build
1.110 hubertf 8628: phase. <span class="command"><strong>mkpatches</strong></span>,
8629: <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are
1.250 leot 8630: from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>
1.88 wiz 8631: package.</p>
1.75 rillig 8632: </li>
1.128 wiz 8633: <li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if
1.267 rillig 8634: necessary; see <a class="xref" href="#components.Makefile" title="13.1. Makefile">Section 13.1, “<code class="filename">Makefile</code>”</a>.</p></li>
1.128 wiz 8635: <li class="listitem">
1.76 rillig 8636: <p>Generate a <code class="filename">PLIST</code>:</p>
1.75 rillig 8637: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
8638: <code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST >PLIST</code></strong>
8639: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong>
8640: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
8641: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre>
1.88 wiz 8642: <p>You usually need to be <code class="username">root</code> to do
8643: this. Look if there are any files left:</p>
1.75 rillig 8644: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
8645: <p>If this reveals any files that are missing in
1.88 wiz 8646: <code class="filename">PLIST</code>, add them.</p>
1.75 rillig 8647: </li>
1.128 wiz 8648: <li class="listitem">
1.88 wiz 8649: <p>Now that the <code class="filename">PLIST</code> is OK, install the
8650: package again and make a binary package:</p>
1.75 rillig 8651: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong>
8652: <code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre>
8653: </li>
1.128 wiz 8654: <li class="listitem">
1.75 rillig 8655: <p>Delete the installed package:</p>
1.88 wiz 8656: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_delete <em class="replaceable"><code>examplepkg</code></em></code></strong></pre>
1.75 rillig 8657: </li>
1.128 wiz 8658: <li class="listitem">
1.110 hubertf 8659: <p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span>
1.88 wiz 8660: command, which shouldn't find anything now:</p>
1.75 rillig 8661: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
8662: </li>
1.128 wiz 8663: <li class="listitem">
1.75 rillig 8664: <p>Reinstall the binary package:</p>
1.93 rillig 8665: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add .../<em class="replaceable"><code>examplepkg</code></em>.tgz</code></strong></pre>
1.75 rillig 8666: </li>
1.128 wiz 8667: <li class="listitem"><p>Play with it. Make sure everything works.</p></li>
8668: <li class="listitem">
1.250 leot 8669: <p>Run <span class="command"><strong>pkglint</strong></span> from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>, and fix the problems it
1.88 wiz 8670: reports:</p>
1.75 rillig 8671: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
8672: </li>
1.267 rillig 8673: <li class="listitem"><p>Submit (or commit, if you have cvs access); see <a class="xref" href="#submit" title="Chapter 23. Submitting and Committing">Chapter 23, <i>Submitting and Committing</i></a>.</p></li>
1.75 rillig 8674: </ul></div>
8675: </div>
1.148 asau 8676: <div class="chapter">
1.75 rillig 8677: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 8678: <a name="submit"></a>Chapter 23. Submitting and Committing</h2></div></div></div>
1.75 rillig 8679: <div class="toc">
8680: <p><b>Table of Contents</b></p>
1.210 leot 8681: <dl class="toc">
1.267 rillig 8682: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
8683: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
8684: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
8685: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
8686: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
8687: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
8688: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
8689: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
1.75 rillig 8690: </dl>
8691: </div>
1.148 asau 8692: <div class="sect1">
1.75 rillig 8693: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8694: <a name="submitting-binary-packages"></a>23.1. Submitting binary packages</h2></div></div></div>
1.75 rillig 8695: <p>Our policy is that we accept binaries only from pkgsrc
8696: developers to guarantee that the packages don't contain any
8697: trojan horses etc. This is not to annoy anyone but rather to
8698: protect our users! You're still free to put up your home-made
8699: binary packages and tell the world where to get them. NetBSD
8700: developers doing bulk builds and wanting to upload them please
1.267 rillig 8701: 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 8702: builds)</i></a>.</p>
1.75 rillig 8703: </div>
1.148 asau 8704: <div class="sect1">
1.75 rillig 8705: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8706: <a name="submitting-your-package"></a>23.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
1.75 rillig 8707: <p>First, check that your package is complete, compiles and
1.267 rillig 8708: runs well; see <a class="xref" href="#debug" title="Chapter 22. Debugging">Chapter 22, <i>Debugging</i></a> and the rest of this
1.270 ! leot 8709: document. Next, generate an uuencoded gzipped <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a>
1.82 rillig 8710: archive that contains all files that make up the package.
1.87 wiz 8711: Finally, send this package to the pkgsrc bug tracking system,
1.270 ! leot 8712: either with the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> command, or if you don't have
1.87 wiz 8713: that, go to the web page
1.110 hubertf 8714: <a class="ulink" href="http://www.NetBSD.org/support/send-pr.html" target="_top">http://www.NetBSD.org/support/send-pr.html</a>,
1.124 snj 8715: which contains some instructions and a link to a form where you
8716: can submit packages. The
1.250 leot 8717: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/gtk-send-pr/README.html" target="_top"><code class="filename">sysutils/gtk-send-pr</code></a> package is
1.124 snj 8718: also available as a substitute for either of the above two tools.
8719: </p>
1.87 wiz 8720: <p>In the form of the problem report, the category should be
1.128 wiz 8721: <span class="quote">“<span class="quote">pkg</span>”</span>, the synopsis should include the package name
1.87 wiz 8722: and version number, and the description field should contain a
8723: short description of your package (contents of the COMMENT
8724: variable or DESCR file are OK). The uuencoded package data should
1.128 wiz 8725: go into the <span class="quote">“<span class="quote">fix</span>”</span> field.</p>
1.75 rillig 8726: <p>If you want to submit several packages, please send a
8727: separate PR for each one, it's easier for us to track things
8728: that way.</p>
8729: <p>Alternatively, you can also import new packages into
1.128 wiz 8730: pkgsrc-wip (<span class="quote">“<span class="quote">pkgsrc work-in-progress</span>”</span>); see the
1.215 wiz 8731: homepage at <a class="ulink" href="http://pkgsrc.org/wip/" target="_top">http://pkgsrc.org/wip/</a>
1.75 rillig 8732: for details.</p>
8733: </div>
1.148 asau 8734: <div class="sect1">
1.75 rillig 8735: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8736: <a name="general-notes-for-changes"></a>23.3. General notes when adding, updating, or removing packages</h2></div></div></div>
1.75 rillig 8737: <p>Please note all package additions, updates, moves, and
1.93 rillig 8738: removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
1.75 rillig 8739: important to keep this file up to date and conforming to the
8740: existing format, because it will be used by scripts to
1.110 hubertf 8741: automatically update pages on <a class="ulink" href="http://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
1.75 rillig 8742: sites. Additionally, check the
1.76 rillig 8743: <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
1.75 rillig 8744: for the package you updated or removed, in case it was mentioned
8745: there.</p>
8746: <p>When the <code class="varname">PKGREVISION</code> of a package is
8747: bumped, the change should appear in
1.93 rillig 8748: <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
1.75 rillig 8749: related or otherwise relevant. Mass bumps that result from a
8750: dependency being updated should not be mentioned. In all other
8751: cases it's the developer's decision.</p>
8752: <p>There is a make target that helps in creating proper
1.110 hubertf 8753: <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries: <span class="command"><strong>make
1.75 rillig 8754: changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
8755: and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
1.93 rillig 8756: usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
1.75 rillig 8757: file is up-to-date (to avoid having to resolve conflicts later-on)
1.110 hubertf 8758: and then to <span class="command"><strong>cd</strong></span> to the package directory. For
8759: package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
1.75 rillig 8760: For new packages, or package moves or removals, set the
8761: <code class="varname">CTYPE</code> variable on the command line to "Added",
8762: "Moved", or "Removed". You can set <code class="varname">NETBSD_LOGIN_NAME</code>
1.110 hubertf 8763: in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
1.125 wiz 8764: not the same as your NetBSD login name. The target also automatically
8765: removes possibly existing entries for the package in the
8766: <code class="filename">TODO</code> file. Don't forget to commit
1.174 asau 8767: the changes, e.g. by using <span class="command"><strong>make commit-changes-entry</strong></span>!
1.126 jakllsch 8768: If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
1.125 wiz 8769: a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
8770: makes the cvs commands use the main repository.
8771: </p>
1.75 rillig 8772: </div>
1.148 asau 8773: <div class="sect1">
1.75 rillig 8774: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8775: <a name="commit-messages"></a>23.4. Commit Messages</h2></div></div></div>
1.243 wiz 8776: <p>For several years, there have been mirrors of pkgsrc in
8777: fossil, git, and hg. Standard practise when using these tools is to
8778: make the first line of a commit message function as a summary that
8779: can be read without the rest, such as is commonly done with "git log
8780: --oneline". For this reason, we have the following guidelines for
8781: pkgsrc commit messages:</p>
8782: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8783: <li class="listitem"><p>Start the commit message with a line that explains the
1.244 wiz 8784: big picture in 65 characters or less. When a commit is for one
1.243 wiz 8785: package, include the name of the package. For updates, include the
8786: version to which it is updated.</p></li>
8787: <li class="listitem"><p>Leave the next line empty.</p></li>
8788: <li class="listitem"><p>Then come the details for the commit (changes in that
8789: package, reason for a change) and any relevant PRs. Wrap this
8790: section.</p></li>
8791: </ul></div>
8792: <p>Here is an example:
8793: </p>
8794: <pre class="programlisting">
8795: libxslt: update to 1.0.30
8796:
8797: Changes since 1.0.29:
8798: ...
8799: </pre>
8800: <p>
8801: </p>
8802: <p>Here is another example:
8803: </p>
8804: <pre class="programlisting">
8805: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8806:
8807: (rationale)
8808: </pre>
8809: <p>
8810: </p>
8811: <p>Commit messages are final: no <span class="quote">“<span class="quote">cvs admin</span>”</span> is
8812: allowed on the pkgsrc repository to change commit messages.</p>
8813: </div>
8814: <div class="sect1">
8815: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8816: <a name="committing-importing"></a>23.5. Committing: Adding a package to CVS</h2></div></div></div>
1.87 wiz 8817: <p>This section is only of interest for pkgsrc developers with write
1.140 wiz 8818: access to the pkgsrc repository.</p>
8819: <p>When the package is finished, <span class="quote">“<span class="quote">cvs add</span>”</span> the files.
8820: Start by adding the directory and then files in the directory. Don't
8821: forget to add the new package to the category's
8822: <code class="filename">Makefile</code>. Make sure you don't forget any files;
8823: you can check by running <span class="quote">“<span class="quote">cvs status</span>”</span>. An example:</p>
8824: <pre class="programlisting">
8825: <code class="prompt">$</code> cd .../pkgsrc/category
8826: <code class="prompt">$</code> cvs add pkgname
8827: <code class="prompt">$</code> cd pkgname
8828: <code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8829: <code class="prompt">$</code> cvs add patches/p*
8830: <code class="prompt">$</code> cvs status | less
1.141 wiz 8831: <code class="prompt">$</code> cvs commit
1.140 wiz 8832: <code class="prompt">$</code> cd ..
8833: <code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line
1.141 wiz 8834: <code class="prompt">$</code> cvs commit Makefile
1.174 asau 8835: <code class="prompt">$</code> cd pkgname
1.182 jnemeth 8836: <code class="prompt">$</code> make CTYPE=Added commit-changes-entry
1.140 wiz 8837: </pre>
1.87 wiz 8838: <p>The commit message of the initial import should include part of the
1.76 rillig 8839: <code class="filename">DESCR</code> file, so people reading the mailing lists know
1.87 wiz 8840: what the package is/does.</p>
1.140 wiz 8841: <p>Also mention the new package in
8842: <code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
8843: <p>Previously, <span class="quote">“<span class="quote">cvs import</span>”</span> was suggested, but it was
8844: much easier to get wrong than <span class="quote">“<span class="quote">cvs add</span>”</span>.</p>
1.75 rillig 8845: </div>
1.148 asau 8846: <div class="sect1">
1.75 rillig 8847: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8848: <a name="updating-package"></a>23.6. Updating a package to a newer version</h2></div></div></div>
1.87 wiz 8849: <p>Please always put a concise, appropriate and relevant summary of the
1.75 rillig 8850: changes between old and new versions into the commit log when updating
1.87 wiz 8851: a package. There are various reasons for this:</p>
1.148 asau 8852: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8853: <li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
1.87 wiz 8854: or its information may be overwritten by newer information.</p></li>
1.128 wiz 8855: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.87 wiz 8856: repository is very useful for people who use either cvs or anoncvs.</p></li>
1.128 wiz 8857: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.75 rillig 8858: repository is very useful for people who read the pkgsrc-changes mailing
8859: list, so that they can make tactical decisions about when to upgrade
1.87 wiz 8860: the package.</p></li>
1.75 rillig 8861: </ul></div>
1.87 wiz 8862: <p>Please also recognize that, just because a new version of a package
1.75 rillig 8863: has been released, it should not automatically be upgraded in the CVS
8864: repository. We prefer to be conservative in the packages that are
8865: included in pkgsrc - development or beta packages are not really the
8866: best thing for most places in which pkgsrc is used. Please use your
8867: judgement about what should go into pkgsrc, and bear in mind that
1.87 wiz 8868: stability is to be preferred above new and possibly untested features.</p>
1.75 rillig 8869: </div>
1.148 asau 8870: <div class="sect1">
1.75 rillig 8871: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8872: <a name="renaming-package"></a>23.7. Renaming a package in pkgsrc</h2></div></div></div>
1.122 reed 8873: <p>Renaming packages is not recommended.</p>
8874: <p>When renaming packages, be sure to fix any references to old name
8875: in other Makefiles, options, buildlink files, etc.</p>
8876: <p>Also When renaming a package, please define
8877: <code class="varname">SUPERSEDES</code> to the package name and dewey version
8878: pattern(s) of the previous package name.
8879: This may be repeated for multiple renames.
8880: The new package would be an exact replacement.
8881: </p>
1.128 wiz 8882: <p>Note that <span class="quote">“<span class="quote">successor</span>”</span> in the
1.122 reed 8883: CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
8884: mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
8885: not be an exact replacement but is a suggestion for the replaced
8886: functionality.</p>
8887: </div>
1.148 asau 8888: <div class="sect1">
1.122 reed 8889: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8890: <a name="moving-package"></a>23.8. Moving a package in pkgsrc</h2></div></div></div>
1.122 reed 8891: <p>It is preferred that packages are not renamed or moved, but if needed
8892: please follow these steps.
8893: </p>
1.128 wiz 8894: <div class="orderedlist"><ol class="orderedlist" type="1">
8895: <li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
8896: <li class="listitem">
1.75 rillig 8897: <p>Remove all CVS dirs.</p>
1.87 wiz 8898: <p>Alternatively to the first two steps you can also do:</p>
1.75 rillig 8899: <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 8900: <p>and use that for further work.</p>
1.75 rillig 8901: </li>
1.128 wiz 8902: <li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
8903: <code class="varname">DEPENDS</code> paths that just did <span class="quote">“<span class="quote">../package</span>”</span>
8904: instead of <span class="quote">“<span class="quote">../../category/package</span>”</span>.</p></li>
8905: <li class="listitem"><p>In the modified package's Makefile, consider setting
1.122 reed 8906: <code class="varname">PREV_PKGPATH</code> to the previous category/package
8907: pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools
8908: for doing an update using pkgsrc building; for example, it can
1.270 ! leot 8909: search the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code>
1.122 reed 8910: (if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
8911: new <code class="varname">PKGPATH</code> for that moved package. Note that
8912: it may have multiple matches, so the tool should also check on the
8913: <code class="varname">PKGBASE</code> too. The <code class="varname">PREV_PKGPATH</code>
8914: probably has no value unless <code class="varname">SUPERSEDES</code> is not
8915: set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li>
1.128 wiz 8916: <li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new
1.75 rillig 8917: place.</p></li>
1.128 wiz 8918: <li class="listitem">
1.75 rillig 8919: <p>Check if any package depends on it:
8920: </p>
8921: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
8922: <code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
8923: </li>
1.128 wiz 8924: <li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
8925: <li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
8926: <li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
8927: <li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
8928: <li class="listitem">
1.75 rillig 8929: <p>Commit the changed and removed files:</p>
8930: <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 8931: <p>(and any packages from step 5, of course).</p>
1.75 rillig 8932: </li>
8933: </ol></div>
8934: </div>
8935: </div>
1.148 asau 8936: <div class="chapter">
1.75 rillig 8937: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 8938: <a name="devfaq"></a>Chapter 24. Frequently Asked Questions</h2></div></div></div>
1.75 rillig 8939: <p>This section contains the answers to questions that may
8940: arise when you are writing a package. If you don't find your
8941: question answered here, first have a look in the other chapters,
8942: and if you still don't have the answer, ask on the
8943: <code class="literal">pkgsrc-users</code> mailing list.</p>
1.148 asau 8944: <div class="qandaset">
1.270 ! leot 8945: <a name="idm74633904"></a><dl>
1.267 rillig 8946: <dt>24.1. <a href="#devfaq.makeflags">What is the difference between
1.75 rillig 8947: MAKEFLAGS, .MAKEFLAGS and
8948: MAKE_FLAGS?</a>
8949: </dt>
1.267 rillig 8950: <dt>24.2. <a href="#devfaq.make">What is the difference between
1.75 rillig 8951: MAKE, GMAKE and
8952: MAKE_PROGRAM?</a>
8953: </dt>
1.267 rillig 8954: <dt>24.3. <a href="#devfaq.cc">What is the difference between
1.75 rillig 8955: CC, PKG_CC and
8956: PKGSRC_COMPILER?</a>
8957: </dt>
1.267 rillig 8958: <dt>24.4. <a href="#devfaq.bl3flags">What is the difference between
1.75 rillig 8959: BUILDLINK_LDFLAGS,
8960: BUILDLINK_LDADD and
8961: BUILDLINK_LIBS?</a>
8962: </dt>
1.267 rillig 8963: <dt>24.5. <a href="#devfaq.bl3prefix">Why does make show-var
1.75 rillig 8964: VARNAME=BUILDLINK_PREFIX.foo
8965: say it's empty?</a>
8966: </dt>
1.267 rillig 8967: <dt>24.6. <a href="#devfaq.master_sites">What does
1.78 rillig 8968: ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
8969: don't understand the := inside
8970: it.</a>
8971: </dt>
1.267 rillig 8972: <dt>24.7. <a href="#devfaq.mailinglists">Which mailing lists are there for package
1.78 rillig 8973: developers?</a>
8974: </dt>
1.267 rillig 8975: <dt>24.8. <a href="#devfaq.documentation">Where is the pkgsrc
1.80 rillig 8976: documentation?</a>
8977: </dt>
1.267 rillig 8978: <dt>24.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I
1.92 rillig 8979: do?</a>
8980: </dt>
1.75 rillig 8981: </dl>
1.148 asau 8982: <table border="0" style="width: 100%;">
8983: <colgroup>
1.75 rillig 8984: <col align="left" width="1%">
1.128 wiz 8985: <col>
1.148 asau 8986: </colgroup>
1.75 rillig 8987: <tbody>
1.148 asau 8988: <tr class="question">
1.75 rillig 8989: <td align="left" valign="top">
1.270 ! leot 8990: <a name="devfaq.makeflags"></a><a name="idm74633520"></a><p><b>24.1.</b></p>
1.75 rillig 8991: </td>
8992: <td align="left" valign="top"><p>What is the difference between
8993: <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
8994: <code class="varname">MAKE_FLAGS</code>?</p></td>
8995: </tr>
8996: <tr class="answer">
1.91 rillig 8997: <td align="left" valign="top"></td>
1.75 rillig 8998: <td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed
1.270 ! leot 8999: to the pkgsrc-internal invocations of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, while
1.75 rillig 9000: <code class="varname">MAKE_FLAGS</code> are the flags that are passed to
9001: the <code class="varname">MAKE_PROGRAM</code> when building the
9002: package. [FIXME: What is .MAKEFLAGS for?]</p></td>
9003: </tr>
1.148 asau 9004: <tr class="question">
1.75 rillig 9005: <td align="left" valign="top">
1.270 ! leot 9006: <a name="devfaq.make"></a><a name="idm74637744"></a><p><b>24.2.</b></p>
1.75 rillig 9007: </td>
9008: <td align="left" valign="top"><p>What is the difference between
9009: <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
9010: <code class="varname">MAKE_PROGRAM</code>?</p></td>
9011: </tr>
9012: <tr class="answer">
1.91 rillig 9013: <td align="left" valign="top"></td>
1.75 rillig 9014: <td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the
1.270 ! leot 9015: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc
1.75 rillig 9016: infrastructure. <code class="varname">GMAKE</code> is the path to GNU
9017: Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to
9018: use that. <code class="varname">MAKE_PROGRAM</code> is the path to the
9019: Make program that is used for building the
9020: package.</p></td>
9021: </tr>
1.148 asau 9022: <tr class="question">
1.75 rillig 9023: <td align="left" valign="top">
1.270 ! leot 9024: <a name="devfaq.cc"></a><a name="idm73302192"></a><p><b>24.3.</b></p>
1.75 rillig 9025: </td>
9026: <td align="left" valign="top"><p>What is the difference between
9027: <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
9028: <code class="varname">PKGSRC_COMPILER</code>?</p></td>
9029: </tr>
9030: <tr class="answer">
1.91 rillig 9031: <td align="left" valign="top"></td>
1.75 rillig 9032: <td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C
9033: compiler, which can be configured by the pkgsrc user.
9034: <code class="varname">PKG_CC</code> is the path to the compiler wrapper.
9035: <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a
9036: path to a compiler, but the type of compiler that should be
1.76 rillig 9037: used. See <code class="filename">mk/compiler.mk</code> for more
1.75 rillig 9038: information about the latter variable.</p></td>
9039: </tr>
1.148 asau 9040: <tr class="question">
1.75 rillig 9041: <td align="left" valign="top">
1.270 ! leot 9042: <a name="devfaq.bl3flags"></a><a name="idm73298096"></a><p><b>24.4.</b></p>
1.75 rillig 9043: </td>
9044: <td align="left" valign="top"><p>What is the difference between
9045: <code class="varname">BUILDLINK_LDFLAGS</code>,
9046: <code class="varname">BUILDLINK_LDADD</code> and
9047: <code class="varname">BUILDLINK_LIBS</code>?</p></td>
9048: </tr>
9049: <tr class="answer">
1.91 rillig 9050: <td align="left" valign="top"></td>
1.75 rillig 9051: <td align="left" valign="top"><p>[FIXME]</p></td>
9052: </tr>
1.148 asau 9053: <tr class="question">
1.75 rillig 9054: <td align="left" valign="top">
1.270 ! leot 9055: <a name="devfaq.bl3prefix"></a><a name="idm73295920"></a><p><b>24.5.</b></p>
1.75 rillig 9056: </td>
1.110 hubertf 9057: <td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
1.75 rillig 9058: VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
9059: say it's empty?</p></td>
9060: </tr>
9061: <tr class="answer">
1.91 rillig 9062: <td align="left" valign="top"></td>
1.75 rillig 9063: <td align="left" valign="top"><p>For optimization reasons, some variables are only
1.128 wiz 9064: available in the <span class="quote">“<span class="quote">wrapper</span>”</span> phase and later. To
9065: <span class="quote">“<span class="quote">simulate</span>”</span> the wrapper phase, append
1.110 hubertf 9066: <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
1.75 rillig 9067: command.</p></td>
9068: </tr>
1.148 asau 9069: <tr class="question">
1.78 rillig 9070: <td align="left" valign="top">
1.270 ! leot 9071: <a name="devfaq.master_sites"></a><a name="idm74648624"></a><p><b>24.6.</b></p>
1.78 rillig 9072: </td>
9073: <td align="left" valign="top"><p>What does
1.220 wiz 9074: <code class="code">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
9075: don't understand the <code class="code">:=</code> inside
1.78 rillig 9076: it.</p></td>
9077: </tr>
9078: <tr class="answer">
1.91 rillig 9079: <td align="left" valign="top"></td>
1.220 wiz 9080: <td align="left" valign="top"><p>The <code class="code">:=</code> is not really an
9081: assignment operator, although it looks like it.
1.78 rillig 9082: Instead, it is a degenerate form of
1.220 wiz 9083: <code class="code">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
1.270 ! leot 9084: which is documented in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which is
1.220 wiz 9085: commonly used in the form <code class="code">${SRCS:.c=.o}</code>. In the
1.78 rillig 9086: case of <code class="varname">MASTER_SITE_*</code>,
9087: <em class="replaceable"><code>old_string</code></em> is the empty string and
9088: <em class="replaceable"><code>new_string</code></em> is
1.220 wiz 9089: <code class="code">package/</code>. That's where the
9090: <code class="code">:</code> and the <code class="code">=</code> fall
1.78 rillig 9091: together.</p></td>
9092: </tr>
1.148 asau 9093: <tr class="question">
1.78 rillig 9094: <td align="left" valign="top">
1.270 ! leot 9095: <a name="devfaq.mailinglists"></a><a name="idm74650032"></a><p><b>24.7.</b></p>
1.78 rillig 9096: </td>
9097: <td align="left" valign="top"><p>Which mailing lists are there for package
9098: developers?</p></td>
9099: </tr>
9100: <tr class="answer">
1.91 rillig 9101: <td align="left" valign="top"></td>
1.148 asau 9102: <td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
1.110 hubertf 9103: <dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt>
1.78 rillig 9104: <dd><p>This is a list for technical discussions related
9105: to pkgsrc development, e.g. soliciting feedback for changes to
9106: pkgsrc infrastructure, proposed new features, questions related
9107: to porting pkgsrc to a new platform, advice for maintaining a
9108: package, patches that affect many packages, help requests moved
9109: from pkgsrc-users when an infrastructure bug is found,
9110: etc.</p></dd>
1.110 hubertf 9111: <dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt>
1.78 rillig 9112: <dd><p>All bug reports in category "pkg" sent with
1.270 ! leot 9113: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-8.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 9114: directly; use one of the other mailing
9115: lists.</p></dd>
9116: </dl></div></td>
9117: </tr>
1.148 asau 9118: <tr class="question">
1.80 rillig 9119: <td align="left" valign="top">
1.270 ! leot 9120: <a name="devfaq.documentation"></a><a name="idm74654512"></a><p><b>24.8.</b></p>
1.80 rillig 9121: </td>
9122: <td align="left" valign="top"><p>Where is the pkgsrc
9123: documentation?</p></td>
9124: </tr>
9125: <tr class="answer">
1.91 rillig 9126: <td align="left" valign="top"></td>
1.80 rillig 9127: <td align="left" valign="top">
9128: <p>There are many places where you can find
9129: documentation about pkgsrc:</p>
1.148 asau 9130: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9131: <li class="listitem"><p>The pkgsrc guide (this document) is a collection
1.80 rillig 9132: of chapters that explain large parts of pkgsrc, but some
9133: chapters tend to be outdated. Which ones they are is hard to
9134: say.</p></li>
1.128 wiz 9135: <li class="listitem"><p>On the mailing list archives (see <a class="ulink" href="http://mail-index.NetBSD.org/" target="_top">http://mail-index.NetBSD.org/</a>), you can find discussions
1.80 rillig 9136: about certain features, announcements of new parts of the pkgsrc
9137: infrastructure and sometimes even announcements that a certain
9138: feature has been marked as obsolete. The benefit here is that
9139: each message has a date appended to it.</p></li>
1.128 wiz 9140: <li class="listitem"><p>Many of the files in the
1.80 rillig 9141: <code class="filename">mk/</code> directory start with a comment that
9142: describes the purpose of the file and how it can be used by the
1.92 rillig 9143: pkgsrc user and package authors. An easy way to find this
1.110 hubertf 9144: documentation is to run <span class="command"><strong>bmake
1.92 rillig 9145: help</strong></span>.</p></li>
1.128 wiz 9146: <li class="listitem"><p>The CVS log messages are a rich source of
1.80 rillig 9147: information, but they tend to be highly abbreviated, especially
9148: for actions that occur often. Some contain a detailed
9149: description of what has changed, but they are geared towards the
9150: other pkgsrc developers, not towards an average pkgsrc user.
9151: They also only document <span class="emphasis"><em>changes</em></span>, so if you
9152: don't know what has been before, these messages may not be worth
9153: too much to you.</p></li>
1.128 wiz 9154: <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">“<span class="quote">implicitly
9155: documented</span>”</span>, that is the documentation exists only in the
1.80 rillig 9156: mind of the developer who wrote the code. To get this
1.110 hubertf 9157: information, use the <span class="command"><strong>cvs annotate</strong></span> command
1.80 rillig 9158: to see who has written it and ask on the
9159: <code class="literal">tech-pkg</code> mailing list, so that others can
9160: find your questions later (see above). To be sure that the
9161: developer in charge reads the mail, you may CC him or
9162: her.</p></li>
9163: </ul></div>
9164: </td>
9165: </tr>
1.148 asau 9166: <tr class="question">
1.92 rillig 9167: <td align="left" valign="top">
1.270 ! leot 9168: <a name="devfaq.too-much-time"></a><a name="idm74664496"></a><p><b>24.9.</b></p>
1.92 rillig 9169: </td>
9170: <td align="left" valign="top"><p>I have a little time to kill. What shall I
9171: do?</p></td>
9172: </tr>
9173: <tr class="answer">
9174: <td align="left" valign="top"></td>
9175: <td align="left" valign="top">
1.93 rillig 9176: <p>This is not really an FAQ yet, but here's the answer
1.92 rillig 9177: anyway.</p>
1.148 asau 9178: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9179: <li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
1.250 leot 9180: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a> package). It
1.92 rillig 9181: will tell you about newer versions of installed packages that are
9182: available, but not yet updated in pkgsrc.</p></li>
1.128 wiz 9183: <li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
1.126 jakllsch 9184: — it contains a list of suggested new packages and a list of
1.92 rillig 9185: cleanups and enhancements for pkgsrc that would be nice to
9186: have.</p></li>
1.128 wiz 9187: <li class="listitem"><p>Review packages for which review was requested on
1.180 wiz 9188: the <a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a>
1.92 rillig 9189: mailing list.</p></li>
9190: </ul></div>
9191: </td>
9192: </tr>
1.75 rillig 9193: </tbody>
9194: </table>
9195: </div>
9196: </div>
1.148 asau 9197: <div class="chapter">
1.85 jmmv 9198: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 9199: <a name="gnome"></a>Chapter 25. GNOME packaging and porting</h2></div></div></div>
1.85 jmmv 9200: <div class="toc">
9201: <p><b>Table of Contents</b></p>
1.210 leot 9202: <dl class="toc">
1.267 rillig 9203: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
9204: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
9205: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
9206: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.85 jmmv 9207: </dl>
9208: </div>
1.110 hubertf 9209: <p>Quoting <a class="ulink" href="http://www.gnome.org/" target="_top">GNOME's web
1.85 jmmv 9210: site</a>:</p>
9211: <div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
9212: environment, an intuitive and attractive desktop for users, and the
9213: GNOME development platform, an extensive framework for building
9214: applications that integrate into the rest of the desktop.</p></blockquote></div>
9215: <p>pkgsrc provides a seamless way to automatically build and install
9216: a complete GNOME environment <span class="emphasis"><em>under many different
9217: platforms</em></span>. We can say with confidence that pkgsrc is one of
9218: the most advanced build and packaging systems for GNOME due to its
9219: included technologies buildlink3, the wrappers and tools framework and
9220: automatic configuration file management. Lots of efforts are put into
9221: achieving a completely clean deinstallation of installed software
9222: components.</p>
1.110 hubertf 9223: <p>Given that pkgsrc is <a class="ulink" href="http://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
1.85 jmmv 9224: the above also means that great efforts are put into making GNOME work
1.110 hubertf 9225: under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted
1.85 jmmv 9226: pkgsrc as its preferred packaging system, contributing lots of
9227: portability fixes to make GNOME build and install under it.</p>
9228: <p>This chapter is aimed at pkgsrc developers and other people
9229: interested in helping our GNOME porting and packaging efforts. It
9230: provides instructions on how to manage the existing packages and some
9231: important information regarding their internals.</p>
1.148 asau 9232: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.85 jmmv 9233: <h3 class="title">We need your help!</h3>
9234: <p>Should you have some spare cycles to devote to NetBSD, pkgsrc
9235: and GNOME and are willing to learn new exciting stuff, please jump
1.110 hubertf 9236: straight to the <a class="ulink" href="http://www.NetBSD.org/contrib/projects.html#gnome" target="_top">pending
1.85 jmmv 9237: work</a> list! There is still a long way to go to get a
9238: fully-functional GNOME desktop under NetBSD and we need your help to
9239: achieve it!</p>
9240: </div>
1.148 asau 9241: <div class="sect1">
1.85 jmmv 9242: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9243: <a name="meta-packages"></a>25.1. Meta packages</h2></div></div></div>
1.85 jmmv 9244: <p>pkgsrc includes three GNOME-related meta packages:</p>
1.148 asau 9245: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 9246: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>: Provides
1.85 jmmv 9247: the core GNOME desktop environment. It only includes the necessary
9248: bits to get it to boot correctly, although it may lack important
9249: functionality for daily operation. The idea behind this package is
9250: to let end users build their own configurations on top of this one,
9251: first installing this meta package to achieve a functional setup and
9252: then adding individual applications.</p></li>
1.250 leot 9253: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a>: Provides a
1.85 jmmv 9254: complete installation of the GNOME platform and desktop as defined
9255: by the GNOME project; this is based on the components distributed in
9256: the <code class="filename">platform/x.y/x.y.z/sources</code> and
9257: <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
9258: official FTP server. Developer-only tools found in those
9259: directories are not installed unless required by some other
9260: component to work properly. Similarly, packages from the bindings
9261: set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
9262: in unless required as a dependency for an end-user component. This
1.250 leot 9263: package "extends" <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>.</p></li>
9264: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a>:
1.85 jmmv 9265: Installs all the tools required to build a GNOME component when
9266: fetched from the CVS repository. These are required to let the
1.110 hubertf 9267: <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
1.85 jmmv 9268: </ul></div>
9269: <p>In all these packages, the <code class="varname">DEPENDS</code> lines are
9270: sorted in a way that eases updates: a package may depend on other
9271: packages listed before it but not on any listed after it. It is very
9272: important to keep this order to ease updates so... <span class="emphasis"><em>do not
9273: change it to alphabetical sorting!</em></span></p>
9274: </div>
1.148 asau 9275: <div class="sect1">
1.85 jmmv 9276: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9277: <a name="new-package"></a>25.2. Packaging a GNOME application</h2></div></div></div>
1.85 jmmv 9278: <p>Almost all GNOME applications are written in C and use a common
9279: set of tools as their build system. Things get different with the new
9280: bindings to other languages (such as Python), but the following will
9281: give you a general idea on the minimum required tools:</p>
1.148 asau 9282: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9283: <li class="listitem">
1.85 jmmv 9284: <p>Almost all GNOME applications use the GNU Autotools as their
9285: build system. As a general rule you will need to tell this to your
9286: package:</p>
1.100 rillig 9287: <pre class="programlisting">
9288: GNU_CONFIGURE=yes
1.85 jmmv 9289: USE_LIBTOOL=yes
1.100 rillig 9290: USE_TOOLS+=gmake
9291: </pre>
1.85 jmmv 9292: </li>
1.128 wiz 9293: <li class="listitem">
1.85 jmmv 9294: <p>If the package uses pkg-config to detect dependencies, add this
9295: tool to the list of required utilities:</p>
1.222 sevan 9296: <pre class="programlisting">
9297: USE_TOOLS+=pkg-config
9298: </pre>
1.250 leot 9299: <p>Also use <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/verifypc/README.html" target="_top"><code class="filename">pkgtools/verifypc</code></a> at
1.85 jmmv 9300: the end of the build process to ensure that you did not miss to
9301: specify any dependency in your package and that the version
9302: requirements are all correct.</p>
9303: </li>
1.128 wiz 9304: <li class="listitem"><p>If the package uses intltool, be sure to add
1.93 rillig 9305: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
1.85 jmmv 9306: to handle dependencies and to force the package to use the latest
9307: available version.</p></li>
1.128 wiz 9308: <li class="listitem">
1.85 jmmv 9309: <p>If the package uses gtk-doc (a documentation generation
9310: utility), do <span class="emphasis"><em>not</em></span> add a dependency on it. The
9311: tool is rather big and the distfile should come with pregenerated
9312: documentation anyway; if it does not, it is a bug that you ought to
9313: report. For such packages you should disable gtk-doc (unless it is
1.89 rillig 9314: the default):</p>
1.222 sevan 9315: <pre class="programlisting">
9316: CONFIGURE_ARGS+=--disable-gtk-doc
9317: </pre>
1.89 rillig 9318: <p>The default location of installed HTML files
9319: (<code class="filename">share/gtk-doc/<package-name></code>) is correct
9320: and should not be changed unless the package insists on installing
9321: them somewhere else. Otherwise programs as
1.110 hubertf 9322: <span class="command"><strong>devhelp</strong></span> will not be able to open them. You can
1.89 rillig 9323: do that with an entry similar to:</p>
1.222 sevan 9324: <pre class="programlisting">
9325: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
9326: </pre>
1.85 jmmv 9327: </li>
9328: </ul></div>
9329: <p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
9330: files under the installation prefix to maintain databases. In this
9331: context, shared means that those exact same directories and files are
9332: used among several different packages, leading to conflicts in the
9333: <code class="filename">PLIST</code>. pkgsrc currently includes functionality to
9334: handle the most common cases, so you have to forget about using
9335: <code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
9336: omitting shared files from them. If you find yourself doing those,
9337: <span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
9338: <p>The following table lists the common situations that result in
9339: using shared directories or files. For each of them, the appropriate
9340: solution is given. After applying the solution be sure to
9341: <span class="emphasis"><em>regenerate the package's file list</em></span> with
1.110 hubertf 9342: <span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
1.85 jmmv 9343: <div class="table">
1.267 rillig 9344: <a name="plist-handling"></a><p class="title"><b>Table 25.1. PLIST handling for GNOME packages</b></p>
1.216 tnn 9345: <div class="table-contents"><table class="table" summary="PLIST handling for GNOME packages" border="1">
1.85 jmmv 9346: <colgroup>
9347: <col>
9348: <col>
9349: </colgroup>
9350: <thead><tr>
9351: <th>If the package...</th>
9352: <th>Then...</th>
9353: </tr></thead>
9354: <tbody>
9355: <tr>
9356: <td>Installs OMF files under <code class="filename">share/omf</code>.</td>
1.267 rillig 9357: <td>See <a class="xref" href="#scrollkeeper-data-files" title="21.6.10. Packages installing scrollkeeper/rarian data files">Section 21.6.10, “Packages installing scrollkeeper/rarian data files”</a>.</td>
1.85 jmmv 9358: </tr>
9359: <tr>
9360: <td>Installs icons under the
9361: <code class="filename">share/icons/hicolor</code> hierarchy or updates
9362: <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
1.267 rillig 9363: <td>See <a class="xref" href="#hicolor-theme" title="21.6.19. Packages installing hicolor theme icons">Section 21.6.19, “Packages installing hicolor theme icons”</a>.</td>
1.85 jmmv 9364: </tr>
9365: <tr>
9366: <td>Installs files under
9367: <code class="filename">share/mime/packages</code>.</td>
1.267 rillig 9368: <td>See <a class="xref" href="#mime-database" title="21.6.14. Packages installing extensions to the MIME database">Section 21.6.14, “Packages installing extensions to the MIME database”</a>.</td>
1.85 jmmv 9369: </tr>
9370: <tr>
9371: <td>Installs <code class="filename">.desktop</code> files under
9372: <code class="filename">share/applications</code> and these include MIME
9373: information.</td>
1.267 rillig 9374: <td>See <a class="xref" href="#desktop-files" title="21.6.20. Packages installing desktop files">Section 21.6.20, “Packages installing desktop files”</a>.</td>
1.85 jmmv 9375: </tr>
9376: </tbody>
1.91 rillig 9377: </table></div>
1.85 jmmv 9378: </div>
1.91 rillig 9379: <br class="table-break">
1.85 jmmv 9380: </div>
1.148 asau 9381: <div class="sect1">
1.85 jmmv 9382: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9383: <a name="full-update"></a>25.3. Updating GNOME to a newer version</h2></div></div></div>
1.85 jmmv 9384: <p>When seeing GNOME as a whole, there are two kinds of
9385: updates:</p>
1.148 asau 9386: <div class="variablelist"><dl class="variablelist">
1.85 jmmv 9387: <dt><span class="term">Major update</span></dt>
9388: <dd>
9389: <p>Given that there is still a very long way for GNOME 3 (if it
9390: ever appears), we consider a major update one that goes from a
9391: <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
9392: where <code class="literal">Y</code> is even and greater than
9393: <code class="literal">X</code>. These are hard to achieve because they
9394: introduce lots of changes in the components' code and almost all
9395: GNOME distfiles are updated to newer versions. Some of them can
9396: even break API and ABI compatibility with the previous major
9397: version series. As a result, the update needs to be done all at
9398: once to minimize breakage.</p>
9399: <p>A major update typically consists of around 80 package
9400: updates and the addition of some new ones.</p>
9401: </dd>
9402: <dt><span class="term">Minor update</span></dt>
9403: <dd>
9404: <p>We consider a minor update one that goes from a
9405: <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
9406: one where <code class="literal">Y</code> is greater than
9407: <code class="literal">X</code>. These are easy to achieve because they do
9408: not update all GNOME components, can be done in an incremental way
9409: and do not break API nor ABI compatibility.</p>
9410: <p>A minor update typically consists of around 50 package
9411: updates, although the numbers here may vary a lot.</p>
9412: </dd>
9413: </dl></div>
9414: <p>In order to update the GNOME components in pkgsrc to a new stable
9415: release (either major or minor), the following steps should be
9416: followed:</p>
1.128 wiz 9417: <div class="orderedlist"><ol class="orderedlist" type="1">
9418: <li class="listitem">
1.85 jmmv 9419: <p>Get a list of all the tarballs that form the new release by
9420: using the following commands. These will leave the full list of the
1.120 snj 9421: components' distfiles into the <code class="filename">list.txt</code>
1.85 jmmv 9422: file:</p>
1.88 wiz 9423: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
1.85 jmmv 9424: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
9425: awk '{ print $9 }' >list.txt</code></strong>
1.88 wiz 9426: <code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
1.85 jmmv 9427: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
9428: awk '{ print $9 }' >>list.txt</code></strong></pre>
9429: </li>
1.128 wiz 9430: <li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
1.85 jmmv 9431: bump their version to the release you are updating them to. The
9432: three meta packages should be always consistent with versioning.
9433: Obviously remove any <code class="varname">PKGREVISION</code>s that might be
9434: in them.</p></li>
1.128 wiz 9435: <li class="listitem">
1.85 jmmv 9436: <p>For each meta package, update all its
9437: <code class="varname">DEPENDS</code> lines to match the latest versions as
9438: shown by the above commands. Do <span class="emphasis"><em>not</em></span> list any
9439: newer version (even if found in the FTP) because the meta packages
9440: are supposed to list the exact versions that form a specific GNOME
9441: release. Exceptions are permitted here if a newer version solves a
9442: serious issue in the overall desktop experience; these typically
9443: come in the form of a revision bump in pkgsrc, not in newer versions
9444: from the developers.</p>
9445: <p>Packages not listed in the <code class="filename">list.txt</code> file
9446: should be updated to the latest version available (if found in
9447: pkgsrc). This is the case, for example, of the dependencies on the
1.250 leot 9448: GNU Autotools in the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a> meta package.</p>
1.85 jmmv 9449: </li>
1.128 wiz 9450: <li class="listitem">
1.85 jmmv 9451: <p>Generate a patch from the modified meta packages and extract the
9452: list of "new" lines. This will provide you an outline on what
9453: packages need to be updated in pkgsrc and in what order:</p>
1.93 rillig 9454: <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.85 jmmv 9455: </li>
1.128 wiz 9456: <li class="listitem"><p>For major desktop updates it is recommended to zap all your
1.85 jmmv 9457: installed packages and start over from scratch at this point.</p></li>
1.128 wiz 9458: <li class="listitem"><p>Now comes the longest step by far: iterate over the contents
1.85 jmmv 9459: of <code class="filename">todo.txt</code> and update the packages listed in
9460: it in order. For major desktop updates none of these should be
1.93 rillig 9461: committed until the entire set is completed because there are chances
1.85 jmmv 9462: of breaking not-yet-updated packages.</p></li>
1.128 wiz 9463: <li class="listitem"><p>Once the packages are up to date and working, commit them to
1.85 jmmv 9464: the tree one by one with appropriate log messages. At the end,
9465: commit the three meta package updates and all the corresponding
9466: changes to the <code class="filename">doc/CHANGES-<YEAR></code> and
9467: <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>
9468: </ol></div>
9469: </div>
1.148 asau 9470: <div class="sect1">
1.85 jmmv 9471: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9472: <a name="patching"></a>25.4. Patching guidelines</h2></div></div></div>
1.85 jmmv 9473: <p>GNOME is a very big component in pkgsrc which approaches 100
9474: packages. Please, it is very important that you always, always,
9475: <span class="strong"><strong>always</strong></span> feed back any portability
1.267 rillig 9476: fixes you do to a GNOME package to the mainstream developers (see <a class="xref" href="#components.patches.feedback" title="13.3.5. Feedback to the author">Section 13.3.5, “Feedback to the author”</a>). This is the only way to get
1.85 jmmv 9477: their attention on portability issues and to ensure that future versions
9478: can be built out-of-the box on NetBSD. The less custom patches in
9479: pkgsrc, the easier further updates are. Those developers in charge of
9480: issuing major GNOME updates will be grateful if you do that.</p>
1.110 hubertf 9481: <p>The most common places to report bugs are the <a class="ulink" href="http://bugzilla.gnome.org/" target="_top">GNOME's Bugzilla</a> and the <a class="ulink" href="http://bugzilla.freedesktop.org/" target="_top">freedesktop.org's
1.85 jmmv 9482: Bugzilla</a>. Not all components use these to track bugs, but most
9483: of them do. Do not be short on your reports: always provide detailed
9484: explanations of the current failure, how it can be improved to achieve
9485: maximum portability and, if at all possible, provide a patch against CVS
9486: head. The more verbose you are, the higher chances of your patch being
9487: accepted.</p>
9488: <p>Also, please avoid using preprocessor magic to fix portability
9489: issues. While the FreeBSD GNOME people are doing a great job in porting
9490: GNOME to their operating system, the official GNOME sources are now
9491: plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
9492: and similar macros. This hurts portability. Please see our patching
1.267 rillig 9493: guidelines (<a class="xref" href="#components.patches.guidelines" title="13.3.4. Patching guidelines">Section 13.3.4, “Patching guidelines”</a>) for more
1.85 jmmv 9494: details.</p>
9495: </div>
9496: </div>
1.75 rillig 9497: </div>
1.148 asau 9498: <div class="part">
1.75 rillig 9499: <div class="titlepage"><div><div><h1 class="title">
9500: <a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
1.148 asau 9501: <div class="partintro">
1.75 rillig 9502: <div></div>
9503: <p>This part of the guide deals with everything
9504: from the infrastructure that is behind the interfaces described
9505: in the developer's guide. A casual package maintainer should not
9506: need anything from this part.</p>
9507: <div class="toc">
9508: <p><b>Table of Contents</b></p>
1.210 leot 9509: <dl class="toc">
1.267 rillig 9510: <dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
1.75 rillig 9511: <dd><dl>
1.267 rillig 9512: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
9513: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
9514: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.75 rillig 9515: <dd><dl>
1.267 rillig 9516: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
9517: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.75 rillig 9518: </dl></dd>
1.267 rillig 9519: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
9520: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 9521: <dd><dl>
1.267 rillig 9522: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
9523: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.81 rillig 9524: </dl></dd>
1.267 rillig 9525: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.81 rillig 9526: <dd><dl>
1.267 rillig 9527: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
9528: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75 rillig 9529: </dl></dd>
9530: </dl></dd>
1.267 rillig 9531: <dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
1.75 rillig 9532: <dd><dl>
1.267 rillig 9533: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
9534: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.75 rillig 9535: <dd><dl>
1.267 rillig 9536: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
9537: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.75 rillig 9538: </dl></dd>
9539: </dl></dd>
1.267 rillig 9540: <dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
9541: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.75 rillig 9542: </dl>
9543: </div>
9544: </div>
1.148 asau 9545: <div class="chapter">
1.75 rillig 9546: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 9547: <a name="infr.design"></a>Chapter 26. Design of the pkgsrc infrastructure</h2></div></div></div>
1.75 rillig 9548: <div class="toc">
9549: <p><b>Table of Contents</b></p>
1.210 leot 9550: <dl class="toc">
1.267 rillig 9551: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
9552: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
9553: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.81 rillig 9554: <dd><dl>
1.267 rillig 9555: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
9556: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.81 rillig 9557: </dl></dd>
1.267 rillig 9558: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
9559: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 9560: <dd><dl>
1.267 rillig 9561: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
9562: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.75 rillig 9563: </dl></dd>
1.267 rillig 9564: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.75 rillig 9565: <dd><dl>
1.267 rillig 9566: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
9567: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75 rillig 9568: </dl></dd>
9569: </dl>
9570: </div>
9571: <p>The pkgsrc infrastructure consists of many small Makefile
9572: fragments. Each such fragment needs a properly specified
9573: interface. This chapter explains how such an interface looks
9574: like.</p>
1.148 asau 9575: <div class="sect1">
1.75 rillig 9576: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9577: <a name="infr.vardef"></a>26.1. The meaning of variable definitions</h2></div></div></div>
1.81 rillig 9578: <p>Whenever a variable is defined in the pkgsrc
9579: infrastructure, the location and the way of definition provide
9580: much information about the intended use of that variable.
9581: Additionally, more documentation may be found in a header
9582: comment or in this pkgsrc guide.</p>
9583: <p>A special file is
9584: <code class="filename">mk/defaults/mk.conf</code>, which lists all
9585: variables that are intended to be user-defined. They are either
9586: defined using the <code class="literal">?=</code> operator or they are
9587: left undefined because defining them to anything would
1.128 wiz 9588: effectively mean <span class="quote">“<span class="quote">yes</span>”</span>. All these variables may be
1.81 rillig 9589: overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
9590: file.</p>
9591: <p>Outside this file, the following conventions apply:
9592: Variables that are defined using the <code class="literal">?=</code>
9593: operator may be overridden by a package.</p>
9594: <p>Variables that are defined using the <code class="literal">=</code>
9595: operator may be used read-only at run-time.</p>
9596: <p>Variables whose name starts with an underscore must not be
9597: accessed outside the pkgsrc infrastructure at all. They may
9598: change without further notice.</p>
1.148 asau 9599: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.81 rillig 9600: <h3 class="title">Note</h3>
9601: <p>These conventions are currently not applied
9602: consistently to the complete pkgsrc
9603: infrastructure.</p>
9604: </div>
9605: </div>
1.148 asau 9606: <div class="sect1">
1.81 rillig 9607: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9608: <a name="infr.vardef.problems"></a>26.2. Avoiding problems before they arise</h2></div></div></div>
1.81 rillig 9609: <p>All variables that contain lists of things should default
9610: to being empty. Two examples that do not follow this rule are
9611: <code class="varname">USE_LANGUAGES</code> and
9612: <code class="varname">DISTFILES</code>. These variables cannot simply be
9613: modified using the <code class="literal">+=</code> operator in package
9614: <code class="filename">Makefile</code>s (or other files included by
9615: them), since there is no guarantee whether the variable is
9616: already set or not, and what its value is. In the case of
1.128 wiz 9617: <code class="varname">DISTFILES</code>, the packages <span class="quote">“<span class="quote">know</span>”</span>
1.81 rillig 9618: the default value and just define it as in the following
9619: example.</p>
9620: <pre class="programlisting">
1.100 rillig 9621: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
1.81 rillig 9622: </pre>
9623: <p>Because of the selection of this default value, the same
9624: value appears in many package Makefiles. Similarly for
9625: <code class="varname">USE_LANGUAGES</code>, but in this case the default
1.128 wiz 9626: value (<span class="quote">“<span class="quote"><code class="literal">c</code></span>”</span>) is so short that it
1.81 rillig 9627: doesn't stand out. Nevertheless it is mentioned in many
9628: files.</p>
9629: </div>
1.148 asau 9630: <div class="sect1">
1.81 rillig 9631: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9632: <a name="infr.var"></a>26.3. Variable evaluation</h2></div></div></div>
1.148 asau 9633: <div class="sect2">
1.75 rillig 9634: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9635: <a name="infr.var.load"></a>26.3.1. At load time</h3></div></div></div>
1.75 rillig 9636: <p>Variable evaluation takes place either at load time or at
9637: runtime, depending on the context in which they occur. The
9638: contexts where variables are evaluated at load time are:</p>
1.148 asau 9639: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9640: <li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
1.75 rillig 9641: and <code class="literal">!=</code> operators,</p></li>
1.128 wiz 9642: <li class="listitem"><p>Make directives like <code class="literal">.if</code> or
1.75 rillig 9643: <code class="literal">.for</code>,</p></li>
1.128 wiz 9644: <li class="listitem"><p>Dependency lines.</p></li>
1.75 rillig 9645: </ul></div>
9646: <p>A special exception are references to the iteration
9647: variables of <code class="literal">.for</code> loops, which are expanded
9648: inline, no matter in which context they appear.</p>
9649: <p>As the values of variables may change during load time,
9650: care must be taken not to evaluate them by accident. Typical
9651: examples for variables that should not be evaluated at load time
9652: are <code class="varname">DEPENDS</code> and
9653: <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
9654: clear, here is an example:</p>
9655: <pre class="programlisting">
1.100 rillig 9656: CONFIGURE_ARGS= # none
9657: CFLAGS= -O
9658: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
1.1 grant 9659:
1.100 rillig 9660: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
1.1 grant 9661:
1.100 rillig 9662: CFLAGS+= -Wall
1.222 sevan 9663: </pre>
1.75 rillig 9664: <p>This code shows how the use of the <code class="literal">:=</code>
9665: operator can quickly lead to unexpected results. The first
9666: paragraph is fairly common code. The second paragraph evaluates
9667: the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
9668: <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
9669: <code class="literal">-Wall</code> is appended to the
9670: <code class="varname">CFLAGS</code>, but this addition will not appear in
9671: <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
9672: paragraphs from above typically occur in completely unrelated
9673: files.</p>
9674: </div>
1.148 asau 9675: <div class="sect2">
1.75 rillig 9676: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9677: <a name="infr.var.run"></a>26.3.2. At runtime</h3></div></div></div>
1.75 rillig 9678: <p>After all the files have been loaded, the values of the
9679: variables cannot be changed anymore. Variables that are used in
9680: the shell commands are expanded at this point.</p>
9681: </div>
9682: </div>
1.148 asau 9683: <div class="sect1">
1.75 rillig 9684: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9685: <a name="infr.varspec"></a>26.4. How can variables be specified?</h2></div></div></div>
1.78 rillig 9686: <p>There are many ways in which the definition and use of a
1.218 rillig 9687: variable can be restricted in order to detect bugs and violations
9688: of the (mostly unwritten) policies. A package can be checked with
9689: <code class="literal">pkglint -Wall</code> to see whether it meets these
9690: rules.</p>
1.78 rillig 9691: </div>
1.148 asau 9692: <div class="sect1">
1.78 rillig 9693: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9694: <a name="infr.design.intf"></a>26.5. Designing interfaces for Makefile fragments</h2></div></div></div>
1.76 rillig 9695: <p>Most of the <code class="filename">.mk</code> files fall into one
1.75 rillig 9696: of the following classes. Cases where a file falls into more
9697: than one class should be avoided as it often leads to subtle
9698: bugs.</p>
1.148 asau 9699: <div class="sect2">
1.75 rillig 9700: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9701: <a name="infr.design.intf.proc"></a>26.5.1. Procedures with parameters</h3></div></div></div>
1.75 rillig 9702: <p>In a traditional imperative programming language some of
1.76 rillig 9703: the <code class="filename">.mk</code> files could be described as
1.126 jakllsch 9704: procedures. They take some input parameters and—after
9705: inclusion—provide a result in output parameters. Since all
1.76 rillig 9706: variables in <code class="filename">Makefile</code>s have global scope
1.75 rillig 9707: care must be taken not to use parameter names that have already
9708: another meaning. For example, <code class="varname">PKGNAME</code> is a
9709: bad choice for a parameter name.</p>
9710: <p>Procedures are completely evaluated at preprocessing time.
9711: That is, when calling a procedure all input parameters must be
9712: completely resolvable. For example,
9713: <code class="varname">CONFIGURE_ARGS</code> should never be an input
9714: parameter since it is very likely that further text will be
9715: added after calling the procedure, which would effectively apply
9716: the procedure to only a part of the variable. Also, references
1.218 rillig 9717: to other variables will be modified after calling the
1.75 rillig 9718: procedure.</p>
9719: <p>A procedure can declare its output parameters either as
9720: suitable for use in preprocessing directives or as only
9721: available at runtime. The latter alternative is for variables
9722: that contain references to other runtime variables.</p>
9723: <p>Procedures shall be written such that it is possible to
9724: call the procedure more than once. That is, the file must not
9725: contain multiple-inclusion guards.</p>
9726: <p>Examples for procedures are
1.76 rillig 9727: <code class="filename">mk/bsd.options.mk</code> and
9728: <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
1.75 rillig 9729: that the parameters are evaluated at load time, they should be
9730: assigned using the <code class="literal">:=</code> operator, which should
9731: be used only for this purpose.</p>
9732: </div>
1.148 asau 9733: <div class="sect2">
1.75 rillig 9734: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9735: <a name="infr.design.intf.action"></a>26.5.2. Actions taken on behalf of parameters</h3></div></div></div>
1.75 rillig 9736: <p>Action files take some input parameters and may define
9737: runtime variables. They shall not define loadtime variables.
9738: There are action files that are included implicitly by the
9739: pkgsrc infrastructure, while other must be included
9740: explicitly.</p>
9741: <p>An example for action files is
1.76 rillig 9742: <code class="filename">mk/subst.mk</code>.</p>
1.75 rillig 9743: </div>
9744: </div>
1.148 asau 9745: <div class="sect1">
1.81 rillig 9746: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9747: <a name="infr.order"></a>26.6. The order in which files are loaded</h2></div></div></div>
1.81 rillig 9748: <p>Package <code class="filename">Makefile</code>s usually consist of
9749: a set of variable definitions, and include the file
9750: <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
9751: Before that, they may also include various other
9752: <code class="filename">*.mk</code> files if they need to query the
9753: availability of certain features like the type of compiler or
9754: the X11 implementation. Due to the heavy use of preprocessor
9755: directives like <code class="literal">.if</code> and
9756: <code class="literal">.for</code>, the order in which the files are loaded
9757: matters.</p>
9758: <p>This section describes at which point the various files
9759: are loaded and gives reasons for that order.</p>
1.148 asau 9760: <div class="sect2">
1.81 rillig 9761: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9762: <a name="infr.order.prefs"></a>26.6.1. The order in <code class="filename">bsd.prefs.mk</code>
1.93 rillig 9763: </h3></div></div></div>
9764: <p>The very first action in <code class="filename">bsd.prefs.mk</code>
1.81 rillig 9765: is to define some essential variables like
9766: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
9767: <code class="varname">MACHINE_ARCH</code>.</p>
9768: <p>Then, the user settings are loaded from the file specified
1.110 hubertf 9769: 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 9770: After that, those variables
1.81 rillig 9771: that have not been overridden by the user are loaded from
9772: <code class="filename">mk/defaults/mk.conf</code>.</p>
9773: <p>After the user settings, the system settings and platform
9774: settings are loaded, which may override the user
9775: settings.</p>
9776: <p>Then, the tool definitions are loaded. The tool wrappers
9777: are not yet in effect. This only happens when building a
9778: package, so the proper variables must be used instead of the
9779: direct tool names.</p>
9780: <p>As the last steps, some essential variables from the
9781: wrapper and the package system flavor are loaded, as well as the
9782: variables that have been cached in earlier phases of a package
9783: build.</p>
9784: </div>
1.148 asau 9785: <div class="sect2">
1.81 rillig 9786: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9787: <a name="infr.order.pkg"></a>26.6.2. The order in <code class="filename">bsd.pkg.mk</code>
1.93 rillig 9788: </h3></div></div></div>
1.81 rillig 9789: <p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
9790: <p>Then, the various <code class="filename">*-vars.mk</code> files are
9791: loaded, which fill default values for those variables that have
1.93 rillig 9792: not been defined by the package. These variables may later
1.81 rillig 9793: be used even in unrelated files.</p>
9794: <p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
9795: provides the target <code class="literal">error-check</code> that is added
9796: as a special dependency to all other targets that use
9797: <code class="varname">DELAYED_ERROR_MSG</code> or
9798: <code class="varname">DELAYED_WARNING_MSG</code>.</p>
9799: <p>Then, the package-specific hacks from
9800: <code class="filename">hacks.mk</code> are included.</p>
9801: <p>Then, various other files follow. Most of them don't have
9802: any dependencies on what they need to have included before or
9803: after them, though some do.</p>
9804: <p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
9805: <code class="varname">PKG_SKIP_REASON</code> is then executed, which
9806: restricts the use of these variables to all the files that have
9807: been included before. Appearances in later files will be
9808: silently ignored.</p>
9809: <p>Then, the files for the main targets are included, in the
9810: order of later execution, though the actual order should not
9811: matter.</p>
9812: <p>At last, some more files are included that don't set any
9813: interesting variables but rather just define make targets to be
9814: executed.</p>
9815: </div>
9816: </div>
1.75 rillig 9817: </div>
1.148 asau 9818: <div class="chapter">
1.75 rillig 9819: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 9820: <a name="regression"></a>Chapter 27. Regression tests</h2></div></div></div>
1.75 rillig 9821: <div class="toc">
9822: <p><b>Table of Contents</b></p>
1.210 leot 9823: <dl class="toc">
1.267 rillig 9824: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
9825: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.75 rillig 9826: <dd><dl>
1.267 rillig 9827: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
9828: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.75 rillig 9829: </dl></dd>
9830: </dl>
9831: </div>
9832: <p>The pkgsrc infrastructure consists of a large codebase,
9833: and there are many corners where every little bit of a file is
9834: well thought out, making pkgsrc likely to fail as soon as
9835: anything is changed near those parts. To prevent most changes
9836: from breaking anything, a suite of regression tests should go
9837: along with every important part of the pkgsrc infrastructure.
9838: This chapter describes how regression tests work in pkgsrc and
9839: how you can add new tests.</p>
1.148 asau 9840: <div class="sect1">
1.75 rillig 9841: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9842: <a name="regression.run"></a>27.1. Running the regression tests</h2></div></div></div>
1.250 leot 9843: <p>You first need to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_regress/README.html" target="_top"><code class="filename">pkgtools/pkg_regress</code></a> package, which
1.110 hubertf 9844: provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
1.75 rillig 9845: can simply run that command, which will run all tests in the
1.76 rillig 9846: <code class="filename">regress</code> category.</p>
1.75 rillig 9847: </div>
1.148 asau 9848: <div class="sect1">
1.75 rillig 9849: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9850: <a name="regression.new"></a>27.2. Adding a new regression test</h2></div></div></div>
1.76 rillig 9851: <p>Every directory in the <code class="filename">regress</code>
9852: category that contains a file called <code class="filename">spec</code>
1.75 rillig 9853: is considered a regression test. This file is a shell program
1.110 hubertf 9854: that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
1.75 rillig 9855: The following functions can be overridden to suit your
9856: needs.</p>
1.148 asau 9857: <div class="sect2">
1.75 rillig 9858: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9859: <a name="regression.fun.override"></a>27.2.1. Overridable functions</h3></div></div></div>
1.218 rillig 9860: <p>These functions do not take any parameters. Although they
9861: are called in <span class="quote">“<span class="quote">set -e</span>”</span> mode, they don't stop at the
9862: first failing command. See <a class="ulink" href="http://stackoverflow.com/q/4072984" target="_top">this StackOverflow
9863: question</a> for details.</p>
1.148 asau 9864: <div class="variablelist"><dl class="variablelist">
1.218 rillig 9865: <dt><span class="term"><code class="varname">do_setup</code></span></dt>
1.75 rillig 9866: <dd><p>This function prepares the environment for the
9867: test. By default it does nothing.</p></dd>
1.218 rillig 9868: <dt><span class="term"><code class="varname">do_test</code></span></dt>
9869: <dd>
9870: <p>This function runs the actual test. By default,
1.75 rillig 9871: it calls <code class="varname">TEST_MAKE</code> with the arguments
9872: <code class="varname">MAKEARGS_TEST</code> and writes its output including
9873: error messages into the file
1.218 rillig 9874: <code class="varname">TEST_OUTFILE</code>.</p>
9875: <p>When defining this function, make sure that all output that
9876: needs to be checked is written to the correct output file.
9877: Example:</p>
9878: <pre class="programlisting">
9879: do_test() {
1.223 rillig 9880: echo "Example output"
1.218 rillig 9881: } 1>$TEST_OUTFILE 2>&1
9882: </pre>
9883: </dd>
9884: <dt><span class="term"><code class="varname">check_result</code></span></dt>
9885: <dd>
9886: <p>This function is run after the test and is
1.75 rillig 9887: typically used to compare the actual output from the one that is
9888: expected. It can make use of the various helper functions from
1.218 rillig 9889: the next section. Example:</p>
9890: <pre class="programlisting">
9891: check_result() {
1.223 rillig 9892: exit_status 0
9893: output_require "Example"
9894: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
9895: output_prohibit "no such file or directory"
1.218 rillig 9896: }
9897: </pre>
9898: </dd>
9899: <dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
1.75 rillig 9900: <dd><p>This function cleans everything up after the
9901: test has been run. By default it does nothing.</p></dd>
9902: </dl></div>
9903: </div>
1.148 asau 9904: <div class="sect2">
1.75 rillig 9905: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9906: <a name="regression.fun.helper"></a>27.2.2. Helper functions</h3></div></div></div>
1.148 asau 9907: <div class="variablelist"><dl class="variablelist">
1.218 rillig 9908: <dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
1.75 rillig 9909: <dd><p>This function compares the exitcode of the
1.218 rillig 9910: <span class="command"><strong>do_test</strong></span> function with its first parameter.
1.75 rillig 9911: If they differ, the test will fail.</p></dd>
1.218 rillig 9912: <dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
9913: <dd>
9914: <p>This function checks for each of its parameters
9915: if the output from <span class="command"><strong>do_test</strong></span> matches the
1.75 rillig 9916: extended regular expression. If it does not, the test will
1.218 rillig 9917: fail. Example:</p>
9918: <pre class="programlisting">
1.219 rillig 9919: output_require "looks fine"
9920: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.218 rillig 9921: </pre>
9922: </dd>
1.75 rillig 9923: <dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt>
9924: <dd><p>This function checks for each of its parameters
1.110 hubertf 9925: if the output from <span class="command"><strong>do_test()</strong></span> does
1.75 rillig 9926: <span class="emphasis"><em>not</em></span> match the extended regular expression.
9927: If any of the regular expressions matches, the test will
9928: fail.</p></dd>
9929: </dl></div>
9930: </div>
9931: </div>
9932: </div>
1.148 asau 9933: <div class="chapter">
1.75 rillig 9934: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 9935: <a name="porting"></a>Chapter 28. Porting pkgsrc</h2></div></div></div>
1.75 rillig 9936: <div class="toc">
9937: <p><b>Table of Contents</b></p>
1.267 rillig 9938: <dl class="toc"><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl>
1.75 rillig 9939: </div>
9940: <p>The pkgsrc system has already been ported to many
9941: operating systems, hardware architectures and compilers. This
9942: chapter explains the necessary steps to make pkgsrc even more
9943: portable.</p>
1.148 asau 9944: <div class="sect1">
1.75 rillig 9945: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9946: <a name="porting.opsys"></a>28.1. Porting pkgsrc to a new operating system</h2></div></div></div>
1.75 rillig 9947: <p>To port pkgsrc to a new operating system (called
9948: <code class="literal">MyOS</code> in this example), you need to touch the
9949: following files:</p>
1.148 asau 9950: <div class="variablelist"><dl class="variablelist">
1.93 rillig 9951: <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 9952: <dd><p>This file contains some basic definitions, for
9953: example the name of the C
9954: compiler.</p></dd>
1.76 rillig 9955: <dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
1.75 rillig 9956: <dd><p>Insert code that defines the variables
9957: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
9958: <code class="varname">LOWER_OS_VERSION</code>,
9959: <code class="varname">LOWER_VENDOR</code>,
9960: <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
9961: <code class="varname">APPEND_ELF</code>, and the other variables that
9962: appear in this file.</p></dd>
1.93 rillig 9963: <dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 9964: <dd><p>This file contains the platform-specific
9965: definitions that are used by pkgsrc. Start by copying one of the
9966: other files and edit it to your
9967: needs.</p></dd>
1.93 rillig 9968: <dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 9969: <dd><p>This file defines the paths to all the tools
9970: that are needed by one or the other package in pkgsrc, as well
9971: as by pkgsrc itself. Find out where these tools are on your
9972: platform and add them.</p></dd>
9973: </dl></div>
9974: <p>Now, you should be able to build some basic packages, like
1.250 leot 9975: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/perl5/README.html" target="_top"><code class="filename">lang/perl5</code></a>, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/bash/README.html" target="_top"><code class="filename">shells/bash</code></a>.</p>
1.75 rillig 9976: </div>
9977: </div>
9978: </div>
1.148 asau 9979: <div class="appendix">
9980: <div class="titlepage"><div><div><h1 class="title">
9981: <a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
1.75 rillig 9982: <div class="toc">
9983: <p><b>Table of Contents</b></p>
1.210 leot 9984: <dl class="toc">
1.75 rillig 9985: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
9986: <dd><dl>
9987: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
9988: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
9989: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.128 wiz 9990: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span></a></span></dt>
1.75 rillig 9991: </dl></dd>
9992: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
9993: </dl>
9994: </div>
9995: <p>We checked to find a piece of software that wasn't in the packages
9996: collection, and picked GNU bison. Quite why someone would want to have
1.110 hubertf 9997: <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.75 rillig 9998: present in the tree is beyond us, but it's useful for the purposes of
9999: this exercise.</p>
1.148 asau 10000: <div class="sect1">
1.75 rillig 10001: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10002: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.148 asau 10003: <div class="sect2">
1.75 rillig 10004: <div class="titlepage"><div><div><h3 class="title">
10005: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
10006: <pre class="programlisting">
1.100 rillig 10007: # $NetBSD$
10008: #
1.1 grant 10009:
1.100 rillig 10010: DISTNAME= bison-1.25
10011: CATEGORIES= devel
10012: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 10013:
1.136 dholland 10014: MAINTAINER= pkgsrc-users@NetBSD.org
1.100 rillig 10015: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10016: COMMENT= GNU yacc clone
1.1 grant 10017:
1.100 rillig 10018: GNU_CONFIGURE= yes
1.152 wiz 10019: INFO_FILES= yes
1.1 grant 10020:
1.100 rillig 10021: .include "../../mk/bsd.pkg.mk"
1.1 grant 10022: </pre>
1.75 rillig 10023: </div>
1.148 asau 10024: <div class="sect2">
1.75 rillig 10025: <div class="titlepage"><div><div><h3 class="title">
10026: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
10027: <pre class="programlisting">
1.100 rillig 10028: GNU version of yacc. Can make re-entrant parsers, and numerous other
1.270 ! leot 10029: improvements. Why you would want this when Berkeley <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1.i386+NetBSD-8.1"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.100 rillig 10030: of the NetBSD source tree is beyond me.
1.1 grant 10031: </pre>
1.75 rillig 10032: </div>
1.148 asau 10033: <div class="sect2">
1.75 rillig 10034: <div class="titlepage"><div><div><h3 class="title">
10035: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
10036: <pre class="programlisting">
1.100 rillig 10037: @comment $NetBSD$
10038: bin/bison
10039: man/man1/bison.1.gz
10040: share/bison.simple
10041: share/bison.hairy
1.1 grant 10042: </pre>
1.75 rillig 10043: </div>
1.148 asau 10044: <div class="sect2">
1.75 rillig 10045: <div class="titlepage"><div><div><h3 class="title">
1.110 hubertf 10046: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span>
1.93 rillig 10047: </h3></div></div></div>
1.75 rillig 10048: <p>The NetBSD package system comes with
1.250 leot 10049: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
1.75 rillig 10050: which helps to check the contents of these
10051: files. After installation it is quite easy to use, just change to the
10052: directory of the package you wish to examine and execute
1.110 hubertf 10053: <span class="command"><strong>pkglint</strong></span>:</p>
1.75 rillig 10054: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
10055: looks fine.</pre>
10056: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.110 hubertf 10057: more checks will be performed. Use e.g. <span class="command"><strong>pkglint -Call
1.75 rillig 10058: -Wall</strong></span> for a very thorough check.</p>
10059: </div>
10060: </div>
1.148 asau 10061: <div class="sect1">
1.75 rillig 10062: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10063: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
10064: <p>Create the directory where the package lives,
10065: plus any auxiliary directories:</p>
10066: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10067: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
10068: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
10069: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
1.76 rillig 10070: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.267 rillig 10071: <code class="filename">PLIST</code> (see <a class="xref" href="#components" title="Chapter 13. Package components - files, directories and contents">Chapter 13, <i>Package components - files, directories and contents</i></a>)
1.75 rillig 10072: then continue with fetching the distfile:</p>
10073: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
1.1 grant 10074: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10075: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10076: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10077: ftp: Error retrieving file: 500 Internal error
10078:
10079: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10080: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10081: ftp: Error retrieving file: 500 Internal error
10082:
10083: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10084: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1.75 rillig 10085: Successfully retrieved file.</pre>
10086: <p>Generate the checksum of the distfile into
1.76 rillig 10087: <code class="filename">distinfo</code>:</p>
1.88 wiz 10088: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
1.75 rillig 10089: <p>Now compile:</p>
10090: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1 grant 10091: >> Checksum OK for bison-1.25.tar.gz.
10092: ===> Extracting for bison-1.25
10093: ===> Patching for bison-1.25
10094: ===> Ignoring empty patch directory
10095: ===> Configuring for bison-1.25
10096: creating cache ./config.cache
10097: checking for gcc... cc
10098: checking whether we are using GNU C... yes
10099: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10100: checking how to run the C preprocessor... cc -E
10101: checking for minix/config.h... no
10102: checking for POSIXized ISC... no
10103: checking whether cross-compiling... no
10104: checking for ANSI C header files... yes
10105: checking for string.h... yes
10106: checking for stdlib.h... yes
10107: checking for memory.h... yes
10108: checking for working const... yes
10109: checking for working alloca.h... no
10110: checking for alloca... yes
10111: checking for strerror... yes
10112: updating cache ./config.cache
10113: creating ./config.status
10114: creating Makefile
10115: ===> Building for bison-1.25
10116: 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
10117: 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
10118: 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
10119: 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
10120: 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 10121: 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 10122: 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
10123: 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
10124: 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
10125: 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
10126: 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
10127: 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
10128: 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
10129: 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
10130: 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
10131: 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
10132: 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
10133: 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
10134: 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
10135: 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
10136: 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
10137: 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
10138: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10139: rm -f bison.s1
1.75 rillig 10140: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1</pre>
10141: <p>Everything seems OK, so install the files:</p>
10142: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1 grant 10143: >> Checksum OK for bison-1.25.tar.gz.
10144: ===> Installing for bison-1.25
10145: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10146: rm -f /usr/pkg/bin/bison
10147: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10148: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10149: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10150: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10151: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10152: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10153: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
1.75 rillig 10154: ===> Registering installation for bison-1.25</pre>
10155: <p>You can now use bison, and also - if you decide so - remove it with
1.110 hubertf 10156: <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.75 rillig 10157: binary package, do this now:</p>
10158: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1 grant 10159: >> Checksum OK for bison-1.25.tar.gz.
10160: ===> Building package for bison-1.25
10161: Creating package bison-1.25.tgz
10162: Registering depends:.
1.75 rillig 10163: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
10164: <p>Now that you don't need the source and object files
10165: any more, clean up:</p>
10166: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
10167: ===> Cleaning for bison-1.25</pre>
10168: </div>
10169: </div>
1.148 asau 10170: <div class="appendix">
10171: <div class="titlepage"><div><div><h1 class="title">
10172: <a name="logs"></a>Appendix B. Build logs</h1></div></div></div>
1.75 rillig 10173: <div class="toc">
10174: <p><b>Table of Contents</b></p>
1.210 leot 10175: <dl class="toc">
1.75 rillig 10176: <dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
10177: <dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
10178: </dl>
10179: </div>
1.148 asau 10180: <div class="sect1">
1.75 rillig 10181: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10182: <a name="logs.building"></a>B.1. Building figlet</h2></div></div></div>
10183: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1 grant 10184: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10185: => figlet221.tar.gz doesn't seem to exist on this system.
10186: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10187: => [172219 bytes]
10188: Connected to ftp.plig.net.
10189: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10190: 331 Guest login ok, send your complete e-mail address as password.
10191: 230-You are user #5 of 500 simultaneous users allowed.
10192: 230-
1.68 rillig 10193: 230- ___ _ _ _
10194: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 10195: 230- | _| _| . |_| . | | | . |_| . | _| . |
10196: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10197: 230- |_| |_| |___| |___|
10198: 230-
10199: 230-** Welcome to ftp.plig.org **
10200: 230-
10201: 230-Please note that all transfers from this FTP site are logged. If you
10202: 230-do not like this, please disconnect now.
10203: 230-
1.120 snj 10204: 230-This archive is available via
1.1 grant 10205: 230-
10206: 230-HTTP: http://ftp.plig.org/
10207: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10208: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10209: 230-
10210: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 10211: 230-mirrored to ftp-admin@plig.org.
1.1 grant 10212: 230-
10213: 230-
10214: 230 Logged in anonymously.
10215: Remote system type is UNIX.
10216: Using binary mode to transfer files.
10217: 200 Type okay.
10218: 250 "/pub" is new cwd.
10219: 250-"/pub/figlet" is new cwd.
10220: 250-
10221: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 10222: 250-
1.75 rillig 10223: 250- ftp://ftp.figlet.org/pub/figlet/
1.1 grant 10224: 250-
10225: 250-The official FIGlet web page is:
1.75 rillig 10226: 250- http://www.figlet.org/
1.1 grant 10227: 250-
10228: 250-If you have questions, please mailto:info@figlet.org. If you want to
10229: 250-contribute a font or something else, you can email us.
1.68 rillig 10230: 250
1.1 grant 10231: 250 "/pub/figlet/program" is new cwd.
10232: 250 "/pub/figlet/program/unix" is new cwd.
10233: local: figlet221.tar.gz remote: figlet221.tar.gz
10234: 502 Unimplemented command.
10235: 227 Entering Passive Mode (195,40,6,41,246,104)
10236: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10237: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10238: 226 Transfer completed.
10239: 172219 bytes received in 00:02 (75.99 KB/s)
10240: 221 Goodbye.
10241: => Checksum OK for figlet221.tar.gz.
10242: ===> Extracting for figlet-2.2.1nb2
10243: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10244: ===> Patching for figlet-2.2.1nb2
10245: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10246: ===> Overriding tools for figlet-2.2.1nb2
10247: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10248: ===> Configuring for figlet-2.2.1nb2
10249: ===> Building for figlet-2.2.1nb2
10250: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10251: chmod a+x figlet
10252: gcc -O2 -o chkfont chkfont.c
10253: => Unwrapping files-to-be-installed.
1.14 xtraeme 10254: <code class="prompt">#</code>
1.75 rillig 10255: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1 grant 10256: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10257: ===> Installing for figlet-2.2.1nb2
10258: install -d -o root -g wheel -m 755 /usr/pkg/bin
10259: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10260: mkdir -p /usr/pkg/share/figlet
10261: cp figlet /usr/pkg/bin
10262: cp chkfont /usr/pkg/bin
10263: chmod 555 figlist showfigfonts
10264: cp figlist /usr/pkg/bin
10265: cp showfigfonts /usr/pkg/bin
10266: cp fonts/*.flf /usr/pkg/share/figlet
10267: cp fonts/*.flc /usr/pkg/share/figlet
10268: cp figlet.6 /usr/pkg/man/man6
10269: ===> Registering installation for figlet-2.2.1nb2
1.75 rillig 10270: <code class="prompt">#</code></pre>
10271: </div>
1.148 asau 10272: <div class="sect1">
1.75 rillig 10273: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10274: <a name="logs.package"></a>B.2. Packaging figlet</h2></div></div></div>
10275: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1 grant 10276: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10277: ===> Packaging figlet-2.2.1nb2
10278: ===> Building binary package for figlet-2.2.1nb2
10279: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10280: Using SrcDir value of /usr/pkg
1.68 rillig 10281: Registering depends:.
1.75 rillig 10282: <code class="prompt">#</code></pre>
10283: </div>
10284: </div>
1.148 asau 10285: <div class="appendix">
10286: <div class="titlepage"><div><div><h1 class="title">
10287: <a name="ftp-layout"></a>Appendix C. Directory layout of the pkgsrc FTP server</h1></div></div></div>
1.76 rillig 10288: <div class="toc">
10289: <p><b>Table of Contents</b></p>
1.210 leot 10290: <dl class="toc">
1.128 wiz 10291: <dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
10292: <dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
10293: <dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
10294: <dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
10295: <dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
1.261 leot 10296: <code class="filename">stable</code>,
1.128 wiz 10297: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 10298: source packages</a></span></dt>
10299: </dl>
10300: </div>
10301: <p>As in other big projects, the directory layout of pkgsrc
10302: is quite complex for newbies. This chapter explains where you
10303: find things on the FTP server. The base directory on
1.110 hubertf 10304: <code class="filename">ftp.NetBSD.org</code> is <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top"><code class="filename">/pub/pkgsrc/</code></a>.
1.89 rillig 10305: On other servers it may be different, but inside this directory,
10306: everything should look the same, no matter on which server you
10307: are. This directory contains some subdirectories, which are
10308: explained below.</p>
1.148 asau 10309: <div class="sect1">
1.76 rillig 10310: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10311: <a name="ftp-distfiles"></a>C.1. <code class="filename">distfiles</code>: The distributed source files</h2></div></div></div>
1.76 rillig 10312: <p>The directory <code class="filename">distfiles</code> contains lots
10313: of archive files from all pkgsrc packages, which are mirrored
10314: here. The subdirectories are called after their package names
10315: and are used when the distributed files have names that don't
10316: explicitly contain a version number or are otherwise too generic
10317: (for example <code class="filename">release.tar.gz</code>).</p>
10318: </div>
1.148 asau 10319: <div class="sect1">
1.76 rillig 10320: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10321: <a name="ftp-misc"></a>C.2. <code class="filename">misc</code>: Miscellaneous things</h2></div></div></div>
1.76 rillig 10322: <p>This directory contains things that individual pkgsrc
10323: developers find worth publishing.</p>
10324: </div>
1.148 asau 10325: <div class="sect1">
1.76 rillig 10326: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10327: <a name="ftp-packages"></a>C.3. <code class="filename">packages</code>: Binary packages</h2></div></div></div>
1.102 rillig 10328: <p>This directory contains binary packages for the various
10329: platforms that are supported by pkgsrc.
10330: Each subdirectory is of the form <em class="replaceable"><code>OPSYS</code></em>/<em class="replaceable"><code>ARCH</code></em>/<em class="replaceable"><code>OSVERSION_TAG</code></em>. The meaning of these variables is:</p>
1.148 asau 10331: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 10332: <li class="listitem"><p><code class="varname">OPSYS</code> is the name of the
1.109 rillig 10333: operating system for which the packages have been built. The
1.110 hubertf 10334: name is taken from the output of the <span class="command"><strong>uname</strong></span>
1.109 rillig 10335: command, so it may differ from the one you are used to
10336: hear.</p></li>
1.128 wiz 10337: <li class="listitem"><p><code class="varname">ARCH</code> is the hardware
1.108 rillig 10338: architecture of the platform for which the packages have been
1.110 hubertf 10339: built. It also includes the <code class="varname">ABI</code> (Application
10340: Binary Interface) for platforms that have several of
10341: them.</p></li>
1.128 wiz 10342: <li class="listitem"><p><code class="varname">OSVERSION</code> is the version of
1.108 rillig 10343: the operating system. For version numbers that change often (for
10344: example NetBSD-current), the often-changing part should be
10345: replaced with an <code class="literal">x</code>, for example
10346: <code class="literal">4.99.x</code>.</p></li>
1.128 wiz 10347: <li class="listitem"><p><code class="varname">TAG</code> is either
1.126 jakllsch 10348: <code class="literal">20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
1.108 rillig 10349: for a stable branch, or <code class="literal">head</code> for packages
10350: built from the HEAD branch. The latter should only be used when
10351: the packages are updated on a regular basis. Otherwise the date
10352: from checking out pkgsrc should be appended, for example
10353: <code class="literal">head_20071015</code>.</p></li>
1.102 rillig 10354: </ul></div>
10355: <p>The rationale for exactly this scheme is that the pkgsrc users looking for binary packages
10356: can quickly click through the directories on the
10357: server and find the best binary packages for their machines. Since they
10358: usually know the operating system and the hardware architecture, OPSYS
10359: and ARCH are placed first. After these choices, they can select the
10360: best combination of OSVERSION and TAG together, since it is usually the
10361: case that packages stay compatible between different version of the
10362: operating system.</p>
10363: <p>In each of these directories, there is a
10364: whole binary packages collection for a specific platform. It has a directory called
1.76 rillig 10365: <code class="filename">All</code> which contains all binary packages.
10366: Besides that, there are various category directories that
10367: contain symbolic links to the real binary packages.</p>
10368: </div>
1.148 asau 10369: <div class="sect1">
1.76 rillig 10370: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10371: <a name="ftp-reports"></a>C.4. <code class="filename">reports</code>: Bulk build reports</h2></div></div></div>
1.108 rillig 10372: <p>Here are the reports from bulk builds, for those who want
10373: to fix packages that didn't build on some of the platforms. The
1.128 wiz 10374: structure of subdirectories should look like the one in <a class="xref" href="#ftp-packages" title="C.3. packages: Binary packages">Section C.3, “<code class="filename">packages</code>: Binary packages”</a>.</p>
1.108 rillig 10375: </div>
1.148 asau 10376: <div class="sect1">
1.108 rillig 10377: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10378: <a name="ftp-source"></a>C.5. <code class="filename">current</code>,
1.261 leot 10379: <code class="filename">stable</code>,
1.126 jakllsch 10380: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 10381: source packages</h2></div></div></div>
1.128 wiz 10382: <p>These directories contain the <span class="quote">“<span class="quote">real</span>”</span> pkgsrc,
1.76 rillig 10383: that is the files that define how to create binary packages from
10384: source archives.</p>
1.262 leot 10385: <p>Each of the <code class="filename">current</code>,
10386: <code class="filename">stable</code> and
10387: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
10388: directories share the same structure. They each contain a
10389: <code class="filename">pkgsrc</code> directory and
10390: <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> file.</p>
1.76 rillig 10391: <p>The directory <code class="filename">pkgsrc</code> contains a
1.89 rillig 10392: snapshot of the CVS repository, which is updated regularly. The
1.262 leot 10393: file <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> contains the same
10394: as the directory, ready to be downloaded as a whole.</p>
10395: <p>The <code class="filename">current</code> directory contains files
10396: related to the HEAD branch of the CVS repository.
10397: In this directory there is an additional file called
10398: <code class="filename">pkgsrc-readmes.tar.{bz,gz,xz}</code> that contains
10399: all pkgsrc <code class="filename">README</code>s with information about
10400: categories and packages.
10401: </p>
10402: <p>The <code class="filename">stable</code> directory is a symlink to
10403: the latest
10404: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
10405: </p>
10406: <p>The
10407: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
10408: directories contain files related to the
10409: <code class="filename">-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
10410: stable branch of the CVS repository. In these directories there is
10411: an additional file called
10412: <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 10413: which contains the state of pkgsrc when it was branched.</p>
10414: </div>
1.75 rillig 10415: </div>
1.148 asau 10416: <div class="appendix">
10417: <div class="titlepage"><div><div><h1 class="title">
1.267 rillig 10418: <a name="help-topics"></a>Appendix D. Help topics</h1></div></div></div>
10419: <p>
10420: The following list contains all help topics that are available
10421: when running <span class="command"><strong>bmake help topic=:index</strong></span>.
10422: </p>
1.269 leot 10423: <table border="0" summary="Simple list" class="simplelist">
10424: <tr>
10425: <td>#!</td>
10426: <td>-lintl</td>
10427: </tr>
10428: <tr>
10429: <td>64bit</td>
10430: <td>ABI</td>
10431: </tr>
10432: <tr>
10433: <td>ACCEPTABLE_LICENSES</td>
10434: <td>ACROREAD_FONTPATH</td>
10435: </tr>
10436: <tr>
10437: <td>ADDITIONAL</td>
10438: <td>AFAIK</td>
10439: </tr>
10440: <tr>
10441: <td>AIX</td>
10442: <td>ALLOW_VULNERABLE_PACKAGES</td>
10443: </tr>
10444: <tr>
10445: <td>ALL_ENV</td>
10446: <td>ALSA_PC</td>
10447: </tr>
10448: <tr>
10449: <td>ALTERNATIVES_SRC</td>
10450: <td>AMANDA_TMP</td>
10451: </tr>
10452: <tr>
10453: <td>AMANDA_USER</td>
10454: <td>AMANDA_VAR</td>
10455: </tr>
10456: <tr>
10457: <td>APACHE_GROUP</td>
10458: <td>APACHE_MODULE_NAME</td>
10459: </tr>
10460: <tr>
10461: <td>APACHE_MODULE_SRC</td>
10462: <td>APACHE_MODULE_SRCDIR</td>
10463: </tr>
10464: <tr>
10465: <td>APACHE_PKG_PREFIX</td>
10466: <td>APACHE_SUEXEC_CONFIGURE_ARGS</td>
10467: </tr>
10468: <tr>
10469: <td>APACHE_SUEXEC_DOCROOT</td>
10470: <td>APACHE_USER</td>
10471: </tr>
10472: <tr>
10473: <td>APPEND_ABI</td>
10474: <td>APPEND_ELF</td>
10475: </tr>
10476: <tr>
10477: <td>ARLA_CACHE</td>
10478: <td>AUDIT_PACKAGES_FLAGS</td>
10479: </tr>
10480: <tr>
10481: <td>AUTOCONF_REQD</td>
10482: <td>AUTOMAKE_OVERRIDE</td>
10483: </tr>
10484: <tr>
10485: <td>AUTOMAKE_REQD</td>
10486: <td>AUTO_MKDIRS</td>
10487: </tr>
10488: <tr>
10489: <td>BDB185_DEFAULT</td>
10490: <td>BDBBASE</td>
10491: </tr>
10492: <tr>
10493: <td>BDB_ACCEPTED</td>
10494: <td>BDB_DEFAULT</td>
10495: </tr>
10496: <tr>
10497: <td>BDB_LIBS</td>
10498: <td>BDB_TYPE</td>
10499: </tr>
10500: <tr>
10501: <td>BIND_DIR</td>
10502: <td>BIND_GROUP</td>
10503: </tr>
10504: <tr>
10505: <td>BIND_USER</td>
10506: <td>BINPKG_SITES</td>
10507: </tr>
10508: <tr>
10509: <td>BIN_INSTALL_FLAGS</td>
10510: <td>BISON_PKGDATADIR</td>
10511: </tr>
10512: <tr>
10513: <td>BLAS_ACCEPTED</td>
10514: <td>BLAS_LIBS</td>
10515: </tr>
10516: <tr>
10517: <td>BLAS_TYPE</td>
10518: <td>BOOTSTRAP_DEPENDS</td>
10519: </tr>
10520: <tr>
10521: <td>BOOTSTRAP_SETUPTOOLS</td>
10522: <td>BROKEN</td>
10523: </tr>
10524: <tr>
10525: <td>BROKEN_EXCEPT_ON_PLATFORM</td>
10526: <td>BROKEN_ON_PLATFORM</td>
10527: </tr>
10528: <tr>
10529: <td>BSDSRCDIR</td>
10530: <td>BSDXSRCDIR</td>
10531: </tr>
10532: <tr>
10533: <td>BSD_MAKE_ENV</td>
10534: <td>BUILDLINK_AUTO_DIRS</td>
10535: </tr>
10536: <tr>
10537: <td>BUILDLINK_AUTO_VARS</td>
10538: <td>BUILDLINK_CFLAGS</td>
10539: </tr>
10540: <tr>
10541: <td>BUILDLINK_CONTENTS_FILTER</td>
10542: <td>BUILDLINK_CPPFLAGS</td>
10543: </tr>
10544: <tr>
10545: <td>BUILDLINK_DEPMETHOD</td>
10546: <td>BUILDLINK_FILES</td>
10547: </tr>
10548: <tr>
10549: <td>BUILDLINK_FILES_CMD</td>
10550: <td>BUILDLINK_FNAME_TRANSFORM</td>
10551: </tr>
10552: <tr>
10553: <td>BUILDLINK_LDFLAGS</td>
10554: <td>BUILDLINK_LIBS</td>
10555: </tr>
10556: <tr>
10557: <td>BUILDLINK_OPSYS_SUPPORT_PTHREAD</td>
10558: <td>BUILDLINK_PKGNAME</td>
10559: </tr>
10560: <tr>
10561: <td>BUILDLINK_PREFIX</td>
10562: <td>BUILDLINK_RPATHDIRS</td>
10563: </tr>
10564: <tr>
10565: <td>BUILDLINK_TREE</td>
10566: <td>BUILD_DEFS</td>
10567: </tr>
10568: <tr>
10569: <td>BUILD_DEFS_EFFECTS</td>
10570: <td>BUILD_DEPENDS</td>
10571: </tr>
10572: <tr>
10573: <td>BUILD_DIRS</td>
10574: <td>BUILD_ENV_SHELL</td>
10575: </tr>
10576: <tr>
10577: <td>BUILD_MAKE_CMD</td>
10578: <td>BUILD_MAKE_FLAGS</td>
10579: </tr>
10580: <tr>
10581: <td>BUILD_TARGET</td>
10582: <td>BUILTIN_FIND_FILES</td>
10583: </tr>
10584: <tr>
10585: <td>BUILTIN_FIND_FILES_VAR</td>
10586: <td>BUILTIN_FIND_GREP</td>
10587: </tr>
10588: <tr>
10589: <td>BUILTIN_FIND_HEADERS</td>
10590: <td>BUILTIN_FIND_HEADERS_VAR</td>
10591: </tr>
10592: <tr>
10593: <td>BUILTIN_PKG</td>
10594: <td>BUILTIN_TEST_CURSES_DEFINES</td>
10595: </tr>
10596: <tr>
10597: <td>BUILTIN_TEST_CURSES_FUNCS</td>
10598: <td>BUILTIN_VERSION_SCRIPT</td>
10599: </tr>
10600: <tr>
10601: <td>BUILTIN_X11_TYPE</td>
10602: <td>BUILTIN_X11_VERSION</td>
10603: </tr>
10604: <tr>
10605: <td>CACTI_GROUP</td>
10606: <td>CACTI_USER</td>
10607: </tr>
10608: <tr>
10609: <td>CANNA_GROUP</td>
10610: <td>CANNA_USER</td>
10611: </tr>
10612: <tr>
10613: <td>CAT</td>
10614: <td>CCACHE_BASE</td>
10615: </tr>
10616: <tr>
10617: <td>CCACHE_DIR</td>
10618: <td>CCACHE_LOGFILE</td>
10619: </tr>
10620: <tr>
10621: <td>CC_VERSION</td>
10622: <td>CC_VERSION_STRING</td>
10623: </tr>
10624: <tr>
10625: <td>CDRECORD_CONF</td>
10626: <td>CDROM_PKG_URL_DIR</td>
10627: </tr>
10628: <tr>
10629: <td>CDROM_PKG_URL_HOST</td>
10630: <td>CHECKOUT_DATE</td>
10631: </tr>
10632: <tr>
10633: <td>CHECK_FAKEHOME</td>
10634: <td>CHECK_FILES</td>
10635: </tr>
10636: <tr>
10637: <td>CHECK_FILES_SKIP</td>
10638: <td>CHECK_FILES_STRICT</td>
10639: </tr>
10640: <tr>
10641: <td>CHECK_HEADERS</td>
10642: <td>CHECK_HEADERS_SKIP</td>
10643: </tr>
10644: <tr>
10645: <td>CHECK_INTERPRETER</td>
10646: <td>CHECK_INTERPRETER_SKIP</td>
10647: </tr>
10648: <tr>
10649: <td>CHECK_PERMS</td>
10650: <td>CHECK_PERMS_AUTOFIX</td>
10651: </tr>
10652: <tr>
10653: <td>CHECK_PERMS_SKIP</td>
10654: <td>CHECK_PORTABILITY</td>
10655: </tr>
10656: <tr>
10657: <td>CHECK_PORTABILITY_SKIP</td>
10658: <td>CHECK_RELRO</td>
10659: </tr>
10660: <tr>
10661: <td>CHECK_RELRO_SKIP</td>
10662: <td>CHECK_RELRO_SUPPORTED</td>
10663: </tr>
10664: <tr>
10665: <td>CHECK_SHLIBS</td>
10666: <td>CHECK_SHLIBS_BLACKLIST</td>
10667: </tr>
10668: <tr>
10669: <td>CHECK_SHLIBS_SKIP</td>
10670: <td>CHECK_SHLIBS_SUPPORTED</td>
10671: </tr>
10672: <tr>
10673: <td>CHECK_SSP</td>
10674: <td>CHECK_SSP_SKIP</td>
10675: </tr>
10676: <tr>
10677: <td>CHECK_SSP_SUPPORTED</td>
10678: <td>CHECK_STRIPPED</td>
10679: </tr>
10680: <tr>
10681: <td>CHECK_STRIPPED_SKIP</td>
10682: <td>CHECK_WRKREF</td>
10683: </tr>
10684: <tr>
10685: <td>CHECK_WRKREF_EXTRA_DIRS</td>
10686: <td>CHECK_WRKREF_SKIP</td>
10687: </tr>
10688: <tr>
10689: <td>CLAMAV_DBDIR</td>
10690: <td>CLAMAV_GROUP</td>
10691: </tr>
10692: <tr>
10693: <td>CLAMAV_USER</td>
10694: <td>CLANGBASE</td>
10695: </tr>
10696: <tr>
10697: <td>CLEANDEPENDS</td>
10698: <td>CMAKE_DEPENDENCIES_REWRITE</td>
10699: </tr>
10700: <tr>
10701: <td>CMAKE_INSTALL_PREFIX</td>
10702: <td>CMAKE_MODULE_PATH_OVERRIDE</td>
10703: </tr>
10704: <tr>
10705: <td>CMAKE_PKGSRC_BUILD_FLAGS</td>
10706: <td>CMAKE_PREFIX_PATH</td>
10707: </tr>
10708: <tr>
10709: <td>CMAKE_USE_GNU_INSTALL_DIRS</td>
10710: <td>COMMON_LISP_DOCFILES</td>
10711: </tr>
10712: <tr>
10713: <td>COMMON_LISP_EXAMPLES</td>
10714: <td>COMMON_LISP_EXTRAFILES</td>
10715: </tr>
10716: <tr>
10717: <td>COMMON_LISP_PACKAGES</td>
10718: <td>COMMON_LISP_SYSTEM</td>
10719: </tr>
10720: <tr>
10721: <td>COMPILER_RPATH_FLAG</td>
10722: <td>COMPILER_USE_SYMLINKS</td>
10723: </tr>
10724: <tr>
10725: <td>CONFIGURE_ARGS</td>
10726: <td>CONFIGURE_DIRS</td>
10727: </tr>
10728: <tr>
10729: <td>CONFIGURE_ENV</td>
10730: <td>CONFIGURE_HAS_INFODIR</td>
10731: </tr>
10732: <tr>
10733: <td>CONFIGURE_HAS_MANDIR</td>
10734: <td>CONFIGURE_SCRIPT</td>
10735: </tr>
10736: <tr>
10737: <td>CONFIG_SHELL</td>
10738: <td>CONFIG_SHELL_FLAGS</td>
10739: </tr>
10740: <tr>
10741: <td>CONF_FILES</td>
10742: <td>CONF_FILES_MODE</td>
10743: </tr>
10744: <tr>
10745: <td>CONF_FILES_PERMS</td>
10746: <td>CONSERVER_DEFAULTHOST</td>
10747: </tr>
10748: <tr>
10749: <td>CONSERVER_DEFAULTPORT</td>
10750: <td>CP</td>
10751: </tr>
10752: <tr>
10753: <td>CPP</td>
10754: <td>CPP_PRECOMP_FLAGS</td>
10755: </tr>
10756: <tr>
10757: <td>CREATE_WRKDIR_SYMLINK</td>
10758: <td>CROSSBASE</td>
10759: </tr>
10760: <tr>
10761: <td>CTFCONVERT</td>
10762: <td>CTF_FILES_SKIP</td>
10763: </tr>
10764: <tr>
10765: <td>CTF_SUPPORTED</td>
10766: <td>CTYPE</td>
10767: </tr>
10768: <tr>
10769: <td>CUPS_GROUP</td>
10770: <td>CUPS_SYSTEM_GROUPS</td>
10771: </tr>
10772: <tr>
10773: <td>CUPS_USER</td>
10774: <td>CURSES_DEFAULT</td>
10775: </tr>
10776: <tr>
10777: <td>CURSES_TYPE</td>
10778: <td>CVS_EXTRACTDIR</td>
10779: </tr>
10780: <tr>
10781: <td>CVS_MODULE</td>
10782: <td>CVS_PROJECT</td>
10783: </tr>
10784: <tr>
10785: <td>CVS_REPOSITORIES</td>
10786: <td>CVS_ROOT</td>
10787: </tr>
10788: <tr>
10789: <td>CVS_ROOT_GNU</td>
10790: <td>CVS_ROOT_NONGNU</td>
10791: </tr>
10792: <tr>
10793: <td>CVS_ROOT_SOURCEFORGE</td>
10794: <td>CVS_TAG</td>
10795: </tr>
10796: <tr>
10797: <td>CXX</td>
10798: <td>CYRUS_GROUP</td>
10799: </tr>
10800: <tr>
10801: <td>CYRUS_IDLE</td>
10802: <td>CYRUS_USER</td>
10803: </tr>
10804: <tr>
10805: <td>DAEMONTOOLS_GROUP</td>
10806: <td>DAEMONTOOLS_LOG_USER</td>
10807: </tr>
10808: <tr>
10809: <td>DBUS_GROUP</td>
10810: <td>DBUS_USER</td>
10811: </tr>
10812: <tr>
10813: <td>DEFANG_GROUP</td>
10814: <td>DEFANG_USER</td>
10815: </tr>
10816: <tr>
10817: <td>DEFAULT_ACCEPTABLE_LICENSES</td>
10818: <td>DEFAULT_DISTFILES</td>
10819: </tr>
10820: <tr>
10821: <td>DEFAULT_IRC_SERVER</td>
10822: <td>DEFAULT_SERIAL_DEVICE</td>
10823: </tr>
10824: <tr>
10825: <td>DEF_UMASK</td>
10826: <td>DEINSTALLDEPENDS</td>
10827: </tr>
10828: <tr>
10829: <td>DEINSTALL_SRC</td>
10830: <td>DEINSTALL_TEMPLATES</td>
10831: </tr>
10832: <tr>
10833: <td>DELAYED_ERROR_MSG</td>
10834: <td>DELAYED_WARNING_MSG</td>
10835: </tr>
10836: <tr>
10837: <td>DEPENDS</td>
10838: <td>DEPENDS_TARGET</td>
10839: </tr>
10840: <tr>
10841: <td>DEPENDS_TYPE</td>
10842: <td>DESTDIR</td>
10843: </tr>
10844: <tr>
10845: <td>DESTDIR_VARNAME</td>
10846: <td>DIALER_GROUP</td>
10847: </tr>
10848: <tr>
10849: <td>DIGEST_REQD</td>
10850: <td>DISTDIR</td>
10851: </tr>
10852: <tr>
10853: <td>DISTFILES</td>
10854: <td>DISTINFO_FILE</td>
10855: </tr>
10856: <tr>
10857: <td>DISTNAME</td>
10858: <td>DIST_PATH</td>
10859: </tr>
10860: <tr>
10861: <td>DIST_SUBDIR</td>
10862: <td>DJBDNS_AXFR_USER</td>
10863: </tr>
10864: <tr>
10865: <td>DJBDNS_CACHE_USER</td>
10866: <td>DJBDNS_DJBDNS_GROUP</td>
10867: </tr>
10868: <tr>
10869: <td>DJBDNS_LOG_USER</td>
10870: <td>DJBDNS_RBL_USER</td>
10871: </tr>
10872: <tr>
10873: <td>DJBDNS_TINY_USER</td>
10874: <td>DLOPEN_REQUIRE_PTHREADS</td>
10875: </tr>
10876: <tr>
10877: <td>DL_AUTO_VARS</td>
10878: <td>DL_CFLAGS</td>
10879: </tr>
10880: <tr>
10881: <td>DL_LDFLAGS</td>
10882: <td>DL_LIBS</td>
10883: </tr>
10884: <tr>
10885: <td>DNS</td>
10886: <td>DOWNLOADED_DISTFILE</td>
10887: </tr>
10888: <tr>
10889: <td>DT_LAYOUT</td>
10890: <td>DYNAMIC_SITES_CMD</td>
10891: </tr>
10892: <tr>
10893: <td>DYNAMIC_SITES_SCRIPT</td>
10894: <td>ECHO</td>
10895: </tr>
10896: <tr>
10897: <td>ECHO_N</td>
10898: <td>ELK_GUI</td>
10899: </tr>
10900: <tr>
10901: <td>EMACS_TYPE</td>
10902: <td>EMULDIR</td>
10903: </tr>
10904: <tr>
10905: <td>EMULSUBDIR</td>
10906: <td>EMULSUBDIRSLASH</td>
10907: </tr>
10908: <tr>
10909: <td>EMUL_ARCH</td>
10910: <td>EMUL_DISTRO</td>
10911: </tr>
10912: <tr>
10913: <td>EMUL_EXEC_FMT</td>
10914: <td>EMUL_IS_NATIVE</td>
10915: </tr>
10916: <tr>
10917: <td>EMUL_MODULES</td>
10918: <td>EMUL_OPSYS</td>
10919: </tr>
10920: <tr>
10921: <td>EMUL_PKG_FMT</td>
10922: <td>EMUL_PLATFORM</td>
10923: </tr>
10924: <tr>
10925: <td>EMUL_PLATFORMS</td>
10926: <td>EMUL_PREFER</td>
10927: </tr>
10928: <tr>
10929: <td>EMUL_REQD</td>
10930: <td>EMUL_TYPE</td>
10931: </tr>
10932: <tr>
10933: <td>ERROR_MSG</td>
10934: <td>EXIM_GROUP</td>
10935: </tr>
10936: <tr>
10937: <td>EXIM_USER</td>
10938: <td>EXPORT_SYMBOLS_LDFLAGS</td>
10939: </tr>
10940: <tr>
10941: <td>EXTRACTOR</td>
10942: <td>EXTRACT_CMD</td>
10943: </tr>
10944: <tr>
10945: <td>EXTRACT_CMD_DEFAULT</td>
10946: <td>EXTRACT_DIR</td>
10947: </tr>
10948: <tr>
10949: <td>EXTRACT_ELEMENTS</td>
10950: <td>EXTRACT_ENV</td>
10951: </tr>
10952: <tr>
10953: <td>EXTRACT_ONLY</td>
10954: <td>EXTRACT_OPTS</td>
10955: </tr>
10956: <tr>
10957: <td>EXTRACT_SUFX</td>
10958: <td>EXTRACT_USING</td>
10959: </tr>
10960: <tr>
10961: <td>FAILOVER_FETCH</td>
10962: <td>FAIL_MSG</td>
10963: </tr>
10964: <tr>
10965: <td>FAKE_NCURSES</td>
10966: <td>FAM</td>
10967: </tr>
10968: <tr>
10969: <td>FAM_ACCEPTED</td>
10970: <td>FAM_DEFAULT</td>
10971: </tr>
10972: <tr>
10973: <td>FAM_SERVER</td>
10974: <td>FCPATH</td>
10975: </tr>
10976: <tr>
10977: <td>FEATURE_CPPFLAGS</td>
10978: <td>FEATURE_LDFLAGS</td>
10979: </tr>
10980: <tr>
10981: <td>FEATURE_LIBS</td>
10982: <td>FETCH_AFTER_ARGS</td>
10983: </tr>
10984: <tr>
10985: <td>FETCH_BEFORE_ARGS</td>
10986: <td>FETCH_CMD</td>
10987: </tr>
10988: <tr>
10989: <td>FETCH_OUTPUT_ARGS</td>
10990: <td>FETCH_PROXY</td>
10991: </tr>
10992: <tr>
10993: <td>FETCH_RESUME_ARGS</td>
10994: <td>FETCH_USING</td>
10995: </tr>
10996: <tr>
10997: <td>FILES_SUBST</td>
10998: <td>FILES_SUBST_SED</td>
10999: </tr>
11000: <tr>
11001: <td>FIX_SYSTEM_HEADERS</td>
11002: <td>FLUXBOX_USE_GNOME</td>
11003: </tr>
11004: <tr>
11005: <td>FLUXBOX_USE_KDE</td>
11006: <td>FLUXBOX_USE_XFT</td>
11007: </tr>
11008: <tr>
11009: <td>FLUXBOX_USE_XINERAMA</td>
11010: <td>FONTDIR</td>
11011: </tr>
11012: <tr>
11013: <td>FONTS_DIRS</td>
11014: <td>FONTS_VERBOSE</td>
11015: </tr>
11016: <tr>
11017: <td>FOO_HACKS_MK</td>
11018: <td>FOSSIL_EXTRACTDIR</td>
11019: </tr>
11020: <tr>
11021: <td>FOSSIL_REPO</td>
11022: <td>FOSSIL_REPOSITORIES</td>
11023: </tr>
11024: <tr>
11025: <td>FOSSIL_VERSION</td>
11026: <td>FOX_USE_XUNICODE</td>
11027: </tr>
11028: <tr>
11029: <td>FREEWNN_GROUP</td>
11030: <td>FREEWNN_USER</td>
11031: </tr>
11032: <tr>
11033: <td>FTP_PKG_URL_DIR</td>
11034: <td>FTP_PKG_URL_HOST</td>
11035: </tr>
11036: <tr>
11037: <td>GAMEDATAMODE</td>
11038: <td>GAMEDATA_PERMS</td>
11039: </tr>
11040: <tr>
11041: <td>GAMEDIRMODE</td>
11042: <td>GAMEDIR_PERMS</td>
11043: </tr>
11044: <tr>
11045: <td>GAMEGRP</td>
11046: <td>GAMEMODE</td>
11047: </tr>
11048: <tr>
11049: <td>GAMEOWN</td>
11050: <td>GAMES_GROUP</td>
11051: </tr>
11052: <tr>
11053: <td>GAMES_USER</td>
11054: <td>GCC</td>
11055: </tr>
11056: <tr>
11057: <td>GCCBASE</td>
11058: <td>GCC_REQD</td>
11059: </tr>
11060: <tr>
11061: <td>GCC_VERSION_SUFFIX</td>
11062: <td>GEM_BUILD</td>
11063: </tr>
11064: <tr>
11065: <td>GEM_CLEANBUILD</td>
11066: <td>GEM_CLEANBUILD_EXTENSIONS</td>
11067: </tr>
11068: <tr>
11069: <td>GEM_DOCDIR</td>
11070: <td>GEM_EXTSDIR</td>
11071: </tr>
11072: <tr>
11073: <td>GEM_HOME</td>
11074: <td>GEM_LIBDIR</td>
11075: </tr>
11076: <tr>
11077: <td>GEM_NAME</td>
11078: <td>GEM_PATH</td>
11079: </tr>
11080: <tr>
11081: <td>GEM_SPECFILE</td>
11082: <td>GENERATE_PLIST</td>
11083: </tr>
11084: <tr>
11085: <td>GHOSTSCRIPT_REQD</td>
11086: <td>GITHUB_PROJECT</td>
11087: </tr>
11088: <tr>
11089: <td>GITHUB_RELEASE</td>
11090: <td>GITHUB_TAG</td>
11091: </tr>
11092: <tr>
11093: <td>GITHUB_TYPE</td>
11094: <td>GIT_BRANCH</td>
11095: </tr>
11096: <tr>
11097: <td>GIT_ENV</td>
11098: <td>GIT_EXTRACTDIR</td>
11099: </tr>
11100: <tr>
11101: <td>GIT_REPO</td>
11102: <td>GIT_REPOSITORIES</td>
11103: </tr>
11104: <tr>
11105: <td>GIT_REVISION</td>
11106: <td>GIT_TAG</td>
11107: </tr>
11108: <tr>
11109: <td>GNU</td>
11110: <td>GNU_CONFIGURE</td>
11111: </tr>
11112: <tr>
11113: <td>GNU_CONFIGURE_INFODIR</td>
11114: <td>GNU_CONFIGURE_MANDIR</td>
11115: </tr>
11116: <tr>
11117: <td>GNU_CONFIGURE_STRICT</td>
11118: <td>GODEP_REDIRECTS</td>
11119: </tr>
11120: <tr>
11121: <td>GO_BUILD_PATTERN</td>
11122: <td>GO_DEPS</td>
11123: </tr>
11124: <tr>
11125: <td>GO_DIST_BASE</td>
11126: <td>GO_SRCPATH</td>
11127: </tr>
11128: <tr>
11129: <td>GROUP_SPECIFIC_PKGS</td>
11130: <td>GRUB_NETWORK_CARDS</td>
11131: </tr>
11132: <tr>
11133: <td>GRUB_PRESET_COMMAND</td>
11134: <td>GRUB_SCAN_ARGS</td>
11135: </tr>
11136: <tr>
11137: <td>GZIP</td>
11138: <td>HASKELL_COMPILER</td>
11139: </tr>
11140: <tr>
11141: <td>HASKELL_ENABLE_HADDOCK_DOCUMENTATION</td>
11142: <td>HASKELL_ENABLE_LIBRARY_PROFILING</td>
11143: </tr>
11144: <tr>
11145: <td>HASKELL_ENABLE_SHARED_LIBRARY</td>
11146: <td>HAS_CONFIGURE</td>
11147: </tr>
11148: <tr>
11149: <td>HEADER_TEMPLATES</td>
11150: <td>HG_REPO</td>
11151: </tr>
11152: <tr>
11153: <td>HG_REPOSITORIES</td>
11154: <td>HG_TAG</td>
11155: </tr>
11156: <tr>
11157: <td>HOST_PKGTOOLS_ARGS</td>
11158: <td>HOST_SPECIFIC_PKGS</td>
11159: </tr>
11160: <tr>
11161: <td>HOWL_GROUP</td>
11162: <td>HOWL_USER</td>
11163: </tr>
11164: <tr>
11165: <td>ICCBASE</td>
11166: <td>ICECAST_CHROOTDIR</td>
11167: </tr>
11168: <tr>
11169: <td>ICON_THEMES</td>
11170: <td>IDOBASE</td>
11171: </tr>
11172: <tr>
11173: <td>IGNORE_CCACHE</td>
11174: <td>IGNORE_INFO_DIRS</td>
11175: </tr>
11176: <tr>
11177: <td>IGNORE_INTERACTIVE_FETCH</td>
11178: <td>IMAKE</td>
11179: </tr>
11180: <tr>
11181: <td>IMAKEOPTS</td>
11182: <td>IMAKE_MAKE</td>
11183: </tr>
11184: <tr>
11185: <td>IMAKE_MANINSTALL</td>
11186: <td>IMAP_UW_CCLIENT_MBOX_FMT</td>
11187: </tr>
11188: <tr>
11189: <td>IMDICTDIR</td>
11190: <td>INCOMPAT_CURSES</td>
11191: </tr>
11192: <tr>
11193: <td>INFO_DIR</td>
11194: <td>INFO_FILES</td>
11195: </tr>
11196: <tr>
11197: <td>INFO_FILES_VERBOSE</td>
11198: <td>INFO_MSG</td>
11199: </tr>
11200: <tr>
11201: <td>INIT_SYSTEM</td>
11202: <td>INN_DATA_DIR</td>
11203: </tr>
11204: <tr>
11205: <td>INN_GROUP</td>
11206: <td>INN_USER</td>
11207: </tr>
11208: <tr>
11209: <td>INSTALLATION_DIRS</td>
11210: <td>INSTALLATION_DIRS_FROM_PLIST</td>
11211: </tr>
11212: <tr>
11213: <td>INSTALL_ENV</td>
11214: <td>INSTALL_SH_OVERRIDE</td>
11215: </tr>
11216: <tr>
11217: <td>INSTALL_SRC</td>
11218: <td>INSTALL_TEMPLATES</td>
11219: </tr>
11220: <tr>
11221: <td>INSTALL_UNSTRIPPED</td>
11222: <td>IRCD_HYBRID_IRC_GROUP</td>
11223: </tr>
11224: <tr>
11225: <td>IRCD_HYBRID_IRC_USER</td>
11226: <td>IRCD_HYBRID_MAXCONN</td>
11227: </tr>
11228: <tr>
11229: <td>IRCD_HYBRID_NICLEN</td>
11230: <td>IRCD_HYBRID_SYSLOG_EVENTS</td>
11231: </tr>
11232: <tr>
11233: <td>IRCD_HYBRID_SYSLOG_FACILITY</td>
11234: <td>IRCD_HYBRID_TOPICLEN</td>
11235: </tr>
11236: <tr>
11237: <td>IRIX</td>
11238: <td>IRRD_USE_PGP</td>
11239: </tr>
11240: <tr>
11241: <td>JABBERD_GROUP</td>
11242: <td>JABBERD_LOGDIR</td>
11243: </tr>
11244: <tr>
11245: <td>JABBERD_PIDDIR</td>
11246: <td>JABBERD_SPOOLDIR</td>
11247: </tr>
11248: <tr>
11249: <td>JABBERD_USER</td>
11250: <td>JAKARTA_HOME</td>
11251: </tr>
11252: <tr>
11253: <td>JAVA_APP_PATH</td>
11254: <td>JAVA_APP_TARGETS</td>
11255: </tr>
11256: <tr>
11257: <td>JAVA_BINPREFIX</td>
11258: <td>JAVA_CLASSPATH</td>
11259: </tr>
11260: <tr>
11261: <td>JAVA_HOME</td>
11262: <td>JAVA_LD_LIBRARY_PATH</td>
11263: </tr>
11264: <tr>
11265: <td>JAVA_NAME</td>
11266: <td>JAVA_UNLIMIT</td>
11267: </tr>
11268: <tr>
11269: <td>JAVA_WRAPPERS</td>
11270: <td>JPEG_ACCEPTED</td>
11271: </tr>
11272: <tr>
11273: <td>JPEG_DEFAULT</td>
11274: <td>KERBEROS</td>
11275: </tr>
11276: <tr>
11277: <td>KERMIT_SUID_UUCP</td>
11278: <td>KJS_USE_PCRE</td>
11279: </tr>
11280: <tr>
11281: <td>KNEWS_DOMAIN_FILE</td>
11282: <td>KNEWS_DOMAIN_NAME</td>
11283: </tr>
11284: <tr>
11285: <td>KRB5_ACCEPTED</td>
11286: <td>KRB5_DEFAULT</td>
11287: </tr>
11288: <tr>
11289: <td>LANGUAGES</td>
11290: <td>LATEX2HTML_ICONPATH</td>
11291: </tr>
11292: <tr>
11293: <td>LDCONFIG_ADD_CMD</td>
11294: <td>LDCONFIG_REMOVE_CMD</td>
11295: </tr>
11296: <tr>
11297: <td>LEAFNODE_DATA_DIR</td>
11298: <td>LEAFNODE_GROUP</td>
11299: </tr>
11300: <tr>
11301: <td>LEAFNODE_USER</td>
11302: <td>LIBDVDCSS_HOMEPAGE</td>
11303: </tr>
11304: <tr>
11305: <td>LIBDVDCSS_MASTER_SITES</td>
1.270 ! leot 11306: <td>LIBRSVG_TYPE</td>
! 11307: </tr>
! 11308: <tr>
1.269 leot 11309: <td>LIBTOOL</td>
1.270 ! leot 11310: <td>LIBTOOLIZE_PLIST</td>
1.269 leot 11311: </tr>
11312: <tr>
11313: <td>LIBTOOL_M4_OVERRIDE</td>
1.270 ! leot 11314: <td>LIBUSB_TYPE</td>
1.269 leot 11315: </tr>
11316: <tr>
11317: <td>LICENSE</td>
1.270 ! leot 11318: <td>LINKER_RPATH_FLAG</td>
1.269 leot 11319: </tr>
11320: <tr>
11321: <td>LINK_RPATH_FLAG</td>
1.270 ! leot 11322: <td>LINUX_BASE_NODEPS</td>
1.269 leot 11323: </tr>
11324: <tr>
11325: <td>LINUX_BASE_PREFERRED</td>
1.270 ! leot 11326: <td>LINUX_BASE_REQUIRED</td>
1.269 leot 11327: </tr>
11328: <tr>
11329: <td>LINUX_LOCALES</td>
1.270 ! leot 11330: <td>LOCALBASE</td>
1.269 leot 11331: </tr>
11332: <tr>
11333: <td>LOCALBASE_LOCKTYPE</td>
1.270 ! leot 11334: <td>LOCALPATCHES</td>
1.269 leot 11335: </tr>
11336: <tr>
11337: <td>LOVE_DATA</td>
1.270 ! leot 11338: <td>LOVE_GAME</td>
1.269 leot 11339: </tr>
11340: <tr>
11341: <td>LOVE_VERSION</td>
1.270 ! leot 11342: <td>LP64PLATFORMS</td>
1.269 leot 11343: </tr>
11344: <tr>
11345: <td>MACHINE_PLATFORM</td>
1.270 ! leot 11346: <td>MAILAGENT_DOMAIN</td>
1.269 leot 11347: </tr>
11348: <tr>
11349: <td>MAILAGENT_EMAIL</td>
1.270 ! leot 11350: <td>MAILAGENT_FQDN</td>
1.269 leot 11351: </tr>
11352: <tr>
11353: <td>MAILAGENT_ORGANIZATION</td>
1.270 ! leot 11354: <td>MAJORDOMO_HOMEDIR</td>
1.269 leot 11355: </tr>
11356: <tr>
11357: <td>MAJOR_OS_VERSION</td>
1.270 ! leot 11358: <td>MAKEINFO_ARGS</td>
1.269 leot 11359: </tr>
11360: <tr>
11361: <td>MAKE_DIRS</td>
1.270 ! leot 11362: <td>MAKE_DIRS_PERMS</td>
1.269 leot 11363: </tr>
11364: <tr>
11365: <td>MAKE_ENV</td>
1.270 ! leot 11366: <td>MAKE_FILE</td>
1.269 leot 11367: </tr>
11368: <tr>
11369: <td>MAKE_FLAGS</td>
1.270 ! leot 11370: <td>MAKE_JOBS</td>
1.269 leot 11371: </tr>
11372: <tr>
11373: <td>MAKE_JOBS_SAFE</td>
1.270 ! leot 11374: <td>MAKE_PROGRAM</td>
1.269 leot 11375: </tr>
11376: <tr>
11377: <td>MANINSTALL</td>
1.270 ! leot 11378: <td>MANZ</td>
1.269 leot 11379: </tr>
11380: <tr>
11381: <td>MASTER_SITES</td>
1.270 ! leot 11382: <td>MASTER_SITE_BACKUP</td>
1.269 leot 11383: </tr>
11384: <tr>
11385: <td>MASTER_SITE_CYGWIN</td>
1.270 ! leot 11386: <td>MASTER_SITE_GNOME</td>
1.269 leot 11387: </tr>
11388: <tr>
11389: <td>MASTER_SITE_GNU</td>
1.270 ! leot 11390: <td>MASTER_SITE_LOCAL</td>
1.269 leot 11391: </tr>
11392: <tr>
11393: <td>MASTER_SITE_MOZILLA</td>
1.270 ! leot 11394: <td>MASTER_SITE_OPENOFFICE</td>
1.269 leot 11395: </tr>
11396: <tr>
11397: <td>MASTER_SITE_OVERRIDE</td>
1.270 ! leot 11398: <td>MASTER_SITE_PERL_CPAN</td>
1.269 leot 11399: </tr>
11400: <tr>
11401: <td>MASTER_SITE_SUNSITE</td>
1.270 ! leot 11402: <td>MASTER_SITE_SUSE</td>
1.269 leot 11403: </tr>
11404: <tr>
11405: <td>MASTER_SITE_TEX_CTAN</td>
1.270 ! leot 11406: <td>MASTER_SITE_XCONTRIB</td>
1.269 leot 11407: </tr>
11408: <tr>
11409: <td>MASTER_SITE_XEMACS</td>
1.270 ! leot 11410: <td>MASTER_SORT</td>
1.269 leot 11411: </tr>
11412: <tr>
11413: <td>MASTER_SORT_RANDOM</td>
1.270 ! leot 11414: <td>MASTER_SORT_REGEX</td>
1.269 leot 11415: </tr>
11416: <tr>
11417: <td>MECAB_CHARSET</td>
1.270 ! leot 11418: <td>MEDIATOMB_GROUP</td>
1.269 leot 11419: </tr>
11420: <tr>
11421: <td>MEDIATOMB_USER</td>
1.270 ! leot 11422: <td>MIPSPROBASE</td>
1.269 leot 11423: </tr>
11424: <tr>
11425: <td>MIREDO_GROUP</td>
1.270 ! leot 11426: <td>MIREDO_USER</td>
1.269 leot 11427: </tr>
11428: <tr>
11429: <td>MISSING_FEATURES</td>
1.270 ! leot 11430: <td>MKDIR</td>
1.269 leot 11431: </tr>
11432: <tr>
11433: <td>MLDONKEY_GROUP</td>
1.270 ! leot 11434: <td>MLDONKEY_HOME</td>
1.269 leot 11435: </tr>
11436: <tr>
11437: <td>MLDONKEY_USER</td>
1.270 ! leot 11438: <td>MONOTONE_GROUP</td>
1.269 leot 11439: </tr>
11440: <tr>
11441: <td>MONOTONE_USER</td>
1.270 ! leot 11442: <td>MOTIFBASE</td>
1.269 leot 11443: </tr>
11444: <tr>
11445: <td>MOTIF_TYPE</td>
1.270 ! leot 11446: <td>MOTIF_TYPE_DEFAULT</td>
1.269 leot 11447: </tr>
11448: <tr>
11449: <td>MPI_TYPE</td>
1.270 ! leot 11450: <td>MSGFMT_STRIP_MSGCTXT</td>
1.269 leot 11451: </tr>
11452: <tr>
11453: <td>MSGFMT_STRIP_MSGID_PLURAL</td>
1.270 ! leot 11454: <td>MTOOLS_ENABLE_FLOPPYD</td>
1.269 leot 11455: </tr>
11456: <tr>
11457: <td>MUST</td>
1.270 ! leot 11458: <td>MV</td>
1.269 leot 11459: </tr>
11460: <tr>
11461: <td>MYSQL_CHARSET</td>
1.270 ! leot 11462: <td>MYSQL_DATADIR</td>
1.269 leot 11463: </tr>
11464: <tr>
11465: <td>MYSQL_EXTRA_CHARSET</td>
1.270 ! leot 11466: <td>MYSQL_GROUP</td>
1.269 leot 11467: </tr>
11468: <tr>
11469: <td>MYSQL_PKGSRCDIR</td>
1.270 ! leot 11470: <td>MYSQL_USER</td>
1.269 leot 11471: </tr>
11472: <tr>
11473: <td>MYSQL_VERSIONS_ACCEPTED</td>
1.270 ! leot 11474: <td>MYSQL_VERSION_DEFAULT</td>
1.269 leot 11475: </tr>
11476: <tr>
11477: <td>NAGIOSCMD_GROUP</td>
1.270 ! leot 11478: <td>NAGIOSDIR</td>
1.269 leot 11479: </tr>
11480: <tr>
11481: <td>NAGIOS_GROUP</td>
1.270 ! leot 11482: <td>NAGIOS_USER</td>
1.269 leot 11483: </tr>
11484: <tr>
11485: <td>NATIVE_APPEND_ABI</td>
1.270 ! leot 11486: <td>NATIVE_APPEND_ELF</td>
1.269 leot 11487: </tr>
11488: <tr>
11489: <td>NATIVE_EXEC_FMT</td>
1.270 ! leot 11490: <td>NATIVE_MACHINE_PLATFORM</td>
1.269 leot 11491: </tr>
11492: <tr>
11493: <td>NATIVE_OBJECT_FMT</td>
1.270 ! leot 11494: <td>NBPAX_PROGRAM_PREFIX</td>
1.269 leot 11495: </tr>
11496: <tr>
11497: <td>NETBSD_LOGIN_NAME</td>
1.270 ! leot 11498: <td>NMH_EDITOR</td>
1.269 leot 11499: </tr>
11500: <tr>
11501: <td>NMH_MTA</td>
1.270 ! leot 11502: <td>NMH_PAGER</td>
1.269 leot 11503: </tr>
11504: <tr>
11505: <td>NOLOGIN</td>
1.270 ! leot 11506: <td>NONZERO_FILESIZE_P</td>
1.269 leot 11507: </tr>
11508: <tr>
11509: <td>NOTE</td>
1.270 ! leot 11510: <td>NOT_FOR_PLATFORM</td>
1.269 leot 11511: </tr>
11512: <tr>
11513: <td>NOT_PAX_ASLR_SAFE</td>
1.270 ! leot 11514: <td>NOT_PAX_MPROTECT_SAFE</td>
1.269 leot 11515: </tr>
11516: <tr>
11517: <td>NO_BUILD</td>
1.270 ! leot 11518: <td>NO_CHECKSUM</td>
1.269 leot 11519: </tr>
11520: <tr>
11521: <td>NO_CONFIGURE</td>
1.270 ! leot 11522: <td>NO_SKIP</td>
1.269 leot 11523: </tr>
11524: <tr>
11525: <td>NS_PREFERRED</td>
1.270 ! leot 11526: <td>NULLMAILER_GROUP</td>
1.269 leot 11527: </tr>
11528: <tr>
11529: <td>NULLMAILER_USER</td>
1.270 ! leot 11530: <td>OASIS</td>
1.269 leot 11531: </tr>
11532: <tr>
11533: <td>OASIS_BUILD_ARGS</td>
1.270 ! leot 11534: <td>OBJHOSTNAME</td>
1.269 leot 11535: </tr>
11536: <tr>
11537: <td>OBJMACHINE</td>
1.270 ! leot 11538: <td>OCAML_FINDLIB_DIRS</td>
1.269 leot 11539: </tr>
11540: <tr>
11541: <td>OCAML_FINDLIB_REGISTER</td>
1.270 ! leot 11542: <td>OCAML_FINDLIB_REGISTER_VERBOSE</td>
1.269 leot 11543: </tr>
11544: <tr>
11545: <td>OCAML_SITELIBDIR</td>
1.270 ! leot 11546: <td>OCAML_TOPKG_DOCDIR</td>
1.269 leot 11547: </tr>
11548: <tr>
11549: <td>OCAML_USE_DUNE</td>
1.270 ! leot 11550: <td>OCAML_USE_FINDLIB</td>
1.269 leot 11551: </tr>
11552: <tr>
11553: <td>OCAML_USE_JBUILDER</td>
1.270 ! leot 11554: <td>OCAML_USE_OASIS</td>
1.269 leot 11555: </tr>
11556: <tr>
11557: <td>OCAML_USE_OASIS_DYNRUN</td>
1.270 ! leot 11558: <td>OCAML_USE_OPAM</td>
1.269 leot 11559: </tr>
11560: <tr>
11561: <td>OCAML_USE_OPT_COMPILER</td>
1.270 ! leot 11562: <td>OCAML_USE_TOPKG</td>
1.269 leot 11563: </tr>
11564: <tr>
11565: <td>OMF</td>
1.270 ! leot 11566: <td>ONLY_FOR_COMPILER</td>
1.269 leot 11567: </tr>
11568: <tr>
11569: <td>ONLY_FOR_PLATFORM</td>
1.270 ! leot 11570: <td>OPENSSH_CHROOT</td>
1.269 leot 11571: </tr>
11572: <tr>
11573: <td>OPENSSH_GROUP</td>
1.270 ! leot 11574: <td>OPENSSH_USER</td>
1.269 leot 11575: </tr>
11576: <tr>
11577: <td>OPSYS</td>
1.270 ! leot 11578: <td>OPSYS_EMULDIR</td>
1.269 leot 11579: </tr>
11580: <tr>
11581: <td>OSS_TYPE</td>
1.270 ! leot 11582: <td>OSX</td>
1.269 leot 11583: </tr>
11584: <tr>
11585: <td>OSX_TOLERATE_SDK_SKEW</td>
1.270 ! leot 11586: <td>OS_HAVE_ALSA</td>
1.269 leot 11587: </tr>
11588: <tr>
11589: <td>OS_HAVE_RCD</td>
1.270 ! leot 11590: <td>OS_VARIANT</td>
1.269 leot 11591: </tr>
11592: <tr>
11593: <td>OS_VERSION</td>
1.270 ! leot 11594: <td>OTF_FONTS_DIR</td>
1.269 leot 11595: </tr>
11596: <tr>
11597: <td>OVERRIDE_DIRDEPTH</td>
1.270 ! leot 11598: <td>OVERRIDE_GEMSPEC</td>
1.269 leot 11599: </tr>
11600: <tr>
11601: <td>OVERRIDE_GNU_CONFIG_SCRIPTS</td>
1.270 ! leot 11602: <td>OVERRIDE_ROCKSPEC</td>
1.269 leot 11603: </tr>
11604: <tr>
11605: <td>OWN_DIRS</td>
1.270 ! leot 11606: <td>OWN_DIRS_PERMS</td>
1.269 leot 11607: </tr>
11608: <tr>
11609: <td>P4GROUP</td>
1.270 ! leot 11610: <td>P4PORT</td>
1.269 leot 11611: </tr>
11612: <tr>
11613: <td>P4ROOT</td>
1.270 ! leot 11614: <td>P4USER</td>
1.269 leot 11615: </tr>
11616: <tr>
11617: <td>PACKAGES</td>
1.270 ! leot 11618: <td>PALMOS_DEFAULT_SDK</td>
1.269 leot 11619: </tr>
11620: <tr>
11621: <td>PAMBASE</td>
1.270 ! leot 11622: <td>PAM_DEFAULT</td>
1.269 leot 11623: </tr>
11624: <tr>
11625: <td>PAPERSIZE</td>
1.270 ! leot 11626: <td>PASSIVE_FETCH</td>
1.269 leot 11627: </tr>
11628: <tr>
11629: <td>PATCHDIR</td>
1.270 ! leot 11630: <td>PATCHFILES</td>
1.269 leot 11631: </tr>
11632: <tr>
11633: <td>PATCH_ARGS</td>
1.270 ! leot 11634: <td>PATCH_DEBUG</td>
1.269 leot 11635: </tr>
11636: <tr>
11637: <td>PATCH_DIST_ARGS</td>
1.270 ! leot 11638: <td>PATCH_DIST_CAT</td>
1.269 leot 11639: </tr>
11640: <tr>
11641: <td>PATCH_DIST_STRIP</td>
1.270 ! leot 11642: <td>PATCH_FUZZ_FACTOR</td>
1.269 leot 11643: </tr>
11644: <tr>
11645: <td>PATCH_STRIP</td>
1.270 ! leot 11646: <td>PATH</td>
1.269 leot 11647: </tr>
11648: <tr>
11649: <td>PCCBASE</td>
1.270 ! leot 11650: <td>PEAR</td>
1.269 leot 11651: </tr>
11652: <tr>
11653: <td>PEAR_CHANNEL</td>
1.270 ! leot 11654: <td>PEAR_CHANNEL_ALIAS</td>
1.269 leot 11655: </tr>
11656: <tr>
11657: <td>PEAR_CHANNEL_VERSION</td>
1.270 ! leot 11658: <td>PEAR_CMD</td>
1.269 leot 11659: </tr>
11660: <tr>
11661: <td>PEAR_LIB</td>
1.270 ! leot 11662: <td>PEAR_PACKAGE_XML</td>
1.269 leot 11663: </tr>
11664: <tr>
11665: <td>PERL5</td>
1.270 ! leot 11666: <td>PERL5_CONFIGURE</td>
1.269 leot 11667: </tr>
11668: <tr>
11669: <td>PERL5_CONFIGURE_DIRS</td>
1.270 ! leot 11670: <td>PERL5_LDFLAGS</td>
1.269 leot 11671: </tr>
11672: <tr>
11673: <td>PERL5_LICENSE</td>
1.270 ! leot 11674: <td>PERL5_MODULE_TYPE</td>
1.269 leot 11675: </tr>
11676: <tr>
11677: <td>PERL5_PACKLIST</td>
1.270 ! leot 11678: <td>PERL5_PACKLIST_DIR</td>
1.269 leot 11679: </tr>
11680: <tr>
11681: <td>PERL5_PERLBASE</td>
1.270 ! leot 11682: <td>PERL5_SITEBASE</td>
1.269 leot 11683: </tr>
11684: <tr>
11685: <td>PERL5_USE_PACKLIST</td>
1.270 ! leot 11686: <td>PERL5_VENDORBASE</td>
1.269 leot 11687: </tr>
11688: <tr>
11689: <td>PFCTL</td>
1.270 ! leot 11690: <td>PFVAR_H</td>
1.269 leot 11691: </tr>
11692: <tr>
11693: <td>PF_VERSION</td>
1.270 ! leot 11694: <td>PGGROUP</td>
1.269 leot 11695: </tr>
11696: <tr>
11697: <td>PGHOME</td>
1.270 ! leot 11698: <td>PGPKGSRCDIR</td>
1.269 leot 11699: </tr>
11700: <tr>
11701: <td>PGSQL_TYPE</td>
1.270 ! leot 11702: <td>PGSQL_VERSIONS_ACCEPTED</td>
1.269 leot 11703: </tr>
11704: <tr>
11705: <td>PGSQL_VERSION_DEFAULT</td>
1.270 ! leot 11706: <td>PGUSER</td>
1.269 leot 11707: </tr>
11708: <tr>
11709: <td>PG_LIB_EXT</td>
1.270 ! leot 11710: <td>PHP</td>
1.269 leot 11711: </tr>
11712: <tr>
11713: <td>PHPCOMMON_MK</td>
1.270 ! leot 11714: <td>PHPPKGSRCDIR</td>
1.269 leot 11715: </tr>
11716: <tr>
11717: <td>PHP_BASE_VERS</td>
1.270 ! leot 11718: <td>PHP_CHECK_INSTALLED</td>
1.269 leot 11719: </tr>
11720: <tr>
11721: <td>PHP_EXTENSION_DIR</td>
1.270 ! leot 11722: <td>PHP_INITIAL_TEENY</td>
1.269 leot 11723: </tr>
11724: <tr>
11725: <td>PHP_PKG_PREFIX</td>
1.270 ! leot 11726: <td>PHP_VERSION</td>
1.269 leot 11727: </tr>
11728: <tr>
11729: <td>PHP_VERSIONS_ACCEPTED</td>
1.270 ! leot 11730: <td>PHP_VERSIONS_INCOMPATIBLE</td>
1.269 leot 11731: </tr>
11732: <tr>
11733: <td>PHP_VERSION_DEFAULT</td>
1.270 ! leot 11734: <td>PHP_VERSION_REQD</td>
1.269 leot 11735: </tr>
11736: <tr>
11737: <td>PILRC_USE_GTK</td>
1.270 ! leot 11738: <td>PKGCONFIG_BASE</td>
1.269 leot 11739: </tr>
11740: <tr>
11741: <td>PKGCONFIG_FILE</td>
1.270 ! leot 11742: <td>PKGCONFIG_OVERRIDE</td>
1.269 leot 11743: </tr>
11744: <tr>
11745: <td>PKGCONFIG_OVERRIDE_STAGE</td>
1.270 ! leot 11746: <td>PKGDIR</td>
1.269 leot 11747: </tr>
11748: <tr>
11749: <td>PKGGNUDIR</td>
1.270 ! leot 11750: <td>PKGINFODIR</td>
1.269 leot 11751: </tr>
11752: <tr>
11753: <td>PKGLOCALEDIR</td>
1.270 ! leot 11754: <td>PKGMANDIR</td>
1.269 leot 11755: </tr>
11756: <tr>
11757: <td>PKGNAME</td>
1.270 ! leot 11758: <td>PKGNAME_REQD</td>
1.269 leot 11759: </tr>
11760: <tr>
11761: <td>PKGPATH</td>
1.270 ! leot 11762: <td>PKGREVISION</td>
1.269 leot 11763: </tr>
11764: <tr>
11765: <td>PKGSRC_CHANGES</td>
1.270 ! leot 11766: <td>PKGSRC_COMPILER</td>
1.269 leot 11767: </tr>
11768: <tr>
11769: <td>PKGSRC_KEEP_BIN_PKGS</td>
1.270 ! leot 11770: <td>PKGSRC_LOCKTYPE</td>
1.269 leot 11771: </tr>
11772: <tr>
11773: <td>PKGSRC_MAKE_ENV</td>
1.270 ! leot 11774: <td>PKGSRC_MESSAGE_RECIPIENTS</td>
1.269 leot 11775: </tr>
11776: <tr>
11777: <td>PKGSRC_MKPIE</td>
1.270 ! leot 11778: <td>PKGSRC_MKREPRO</td>
1.269 leot 11779: </tr>
11780: <tr>
11781: <td>PKGSRC_RUN_TEST</td>
1.270 ! leot 11782: <td>PKGSRC_SETENV</td>
1.269 leot 11783: </tr>
11784: <tr>
11785: <td>PKGSRC_SLEEPSECS</td>
1.270 ! leot 11786: <td>PKGSRC_TODO</td>
1.269 leot 11787: </tr>
11788: <tr>
11789: <td>PKGSRC_USE_CTF</td>
1.270 ! leot 11790: <td>PKGSRC_USE_FORTIFY</td>
1.269 leot 11791: </tr>
11792: <tr>
11793: <td>PKGSRC_USE_RELRO</td>
1.270 ! leot 11794: <td>PKGSRC_USE_SSP</td>
1.269 leot 11795: </tr>
11796: <tr>
11797: <td>PKGSRC_USE_STACK_CHECK</td>
1.270 ! leot 11798: <td>PKGTASKS_DATAFILE</td>
1.269 leot 11799: </tr>
11800: <tr>
11801: <td>PKGTOOLS_ARGS</td>
1.270 ! leot 11802: <td>PKGTOOLS_ENV</td>
1.269 leot 11803: </tr>
11804: <tr>
11805: <td>PKG_ALTERNATIVES</td>
1.270 ! leot 11806: <td>PKG_APACHE</td>
1.269 leot 11807: </tr>
11808: <tr>
11809: <td>PKG_APACHE_ACCEPTED</td>
1.270 ! leot 11810: <td>PKG_APACHE_DEFAULT</td>
1.269 leot 11811: </tr>
11812: <tr>
11813: <td>PKG_BEST_EXISTS</td>
1.270 ! leot 11814: <td>PKG_BUILD_OPTIONS</td>
1.269 leot 11815: </tr>
11816: <tr>
11817: <td>PKG_COMPRESSION</td>
1.270 ! leot 11818: <td>PKG_CONFIG</td>
1.269 leot 11819: </tr>
11820: <tr>
11821: <td>PKG_CONFIG_PERMS</td>
1.270 ! leot 11822: <td>PKG_CREATE_USERGROUP</td>
1.269 leot 11823: </tr>
11824: <tr>
11825: <td>PKG_DB_TMPDIR</td>
1.270 ! leot 11826: <td>PKG_DEBUG_LEVEL</td>
1.269 leot 11827: </tr>
11828: <tr>
11829: <td>PKG_DEFAULT_OPTIONS</td>
1.270 ! leot 11830: <td>PKG_DESTDIR_SUPPORT</td>
1.269 leot 11831: </tr>
11832: <tr>
11833: <td>PKG_DEVELOPER</td>
1.270 ! leot 11834: <td>PKG_DISABLED_OPTIONS</td>
1.269 leot 11835: </tr>
11836: <tr>
11837: <td>PKG_FATAL_ERRORS</td>
1.270 ! leot 11838: <td>PKG_FC</td>
1.269 leot 11839: </tr>
11840: <tr>
11841: <td>PKG_FILELIST_CMD</td>
1.270 ! leot 11842: <td>PKG_GECOS</td>
1.269 leot 11843: </tr>
11844: <tr>
11845: <td>PKG_GID</td>
1.270 ! leot 11846: <td>PKG_GROUPS</td>
1.269 leot 11847: </tr>
11848: <tr>
11849: <td>PKG_GROUPS_VARS</td>
1.270 ! leot 11850: <td>PKG_HOME</td>
1.269 leot 11851: </tr>
11852: <tr>
11853: <td>PKG_INIT_SCRIPTS</td>
1.270 ! leot 11854: <td>PKG_JAVA_HOME</td>
1.269 leot 11855: </tr>
11856: <tr>
11857: <td>PKG_JVM</td>
1.270 ! leot 11858: <td>PKG_JVMS_ACCEPTED</td>
1.269 leot 11859: </tr>
11860: <tr>
11861: <td>PKG_JVM_DEFAULT</td>
1.270 ! leot 11862: <td>PKG_LEGACY_OPTIONS</td>
1.269 leot 11863: </tr>
11864: <tr>
11865: <td>PKG_LIBTOOL</td>
1.270 ! leot 11866: <td>PKG_OPTIONS</td>
1.269 leot 11867: </tr>
11868: <tr>
11869: <td>PKG_OPTIONS_DEPRECATED_WARNINGS</td>
1.270 ! leot 11870: <td>PKG_OPTIONS_LEGACY_OPTS</td>
1.269 leot 11871: </tr>
11872: <tr>
11873: <td>PKG_OPTIONS_LEGACY_VARS</td>
1.270 ! leot 11874: <td>PKG_OPTIONS_NONEMPTY_SETS</td>
1.269 leot 11875: </tr>
11876: <tr>
11877: <td>PKG_OPTIONS_OPTIONAL_GROUPS</td>
1.270 ! leot 11878: <td>PKG_OPTIONS_REQUIRED_GROUPS</td>
1.269 leot 11879: </tr>
11880: <tr>
11881: <td>PKG_OPTIONS_VAR</td>
1.270 ! leot 11882: <td>PKG_PHP</td>
1.269 leot 11883: </tr>
11884: <tr>
11885: <td>PKG_PHP_MAJOR_VERS</td>
1.270 ! leot 11886: <td>PKG_PHP_VERSION</td>
1.269 leot 11887: </tr>
11888: <tr>
11889: <td>PKG_RCD_SCRIPTS</td>
1.270 ! leot 11890: <td>PKG_REFCOUNT_DBDIR</td>
1.269 leot 11891: </tr>
11892: <tr>
11893: <td>PKG_REGISTER_SHELLS</td>
1.270 ! leot 11894: <td>PKG_RESUME_TRANSFERS</td>
1.269 leot 11895: </tr>
11896: <tr>
11897: <td>PKG_SHELL</td>
1.270 ! leot 11898: <td>PKG_SUGGESTED_OPTIONS</td>
1.269 leot 11899: </tr>
11900: <tr>
11901: <td>PKG_SUPPORTED_OPTIONS</td>
1.270 ! leot 11902: <td>PKG_SYSCONFBASE</td>
1.269 leot 11903: </tr>
11904: <tr>
11905: <td>PKG_SYSCONFBASEDIR</td>
1.270 ! leot 11906: <td>PKG_SYSCONFDIR</td>
1.269 leot 11907: </tr>
11908: <tr>
11909: <td>PKG_SYSCONFDIR_PERMS</td>
1.270 ! leot 11910: <td>PKG_SYSCONFSUBDIR</td>
1.269 leot 11911: </tr>
11912: <tr>
11913: <td>PKG_SYSCONFVAR</td>
1.270 ! leot 11914: <td>PKG_TOOLS_BIN</td>
1.269 leot 11915: </tr>
11916: <tr>
11917: <td>PKG_UID</td>
1.270 ! leot 11918: <td>PKG_UPDATE_FONTS_DB</td>
1.269 leot 11919: </tr>
11920: <tr>
11921: <td>PKG_USERS</td>
1.270 ! leot 11922: <td>PKG_USERS_VARS</td>
1.269 leot 11923: </tr>
11924: <tr>
11925: <td>PKG_VERBOSE</td>
1.270 ! leot 11926: <td>PLIST</td>
1.269 leot 11927: </tr>
11928: <tr>
11929: <td>PLIST_AWK</td>
1.270 ! leot 11930: <td>PLIST_AWK_ENV</td>
1.269 leot 11931: </tr>
11932: <tr>
11933: <td>PLIST_SRC</td>
1.270 ! leot 11934: <td>PLIST_SUBST</td>
1.269 leot 11935: </tr>
11936: <tr>
11937: <td>PLIST_TYPE</td>
1.270 ! leot 11938: <td>PLIST_VARS</td>
1.269 leot 11939: </tr>
11940: <tr>
11941: <td>POPTOP_USE_MPPE</td>
1.270 ! leot 11942: <td>POST_FETCH_HOOK</td>
1.269 leot 11943: </tr>
11944: <tr>
11945: <td>PREFER</td>
1.270 ! leot 11946: <td>PREFER_NATIVE</td>
1.269 leot 11947: </tr>
11948: <tr>
11949: <td>PREFER_NATIVE_PTHREADS</td>
1.270 ! leot 11950: <td>PREFER_PKGSRC</td>
1.269 leot 11951: </tr>
11952: <tr>
11953: <td>PREFIX</td>
1.270 ! leot 11954: <td>PREPEND_PATH</td>
1.269 leot 11955: </tr>
11956: <tr>
11957: <td>PRE_ROOT_CMD</td>
1.270 ! leot 11958: <td>PRIVILEGED_STAGES</td>
1.269 leot 11959: </tr>
11960: <tr>
11961: <td>PS</td>
1.270 ! leot 11962: <td>PTHREAD_AUTO_VARS</td>
1.269 leot 11963: </tr>
11964: <tr>
11965: <td>PTHREAD_CFLAGS</td>
1.270 ! leot 11966: <td>PTHREAD_LDFLAGS</td>
1.269 leot 11967: </tr>
11968: <tr>
11969: <td>PTHREAD_LIBS</td>
1.270 ! leot 11970: <td>PTHREAD_OPTS</td>
1.269 leot 11971: </tr>
11972: <tr>
11973: <td>PTHREAD_TYPE</td>
1.270 ! leot 11974: <td>PVM_SSH</td>
1.269 leot 11975: </tr>
11976: <tr>
11977: <td>PYPKGPREFIX</td>
1.270 ! leot 11978: <td>PYTHON_FOR_BUILD_ONLY</td>
1.269 leot 11979: </tr>
11980: <tr>
11981: <td>PYTHON_SELF_CONFLICT</td>
1.270 ! leot 11982: <td>PYTHON_VERSIONED_DEPENDENCIES</td>
1.269 leot 11983: </tr>
11984: <tr>
11985: <td>PYTHON_VERSIONS_ACCEPTED</td>
1.270 ! leot 11986: <td>PYTHON_VERSIONS_INCOMPATIBLE</td>
1.269 leot 11987: </tr>
11988: <tr>
11989: <td>PYTHON_VERSION_DEFAULT</td>
1.270 ! leot 11990: <td>PYTHON_VERSION_REQD</td>
1.269 leot 11991: </tr>
11992: <tr>
11993: <td>PYVERSSUFFIX</td>
1.270 ! leot 11994: <td>PY_NO_EGG</td>
1.269 leot 11995: </tr>
11996: <tr>
11997: <td>QMAILDIR</td>
1.270 ! leot 11998: <td>QMAIL_ALIAS_USER</td>
1.269 leot 11999: </tr>
12000: <tr>
12001: <td>QMAIL_DAEMON_USER</td>
1.270 ! leot 12002: <td>QMAIL_LOG_USER</td>
1.269 leot 12003: </tr>
12004: <tr>
12005: <td>QMAIL_NOFILES_GROUP</td>
1.270 ! leot 12006: <td>QMAIL_PASSWD_USER</td>
1.269 leot 12007: </tr>
12008: <tr>
12009: <td>QMAIL_QMAIL_GROUP</td>
1.270 ! leot 12010: <td>QMAIL_QUEUE_DIR</td>
1.269 leot 12011: </tr>
12012: <tr>
12013: <td>QMAIL_QUEUE_EXTRA</td>
1.270 ! leot 12014: <td>QMAIL_QUEUE_USER</td>
1.269 leot 12015: </tr>
12016: <tr>
12017: <td>QMAIL_REMOTE_USER</td>
1.270 ! leot 12018: <td>QMAIL_ROOT_USER</td>
1.269 leot 12019: </tr>
12020: <tr>
12021: <td>QMAIL_SEND_USER</td>
1.270 ! leot 12022: <td>QPOPPER_FAC</td>
1.269 leot 12023: </tr>
12024: <tr>
12025: <td>QPOPPER_SPOOL_DIR</td>
1.270 ! leot 12026: <td>QPOPPER_USER</td>
1.269 leot 12027: </tr>
12028: <tr>
12029: <td>RAKE_NAME</td>
1.270 ! leot 12030: <td>RASMOL_DEPTH</td>
1.269 leot 12031: </tr>
12032: <tr>
12033: <td>RCD_DIR</td>
1.270 ! leot 12034: <td>RCD_ORDER</td>
1.269 leot 12035: </tr>
12036: <tr>
12037: <td>RCD_SCRIPTS</td>
1.270 ! leot 12038: <td>RCD_SCRIPTS_DIR</td>
1.269 leot 12039: </tr>
12040: <tr>
12041: <td>RCD_SCRIPTS_EXAMPLEDIR</td>
1.270 ! leot 12042: <td>RCD_SCRIPTS_MODE</td>
1.269 leot 12043: </tr>
12044: <tr>
12045: <td>RCD_SCRIPTS_SHELL</td>
1.270 ! leot 12046: <td>RCD_SCRIPT_SRC</td>
1.269 leot 12047: </tr>
12048: <tr>
12049: <td>RCD_SUBR</td>
1.270 ! leot 12050: <td>RDOC</td>
1.269 leot 12051: </tr>
12052: <tr>
12053: <td>READLINE_DEFAULT</td>
1.270 ! leot 12054: <td>READLINE_TYPE</td>
1.269 leot 12055: </tr>
12056: <tr>
12057: <td>REAL_ROOT_GROUP</td>
1.270 ! leot 12058: <td>REAL_ROOT_USER</td>
1.269 leot 12059: </tr>
12060: <tr>
12061: <td>RECURSIVE_MAKE</td>
1.270 ! leot 12062: <td>RELAY_CTRL_DIR</td>
1.269 leot 12063: </tr>
12064: <tr>
12065: <td>REPLACE_AWK</td>
1.270 ! leot 12066: <td>REPLACE_BASH</td>
1.269 leot 12067: </tr>
12068: <tr>
12069: <td>REPLACE_CSH</td>
1.270 ! leot 12070: <td>REPLACE_KSH</td>
1.269 leot 12071: </tr>
12072: <tr>
12073: <td>REPLACE_PERL</td>
1.270 ! leot 12074: <td>REPLACE_PERL6</td>
1.269 leot 12075: </tr>
12076: <tr>
12077: <td>REPLACE_PYTHON</td>
1.270 ! leot 12078: <td>REPLACE_RUBY</td>
1.269 leot 12079: </tr>
12080: <tr>
12081: <td>REPLACE_RUBY_DIRS</td>
1.270 ! leot 12082: <td>REPLACE_RUBY_PAT</td>
1.269 leot 12083: </tr>
12084: <tr>
12085: <td>REPLACE_SH</td>
1.270 ! leot 12086: <td>REPLACE_TEXLUA</td>
1.269 leot 12087: </tr>
12088: <tr>
12089: <td>REQD_DIRS</td>
1.270 ! leot 12090: <td>REQD_DIRS_PERMS</td>
1.269 leot 12091: </tr>
12092: <tr>
12093: <td>REQD_FILES</td>
1.270 ! leot 12094: <td>REQD_FILES_MODE</td>
1.269 leot 12095: </tr>
12096: <tr>
12097: <td>REQD_FILES_PERMS</td>
1.270 ! leot 12098: <td>RESOLV_AUTO_VARS</td>
1.269 leot 12099: </tr>
12100: <tr>
12101: <td>RESOLV_LDFLAGS</td>
1.270 ! leot 12102: <td>RESOLV_LIBS</td>
1.269 leot 12103: </tr>
12104: <tr>
12105: <td>RM</td>
1.270 ! leot 12106: <td>ROCKSPEC_NAME</td>
1.269 leot 12107: </tr>
12108: <tr>
12109: <td>ROCKSPEC_SPECFILE</td>
1.270 ! leot 12110: <td>ROOT_CMD</td>
1.269 leot 12111: </tr>
12112: <tr>
12113: <td>ROOT_GROUP</td>
1.270 ! leot 12114: <td>ROOT_USER</td>
1.269 leot 12115: </tr>
12116: <tr>
12117: <td>RPCGEN</td>
1.270 ! leot 12118: <td>RPM</td>
1.269 leot 12119: </tr>
12120: <tr>
12121: <td>RPM2PKG_PLIST</td>
1.270 ! leot 12122: <td>RPM2PKG_PREFIX</td>
1.269 leot 12123: </tr>
12124: <tr>
12125: <td>RPM2PKG_STAGE</td>
1.270 ! leot 12126: <td>RPM2PKG_STRIP</td>
1.269 leot 12127: </tr>
12128: <tr>
12129: <td>RPM2PKG_SUBPREFIX</td>
1.270 ! leot 12130: <td>RPMFILES</td>
1.269 leot 12131: </tr>
12132: <tr>
12133: <td>RPMIGNOREPATH</td>
1.270 ! leot 12134: <td>RPM_DB_PREFIX</td>
1.269 leot 12135: </tr>
12136: <tr>
12137: <td>RSSH_CVS_PATH</td>
1.270 ! leot 12138: <td>RSSH_RDIST_PATH</td>
1.269 leot 12139: </tr>
12140: <tr>
12141: <td>RSSH_RSYNC_PATH</td>
1.270 ! leot 12142: <td>RSSH_SCP_PATH</td>
1.269 leot 12143: </tr>
12144: <tr>
12145: <td>RSSH_SFTP_SERVER_PATH</td>
1.270 ! leot 12146: <td>RUBY</td>
1.269 leot 12147: </tr>
12148: <tr>
12149: <td>RUBYGEM</td>
1.270 ! leot 12150: <td>RUBYGEM_NAME</td>
1.269 leot 12151: </tr>
12152: <tr>
12153: <td>RUBYGEM_OPTIONS</td>
1.270 ! leot 12154: <td>RUBY_ABI_VERSION</td>
1.269 leot 12155: </tr>
12156: <tr>
12157: <td>RUBY_ARCH</td>
1.270 ! leot 12158: <td>RUBY_ARCHINC</td>
1.269 leot 12159: </tr>
12160: <tr>
12161: <td>RUBY_ARCHLIB</td>
1.270 ! leot 12162: <td>RUBY_BASE</td>
1.269 leot 12163: </tr>
12164: <tr>
12165: <td>RUBY_BASERIDIR</td>
1.270 ! leot 12166: <td>RUBY_BUILD_RDOC</td>
1.269 leot 12167: </tr>
12168: <tr>
12169: <td>RUBY_BUILD_RI</td>
1.270 ! leot 12170: <td>RUBY_DLEXT</td>
1.269 leot 12171: </tr>
12172: <tr>
12173: <td>RUBY_DOC</td>
1.270 ! leot 12174: <td>RUBY_DYNAMIC_DIRS</td>
1.269 leot 12175: </tr>
12176: <tr>
12177: <td>RUBY_EG</td>
1.270 ! leot 12178: <td>RUBY_ENCODING_ARG</td>
1.269 leot 12179: </tr>
12180: <tr>
12181: <td>RUBY_EXTCONF</td>
1.270 ! leot 12182: <td>RUBY_EXTCONF_CHECK</td>
1.269 leot 12183: </tr>
12184: <tr>
12185: <td>RUBY_EXTCONF_DEBUG</td>
1.270 ! leot 12186: <td>RUBY_EXTCONF_MAKEFILE</td>
1.269 leot 12187: </tr>
12188: <tr>
12189: <td>RUBY_GEM_BASE</td>
1.270 ! leot 12190: <td>RUBY_INC</td>
1.269 leot 12191: </tr>
12192: <tr>
12193: <td>RUBY_LIB</td>
1.270 ! leot 12194: <td>RUBY_LIB_BASE</td>
1.269 leot 12195: </tr>
12196: <tr>
12197: <td>RUBY_NAME</td>
1.270 ! leot 12198: <td>RUBY_NOVERSION</td>
1.269 leot 12199: </tr>
12200: <tr>
12201: <td>RUBY_PKGPREFIX</td>
1.270 ! leot 12202: <td>RUBY_RAILS</td>
1.269 leot 12203: </tr>
12204: <tr>
12205: <td>RUBY_RAILS42_VERSION</td>
1.270 ! leot 12206: <td>RUBY_RAILS51_VERSION</td>
1.269 leot 12207: </tr>
12208: <tr>
12209: <td>RUBY_RAILS52_VERSION</td>
1.270 ! leot 12210: <td>RUBY_RAILS_ACCEPTED</td>
1.269 leot 12211: </tr>
12212: <tr>
12213: <td>RUBY_RAILS_DEFAULT</td>
1.270 ! leot 12214: <td>RUBY_RAILS_REQD</td>
1.269 leot 12215: </tr>
12216: <tr>
12217: <td>RUBY_RAILS_STRICT_DEP</td>
1.270 ! leot 12218: <td>RUBY_RIDIR</td>
1.269 leot 12219: </tr>
12220: <tr>
12221: <td>RUBY_SETUP</td>
1.270 ! leot 12222: <td>RUBY_SHLIB</td>
1.269 leot 12223: </tr>
12224: <tr>
12225: <td>RUBY_SHLIBALIAS</td>
1.270 ! leot 12226: <td>RUBY_SHLIBVER</td>
1.269 leot 12227: </tr>
12228: <tr>
12229: <td>RUBY_SIMPLE_INSTALL</td>
1.270 ! leot 12230: <td>RUBY_SITEARCHLIB</td>
1.269 leot 12231: </tr>
12232: <tr>
12233: <td>RUBY_SITELIB</td>
1.270 ! leot 12234: <td>RUBY_SITELIB_BASE</td>
1.269 leot 12235: </tr>
12236: <tr>
12237: <td>RUBY_SITERIDIR</td>
1.270 ! leot 12238: <td>RUBY_SLEXT</td>
1.269 leot 12239: </tr>
12240: <tr>
12241: <td>RUBY_SRCDIR</td>
1.270 ! leot 12242: <td>RUBY_STATICLIB</td>
1.269 leot 12243: </tr>
12244: <tr>
12245: <td>RUBY_SUFFIX</td>
1.270 ! leot 12246: <td>RUBY_SYSRIDIR</td>
1.269 leot 12247: </tr>
12248: <tr>
12249: <td>RUBY_USE_PTHREAD</td>
1.270 ! leot 12250: <td>RUBY_VENDORARCHLIB</td>
1.269 leot 12251: </tr>
12252: <tr>
12253: <td>RUBY_VENDORLIB</td>
1.270 ! leot 12254: <td>RUBY_VENDORLIB_BASE</td>
1.269 leot 12255: </tr>
12256: <tr>
12257: <td>RUBY_VER</td>
1.270 ! leot 12258: <td>RUBY_VERSION</td>
1.269 leot 12259: </tr>
12260: <tr>
12261: <td>RUBY_VERSIONS_ACCEPTED</td>
1.270 ! leot 12262: <td>RUBY_VERSION_DEFAULT</td>
1.269 leot 12263: </tr>
12264: <tr>
12265: <td>RUBY_VERSION_REQD</td>
1.270 ! leot 12266: <td>RUBY_VER_DIR</td>
1.269 leot 12267: </tr>
12268: <tr>
12269: <td>RUN</td>
1.270 ! leot 12270: <td>RUN_LDCONFIG</td>
1.269 leot 12271: </tr>
12272: <tr>
12273: <td>SAWFISH_THEMES</td>
1.270 ! leot 12274: <td>SCO</td>
1.269 leot 12275: </tr>
12276: <tr>
12277: <td>SCREWS_GROUP</td>
1.270 ! leot 12278: <td>SCREWS_USER</td>
1.269 leot 12279: </tr>
12280: <tr>
12281: <td>SCRIPTS_ENV</td>
1.270 ! leot 12282: <td>SCROLLKEEPER_DATADIR</td>
1.269 leot 12283: </tr>
12284: <tr>
12285: <td>SCROLLKEEPER_REBUILDDB</td>
1.270 ! leot 12286: <td>SCROLLKEEPER_UPDATEDB</td>
1.269 leot 12287: </tr>
12288: <tr>
12289: <td>SDIST_PAWD</td>
1.270 ! leot 12290: <td>SERIAL_DEVICES</td>
1.269 leot 12291: </tr>
12292: <tr>
12293: <td>SETGIDGAME</td>
1.270 ! leot 12294: <td>SETGID_GAMES_PERMS</td>
1.269 leot 12295: </tr>
12296: <tr>
12297: <td>SETUID_ROOT_PERMS</td>
1.270 ! leot 12298: <td>SH</td>
1.269 leot 12299: </tr>
12300: <tr>
12301: <td>SHLIB</td>
1.270 ! leot 12302: <td>SHORTNAME</td>
1.269 leot 12303: </tr>
12304: <tr>
12305: <td>SIGN_PACKAGES</td>
1.270 ! leot 12306: <td>SILC_CLIENT_WITH_PERL</td>
1.269 leot 12307: </tr>
12308: <tr>
12309: <td>SITE_SPECIFIC_PKGS</td>
1.270 ! leot 12310: <td>SKIP_DEPENDS</td>
1.269 leot 12311: </tr>
12312: <tr>
12313: <td>SKIP_PORTABILITY_CHECK</td>
1.270 ! leot 12314: <td>SMF_INSTANCES</td>
1.269 leot 12315: </tr>
12316: <tr>
12317: <td>SMF_MANIFEST</td>
1.270 ! leot 12318: <td>SMF_METHODS</td>
1.269 leot 12319: </tr>
12320: <tr>
12321: <td>SMF_METHOD_SHELL</td>
1.270 ! leot 12322: <td>SMF_METHOD_SRC</td>
1.269 leot 12323: </tr>
12324: <tr>
12325: <td>SMF_NAME</td>
1.270 ! leot 12326: <td>SMF_PREFIX</td>
1.269 leot 12327: </tr>
12328: <tr>
12329: <td>SMF_SRCDIR</td>
1.270 ! leot 12330: <td>SNIPROXY_GROUP</td>
1.269 leot 12331: </tr>
12332: <tr>
12333: <td>SNIPROXY_USER</td>
1.270 ! leot 12334: <td>SOURCE_BUFFSIZE</td>
1.269 leot 12335: </tr>
12336: <tr>
12337: <td>SPECIAL_PERMS</td>
1.270 ! leot 12338: <td>SPECIFIC_PKGS</td>
1.269 leot 12339: </tr>
12340: <tr>
12341: <td>SSH_SUID</td>
1.270 ! leot 12342: <td>SSYNC_PAWD</td>
1.269 leot 12343: </tr>
12344: <tr>
12345: <td>STEP_MSG</td>
1.270 ! leot 12346: <td>STRIP</td>
1.269 leot 12347: </tr>
12348: <tr>
12349: <td>STRIP_DBG</td>
1.270 ! leot 12350: <td>STRIP_DEBUG</td>
1.269 leot 12351: </tr>
12352: <tr>
12353: <td>STRIP_DEBUG_SUPPORTED</td>
1.270 ! leot 12354: <td>STRIP_FILES_SKIP</td>
1.269 leot 12355: </tr>
12356: <tr>
12357: <td>SU</td>
1.270 ! leot 12358: <td>SUBDIR</td>
1.269 leot 12359: </tr>
12360: <tr>
12361: <td>SUBST_CLASSES</td>
1.270 ! leot 12362: <td>SUBST_FILES</td>
1.269 leot 12363: </tr>
12364: <tr>
12365: <td>SUBST_FILTER_CMD</td>
1.270 ! leot 12366: <td>SUBST_MESSAGE</td>
1.269 leot 12367: </tr>
12368: <tr>
12369: <td>SUBST_SED</td>
1.270 ! leot 12370: <td>SUBST_SHOW_DIFF</td>
1.269 leot 12371: </tr>
12372: <tr>
12373: <td>SUBST_SKIP_TEXT_CHECK</td>
1.270 ! leot 12374: <td>SUBST_STAGE</td>
1.269 leot 12375: </tr>
12376: <tr>
12377: <td>SUBST_VARS</td>
1.270 ! leot 12378: <td>SUNWSPROBASE</td>
1.269 leot 12379: </tr>
12380: <tr>
12381: <td>SUSE_PREFER</td>
1.270 ! leot 12382: <td>SU_CMD</td>
1.269 leot 12383: </tr>
12384: <tr>
12385: <td>SVN_EXTRACTDIR</td>
1.270 ! leot 12386: <td>SVN_REPO</td>
1.269 leot 12387: </tr>
12388: <tr>
12389: <td>SVN_REPOSITORIES</td>
1.270 ! leot 12390: <td>SVN_REVISION</td>
1.269 leot 12391: </tr>
12392: <tr>
12393: <td>TERMCAP_TYPE</td>
1.270 ! leot 12394: <td>TERMINFO_DEFAULT</td>
1.269 leot 12395: </tr>
12396: <tr>
12397: <td>TERMINFO_TYPE</td>
1.270 ! leot 12398: <td>TEST</td>
1.269 leot 12399: </tr>
12400: <tr>
12401: <td>TEST_DEPENDS</td>
1.270 ! leot 12402: <td>TEST_DIRS</td>
1.269 leot 12403: </tr>
12404: <tr>
12405: <td>TEST_ENV</td>
1.270 ! leot 12406: <td>TEST_MAKE_CMD</td>
1.269 leot 12407: </tr>
12408: <tr>
12409: <td>TEST_MAKE_FLAGS</td>
1.270 ! leot 12410: <td>TEST_TARGET</td>
1.269 leot 12411: </tr>
12412: <tr>
12413: <td>TEXLIVE_IGNORE_PATTERNS</td>
1.270 ! leot 12414: <td>TEXLIVE_REV</td>
1.269 leot 12415: </tr>
12416: <tr>
12417: <td>TEXMFSITE</td>
1.270 ! leot 12418: <td>TEX_FORMATS</td>
1.269 leot 12419: </tr>
12420: <tr>
12421: <td>TEX_HYPHEN_DAT</td>
1.270 ! leot 12422: <td>TEX_HYPHEN_DEF</td>
1.269 leot 12423: </tr>
12424: <tr>
12425: <td>TEX_TEXMF_DIRS</td>
1.270 ! leot 12426: <td>THTTPD_LOG_FACILITY</td>
1.269 leot 12427: </tr>
12428: <tr>
12429: <td>TO</td>
1.270 ! leot 12430: <td>TOOLS_ALIASES</td>
1.269 leot 12431: </tr>
12432: <tr>
12433: <td>TOOLS_ARGS</td>
1.270 ! leot 12434: <td>TOOLS_BROKEN</td>
1.269 leot 12435: </tr>
12436: <tr>
12437: <td>TOOLS_CMD</td>
1.270 ! leot 12438: <td>TOOLS_CREATE</td>
1.269 leot 12439: </tr>
12440: <tr>
12441: <td>TOOLS_DIR</td>
1.270 ! leot 12442: <td>TOOLS_FAIL</td>
1.269 leot 12443: </tr>
12444: <tr>
12445: <td>TOOLS_GNU_MISSING</td>
1.270 ! leot 12446: <td>TOOLS_LDCONFIG</td>
1.269 leot 12447: </tr>
12448: <tr>
12449: <td>TOOLS_NOOP</td>
1.270 ! leot 12450: <td>TOOLS_PATH</td>
1.269 leot 12451: </tr>
12452: <tr>
12453: <td>TOOLS_SCRIPT</td>
1.270 ! leot 12454: <td>TOOL_DEPENDS</td>
1.269 leot 12455: </tr>
12456: <tr>
12457: <td>TTF_FONTDIR</td>
1.270 ! leot 12458: <td>TTF_FONTS_DIR</td>
1.269 leot 12459: </tr>
12460: <tr>
12461: <td>TYPE</td>
1.270 ! leot 12462: <td>UAC_REQD_EXECS</td>
1.269 leot 12463: </tr>
12464: <tr>
12465: <td>UCSPI_SSL_GROUP</td>
1.270 ! leot 12466: <td>UCSPI_SSL_USER</td>
1.269 leot 12467: </tr>
12468: <tr>
12469: <td>UNLIMIT_RESOURCES</td>
1.270 ! leot 12470: <td>UNPRIVILEGED</td>
1.269 leot 12471: </tr>
12472: <tr>
12473: <td>UNPRIVILEGED_GROUP</td>
1.270 ! leot 12474: <td>UNPRIVILEGED_GROUPS</td>
1.269 leot 12475: </tr>
12476: <tr>
12477: <td>UNPRIVILEGED_USER</td>
1.270 ! leot 12478: <td>UNWRAP_FILES</td>
1.269 leot 12479: </tr>
12480: <tr>
12481: <td>UNWRAP_PATTERNS</td>
1.270 ! leot 12482: <td>UPDATE_GEMSPEC</td>
1.269 leot 12483: </tr>
12484: <tr>
12485: <td>UPDATE_TARGET</td>
1.270 ! leot 12486: <td>URI</td>
1.269 leot 12487: </tr>
12488: <tr>
12489: <td>USA</td>
1.270 ! leot 12490: <td>USERGROUP_PHASE</td>
1.269 leot 12491: </tr>
12492: <tr>
12493: <td>USERPPP_GROUP</td>
1.270 ! leot 12494: <td>USER_SPECIFIC_PKGS</td>
1.269 leot 12495: </tr>
12496: <tr>
12497: <td>USE_ABI_DEPENDS</td>
1.270 ! leot 12498: <td>USE_APR</td>
1.269 leot 12499: </tr>
12500: <tr>
12501: <td>USE_BSD_MAKEFILE</td>
1.270 ! leot 12502: <td>USE_BUILTIN</td>
1.269 leot 12503: </tr>
12504: <tr>
12505: <td>USE_CROSS_COMPILE</td>
1.270 ! leot 12506: <td>USE_CURSES</td>
1.269 leot 12507: </tr>
12508: <tr>
12509: <td>USE_CWRAPPERS</td>
1.270 ! leot 12510: <td>USE_DB185</td>
1.269 leot 12511: </tr>
12512: <tr>
12513: <td>USE_FEATURES</td>
1.270 ! leot 12514: <td>USE_GAMESGROUP</td>
1.269 leot 12515: </tr>
12516: <tr>
12517: <td>USE_GCC_RUNTIME</td>
1.270 ! leot 12518: <td>USE_IMAKE</td>
1.269 leot 12519: </tr>
12520: <tr>
12521: <td>USE_JAVA</td>
1.270 ! leot 12522: <td>USE_JAVA2</td>
1.269 leot 12523: </tr>
12524: <tr>
12525: <td>USE_LANGUAGES</td>
1.270 ! leot 12526: <td>USE_LIBTOOL</td>
1.269 leot 12527: </tr>
12528: <tr>
12529: <td>USE_NATIVE_GCC</td>
1.270 ! leot 12530: <td>USE_NETBSD_REPO</td>
1.269 leot 12531: </tr>
12532: <tr>
12533: <td>USE_PKGSRC_GCC</td>
1.270 ! leot 12534: <td>USE_PKGSRC_GCC_RUNTIME</td>
1.269 leot 12535: </tr>
12536: <tr>
12537: <td>USE_PKGTASKS</td>
1.270 ! leot 12538: <td>USE_RUBY_EXTCONF</td>
1.269 leot 12539: </tr>
12540: <tr>
12541: <td>USE_RUBY_INSTALL</td>
1.270 ! leot 12542: <td>USE_RUBY_SETUP</td>
1.269 leot 12543: </tr>
12544: <tr>
12545: <td>USE_RUBY_SETUP_PKG</td>
1.270 ! leot 12546: <td>USE_TOOLS</td>
1.269 leot 12547: </tr>
12548: <tr>
12549: <td>UUCP_GROUP</td>
1.270 ! leot 12550: <td>UUCP_USER</td>
1.269 leot 12551: </tr>
12552: <tr>
12553: <td>VARBASE</td>
1.270 ! leot 12554: <td>VARNAME</td>
1.269 leot 12555: </tr>
12556: <tr>
12557: <td>VIM_EXTRA_OPTS</td>
1.270 ! leot 12558: <td>WARNING_MSG</td>
1.269 leot 12559: </tr>
12560: <tr>
12561: <td>WCALC_CGIDIR</td>
1.270 ! leot 12562: <td>WCALC_CGIPATH</td>
1.269 leot 12563: </tr>
12564: <tr>
12565: <td>WCALC_HTMLDIR</td>
1.270 ! leot 12566: <td>WCALC_HTMLPATH</td>
1.269 leot 12567: </tr>
12568: <tr>
12569: <td>WDM_MANAGERS</td>
1.270 ! leot 12570: <td>WRAPPER_REORDER_CMDS</td>
1.269 leot 12571: </tr>
12572: <tr>
12573: <td>WRKDIR</td>
1.270 ! leot 12574: <td>WRKDIR_BASENAME</td>
1.269 leot 12575: </tr>
12576: <tr>
12577: <td>WRKDIR_LOCKTYPE</td>
1.270 ! leot 12578: <td>WRKLOG</td>
1.269 leot 12579: </tr>
12580: <tr>
12581: <td>WRKOBJDIR</td>
1.270 ! leot 12582: <td>WRKSRC</td>
1.269 leot 12583: </tr>
12584: <tr>
12585: <td>WXGTK_ACCEPTED</td>
1.270 ! leot 12586: <td>WXGTK_DEFAULT</td>
1.269 leot 12587: </tr>
12588: <tr>
12589: <td>X10_PORT</td>
1.270 ! leot 12590: <td>X11</td>
1.269 leot 12591: </tr>
12592: <tr>
12593: <td>X11BASE</td>
1.270 ! leot 12594: <td>X11_PKGSRCDIR</td>
1.269 leot 12595: </tr>
12596: <tr>
12597: <td>X11_TYPE</td>
1.270 ! leot 12598: <td>X509_CERTIFICATE</td>
1.269 leot 12599: </tr>
12600: <tr>
12601: <td>X509_KEY</td>
1.270 ! leot 12602: <td>XAW_TYPE</td>
1.269 leot 12603: </tr>
12604: <tr>
12605: <td>XLOCK_DEFAULT_MODE</td>
1.270 ! leot 12606: <td>XMKMF_FLAGS</td>
1.269 leot 12607: </tr>
12608: <tr>
12609: <td>XXX</td>
1.270 ! leot 12610: <td>XXXX</td>
1.269 leot 12611: </tr>
12612: <tr>
12613: <td>YES</td>
1.270 ! leot 12614: <td>ZERO_FILESIZE_P</td>
1.269 leot 12615: </tr>
12616: <tr>
12617: <td>ZSH_STATIC</td>
1.270 ! leot 12618: <td>__stdc__</td>
1.269 leot 12619: </tr>
12620: <tr>
12621: <td>_vargroups</td>
1.270 ! leot 12622: <td>add</td>
1.269 leot 12623: </tr>
12624: <tr>
12625: <td>all</td>
1.270 ! leot 12626: <td>alternatives</td>
1.269 leot 12627: </tr>
12628: <tr>
12629: <td>aslr</td>
1.270 ! leot 12630: <td>asprintf</td>
1.269 leot 12631: </tr>
12632: <tr>
12633: <td>autoconf</td>
1.270 ! leot 12634: <td>automake</td>
1.269 leot 12635: </tr>
12636: <tr>
12637: <td>autoreconf</td>
1.270 ! leot 12638: <td>awk</td>
1.269 leot 12639: </tr>
12640: <tr>
12641: <td>bash</td>
1.270 ! leot 12642: <td>big-endian</td>
1.269 leot 12643: </tr>
12644: <tr>
12645: <td>bin-install</td>
1.270 ! leot 12646: <td>binpkg-list</td>
1.269 leot 12647: </tr>
12648: <tr>
12649: <td>bootstrap-depends</td>
1.270 ! leot 12650: <td>broken</td>
1.269 leot 12651: </tr>
12652: <tr>
12653: <td>broken_on_platform</td>
1.270 ! leot 12654: <td>build</td>
1.269 leot 12655: </tr>
12656: <tr>
12657: <td>build-env</td>
1.270 ! leot 12658: <td>buildlink-directories</td>
1.269 leot 12659: </tr>
12660: <tr>
12661: <td>buildlink-oss-soundcard-h</td>
1.270 ! leot 12662: <td>c</td>
1.269 leot 12663: </tr>
12664: <tr>
12665: <td>c++</td>
1.270 ! leot 12666: <td>ccache</td>
1.269 leot 12667: </tr>
12668: <tr>
12669: <td>cce</td>
1.270 ! leot 12670: <td>cdefs</td>
1.269 leot 12671: </tr>
12672: <tr>
12673: <td>changes</td>
1.270 ! leot 12674: <td>changes-entry</td>
1.269 leot 12675: </tr>
12676: <tr>
12677: <td>changes-entry-noupdate</td>
1.270 ! leot 12678: <td>check</td>
1.269 leot 12679: </tr>
12680: <tr>
12681: <td>check-clean</td>
1.270 ! leot 12682: <td>check-files</td>
1.269 leot 12683: </tr>
12684: <tr>
12685: <td>check-files-clean</td>
1.270 ! leot 12686: <td>check-vulnerable</td>
1.269 leot 12687: </tr>
12688: <tr>
12689: <td>checksum</td>
1.270 ! leot 12690: <td>checksum-phase</td>
1.269 leot 12691: </tr>
12692: <tr>
12693: <td>clean</td>
1.270 ! leot 12694: <td>clean-depends</td>
1.269 leot 12695: </tr>
12696: <tr>
12697: <td>cleandir</td>
1.270 ! leot 12698: <td>commit</td>
1.269 leot 12699: </tr>
12700: <tr>
12701: <td>commit-changes-entry</td>
1.270 ! leot 12702: <td>compact</td>
1.269 leot 12703: </tr>
12704: <tr>
12705: <td>compiler</td>
1.270 ! leot 12706: <td>conf</td>
1.269 leot 12707: </tr>
12708: <tr>
12709: <td>config.guess</td>
1.270 ! leot 12710: <td>config.sub</td>
1.269 leot 12711: </tr>
12712: <tr>
12713: <td>configuration</td>
1.270 ! leot 12714: <td>configure</td>
1.269 leot 12715: </tr>
12716: <tr>
12717: <td>configure-help</td>
1.270 ! leot 12718: <td>configure_args</td>
1.269 leot 12719: </tr>
12720: <tr>
12721: <td>cputime</td>
1.270 ! leot 12722: <td>create-usergroup</td>
1.269 leot 12723: </tr>
12724: <tr>
12725: <td>csh</td>
1.270 ! leot 12726: <td>ctf</td>
1.269 leot 12727: </tr>
12728: <tr>
12729: <td>cvs</td>
1.270 ! leot 12730: <td>debug</td>
1.269 leot 12731: </tr>
12732: <tr>
12733: <td>declaration</td>
1.270 ! leot 12734: <td>declare</td>
1.269 leot 12735: </tr>
12736: <tr>
12737: <td>defined</td>
1.270 ! leot 12738: <td>depend</td>
1.269 leot 12739: </tr>
12740: <tr>
12741: <td>dependencies</td>
1.270 ! leot 12742: <td>depends</td>
1.269 leot 12743: </tr>
12744: <tr>
12745: <td>depends-checksum</td>
1.270 ! leot 12746: <td>depends-fetch</td>
1.269 leot 12747: </tr>
12748: <tr>
12749: <td>deps</td>
1.270 ! leot 12750: <td>describe</td>
1.269 leot 12751: </tr>
12752: <tr>
12753: <td>destdir</td>
1.270 ! leot 12754: <td>distclean</td>
1.269 leot 12755: </tr>
12756: <tr>
12757: <td>distinfo</td>
1.270 ! leot 12758: <td>dl</td>
1.269 leot 12759: </tr>
12760: <tr>
12761: <td>dlopen</td>
1.270 ! leot 12762: <td>do-build</td>
1.269 leot 12763: </tr>
12764: <tr>
12765: <td>do-buildlink</td>
1.270 ! leot 12766: <td>do-clean</td>
1.269 leot 12767: </tr>
12768: <tr>
12769: <td>do-configure-post-hook</td>
1.270 ! leot 12770: <td>do-extract</td>
1.269 leot 12771: </tr>
12772: <tr>
12773: <td>do-fetch</td>
1.270 ! leot 12774: <td>do-install</td>
1.269 leot 12775: </tr>
12776: <tr>
12777: <td>emul</td>
1.270 ! leot 12778: <td>emulation</td>
1.269 leot 12779: </tr>
12780: <tr>
12781: <td>emulator</td>
1.270 ! leot 12782: <td>endian</td>
1.269 leot 12783: </tr>
12784: <tr>
12785: <td>enomem</td>
1.270 ! leot 12786: <td>err</td>
1.269 leot 12787: </tr>
12788: <tr>
12789: <td>errx</td>
1.270 ! leot 12790: <td>etc</td>
1.269 leot 12791: </tr>
12792: <tr>
12793: <td>feature</td>
1.270 ! leot 12794: <td>features</td>
1.269 leot 12795: </tr>
12796: <tr>
12797: <td>fetch</td>
1.270 ! leot 12798: <td>fetch-list</td>
1.269 leot 12799: </tr>
12800: <tr>
12801: <td>follows</td>
1.270 ! leot 12802: <td>forbids</td>
1.269 leot 12803: </tr>
12804: <tr>
12805: <td>form</td>
1.270 ! leot 12806: <td>format</td>
1.269 leot 12807: </tr>
12808: <tr>
12809: <td>fortify</td>
1.270 ! leot 12810: <td>fortify_source</td>
1.269 leot 12811: </tr>
12812: <tr>
12813: <td>fossil</td>
1.270 ! leot 12814: <td>friend</td>
1.269 leot 12815: </tr>
12816: <tr>
12817: <td>from</td>
1.270 ! leot 12818: <td>fts</td>
1.269 leot 12819: </tr>
12820: <tr>
12821: <td>fts_close</td>
1.270 ! leot 12822: <td>fts_open</td>
1.269 leot 12823: </tr>
12824: <tr>
12825: <td>fts_read</td>
1.270 ! leot 12826: <td>fts_set</td>
1.269 leot 12827: </tr>
12828: <tr>
12829: <td>full</td>
1.270 ! leot 12830: <td>gcc</td>
1.269 leot 12831: </tr>
12832: <tr>
12833: <td>getopt_long</td>
1.270 ! leot 12834: <td>getprogname</td>
1.269 leot 12835: </tr>
12836: <tr>
12837: <td>gettext</td>
1.270 ! leot 12838: <td>git</td>
1.269 leot 12839: </tr>
12840: <tr>
12841: <td>github</td>
1.270 ! leot 12842: <td>glob</td>
1.269 leot 12843: </tr>
12844: <tr>
12845: <td>gnu</td>
1.270 ! leot 12846: <td>gnu_configure_strict</td>
1.269 leot 12847: </tr>
12848: <tr>
12849: <td>go</td>
1.270 ! leot 12850: <td>go-deps</td>
1.269 leot 12851: </tr>
12852: <tr>
12853: <td>golang</td>
1.270 ! leot 12854: <td>guess-license</td>
1.269 leot 12855: </tr>
12856: <tr>
12857: <td>hashbang</td>
1.270 ! leot 12858: <td>heimdal</td>
1.269 leot 12859: </tr>
12860: <tr>
12861: <td>help</td>
1.270 ! leot 12862: <td>hg</td>
1.269 leot 12863: </tr>
12864: <tr>
12865: <td>imake</td>
1.270 ! leot 12866: <td>increment</td>
1.269 leot 12867: </tr>
12868: <tr>
12869: <td>interp</td>
1.270 ! leot 12870: <td>interpreter</td>
1.269 leot 12871: </tr>
12872: <tr>
12873: <td>intl</td>
1.270 ! leot 12874: <td>iso</td>
1.269 leot 12875: </tr>
12876: <tr>
12877: <td>kerberos</td>
1.270 ! leot 12878: <td>krb</td>
1.269 leot 12879: </tr>
12880: <tr>
12881: <td>krb5</td>
1.270 ! leot 12882: <td>ksh</td>
1.269 leot 12883: </tr>
12884: <tr>
12885: <td>latex</td>
1.270 ! leot 12886: <td>libnbcompat</td>
1.269 leot 12887: </tr>
12888: <tr>
12889: <td>libs</td>
1.270 ! leot 12890: <td>libtool</td>
1.269 leot 12891: </tr>
12892: <tr>
12893: <td>licence</td>
1.270 ! leot 12894: <td>license</td>
1.269 leot 12895: </tr>
12896: <tr>
12897: <td>lintl</td>
1.270 ! leot 12898: <td>little-endian</td>
1.269 leot 12899: </tr>
12900: <tr>
12901: <td>lock</td>
1.270 ! leot 12902: <td>locking</td>
1.269 leot 12903: </tr>
12904: <tr>
12905: <td>lvalue</td>
1.270 ! leot 12906: <td>make</td>
1.269 leot 12907: </tr>
12908: <tr>
12909: <td>makesum</td>
1.270 ! leot 12910: <td>memory</td>
1.269 leot 12911: </tr>
12912: <tr>
12913: <td>mercurial</td>
1.270 ! leot 12914: <td>meta</td>
1.269 leot 12915: </tr>
12916: <tr>
12917: <td>meta-package</td>
1.270 ! leot 12918: <td>meta_package</td>
1.269 leot 12919: </tr>
12920: <tr>
12921: <td>mit-krb5</td>
1.270 ! leot 12922: <td>mk.conf</td>
1.269 leot 12923: </tr>
12924: <tr>
12925: <td>mount</td>
1.270 ! leot 12926: <td>mprotect</td>
1.269 leot 12927: </tr>
12928: <tr>
12929: <td>mremap</td>
1.270 ! leot 12930: <td>nb</td>
1.269 leot 12931: </tr>
12932: <tr>
12933: <td>nbcompat</td>
1.270 ! leot 12934: <td>no</td>
1.269 leot 12935: </tr>
12936: <tr>
12937: <td>obstack</td>
1.270 ! leot 12938: <td>obstack_ptr_grow</td>
1.269 leot 12939: </tr>
12940: <tr>
12941: <td>occurs</td>
1.270 ! leot 12942: <td>only</td>
1.269 leot 12943: </tr>
12944: <tr>
12945: <td>options</td>
1.270 ! leot 12946: <td>options.mk</td>
1.269 leot 12947: </tr>
12948: <tr>
12949: <td>order</td>
1.270 ! leot 12950: <td>override</td>
1.269 leot 12951: </tr>
12952: <tr>
12953: <td>override-intltool</td>
1.270 ! leot 12954: <td>override-message-intltool</td>
1.269 leot 12955: </tr>
12956: <tr>
12957: <td>package</td>
1.270 ! leot 12958: <td>parallel</td>
1.269 leot 12959: </tr>
12960: <tr>
12961: <td>partial</td>
1.270 ! leot 12962: <td>path</td>
1.269 leot 12963: </tr>
12964: <tr>
12965: <td>pax</td>
1.270 ! leot 12966: <td>paxctl</td>
1.269 leot 12967: </tr>
12968: <tr>
12969: <td>pbulk-index</td>
1.270 ! leot 12970: <td>pc</td>
1.269 leot 12971: </tr>
12972: <tr>
12973: <td>perl</td>
1.270 ! leot 12974: <td>perl5</td>
1.269 leot 12975: </tr>
12976: <tr>
12977: <td>perms</td>
1.270 ! leot 12978: <td>php</td>
1.269 leot 12979: </tr>
12980: <tr>
12981: <td>pkg-build-options</td>
1.270 ! leot 12982: <td>pkg-config</td>
1.269 leot 12983: </tr>
12984: <tr>
12985: <td>pkg_build_options</td>
1.270 ! leot 12986: <td>platform</td>
1.269 leot 12987: </tr>
12988: <tr>
12989: <td>plist</td>
1.270 ! leot 12990: <td>post-extract</td>
1.269 leot 12991: </tr>
12992: <tr>
12993: <td>post-fetch</td>
1.270 ! leot 12994: <td>post-wrapper</td>
1.269 leot 12995: </tr>
12996: <tr>
12997: <td>pre-configure</td>
1.270 ! leot 12998: <td>pre-extract</td>
1.269 leot 12999: </tr>
13000: <tr>
13001: <td>pre-fetch</td>
1.270 ! leot 13002: <td>print-go-deps</td>
1.269 leot 13003: </tr>
13004: <tr>
13005: <td>print-plist</td>
1.270 ! leot 13006: <td>print-summary-data</td>
1.269 leot 13007: </tr>
13008: <tr>
13009: <td>privileged-install-hook</td>
1.270 ! leot 13010: <td>pypi</td>
1.269 leot 13011: </tr>
13012: <tr>
13013: <td>python</td>
1.270 ! leot 13014: <td>readme-all</td>
1.269 leot 13015: </tr>
13016: <tr>
13017: <td>regcomp</td>
1.270 ! leot 13018: <td>relro</td>
1.269 leot 13019: </tr>
13020: <tr>
13021: <td>rename</td>
1.270 ! leot 13022: <td>reorder</td>
1.269 leot 13023: </tr>
13024: <tr>
13025: <td>replace</td>
1.270 ! leot 13026: <td>replace_interpreter</td>
1.269 leot 13027: </tr>
13028: <tr>
13029: <td>reproducible</td>
1.270 ! leot 13030: <td>resolv</td>
1.269 leot 13031: </tr>
13032: <tr>
13033: <td>root</td>
1.270 ! leot 13034: <td>ruby</td>
1.269 leot 13035: </tr>
13036: <tr>
13037: <td>setenv</td>
1.270 ! leot 13038: <td>setgid</td>
1.269 leot 13039: </tr>
13040: <tr>
13041: <td>setprogname</td>
1.270 ! leot 13042: <td>setuid</td>
1.269 leot 13043: </tr>
13044: <tr>
13045: <td>sh</td>
1.270 ! leot 13046: <td>show</td>
1.269 leot 13047: </tr>
13048: <tr>
13049: <td>show-all</td>
1.270 ! leot 13050: <td>show-build-defs</td>
1.269 leot 13051: </tr>
13052: <tr>
13053: <td>show-depends</td>
1.270 ! leot 13054: <td>show-deps</td>
1.269 leot 13055: </tr>
13056: <tr>
13057: <td>show-distfiles</td>
1.270 ! leot 13058: <td>show-downlevel</td>
1.269 leot 13059: </tr>
13060: <tr>
13061: <td>show-subdir-var</td>
1.270 ! leot 13062: <td>show-tools</td>
1.269 leot 13063: </tr>
13064: <tr>
13065: <td>show-var</td>
1.270 ! leot 13066: <td>show-vars</td>
1.269 leot 13067: </tr>
13068: <tr>
13069: <td>snprintf</td>
1.270 ! leot 13070: <td>ssp</td>
1.269 leot 13071: </tr>
13072: <tr>
13073: <td>st_mode</td>
1.270 ! leot 13074: <td>stage-install</td>
1.269 leot 13075: </tr>
13076: <tr>
13077: <td>strip</td>
1.270 ! leot 13078: <td>strong</td>
1.269 leot 13079: </tr>
13080: <tr>
13081: <td>subst</td>
1.270 ! leot 13082: <td>subversion</td>
1.269 leot 13083: </tr>
13084: <tr>
13085: <td>sun</td>
1.270 ! leot 13086: <td>sunpro</td>
1.269 leot 13087: </tr>
13088: <tr>
13089: <td>sunwspro</td>
1.270 ! leot 13090: <td>svn</td>
1.269 leot 13091: </tr>
13092: <tr>
13093: <td>test</td>
1.270 ! leot 13094: <td>tex</td>
1.269 leot 13095: </tr>
13096: <tr>
13097: <td>texlive</td>
1.270 ! leot 13098: <td>tmp</td>
1.269 leot 13099: </tr>
13100: <tr>
13101: <td>tool</td>
1.270 ! leot 13102: <td>tools</td>
1.269 leot 13103: </tr>
13104: <tr>
13105: <td>tools-libtool-m4-override</td>
1.270 ! leot 13106: <td>type</td>
1.269 leot 13107: </tr>
13108: <tr>
13109: <td>ulimit</td>
1.270 ! leot 13110: <td>undefined</td>
1.269 leot 13111: </tr>
13112: <tr>
13113: <td>undo-replace</td>
1.270 ! leot 13114: <td>unlimit</td>
1.269 leot 13115: </tr>
13116: <tr>
13117: <td>unprivileged</td>
1.270 ! leot 13118: <td>unprivileged-install-hook</td>
1.269 leot 13119: </tr>
13120: <tr>
13121: <td>unstripped</td>
1.270 ! leot 13122: <td>update</td>
1.269 leot 13123: </tr>
13124: <tr>
13125: <td>upload</td>
1.270 ! leot 13126: <td>upload-distfiles</td>
1.269 leot 13127: </tr>
13128: <tr>
13129: <td>usage</td>
1.270 ! leot 13130: <td>use_tools</td>
1.269 leot 13131: </tr>
13132: <tr>
13133: <td>user</td>
1.270 ! leot 13134: <td>utimes</td>
1.269 leot 13135: </tr>
13136: <tr>
13137: <td>vasprintf</td>
1.270 ! leot 13138: <td>verbose</td>
1.269 leot 13139: </tr>
13140: <tr>
13141: <td>vsnprintf</td>
1.270 ! leot 13142: <td>warn</td>
1.269 leot 13143: </tr>
13144: <tr>
13145: <td>warning</td>
1.270 ! leot 13146: <td>warnings</td>
1.269 leot 13147: </tr>
13148: <tr>
13149: <td>warnx</td>
1.270 ! leot 13150: <td>weak</td>
1.269 leot 13151: </tr>
13152: <tr>
13153: <td>work</td>
1.270 ! leot 13154: <td>wrapper</td>
1.269 leot 13155: </tr>
13156: <tr>
13157: <td>yes</td>
1.270 ! leot 13158: <td> </td>
1.269 leot 13159: </tr>
13160: </table>
1.267 rillig 13161: </div>
13162: <div class="appendix">
13163: <div class="titlepage"><div><div><h1 class="title">
13164: <a name="editing"></a>Appendix E. Editing guidelines for the pkgsrc guide</h1></div></div></div>
1.75 rillig 13165: <div class="toc">
13166: <p><b>Table of Contents</b></p>
1.210 leot 13167: <dl class="toc">
1.267 rillig 13168: <dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
13169: <dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
1.75 rillig 13170: </dl>
13171: </div>
1.79 rillig 13172: <p>This section contains information on editing the pkgsrc
13173: guide itself.</p>
1.148 asau 13174: <div class="sect1">
1.75 rillig 13175: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 13176: <a name="targets"></a>E.1. Make targets</h2></div></div></div>
1.79 rillig 13177: <p>The pkgsrc guide's source code is stored in
13178: <code class="filename">pkgsrc/doc/guide/files</code>, and several files
13179: are created from it:</p>
1.148 asau 13180: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 13181: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.txt</code></p></li>
13182: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.html</code></p></li>
13183: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/docs/pkgsrc/" target="_top">http://www.NetBSD.org/docs/pkgsrc/</a></p></li>
13184: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf" target="_top">http://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf</a>:
1.79 rillig 13185: The PDF version of the pkgsrc guide.</p></li>
1.128 wiz 13186: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps" target="_top">http://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps</a>:
1.79 rillig 13187: PostScript version of the pkgsrc guide.</p></li>
1.75 rillig 13188: </ul></div>
13189: </div>
1.148 asau 13190: <div class="sect1">
1.75 rillig 13191: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 13192: <a name="procedure"></a>E.2. Procedure</h2></div></div></div>
1.79 rillig 13193: <p>The procedure to edit the pkgsrc guide is:</p>
1.128 wiz 13194: <div class="procedure"><ol class="procedure" type="1">
1.148 asau 13195: <li class="step"><p>Make sure you have the packages needed to
1.83 wiz 13196: regenerate the pkgsrc guide (and other XML-based NetBSD
1.151 obache 13197: documentation) installed. These are automatically installed when
1.250 leot 13198: you install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/pkgsrc-guide-tools/README.html" target="_top"><code class="filename">meta-pkgs/pkgsrc-guide-tools</code></a> package.</p></li>
1.148 asau 13199: <li class="step"><p>Run <span class="command"><strong>cd doc/guide</strong></span> to get to the
1.79 rillig 13200: right directory. All further steps will take place
13201: here.</p></li>
1.148 asau 13202: <li class="step"><p>Edit the XML file(s) in
1.79 rillig 13203: <code class="filename">files/</code>.</p></li>
1.148 asau 13204: <li class="step"><p>Run <span class="command"><strong>bmake</strong></span> to check the pkgsrc
1.79 rillig 13205: guide for valid XML and to build the final output files. If you
13206: get any errors at this stage, you can just edit the files, as
13207: there are only symbolic links in the working directory, pointing
13208: to the files in <code class="filename">files/</code>.</p></li>
1.148 asau 13209: <li class="step"><p><span class="command"><strong>(cd files && cvs
1.79 rillig 13210: commit)</strong></span></p></li>
1.148 asau 13211: <li class="step"><p>Run <span class="command"><strong>bmake clean && bmake</strong></span> to
1.79 rillig 13212: regenerate the output files with the proper RCS
13213: Ids.</p></li>
1.148 asau 13214: <li class="step">
1.110 hubertf 13215: <p>Run <span class="command"><strong>bmake regen</strong></span> to install and
1.91 rillig 13216: commit the files in both <code class="filename">pkgsrc/doc</code> and
13217: <code class="filename">htdocs</code>.</p>
1.148 asau 13218: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.91 rillig 13219: <h3 class="title">Note</h3>
13220: <p>If you have added, removed or renamed some chapters,
1.110 hubertf 13221: you need to synchronize them using <span class="command"><strong>cvs add</strong></span> or
13222: <span class="command"><strong>cvs delete</strong></span> in the htdocs
1.91 rillig 13223: directory.</p>
13224: </div>
13225: </li>
1.79 rillig 13226: </ol></div>
1.75 rillig 13227: </div>
13228: </div>
13229: </div></body>
1.1 grant 13230: </html>
CVSweb <webmaster@jp.NetBSD.org>