Annotation of pkgsrc/doc/pkgsrc.html, revision 1.267
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.267 ! rillig 34: <div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.34 2019/04/28 13:41:18 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.265 leot 966: <code class="literal">2019Q1</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.265 leot 992: <p>The tar file for the stable branch 2019Q1 is in the
993: directory <code class="filename">pkgsrc-2019Q1</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2019Q1/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.265 leot 996: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2019Q1/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.265 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-2019Q1 -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.146 wiz 1038: cvs -q -z2
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.265 leot 1096: <span class="quote">“<span class="quote">-rpkgsrc-2019Q1</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.257 leot 1341: to the root users <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?crontab+5.i386+NetBSD-8.0"><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.257 leot 1370: see <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?daily.conf+5.i386+NetBSD-8.0"><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.0"><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.257 leot 1561: <p>If you invoke the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><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.257 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.0"><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.257 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.0"><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.257 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.0"><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.257 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.0"><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.257 leot 1628: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><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.257 leot 1770: privileges using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-8.0"><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.257 leot 2011: another system with <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.0"><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.257 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.0"><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.257 leot 2654: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> feature of pkgsrc, it can become annoying to type in the root
1.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.257 leot 2728: scripts and to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><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
3099: <code class="varname">BUILD_DEPENDS</code> instead of <code class="varname">DEPENDS</code>.
3100: Your package may then look like this:</p>
1.77 rillig 3101: <pre class="programlisting">
1.100 rillig 3102: [...]
1.77 rillig 3103:
1.174 asau 3104: BUILD_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
1.100 rillig 3105: DEPENDS+= screen-[0-9]*:../../misc/screen
3106: DEPENDS+= screen>=4.0:../../misc/screen
1.77 rillig 3107:
1.100 rillig 3108: [...]
1.77 rillig 3109:
1.100 rillig 3110: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
3111: .include "../../devel/glib2/buildlink3.mk"
3112: .include "../../mk/bsd.pkg.mk"
1.77 rillig 3113: </pre>
3114: </li>
1.148 asau 3115: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
1.128 wiz 3116: 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 3117: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
3118: --explain</strong></span> or <span class="command"><strong>pkglint
1.91 rillig 3119: -e</strong></span>, which outputs additional
3120: explanations.</p></li>
1.148 asau 3121: <li class="step"><p>In many cases the package is not yet ready to build. You can
1.267 ! rillig 3122: 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 3123: over there, you can hopefully continue here.</p></li>
1.148 asau 3124: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
1.91 rillig 3125: directory from the extracted files. Besides these files, a lot of cache
3126: files and other system information has been saved in the working
3127: directory, which may become wrong after you edited the
3128: <code class="filename">Makefile</code>.</p></li>
1.148 asau 3129: <li class="step"><p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
1.267 ! rillig 3130: 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 3131: <li class="step"><p>When the package builds fine, the next step is to install
1.110 hubertf 3132: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
1.91 rillig 3133: everything works.</p></li>
1.148 asau 3134: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
1.91 rillig 3135: contains a list of the files that are installed by the package, is
1.110 hubertf 3136: nearly empty. Run <span class="command"><strong>bmake print-PLIST
1.91 rillig 3137: >PLIST</strong></span> to generate a probably correct list. Check
3138: the file using your preferred text editor to see if the list of
3139: files looks plausible.</p></li>
1.148 asau 3140: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
1.91 rillig 3141: <code class="filename">PLIST</code> contains garbage or not.</p></li>
1.148 asau 3142: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
1.91 rillig 3143: has been registered in the database of installed files, but with an
1.110 hubertf 3144: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
3145: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
1.91 rillig 3146: registered with the list of files from
3147: <code class="filename">PLIST</code>.</p></li>
1.148 asau 3148: <li class="step"><p>Run <span class="command"><strong>bmake package</strong></span> to create a binary
1.91 rillig 3149: package from the set of installed files.</p></li>
1.77 rillig 3150: </ol></div>
1.148 asau 3151: <div class="sect1">
1.91 rillig 3152: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3153: <a name="creating.common"></a>12.1. Common types of packages</h2></div></div></div>
1.148 asau 3154: <div class="sect2">
1.91 rillig 3155: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3156: <a name="creating.perl-module"></a>12.1.1. Perl modules</h3></div></div></div>
1.91 rillig 3157: <p>Simple Perl modules are handled automatically by
1.110 hubertf 3158: <span class="command"><strong>url2pkg</strong></span>, including dependencies.</p>
1.91 rillig 3159: </div>
1.148 asau 3160: <div class="sect2">
1.91 rillig 3161: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3162: <a name="creating.python-module"></a>12.1.2. Python modules and programs</h3></div></div></div>
1.118 imil 3163: <p>Python modules and programs packages are easily created using a
3164: set of predefined variables.</p>
3165: <p>
1.171 wiz 3166: If some Python versions are not supported by the software, set the
3167: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
3168: that are not supported, e.g.
1.118 imil 3169: </p>
3170: <pre class="programlisting">
1.203 sevan 3171: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.118 imil 3172: </pre>
3173: <p>
1.213 wiz 3174: If the packaged software is a Python module, include one of
3175: <code class="filename">../../lang/python/egg.mk</code>,
3176: <code class="filename">../../lang/python/distutils.mk</code>, or
3177: <code class="filename">../../lang/python/extension.mk</code>.</p>
3178: <p>Most Python packages use either <span class="quote">“<span class="quote">distutils</span>”</span> or
3179: easy-setup/setuptools (<span class="quote">“<span class="quote">eggs</span>”</span>).
3180: if the packaged software is using setuptools, you only need
3181: to include <span class="quote">“<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>”</span>.
3182: Otherwise, if the software uses <span class="quote">“<span class="quote">distutils</span>”</span>, include
3183: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/distutils.mk</code></span>”</span>.
3184: so pkgsrc will use this framework.
3185: <span class="quote">“<span class="quote">distutils</span>”</span> uses a script called <code class="filename">setup.py</code>,
3186: if the <span class="quote">“<span class="quote">distutils</span>”</span> driver is not called
3187: <code class="filename">setup.py</code>, set the <code class="varname">PYSETUP</code> variable
3188: to the name of the script.</p>
3189: <p>Either way, the package directory should be called
1.128 wiz 3190: <span class="quote">“<span class="quote">py-software</span>”</span> and <code class="varname">PKGNAME</code> should be set to
3191: <span class="quote">“<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>”</span>, e.g.
1.118 imil 3192: </p>
3193: <pre class="programlisting">
3194: DISTNAME= foopymodule-1.2.10
3195: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
3196: </pre>
1.171 wiz 3197: <p>If it is an application, include
3198: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>”</span>.
3199: In order to correctly set the path to the Python interpreter, use the
1.118 imil 3200: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
1.142 wiz 3201: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
1.171 wiz 3202: For example:
1.118 imil 3203: </p>
3204: <pre class="programlisting">
1.142 wiz 3205: REPLACE_PYTHON= *.py
1.118 imil 3206: </pre>
1.171 wiz 3207: <p>Some Python modules have separate distributions for Python-2.x
3208: and Python-3.x support. In pkgsrc this is handled by the
3209: <code class="filename">versioned_dependencies.mk</code> file. Set
3210: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
3211: packages that should be depended upon and include
3212: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>”</span>,
3213: then the pkgsrc infrastructure will depend on the appropriate package
3214: version. For example:
3215: </p>
3216: <pre class="programlisting">
1.248 wiz 3217: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.171 wiz 3218: </pre>
3219: <p>
3220: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
3221: of supported packages.</p>
1.118 imil 3222: </div>
1.91 rillig 3223: </div>
1.148 asau 3224: <div class="sect1">
1.91 rillig 3225: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3226: <a name="creating.examples"></a>12.2. Examples</h2></div></div></div>
1.148 asau 3227: <div class="sect2">
1.91 rillig 3228: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3229: <a name="creating.nvu"></a>12.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
1.148 asau 3230: <div class="sect3">
1.91 rillig 3231: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 3232: <a name="creating.nvu.init"></a>12.2.1.1. The initial package</h4></div></div></div>
1.91 rillig 3233: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
1.128 wiz 3234: that the <span class="quote">“<span class="quote">nvu</span>”</span> package has not yet been imported into
1.91 rillig 3235: pkgsrc. As the description says it has to do with the web, the obvious
1.128 wiz 3236: choice for the category is <span class="quote">“<span class="quote">www</span>”</span>.</p>
1.91 rillig 3237: <pre class="programlisting">
1.100 rillig 3238: <code class="prompt">$</code> mkdir www/nvu
3239: <code class="prompt">$</code> cd www/nvu
1.91 rillig 3240: </pre>
3241: <p>The web site says that the sources are available as a tar file, so
1.110 hubertf 3242: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
1.91 rillig 3243: <pre class="programlisting">
1.100 rillig 3244: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.91 rillig 3245: </pre>
3246: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
3247: below the <code class="varname">DISTNAME</code> line, as the package name should
1.128 wiz 3248: not have the word <span class="quote">“<span class="quote">sources</span>”</span> in it. I also filled in the
1.91 rillig 3249: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
3250: <code class="varname">COMMENT</code> fields. Then the package
3251: <code class="filename">Makefile</code> looked like that:</p>
3252: <pre class="programlisting">
1.233 sevan 3253: # $NetBSD $
1.100 rillig 3254: #
1.91 rillig 3255:
1.100 rillig 3256: DISTNAME= nvu-1.0-sources
3257: PKGNAME= nvu-1.0
3258: CATEGORIES= www
3259: MASTER_SITES= http://cvs.nvu.com/download/
3260: EXTRACT_SUFX= .tar.bz2
3261:
3262: MAINTAINER= rillig@NetBSD.org
3263: HOMEPAGE= http://cvs.nvu.com/
3264: COMMENT= Web Authoring System
1.91 rillig 3265:
1.100 rillig 3266: # url2pkg-marker (please do not remove this line.)
3267: .include "../../mk/bsd.pkg.mk"
1.91 rillig 3268: </pre>
1.237 wiz 3269: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
1.233 sevan 3270: this is a workaround to prevent CVS expanding to the filename of the
3271: guide.</p>
1.91 rillig 3272: <p>Then, I quit the editor and watched pkgsrc downloading a large
3273: source archive:</p>
3274: <pre class="programlisting">
1.100 rillig 3275: url2pkg> Running "make makesum" ...
3276: => Required installed package digest>=20010302: digest-20060826 found
3277: => Fetching nvu-1.0-sources.tar.bz2
3278: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
3279: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
3280: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
3281: url2pkg> Running "make extract" ...
3282: => Required installed package digest>=20010302: digest-20060826 found
3283: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3284: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3285: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
3286: ===> Installing dependencies for nvu-1.0
3287: ===> Overriding tools for nvu-1.0
3288: ===> Extracting for nvu-1.0
3289: url2pkg> Adjusting the Makefile.
1.91 rillig 3290:
1.100 rillig 3291: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.91 rillig 3292:
1.100 rillig 3293: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.91 rillig 3294: </pre>
3295: </div>
1.148 asau 3296: <div class="sect3">
1.91 rillig 3297: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 3298: <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 3299: <p>Now that the package has been extracted, let's see what's inside
3300: it. The package has a <code class="filename">README.txt</code>, but that only
3301: says something about mozilla, so it's probably useless for seeing what
3302: dependencies this package has. But since there is a GNU configure script
3303: in the package, let's hope that it will complain about everything it
3304: needs.</p>
3305: <pre class="programlisting">
1.100 rillig 3306: <code class="prompt">$</code> bmake
3307: => Required installed package digest>=20010302: digest-20060826 found
3308: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3309: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3310: ===> Patching for nvu-1.0
3311: ===> Creating toolchain wrappers for nvu-1.0
3312: ===> Configuring for nvu-1.0
3313: [...]
3314: configure: error: Perl 5.004 or higher is required.
3315: [...]
3316: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
3317: [...]
1.91 rillig 3318: </pre>
3319: <p>That worked quite well. So I opened the package Makefile in my
3320: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
1.128 wiz 3321: just appended <span class="quote">“<span class="quote">perl</span>”</span> to it. Since the dependencies of the
1.91 rillig 3322: package have changed now, and since a perl wrapper is automatically
1.128 wiz 3323: installed in the <span class="quote">“<span class="quote">tools</span>”</span> phase, I need to build the package
1.91 rillig 3324: from scratch.</p>
3325: <pre class="programlisting">
1.100 rillig 3326: <code class="prompt">$</code> bmake clean
3327: ===> Cleaning for nvu-1.0
3328: <code class="prompt">$</code> bmake
3329: [...]
3330: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
3331: GNU Make. You will not be able to build Mozilla without GNU Make.
3332: [...]
1.91 rillig 3333: </pre>
1.128 wiz 3334: <p>So I added <span class="quote">“<span class="quote">gmake</span>”</span> to the
1.91 rillig 3335: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
3336: <pre class="programlisting">
1.100 rillig 3337: [...]
3338: checking for GTK - version >= 1.2.0... no
3339: *** Could not run GTK test program, checking why...
3340: [...]
1.91 rillig 3341: </pre>
3342: <p>Now to the other dependencies. The first question is: Where is the
3343: GTK package hidden in pkgsrc?</p>
3344: <pre class="programlisting">
1.100 rillig 3345: <code class="prompt">$</code> echo ../../*/gtk*
3346: [many packages ...]
3347: <code class="prompt">$</code> echo ../../*/gtk
3348: ../../x11/gtk
3349: <code class="prompt">$</code> echo ../../*/gtk2
3350: ../../x11/gtk2
3351: <code class="prompt">$</code> echo ../../*/gtk2/bui*
3352: ../../x11/gtk2/buildlink3.mk
1.91 rillig 3353: </pre>
3354: <p>The first try was definitely too broad. The second one had exactly
3355: one result, which is very good. But there is one pitfall with GNOME
3356: packages. Before GNOME 2 had been released, there were already many
3357: GNOME 1 packages in pkgsrc. To be able to continue to use these
3358: packages, the GNOME 2 packages were imported as separate packages, and
1.128 wiz 3359: their names usually have a <span class="quote">“<span class="quote">2</span>”</span> appended. So I checked
1.91 rillig 3360: whether this was the case here, and indeed it was.</p>
3361: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
3362: file, adding the dependency is very easy. I just inserted an
3363: <code class="literal">.include</code> line before the last line of the package
3364: <code class="filename">Makefile</code>, so that it now looks like this:</p>
3365: <pre class="programlisting">
1.100 rillig 3366: [...]
3367: .include "../../x11/gtk2/buildlink3.mk"
3368: .include "../../mk/bsd.pkg.mk
1.91 rillig 3369: </pre>
1.110 hubertf 3370: <p>After another <span class="command"><strong>bmake clean && bmake</strong></span>, the answer
1.91 rillig 3371: was:</p>
3372: <pre class="programlisting">
1.100 rillig 3373: [...]
3374: checking for gtk-config... /home/roland/pkg/bin/gtk-config
3375: checking for GTK - version >= 1.2.0... no
3376: *** Could not run GTK test program, checking why...
3377: *** The test program failed to compile or link. See the file config.log for the
3378: *** exact error that occured. This usually means GTK was incorrectly installed
3379: *** or that you have moved GTK since it was installed. In the latter case, you
3380: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
3381: configure: error: Test for GTK failed.
3382: [...]
1.91 rillig 3383: </pre>
1.128 wiz 3384: <p>In this particular case, the assumption that <span class="quote">“<span class="quote">every package
3385: prefers GNOME 2</span>”</span> had been wrong. The first of the lines above
1.91 rillig 3386: told me that this package really wanted to have the GNOME 1 version of
3387: GTK. If the package had looked for GTK2, it would have looked for
1.110 hubertf 3388: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
1.91 rillig 3389: So I changed the <code class="literal">x11/gtk2</code> to
3390: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
3391: and tried again.</p>
3392: <pre class="programlisting">
1.100 rillig 3393: [...]
1.166 jnemeth 3394: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
1.100 rillig 3395: In file included from xpidl.c:42:
3396: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
3397: In file included from xpidl.c:42:
3398: xpidl.h:132: error: parse error before "IDL_ns"
3399: [...]
1.91 rillig 3400: </pre>
3401: <p>The package still does not find all of its dependencies. Now the
3402: question is: Which package provides the
3403: <code class="filename">libIDL/IDL.h</code> header file?</p>
3404: <pre class="programlisting">
1.100 rillig 3405: <code class="prompt">$</code> echo ../../*/*idl*
3406: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
3407: <code class="prompt">$</code> echo ../../*/*IDL*
3408: ../../net/libIDL
1.91 rillig 3409: </pre>
3410: <p>Let's take the one from the second try. So I included the
3411: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
3412: again. But the error didn't change. After digging through some of the
3413: code, I concluded that the build process of the package was broken and
3414: couldn't have ever worked, but since the Mozilla source tree is quite
3415: large, I didn't want to fix it. So I added the following to the package
3416: <code class="filename">Makefile</code> and tried again:</p>
3417: <pre class="programlisting">
1.100 rillig 3418: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.252 leot 3419: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.91 rillig 3420: </pre>
3421: <p>The latter line is needed because the package expects the library
3422: <code class="filename">libIDL.so</code>, but only
3423: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
3424: wrapper to rewrite that on the fly.</p>
3425: <p>The next problem was related to a recent change of the FreeType
1.250 leot 3426: 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 3427: which patch files were relevant for this issue and copied them to the
3428: <code class="filename">patches</code> directory. Then I retried, fixed the
3429: patches so that they applied cleanly and retried again. This time,
3430: everything worked.</p>
3431: </div>
1.148 asau 3432: <div class="sect3">
1.91 rillig 3433: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 3434: <a name="creating.nvu.inst"></a>12.2.1.3. Installing the package</h4></div></div></div>
1.91 rillig 3435: <pre class="programlisting">
1.100 rillig 3436: <code class="prompt">$</code> bmake CHECK_FILES=no install
3437: [...]
3438: <code class="prompt">$</code> bmake print-PLIST >PLIST
3439: <code class="prompt">$</code> bmake deinstall
3440: <code class="prompt">$</code> bmake install
1.91 rillig 3441: </pre>
3442: </div>
3443: </div>
3444: </div>
1.77 rillig 3445: </div>
1.148 asau 3446: <div class="chapter">
1.75 rillig 3447: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 3448: <a name="components"></a>Chapter 13. Package components - files, directories and contents</h2></div></div></div>
1.75 rillig 3449: <div class="toc">
3450: <p><b>Table of Contents</b></p>
1.210 leot 3451: <dl class="toc">
1.267 ! rillig 3452: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
! 3453: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
! 3454: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
! 3455: <dd><dl>
! 3456: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
! 3457: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
! 3458: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
! 3459: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
! 3460: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
! 3461: </dl></dd>
! 3462: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
! 3463: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
! 3464: <dd><dl>
! 3465: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
! 3466: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
! 3467: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.78 rillig 3468: </dl></dd>
1.267 ! rillig 3469: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
! 3470: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.75 rillig 3471: </dl>
3472: </div>
1.87 wiz 3473: <p>Whenever you're preparing a package, there are a number of
3474: files involved which are described in the following
3475: sections.</p>
1.148 asau 3476: <div class="sect1">
1.75 rillig 3477: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3478: <a name="components.Makefile"></a>13.1. <code class="filename">Makefile</code>
1.93 rillig 3479: </h2></div></div></div>
1.75 rillig 3480: <p>Building, installation and creation of a binary package are all
1.87 wiz 3481: controlled by the package's <code class="filename">Makefile</code>.
3482: The <code class="filename">Makefile</code> describes various things about
3483: a package, for example from where to get it, how to configure,
3484: build, and install it.</p>
1.76 rillig 3485: <p>A package <code class="filename">Makefile</code> contains several
1.87 wiz 3486: sections that describe the package.</p>
1.75 rillig 3487: <p>In the first section there are the following variables, which
1.87 wiz 3488: should appear exactly in the order given here. The order and
3489: grouping of the variables is mostly historical and has no further
3490: meaning.</p>
1.148 asau 3491: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3492: <li class="listitem"><p><code class="varname">DISTNAME</code> is the basename of the
1.87 wiz 3493: distribution file to be downloaded from the package's
3494: website.</p></li>
1.128 wiz 3495: <li class="listitem"><p><code class="varname">PKGNAME</code> is the name of the
1.174 asau 3496: package, as used by pkgsrc. You need to provide it if
1.87 wiz 3497: <code class="varname">DISTNAME</code> (which is the default) is not a good
1.174 asau 3498: name for the package in pkgsrc or <code class="varname">DISTNAME</code> is not
3499: provided (no distribution file is required). Usually it is the pkgsrc
1.87 wiz 3500: directory name together with the version number. It must match the
3501: regular expression
3502: <code class="varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>, that is, it
3503: starts with a letter or digit, and contains only letters, digits,
3504: dashes, underscores, dots and plus signs.</p></li>
1.128 wiz 3505: <li class="listitem">
1.75 rillig 3506: <p><code class="varname">CATEGORIES</code> is a list of categories
1.87 wiz 3507: which the package fits in. You can choose any of the top-level
3508: directories of pkgsrc for it.</p>
1.75 rillig 3509: <p>Currently the following values are available for
1.87 wiz 3510: <code class="varname">CATEGORIES</code>. If more than
3511: one is used, they need to be separated by spaces:</p>
1.75 rillig 3512: <pre class="programlisting">
1.100 rillig 3513: archivers cross geography meta-pkgs security
3514: audio databases graphics misc shells
3515: benchmarks devel ham multimedia sysutils
3516: biology editors inputmethod net textproc
3517: cad emulators lang news time
3518: chat finance mail parallel wm
3519: comms fonts math pkgtools www
3520: converters games mbone print x11
3521: </pre>
1.75 rillig 3522: </li>
1.128 wiz 3523: <li class="listitem"><p><code class="varname">MASTER_SITES</code>,
1.87 wiz 3524: <code class="varname">DYNAMIC_MASTER_SITES</code>,
3525: <code class="varname">DIST_SUBDIR</code>, <code class="varname">EXTRACT_SUFX</code>
3526: and <code class="varname">DISTFILES</code> are discussed in detail in
1.267 ! rillig 3527: <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 3528: </ul></div>
3529: <p>The second section contains information about separately
1.87 wiz 3530: downloaded patches, if any.
3531: </p>
1.148 asau 3532: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.190 wiz 3533: <li class="listitem"><p><code class="varname">PATCHFILES</code>:
1.87 wiz 3534: Name(s) of additional files that contain distribution patches.
3535: There is no default. pkgsrc will look for them at
3536: <code class="varname">PATCH_SITES</code>.
3537: They will automatically be uncompressed before patching if
3538: the names end with <code class="filename">.gz</code> or
3539: <code class="filename">.Z</code>.</p></li>
1.128 wiz 3540: <li class="listitem"><p><code class="varname">PATCH_SITES</code>:
1.87 wiz 3541: Primary location(s) for distribution patch files (see
1.190 wiz 3542: <code class="varname">PATCHFILES</code> above) if not found locally.</p></li>
3543: <li class="listitem"><p><code class="varname">PATCH_DIST_STRIP</code>:
1.257 leot 3544: an argument to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> that sets the pathname strip count to
1.190 wiz 3545: help find the correct files to patch. It defaults to
3546: <span class="command"><strong>-p0</strong></span>.</p></li>
1.75 rillig 3547: </ul></div>
3548: <p>The third section contains the following variables.
1.87 wiz 3549: </p>
1.148 asau 3550: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3551: <li class="listitem"><p><code class="varname">MAINTAINER</code> is the email
1.114 jmcneill 3552: address of the person who feels responsible for this package,
3553: and who is most likely to look at problems or questions regarding
1.257 leot 3554: 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.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a>.
1.114 jmcneill 3555: Other developers may contact the <code class="varname">MAINTAINER</code>
3556: before making changes to the package, but are not required to
3557: do so. When packaging a new program, set <code class="varname">MAINTAINER</code>
3558: to yourself. If you really can't maintain the package for future
3559: updates, set it to
1.110 hubertf 3560: <code class="email"><<a class="email" href="mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p></li>
1.128 wiz 3561: <li class="listitem"><p><code class="varname">OWNER</code> should be used instead
1.114 jmcneill 3562: of <code class="varname">MAINTAINER</code> when you do not want other
3563: developers to update or change the package without contacting
3564: you first. A package Makefile should contain one of
3565: <code class="varname">MAINTAINER</code> or <code class="varname">OWNER</code>, but
3566: not both. </p></li>
1.128 wiz 3567: <li class="listitem"><p><code class="varname">HOMEPAGE</code> is a URL where users can
1.87 wiz 3568: find more information about the package.</p></li>
1.128 wiz 3569: <li class="listitem"><p><code class="varname">COMMENT</code> is a one-line
1.87 wiz 3570: description of the package (should not include the package
3571: name).</p></li>
1.234 leot 3572: <li class="listitem"><p><code class="varname">LICENSE</code> indicates the license(s)
1.267 ! rillig 3573: 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 3574: </ul></div>
3575: <p>Other variables that affect the build:
1.87 wiz 3576: </p>
1.148 asau 3577: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.75 rillig 3578: <p><code class="varname">WRKSRC</code>: The directory where the
1.87 wiz 3579: interesting distribution files of the package are found. The
3580: default is <code class="filename">${WRKDIR}/${DISTNAME}</code>, which
3581: works for most packages.</p>
1.75 rillig 3582: <p>If a package doesn't create a subdirectory for itself
1.87 wiz 3583: (most GNU software does, for instance), but extracts itself in
3584: the current directory, you should set
3585: <code class="varname">WRKSRC=${WRKDIR}</code>.</p>
3586: <p>If a package doesn't create a subdirectory with the
3587: name of <code class="varname">DISTNAME</code> but some different name,
3588: set <code class="varname">WRKSRC</code> to point to the proper name in
3589: <code class="filename">${WRKDIR}</code>, for example
3590: <code class="varname">WRKSRC=${WRKDIR}/${DISTNAME}/unix</code>. See
1.250 leot 3591: <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 3592: <p>The name of the working directory created by pkgsrc is
1.87 wiz 3593: taken from the <code class="varname">WRKDIR_BASENAME</code>
3594: variable. By default, its value is
3595: <code class="filename">work</code>. If you want to use the same
3596: pkgsrc tree for building different kinds of binary packages,
3597: you can change the variable according to your needs. Two
3598: other variables handle common cases of setting
3599: <code class="varname">WRKDIR_BASENAME</code> individually. If
3600: <code class="varname">OBJHOSTNAME</code> is defined in
1.110 hubertf 3601: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the first component of
1.87 wiz 3602: the host's name is attached to the directory name. If
3603: <code class="varname">OBJMACHINE</code> is defined, the platform name
3604: is attached, which might look like
3605: <code class="filename">work.i386</code> or
3606: <code class="filename">work.sparc</code>.</p>
1.75 rillig 3607: </li></ul></div>
3608: <p>Please pay attention to the following gotchas:</p>
1.148 asau 3609: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3610: <li class="listitem"><p>Add <code class="varname">MANCOMPRESSED</code> if man pages are
1.88 wiz 3611: installed in compressed form by the package. For packages using
3612: BSD-style makefiles which honor MANZ, there is
3613: <code class="varname">MANCOMPRESSED_IF_MANZ</code>.</p></li>
1.128 wiz 3614: <li class="listitem"><p>Replace <code class="filename">/usr/local</code> with
3615: <span class="quote">“<span class="quote">${PREFIX}</span>”</span> in all files (see patches,
1.88 wiz 3616: below).</p></li>
1.267 ! rillig 3617: <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 3618: </ul></div>
3619: </div>
1.148 asau 3620: <div class="sect1">
1.75 rillig 3621: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3622: <a name="components.distinfo"></a>13.2. <code class="filename">distinfo</code>
1.93 rillig 3623: </h2></div></div></div>
1.76 rillig 3624: <p>The <code class="filename">distinfo</code> file contains the message
1.87 wiz 3625: digest, or checksum, of each distfile needed for the package. This
3626: ensures that the distfiles retrieved from the Internet have not been
3627: corrupted during transfer or altered by a malign force to introduce
1.219 rillig 3628: a security hole. To provide maximum security, all distfiles are
3629: protected using three different message digest algorithms (SHA1,
3630: RMD160, SHA512), as well as the file size.</p>
1.76 rillig 3631: <p>The <code class="filename">distinfo</code> file also contains the
1.87 wiz 3632: checksums for all the patches found in the
1.267 ! rillig 3633: <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 3634: are only applied intentionally and that they don't accidentally change,
3635: e.g. when merging different changes together. They also make sure that
3636: new patches are actually added to CVS and old ones are removed.
3637: Too see whether the patches and the <code class="filename">distinfo</code> file
3638: match, run <span class="command"><strong>pkglint</strong></span> after changing the patches.</p>
1.76 rillig 3639: <p>To regenerate the <code class="filename">distinfo</code> file, use the
1.219 rillig 3640: <span class="command"><strong>make distinfo</strong></span> command.</p>
1.75 rillig 3641: <p>Some packages have different sets of distfiles depending on
1.250 leot 3642: 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 3643: <code class="filename">distinfo</code> file and care should be taken when
3644: upgrading such a package to ensure distfile information is not
3645: lost.</p>
1.75 rillig 3646: </div>
1.148 asau 3647: <div class="sect1">
1.75 rillig 3648: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3649: <a name="components.patches"></a>13.3. <code class="filename">patches/*</code>
1.219 rillig 3650: </h2></div></div></div>
3651: <p>Some packages don't work out-of-the box on the various
3652: platforms that are supported by pkgsrc. These packages need
3653: to be patched to make them work. The patch files can be
1.93 rillig 3654: found in the <code class="filename">patches/</code> directory.</p>
3655: <p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
3656: applied to the files in <code class="varname">WRKSRC</code> directory after
1.219 rillig 3657: extracting them, in alphabetic order.</p>
1.148 asau 3658: <div class="sect2">
1.93 rillig 3659: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3660: <a name="components.patch.structure"></a>13.3.1. Structure of a single patch file</h3></div></div></div>
1.76 rillig 3661: <p>The <code class="filename">patch-*</code> files should be in
1.110 hubertf 3662: <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
1.93 rillig 3663: problems. (To force patches to apply with fuzz you can set
3664: <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
1.94 dmcmahil 3665: should contain only changes for a single file, and no file should be
1.93 rillig 3666: patched by more than one patch file. This helps to keep future
3667: modifications simple.</p>
3668: <p>Each patch file is structured as follows: In the first line,
3669: there is the RCS Id of the patch itself. The second line should be
3670: empty for aesthetic reasons. After that, there should be a comment for
3671: each change that the patch does. There are a number of standard
3672: cases:</p>
1.148 asau 3673: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 3674: <li class="listitem"><p>Patches for commonly known vulnerabilities should
1.93 rillig 3675: mention the vulnerability ID (CAN, CVE).</p></li>
1.128 wiz 3676: <li class="listitem"><p>Patches that change source code should mention the
1.93 rillig 3677: platform and other environment (for example, the compiler) that the
3678: patch is needed for.</p></li>
3679: </ul></div>
1.219 rillig 3680: <p>The patch should be commented so that any
1.93 rillig 3681: developer who knows the code of the application can make some use of
3682: the patch. Special care should be taken for the upstream developers,
3683: since we generally want that they accept our patches, so we have less
3684: work in the future.</p>
3685: </div>
1.148 asau 3686: <div class="sect2">
1.93 rillig 3687: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3688: <a name="components.patches.caveats"></a>13.3.2. Creating patch files</h3></div></div></div>
1.93 rillig 3689: <p>One important thing to mention is to pay attention that no RCS
3690: IDs get stored in the patch files, as these will cause problems when
1.87 wiz 3691: later checked into the NetBSD CVS tree. Use the
1.250 leot 3692: <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 3693: problems.</p>
1.87 wiz 3694: <p>For even more automation, we recommend using
1.110 hubertf 3695: <span class="command"><strong>mkpatches</strong></span> from the same package to make a
1.87 wiz 3696: whole set of patches. You just have to backup files before you
3697: edit them to <code class="filename">filename.orig</code>, e.g. with
1.110 hubertf 3698: <span class="command"><strong>cp -p filename filename.orig</strong></span> or, easier, by
3699: using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
1.87 wiz 3700: you upgrade a package this way, you can easily compare the new
3701: set of patches with the previously existing one with
1.130 wiz 3702: <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
3703: are replaced by new files, so carefully check if you want to take all
3704: the changes.</p>
1.87 wiz 3705: <p>When you have finished a package, remember to generate
1.110 hubertf 3706: the checksums for the patch files by using the <span class="command"><strong>make
1.267 ! rillig 3707: 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 3708: <p>When adding a patch that corrects a problem in the
3709: distfile (rather than e.g. enforcing pkgsrc's view of where
3710: man pages should go), send the patch as a bug report to the
3711: maintainer. This benefits non-pkgsrc users of the package,
3712: and usually makes it possible to remove the patch in future
3713: version.</p>
1.101 rillig 3714: <p>The file names of the patch files are usually of the form
1.130 wiz 3715: <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
3716: Many packages still use the previous convention
3717: <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
3718: but new patches should be of the form containing the filename.
1.250 leot 3719: <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 3720: automatically.</p>
1.93 rillig 3721: </div>
1.148 asau 3722: <div class="sect2">
1.93 rillig 3723: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3724: <a name="components.patches.sources"></a>13.3.3. Sources where the patch files come from</h3></div></div></div>
1.87 wiz 3725: <p>If you want to share patches between multiple packages
3726: in pkgsrc, e.g. because they use the same distfiles, set
3727: <code class="varname">PATCHDIR</code> to the path where the patch files
3728: can be found, e.g.:</p>
3729: <pre class="programlisting">
1.100 rillig 3730: PATCHDIR= ${.CURDIR}/../xemacs/patches
1.93 rillig 3731: </pre>
1.75 rillig 3732: <p>Patch files that are distributed by the author or other
1.87 wiz 3733: maintainers can be listed in
3734: <code class="varname">PATCHFILES</code>.</p>
3735: <p>If it is desired to store any patches that should not be
3736: committed into pkgsrc, they can be kept outside the pkgsrc
3737: tree in the <code class="filename">$LOCALPATCHES</code> directory. The
3738: directory tree there is expected to have the same
1.128 wiz 3739: <span class="quote">“<span class="quote">category/package</span>”</span> structure as pkgsrc, and
1.87 wiz 3740: patches are expected to be stored inside these dirs (also
3741: known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
3742: example, if you want to keep a private patch for
3743: <code class="filename">pkgsrc/graphics/png</code>, keep it in
3744: <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
3745: files in the named directory are expected to be patch files,
3746: and <span class="emphasis"><em>they are applied after pkgsrc patches are
3747: applied</em></span>.</p>
1.93 rillig 3748: </div>
1.148 asau 3749: <div class="sect2">
1.85 jmmv 3750: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3751: <a name="components.patches.guidelines"></a>13.3.4. Patching guidelines</h3></div></div></div>
1.85 jmmv 3752: <p>When fixing a portability issue in the code do not use
3753: preprocessor magic to check for the current operating system nor
3754: platform. Doing so hurts portability to other platforms because
3755: the OS-specific details are not abstracted appropriately.</p>
3756: <p>The general rule to follow is: instead of checking for the
3757: operating system the application is being built on, check for the
3758: specific <span class="emphasis"><em>features</em></span> you need. For example,
3759: instead of assuming that kqueue is available under NetBSD and
3760: using the <code class="varname">__NetBSD__</code> macro to conditionalize
1.126 jakllsch 3761: kqueue support, add a check that detects kqueue itself —
1.85 jmmv 3762: yes, this generally involves patching the
1.110 hubertf 3763: <span class="command"><strong>configure</strong></span> script. There is absolutely nothing
1.85 jmmv 3764: that prevents some OSes from adopting interfaces from other OSes
3765: (e.g. Linux implementing kqueue), something that the above checks
3766: cannot take into account.</p>
3767: <p>Of course, checking for features generally involves more
3768: work on the developer's side, but the resulting changes are
1.87 wiz 3769: cleaner and there are chances they will work on many other
1.85 jmmv 3770: platforms. Not to mention that there are higher chances of being
3771: later integrated into the mainstream sources. Remember:
3772: <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
3773: <p>Some typical examples:</p>
3774: <div class="table">
1.267 ! rillig 3775: <a name="patch-examples"></a><p class="title"><b>Table 13.1. Patching examples</b></p>
1.216 tnn 3776: <div class="table-contents"><table class="table" summary="Patching examples" border="1">
1.85 jmmv 3777: <colgroup>
3778: <col>
3779: <col>
3780: <col>
3781: </colgroup>
3782: <thead><tr>
3783: <th>Where</th>
3784: <th>Incorrect</th>
3785: <th>Correct</th>
3786: </tr></thead>
3787: <tbody>
3788: <tr>
3789: <td>configure script</td>
3790: <td>
1.100 rillig 3791: <pre class="programlisting">
3792: case ${target_os} in
3793: netbsd*) have_kvm=yes ;;
3794: *) have_kvm=no ;;
3795: esac
3796: </pre>
1.85 jmmv 3797: </td>
3798: <td>
1.100 rillig 3799: <pre class="programlisting">
3800: AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
3801: </pre>
1.85 jmmv 3802: </td>
3803: </tr>
3804: <tr>
3805: <td>C source file</td>
3806: <td>
1.100 rillig 3807: <pre class="programlisting">
3808: #if defined(__NetBSD__)
3809: # include <sys/event.h>
3810: #endif
3811: </pre>
1.85 jmmv 3812: </td>
3813: <td>
1.100 rillig 3814: <pre class="programlisting">
3815: #if defined(HAVE_SYS_EVENT_H)
3816: # include <sys/event.h>
3817: #endif
3818: </pre>
1.85 jmmv 3819: </td>
3820: </tr>
3821: <tr>
3822: <td>C source file</td>
3823: <td>
1.100 rillig 3824: <pre class="programlisting">
3825: int
3826: monitor_file(...)
3827: {
3828: #if defined(__NetBSD__)
3829: int fd = kqueue();
3830: ...
3831: #else
3832: ...
3833: #endif
3834: }
3835: </pre>
1.85 jmmv 3836: </td>
3837: <td>
1.100 rillig 3838: <pre class="programlisting">
3839: int
3840: monitor_file(...)
3841: {
3842: #if defined(HAVE_KQUEUE)
3843: int fd = kqueue();
3844: ...
3845: #else
1.223 rillig 3846: ...
1.100 rillig 3847: #endif
3848: }
3849: </pre>
1.85 jmmv 3850: </td>
3851: </tr>
3852: </tbody>
1.91 rillig 3853: </table></div>
1.85 jmmv 3854: </div>
1.254 maya 3855: <br class="table-break">
1.85 jmmv 3856: </div>
1.148 asau 3857: <div class="sect2">
1.85 jmmv 3858: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3859: <a name="components.patches.feedback"></a>13.3.5. Feedback to the author</h3></div></div></div>
1.85 jmmv 3860: <p>Always, always, <span class="strong"><strong>always</strong></span>
3861: feed back any <span class="emphasis"><em>portability fixes</em></span> or
3862: improvements you do to a package to the mainstream developers.
3863: This is the only way to get their attention on portability issues
3864: and to ensure that future versions can be built out-of-the box on
3865: NetBSD. Furthermore, any user that gets newer distfiles will get
3866: the fixes straight from the packaged code.</p>
1.93 rillig 3867: <p>This generally involves cleaning up the patches
3868: (because sometimes the patches that are
1.147 wiz 3869: added to pkgsrc are quick hacks), filing bug reports in the
1.85 jmmv 3870: appropriate trackers for the projects and working with the
3871: mainstream authors to accept your changes. It is
3872: <span class="emphasis"><em>extremely important</em></span> that you do it so that
3873: the packages in pkgsrc are kept simple and thus further changes
3874: can be done without much hassle.</p>
1.130 wiz 3875: <p>When you have done this, please add a URL to the upstream
3876: bug report to the patch comment.</p>
1.85 jmmv 3877: <p>Support the idea of free software!</p>
3878: </div>
1.75 rillig 3879: </div>
1.148 asau 3880: <div class="sect1">
1.75 rillig 3881: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3882: <a name="other-mandatory-files"></a>13.4. Other mandatory files</h2></div></div></div>
1.148 asau 3883: <div class="variablelist"><dl class="variablelist">
1.76 rillig 3884: <dt><span class="term"><code class="filename">DESCR</code></span></dt>
1.75 rillig 3885: <dd><p>A multi-line description of the piece of software. This should include
1.87 wiz 3886: any credits where they are due. Please bear in mind that others do not
3887: share your sense of humour (or spelling idiosyncrasies), and that others
3888: will read everything that you write here.</p></dd>
1.76 rillig 3889: <dt><span class="term"><code class="filename">PLIST</code></span></dt>
1.87 wiz 3890: <dd><p>This file governs the files that are installed on your
3891: system: all the binaries, manual pages, etc. There are other
3892: directives which may be entered in this file, to control the
3893: creation and deletion of directories, and the location of
1.267 ! rillig 3894: 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 3895: information.</p></dd>
1.75 rillig 3896: </dl></div>
3897: </div>
1.148 asau 3898: <div class="sect1">
1.75 rillig 3899: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 3900: <a name="components.optional"></a>13.5. Optional files</h2></div></div></div>
1.148 asau 3901: <div class="sect2">
1.78 rillig 3902: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3903: <a name="components.optional.bin"></a>13.5.1. Files affecting the binary package</h3></div></div></div>
1.148 asau 3904: <div class="variablelist"><dl class="variablelist">
1.76 rillig 3905: <dt><span class="term"><code class="filename">INSTALL</code></span></dt>
1.135 wiz 3906: <dd>
1.257 leot 3907: <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.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>.
1.87 wiz 3908: First time after package extraction and before files are
3909: moved in place, the second time after the files to install
3910: are moved in place. This can be used to do any custom
3911: procedures not possible with @exec commands in
1.257 leot 3912: <code class="filename">PLIST</code>. See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> and
1.267 ! rillig 3913: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information. See also <a class="xref" href="#files-and-dirs-outside-prefix" title="17.1. Files and directories outside the installation prefix">Section 17.1, “Files and directories outside the installation prefix”</a>.
1.135 wiz 3914: Please note that you can modify variables in it easily by using
3915: <code class="varname">FILES_SUBST</code> in the package's
3916: <code class="filename">Makefile</code>:</p>
3917: <pre class="programlisting">
3918: FILES_SUBST+= SOMEVAR="somevalue"
3919: </pre>
3920: <p>replaces "@SOMEVAR@" with <span class="quote">“<span class="quote">somevalue</span>”</span> in the
3921: <code class="filename">INSTALL</code>. By default, substitution is
3922: performed for <code class="varname">PREFIX</code>,
3923: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
3924: <code class="varname">VARBASE</code>, and a few others, type
3925: <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
3926: complete list.</p>
3927: </dd>
1.76 rillig 3928: <dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
1.75 rillig 3929: <dd><p>This script is executed before and after any files are removed. It is
1.87 wiz 3930: this script's responsibility to clean up any additional messy details
3931: around the package's installation, since all pkg_delete knows is how to
3932: delete the files created in the original distribution.
1.257 leot 3933: See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
3934: and <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information.
1.135 wiz 3935: The same methods to replace variables can be used as for
3936: the <code class="filename">INSTALL</code> file.</p></dd>
1.76 rillig 3937: <dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
1.75 rillig 3938: <dd>
3939: <p>This file is displayed after installation of the package.
1.87 wiz 3940: Useful for things like legal notices on almost-free
3941: software and hints for updating config files after
3942: installing modules for apache, PHP etc.
3943: Please note that you can modify variables in it easily by using
3944: <code class="varname">MESSAGE_SUBST</code> in the package's
3945: <code class="filename">Makefile</code>:</p>
1.75 rillig 3946: <pre class="programlisting">
1.100 rillig 3947: MESSAGE_SUBST+= SOMEVAR="somevalue"
3948: </pre>
1.128 wiz 3949: <p>replaces "${SOMEVAR}" with <span class="quote">“<span class="quote">somevalue</span>”</span> in
1.87 wiz 3950: <code class="filename">MESSAGE</code>. By default, substitution is
3951: performed for <code class="varname">PKGNAME</code>,
3952: <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
1.209 sevan 3953: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
1.87 wiz 3954: <code class="varname">PKG_SYSCONFDIR</code>,
3955: <code class="varname">ROOT_GROUP</code>, and
1.117 jnemeth 3956: <code class="varname">ROOT_USER</code>.</p>
1.87 wiz 3957: <p>You can display a different or additional files by
3958: setting the <code class="varname">MESSAGE_SRC</code> variable. Its
3959: default is <code class="filename">MESSAGE</code>, if the file
3960: exists.</p>
1.75 rillig 3961: </dd>
1.78 rillig 3962: <dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
1.174 asau 3963: <dd>
3964: <p>This file is used by the alternatives framework.
3965: It creates, configures, and destroys generic wrappers used to
3966: run programs with similar interfaces.
3967: See pkg_alternatives(8) from pkgtools/pkg_alternatives
3968: for more information.</p>
3969: <p>Each line of the file contains two filenames, first
3970: the wrapper and then the alternative provided by the package.
3971: Both paths are relative to <code class="varname">PREFIX</code>.</p>
3972: </dd>
1.78 rillig 3973: </dl></div>
3974: </div>
1.148 asau 3975: <div class="sect2">
1.78 rillig 3976: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 3977: <a name="components.optional.build"></a>13.5.2. Files affecting the build process</h3></div></div></div>
1.148 asau 3978: <div class="variablelist"><dl class="variablelist">
1.78 rillig 3979: <dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
3980: <dd><p>This file contains arbitrary things that could
3981: also go into a <code class="filename">Makefile</code>, but its purpose is
3982: to be used by more than one package. This file should only be
3983: used when the packages that will use the file are known in
3984: advance. For other purposes it is often better to write a
3985: <code class="filename">*.mk</code> file and give it a good name that
3986: describes what it does.</p></dd>
3987: <dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
3988: <dd><p>This file contains the dependency information
1.267 ! rillig 3989: 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 3990: <dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
3991: <dd><p>This file contains workarounds for compiler bugs
3992: and similar things. It is included automatically by the pkgsrc
3993: infrastructure, so you don't need an extra
3994: <code class="literal">.include</code> line for
3995: it.</p></dd>
3996: <dt><span class="term"><code class="filename">options.mk</code></span></dt>
3997: <dd><p>This file contains the code for the
1.267 ! rillig 3998: 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 3999: selected by the user. If a package has only one or two options,
4000: it is equally acceptable to put the code directly into the
4001: <code class="filename">Makefile</code>.</p></dd>
4002: </dl></div>
4003: </div>
1.148 asau 4004: <div class="sect2">
1.78 rillig 4005: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4006: <a name="components.optional.none"></a>13.5.3. Files affecting nothing at all</h3></div></div></div>
1.148 asau 4007: <div class="variablelist"><dl class="variablelist">
1.78 rillig 4008: <dt><span class="term"><code class="filename">README*</code></span></dt>
4009: <dd><p>These files do not take place in the creation of
4010: a package and thus are purely informative to the package
4011: developer.</p></dd>
4012: <dt><span class="term"><code class="filename">TODO</code></span></dt>
4013: <dd><p>This file contains things that need to be done
4014: to make the package even
4015: better.</p></dd>
1.75 rillig 4016: </dl></div>
4017: </div>
1.78 rillig 4018: </div>
1.148 asau 4019: <div class="sect1">
1.75 rillig 4020: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4021: <a name="work-dir"></a>13.6. <code class="filename">work*</code>
1.93 rillig 4022: </h2></div></div></div>
1.110 hubertf 4023: <p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
1.87 wiz 4024: unpacked into the directory denoted by
4025: <code class="varname">WRKDIR</code>. It can be removed by running
1.110 hubertf 4026: <span class="command"><strong>make clean</strong></span>. Besides the sources, this
1.87 wiz 4027: directory is also used to keep various timestamp files.
4028: The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
4029: The default is <code class="filename">${.CURDIR}/work</code>
4030: or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
4031: if <code class="varname">OBJMACHINE</code> is set.</p>
1.75 rillig 4032: </div>
1.148 asau 4033: <div class="sect1">
1.75 rillig 4034: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4035: <a name="files-dir"></a>13.7. <code class="filename">files/*</code>
1.93 rillig 4036: </h2></div></div></div>
1.75 rillig 4037: <p>If you have any files that you wish to be placed in the package prior
1.87 wiz 4038: to configuration or building, you could place these files here and use
1.110 hubertf 4039: a <span class="command"><strong>${CP}</strong></span> command in the
1.128 wiz 4040: <span class="quote">“<span class="quote">pre-configure</span>”</span> target to achieve
1.87 wiz 4041: this. Alternatively, you could simply diff the file against
4042: <code class="filename">/dev/null</code> and use the patch mechanism to manage
4043: the creation of this file.</p>
4044: <p>If you want to share files in this way with other
4045: packages, set the <code class="varname">FILESDIR</code> variable to point
4046: to the other package's <code class="filename">files</code> directory,
4047: e.g.:</p>
4048: <pre class="programlisting">
1.100 rillig 4049: FILESDIR=${.CURDIR}/../xemacs/files
4050: </pre>
1.75 rillig 4051: </div>
4052: </div>
1.148 asau 4053: <div class="chapter">
1.75 rillig 4054: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 4055: <a name="makefile"></a>Chapter 14. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
1.75 rillig 4056: <div class="toc">
4057: <p><b>Table of Contents</b></p>
1.210 leot 4058: <dl class="toc">
1.267 ! rillig 4059: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
! 4060: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
! 4061: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
! 4062: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
! 4063: <dd><dl>
! 4064: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
! 4065: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
! 4066: <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>
! 4067: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.75 rillig 4068: </dl></dd>
4069: </dl>
4070: </div>
1.76 rillig 4071: <p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
1.75 rillig 4072: each of which forms a well-defined part of the pkgsrc system. Using
1.257 leot 4073: the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system
1.75 rillig 4074: like pkgsrc requires some discipline to keep the code correct and
4075: understandable.</p>
1.76 rillig 4076: <p>The basic ingredients for <code class="filename">Makefile</code>
1.267 ! rillig 4077: programming are variables and shell
1.75 rillig 4078: commands. Among these shell commands may even be more complex ones
1.257 leot 4079: like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?awk+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs
1.75 rillig 4080: as intended it is necessary to quote all variables correctly when they
4081: are used.</p>
1.267 ! rillig 4082: <p>This chapter describes some patterns that appear quite often in
1.76 rillig 4083: <code class="filename">Makefile</code>s, including the pitfalls that come along
1.75 rillig 4084: with them.</p>
1.148 asau 4085: <div class="sect1">
1.75 rillig 4086: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4087: <a name="makefile.style"></a>14.1. Caveats</h2></div></div></div>
1.148 asau 4088: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.97 rillig 4089: <p>When you are creating a file as a
4090: target of a rule, always write the data to a temporary file first
4091: and finally rename that file. Otherwise there might occur an error
4092: in the middle of generating the file, and when the user runs
1.257 leot 4093: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><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 4094: regenerated properly. Example:</p>
4095: <pre class="programlisting">
1.100 rillig 4096: wrong:
4097: @echo "line 1" > ${.TARGET}
4098: @echo "line 2" >> ${.TARGET}
4099: @false
4100:
4101: correct:
4102: @echo "line 1" > ${.TARGET}.tmp
4103: @echo "line 2" >> ${.TARGET}.tmp
4104: @false
4105: @mv ${.TARGET}.tmp ${.TARGET}
1.97 rillig 4106: </pre>
1.110 hubertf 4107: <p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
1.97 rillig 4108: <code class="filename">wrong</code> will exist, although there was an error
1.110 hubertf 4109: message in the first run. On the other hand, running <span class="command"><strong>make
1.97 rillig 4110: correct</strong></span> gives an error message twice, as expected.</p>
1.257 leot 4111: <p>You might remember that <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> sometimes removes
1.97 rillig 4112: <code class="literal">${.TARGET}</code> in case of error, but this only
4113: happens when it is interrupted, for example by pressing
1.267 ! rillig 4114: <code class="literal">Ctrl+C</code>. This does <span class="emphasis"><em>not</em></span> happen
1.257 leot 4115: when one of the commands fails (like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?false+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p>
1.97 rillig 4116: </li></ul></div>
4117: </div>
1.148 asau 4118: <div class="sect1">
1.97 rillig 4119: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4120: <a name="makefile.variables"></a>14.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
1.76 rillig 4121: <p><code class="filename">Makefile</code> variables contain strings that
1.267 ! rillig 4122: can be processed using the five operators <code class="code">=</code>,
! 4123: <code class="code">+=</code>, <code class="code">?=</code>, <code class="code">:=</code> and
! 4124: <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.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man
1.75 rillig 4125: page.</p>
4126: <p>When a variable's value is parsed from a
1.267 ! rillig 4127: <code class="filename">Makefile</code>, the hash character <code class="code">#</code> and
! 4128: the backslash character <code class="code">\</code> are handled specially. If a
! 4129: backslash is the last character in a line, that backslash is removed
! 4130: from the line and the line continues with the next line of the file.</p>
! 4131: <p>The <code class="code">#</code> character starts a comment that reaches
! 4132: until the end of the line. To get an actual <code class="code">#</code> character,
! 4133: such as in a URL, write <code class="code">\#</code> instead.</p>
1.219 rillig 4134: <p>The evaluation of variables either happens immediately or lazy.
1.267 ! rillig 4135: It happens immediately when the variable occurs on the right-hand
! 4136: side of the <code class="code">:=</code> or the <code class="code">!=</code> operator, in a
1.219 rillig 4137: <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
4138: In the other cases, it is evaluated lazily.</p>
1.75 rillig 4139: <p>Some of the modifiers split the string into words and then
1.267 ! rillig 4140: operate on the words, others operate on the string as a whole. When a
! 4141: string is split into words, double quotes and single quotes are
! 4142: interpreted as delimiters, just like in <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sh+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p>
1.148 asau 4143: <div class="sect2">
1.75 rillig 4144: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4145: <a name="makefile.variables.names"></a>14.2.1. Naming conventions</h3></div></div></div>
1.148 asau 4146: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4147: <li class="listitem"><p>All variable names starting with an underscore
1.75 rillig 4148: are reserved for use by the pkgsrc infrastructure. They shall
1.267 ! rillig 4149: not be used by packages.</p></li>
1.128 wiz 4150: <li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
1.75 rillig 4151: lowercase variable names for the iteration
4152: variables.</p></li>
1.267 ! rillig 4153: <li class="listitem"><p>All list variables should have a plural name,
! 4154: such as <code class="varname">PKG_OPTIONS</code> or
1.75 rillig 4155: <code class="varname">DISTFILES</code>.</p></li>
4156: </ul></div>
4157: </div>
4158: </div>
1.148 asau 4159: <div class="sect1">
1.75 rillig 4160: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4161: <a name="makefile.code"></a>14.3. Code snippets</h2></div></div></div>
1.148 asau 4162: <div class="sect2">
1.75 rillig 4163: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4164: <a name="adding-to-list"></a>14.3.1. Adding things to a list</h3></div></div></div>
1.220 wiz 4165: <p>When adding a string that possibly contains whitespace or quotes to
4166: a list (example 1), it must be quoted using the <code class="code">:Q</code>
4167: modifier.</p>
4168: <p>When adding another list to a list (example 2), it must not be
4169: quoted, since its elements are already quoted.</p>
1.75 rillig 4170: <pre class="programlisting">
1.220 wiz 4171: STRING= foo * bar `date`
4172: LIST= # empty
4173: ANOTHER_LIST= a=b c=d
4174:
4175: LIST+= ${STRING:Q} # 1
4176: LIST+= ${ANOTHER_LIST} # 2
4177: </pre>
1.75 rillig 4178: </div>
1.148 asau 4179: <div class="sect2">
1.75 rillig 4180: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4181: <a name="echo-literal"></a>14.3.2. Echoing a string exactly as-is</h3></div></div></div>
1.220 wiz 4182: <p>Echoing a string containing special characters needs special
4183: work.</p>
1.75 rillig 4184: <pre class="programlisting">
1.100 rillig 4185: STRING= foo bar < > * `date` $$HOME ' "
1.219 rillig 4186: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 grant 4187:
1.100 rillig 4188: all:
4189: echo ${STRING} # 1
1.219 rillig 4190: echo ${STRING:Q} # 2
4191: printf '%s\n' ${STRING:Q}'' # 3
1.220 wiz 4192: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 grant 4193: </pre>
1.220 wiz 4194: <p>Example 1 leads to a syntax error in the shell, as the characters
4195: are just copied.</p>
4196: <p>Example 2 quotes the string so that the shell interprets it
4197: correctly. But the echo command may additionally interpret strings with a
4198: leading dash or those containing backslashes.</p>
1.257 leot 4199: <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.0"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> only
1.252 leot 4200: interprets the format string, but not the next argument. The trailing
4201: single quotes handle the case when the string is empty. In that case, the
4202: :Q modifier would result in an empty string too, which would then be
1.257 leot 4203: skipped by the shell. For <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?printf+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> this doesn't make a difference,
1.252 leot 4204: but other programs may care.</p>
1.220 wiz 4205: <p>In example 4, the <code class="varname">EXAMPLE_ENV</code> does not
4206: need to be quoted because the quoting has already been done
4207: when adding elements to the list.</p>
1.75 rillig 4208: </div>
1.148 asau 4209: <div class="sect2">
1.75 rillig 4210: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4211: <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 4212: <p>When passing <code class="varname">CFLAGS</code> or similar variables to a
4213: GNU-style configure script (especially those that call other configure
4214: scripts), it must not have leading or trailing whitespace, since
4215: otherwise the configure script gets confused. To trim leading and
4216: trailing whitespace, use the <code class="code">:M</code> modifier, as in the
4217: following example:</p>
1.75 rillig 4218: <pre class="programlisting">
1.100 rillig 4219: CPPFLAGS= # empty
1.220 wiz 4220: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
1.100 rillig 4221: CPPFLAGS+= ${MY_CPPFLAGS}
4222:
4223: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
4224:
4225: all:
4226: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
1.220 wiz 4227: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 grant 4228: </pre>
1.220 wiz 4229: <p>In this example, <code class="varname">CPPFLAGS</code> has both leading and
4230: trailing whitespace because the <code class="code">+=</code> operator always adds a
4231: space.</p>
4232: </div>
4233: <div class="sect2">
4234: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4235: <a name="empty-variables"></a>14.3.4. Handling possibly empty variables</h3></div></div></div>
1.220 wiz 4236: <p>When a possibly empty variable is used in a shell program, it may
4237: lead to a syntax error.</p>
4238: <pre class="programlisting">
4239: EGFILES= # empty
4240:
4241: install-examples: # produces a syntax error in the shell
4242: for egfile in ${EGFILES}; do \
4243: echo "Installing $$egfile"; \
4244: done
4245: </pre>
4246: <p>The shell only sees the text <code class="code">for egfile in ; do</code>, since
1.257 leot 4247: <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.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>.
1.220 wiz 4248: To fix this syntax error, use one of the snippets below.</p>
4249: <pre class="programlisting">
4250: EMPTY= # empty
4251:
4252: install-examples:
4253: for egfile in ${EGFILES} ""; do \
4254: [ -n "$$egfile" ] || continue; \
4255: echo "Installing $$egfile"; \
1.100 rillig 4256: done
1.220 wiz 4257: </pre>
4258: <p>In this case, an empty string is appended to the iteration list (to
4259: prevent the syntax error) and filtered out later.</p>
4260: <pre class="programlisting">
4261: EGFILES= # empty
1.100 rillig 4262:
1.220 wiz 4263: install-examples:
4264: .for egfile in ${EGFILES}
4265: echo "Installing ${egfile}"
1.100 rillig 4266: .endfor
1.1 grant 4267: </pre>
1.267 ! rillig 4268: <p>If one of the filenames contains special characters, it should be
! 4269: enclosed in single or double quotes.</p>
1.220 wiz 4270: <p>To have a shell command test whether a make variable is empty, use
4271: the following code: <code class="code">${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</p>
1.75 rillig 4272: </div>
4273: </div>
4274: </div>
1.148 asau 4275: <div class="chapter">
1.75 rillig 4276: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 4277: <a name="plist"></a>Chapter 15. PLIST issues</h2></div></div></div>
1.75 rillig 4278: <div class="toc">
4279: <p><b>Table of Contents</b></p>
1.210 leot 4280: <dl class="toc">
1.267 ! rillig 4281: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
! 4282: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
! 4283: <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>
! 4284: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
! 4285: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
! 4286: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
! 4287: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
! 4288: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
! 4289: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.75 rillig 4290: </dl>
4291: </div>
1.87 wiz 4292: <p>The <code class="filename">PLIST</code> file contains a package's
1.128 wiz 4293: <span class="quote">“<span class="quote">packing list</span>”</span>, i.e. a list of files that belong to
1.87 wiz 4294: the package (relative to the <code class="filename">${PREFIX}</code>
4295: directory it's been installed in) plus some additional statements
1.257 leot 4296: - see the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list.
1.87 wiz 4297: This chapter addresses some issues that need attention when
4298: dealing with the <code class="filename">PLIST</code> file (or files, see
4299: below!).</p>
1.148 asau 4300: <div class="sect1">
1.75 rillig 4301: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4302: <a name="rcs-id"></a>15.1. RCS ID</h2></div></div></div>
1.87 wiz 4303: <p>Be sure to add a RCS ID line as the first thing in any
4304: <code class="filename">PLIST</code> file you write:</p>
1.75 rillig 4305: <pre class="programlisting">
1.233 sevan 4306: @comment $NetBSD $
1.222 sevan 4307: </pre>
1.235 yyamano 4308: <p>An artificial space has been added between NetBSD and $, this is a
1.233 sevan 4309: workaround here to prevent CVS expanding to the filename of the guide. When
1.238 leot 4310: adding the RCS ID the space should be omitted.</p>
1.75 rillig 4311: </div>
1.148 asau 4312: <div class="sect1">
1.75 rillig 4313: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4314: <a name="automatic-plist-generation"></a>15.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
1.110 hubertf 4315: <p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
1.87 wiz 4316: to output a PLIST that matches any new files since the package
1.267 ! rillig 4317: 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 4318: more information on this target.</p>
1.75 rillig 4319: </div>
1.148 asau 4320: <div class="sect1">
1.75 rillig 4321: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4322: <a name="print-PLIST"></a>15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
1.93 rillig 4323: </h2></div></div></div>
1.87 wiz 4324: <p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
4325: of AWK patterns and actions that are used to filter the output of
4326: print-PLIST. You can <span class="emphasis"><em>append</em></span> any chunk of AWK
4327: scripting you like to it, but be careful with quoting.</p>
4328: <p>For example, to get all files inside the
4329: <code class="filename">libdata/foo</code> directory removed from the
4330: resulting PLIST:</p>
4331: <pre class="programlisting">
1.100 rillig 4332: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.222 sevan 4333: </pre>
1.75 rillig 4334: </div>
1.148 asau 4335: <div class="sect1">
1.75 rillig 4336: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4337: <a name="plist.misc"></a>15.4. Variable substitution in PLIST</h2></div></div></div>
1.87 wiz 4338: <p>A number of variables are substituted automatically in
4339: PLISTs when a package is installed on a system. This includes the
4340: following variables:</p>
1.148 asau 4341: <div class="variablelist"><dl class="variablelist">
1.75 rillig 4342: <dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
4343: <dd>
4344: <p>Some packages like emacs and perl embed information
1.87 wiz 4345: about which architecture they were built on into the
4346: pathnames where they install their files. To handle this
4347: case, PLIST will be preprocessed before actually used, and
4348: the symbol
1.128 wiz 4349: <span class="quote">“<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>”</span> will be
1.110 hubertf 4350: replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
1.87 wiz 4351: same is done if the string
4352: <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
4353: PLIST somewhere - use this on packages that have GNU
4354: autoconf-created configure scripts.</p>
1.148 asau 4355: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 4356: <h3 class="title">Legacy note</h3>
4357: <p>There used to be a symbol
1.128 wiz 4358: <span class="quote">“<span class="quote"><code class="varname">$ARCH</code></span>”</span> that
1.110 hubertf 4359: was replaced by the output of <span class="command"><strong>uname
1.87 wiz 4360: -m</strong></span>, but that's no longer supported and has
4361: been removed.</p>
1.75 rillig 4362: </div>
4363: </dd>
4364: <dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
4365: <dd>
4366: <p>Some packages want to embed the OS name and version
1.87 wiz 4367: into some paths. To do this, use these variables in the
4368: <code class="filename">PLIST</code>:
4369: </p>
1.148 asau 4370: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4371: <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>
4372: <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>
4373: <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 4374: </ul></div>
4375: </dd>
4376: </dl></div>
1.199 tnn 4377: <p>For a list of values which are replaced by
4378: default, the output of <span class="command"><strong>make help topic=PLIST_SUBST</strong></span> as
4379: well as searching the <code class="filename">pkgsrc/mk</code> directory with <span class="command"><strong>grep</strong></span> for
4380: <code class="varname">PLIST_SUBST</code> should help.</p>
1.87 wiz 4381: <p>If you want to change other variables not listed above, you
4382: can add variables and their expansions to this variable in the
1.267 ! rillig 4383: 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 4384: <pre class="programlisting">
1.100 rillig 4385: PLIST_SUBST+= SOMEVAR="somevalue"
1.222 sevan 4386: </pre>
1.128 wiz 4387: <p>This replaces all occurrences of <span class="quote">“<span class="quote">${SOMEVAR}</span>”</span>
1.87 wiz 4388: in the <code class="filename">PLIST</code> with
1.128 wiz 4389: <span class="quote">“<span class="quote">somevalue</span>”</span>.</p>
1.120 snj 4390: <p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
1.119 mishka 4391: the common case of conditionally including some
4392: <code class="filename">PLIST</code> entries. It can be done by adding
4393: <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
1.120 snj 4394: setting the corresponding <code class="varname">PLIST.foo</code> variable
4395: to <code class="literal">yes</code> if the entry should be included.
1.128 wiz 4396: This will substitute <span class="quote">“<span class="quote"><code class="varname">${PLIST.foo}</code></span>”</span>
1.119 mishka 4397: in the <code class="filename">PLIST</code> with either
1.128 wiz 4398: <span class="quote">“<span class="quote"><code class="literal">""</code></span>”</span> or
4399: <span class="quote">“<span class="quote"><code class="literal">"@comment "</code></span>”</span>.
1.119 mishka 4400: For example, in <code class="filename">Makefile</code>:</p>
4401: <pre class="programlisting">
1.223 rillig 4402: PLIST_VARS+= foo
1.119 mishka 4403: .if <em class="replaceable"><code>condition</code></em>
1.223 rillig 4404: PLIST.foo= yes
1.119 mishka 4405: .else
1.222 sevan 4406: </pre>
1.119 mishka 4407: <p>And then in <code class="filename">PLIST</code>:</p>
4408: <pre class="programlisting">
1.233 sevan 4409: @comment $NetBSD $
1.119 mishka 4410: bin/bar
4411: man/man1/bar.1
4412: ${PLIST.foo}bin/foo
4413: ${PLIST.foo}man/man1/foo.1
4414: ${PLIST.foo}share/bar/foo.data
1.222 sevan 4415: </pre>
1.235 yyamano 4416: <p>An artificial space has been added between NetBSD and $, this is a
1.233 sevan 4417: workaround here to prevent CVS expanding to the filename of the guide. When
4418: adding the RCS ID the space should be ommited.</p>
1.75 rillig 4419: </div>
1.148 asau 4420: <div class="sect1">
1.75 rillig 4421: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4422: <a name="manpage-compression"></a>15.5. Man page compression</h2></div></div></div>
1.75 rillig 4423: <p>Man pages should be installed in compressed form if
1.87 wiz 4424: <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
4425: and uncompressed otherwise. To handle this in the
1.128 wiz 4426: <code class="filename">PLIST</code> file, the suffix <span class="quote">“<span class="quote">.gz</span>”</span> is
1.87 wiz 4427: appended/removed automatically for man pages according to
4428: <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
4429: or not, see above for details. This modification of the
4430: <code class="filename">PLIST</code> file is done on a copy of it, not
4431: <code class="filename">PLIST</code> itself.</p>
1.75 rillig 4432: </div>
1.148 asau 4433: <div class="sect1">
1.75 rillig 4434: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4435: <a name="using-PLIST_SRC"></a>15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
1.93 rillig 4436: </h2></div></div></div>
1.76 rillig 4437: <p>To use one or more files as source for the <code class="filename">PLIST</code> used
1.87 wiz 4438: in generating the binary package, set the variable
4439: <code class="varname">PLIST_SRC</code> to the names of that file(s).
1.257 leot 4440: The files are later concatenated using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cat+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is
1.87 wiz 4441: important. The default for <code class="varname">PLIST_SRC</code> is
4442: <code class="filename">${PKGDIR}/PLIST</code>.</p>
1.75 rillig 4443: </div>
1.148 asau 4444: <div class="sect1">
1.75 rillig 4445: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4446: <a name="platform-specific-plist"></a>15.7. Platform-specific and differing PLISTs</h2></div></div></div>
1.75 rillig 4447: <p>Some packages decide to install a different set of files based on
1.87 wiz 4448: the operating system being used. These differences can be
4449: automatically handled by using the following files:</p>
1.148 asau 4450: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4451: <li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
4452: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
4453: <li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
4454: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
4455: <li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
1.75 rillig 4456: </ul></div>
4457: </div>
1.148 asau 4458: <div class="sect1">
1.75 rillig 4459: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4460: <a name="build-plist"></a>15.8. Build-specific PLISTs</h2></div></div></div>
1.197 wiz 4461: <p>Some packages decide to generate hard-to-guess file names
4462: during installation that are hard to wire down.</p>
4463: <p>In such cases, you can set the
4464: <code class="varname">GENERATE_PLIST</code> variable to shell code
4465: terminated (with a semicolon) that will output PLIST entries which
4466: will be appended to the PLIST</p>
4467: <p>You can find one example in editors/xemacs:</p>
4468: <pre class="programlisting">
1.222 sevan 4469: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
4470: </pre>
1.197 wiz 4471: <p>which will append something like
4472: <code class="filename">bin/xemacs-21.4.23-54e8ea71.dmp</code> to the
4473: <code class="filename">PLIST</code>.
4474: </p>
4475: </div>
4476: <div class="sect1">
4477: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4478: <a name="faq.common-dirs"></a>15.9. Sharing directories between packages</h2></div></div></div>
1.128 wiz 4479: <p>A <span class="quote">“<span class="quote">shared directory</span>”</span> is a directory where
1.87 wiz 4480: multiple (and unrelated) packages install files. These
1.125 wiz 4481: directories were problematic because you had to add special
4482: tricks in the PLIST to conditionally remove them, or have some
1.87 wiz 4483: centralized package handle them.</p>
1.125 wiz 4484: <p>In pkgsrc, it is now easy: Each package should create
4485: directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
4486: will remove any directories left empty after uninstalling a
4487: package.</p>
4488: <p>If a package needs an empty directory to work, create
4489: the directory during installation as usual, and also add an
4490: entry to the PLIST:
1.222 sevan 4491:
4492: </p>
1.87 wiz 4493: <pre class="programlisting">
1.125 wiz 4494: @pkgdir path/to/empty/directory
1.222 sevan 4495: </pre>
1.125 wiz 4496: <p>
1.222 sevan 4497:
1.197 wiz 4498: or take a look at <code class="varname">MAKE_DIRS</code> and
4499: <code class="varname">OWN_DIRS</code>.
1.125 wiz 4500: </p>
1.75 rillig 4501: </div>
4502: </div>
1.148 asau 4503: <div class="chapter">
1.75 rillig 4504: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 4505: <a name="buildlink"></a>Chapter 16. Buildlink methodology</h2></div></div></div>
1.75 rillig 4506: <div class="toc">
4507: <p><b>Table of Contents</b></p>
1.210 leot 4508: <dl class="toc">
1.267 ! rillig 4509: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
! 4510: <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 4511: <dd><dl>
1.267 ! rillig 4512: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
! 4513: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.133 wiz 4514: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4515: and
4516: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4517: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.75 rillig 4518: </dl></dd>
1.267 ! rillig 4519: <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 4520: <dd><dl>
1.267 ! rillig 4521: <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>
! 4522: <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 4523: </dl></dd>
4524: </dl>
4525: </div>
4526: <p>Buildlink is a framework in pkgsrc that controls what headers and libraries
1.87 wiz 4527: are seen by a package's configure and build processes. This is implemented
4528: in a two step process:</p>
1.128 wiz 4529: <div class="orderedlist"><ol class="orderedlist" type="1">
4530: <li class="listitem"><p>Symlink headers and libraries for dependencies into
1.87 wiz 4531: <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
4532: of <code class="varname">WRKDIR</code>.</p></li>
1.128 wiz 4533: <li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
1.87 wiz 4534: tools that translate <code class="option">-I${LOCALBASE}/include</code> and
4535: <code class="option">-L${LOCALBASE}/lib</code> into references to
4536: <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
4537: native compiler on some operating systems look like GCC, so that
4538: packages that expect GCC won't require modifications to build with
4539: those native compilers.</p></li>
1.75 rillig 4540: </ol></div>
4541: <p>This normalizes the environment in which a package is built so that the
1.87 wiz 4542: package may be built consistently despite what other software may be
4543: installed. Please note that the normal system header and library paths,
4544: e.g. <code class="filename">/usr/include</code>,
4545: <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
4546: designed to insulate the package build from non-system-supplied
4547: software.</p>
1.148 asau 4548: <div class="sect1">
1.75 rillig 4549: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4550: <a name="converting-to-buildlink3"></a>16.1. Converting packages to use buildlink3</h2></div></div></div>
1.75 rillig 4551: <p>The process of converting packages to use the buildlink3
1.128 wiz 4552: framework (<span class="quote">“<span class="quote">bl3ifying</span>”</span>) is fairly straightforward.
1.87 wiz 4553: The things to keep in mind are:</p>
1.128 wiz 4554: <div class="orderedlist"><ol class="orderedlist" type="1">
4555: <li class="listitem"><p>Ensure that the build always calls the wrapper scripts
1.87 wiz 4556: instead of the actual toolchain. Some packages are tricky,
4557: and the only way to know for sure is the check
4558: <code class="filename">${WRKDIR}/.work.log</code> to see if the
4559: wrappers are being invoked.</p></li>
1.128 wiz 4560: <li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
1.87 wiz 4561: the package Makefile, e.g. Java VMs, standalone shells,
4562: etc., because the code to symlink files into
4563: <code class="filename">${BUILDLINK_DIR}</code> looks for files
1.128 wiz 4564: relative to <span class="quote">“<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>”</span>.
1.87 wiz 4565: </p></li>
1.128 wiz 4566: <li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
1.87 wiz 4567: <code class="filename">buildlink3.mk</code> files that you list in a
4568: package's Makefile are added as dependencies for that package.
4569: </p></li>
1.75 rillig 4570: </ol></div>
1.87 wiz 4571: <p>If a dependency on a particular package is required for its libraries and
4572: headers, then we replace:</p>
1.75 rillig 4573: <pre class="programlisting">
1.100 rillig 4574: DEPENDS+= foo>=1.1.0:../../category/foo
4575: </pre>
1.75 rillig 4576: <p>with</p>
4577: <pre class="programlisting">
1.100 rillig 4578: .include "../../category/foo/buildlink3.mk"
4579: </pre>
1.75 rillig 4580: <p>The buildlink3.mk files usually define the required dependencies.
4581: If you need a newer version of the dependency when using buildlink3.mk
1.87 wiz 4582: files, then you can define it in your Makefile; for example:</p>
1.75 rillig 4583: <pre class="programlisting">
1.100 rillig 4584: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
4585: .include "../../category/foo/buildlink3.mk"
4586: </pre>
1.76 rillig 4587: <p>There are several <code class="filename">buildlink3.mk</code>
1.87 wiz 4588: files in <code class="filename">pkgsrc/mk</code>
4589: that handle special package issues:</p>
1.148 asau 4590: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4591: <li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
1.87 wiz 4592: the native or a pkgsrc Berkeley DB implementation based on
4593: the values of <code class="varname">BDB_ACCEPTED</code> and
4594: <code class="varname">BDB_DEFAULT</code>.</p></li>
1.128 wiz 4595: <li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
1.87 wiz 4596: comes with neither Curses nor NCurses, this will take care
1.250 leot 4597: 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 4598: <li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
1.87 wiz 4599: of <code class="varname">KRB5_ACCEPTED</code> to choose between
4600: adding a dependency on Heimdal or MIT-krb5 for packages that
4601: require a Kerberos 5 implementation.</p></li>
1.128 wiz 4602: <li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
1.88 wiz 4603: system-provided Motif installation or adds a dependency on
1.250 leot 4604: <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 4605: <code class="varname">MOTIF_TYPE</code> to <span class="quote">“<span class="quote">dt</span>”</span>,
1.239 leot 4606: <span class="quote">“<span class="quote">lesstif</span>”</span> or <span class="quote">“<span class="quote">motif</span>”</span>
4607: to choose which Motif version will be used.</p></li>
1.161 ryoon 4608: <li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
1.162 wiz 4609: system-provided GNU readline or editline (libedit) installation,
1.250 leot 4610: 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>,
4611: <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 4612: <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
4613: If your package really needs GNU readline library, its Makefile
4614: should include <code class="filename">devel/readline/buildlink3.mk</code>
4615: instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
1.128 wiz 4616: <li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
1.87 wiz 4617: variables that may be used by packages that use the
4618: Open Sound System (OSS) API.</p></li>
1.128 wiz 4619: <li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
1.142 wiz 4620: any of the Postgres versions in the variable
4621: <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
4622: the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
1.87 wiz 4623: the file for more information.</p></li>
1.128 wiz 4624: <li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
1.87 wiz 4625: <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
1.250 leot 4626: 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 4627: <li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
1.87 wiz 4628: <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
4629: library.</p></li>
1.75 rillig 4630: </ul></div>
1.76 rillig 4631: <p>The comments in those <code class="filename">buildlink3.mk</code>
1.87 wiz 4632: files provide a more complete
4633: description of how to use them properly.</p>
1.75 rillig 4634: </div>
1.148 asau 4635: <div class="sect1">
1.75 rillig 4636: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4637: <a name="creating-buildlink3.mk"></a>16.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
1.107 rillig 4638: <a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
1.87 wiz 4639: included by Makefiles to indicate the need to compile and link
4640: against header files and libraries provided by the package. A
4641: <code class="filename">buildlink3.mk</code> file should always provide
4642: enough information to add the correct type of dependency
4643: relationship and include any other
4644: <code class="filename">buildlink3.mk</code> files that it needs to find
4645: headers and libraries that it needs in turn.</p>
4646: <p>To generate an initial <code class="filename">buildlink3.mk</code>
1.250 leot 4647: 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 4648: package is highly recommended. For most packages, the following
4649: command will generate a good starting point for
4650: <code class="filename">buildlink3.mk</code> files:</p>
4651: <pre class="screen">
4652: <code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
4653: <code class="prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
4654: </pre>
1.148 asau 4655: <div class="sect2">
1.75 rillig 4656: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4657: <a name="anatomy-of-bl3"></a>16.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
1.75 rillig 4658: <p>The following real-life example
1.87 wiz 4659: <code class="filename">buildlink3.mk</code> is taken
4660: from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.75 rillig 4661: <pre class="programlisting">
1.120 snj 4662: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 grant 4663:
1.223 rillig 4664: BUILDLINK_TREE+= tiff
1.1 grant 4665:
1.120 snj 4666: .if !defined(TIFF_BUILDLINK3_MK)
4667: TIFF_BUILDLINK3_MK:=
1.87 wiz 4668:
1.223 rillig 4669: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
4670: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
4671: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.87 wiz 4672:
1.100 rillig 4673: .include "../../devel/zlib/buildlink3.mk"
4674: .include "../../graphics/jpeg/buildlink3.mk"
1.120 snj 4675: .endif # TIFF_BUILDLINK3_MK
1.87 wiz 4676:
1.223 rillig 4677: BUILDLINK_TREE+= -tiff
1.100 rillig 4678: </pre>
1.87 wiz 4679: <p>The header and footer manipulate
1.120 snj 4680: <code class="varname">BUILDLINK_TREE</code>, which is common across all
1.87 wiz 4681: <code class="filename">buildlink3.mk</code> files and is used to track
1.120 snj 4682: the dependency tree.</p>
4683: <p>The main section is protected from multiple inclusion
1.87 wiz 4684: and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
4685: added. Several important variables are set in the section:</p>
1.148 asau 4686: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4687: <li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4688: is the actual dependency recorded in the installed
4689: package; this should always be set using
1.110 hubertf 4690: <span class="command"><strong>+=</strong></span> to ensure that
1.87 wiz 4691: we're appending to any pre-existing list of values. This
4692: variable should be set to the first version of the
1.133 wiz 4693: package that had an backwards-incompatible API change.
1.87 wiz 4694: </p></li>
1.128 wiz 4695: <li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4696: is the location of the <em class="replaceable"><code>pkg</code></em>
4697: pkgsrc directory.</p></li>
1.128 wiz 4698: <li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4699: (not shown above) controls whether we use
4700: <code class="varname">BUILD_DEPENDS</code> or
4701: <code class="varname">DEPENDS</code> to add the dependency on
4702: <em class="replaceable"><code>pkg</code></em>. The build dependency is
4703: selected by setting
4704: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4705: to <span class="quote">“<span class="quote">build</span>”</span>. By default, the full dependency is
1.87 wiz 4706: used.</p></li>
1.128 wiz 4707: <li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4708: and
4709: <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
4710: (not shown above) are lists of subdirectories of
1.76 rillig 4711: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.75 rillig 4712: to add to the header and library search paths. These
1.128 wiz 4713: default to <span class="quote">“<span class="quote">include</span>”</span> and <span class="quote">“<span class="quote">lib</span>”</span>
1.87 wiz 4714: respectively.</p></li>
1.128 wiz 4715: <li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4716: (not shown above) is the list of preprocessor flags to add
4717: to <code class="varname">CPPFLAGS</code>, which are passed on to the
1.128 wiz 4718: configure and build phases. The <span class="quote">“<span class="quote">-I</span>”</span> option
1.75 rillig 4719: should be avoided and instead be handled using
4720: <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
1.87 wiz 4721: above.</p></li>
1.75 rillig 4722: </ul></div>
1.87 wiz 4723: <p>The following variables are all optionally defined within
4724: this second section (protected against multiple inclusion) and
4725: control which package files are symlinked into
4726: <code class="filename">${BUILDLINK_DIR}</code> and how their names are
4727: transformed during the symlinking:</p>
1.148 asau 4728: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 4729: <li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4730: (not shown above) is a shell glob pattern relative to
1.76 rillig 4731: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.75 rillig 4732: to be symlinked into
1.76 rillig 4733: <code class="filename">${BUILDLINK_DIR}</code>,
1.87 wiz 4734: e.g. <code class="filename">include/*.h</code>.</p></li>
1.128 wiz 4735: <li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
1.87 wiz 4736: (not shown above) is a shell pipeline that
4737: outputs to stdout a list of files relative to
4738: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
4739: The resulting files are to be symlinked
4740: into <code class="filename">${BUILDLINK_DIR}</code>. By default,
4741: this takes the <code class="filename">+CONTENTS</code> of a
4742: <em class="replaceable"><code>pkg</code></em> and filters it through
4743: <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
1.128 wiz 4744: <li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4745: (not shown above) is a filter command that filters
1.76 rillig 4746: <code class="filename">+CONTENTS</code> input into a list of files
1.75 rillig 4747: relative to
1.76 rillig 4748: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.194 bsiegert 4749: on stdout. By default,
1.75 rillig 4750: <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
1.76 rillig 4751: outputs the contents of the <code class="filename">include</code>
4752: and <code class="filename">lib</code> directories in the package
1.194 bsiegert 4753: <code class="filename">+CONTENTS</code>.</p></li>
1.128 wiz 4754: <li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
1.75 rillig 4755: (not shown above) is a list of sed arguments used to
4756: transform the name of the source filename into a
1.110 hubertf 4757: destination filename, e.g. <span class="command"><strong>-e
1.87 wiz 4758: "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
1.75 rillig 4759: </ul></div>
1.120 snj 4760: <p>This section can additionally include any
1.87 wiz 4761: <code class="filename">buildlink3.mk</code> needed for
4762: <em class="replaceable"><code>pkg</code></em>'s library dependencies.
4763: Including these <code class="filename">buildlink3.mk</code> files
4764: means that the headers and libraries for these
4765: dependencies are also symlinked into
4766: <code class="filename">${BUILDLINK_DIR}</code>
4767: whenever the <em class="replaceable"><code>pkg</code></em>
4768: <code class="filename">buildlink3.mk</code>
1.120 snj 4769: file is included. Dependencies are only added for directly
4770: include <code class="filename">buildlink3.mk</code> files.</p>
1.153 wiz 4771: <p>When providing a <code class="filename">buildlink3.mk</code> and
4772: including other <code class="filename">buildlink3.mk</code> files in it,
1.156 wiz 4773: please only add necessary ones, i.e., those whose libraries or
1.153 wiz 4774: header files are automatically exposed when the package is
4775: use.</p>
4776: <p>In particular, if only an executable
4777: (<code class="filename">bin/foo</code>) is linked against a library, that
4778: library does not need to be propagated in the
4779: <code class="filename">buildlink3.mk</code> file.</p>
4780: <p>The following steps should help you decide if a
4781: <code class="filename">buildlink3.mk</code> file needs to be included:
4782: </p>
4783: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4784: <li class="listitem"><p>Look at the installed header files: What
4785: headers do they include? The packages providing these files
4786: must be buildlinked.</p></li>
1.155 wiz 4787: <li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
4788: libraries and look against what other libraries they link.
4789: Some of the packages providing these probably need to be
4790: buildlinked; however, it's not automatic, since e.g. GTK on
4791: some systems pulls in the X libraries, so they will show up in
4792: the <code class="filename">ldd</code> output, while on others (like OS
1.156 wiz 4793: X) it won't. <code class="filename">ldd</code> output can thus only be
1.155 wiz 4794: used as a hint.</p></li>
1.153 wiz 4795: </ul></div>
4796: <p>
4797: </p>
1.75 rillig 4798: </div>
1.148 asau 4799: <div class="sect2">
1.75 rillig 4800: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4801: <a name="updating-buildlink-depends"></a>16.2.2. Updating
1.87 wiz 4802: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.133 wiz 4803: and
4804: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4805: in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
4806: <p>These two variables differ in that one describes source
4807: compatibility (API) and the other binary compatibility (ABI).
4808: The difference is that a change in the API breaks compilation of
4809: programs while changes in the ABI stop compiled programs from
4810: running.</p>
4811: <p>Changes to the
1.134 wiz 4812: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.133 wiz 4813: variable in a <code class="filename">buildlink3.mk</code> file happen
4814: very rarely. One possible reason is that all packages depending
4815: on this already need a newer version. In case it is bumped see
4816: the description below.</p>
4817: <p>The most common example of an ABI change is that the major
4818: version of a shared library is increased. In this case,
4819: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4820: should be adjusted to require at least the new package version.
4821: Then the packages that depend on this package need their
4822: <code class="varname">PKGREVISION</code>s increased and, if they have
4823: <code class="filename">buildlink3.mk</code> files, their
4824: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4825: adjusted, too. This is needed so pkgsrc will require the correct
4826: package dependency and not settle for an older one when building
4827: the source.</p>
1.267 ! rillig 4828: <p>See <a class="xref" href="#dependencies" title="21.1.5. Handling dependencies">Section 21.1.5, “Handling dependencies”</a> for
1.133 wiz 4829: more information about dependencies on other packages,
4830: including the <code class="varname">BUILDLINK_ABI_DEPENDS</code> and
1.87 wiz 4831: <code class="varname">ABI_DEPENDS</code> definitions.</p>
4832: <p>Please take careful consideration before adjusting
4833: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4834: or
4835: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4836: as we don't want to cause unneeded package deletions and
4837: rebuilds. In many cases, new versions of packages work just
4838: fine with older dependencies.</p>
4839: <p>Also it is not needed to set
1.133 wiz 4840: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
4841: when it is identical to
1.87 wiz 4842: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. </p>
1.75 rillig 4843: </div>
4844: </div>
1.148 asau 4845: <div class="sect1">
1.75 rillig 4846: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 4847: <a name="writing-builtin.mk"></a>16.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
1.87 wiz 4848: <p>Some packages in pkgsrc install headers and libraries that
1.75 rillig 4849: coincide with headers and libraries present in the base system.
1.76 rillig 4850: Aside from a <code class="filename">buildlink3.mk</code> file, these
4851: packages should also include a <code class="filename">builtin.mk</code>
1.75 rillig 4852: file that includes the necessary checks to decide whether using
4853: the built-in software or the pkgsrc software is
1.87 wiz 4854: appropriate.</p>
4855: <p>The only requirements of a builtin.mk file for
4856: <em class="replaceable"><code>pkg</code></em> are:</p>
1.128 wiz 4857: <div class="orderedlist"><ol class="orderedlist" type="1">
4858: <li class="listitem"><p>It should set
1.87 wiz 4859: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4860: to either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span>
1.87 wiz 4861: after it is included.</p></li>
1.128 wiz 4862: <li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
1.87 wiz 4863: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4864: which is already set before the
4865: <code class="filename">builtin.mk</code> file is included.</p></li>
1.128 wiz 4866: <li class="listitem"><p>It should be written to allow multiple inclusion. This
1.87 wiz 4867: is <span class="emphasis"><em>very</em></span> important and takes careful
4868: attention to <code class="filename">Makefile</code> coding.</p></li>
1.75 rillig 4869: </ol></div>
1.148 asau 4870: <div class="sect2">
1.75 rillig 4871: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4872: <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 4873: <p>The following is the recommended template for builtin.mk
1.87 wiz 4874: files:</p>
1.75 rillig 4875: <pre class="programlisting">
1.100 rillig 4876: .if !defined(IS_BUILTIN.foo)
4877: #
4878: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
4879: # genuinely exists in the system or not.
4880: #
4881: IS_BUILTIN.foo?= no
4882:
4883: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
4884: # version can be determined.
4885: #
4886: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
4887: BUILTIN_PKG.foo?= foo-1.0
4888: . endif
4889: .endif # IS_BUILTIN.foo
4890:
4891: .if !defined(USE_BUILTIN.foo)
4892: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
4893: . if defined(BUILTIN_PKG.foo)
4894: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
4895: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
4896: USE_BUILTIN.foo!= \
4897: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
4898: && ${ECHO} "yes" || ${ECHO} "no"
4899: . endif
4900: . endfor
4901: . endif
4902: .endif # USE_BUILTIN.foo
4903:
4904: CHECK_BUILTIN.foo?= no
4905: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
4906: #
4907: # Here we place code that depends on whether USE_BUILTIN.foo is set to
4908: # "yes" or "no".
4909: #
4910: .endif # CHECK_BUILTIN.foo
4911: </pre>
1.87 wiz 4912: <p>The first section sets
4913: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4914: depending on if <em class="replaceable"><code>pkg</code></em> really exists
4915: in the base system. This should not be a base system software
4916: with similar functionality to <em class="replaceable"><code>pkg</code></em>;
1.128 wiz 4917: it should only be <span class="quote">“<span class="quote">yes</span>”</span> if the actual package is
1.87 wiz 4918: included as part of the base system. This variable is only
4919: used internally within the <code class="filename">builtin.mk</code>
4920: file.</p>
4921: <p>The second section sets
4922: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
4923: to the version of <em class="replaceable"><code>pkg</code></em> in the base
4924: system if it exists (if
4925: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4926: is <span class="quote">“<span class="quote">yes</span>”</span>). This variable is only used internally
1.87 wiz 4927: within the <code class="filename">builtin.mk</code> file.</p>
4928: <p>The third section sets
4929: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4930: and is <span class="emphasis"><em>required</em></span> in all
4931: <code class="filename">builtin.mk</code> files. The code in this
4932: section must make the determination whether the built-in
4933: software is adequate to satisfy the dependencies listed in
4934: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
4935: This is typically done by comparing
4936: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
4937: against each of the dependencies in
4938: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
4939: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4940: <span class="emphasis"><em>must</em></span> be set to the correct value by the
4941: end of the <code class="filename">builtin.mk</code> file. Note that
4942: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4943: may be <span class="quote">“<span class="quote">yes</span>”</span> even if
1.87 wiz 4944: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.128 wiz 4945: is <span class="quote">“<span class="quote">no</span>”</span> because we may make the determination
1.87 wiz 4946: that the built-in version of the software is similar enough to
4947: be used as a replacement.</p>
4948: <p>The last section is guarded by
4949: <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
4950: and includes code that uses the value of
4951: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
4952: set in the previous section. This typically includes, e.g.,
4953: adding additional dependency restrictions and listing additional
4954: files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
4955: <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
1.75 rillig 4956: </div>
1.148 asau 4957: <div class="sect2">
1.75 rillig 4958: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 4959: <a name="native-or-pkgsrc-preference"></a>16.3.2. Global preferences for native or pkgsrc software</h3></div></div></div>
1.87 wiz 4960: <p>When building packages, it's possible to choose whether to set
4961: a global preference for using either the built-in (native)
4962: version or the pkgsrc version of software to satisfy a
4963: dependency. This is controlled by setting
4964: <code class="varname">PREFER_PKGSRC</code> and
4965: <code class="varname">PREFER_NATIVE</code>. These variables take values
1.128 wiz 4966: 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 4967: packages. <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to
4968: use the pkgsrc versions of software, while
4969: <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the
4970: built-in versions. Preferences are determined by the most
4971: specific instance of the package in either
4972: <code class="varname">PREFER_PKGSRC</code> or
4973: <code class="varname">PREFER_NATIVE</code>. If a package is specified
4974: in neither or in both variables, then
4975: <code class="varname">PREFER_PKGSRC</code> has precedence over
4976: <code class="varname">PREFER_NATIVE</code>. For example, to require
4977: using pkgsrc versions of software for all but the most basic
4978: bits on a NetBSD system, you can set:</p>
4979: <pre class="programlisting">
1.100 rillig 4980: PREFER_PKGSRC= yes
4981: PREFER_NATIVE= getopt skey tcp_wrappers
4982: </pre>
1.87 wiz 4983: <p>A package <span class="emphasis"><em>must</em></span> have a
4984: <code class="filename">builtin.mk</code>
4985: file to be listed in <code class="varname">PREFER_NATIVE</code>,
4986: otherwise it is simply ignored in that list.</p>
1.229 sevan 4987: <p>Setting <code class="varname">PREFER_NATIVE</code> should be performed
4988: straight after bootstrap and <code class="varname">PREFER_PKGSRC</code> during
4989: bootstrap.
4990: Switching between settings globally at a later date can introduce
4991: complications with dependency resolution. This is caused by packages
4992: built with the opposite preference being installed alongside each other.</p>
4993: <pre class="screen">
4994: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes</code></strong>
4995: </pre>
1.75 rillig 4996: </div>
4997: </div>
4998: </div>
1.148 asau 4999: <div class="chapter">
1.75 rillig 5000: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 5001: <a name="pkginstall"></a>Chapter 17. The pkginstall framework</h2></div></div></div>
1.75 rillig 5002: <div class="toc">
5003: <p><b>Table of Contents</b></p>
1.210 leot 5004: <dl class="toc">
1.267 ! rillig 5005: <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 5006: <dd><dl>
1.267 ! rillig 5007: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
! 5008: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
1.75 rillig 5009: </dl></dd>
1.267 ! rillig 5010: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
1.75 rillig 5011: <dd><dl>
1.267 ! rillig 5012: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
! 5013: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
! 5014: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
! 5015: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
! 5016: </dl></dd>
! 5017: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
! 5018: <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>
! 5019: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
! 5020: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
! 5021: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
! 5022: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
! 5023: <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 5024: </dl>
5025: </div>
5026: <p>This chapter describes the framework known as
5027: <code class="literal">pkginstall</code>, whose key features are:</p>
1.148 asau 5028: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5029: <li class="listitem"><p>Generic installation and manipulation of directories and files
1.75 rillig 5030: outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
1.128 wiz 5031: <li class="listitem"><p>Automatic handling of configuration files during installation,
1.75 rillig 5032: provided that packages are correctly designed.</p></li>
1.128 wiz 5033: <li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
5034: <li class="listitem"><p>Registration of system users and groups.</p></li>
5035: <li class="listitem"><p>Registration of system shells.</p></li>
5036: <li class="listitem"><p>Automatic updating of fonts databases.</p></li>
1.75 rillig 5037: </ul></div>
5038: <p>The following sections inspect each of the above points in detail.</p>
5039: <p>You may be thinking that many of the things described here could be
5040: easily done with simple code in the package's post-installation target
5041: (<code class="literal">post-install</code>). <span class="emphasis"><em>This is incorrect</em></span>,
5042: as the code in them is only executed when building from source. Machines
5043: using binary packages could not benefit from it at all (as the code itself
5044: could be unavailable). Therefore, the only way to achieve any of the items
5045: described above is by means of the installation scripts, which are
5046: automatically generated by pkginstall.</p>
1.148 asau 5047: <div class="sect1">
1.75 rillig 5048: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5049: <a name="files-and-dirs-outside-prefix"></a>17.1. Files and directories outside the installation prefix</h2></div></div></div>
1.76 rillig 5050: <p>As you already know, the <code class="filename">PLIST</code> file holds a list
1.75 rillig 5051: of files and directories that belong to a package. The names used in it
1.76 rillig 5052: are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
1.75 rillig 5053: which means that it cannot register files outside this directory (absolute
5054: path names are not allowed). Despite this restriction, some packages need
5055: to install files outside this location; e.g., under
1.76 rillig 5056: <code class="filename">${VARBASE}</code> or
1.87 wiz 5057: <code class="filename">${PKG_SYSCONFDIR}</code>. The only way to achieve this
5058: is to create such files during installation time by using
5059: installation scripts.</p>
5060: <p>The generic installation scripts are shell scripts that can
5061: contain arbitrary code. The list of scripts to execute is taken from
5062: the <code class="varname">INSTALL_FILE</code> variable, which defaults to
5063: <code class="filename">INSTALL</code>. A similar variable exists for package
5064: removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
5065: <code class="filename">DEINSTALL</code>). These scripts can run arbitrary
5066: commands, so they have the potential to create and manage files
5067: anywhere in the file system.</p>
5068: <p>Using these general installation files is not recommended, but
5069: may be needed in some special cases. One reason for avoiding them is
5070: that the user has to trust the packager that there is no unwanted or
5071: simply erroneous code included in the installation script. Also,
5072: previously there were many similar scripts for the same functionality,
5073: and fixing a common error involved finding and changing all of
5074: them.</p>
5075: <p>The pkginstall framework offers another, standardized way. It
5076: provides generic scripts to abstract the manipulation of such files
5077: and directories based on variables set in the package's
5078: <code class="filename">Makefile</code>. The rest of this section describes
5079: these variables.</p>
1.148 asau 5080: <div class="sect2">
1.75 rillig 5081: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5082: <a name="dirs-outside-prefix"></a>17.1.1. Directory manipulation</h3></div></div></div>
1.75 rillig 5083: <p>The following variables can be set to request the creation of
5084: directories anywhere in the file system:</p>
1.148 asau 5085: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.218 rillig 5086: <li class="listitem">
5087: <p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
1.75 rillig 5088: contain a list of directories that should be created and should attempt
5089: to be destroyed by the installation scripts. The difference between
5090: the two is that the latter prompts the administrator to remove any
5091: directories that may be left after deinstallation (because they were
1.218 rillig 5092: not empty), while the former does not. Example:</p>
5093: <pre class="programlisting">
5094: MAKE_DIRS+= ${VARBASE}/foo/private
5095: </pre>
5096: </li>
1.128 wiz 5097: <li class="listitem">
1.75 rillig 5098: <p><code class="varname">MAKE_DIRS_PERMS</code> and
5099: <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
5100: which directories should be created and should attempt to be destroyed
5101: by the installation scripts. Each tuple holds the following values,
5102: separated by spaces: the directory name, its owner, its group and its
5103: numerical mode. For example:</p>
5104: <pre class="programlisting">
1.218 rillig 5105: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5106: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 grant 5107: </pre>
1.75 rillig 5108: <p>The difference between the two is exactly the same as their
5109: non-<code class="varname">PERMS</code> counterparts.</p>
5110: </li>
5111: </ul></div>
5112: </div>
1.148 asau 5113: <div class="sect2">
1.75 rillig 5114: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5115: <a name="files-outside-prefix"></a>17.1.2. File manipulation</h3></div></div></div>
1.75 rillig 5116: <p>Creating non-empty files outside the installation prefix is tricky
1.76 rillig 5117: because the <code class="filename">PLIST</code> forces all files to be inside it.
1.75 rillig 5118: To overcome this problem, the only solution is to extract the file in the
5119: known place (i.e., inside the installation prefix) and copy it to the
5120: appropriate location during installation (done by the installation scripts
5121: generated by pkginstall). We will call the former the <span class="emphasis"><em>master
5122: file</em></span> in the following paragraphs, which describe the variables
5123: that can be used to automatically and consistently handle files outside the
5124: installation prefix:</p>
1.148 asau 5125: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5126: <li class="listitem">
1.75 rillig 5127: <p><code class="varname">CONF_FILES</code> and
1.137 wiz 5128: <code class="varname">REQD_FILES</code> are pairs of master and target files.
1.75 rillig 5129: During installation time, the master file is copied to the target one
5130: if and only if the latter does not exist. Upon deinstallation, the
5131: target file is removed provided that it was not modified by the
5132: installation.</p>
5133: <p>The difference between the two is that the latter prompts the
5134: administrator to remove any files that may be left after
5135: deinstallation (because they were not empty), while the former does
5136: not.</p>
5137: </li>
1.128 wiz 5138: <li class="listitem">
1.75 rillig 5139: <p><code class="varname">CONF_FILES_PERMS</code> and
1.137 wiz 5140: <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master
1.75 rillig 5141: files as well as their target locations. For each of them, it also
5142: specifies their owner, their group and their numeric permissions, in
5143: this order. For example:</p>
5144: <pre class="programlisting">
1.218 rillig 5145: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5146: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 grant 5147: </pre>
1.75 rillig 5148: <p>The difference between the two is exactly the same as their
5149: non-<code class="varname">PERMS</code> counterparts.</p>
5150: </li>
5151: </ul></div>
5152: </div>
5153: </div>
1.148 asau 5154: <div class="sect1">
1.75 rillig 5155: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5156: <a name="conf-files"></a>17.2. Configuration files</h2></div></div></div>
1.75 rillig 5157: <p>Configuration files are special in the sense that they are installed
5158: in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and
5159: need special treatment during installation (most of which is automated by
5160: pkginstall). The main concept you must bear in mind is that files marked
5161: as configuration files are automatically copied to the right place (somewhere
5162: inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if
5163: and only if</em></span> they didn't exist before. Similarly, they will not
5164: be removed if they have local modifications. This ensures that
5165: administrators never lose any custom changes they may have made.</p>
1.148 asau 5166: <div class="sect2">
1.75 rillig 5167: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5168: <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 5169: <p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
5170: specifies where configuration files shall be installed. Its contents are
5171: set based upon the following variables:</p>
1.148 asau 5172: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5173: <li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
1.76 rillig 5174: directory. Defaults to <code class="filename">${PREFIX}/etc</code> although it may
1.75 rillig 5175: be overridden by the user to point to his preferred location (e.g.,
1.76 rillig 5176: <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
1.75 rillig 5177: Packages must not use it directly.</p></li>
1.128 wiz 5178: <li class="listitem">
1.75 rillig 5179: <p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
5180: <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
5181: for the package being built shall be installed. The definition of this
5182: variable only makes sense in the package's
1.76 rillig 5183: <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
1.75 rillig 5184: <p>As an example, consider the Apache package,
1.250 leot 5185: <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 5186: configuration files under the
1.76 rillig 5187: <code class="filename">httpd/</code> subdirectory of
1.75 rillig 5188: <code class="varname">PKG_SYSCONFBASE</code>. This should be set in the package
5189: Makefile.</p>
5190: </li>
1.128 wiz 5191: <li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
1.75 rillig 5192: variable that holds this package's configuration directory (if
5193: different from <code class="varname">PKG_SYSCONFBASE</code>). It defaults to
5194: <code class="varname">PKGBASE</code>'s value, and is always prefixed with
5195: <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
1.128 wiz 5196: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
1.75 rillig 5197: directory where the configuration files for the package identified by
5198: <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
5199: </ul></div>
5200: <p>Based on the above variables, pkginstall determines the value of
5201: <code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
5202: variable that can be used within a package to refer to its configuration
5203: directory. The algorithm used to set its value is basically the
5204: following:</p>
1.128 wiz 5205: <div class="orderedlist"><ol class="orderedlist" type="1">
5206: <li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
1.75 rillig 5207: its value is used.</p></li>
1.128 wiz 5208: <li class="listitem"><p>If the previous variable is not defined but
1.75 rillig 5209: <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
1.76 rillig 5210: <code class="filename">Makefile</code>, the resulting value is
5211: <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
1.128 wiz 5212: <li class="listitem"><p>Otherwise, it is set to
1.76 rillig 5213: <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
1.75 rillig 5214: </ol></div>
1.76 rillig 5215: <p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
1.267 ! rillig 5216: 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 5217: subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to
5218: be created with OWN_DIRS or MAKE_DIRS.</p>
1.75 rillig 5219: </div>
1.148 asau 5220: <div class="sect2">
1.75 rillig 5221: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5222: <a name="conf-files-configure"></a>17.2.2. Telling the software where configuration files are</h3></div></div></div>
1.75 rillig 5223: <p>Given that pkgsrc (and users!) expect configuration files to be in a
5224: known place, you need to teach each package where it shall install its
5225: files. In some cases you will have to patch the package Makefiles to
5226: achieve it. If you are lucky, though, it may be as easy as passing an
5227: extra flag to the configuration script; this is the case of GNU Autoconf-
5228: generated files:</p>
5229: <pre class="programlisting">
1.100 rillig 5230: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 grant 5231: </pre>
1.75 rillig 5232: <p>Note that this specifies where the package has to <span class="emphasis"><em>look
5233: for</em></span> its configuration files, not where they will be originally
5234: installed (although the difference is never explicit,
5235: unfortunately).</p>
5236: </div>
1.148 asau 5237: <div class="sect2">
1.75 rillig 5238: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5239: <a name="conf-files-patching"></a>17.2.3. Patching installations</h3></div></div></div>
1.75 rillig 5240: <p>As said before, pkginstall automatically handles configuration files.
5241: This means that <span class="strong"><strong>the packages themselves must not
1.76 rillig 5242: touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
1.75 rillig 5243: directly</strong></span>. Bad news is that many software installation scripts
5244: will, out of the box, mess with the contents of that directory. So what is
5245: the correct procedure to fix this issue?</p>
5246: <p>You must teach the package (usually by manually patching it) to
5247: install any configuration files under the examples hierarchy,
1.76 rillig 5248: <code class="filename">share/examples/${PKGBASE}/</code>. This way, the
5249: <code class="filename">PLIST</code> registers them and the administrator always
1.75 rillig 5250: has the original copies available.</p>
5251: <p>Once the required configuration files are in place (i.e., under the
5252: examples hierarchy), the pkginstall framework can use them as master copies
5253: during the package installation to update what is in
1.76 rillig 5254: <code class="filename">${PKG_SYSCONFDIR}</code>. To achieve this, the variables
1.75 rillig 5255: <code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
1.267 ! rillig 5256: 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 5257: about their syntax and their purpose. Here is an example, taken from the
1.250 leot 5258: <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 5259: <pre class="programlisting">
1.100 rillig 5260: EGDIR= ${PREFIX}/share/doc/mutt/samples
5261: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 grant 5262: </pre>
1.75 rillig 5263: <p>Note that the <code class="varname">EGDIR</code> variable is specific to that
5264: package and has no meaning outside it.</p>
5265: </div>
1.148 asau 5266: <div class="sect2">
1.75 rillig 5267: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5268: <a name="conf-files-disable"></a>17.2.4. Disabling handling of configuration files</h3></div></div></div>
1.75 rillig 5269: <p>The automatic copying of config files can be toggled by setting the
5270: environment variable <code class="varname">PKG_CONFIG</code> prior to package
5271: installation.</p>
5272: </div>
5273: </div>
1.148 asau 5274: <div class="sect1">
1.75 rillig 5275: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5276: <a name="rcd-scripts"></a>17.3. System startup scripts</h2></div></div></div>
1.75 rillig 5277: <p>System startup scripts are special files because they must be
5278: installed in a place known by the underlying OS, usually outside the
1.267 ! rillig 5279: 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 5280: can be used. However, pkginstall provides a special mechanism to handle
5281: these files.</p>
5282: <p>In order to provide system startup scripts, the package has
5283: to:</p>
1.128 wiz 5284: <div class="orderedlist"><ol class="orderedlist" type="1">
5285: <li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
1.75 rillig 5286: the <code class="literal">.sh</code> suffix appended. Considering the
1.250 leot 5287: <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 5288: <code class="filename">cupsd.sh</code> in its files directory.</p></li>
1.128 wiz 5289: <li class="listitem">
1.75 rillig 5290: <p>Tell pkginstall to handle it, appending the name of the script,
5291: without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
5292: Continuing the previous example:</p>
5293: <pre class="programlisting">
1.100 rillig 5294: RCD_SCRIPTS+= cupsd
1.1 grant 5295: </pre>
1.75 rillig 5296: </li>
5297: </ol></div>
5298: <p>Once this is done, pkginstall will do the following steps for each
5299: script in an automated fashion:</p>
1.128 wiz 5300: <div class="orderedlist"><ol class="orderedlist" type="1">
5301: <li class="listitem"><p>Process the file found in the files directory applying all the
1.76 rillig 5302: substitutions described in the <code class="filename">FILES_SUBST</code>
1.75 rillig 5303: variable.</p></li>
1.128 wiz 5304: <li class="listitem"><p>Copy the script from the files directory to the examples
1.76 rillig 5305: hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>. Note
1.75 rillig 5306: that this master file must be explicitly registered in the
1.76 rillig 5307: <code class="filename">PLIST</code>.</p></li>
1.128 wiz 5308: <li class="listitem"><p>Add code to the installation scripts to copy the startup script
1.75 rillig 5309: from the examples hierarchy into the system-wide startup scripts
5310: directory.</p></li>
5311: </ol></div>
1.148 asau 5312: <div class="sect2">
1.75 rillig 5313: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5314: <a name="rcd-scripts-disable"></a>17.3.1. Disabling handling of system startup scripts</h3></div></div></div>
1.75 rillig 5315: <p>The automatic copying of config files can be toggled by setting the
5316: environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
5317: installation. Note that the scripts will be always copied inside the
1.76 rillig 5318: examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
1.75 rillig 5319: matter what the value of this variable is.</p>
5320: </div>
5321: </div>
1.148 asau 5322: <div class="sect1">
1.75 rillig 5323: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5324: <a name="users-and-groups"></a>17.4. System users and groups</h2></div></div></div>
1.75 rillig 5325: <p>If a package needs to create special users and/or groups during
5326: installation, it can do so by using the pkginstall framework.</p>
5327: <p>Users can be created by adding entries to the
5328: <code class="varname">PKG_USERS</code> variable. Each entry has the following
5329: syntax:</p>
5330: <pre class="programlisting">
1.100 rillig 5331: user:group
1.1 grant 5332: </pre>
1.87 wiz 5333: <p>Further specification of user details may be done by setting
5334: per-user variables.
5335: <code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
5336: numeric UID for the user.
5337: <code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
5338: user's description or comment.
5339: <code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
5340: user's home directory, and defaults to
5341: <code class="filename">/nonexistent</code> if not specified.
5342: <code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
1.94 dmcmahil 5343: user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
1.87 wiz 5344: not specified.</p>
1.75 rillig 5345: <p>Similarly, groups can be created by adding entries to the
5346: <code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
5347: <pre class="programlisting">
1.100 rillig 5348: group
1.1 grant 5349: </pre>
1.93 rillig 5350: <p>The numeric GID of the group may be set by defining
1.75 rillig 5351: <code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
5352: <p>If a package needs to create the users and groups at an earlier
1.227 wiz 5353: stage, then it can set <code class="varname">USERGROUP_PHASE</code> to either
5354: <code class="literal">configure</code>,<code class="literal">build</code>, or
5355: <code class="literal">pre-install</code> to indicate the phase before which the
5356: users and groups are created. In this case, the numeric UIDs and GIDs
5357: of the created users and groups are automatically hardcoded into the
5358: final installation scripts.</p>
1.75 rillig 5359: </div>
1.148 asau 5360: <div class="sect1">
1.75 rillig 5361: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5362: <a name="shells"></a>17.5. System shells</h2></div></div></div>
1.75 rillig 5363: <p>Packages that install system shells should register them in the shell
1.76 rillig 5364: database, <code class="filename">/etc/shells</code>, to make things easier to the
1.75 rillig 5365: administrator. This must be done from the installation scripts to keep
5366: binary packages working on any system. pkginstall provides an easy way to
5367: accomplish this task.</p>
5368: <p>When a package provides a shell interpreter, it has to set the
5369: <code class="varname">PKG_SHELL</code> variable to its absolute file name. This will
5370: add some hooks to the installation scripts to handle it. Consider the
1.250 leot 5371: 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 5372: <pre class="programlisting">
1.100 rillig 5373: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 grant 5374: </pre>
1.148 asau 5375: <div class="sect2">
1.75 rillig 5376: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5377: <a name="shells-disable"></a>17.5.1. Disabling shell registration</h3></div></div></div>
1.75 rillig 5378: <p>The automatic registration of shell interpreters can be disabled by
1.76 rillig 5379: the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
1.75 rillig 5380: environment variable to <code class="literal">NO</code>.</p>
5381: </div>
5382: </div>
1.148 asau 5383: <div class="sect1">
1.75 rillig 5384: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5385: <a name="fonts"></a>17.6. Fonts</h2></div></div></div>
1.75 rillig 5386: <p>Packages that install X11 fonts should update the database files
5387: that index the fonts within each fonts directory. This can easily be
5388: accomplished within the pkginstall framework.</p>
5389: <p>When a package installs X11 fonts, it must list the directories in
5390: which fonts are installed in the
5391: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
1.128 wiz 5392: where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">“<span class="quote">ttf</span>”</span>,
5393: <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 5394: installation scripts to run the appropriate commands to update the fonts
5395: database files within each of those directories. For convenience, if the
5396: directory path is relative, it is taken to be relative to the package's
1.250 leot 5397: 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 5398: <pre class="programlisting">
1.175 wiz 5399: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 grant 5400: </pre>
1.148 asau 5401: <div class="sect2">
1.75 rillig 5402: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5403: <a name="fonts-disable"></a>17.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
1.75 rillig 5404: <p>The automatic update of fonts databases can be disabled by
1.76 rillig 5405: the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
1.75 rillig 5406: environment variable to <code class="literal">NO</code>.</p>
5407: </div>
5408: </div>
5409: </div>
1.148 asau 5410: <div class="chapter">
1.75 rillig 5411: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 5412: <a name="options"></a>Chapter 18. Options handling</h2></div></div></div>
1.75 rillig 5413: <div class="toc">
5414: <p><b>Table of Contents</b></p>
1.210 leot 5415: <dl class="toc">
1.267 ! rillig 5416: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
! 5417: <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>
! 5418: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
! 5419: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
1.75 rillig 5420: </dl>
5421: </div>
5422: <p>Many packages have the ability to be built to support different
1.76 rillig 5423: sets of features. <code class="filename">bsd.options.mk</code> is a framework
1.75 rillig 5424: in pkgsrc that provides generic handling of those options that
5425: determine different ways in which the packages can be built. It's
5426: possible for the user to specify exactly which sets of options will be
5427: built into a package or to allow a set of global default options
5428: apply.</p>
1.107 rillig 5429: <p>There are two broad classes of behaviors that one might want to
5430: control via options. One is whether some particular feature is
5431: enabled in a program that will be built anyway, often by including or
5432: not including a dependency on some other package. The other is
5433: whether or not an additional program will be built as part of the
5434: package. Generally, it is better to make a split package for such
5435: additional programs instead of using options, because it enables
5436: binary packages to be built which can then be added separately. For
5437: example, the foo package might have minimal dependencies (those
5438: packages without which foo doesn't make sense), and then the foo-gfoo
5439: package might include the GTK frontend program gfoo. This is better
5440: than including a gtk option to foo that adds gfoo, because either that
5441: option is default, in which case binary users can't get foo without
5442: gfoo, or not default, in which case they can't get gfoo. With split
5443: packages, they can install foo without having GTK, and later decide to
5444: install gfoo (pulling in GTK at that time). This is an advantage to
5445: source users too, avoiding the need for rebuilds.</p>
5446: <p>Plugins with widely varying dependencies should usually be split
5447: instead of options.</p>
5448: <p>It is often more work to maintain split packages, especially if
5449: the upstream package does not support this. The decision of split
5450: vs. option should be made based on the likelihood that users will want
5451: or object to the various pieces, the size of the dependencies that are
5452: included, and the amount of work.</p>
5453: <p>A further consideration is licensing. Non-free parts, or parts
5454: that depend on non-free dependencies (especially plugins) should
5455: almost always be split if feasible.</p>
1.148 asau 5456: <div class="sect1">
1.75 rillig 5457: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5458: <a name="global-default-options"></a>18.1. Global default options</h2></div></div></div>
1.75 rillig 5459: <p>Global default options are listed in
5460: <code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
5461: that should be built into every package if that option is supported.
1.110 hubertf 5462: This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75 rillig 5463: </div>
1.148 asau 5464: <div class="sect1">
1.75 rillig 5465: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5466: <a name="converting-to-options"></a>18.2. Converting packages to use <code class="filename">bsd.options.mk</code>
1.93 rillig 5467: </h2></div></div></div>
1.75 rillig 5468: <p>The following example shows how
1.76 rillig 5469: <code class="filename">bsd.options.mk</code> should be used
1.75 rillig 5470: by the hypothetical ``wibble'' package, either in the package
1.76 rillig 5471: <code class="filename">Makefile</code>, or in a file,
5472: e.g. <code class="filename">options.mk</code>, that is included by the
5473: main package <code class="filename">Makefile</code>.</p>
1.75 rillig 5474: <pre class="programlisting">
1.100 rillig 5475: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
5476: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
5477: PKG_OPTIONS_OPTIONAL_GROUPS= database
5478: PKG_OPTIONS_GROUP.database= mysql pgsql
5479: PKG_SUGGESTED_OPTIONS= wibble-foo
5480: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
5481: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
5482:
5483: .include "../../mk/bsd.prefs.mk"
5484:
5485: # this package was previously named wibble2
5486: .if defined(PKG_OPTIONS.wibble2)
5487: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
5488: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
5489: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
5490: .endif
5491:
5492: .include "../../mk/bsd.options.mk"
5493:
5494: # Package-specific option-handling
5495:
5496: ###
5497: ### FOO support
5498: ###
5499: .if !empty(PKG_OPTIONS:Mwibble-foo)
5500: CONFIGURE_ARGS+= --enable-foo
5501: .endif
5502:
5503: ###
5504: ### LDAP support
5505: ###
5506: .if !empty(PKG_OPTIONS:Mldap)
5507: . include "../../databases/openldap-client/buildlink3.mk"
5508: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
5509: .endif
5510:
5511: ###
5512: ### database support
5513: ###
5514: .if !empty(PKG_OPTIONS:Mmysql)
5515: . include "../../mk/mysql.buildlink3.mk"
5516: .endif
5517: .if !empty(PKG_OPTIONS:Mpgsql)
5518: . include "../../mk/pgsql.buildlink3.mk"
5519: .endif
1.75 rillig 5520: </pre>
5521: <p>The first section contains the information about which build
5522: options are supported by the package, and any default options settings
5523: if needed.</p>
1.128 wiz 5524: <div class="orderedlist"><ol class="orderedlist" type="1">
5525: <li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
1.257 leot 5526: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> variable that the user can set to override the default
1.75 rillig 5527: options. It should be set to
1.78 rillig 5528: PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
5529: PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
5530: at the point where the options are processed.</p></li>
1.128 wiz 5531: <li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.75 rillig 5532: build options supported by the package.</p></li>
1.128 wiz 5533: <li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
1.75 rillig 5534: list of names of groups of mutually exclusive options. The options in
5535: each group are listed in
5536: <code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
5537: The most specific setting of any option from the group takes
5538: precedence over all other options in the group. Options from the
5539: groups will be automatically added to
5540: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
1.128 wiz 5541: <li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
1.75 rillig 5542: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
5543: packages will fail if no option from the group is
5544: selected.</p></li>
1.128 wiz 5545: <li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
1.75 rillig 5546: of names of sets of options. At least one option from each set must
5547: be selected. The options in each set are listed in
5548: <code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
5549: Options from the sets will be automatically added to
5550: <code class="varname">PKG_SUPPORTED_OPTIONS</code>. Building the package will
5551: fail if no option from the set is selected.</p></li>
1.128 wiz 5552: <li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
1.75 rillig 5553: build options which are enabled by default.</p></li>
1.128 wiz 5554: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
1.75 rillig 5555: of
1.128 wiz 5556: <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 5557: pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
1.75 rillig 5558: their option counterparts. Pairs should be added with
1.128 wiz 5559: <span class="quote">“<span class="quote">+=</span>”</span> to keep the listing of global legacy variables. A
1.75 rillig 5560: warning will be issued if the user uses a legacy
5561: variable.</p></li>
1.128 wiz 5562: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
1.75 rillig 5563: of
1.128 wiz 5564: <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 5565: pairs that map options that have been renamed to their new
1.128 wiz 5566: counterparts. Pairs should be added with <span class="quote">“<span class="quote">+=</span>”</span> to keep
1.75 rillig 5567: the listing of global legacy options. A warning will be issued if
5568: the user uses a legacy option.</p></li>
1.128 wiz 5569: <li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
1.75 rillig 5570: options implied by deprecated variables used. This can be used for
5571: cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
5572: <code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
5573: <code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
1.128 wiz 5574: <li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
1.75 rillig 5575: a list of warnings about deprecated variables or options used, and
5576: what to use instead.</p></li>
5577: </ol></div>
5578: <p>A package should never modify
5579: <code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
5580: <code class="varname">PKG_OPTIONS_VAR</code>. These are strictly user-settable.
5581: To suggest a default set of options, use
5582: <code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
5583: <p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
1.76 rillig 5584: including <code class="filename">bsd.options.mk</code>. If none of
1.75 rillig 5585: <code class="varname">PKG_SUPPORTED_OPTIONS</code>,
5586: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
5587: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
5588: happen with platform-specific options if none of them is supported on
5589: the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
5590: empty list and the package is otherwise treated as not using the
5591: options framework.</p>
1.76 rillig 5592: <p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
1.75 rillig 5593: variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
5594: build options, properly filtered to remove unsupported and duplicate
5595: options.</p>
5596: <p>The remaining sections contain the logic that is specific to
5597: each option. The correct way to check for an option is to check
5598: whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
5599: <pre class="programlisting">
1.100 rillig 5600: .if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
1.75 rillig 5601: </pre>
5602: </div>
1.148 asau 5603: <div class="sect1">
1.75 rillig 5604: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5605: <a name="option-names"></a>18.3. Option Names</h2></div></div></div>
1.75 rillig 5606: <p>Options that enable similar features in different packages (like
5607: optional support for a library) should use a common name in all
5608: packages that support it (like the name of the library). If another
5609: package already has an option with the same meaning, use the same
5610: name.</p>
5611: <p>Options that enable features specific to one package, where it's
5612: unlikely that another (unrelated) package has the same (or a similar)
5613: optional feature, should use a name prefixed with
5614: <code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
5615: <p>If a group of related packages share an optional feature
5616: specific to that group, prefix it with the name of the
1.128 wiz 5617: <span class="quote">“<span class="quote">main</span>”</span> package
1.75 rillig 5618: (e. g. <code class="varname">djbware-errno-hack</code>).</p>
5619: <p>For new options, add a line to
1.76 rillig 5620: <code class="filename">mk/defaults/options.description</code>. Lines have two
1.75 rillig 5621: fields, separated by tab. The first field is the option name, the
5622: second its description. The description should be a whole sentence
5623: (starting with an uppercase letter and ending with a period) that
1.128 wiz 5624: describes what enabling the option does. E. g. <span class="quote">“<span class="quote">Enable ispell
5625: support.</span>”</span> The file is sorted by option names.</p>
1.75 rillig 5626: </div>
1.148 asau 5627: <div class="sect1">
1.107 rillig 5628: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5629: <a name="option-build"></a>18.4. Determining the options of dependencies</h2></div></div></div>
1.110 hubertf 5630: <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 5631: different dependencies based on the options with which the package was
5632: built. For querying these options, the file
5633: <code class="filename">pkgsrc/mk/pkg-build-options.mk</code> should be used. A
5634: typical example looks like this:</p>
5635: <pre class="programlisting">
5636: pkgbase := libpurple
5637: .include "../../mk/pkg-build-options.mk"
5638:
5639: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5640: ...
5641: .endif
5642: </pre>
5643: <p>Including <code class="filename">pkg-build-options.mk</code> here will set
5644: the variable <code class="varname">PKG_BUILD_OPTIONS.libpurple</code> to the build
5645: options of the libpurple package, which can then be queried like
5646: <code class="varname">PKG_OPTIONS</code> in the <code class="filename">options.mk</code>
5647: file. See the file <code class="filename">pkg-build-options.mk</code> for more
5648: details.</p>
5649: </div>
1.75 rillig 5650: </div>
1.148 asau 5651: <div class="chapter">
1.75 rillig 5652: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 5653: <a name="build"></a>Chapter 19. The build process</h2></div></div></div>
1.75 rillig 5654: <div class="toc">
5655: <p><b>Table of Contents</b></p>
1.210 leot 5656: <dl class="toc">
1.267 ! rillig 5657: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
! 5658: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
! 5659: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
! 5660: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
! 5661: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
! 5662: <dd><dl>
! 5663: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
! 5664: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
! 5665: </dl></dd>
! 5666: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
! 5667: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
! 5668: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
! 5669: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
! 5670: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
! 5671: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
! 5672: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
! 5673: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
! 5674: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
! 5675: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
! 5676: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
! 5677: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
1.75 rillig 5678: </dl>
5679: </div>
1.148 asau 5680: <div class="sect1">
1.75 rillig 5681: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5682: <a name="build.intro"></a>19.1. Introduction</h2></div></div></div>
1.75 rillig 5683: <p>This chapter gives a detailed description on how a package is
1.87 wiz 5684: built. Building a package is separated into different
5685: <span class="emphasis"><em>phases</em></span> (for example <code class="varname">fetch</code>,
5686: <code class="varname">build</code>, <code class="varname">install</code>), all of which are
1.120 snj 5687: described in the following sections. Each phase is split into
1.87 wiz 5688: so-called <span class="emphasis"><em>stages</em></span>, which take the name of the
5689: containing phase, prefixed by one of <code class="varname">pre-</code>,
5690: <code class="varname">do-</code> or <code class="varname">post-</code>. (Examples are
5691: <code class="varname">pre-configure</code>, <code class="varname">post-build</code>.) Most
5692: of the actual work is done in the <code class="varname">do-*</code> stages.</p>
1.97 rillig 5693: <p>Never override the regular targets (like
5694: <code class="varname">fetch</code>), if you have to, override the
5695: <code class="varname">do-*</code> ones instead.</p>
1.75 rillig 5696: <p>The basic steps for building a program are always the same. First
1.87 wiz 5697: the program's source (<span class="emphasis"><em>distfile</em></span>) must be brought to
5698: the local system and then extracted. After any pkgsrc-specific patches
5699: to compile properly are applied, the software can be configured, then
5700: built (usually by compiling), and finally the generated binaries, etc.
5701: can be put into place on the system.</p>
1.97 rillig 5702: <p>To get more details about what is happening at each step,
5703: you can set the <code class="varname">PKG_VERBOSE</code> variable, or the
5704: <code class="varname">PATCH_DEBUG</code> variable if you are just interested
5705: in more details about the <span class="emphasis"><em>patch</em></span> step.</p>
1.75 rillig 5706: </div>
1.148 asau 5707: <div class="sect1">
1.75 rillig 5708: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5709: <a name="build.prefix"></a>19.2. Program location</h2></div></div></div>
1.75 rillig 5710: <p>Before outlining the process performed by the NetBSD package system in
1.87 wiz 5711: the next section, here's a brief discussion on where programs are
5712: installed, and which variables influence this.</p>
1.75 rillig 5713: <p>The automatic variable <code class="varname">PREFIX</code> indicates
1.87 wiz 5714: where all files of the final program shall be installed. It is
5715: usually set to <code class="varname">LOCALBASE</code>
5716: (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
1.88 wiz 5717: for pkgs in the <code class="filename">cross</code> category. The value of
1.87 wiz 5718: <code class="varname">PREFIX</code> needs to be put
5719: into the various places in the program's source where paths to
1.267 ! rillig 5720: 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 5721: <p>When choosing which of these variables to use,
1.87 wiz 5722: follow the following rules:</p>
1.148 asau 5723: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 5724: <li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
1.88 wiz 5725: where the current pkg will be installed. When referring to a
5726: pkg's own installation path, use
1.128 wiz 5727: <span class="quote">“<span class="quote">${PREFIX}</span>”</span>.</p></li>
5728: <li class="listitem"><p><code class="varname">LOCALBASE</code> is where all non-X11 pkgs
1.88 wiz 5729: are installed. If you need to construct a -I or -L argument
5730: to the compiler to find includes and libraries installed by
1.128 wiz 5731: another non-X11 pkg, use <span class="quote">“<span class="quote">${LOCALBASE}</span>”</span>. The name
1.87 wiz 5732: <code class="varname">LOCALBASE</code> stems from FreeBSD, which
5733: installed all packages in <code class="filename">/usr/local</code>. As
5734: pkgsrc leaves <code class="filename">/usr/local</code> for the system
5735: administrator, this variable is a misnomer.</p></li>
1.128 wiz 5736: <li class="listitem"><p><code class="varname">X11BASE</code> is where the actual X11
1.88 wiz 5737: distribution (from xsrc, etc.) is installed. When looking for
5738: <span class="emphasis"><em>standard</em></span> X11 includes (not those
1.128 wiz 5739: installed by a package), use <span class="quote">“<span class="quote">${X11BASE}</span>”</span>.</p></li>
1.209 sevan 5740: <li class="listitem"><p>X11-based packages using imake must set
5741: <code class="varname">USE_IMAKE</code> to be installed correctly under
5742: <code class="varname">LOCALBASE</code>.</p></li>
1.128 wiz 5743: <li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
1.257 leot 5744: install files according to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?hier+7.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that
1.87 wiz 5745: manual pages go into <code class="filename">${PREFIX}/man</code>, not
5746: <code class="filename">${PREFIX}/share/man</code>.</p></li>
1.75 rillig 5747: </ul></div>
5748: </div>
1.148 asau 5749: <div class="sect1">
1.75 rillig 5750: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5751: <a name="build.builddirs"></a>19.3. Directories used during the build process</h2></div></div></div>
1.114 jmcneill 5752: <p>When building a package, various directories are used to store
1.87 wiz 5753: source files, temporary files, pkgsrc-internal files, and so on. These
5754: directories are explained here.</p>
1.75 rillig 5755: <p>Some of the directory variables contain relative pathnames. There
1.87 wiz 5756: are two common base directories for these relative directories:
5757: <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
5758: pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
5759: inside the package itself.</p>
1.148 asau 5760: <div class="variablelist"><dl class="variablelist">
1.75 rillig 5761: <dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
5762: <dd><p>This is an absolute pathname that points to the pkgsrc
1.87 wiz 5763: root directory. Generally, you don't need
5764: it.</p></dd>
1.97 rillig 5765: <dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
5766: <dd><p>This is an absolute pathname that points to the
5767: current package.</p></dd>
1.75 rillig 5768: <dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
5769: <dd><p>This is a pathname relative to
1.87 wiz 5770: <code class="varname">PKGSRCDIR</code> that points to the current
5771: package.</p></dd>
1.75 rillig 5772: <dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
5773: <dd><p>This is an absolute pathname pointing to the directory
1.93 rillig 5774: where all work takes place. The distfiles are extracted to this
1.87 wiz 5775: directory. It also contains temporary directories and log files used by
5776: the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
5777: the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
1.75 rillig 5778: <dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
5779: <dd><p>This is an absolute pathname pointing to the directory
1.87 wiz 5780: where the distfiles are extracted. It is usually a direct subdirectory
5781: of <code class="varname">WRKDIR</code>, and often it's the only directory entry
5782: that isn't hidden. This variable may be changed by a package
5783: <code class="filename">Makefile</code>.</p></dd>
1.75 rillig 5784: </dl></div>
1.114 jmcneill 5785: <p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
5786: the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
1.116 rillig 5787: to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
1.114 jmcneill 5788: <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
5789: If users would like to have their pkgsrc trees behave in a
5790: read-only manner, then the value of
5791: <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
5792: <span class="emphasis"><em>no</em></span>.</p>
1.75 rillig 5793: </div>
1.148 asau 5794: <div class="sect1">
1.75 rillig 5795: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5796: <a name="build.running"></a>19.4. Running a phase</h2></div></div></div>
1.110 hubertf 5797: <p>You can run a particular phase by typing <span class="command"><strong>make
1.87 wiz 5798: phase</strong></span>, where <span class="emphasis"><em>phase</em></span> is the name of the
5799: phase. This will automatically run all phases that are required for this
5800: phase. The default phase is <code class="varname">build</code>, that is, when you
1.110 hubertf 5801: run <span class="command"><strong>make</strong></span> without parameters in a package directory,
1.87 wiz 5802: the package will be built, but not installed.</p>
1.75 rillig 5803: </div>
1.148 asau 5804: <div class="sect1">
1.75 rillig 5805: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5806: <a name="build.fetch"></a>19.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.81 rillig 5807: <p>The first step in building a package is to fetch the
1.88 wiz 5808: distribution files (distfiles) from the sites that are providing
5809: them. This is the task of the <span class="emphasis"><em>fetch</em></span>
5810: phase.</p>
1.148 asau 5811: <div class="sect2">
1.81 rillig 5812: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5813: <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 5814: <p>In simple cases, <code class="varname">MASTER_SITES</code>
5815: defines all URLs from where the distfile, whose name is
5816: derived from the <code class="varname">DISTNAME</code> variable, is
5817: fetched. The more complicated cases are described
5818: below.</p>
5819: <p>The variable <code class="varname">DISTFILES</code> specifies
5820: the list of distfiles that have to be fetched. Its value
1.174 asau 5821: defaults to <code class="literal">${DEFAULT_DISTFILES}</code> and
5822: its value is <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
1.88 wiz 5823: so that most packages don't need to define it at all.
5824: <code class="varname">EXTRACT_SUFX</code> is
5825: <code class="literal">.tar.gz</code> by default, but can be changed
5826: freely. Note that if your package requires additional
5827: distfiles to the default one, you cannot just append the
5828: additional filenames using the <code class="literal">+=</code>
5829: operator, but you have write for example:</p>
1.81 rillig 5830: <pre class="programlisting">
1.174 asau 5831: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.100 rillig 5832: </pre>
1.88 wiz 5833: <p>Each distfile is fetched from a list of sites, usually
5834: <code class="varname">MASTER_SITES</code>. If the package has multiple
5835: <code class="varname">DISTFILES</code> or multiple
5836: <code class="varname">PATCHFILES</code> from different sites, you can
5837: set
5838: <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
5839: to the list of URLs where the file
5840: <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
5841: (including the suffix) can be found.</p>
5842: <pre class="programlisting">
1.100 rillig 5843: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5844: DISTFILES+= foo-file.tar.gz
5845: SITES.foo-file.tar.gz= \
5846: http://www.somewhere.com/somehow/ \
5847: http://www.somewhereelse.com/mirror/somehow/
5848: </pre>
1.81 rillig 5849: <p>When actually fetching the distfiles, each item from
1.88 wiz 5850: <code class="varname">MASTER_SITES</code> or
5851: <code class="varname">SITES.*</code> gets the name of each distfile
5852: appended to it, without an intermediate slash. Therefore,
5853: all site values have to end with a slash or other separator
5854: character. This allows for example to set
5855: <code class="varname">MASTER_SITES</code> to a URL of a CGI script
5856: that gets the name of the distfile as a parameter. In this
5857: case, the definition would look like:</p>
1.81 rillig 5858: <pre class="programlisting">
1.100 rillig 5859: MASTER_SITES= http://www.example.com/download.cgi?file=
5860: </pre>
1.125 wiz 5861: <p> The exception to this rule are URLs starting with a dash.
1.174 asau 5862: In that case the URL is taken as is, fetched and the result
5863: stored under the name of the distfile. You can use this style
5864: for the case when the download URL style does not match the
5865: above common case. For example, if permanent download URL is a
5866: redirector to the real download URL, or the download file name
5867: is offered by an HTTP Content-Disposition header. In the
5868: following example, <code class="filename">foo-1.0.0.tar.gz</code> will be
5869: created instead of the default
5870: <code class="filename">v1.0.0.tar.gz</code>.</p>
5871: <pre class="programlisting">
5872: DISTNAME= foo-1.0.0
5873: MASTER_SITES= -http://www.example.com/archive/v1.0.0.tar.gz
5874: </pre>
1.81 rillig 5875: <p>There are some predefined values for
1.88 wiz 5876: <code class="varname">MASTER_SITES</code>, which can be used in
5877: packages. The names of the variables should speak for
5878: themselves.</p>
5879: <pre class="programlisting">
1.100 rillig 5880: ${MASTER_SITE_APACHE}
5881: ${MASTER_SITE_BACKUP}
5882: ${MASTER_SITE_CYGWIN}
5883: ${MASTER_SITE_DEBIAN}
5884: ${MASTER_SITE_FREEBSD}
5885: ${MASTER_SITE_FREEBSD_LOCAL}
5886: ${MASTER_SITE_GENTOO}
5887: ${MASTER_SITE_GNOME}
5888: ${MASTER_SITE_GNU}
5889: ${MASTER_SITE_GNUSTEP}
1.174 asau 5890: ${MASTER_SITE_HASKELL_HACKAGE}
1.100 rillig 5891: ${MASTER_SITE_IFARCHIVE}
5892: ${MASTER_SITE_KDE}
5893: ${MASTER_SITE_MOZILLA}
1.174 asau 5894: ${MASTER_SITE_MOZILLA_ALL}
5895: ${MASTER_SITE_MOZILLA_ESR}
1.100 rillig 5896: ${MASTER_SITE_MYSQL}
1.174 asau 5897: ${MASTER_SITE_NETLIB}
1.100 rillig 5898: ${MASTER_SITE_OPENOFFICE}
1.208 ryoon 5899: ${MASTER_SITE_OSDN}
1.100 rillig 5900: ${MASTER_SITE_PERL_CPAN}
5901: ${MASTER_SITE_PGSQL}
1.174 asau 5902: ${MASTER_SITE_RUBYGEMS}
1.100 rillig 5903: ${MASTER_SITE_R_CRAN}
5904: ${MASTER_SITE_SOURCEFORGE}
5905: ${MASTER_SITE_SUNSITE}
5906: ${MASTER_SITE_SUSE}
5907: ${MASTER_SITE_TEX_CTAN}
5908: ${MASTER_SITE_XCONTRIB}
5909: ${MASTER_SITE_XEMACS}
1.174 asau 5910: ${MASTER_SITE_XORG}
1.100 rillig 5911: </pre>
1.88 wiz 5912: <p>Some explanations for the less self-explaining ones:
5913: <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
1.133 wiz 5914: 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 5915: 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 5916: <p>If you choose one of these predefined sites, you may
5917: want to specify a subdirectory of that site. Since these
5918: macros may expand to more than one actual site, you
5919: <span class="emphasis"><em>must</em></span> use the following construct to
5920: specify a subdirectory:</p>
1.81 rillig 5921: <pre class="programlisting">
1.100 rillig 5922: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
5923: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
5924: </pre>
1.81 rillig 5925: <p>Note the trailing slash after the subdirectory
1.88 wiz 5926: name.</p>
1.81 rillig 5927: </div>
1.148 asau 5928: <div class="sect2">
1.81 rillig 5929: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 5930: <a name="build.fetch.how"></a>19.5.2. How are the files fetched?</h3></div></div></div>
1.88 wiz 5931: <p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
5932: all the distfiles exist in a local directory
1.93 rillig 5933: (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
1.88 wiz 5934: user). If the files do not exist, they are fetched using
5935: commands of the form</p>
1.75 rillig 5936: <pre class="programlisting">
1.100 rillig 5937: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
5938: </pre>
1.88 wiz 5939: <p>where <code class="literal">${site}</code> varies through
5940: several possibilities in turn: first,
5941: <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
5942: sites specified in either <code class="varname">SITES.file</code> if
5943: defined, else <code class="varname">MASTER_SITES</code> or
5944: <code class="varname">PATCH_SITES</code>, as applies, then finally the
5945: value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
1.91 rillig 5946: all except the first and the last can be optionally sorted
5947: by the user, via setting either
5948: <code class="varname">MASTER_SORT_RANDOM</code>, and
5949: <code class="varname">MASTER_SORT_AWK</code> or
1.88 wiz 5950: <code class="varname">MASTER_SORT_REGEX</code>.</p>
1.117 jnemeth 5951: <p> The specific command and arguments used depend on the
5952: <code class="varname">FETCH_USING</code> parameter. The example above is
5953: for <code class="literal">FETCH_USING=custom</code>.</p>
1.97 rillig 5954: <p>The distfiles mirror run by the NetBSD Foundation uses the
5955: <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
5956: distfiles, if they are freely distributable. Packages setting
5957: <code class="varname">NO_SRC_ON_FTP</code> (usually to
1.128 wiz 5958: <span class="quote">“<span class="quote">${RESTRICTED}</span>”</span>) will not have their distfiles
1.97 rillig 5959: mirrored.</p>
1.81 rillig 5960: </div>
1.75 rillig 5961: </div>
1.148 asau 5962: <div class="sect1">
1.75 rillig 5963: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5964: <a name="build.checksum"></a>19.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
1.88 wiz 5965: <p>After the distfile(s) are fetched, their checksum is
5966: generated and compared with the checksums stored in the
5967: distinfo file. If the checksums don't match, the build is
5968: aborted. This is to ensure the same distfile is used for
5969: building, and that the distfile wasn't changed, e.g. by some
5970: malign force, deliberately changed distfiles on the master
5971: distribution site or network lossage.</p>
1.75 rillig 5972: </div>
1.148 asau 5973: <div class="sect1">
1.75 rillig 5974: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 5975: <a name="build.extract"></a>19.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
1.75 rillig 5976: <p>When the distfiles are present on the local system, they
1.88 wiz 5977: need to be extracted, as they usually come in the form of some
5978: compressed archive format.</p>
1.75 rillig 5979: <p>By default, all <code class="varname">DISTFILES</code> are
1.88 wiz 5980: extracted. If you only need some of them, you can set the
5981: <code class="varname">EXTRACT_ONLY</code> variable to the list of those
5982: files.</p>
5983: <p>Extracting the files is usually done by a little
1.93 rillig 5984: program, <code class="filename">mk/extract/extract</code>, which
1.88 wiz 5985: already knows how to extract various archive formats, so most
5986: likely you will not need to change anything here. But if you
5987: need, the following variables may help you:</p>
1.148 asau 5988: <div class="variablelist"><dl class="variablelist">
1.75 rillig 5989: <dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
5990: <dd><p>Use these variables to override the default
1.88 wiz 5991: options for an extract command, which are defined in
1.93 rillig 5992: <code class="filename">mk/extract/extract</code>.</p></dd>
1.75 rillig 5993: <dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
5994: <dd><p>This variable can be set to
1.114 jmcneill 5995: <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
5996: (which is the default value), <code class="literal">pax</code>, or an
1.88 wiz 5997: absolute pathname pointing to the command with which tar
1.114 jmcneill 5998: archives should be extracted. It is preferred to choose bsdtar over gtar
5999: if NetBSD's pax-as-tar is not good enough.</p></dd>
1.75 rillig 6000: </dl></div>
1.88 wiz 6001: <p>If the <code class="filename">extract</code> program doesn't
6002: serve your needs, you can also override the
6003: <code class="varname">EXTRACT_CMD</code> variable, which holds the
6004: command used for extracting the files. This command is
6005: executed in the <code class="filename">${WRKSRC}</code>
6006: directory. During execution of this command, the shell
6007: variable <code class="varname">extract_file</code> holds the absolute
6008: pathname of the file that is going to be extracted.</p>
1.75 rillig 6009: <p>And if that still does not suffice, you can override the
1.88 wiz 6010: <code class="varname">do-extract</code> target in the package
6011: Makefile.</p>
1.75 rillig 6012: </div>
1.148 asau 6013: <div class="sect1">
1.75 rillig 6014: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6015: <a name="build.patch"></a>19.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
1.75 rillig 6016: <p>After extraction, all the patches named by the
1.88 wiz 6017: <code class="varname">PATCHFILES</code>, those present in the patches
6018: subdirectory of the package as well as in
6019: $LOCALPATCHES/$PKGPATH (e.g.
6020: <code class="filename">/usr/local/patches/graphics/png</code>) are
6021: applied. Patchfiles ending in <code class="filename">.Z</code> or
6022: <code class="filename">.gz</code> are uncompressed before they are
6023: applied, files ending in <code class="filename">.orig</code> or
6024: <code class="filename">.rej</code> are ignored. Any special options to
1.257 leot 6025: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in
1.267 ! rillig 6026: <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.257 leot 6027: <p>By default <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special args to make
1.88 wiz 6028: it fail if the patches apply with some lines of fuzz. Please
6029: fix (regen) the patches so that they apply cleanly. The
6030: rationale behind this is that patches that don't apply cleanly
6031: may end up being applied in the wrong place, and cause severe
6032: harm there.</p>
1.75 rillig 6033: </div>
1.148 asau 6034: <div class="sect1">
1.75 rillig 6035: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6036: <a name="build.tools"></a>19.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
! 6037: <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 6038: </p>
1.75 rillig 6039: </div>
1.148 asau 6040: <div class="sect1">
1.75 rillig 6041: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6042: <a name="build.wrapper"></a>19.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
1.75 rillig 6043: <p>This phase creates wrapper programs for the compilers and
1.88 wiz 6044: linkers. The following variables can be used to tweak the
6045: wrappers.</p>
1.148 asau 6046: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6047: <dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
6048: <dd><p>The command used to print progress
1.88 wiz 6049: messages. Does nothing by default. Set to
6050: <code class="literal">${ECHO}</code> to see the progress
6051: messages.</p></dd>
1.75 rillig 6052: <dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
6053: <dd><p>This variable can be set to
1.88 wiz 6054: <code class="literal">yes</code> (default) or <code class="literal">no</code>,
6055: depending on whether you want additional information in the
6056: wrapper log file.</p></dd>
1.75 rillig 6057: <dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
6058: <dd><p>This variable can be set to
1.88 wiz 6059: <code class="literal">yes</code> or <code class="literal">no</code>, depending
6060: on whether the wrapper should use its cache, which will
6061: improve the speed. The default value is
6062: <code class="literal">yes</code>, but is forced to
6063: <code class="literal">no</code> if the platform does not support
6064: it.</p></dd>
1.75 rillig 6065: <dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
1.88 wiz 6066: <dd><p>A list of reordering commands. A reordering
6067: command has the form
6068: <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
6069: It ensures that that
6070: <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
6071: before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
6072: </p></dd>
1.75 rillig 6073: <dt><span class="term"><code class="varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
6074: <dd><p>A list of transformation commands. [TODO:
1.88 wiz 6075: investigate further]</p></dd>
1.75 rillig 6076: </dl></div>
6077: </div>
1.148 asau 6078: <div class="sect1">
1.75 rillig 6079: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6080: <a name="build.configure"></a>19.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.88 wiz 6081: <p>Most pieces of software need information on the header
6082: files, system calls, and library routines which are available
6083: on the platform they run on. The process of determining this
6084: information is known as configuration, and is usually
6085: automated. In most cases, a script is supplied with the
6086: distfiles, and its invocation results in generation of header
6087: files, Makefiles, etc.</p>
6088: <p>If the package contains a configure script, this can be
6089: invoked by setting <code class="varname">HAS_CONFIGURE</code> to
1.128 wiz 6090: <span class="quote">“<span class="quote">yes</span>”</span>. If the configure script is a GNU autoconf
1.88 wiz 6091: script, you should set <code class="varname">GNU_CONFIGURE</code> to
1.128 wiz 6092: <span class="quote">“<span class="quote">yes</span>”</span> instead. What happens in the
1.88 wiz 6093: <span class="emphasis"><em>configure</em></span> phase is roughly:</p>
6094: <pre class="programlisting">
1.100 rillig 6095: .for d in ${CONFIGURE_DIRS}
6096: cd ${WRKSRC} \
6097: && cd ${d} \
6098: && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
6099: .endfor
6100: </pre>
1.88 wiz 6101: <p><code class="varname">CONFIGURE_DIRS</code> (default:
1.128 wiz 6102: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
1.88 wiz 6103: <code class="varname">WRKSRC</code>. In each of these directories, the
6104: configure script is run with the environment
6105: <code class="varname">CONFIGURE_ENV</code> and arguments
6106: <code class="varname">CONFIGURE_ARGS</code>. The variables
6107: <code class="varname">CONFIGURE_ENV</code>,
6108: <code class="varname">CONFIGURE_SCRIPT</code> (default:
1.128 wiz 6109: <span class="quote">“<span class="quote">./configure</span>”</span>) and
1.88 wiz 6110: <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
6111: package.</p>
1.144 wiz 6112: <p>If the program uses the Perl way of configuration (mainly Perl
6113: modules, but not only), i.e. a file called
6114: <code class="filename">Makefile.PL</code>, it should include
6115: <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
6116: <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
6117: variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
1.88 wiz 6118: <p>If the program uses an <code class="filename">Imakefile</code>
6119: for configuration, the appropriate steps can be invoked by
6120: setting <code class="varname">USE_IMAKE</code> to
1.209 sevan 6121: <span class="quote">“<span class="quote">yes</span>”</span>. If you only need xmkmf, add it to <code class="varname">USE_TOOLS</code>.
6122: You can add variables to xmkmf's environment by adding them to the
1.97 rillig 6123: <code class="varname">SCRIPTS_ENV</code> variable.</p>
1.111 rillig 6124: <p>If the program uses <code class="filename">cmake</code>
6125: for configuration, the appropriate steps can be invoked by
1.128 wiz 6126: setting <code class="varname">USE_CMAKE</code> to <span class="quote">“<span class="quote">yes</span>”</span>.
1.111 rillig 6127: You can add variables to cmake's environment by adding them to the
6128: <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
6129: by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
6130: The top directory argument is given by the
6131: <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to
1.128 wiz 6132: <span class="quote">“<span class="quote">.</span>”</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p>
1.97 rillig 6133: <p>If there is no configure step at all, set
1.128 wiz 6134: <code class="varname">NO_CONFIGURE</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.75 rillig 6135: </div>
1.148 asau 6136: <div class="sect1">
1.75 rillig 6137: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6138: <a name="build.build"></a>19.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.88 wiz 6139: <p>For building a package, a rough equivalent of the
6140: following code is executed.</p>
1.75 rillig 6141: <pre class="programlisting">
1.100 rillig 6142: .for d in ${BUILD_DIRS}
6143: cd ${WRKSRC} \
6144: && cd ${d} \
6145: && env ${MAKE_ENV} \
6146: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
6147: -f ${MAKE_FILE} \
6148: ${BUILD_TARGET}
6149: .endfor
6150: </pre>
1.88 wiz 6151: <p><code class="varname">BUILD_DIRS</code> (default:
1.128 wiz 6152: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
1.88 wiz 6153: <code class="varname">WRKSRC</code>. In each of these directories,
6154: <code class="varname">MAKE_PROGRAM</code> is run with the environment
6155: <code class="varname">MAKE_ENV</code> and arguments
6156: <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
6157: <code class="varname">MAKE_ENV</code>,
6158: <code class="varname">BUILD_MAKE_FLAGS</code>,
6159: <code class="varname">MAKE_FILE</code> and
6160: <code class="varname">BUILD_TARGET</code> may all be changed by the
6161: package.</p>
1.75 rillig 6162: <p>The default value of <code class="varname">MAKE_PROGRAM</code> is
1.128 wiz 6163: <span class="quote">“<span class="quote">gmake</span>”</span> if <code class="varname">USE_TOOLS</code> contains
6164: <span class="quote">“<span class="quote">gmake</span>”</span>, <span class="quote">“<span class="quote">make</span>”</span> otherwise. The
1.88 wiz 6165: default value of <code class="varname">MAKE_FILE</code> is
1.128 wiz 6166: <span class="quote">“<span class="quote">Makefile</span>”</span>, and <code class="varname">BUILD_TARGET</code>
6167: defaults to <span class="quote">“<span class="quote">all</span>”</span>.</p>
1.97 rillig 6168: <p>If there is no build step at all, set
1.128 wiz 6169: <code class="varname">NO_BUILD</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.75 rillig 6170: </div>
1.148 asau 6171: <div class="sect1">
1.75 rillig 6172: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6173: <a name="build.test"></a>19.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
1.75 rillig 6174: <p>[TODO]</p>
6175: </div>
1.148 asau 6176: <div class="sect1">
1.75 rillig 6177: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6178: <a name="build.install"></a>19.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.75 rillig 6179: <p>Once the build stage has completed, the final step is to
1.88 wiz 6180: install the software in public directories, so users can
6181: access the programs and files.</p>
1.75 rillig 6182: <p>In the <span class="emphasis"><em>install</em></span> phase, a rough
1.88 wiz 6183: equivalent of the following code is executed. Additionally,
6184: before and after this code, much magic is performed to do
6185: consistency checks, registering the package, and so on.</p>
6186: <pre class="programlisting">
1.100 rillig 6187: .for d in ${INSTALL_DIRS}
6188: cd ${WRKSRC} \
6189: && cd ${d} \
6190: && env ${MAKE_ENV} \
6191: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
6192: -f ${MAKE_FILE} \
6193: ${INSTALL_TARGET}
6194: .endfor
6195: </pre>
1.75 rillig 6196: <p>The variable's meanings are analogous to the ones in the
1.88 wiz 6197: <span class="emphasis"><em>build</em></span> phase.
6198: <code class="varname">INSTALL_DIRS</code> defaults to
6199: <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
1.128 wiz 6200: is <span class="quote">“<span class="quote">install</span>”</span> by default, plus
6201: <span class="quote">“<span class="quote">install.man</span>”</span> if <code class="varname">USE_IMAKE</code> is
1.88 wiz 6202: defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
6203: defined.</p>
1.75 rillig 6204: <p>In the <span class="emphasis"><em>install</em></span> phase, the following
1.88 wiz 6205: variables are useful. They are all variations of the
1.257 leot 6206: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and
1.88 wiz 6207: permissions preset. <code class="varname">INSTALL</code> is the plain
6208: install command. The specialized variants, together with their
6209: intended use, are:</p>
1.148 asau 6210: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6211: <dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
1.88 wiz 6212: <dd><p>directories that contain
6213: binaries</p></dd>
1.75 rillig 6214: <dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
1.88 wiz 6215: <dd><p>directories that contain
6216: scripts</p></dd>
1.75 rillig 6217: <dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
1.88 wiz 6218: <dd><p>directories that contain shared and static
6219: libraries</p></dd>
1.75 rillig 6220: <dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
1.88 wiz 6221: <dd><p>directories that contain data
6222: files</p></dd>
1.75 rillig 6223: <dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
1.88 wiz 6224: <dd><p>directories that contain man
6225: pages</p></dd>
1.210 leot 6226: <dt><span class="term"><code class="varname">INSTALL_GAME_DIR</code></span></dt>
6227: <dd><p>directories that contain data files for games
6228: </p></dd>
1.75 rillig 6229: <dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
1.88 wiz 6230: <dd><p>binaries that can be stripped from debugging
6231: symbols</p></dd>
1.75 rillig 6232: <dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
1.88 wiz 6233: <dd><p>binaries that cannot be
6234: stripped</p></dd>
1.75 rillig 6235: <dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
1.88 wiz 6236: <dd><p>game
6237: binaries</p></dd>
1.75 rillig 6238: <dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
1.88 wiz 6239: <dd><p>shared and static
6240: libraries</p></dd>
1.75 rillig 6241: <dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
6242: <dd><p>data files</p></dd>
6243: <dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
1.88 wiz 6244: <dd><p>data files for
6245: games</p></dd>
1.75 rillig 6246: <dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
6247: <dd><p>man pages</p></dd>
6248: </dl></div>
6249: <p>Some other variables are:</p>
1.148 asau 6250: <div class="variablelist"><dl class="variablelist">
1.216 tnn 6251: <dt><span class="term"><code class="varname">INSTALL_UNSTRIPPED</code></span></dt>
1.257 leot 6252: <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.0"><span class="citerefentry"><span class="refentrytitle">strip</span>(1)</span></a>
1.216 tnn 6253: when installing binaries. Any debugging sections and symbols present in
6254: binaries will be preserved.
6255: </p></dd>
1.75 rillig 6256: <dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
6257: <dd><p>A list of directories relative to
1.88 wiz 6258: <code class="varname">PREFIX</code> that are created by pkgsrc at the
1.98 wiz 6259: beginning of the <span class="emphasis"><em>install</em></span> phase.
6260: The package is supposed to create all needed directories itself
6261: before installing files to it and list all other directories here.
6262: </p></dd>
1.75 rillig 6263: </dl></div>
1.97 rillig 6264: <p>In the rare cases that a package shouldn't install anything,
1.128 wiz 6265: set <code class="varname">NO_INSTALL</code> to <span class="quote">“<span class="quote">yes</span>”</span>. This is
1.97 rillig 6266: mostly relevant for packages in the <code class="filename">regress</code>
6267: category.</p>
1.75 rillig 6268: </div>
1.148 asau 6269: <div class="sect1">
1.75 rillig 6270: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6271: <a name="build.package"></a>19.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
1.88 wiz 6272: <p>Once the install stage has completed, a binary package of
6273: the installed files can be built. These binary packages can be
6274: used for quick installation without previous compilation, e.g. by
1.110 hubertf 6275: the <span class="command"><strong>make bin-install</strong></span> or by using
6276: <span class="command"><strong>pkg_add</strong></span>.</p>
1.88 wiz 6277: <p>By default, the binary packages are created in
6278: <code class="filename">${PACKAGES}/All</code> and symlinks are created in
6279: <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
6280: one for each category in the <code class="varname">CATEGORIES</code>
6281: variable. <code class="varname">PACKAGES</code> defaults to
6282: <code class="filename">pkgsrc/packages</code>.</p>
6283: </div>
1.148 asau 6284: <div class="sect1">
1.88 wiz 6285: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6286: <a name="build.clean"></a>19.16. Cleaning up</h2></div></div></div>
1.88 wiz 6287: <p>Once you're finished with a package, you can clean the work
1.110 hubertf 6288: directory by running <span class="command"><strong>make clean</strong></span>. If you want
1.88 wiz 6289: to clean the work directories of all dependencies too, use
1.110 hubertf 6290: <span class="command"><strong>make clean-depends</strong></span>.</p>
1.75 rillig 6291: </div>
1.148 asau 6292: <div class="sect1">
1.75 rillig 6293: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6294: <a name="build.helpful-targets"></a>19.17. Other helpful targets</h2></div></div></div>
1.148 asau 6295: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6296: <dt><span class="term">pre/post-*</span></dt>
1.88 wiz 6297: <dd><p>For any of the main targets described in the
6298: previous section, two auxiliary targets exist with
1.128 wiz 6299: <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 6300: prefix for the main target's name. These targets are
1.88 wiz 6301: invoked before and after the main target is called,
6302: allowing extra configuration or installation steps be
6303: performed from a package's Makefile, for example, which
6304: a program's configure script or install target
6305: omitted.</p></dd>
1.75 rillig 6306: <dt><span class="term">do-*</span></dt>
1.88 wiz 6307: <dd><p>Should one of the main targets do the wrong thing,
6308: and should there be no variable to fix this, you can
6309: redefine it with the do-* target. (Note that redefining
6310: the target itself instead of the do-* target is a bad
6311: idea, as the pre-* and post-* targets won't be called
6312: anymore, etc.) You will not usually need to do
6313: this.</p></dd>
1.75 rillig 6314: <dt><span class="term">reinstall</span></dt>
1.88 wiz 6315: <dd>
1.110 hubertf 6316: <p>If you did a <span class="command"><strong>make install</strong></span> and
1.88 wiz 6317: you noticed some file was not installed properly, you
6318: can repeat the installation with this target, which will
1.128 wiz 6319: ignore the <span class="quote">“<span class="quote">already installed</span>”</span> flag.</p>
1.88 wiz 6320: <p>This is the default value of
6321: <code class="varname">DEPENDS_TARGET</code> except in the case of
1.110 hubertf 6322: <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
1.88 wiz 6323: package</strong></span>, where the defaults are
1.128 wiz 6324: <span class="quote">“<span class="quote">package</span>”</span> and <span class="quote">“<span class="quote">update</span>”</span>,
1.88 wiz 6325: respectively.</p>
6326: </dd>
1.75 rillig 6327: <dt><span class="term">deinstall</span></dt>
6328: <dd>
1.257 leot 6329: <p>This target does a <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the
1.88 wiz 6330: current directory, effectively de-installing the
6331: package. The following variables can be used to tune the
6332: behaviour:</p>
1.148 asau 6333: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6334: <dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
1.257 leot 6335: <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.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd>
1.75 rillig 6336: <dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
1.88 wiz 6337: <dd><p>Remove all packages that require (depend on)
6338: the given package. This can be used to remove any
6339: packages that may have been pulled in by a given
1.110 hubertf 6340: package, e.g. if <span class="command"><strong>make deinstall
1.87 wiz 6341: DEINSTALLDEPENDS=1</strong></span> is done in
1.88 wiz 6342: <code class="filename">pkgsrc/x11/kde</code>, this is
6343: likely to remove whole KDE. Works by adding
1.257 leot 6344: <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.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
1.88 wiz 6345: command line.</p></dd>
1.75 rillig 6346: </dl></div>
6347: </dd>
1.88 wiz 6348: <dt><span class="term">bin-install</span></dt>
6349: <dd><p>Install a binary package from local disk and via FTP
6350: from a list of sites (see the
6351: <code class="varname">BINPKG_SITES</code> variable), and do a
1.110 hubertf 6352: <span class="command"><strong>make package</strong></span> if no binary package is
1.88 wiz 6353: available anywhere. The arguments given to
1.110 hubertf 6354: <span class="command"><strong>pkg_add</strong></span> can be set via
1.88 wiz 6355: <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
6356: operation, etc.</p></dd>
1.205 wiz 6357: <dt><span class="term">install-clean</span></dt>
6358: <dd><p>This target removes the state files for the "install" and later
6359: phases so that the "install" target may be re-invoked. This can be
6360: used after editing the PLIST to install the package without
6361: rebuilding it.</p></dd>
6362: <dt><span class="term">build-clean</span></dt>
6363: <dd><p>This target removes the state files for the "build" and later
6364: phases so that the "build" target may be re-invoked.</p></dd>
1.75 rillig 6365: <dt><span class="term">update</span></dt>
6366: <dd>
1.88 wiz 6367: <p>This target causes the current package to be
6368: updated to the latest version. The package and all
6369: depending packages first get de-installed, then current
6370: versions of the corresponding packages get compiled and
6371: installed. This is similar to manually noting which
6372: packages are currently installed, then performing a
1.110 hubertf 6373: series of <span class="command"><strong>make deinstall</strong></span> and
6374: <span class="command"><strong>make install</strong></span> (or whatever
1.88 wiz 6375: <code class="varname">UPDATE_TARGET</code> is set to) for these
6376: packages.</p>
1.128 wiz 6377: <p>You can use the <span class="quote">“<span class="quote">update</span>”</span> target to
1.110 hubertf 6378: resume package updating in case a previous <span class="command"><strong>make
1.88 wiz 6379: update</strong></span> was interrupted for some reason.
6380: However, in this case, make sure you don't call
1.110 hubertf 6381: <span class="command"><strong>make clean</strong></span> or otherwise remove the
1.88 wiz 6382: list of dependent packages in <code class="varname">WRKDIR</code>.
6383: Otherwise, you lose the ability to automatically update
6384: the current package along with the dependent packages
6385: you have installed.</p>
1.110 hubertf 6386: <p>Resuming an interrupted <span class="command"><strong>make
1.88 wiz 6387: update</strong></span> will only work as long as the package
6388: tree remains unchanged. If the source code for one of
6389: the packages to be updated has been changed, resuming
1.110 hubertf 6390: <span class="command"><strong>make update</strong></span> will most certainly
1.88 wiz 6391: fail!</p>
6392: <p>The following variables can be used either on the
1.110 hubertf 6393: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
6394: alter the behaviour of <span class="command"><strong>make
1.88 wiz 6395: update</strong></span>:</p>
1.148 asau 6396: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6397: <dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
1.88 wiz 6398: <dd><p>Install target to recursively use for the
6399: updated package and the dependent packages.
6400: Defaults to <code class="varname">DEPENDS_TARGET</code> if
1.128 wiz 6401: set, <span class="quote">“<span class="quote">install</span>”</span> otherwise for
1.110 hubertf 6402: <span class="command"><strong>make update</strong></span>. Other good
1.128 wiz 6403: targets are <span class="quote">“<span class="quote">package</span>”</span> or
6404: <span class="quote">“<span class="quote">bin-install</span>”</span>. Do not set this to
6405: <span class="quote">“<span class="quote">update</span>”</span> or you will get stuck in an
1.88 wiz 6406: endless loop!</p></dd>
1.75 rillig 6407: <dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
1.88 wiz 6408: <dd><p>Don't clean up after updating. Useful if
6409: you want to leave the work sources of the updated
6410: packages around for inspection or other purposes.
6411: Be sure you eventually clean up the source tree
1.128 wiz 6412: (see the <span class="quote">“<span class="quote">clean-update</span>”</span> target below)
1.88 wiz 6413: or you may run into troubles with old source code
6414: still lying around on your next
1.110 hubertf 6415: <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
1.88 wiz 6416: update</strong></span>.</p></dd>
1.75 rillig 6417: <dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
1.88 wiz 6418: <dd><p>Deinstall each package before installing
6419: (making <code class="varname">DEPENDS_TARGET</code>). This
6420: may be necessary if the
1.128 wiz 6421: <span class="quote">“<span class="quote">clean-update</span>”</span> target (see below) was
1.110 hubertf 6422: called after interrupting a running <span class="command"><strong>make
1.88 wiz 6423: update</strong></span>.</p></dd>
1.75 rillig 6424: <dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
1.88 wiz 6425: <dd><p>Allows you to disable recursion and hardcode
6426: the target for packages. The default is
1.128 wiz 6427: <span class="quote">“<span class="quote">update</span>”</span> for the update target,
1.88 wiz 6428: facilitating a recursive update of prerequisite
6429: packages. Only set
6430: <code class="varname">DEPENDS_TARGET</code> if you want to
6431: disable recursive updates. Use
6432: <code class="varname">UPDATE_TARGET</code> instead to just
6433: set a specific target for each package to be
1.110 hubertf 6434: installed during <span class="command"><strong>make update</strong></span>
1.88 wiz 6435: (see above).</p></dd>
1.75 rillig 6436: </dl></div>
6437: </dd>
6438: <dt><span class="term">clean-update</span></dt>
6439: <dd>
1.88 wiz 6440: <p>Clean the source tree for all packages that would
1.110 hubertf 6441: get updated if <span class="command"><strong>make update</strong></span> was called
1.88 wiz 6442: from the current directory. This target should not be
6443: used if the current package (or any of its depending
6444: packages) have already been de-installed (e.g., after
1.110 hubertf 6445: calling <span class="command"><strong>make update</strong></span>) or you may lose
1.88 wiz 6446: some packages you intended to update. As a rule of
6447: thumb: only use this target <span class="emphasis"><em>before</em></span>
1.110 hubertf 6448: the first time you run <span class="command"><strong>make update</strong></span>
1.88 wiz 6449: and only if you have a dirty package tree (e.g., if you
6450: used <code class="varname">NOCLEAN</code>).</p>
6451: <p>If you are unsure about whether your tree is
1.110 hubertf 6452: clean, you can either perform a <span class="command"><strong>make
1.88 wiz 6453: clean</strong></span> at the top of the tree, or use the
6454: following sequence of commands from the directory of the
6455: package you want to update (<span class="emphasis"><em>before</em></span>
1.110 hubertf 6456: running <span class="command"><strong>make update</strong></span> for the first
1.88 wiz 6457: time, otherwise you lose all the packages you wanted to
6458: update!):</p>
1.87 wiz 6459: <pre class="screen">
6460: <code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
1.75 rillig 6461: <code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
1.87 wiz 6462: <code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
6463: </pre>
1.88 wiz 6464: <p>The following variables can be used either on the
1.110 hubertf 6465: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
6466: <span class="command"><strong>make clean-update</strong></span>:</p>
1.148 asau 6467: <div class="variablelist"><dl class="variablelist">
1.75 rillig 6468: <dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
1.110 hubertf 6469: <dd><p>After <span class="command"><strong>make clean</strong></span>, do not
1.88 wiz 6470: reconstruct the list of directories to update for
1.110 hubertf 6471: this package. Only use this if <span class="command"><strong>make
1.88 wiz 6472: update</strong></span> successfully installed all
6473: packages you wanted to update. Normally, this is
1.110 hubertf 6474: done automatically on <span class="command"><strong>make
1.88 wiz 6475: update</strong></span>, but may have been suppressed by
6476: the <code class="varname">NOCLEAN</code> variable (see
6477: above).</p></dd>
1.75 rillig 6478: </dl></div>
6479: </dd>
1.88 wiz 6480: <dt><span class="term">replace</span></dt>
6481: <dd>
6482: <p>Update the installation of the current package. This
6483: differs from update in that it does not replace dependent
1.250 leot 6484: 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 6485: target to work.</p>
6486: <p><span class="emphasis"><em>Be careful when using this
6487: target!</em></span> There are no guarantees that dependent
6488: packages will still work, in particular they will most
1.110 hubertf 6489: certainly break if you <span class="command"><strong>make replace</strong></span> a
1.88 wiz 6490: library package whose shared library major version changed
6491: between your installed version and the new one. For this
6492: reason, this target is not officially supported and only
6493: recommended for advanced users.</p>
6494: </dd>
1.75 rillig 6495: <dt><span class="term">info</span></dt>
1.257 leot 6496: <dd><p>This target invokes <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current
1.88 wiz 6497: package. You can use this to check which version of a
6498: package is installed.</p></dd>
6499: <dt><span class="term">index</span></dt>
6500: <dd>
6501: <p>This is a top-level command, i.e. it should be used in
6502: the <code class="filename">pkgsrc</code> directory. It creates a
6503: database of all packages in the local pkgsrc tree, including
6504: dependencies, comment, maintainer, and some other useful
6505: information. Individual entries are created by running
1.110 hubertf 6506: <span class="command"><strong>make describe</strong></span> in the packages'
1.88 wiz 6507: directories. This index file is saved as
6508: <code class="filename">pkgsrc/INDEX</code>. It can be displayed in
1.110 hubertf 6509: verbose format by running <span class="command"><strong>make
1.88 wiz 6510: print-index</strong></span>. You can search in it with
1.110 hubertf 6511: <span class="command"><strong>make search
1.88 wiz 6512: key=<em class="replaceable"><code>something</code></em></strong></span>. You can
6513: extract a list of all packages that depend on a particular
1.110 hubertf 6514: one by running <span class="command"><strong>make show-deps
1.88 wiz 6515: PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
6516: <p>Running this command takes a very long time, some
6517: hours even on fast machines!</p>
6518: </dd>
1.75 rillig 6519: <dt><span class="term">readme</span></dt>
1.88 wiz 6520: <dd>
6521: <p>This target generates a
6522: <code class="filename">README.html</code> file, which can be
1.250 leot 6523: 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 6524: contain references to any packages which are in the
6525: <code class="varname">PACKAGES</code> directory on the local
6526: host. The generated files can be made to refer to URLs
6527: based on <code class="varname">FTP_PKG_URL_HOST</code> and
6528: <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
6529: wanted to generate <code class="filename">README.html</code>
6530: files which pointed to binary packages on the local
6531: machine, in the directory
6532: <code class="filename">/usr/packages</code>, set
6533: <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
6534: <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
6535: <code class="varname">${PACKAGES}</code> directory and its
6536: subdirectories will be searched for all the binary
6537: packages.</p>
6538: <p>The target can be run at the toplevel or in category
6539: directories, in which case it descends recursively.</p>
6540: </dd>
1.75 rillig 6541: <dt><span class="term">readme-all</span></dt>
1.88 wiz 6542: <dd><p>This is a top-level command, run it in
6543: <code class="filename">pkgsrc</code>. Use this target to create a
6544: file <code class="filename">README-all.html</code> which contains a
6545: list of all packages currently available in the NetBSD
6546: Packages Collection, together with the category they belong
6547: to and a short description. This file is compiled from the
6548: <code class="filename">pkgsrc/*/README.html</code> files, so be sure
1.110 hubertf 6549: to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
1.88 wiz 6550: readme</strong></span>.</p></dd>
1.75 rillig 6551: <dt><span class="term">cdrom-readme</span></dt>
1.88 wiz 6552: <dd><p>This is very much the same as the
1.128 wiz 6553: <span class="quote">“<span class="quote">readme</span>”</span> target (see above), but is to be
1.88 wiz 6554: used when generating a pkgsrc tree to be written to a
6555: CD-ROM. This target also produces
6556: <code class="filename">README.html</code> files, and can be made
6557: to refer to URLs based on
6558: <code class="varname">CDROM_PKG_URL_HOST</code> and
1.87 wiz 6559: <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
1.75 rillig 6560: <dt><span class="term">show-distfiles</span></dt>
1.88 wiz 6561: <dd><p>This target shows which distfiles and patchfiles
6562: are needed to build the package
6563: (<code class="varname">ALLFILES</code>, which contains all
6564: <code class="varname">DISTFILES</code> and
1.87 wiz 6565: <code class="varname">PATCHFILES</code>, but not
6566: <code class="filename">patches/*</code>).</p></dd>
1.75 rillig 6567: <dt><span class="term">show-downlevel</span></dt>
1.88 wiz 6568: <dd><p>This target shows nothing if the package is not
6569: installed. If a version of this package is installed,
6570: but is not the version provided in this version of
6571: pkgsrc, then a warning message is displayed. This target
6572: can be used to show which of your installed packages are
6573: downlevel, and so the old versions can be deleted, and
6574: the current ones added.</p></dd>
1.75 rillig 6575: <dt><span class="term">show-pkgsrc-dir</span></dt>
1.88 wiz 6576: <dd><p>This target shows the directory in the pkgsrc
6577: hierarchy from which the package can be built and
6578: installed. This may not be the same directory as the one
6579: from which the package was installed. This target is
6580: intended to be used by people who may wish to upgrade
6581: many packages on a single host, and can be invoked from
6582: the top-level pkgsrc Makefile by using the
1.128 wiz 6583: <span class="quote">“<span class="quote">show-host-specific-pkgs</span>”</span> target.</p></dd>
1.75 rillig 6584: <dt><span class="term">show-installed-depends</span></dt>
1.88 wiz 6585: <dd><p>This target shows which installed packages match
6586: the current package's <code class="varname">DEPENDS</code>. Useful
6587: if out of date dependencies are causing build
6588: problems.</p></dd>
1.205 wiz 6589: <dt><span class="term">print-build-depends-list</span></dt>
6590: <dd><p>This target shows the list of packages that the current package
6591: depends on for building.</p></dd>
6592: <dt><span class="term">print-run-depends-list</span></dt>
6593: <dd><p>This target shows the list of packages that the current package
6594: depends on for running.</p></dd>
1.75 rillig 6595: <dt><span class="term">check-shlibs</span></dt>
1.88 wiz 6596: <dd><p>After a package is installed, check all its
6597: binaries and (on ELF platforms) shared libraries to see
6598: if they find the shared libs they need. Run by default
1.110 hubertf 6599: 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 6600: <dt><span class="term">print-PLIST</span></dt>
6601: <dd>
1.128 wiz 6602: <p>After a <span class="quote">“<span class="quote">make install</span>”</span> from a new or
1.88 wiz 6603: upgraded pkg, this prints out an attempt to generate a
1.110 hubertf 6604: new <code class="filename">PLIST</code> from a <span class="command"><strong>find
1.88 wiz 6605: -newer work/.extract_done</strong></span>. An attempt is made
6606: to care for shared libs etc., but it is
1.87 wiz 6607: <span class="emphasis"><em>strongly</em></span> recommended to review the
6608: result before putting it into
6609: <code class="filename">PLIST</code>. On upgrades, it's useful to
6610: diff the output of this command against an already
6611: existing <code class="filename">PLIST</code> file.</p>
1.257 leot 6612: <p>If the package installs files via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
1.88 wiz 6613: other methods that don't update file access times, be
6614: sure to add these files manually to your
1.128 wiz 6615: <code class="filename">PLIST</code>, as the <span class="quote">“<span class="quote">find
6616: -newer</span>”</span> command used by this target won't catch
1.87 wiz 6617: them!</p>
1.267 ! rillig 6618: <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 6619: information on this target.</p>
1.75 rillig 6620: </dd>
6621: <dt><span class="term">bulk-package</span></dt>
6622: <dd>
1.88 wiz 6623: <p>Used to do bulk builds. If an appropriate binary
6624: package already exists, no action is taken. If not, this
6625: target will compile, install and package it (and its
6626: depends, if <code class="varname">PKG_DEPENDS</code> is set
1.267 ! rillig 6627: 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 6628: builds)</i></a>).
1.88 wiz 6629: After creating the binary package, the sources, the
6630: just-installed package and its required packages are
6631: removed, preserving free disk space.</p>
6632: <p><span class="emphasis"><em>Beware that this target may deinstall
6633: all packages installed on a system!</em></span></p>
1.75 rillig 6634: </dd>
6635: <dt><span class="term">bulk-install</span></dt>
6636: <dd>
1.88 wiz 6637: <p>Used during bulk-installs to install required
6638: packages. If an up-to-date binary package is available,
1.257 leot 6639: it will be installed via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. If not,
1.110 hubertf 6640: <span class="command"><strong>make bulk-package</strong></span> will be executed,
1.87 wiz 6641: but the installed binary won't be removed.</p>
1.88 wiz 6642: <p>A binary package is considered
1.128 wiz 6643: <span class="quote">“<span class="quote">up-to-date</span>”</span> to be installed via
1.257 leot 6644: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> if:</p>
1.148 asau 6645: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 6646: <li class="listitem"><p>None of the package's files
1.88 wiz 6647: (<code class="filename">Makefile</code>, ...) were modified
6648: since it was built.</p></li>
1.128 wiz 6649: <li class="listitem"><p>None of the package's required (binary)
1.88 wiz 6650: packages were modified since it was built.</p></li>
1.75 rillig 6651: </ul></div>
1.88 wiz 6652: <p><span class="emphasis"><em>Beware that this target may deinstall
6653: all packages installed on a system!</em></span></p>
1.75 rillig 6654: </dd>
6655: </dl></div>
6656: </div>
6657: </div>
1.148 asau 6658: <div class="chapter">
1.75 rillig 6659: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 6660: <a name="tools"></a>Chapter 20. Tools needed for building or running</h2></div></div></div>
1.75 rillig 6661: <div class="toc">
6662: <p><b>Table of Contents</b></p>
1.210 leot 6663: <dl class="toc">
1.267 ! rillig 6664: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
! 6665: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
! 6666: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
1.75 rillig 6667: </dl>
6668: </div>
1.87 wiz 6669: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
1.75 rillig 6670: by pkgsrc and also for individual packages to define what commands
6671: are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>)
6672: or for later run-time of an installed packaged (such as
6673: <code class="varname">DEPENDS</code>).
6674: If the native system provides an adequate tool, then in many cases, a pkgsrc
1.87 wiz 6675: package will not be used.</p>
6676: <p>When building a package, the replacement tools are
1.75 rillig 6677: made available in a directory (as symlinks or wrapper scripts)
6678: that is early in the executable search path. Just like the buildlink
1.87 wiz 6679: system, this helps with consistent builds.</p>
6680: <p>A tool may be needed to help build a specific package. For example,
6681: perl, GNU make (gmake) or yacc may be needed.</p>
6682: <p>Also a tool may be needed, for example, because the native system's supplied
1.75 rillig 6683: tool may be inefficient for building a package with pkgsrc.
6684: For example, a package may need GNU awk, bison (instead of
1.87 wiz 6685: yacc) or a better sed.</p>
6686: <p>The tools used by a package can be listed by running
1.110 hubertf 6687: <span class="command"><strong>make show-tools</strong></span>.</p>
1.148 asau 6688: <div class="sect1">
1.75 rillig 6689: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6690: <a name="pkgsrc-tools"></a>20.1. Tools for pkgsrc builds</h2></div></div></div>
1.87 wiz 6691: <p>The default set of tools used by pkgsrc is defined in
1.76 rillig 6692: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
1.110 hubertf 6693: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
6694: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
1.75 rillig 6695: These can be seen by running:
1.110 hubertf 6696: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
1.87 wiz 6697: <p>If a package needs a specific program to build
1.75 rillig 6698: then the <code class="varname">USE_TOOLS</code> variable can be used
1.87 wiz 6699: to define the tools needed.</p>
1.75 rillig 6700: </div>
1.148 asau 6701: <div class="sect1">
1.75 rillig 6702: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6703: <a name="package-tools"></a>20.2. Tools needed by packages</h2></div></div></div>
1.135 wiz 6704: <p>In the following examples, the :run means that it is needed at
6705: run-time (and becomes a DEPENDS).
1.75 rillig 6706: The default is a build dependency which can be set with
6707: :build. (So in this example, it is the same as gmake:build
1.87 wiz 6708: and pkg-config:build.)</p>
1.75 rillig 6709: <pre class="programlisting">
6710: USE_TOOLS+= gmake perl:run pkg-config
6711: </pre>
1.87 wiz 6712: <p>When using the tools framework, a
1.75 rillig 6713: <code class="varname">TOOLS_PATH.foo</code> variable is defined
6714: which contains the full path to the appropriate tool. For example,
1.128 wiz 6715: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
1.87 wiz 6716: on Linux systems.</p>
6717: <p>If you always need a pkgsrc version of the
1.75 rillig 6718: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
6719: </p>
6720: </div>
1.148 asau 6721: <div class="sect1">
1.75 rillig 6722: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6723: <a name="platform-tools"></a>20.3. Tools provided by platforms</h2></div></div></div>
1.87 wiz 6724: <p>When improving or porting pkgsrc to a new platform, have a look
1.75 rillig 6725: at (or create) the corresponding platform specific make file fragment under
1.76 rillig 6726: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
1.75 rillig 6727: the name of the common tools. For example:</p>
6728: <pre class="programlisting">
6729: .if exists(/usr/bin/bzcat)
6730: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
6731: .elif exists(/usr/bin/bzip2)
6732: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
6733: .endif
1.69 rillig 6734:
1.75 rillig 6735: TOOLS_PLATFORM.true?= true # shell builtin
6736: </pre>
6737: </div>
6738: </div>
1.148 asau 6739: <div class="chapter">
1.75 rillig 6740: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 6741: <a name="fixes"></a>Chapter 21. Making your package work</h2></div></div></div>
1.75 rillig 6742: <div class="toc">
6743: <p><b>Table of Contents</b></p>
1.210 leot 6744: <dl class="toc">
1.267 ! rillig 6745: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
1.75 rillig 6746: <dd><dl>
1.267 ! rillig 6747: <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>
! 6748: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
! 6749: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
! 6750: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
! 6751: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
! 6752: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
! 6753: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
! 6754: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
! 6755: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
! 6756: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
! 6757: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
! 6758: </dl></dd>
! 6759: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
! 6760: <dd><dl>
! 6761: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
! 6762: <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>
! 6763: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
! 6764: </dl></dd>
! 6765: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
! 6766: <dd><dl>
! 6767: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
! 6768: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
! 6769: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
! 6770: </dl></dd>
! 6771: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
! 6772: <dd><dl>
! 6773: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
! 6774: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
! 6775: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
! 6776: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
! 6777: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
! 6778: </dl></dd>
! 6779: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
! 6780: <dd><dl>
! 6781: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
! 6782: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
! 6783: <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>
! 6784: <dt><span class="sect2"><a href="#out-of-memory">21.5.4. Running out of memory</a></span></dt>
! 6785: </dl></dd>
! 6786: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
! 6787: <dd><dl>
! 6788: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
! 6789: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
! 6790: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
! 6791: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
! 6792: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
! 6793: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
! 6794: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
! 6795: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
! 6796: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
! 6797: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
! 6798: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
! 6799: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
! 6800: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
! 6801: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
! 6802: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
! 6803: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
! 6804: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
! 6805: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.87 wiz 6806: emulation</a></span></dt>
1.267 ! rillig 6807: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
! 6808: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.75 rillig 6809: </dl></dd>
1.267 ! rillig 6810: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.75 rillig 6811: </dl>
6812: </div>
1.148 asau 6813: <div class="sect1">
1.75 rillig 6814: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 6815: <a name="general-operation"></a>21.1. General operation</h2></div></div></div>
1.78 rillig 6816: <p>One appealing feature of pkgsrc is that it runs on many
1.218 rillig 6817: different platforms. As a result, it is important to ensure,
6818: where possible, that packages in pkgsrc are portable. This
6819: chapter mentions some particular details you should pay
6820: attention to while working on pkgsrc.</p>
1.148 asau 6821: <div class="sect2">
1.78 rillig 6822: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 6823: <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 6824: </h3></div></div></div>
1.78 rillig 6825: <p>The pkgsrc user can configure pkgsrc by overriding several
1.87 wiz 6826: variables in the file pointed to by <code class="varname">MAKECONF</code>,
1.110 hubertf 6827: which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
1.87 wiz 6828: want to use those variables in the preprocessor directives of
1.257 leot 6829: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or
1.87 wiz 6830: <code class="literal">.for</code>), you need to include the file
6831: <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
6832: loads the user preferences.</p>
1.78 rillig 6833: <p>But note that some variables may not be completely defined
1.219 rillig 6834: after <code class="filename">../../mk/bsd.prefs.mk</code> has been
6835: included, as they may contain references to variables that are
6836: not yet defined. In shell commands (the lines in
6837: <code class="filename">Makefile</code> that are indented with a tab) this
6838: is no problem, since variables are only expanded when they are
6839: used. But in the preprocessor directives mentioned above and in
6840: dependency lines (of the form <code class="literal">target:
6841: dependencies</code>) the variables are expanded at load
6842: time.</p>
1.148 asau 6843: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.78 rillig 6844: <h3 class="title">Note</h3>
1.218 rillig 6845: <p>To check whether a variable can be used at load time,
6846: run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
1.78 rillig 6847: </div>
6848: </div>
1.148 asau 6849: <div class="sect2">
1.78 rillig 6850: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 6851: <a name="user-interaction"></a>21.1.2. User interaction</h3></div></div></div>
1.88 wiz 6852: <p>Occasionally, packages require interaction from the user,
6853: and this can be in a number of ways:</p>
1.148 asau 6854: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 6855: <li class="listitem"><p>When fetching the distfiles, some packages require user
1.87 wiz 6856: interaction such as entering username/password or accepting a
6857: license on a web page.</p></li>
1.128 wiz 6858: <li class="listitem"><p>When extracting the distfiles, some packages may ask for
1.88 wiz 6859: passwords.</p></li>
1.128 wiz 6860: <li class="listitem"><p>help to configure the package before it is built</p></li>
6861: <li class="listitem"><p>help during the build process</p></li>
6862: <li class="listitem"><p>help during the installation of a package</p></li>
1.78 rillig 6863: </ul></div>
1.218 rillig 6864: <p>A package can set the <code class="varname">INTERACTIVE_STAGE</code>
6865: variable to define which stages need interaction. This should be
6866: done in the package's <code class="filename">Makefile</code>, e.g.:</p>
1.75 rillig 6867: <pre class="programlisting">
1.100 rillig 6868: INTERACTIVE_STAGE= configure install
1.222 sevan 6869: </pre>
1.88 wiz 6870: <p>The user can then decide to skip this package by setting the
1.218 rillig 6871: <code class="varname">BATCH</code> variable. Packages that require interaction
6872: are also excluded from bulk builds.</p>
1.75 rillig 6873: </div>
1.148 asau 6874: <div class="sect2">
1.75 rillig 6875: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 6876: <a name="handling-licenses"></a>21.1.3. Handling licenses</h3></div></div></div>
1.222 sevan 6877: <p>Authors of software can choose the licence under which software
6878: can be copied. The Free Software Foundation has declared some
6879: licenses "Free", and the Open Source Initiative has a definition of
6880: "Open Source".</p>
6881: <p>By default, pkgsrc allows packages with Free or Open Source
6882: licenses to be built. To allow packages with other licenses to be
6883: built as well, the pkgsrc user needs to add these licenses to the
6884: <code class="varname">ACCEPTABLE_LICENSES</code> variable in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. Note
6885: that this variable only affects which packages may be
6886: <span class="emphasis"><em>built</em></span>, while the license terms often also
6887: restrict the actual use of the package and its redistribution.</p>
1.98 wiz 6888: <p>One might want to only install packages with a BSD license,
1.218 rillig 6889: or the GPL, and not the other. The free licenses are added to the
1.222 sevan 6890: default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The pkgsrc
1.121 jnemeth 6891: user can override the default by setting the
6892: <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
1.222 sevan 6893: of "+=". The licenses accepted by default are defined in the
6894: <code class="varname">DEFAULT_ACCEPTABLE_LICENSES</code> variable in the file
6895: <code class="filename">pkgsrc/mk/license.mk</code>.</p>
1.78 rillig 6896: <p>The license tag mechanism is intended to address
1.87 wiz 6897: copyright-related issues surrounding building, installing and
6898: using a package, and not to address redistribution issues (see
6899: <code class="varname">RESTRICTED</code> and
1.222 sevan 6900: <code class="varname">NO_SRC_ON_FTP</code>, etc.).
1.121 jnemeth 6901: Packages with redistribution restrictions should set these
6902: tags.</p>
1.98 wiz 6903: <p>Denoting that a package may be copied according to a
6904: particular license is done by placing the license in
1.87 wiz 6905: <code class="filename">pkgsrc/licenses</code> and setting the
6906: <code class="varname">LICENSE</code> variable to a string identifying the
1.250 leot 6907: 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 6908: <pre class="programlisting">
1.100 rillig 6909: LICENSE= xv-license
1.222 sevan 6910: </pre>
1.87 wiz 6911: <p>When trying to build, the user will get a notice that the
1.98 wiz 6912: package is covered by a license which has not been placed in the
6913: <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
1.87 wiz 6914: <pre class="programlisting">
1.100 rillig 6915: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
6916: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6917: ===> To view the license, enter "/usr/bin/make show-license".
6918: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6919: ===> ACCEPTABLE_LICENSES+=xv-license
6920: *** Error code 1
1.222 sevan 6921: </pre>
1.110 hubertf 6922: <p>The license can be viewed with <span class="command"><strong>make
1.98 wiz 6923: show-license</strong></span>, and if the user so chooses, the line
1.110 hubertf 6924: printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.98 wiz 6925: convey to pkgsrc that it should not in the future fail because of
6926: that license:</p>
1.78 rillig 6927: <pre class="programlisting">
1.100 rillig 6928: ACCEPTABLE_LICENSES+=xv-license
1.222 sevan 6929: </pre>
6930: <p>The use of <code class="varname">LICENSE=shareware</code>,
6931: <code class="varname">LICENSE=no-commercial-use</code>, and similar language
6932: is deprecated because it does not crisply refer to a particular
6933: license text. Another problem with such usage is that it does not
6934: enable a user to tell pkgsrc to proceed for a single package
6935: without also telling pkgsrc to proceed for all packages with that
6936: tag.</p>
6937: <div class="sect3">
6938: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 6939: <a name="new-license"></a>21.1.3.1. Adding a package with a new license</h4></div></div></div>
1.154 rodent 6940: <p>When adding a package with a new license, the following steps
6941: are required:</p>
6942: <div class="orderedlist"><ol class="orderedlist" type="1">
6943: <li class="listitem">
1.222 sevan 6944: <p>Check whether the license qualifies as Free or Open
6945: Source by referencing <a class="ulink" href="http://www.gnu.org/licenses/license-list.en.html" target="_top">Various Licenses
6946: and Comments about Them</a> and <a class="ulink" href="http://opensource.org/licenses/alphabetical" target="_top">Licenses by Name |
6947: Open Source Initiative</a>. If this is the case, the filename in
6948: <code class="filename">pkgsrc/licenses/</code> does not need the
6949: <code class="filename">-license</code> suffix, and the license name should be
6950: added to:</p>
1.154 rodent 6951: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6952: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in <code class="filename">pkgsrc/mk/license.mk</code></p></li>
6953: <li class="listitem"><p>default_acceptable_licenses in <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
6954: </ul></div>
6955: </li>
6956: <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>
6957: </ol></div>
1.222 sevan 6958: </div>
6959: <div class="sect3">
6960: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 6961: <a name="change-license"></a>21.1.3.2. Change to the license</h4></div></div></div>
1.98 wiz 6962: <p>When the license changes (in a way other than formatting),
1.222 sevan 6963: make sure that the new license has a different name (e.g.,
1.98 wiz 6964: append the version number if it exists, or the date). Just
6965: because a user told pkgsrc to build programs under a previous
6966: version of a license does not mean that pkgsrc should build
1.99 rillig 6967: programs under the new licenses. The higher-level point is that
1.98 wiz 6968: pkgsrc does not evaluate licenses for reasonableness; the only
6969: test is a mechanistic test of whether a particular text has been
1.222 sevan 6970: approved by either of two bodies (FSF or OSI).</p>
6971: </div>
1.75 rillig 6972: </div>
1.148 asau 6973: <div class="sect2">
1.75 rillig 6974: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 6975: <a name="restricted-packages"></a>21.1.4. Restricted packages</h3></div></div></div>
1.75 rillig 6976: <p>Some licenses restrict how software may be re-distributed.
1.222 sevan 6977: By declaring the restrictions, package tools can
1.98 wiz 6978: automatically refrain from e.g. placing binary packages on FTP
6979: sites.</p>
1.222 sevan 6980: <p>There are four possible restrictions, which are
1.98 wiz 6981: the cross product of sources (distfiles) and binaries not being
6982: placed on FTP sites and CD-ROMs. Because this is rarely the exact
6983: language in any license, and because non-Free licenses tend to be
6984: different from each other, pkgsrc adopts a definition of FTP and
1.222 sevan 6985: CD-ROM.
6986:
6987: "FTP" means making the source or binary file available over the
6988: Internet at no charge.
6989:
6990: "CD-ROM" means making the source or binary available on some kind of
6991: media, together with other source and binary packages, which is sold
6992: for a distribution charge.
1.98 wiz 6993: </p>
6994: <p>In order to encode these restrictions, the package system
1.87 wiz 6995: defines five make variables that can be set to note these
6996: restrictions:</p>
1.148 asau 6997: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 6998: <li class="listitem">
1.75 rillig 6999: <p><code class="varname">RESTRICTED</code></p>
7000: <p>This variable should be set whenever a restriction
1.87 wiz 7001: exists (regardless of its kind). Set this variable to a
1.98 wiz 7002: string containing the reason for the restriction. It should
7003: be understood that those wanting to understand the restriction
7004: will have to read the license, and perhaps seek advice of
7005: counsel.</p>
1.75 rillig 7006: </li>
1.128 wiz 7007: <li class="listitem">
1.75 rillig 7008: <p><code class="varname">NO_BIN_ON_CDROM</code></p>
1.98 wiz 7009: <p>Binaries may not be placed on CD-ROM containing other
7010: binary packages, for which a distribution charge may be made.
7011: In this case, set this variable to
7012: <code class="varname">${RESTRICTED}</code>.</p>
1.75 rillig 7013: </li>
1.128 wiz 7014: <li class="listitem">
1.75 rillig 7015: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.98 wiz 7016: <p>Binaries may not made available on the Internet without
7017: charge. In this case, set this variable to
7018: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7019: binary packages will not be included on ftp.NetBSD.org.</p>
1.75 rillig 7020: </li>
1.128 wiz 7021: <li class="listitem">
1.75 rillig 7022: <p><code class="varname">NO_SRC_ON_CDROM</code></p>
1.98 wiz 7023: <p>Distfiles may not be placed on CD-ROM, together with
7024: other distfiles, for which a fee may be charged. In this
7025: case, set this variable to <code class="varname">${RESTRICTED}</code>.
7026: </p>
1.75 rillig 7027: </li>
1.128 wiz 7028: <li class="listitem">
1.75 rillig 7029: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.98 wiz 7030: <p>Distfiles may not made available via FTP at no charge.
7031: In this case, set this variable to
7032: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7033: the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
1.75 rillig 7034: </li>
7035: </ul></div>
1.222 sevan 7036: <p>Please note that packages will be removed from pkgsrc when the
7037: distfiles are not distributable and cannot be obtained for a period
7038: of one full quarter branch. Packages with manual/interactive fetch
7039: must have a maintainer and it is his/her responsibility to ensure
7040: this.</p>
1.75 rillig 7041: </div>
1.148 asau 7042: <div class="sect2">
1.75 rillig 7043: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7044: <a name="dependencies"></a>21.1.5. Handling dependencies</h3></div></div></div>
1.75 rillig 7045: <p>Your package may depend on some other package being present
1.88 wiz 7046: - and there are various ways of expressing this dependency.
7047: pkgsrc supports the <code class="varname">BUILD_DEPENDS</code> and
7048: <code class="varname">DEPENDS</code> definitions, the
7049: <code class="varname">USE_TOOLS</code> definition, as well as dependencies
7050: via <code class="filename">buildlink3.mk</code>, which is the preferred way
7051: to handle dependencies, and which uses the variables named above.
1.267 ! rillig 7052: 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 7053: <p>The basic difference between the two variables is as
1.87 wiz 7054: follows: The <code class="varname">DEPENDS</code> definition registers
7055: that pre-requisite in the binary package so it will be pulled in
7056: when the binary package is later installed, whilst the
7057: <code class="varname">BUILD_DEPENDS</code> definition does not, marking a
7058: dependency that is only needed for building the package.</p>
1.75 rillig 7059: <p>This means that if you only need a package present whilst
1.87 wiz 7060: you are building, it should be noted as a
7061: <code class="varname">BUILD_DEPENDS</code>.</p>
1.75 rillig 7062: <p>The format for a <code class="varname">BUILD_DEPENDS</code> and a
1.87 wiz 7063: <code class="varname">DEPENDS</code> definition is:</p>
1.75 rillig 7064: <pre class="programlisting">
1.100 rillig 7065: <pre-req-package-name>:../../<category>/<pre-req-package>
1.222 sevan 7066: </pre>
1.128 wiz 7067: <p>Please note that the <span class="quote">“<span class="quote">pre-req-package-name</span>”</span>
1.87 wiz 7068: may include any of the wildcard version numbers recognized by
1.257 leot 7069: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p>
1.128 wiz 7070: <div class="orderedlist"><ol class="orderedlist" type="1">
7071: <li class="listitem">
1.75 rillig 7072: <p>If your package needs another package's binaries or
1.160 wiz 7073: libraries to build and run, and if that package has a
1.87 wiz 7074: <code class="filename">buildlink3.mk</code> file available, use it:</p>
1.75 rillig 7075: <pre class="programlisting">
1.100 rillig 7076: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7077: </pre>
1.75 rillig 7078: </li>
1.128 wiz 7079: <li class="listitem">
1.160 wiz 7080: <p>If your package needs another package's binaries or
7081: libraries only for building, and if that package has a
7082: <code class="filename">buildlink3.mk</code> file available, use it:</p>
7083: <pre class="programlisting">
7084: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7085: </pre>
1.160 wiz 7086: <p>but set
7087: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
7088: to make it a build dependency only. This case is rather
7089: rare.</p>
7090: </li>
7091: <li class="listitem">
1.132 spz 7092: <p>If your package needs binaries from another package to build,
7093: use the <code class="varname">BUILD_DEPENDS</code> definition:</p>
1.75 rillig 7094: <pre class="programlisting">
1.260 tnn 7095: BUILD_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.222 sevan 7096: </pre>
1.75 rillig 7097: </li>
1.132 spz 7098: <li class="listitem"><p>If your package needs a library with which to link and
7099: there is no <code class="filename">buildlink3.mk</code> file
7100: available, create one. Using
7101: <code class="varname">DEPENDS</code> won't be sufficient because the
7102: include files and libraries will be hidden from the compiler.</p></li>
1.128 wiz 7103: <li class="listitem">
1.132 spz 7104: <p>If your package needs some executable to be able to run
7105: correctly and if there's no
7106: <code class="filename">buildlink3.mk</code> file, this is specified
7107: using the <code class="varname">DEPENDS</code> variable. The
1.250 leot 7108: <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 7109: be able to execute the latex binary from the tex-latex-bin package
1.132 spz 7110: when it runs, and that is specified:</p>
1.75 rillig 7111: <pre class="programlisting">
1.242 wiz 7112: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.222 sevan 7113: </pre>
1.132 spz 7114: </li>
7115: <li class="listitem">
7116: <p>You can use wildcards in package dependencies. Note that
7117: such wildcard dependencies are retained when creating binary
7118: packages. The dependency is checked when installing the binary
7119: package and any package which matches the pattern will be
7120: used. Wildcard dependencies should be used with care.</p>
1.128 wiz 7121: <p>The <span class="quote">“<span class="quote">-[0-9]*</span>”</span> should be used instead of
7122: <span class="quote">“<span class="quote">-*</span>”</span> to avoid potentially ambiguous matches
7123: such as <span class="quote">“<span class="quote">tk-postgresql</span>”</span> matching a
7124: <span class="quote">“<span class="quote">tk-*</span>”</span> <code class="varname">DEPENDS</code>.</p>
1.75 rillig 7125: <p>Wildcards can also be used to specify that a package
1.87 wiz 7126: will only build against a certain minimum version of a
7127: pre-requisite:</p>
1.75 rillig 7128: <pre class="programlisting">
1.132 spz 7129: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.222 sevan 7130: </pre>
1.132 spz 7131: <p>This means that the package will build using version 6.0
7132: of ImageMagick or newer. Such a dependency may be warranted
7133: if, for example, the command line options of an executable
7134: have changed.</p>
7135: <p>If you need to depend on minimum versions of libraries,
7136: see the buildlink section of the pkgsrc guide.</p>
1.75 rillig 7137: <p>For security fixes, please update the package
1.267 ! rillig 7138: 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 7139: information.</p>
1.75 rillig 7140: </li>
7141: </ol></div>
7142: <p>If your package needs files from another package to build,
1.87 wiz 7143: add the relevant distribution files to
7144: <code class="varname">DISTFILES</code>, so they will be extracted
1.250 leot 7145: 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 7146: (It relies on the jpeg sources being present in source form
7147: during the build.)</p>
1.75 rillig 7148: </div>
1.148 asau 7149: <div class="sect2">
1.75 rillig 7150: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7151: <a name="conflicts"></a>21.1.6. Handling conflicts with other packages</h3></div></div></div>
1.75 rillig 7152: <p>Your package may conflict with other packages a user might
1.87 wiz 7153: already have installed on his system, e.g. if your package
1.88 wiz 7154: installs the same set of files as another package in the pkgsrc
1.190 wiz 7155: tree or has the same <code class="varname">PKGNAME</code>.</p>
1.255 leot 7156: <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>
7157: 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>
7158: install the same shared library, thus you set in
7159: <code class="filename">pkgsrc/x11/libXaw3d/Makefile</code>:</p>
7160: <pre class="programlisting">
7161: CONFLICTS= Xaw-Xpm-[0-9]*
7162: </pre>
7163: <p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
7164: <pre class="programlisting">
7165: CONFLICTS= libXaw3d-[0-9]*
7166: </pre>
1.257 leot 7167: <p><a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> is able to detect attempts to install packages
1.255 leot 7168: that conflict with existing packages and abort. However, in many
7169: situations this is too late in the process. Binary package managers
7170: will not know about the conflict until they attempt to install the
7171: package after already downloading it and all its dependencies.
7172: Users may also waste time building a package and its dependencies
7173: only to find out at the end that it conflicts with another package
7174: they have installed.</p>
7175: <p>To avoid these issues <code class="varname">CONFLICTS</code> entries
7176: should be added in all cases where it is known that packages conflict
7177: with each other. These <code class="varname">CONFLICTS</code> entries are
1.257 leot 7178: exported in <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> files and consumed by binary package
1.255 leot 7179: managers to inform users that packages cannot be installed onto
7180: the target system.</p>
1.75 rillig 7181: </div>
1.148 asau 7182: <div class="sect2">
1.75 rillig 7183: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7184: <a name="not-building-packages"></a>21.1.7. Packages that cannot or should not be built</h3></div></div></div>
1.75 rillig 7185: <p>There are several reasons why a package might be
1.88 wiz 7186: instructed to not build under certain circumstances. If the
1.87 wiz 7187: package builds and runs on most platforms, the exceptions
1.193 dholland 7188: should be noted with <code class="varname">BROKEN_ON_PLATFORM</code>. If
7189: the package builds and runs on a small handful of platforms,
7190: set <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> instead.
7191: Both <code class="varname">BROKEN_ON_PLATFORM</code> and
7192: <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> are OS triples
7193: (OS-version-platform) that can use glob-style
7194: wildcards.</p>
7195: <p>If a package is not appropriate for some platforms (as
1.225 maya 7196: opposed to merely broken), a different set of variables should be
1.193 dholland 7197: used as this affects failure reporting and statistics.
7198: If the package is appropriate for most platforms, the exceptions
1.87 wiz 7199: should be noted with <code class="varname">NOT_FOR_PLATFORM</code>. If
1.193 dholland 7200: the package is appropriate for only a small handful of platforms
7201: (often exactly one), set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.87 wiz 7202: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
7203: <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
7204: (OS-version-platform) that can use glob-style
7205: wildcards.</p>
1.88 wiz 7206: <p>Some packages are tightly bound to a specific version of an
1.250 leot 7207: 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 7208: backwards compatible with other versions of the OS, and should be
7209: uploaded to a version specific directory on the FTP server. Mark
7210: these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
1.128 wiz 7211: <span class="quote">“<span class="quote">yes</span>”</span>. This variable is not currently used by any of
1.88 wiz 7212: the package system internals, but may be used in the
7213: future.</p>
1.75 rillig 7214: <p>If the package should be skipped (for example, because it
1.87 wiz 7215: provides functionality already provided by the system), set
1.88 wiz 7216: <code class="varname">PKG_SKIP_REASON</code> to a descriptive message. If
7217: the package should fail because some preconditions are not met,
7218: set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
1.87 wiz 7219: message.</p>
1.75 rillig 7220: </div>
1.148 asau 7221: <div class="sect2">
1.75 rillig 7222: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7223: <a name="undeletable-packages"></a>21.1.8. Packages which should not be deleted, once installed</h3></div></div></div>
1.75 rillig 7224: <p>To ensure that a package may not be deleted, once it has been
1.87 wiz 7225: installed, the <code class="varname">PKG_PRESERVE</code> definition should
7226: be set in the package Makefile. This will be carried into any
7227: binary package that is made from this pkgsrc entry. A
1.128 wiz 7228: <span class="quote">“<span class="quote">preserved</span>”</span> package will
1.257 leot 7229: not be deleted using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the
1.128 wiz 7230: <span class="quote">“<span class="quote">-f</span>”</span> option is used.</p>
1.75 rillig 7231: </div>
1.148 asau 7232: <div class="sect2">
1.75 rillig 7233: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7234: <a name="security-handling"></a>21.1.9. Handling packages with security problems</h3></div></div></div>
1.75 rillig 7235: <p>When a vulnerability is found, this should be noted in
1.87 wiz 7236: <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.138 wiz 7237: and after committing that file, ask pkgsrc-security@NetBSD.org to
7238: update the file on ftp.NetBSD.org.</p>
1.75 rillig 7239: <p>After fixing the vulnerability by a patch, its
1.138 wiz 7240: <code class="varname">PKGREVISION</code> should be increased (this is of
7241: course not necessary if the problem is fixed by using a newer
7242: release of the software), and the pattern in the
7243: pkg-vulnerabilities file must be updated.</p>
1.75 rillig 7244: <p>Also, if the fix should be applied to the stable pkgsrc
1.87 wiz 7245: branch, be sure to submit a pullup request!</p>
1.75 rillig 7246: <p>Binary packages already on ftp.NetBSD.org will be handled
1.87 wiz 7247: semi-automatically by a weekly cron job.</p>
1.75 rillig 7248: </div>
1.148 asau 7249: <div class="sect2">
1.75 rillig 7250: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7251: <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 7252: <p>When making fixes to an existing package it can be useful
1.87 wiz 7253: to change the version number in <code class="varname">PKGNAME</code>. To
7254: avoid conflicting with future versions by the original author, a
1.128 wiz 7255: <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 7256: on package versions by setting <code class="varname">PKGREVISION=1</code>
1.128 wiz 7257: (2, ...). The <span class="quote">“<span class="quote">nb</span>”</span> is treated like a
7258: <span class="quote">“<span class="quote">.</span>”</span> by the package tools. e.g.</p>
1.87 wiz 7259: <pre class="programlisting">
1.100 rillig 7260: DISTNAME= foo-17.42
7261: PKGREVISION= 9
1.222 sevan 7262: </pre>
1.75 rillig 7263: <p>will result in a <code class="varname">PKGNAME</code> of
1.128 wiz 7264: <span class="quote">“<span class="quote">foo-17.42nb9</span>”</span>. If you want to use the original
7265: value of <code class="varname">PKGNAME</code> without the <span class="quote">“<span class="quote">nbX</span>”</span>
1.87 wiz 7266: suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
7267: <code class="varname">PKGNAME_NOREV</code>.</p>
1.75 rillig 7268: <p>When a new release of the package is released, the
1.87 wiz 7269: <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
7270: minor release of the above package, things should be like:</p>
1.75 rillig 7271: <pre class="programlisting">
1.100 rillig 7272: DISTNAME= foo-17.43
1.222 sevan 7273: </pre>
1.87 wiz 7274: <p><code class="varname">PKGREVISION</code> should be incremented for any
7275: non-trivial change in the resulting binary package. Without a
7276: <code class="varname">PKGREVISION</code> bump, someone with the previous
7277: version installed has no way of knowing that their package is out
7278: of date. Thus, changes without increasing
7279: <code class="varname">PKGREVISION</code> are essentially labeled "this is so
7280: trivial that no reasonable person would want to upgrade", and this
7281: is the rough test for when increasing
7282: <code class="varname">PKGREVISION</code> is appropriate. Examples of
7283: changes that do not merit increasing
7284: <code class="varname">PKGREVISION</code> are:</p>
1.148 asau 7285: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7286: <li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
1.114 jmcneill 7287: <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>,
1.100 rillig 7288: or comments in Makefile.</p></li>
1.128 wiz 7289: <li class="listitem"><p>
1.100 rillig 7290: Changing build variables if the resulting binary package is the same.</p></li>
1.128 wiz 7291: <li class="listitem"><p>
1.100 rillig 7292: Changing <code class="filename">DESCR</code>.</p></li>
1.128 wiz 7293: <li class="listitem"><p>
1.100 rillig 7294: Adding <code class="varname">PKG_OPTIONS</code> if the default options don't change.</p></li>
7295: </ul></div>
1.87 wiz 7296: <p>Examples of changes that do merit an increase to
7297: <code class="varname">PKGREVISION</code> include:</p>
1.148 asau 7298: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7299: <li class="listitem"><p>
1.100 rillig 7300: Security fixes</p></li>
1.128 wiz 7301: <li class="listitem"><p>
1.100 rillig 7302: Changes or additions to a patch file</p></li>
1.128 wiz 7303: <li class="listitem"><p>
1.100 rillig 7304: Changes to the <code class="filename">PLIST</code></p></li>
1.128 wiz 7305: <li class="listitem"><p>A dependency is changed or renamed.</p></li>
1.100 rillig 7306: </ul></div>
1.78 rillig 7307: <p>PKGREVISION must also be incremented when dependencies have ABI
7308: changes.</p>
1.75 rillig 7309: </div>
1.148 asau 7310: <div class="sect2">
1.79 rillig 7311: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7312: <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 7313: <p>When you want to replace the same text in multiple files
1.87 wiz 7314: or when the replacement text varies, patches alone cannot help.
7315: This is where the SUBST framework comes in. It provides an
7316: easy-to-use interface for replacing text in files.
7317: Example:</p>
7318: <pre class="programlisting">
1.100 rillig 7319: SUBST_CLASSES+= fix-paths
7320: SUBST_STAGE.fix-paths= pre-configure
7321: SUBST_MESSAGE.fix-paths= Fixing absolute paths.
7322: SUBST_FILES.fix-paths= src/*.c
7323: SUBST_FILES.fix-paths+= scripts/*.sh
7324: SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g'
7325: SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g'
1.222 sevan 7326: </pre>
1.79 rillig 7327: <p><code class="varname">SUBST_CLASSES</code> is a list of identifiers
1.87 wiz 7328: that are used to identify the different SUBST blocks that are
7329: defined. The SUBST framework is heavily used by pkgsrc, so it is
7330: important to always use the <code class="literal">+=</code> operator with
7331: this variable. Otherwise some substitutions may be
7332: skipped.</p>
1.79 rillig 7333: <p>The remaining variables of each SUBST block are
1.87 wiz 7334: parameterized with the identifier from the first line
7335: (<code class="literal">fix-paths</code> in this case.) They can be seen as
7336: parameters to a function call.</p>
1.79 rillig 7337: <p><code class="varname">SUBST_STAGE.*</code> specifies the stage at
1.87 wiz 7338: which the replacement will take place. All combinations of
7339: <code class="literal">pre-</code>, <code class="literal">do-</code> and
7340: <code class="literal">post-</code> together with a phase name are
7341: possible, though only few are actually used. Most commonly used
7342: are <code class="literal">post-patch</code> and
7343: <code class="literal">pre-configure</code>. Of these two,
7344: <code class="literal">pre-configure</code> should be preferred because
1.110 hubertf 7345: then it is possible to run <span class="command"><strong>bmake patch</strong></span> and
1.87 wiz 7346: have the state after applying the patches but before making any
7347: other changes. This is especially useful when you are debugging
7348: a package in order to create new patches for it. Similarly,
7349: <code class="literal">post-build</code> is preferred over
7350: <code class="literal">pre-install</code>, because the install phase should
7351: generally be kept as simple as possible. When you use
7352: <code class="literal">post-build</code>, you have the same files in the
7353: working directory that will be installed later, so you can check
7354: if the substitution has succeeded.</p>
1.79 rillig 7355: <p><code class="varname">SUBST_MESSAGE.*</code> is an optional text
1.87 wiz 7356: that is printed just before the substitution is done.</p>
1.79 rillig 7357: <p><code class="varname">SUBST_FILES.*</code> is the list of shell
1.87 wiz 7358: globbing patterns that specifies the files in which the
7359: substitution will take place. The patterns are interpreted
7360: relatively to the <code class="varname">WRKSRC</code> directory.</p>
1.79 rillig 7361: <p><code class="varname">SUBST_SED.*</code> is a list of arguments to
1.257 leot 7362: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that specify the actual substitution. Every sed
1.87 wiz 7363: command should be prefixed with <code class="literal">-e</code>, so that
7364: all SUBST blocks look uniform.</p>
1.79 rillig 7365: <p>There are some more variables, but they are so seldomly
1.87 wiz 7366: used that they are only documented in the
7367: <code class="filename">mk/subst.mk</code> file.</p>
1.79 rillig 7368: </div>
1.75 rillig 7369: </div>
1.148 asau 7370: <div class="sect1">
1.75 rillig 7371: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 7372: <a name="fixes.fetch"></a>21.2. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.148 asau 7373: <div class="sect2">
1.75 rillig 7374: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7375: <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 7376: <p>If you need to download from a dynamic URL you can set
1.110 hubertf 7377: <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
1.87 wiz 7378: fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
7379: with the name of each file to download as an argument, expecting
7380: it to output the URL of the directory from which to download
1.250 leot 7381: 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 7382: example of this usage.</p>
1.75 rillig 7383: <p>If the download can't be automated, because the user must
1.87 wiz 7384: submit personal information to apply for a password, or must pay
7385: for the source, or whatever, you can set
7386: <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
7387: displayed to the user before aborting the build. Example:</p>
7388: <pre class="programlisting">
1.100 rillig 7389: FETCH_MESSAGE= "Please download the files"
7390: FETCH_MESSAGE+= " "${DISTFILES:Q}
7391: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
1.222 sevan 7392: </pre>
1.75 rillig 7393: </div>
1.148 asau 7394: <div class="sect2">
1.75 rillig 7395: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7396: <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 7397: <p>Sometimes authors of a software package make some
1.87 wiz 7398: modifications after the software was released, and they put up a
7399: new distfile without changing the package's version number. If a
7400: package is already in pkgsrc at that time, the checksum will
7401: no longer match. The contents of the new distfile should be
7402: compared against the old one before changing anything, to make
7403: sure the distfile was really updated on purpose, and that
7404: no trojan horse or so crept in.
1.97 rillig 7405: Please mention that the distfiles were compared and what was found
1.159 rodent 7406: in your commit message.</p>
1.220 wiz 7407: <p>Then, the correct way to work around this is to set
7408: <code class="varname">DIST_SUBDIR</code> to a unique directory name, usually
7409: based on <code class="varname">PKGNAME_NOREV</code> (but take care with
7410: python or ruby packages, where <code class="varname">PKGNAME</code> includes
7411: a variable prefix). All <code class="varname">DISTFILES</code> and
1.93 rillig 7412: <code class="varname">PATCHFILES</code> for this package will be put in that
1.267 ! rillig 7413: 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 7414: happens more often, <code class="varname">PKGNAME</code> can be used (thus
1.220 wiz 7415: including the <code class="filename">nbX</code> suffix) or a date stamp can
7416: be appended, like
7417: <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
1.159 rodent 7418: <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>
7419: <p>Do not forget regenerating the <code class="filename">distinfo</code> file
1.87 wiz 7420: after that, since it contains the <code class="varname">DIST_SUBDIR</code>
7421: path in the filenames.
1.159 rodent 7422: Also, increase the PKGREVISION if the installed package is different.
1.87 wiz 7423: Furthermore, a mail to the package's authors seems appropriate
7424: telling them that changing distfiles after releases without
7425: changing the file names is not good practice.</p>
1.75 rillig 7426: </div>
1.199 tnn 7427: <div class="sect2">
7428: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7429: <a name="build.fetch.github"></a>21.2.3. Packages hosted on github.com</h3></div></div></div>
1.200 tnn 7430: <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:
7431: </p>
1.199 tnn 7432: <div class="sect3">
7433: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7434: <a name="build.fetch.github.tag"></a>21.2.3.1. Fetch based on a tagged release</h4></div></div></div>
1.199 tnn 7435: <p>
7436: 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.
7437: </p>
7438: <pre class="programlisting">
7439: DISTNAME= exampleproject-1.0
1.200 tnn 7440: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
7441: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
7442: GITHUB_TAG= v${PKGVERSION_NOREV}
1.199 tnn 7443: EXTRACT_SUFX= .zip
7444: </pre>
7445: </div>
7446: <div class="sect3">
7447: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7448: <a name="build.fetch.github.commit"></a>21.2.3.2. Fetch based on a specific commit</h4></div></div></div>
1.199 tnn 7449: <p>
7450: 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.
7451: </p>
7452: <pre class="programlisting">
7453: DISTNAME= example-1.0
1.217 jnemeth 7454: MASTER_SITES= ${MASTER_SITE_GITHUB:=example/}
1.200 tnn 7455: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
7456: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.222 sevan 7457: </pre>
1.199 tnn 7458: </div>
7459: <div class="sect3">
7460: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7461: <a name="build.fetch.github.release"></a>21.2.3.3. Fetch based on release</h4></div></div></div>
1.199 tnn 7462: <p>
7463: 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.
7464: </p>
7465: <pre class="programlisting">
7466: DISTNAME= offensive-1.6
1.200 tnn 7467: PKGNAME= ${DISTNAME:S/offensive/proper/}
7468: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
7469: GITHUB_PROJECT= exampleproject
7470: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
7471: EXTRACT_SUFX= .zip
1.222 sevan 7472: </pre>
1.199 tnn 7473: </div>
7474: </div>
1.75 rillig 7475: </div>
1.148 asau 7476: <div class="sect1">
1.75 rillig 7477: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 7478: <a name="fixes.configure"></a>21.3. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.148 asau 7479: <div class="sect2">
1.75 rillig 7480: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7481: <a name="fixes.libtool"></a>21.3.1. Shared libraries - libtool</h3></div></div></div>
1.75 rillig 7482: <p>pkgsrc supports many different machines, with different
1.87 wiz 7483: object formats like a.out and ELF, and varying abilities to do
7484: shared library and dynamic loading at all. To accompany this,
7485: varying commands and options have to be passed to the
7486: compiler, linker, etc. to get the Right Thing, which can be
7487: pretty annoying especially if you don't have all the machines
7488: at your hand to test things. The
1.250 leot 7489: <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 7490: can help here, as it just <span class="quote">“<span class="quote">knows</span>”</span> how to build
1.87 wiz 7491: both static and dynamic libraries from a set of source files,
7492: thus being platform-independent.</p>
7493: <p>Here's how to use libtool in a package in seven simple
7494: steps:</p>
1.128 wiz 7495: <div class="orderedlist"><ol class="orderedlist" type="1">
7496: <li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
1.87 wiz 7497: Makefile.</p></li>
1.128 wiz 7498: <li class="listitem"><p>For library objects, use <span class="quote">“<span class="quote">${LIBTOOL} --mode=compile
7499: ${CC}</span>”</span> in place of <span class="quote">“<span class="quote">${CC}</span>”</span>. You could even
1.87 wiz 7500: add it to the definition of <code class="varname">CC</code>, if only
7501: libraries are being built in a given Makefile. This one command
7502: will build both PIC and non-PIC library objects, so you need not
7503: have separate shared and non-shared library rules.</p></li>
1.128 wiz 7504: <li class="listitem">
1.75 rillig 7505: <p>For the linking of the library, remove any
1.128 wiz 7506: <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
7507: -Bshareable</span>”</span> commands, and instead use:</p>
1.75 rillig 7508: <pre class="programlisting">
1.100 rillig 7509: ${LIBTOOL} --mode=link \
7510: ${CC} -o ${.TARGET:.a=.la} \
7511: ${OBJS:.o=.lo} \
7512: -rpath ${PREFIX}/lib \
7513: -version-info major:minor
1.222 sevan 7514: </pre>
1.75 rillig 7515: <p>Note that the library is changed to have a
1.87 wiz 7516: <code class="filename">.la</code> extension, and the objects are
7517: changed to have a <code class="filename">.lo</code>
7518: extension. Change <code class="varname">OBJS</code> as
7519: necessary. This automatically creates all of the
7520: <code class="filename">.a</code>,
7521: <code class="filename">.so.major.minor</code>, and ELF symlinks (if
7522: necessary) in the build directory. Be sure to include
1.128 wiz 7523: <span class="quote">“<span class="quote">-version-info</span>”</span>, especially when major and
1.87 wiz 7524: minor are zero, as libtool will otherwise strip off the
7525: shared library version.</p>
1.75 rillig 7526: <p>From the libtool manual:</p>
7527: <pre class="programlisting">
1.100 rillig 7528: So, libtool library versions are described by three integers:
1.69 rillig 7529:
1.100 rillig 7530: CURRENT
7531: The most recent interface number that this library implements.
1.69 rillig 7532:
1.100 rillig 7533: REVISION
7534: The implementation number of the CURRENT interface.
1.69 rillig 7535:
1.100 rillig 7536: AGE
7537: The difference between the newest and oldest interfaces that
7538: this library implements. In other words, the library implements
7539: all the interface numbers in the range from number `CURRENT -
7540: AGE' to `CURRENT'.
1.1 grant 7541:
1.100 rillig 7542: If two libraries have identical CURRENT and AGE numbers, then the
7543: dynamic linker chooses the library with the greater REVISION number.
1.222 sevan 7544: </pre>
1.128 wiz 7545: <p>The <span class="quote">“<span class="quote">-release</span>”</span> option will produce
1.87 wiz 7546: different results for a.out and ELF (excluding symlinks)
7547: in only one case. An ELF library of the form
1.128 wiz 7548: <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 7549: will have a symlink of
1.128 wiz 7550: <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 7551: on an a.out platform. This is handled
7552: automatically.</p>
1.128 wiz 7553: <p>The <span class="quote">“<span class="quote">-rpath argument</span>”</span> is the install
1.87 wiz 7554: directory of the library being built.</p>
1.76 rillig 7555: <p>In the <code class="filename">PLIST</code>, include only the
1.87 wiz 7556: <code class="filename">.la</code> file, the other files will be
7557: added automatically.</p>
1.75 rillig 7558: </li>
1.128 wiz 7559: <li class="listitem">
1.76 rillig 7560: <p>When linking shared object (<code class="filename">.so</code>)
1.257 leot 7561: 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.0"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT
1.128 wiz 7562: shared libraries, use <span class="quote">“<span class="quote">-module
7563: -avoid-version</span>”</span> to prevent them getting version
1.87 wiz 7564: tacked on.</p>
1.76 rillig 7565: <p>The <code class="filename">PLIST</code> file gets the
1.87 wiz 7566: <code class="filename">foo.so</code> entry.</p>
1.75 rillig 7567: </li>
1.128 wiz 7568: <li class="listitem">
1.75 rillig 7569: <p>When linking programs that depend on these libraries
1.87 wiz 7570: <span class="emphasis"><em>before</em></span> they are installed, preface
1.257 leot 7571: the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cc+1.i386+NetBSD-8.0"><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.0"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">“<span class="quote">${LIBTOOL}
1.128 wiz 7572: --mode=link</span>”</span>, and it will find the correct
1.87 wiz 7573: libraries (static or shared), but please be aware that
7574: libtool will not allow you to specify a relative path in
1.128 wiz 7575: -L (such as <span class="quote">“<span class="quote">-L../somelib</span>”</span>), because it
1.87 wiz 7576: expects you to change that argument to be the
7577: <code class="filename">.la</code> file. e.g.</p>
1.75 rillig 7578: <pre class="programlisting">
1.100 rillig 7579: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.222 sevan 7580: </pre>
1.75 rillig 7581: <p>should be changed to:</p>
7582: <pre class="programlisting">
1.100 rillig 7583: ${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
1.222 sevan 7584: </pre>
1.75 rillig 7585: <p>and it will do the right thing with the libraries.</p>
7586: </li>
1.128 wiz 7587: <li class="listitem">
1.257 leot 7588: <p>When installing libraries, preface the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a>
7589: or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cp+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">“<span class="quote">${LIBTOOL}
1.128 wiz 7590: --mode=install</span>”</span>, and change the library name to
1.87 wiz 7591: <code class="filename">.la</code>. e.g.</p>
1.75 rillig 7592: <pre class="programlisting">
1.126 jakllsch 7593: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.222 sevan 7594: </pre>
1.76 rillig 7595: <p>This will install the static <code class="filename">.a</code>,
1.87 wiz 7596: shared library, any needed symlinks, and run
1.257 leot 7597: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p>
1.75 rillig 7598: </li>
1.128 wiz 7599: <li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
1.87 wiz 7600: the <code class="filename">.la</code>
7601: file (this is a change from previous behaviour).</p></li>
1.75 rillig 7602: </ol></div>
7603: </div>
1.148 asau 7604: <div class="sect2">
1.75 rillig 7605: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7606: <a name="using-libtool"></a>21.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
1.75 rillig 7607: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
1.87 wiz 7608: package Makefile. This will override the package's own libtool
7609: in most cases. For older libtool using packages, libtool is
7610: made by ltconfig script during the do-configure step; you can
1.110 hubertf 7611: check the libtool script location by doing <span class="command"><strong>make
1.87 wiz 7612: configure; find work*/ -name libtool</strong></span>.</p>
1.75 rillig 7613: <p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
1.87 wiz 7614: scripts, relative to <code class="varname">WRKSRC</code>, to override. By
1.128 wiz 7615: default, it is set to <span class="quote">“<span class="quote">libtool */libtool
7616: */*/libtool</span>”</span>. If this does not match the location of the
1.87 wiz 7617: package's libtool script(s), set it as appropriate.</p>
1.76 rillig 7618: <p>If you do not need <code class="filename">*.a</code> static
1.87 wiz 7619: libraries built and installed, then use
7620: <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.75 rillig 7621: <p>If your package makes use of the platform-independent library
1.87 wiz 7622: for loading dynamic shared objects, that comes with libtool
7623: (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
7624: <p>Some packages use libtool incorrectly so that the package
7625: may not work or build in some circumstances. Some of the more
7626: common errors are:</p>
1.148 asau 7627: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7628: <li class="listitem">
1.75 rillig 7629: <p>The inclusion of a shared object (-module) as a dependent library in an
1.87 wiz 7630: executable or library. This in itself isn't a problem if one of two things
7631: has been done:</p>
1.128 wiz 7632: <div class="orderedlist"><ol class="orderedlist" type="1">
7633: <li class="listitem"><p>The shared object is named correctly, i.e.
1.87 wiz 7634: <code class="filename">libfoo.la</code>, not
7635: <code class="filename">foo.la</code></p></li>
1.128 wiz 7636: <li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
1.75 rillig 7637: </ol></div>
7638: </li>
1.128 wiz 7639: <li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
1.87 wiz 7640: The function lt_dlinit() should be called and the macro
7641: <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
7642: executables.</p></li>
1.75 rillig 7643: </ul></div>
7644: </div>
1.148 asau 7645: <div class="sect2">
1.75 rillig 7646: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7647: <a name="autoconf-automake"></a>21.3.3. GNU Autoconf/Automake</h3></div></div></div>
1.75 rillig 7648: <p>If a package needs GNU autoconf or automake to be executed
1.87 wiz 7649: to regenerate the configure script and Makefile.in makefile
7650: templates, then they should be executed in a pre-configure
7651: target.</p>
1.75 rillig 7652: <p>For packages that need only autoconf:</p>
7653: <pre class="programlisting">
1.100 rillig 7654: AUTOCONF_REQD= 2.50 # if default version is not good enough
7655: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
7656: ...
1.1 grant 7657:
1.100 rillig 7658: pre-configure:
7659: cd ${WRKSRC} && autoconf
1.1 grant 7660:
1.100 rillig 7661: ...
1.222 sevan 7662: </pre>
1.75 rillig 7663: <p>and for packages that need automake and autoconf:</p>
7664: <pre class="programlisting">
1.100 rillig 7665: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
7666: USE_TOOLS+= automake # use "automake14" for automake-1.4
7667: ...
7668:
7669: pre-configure:
7670: set -e; cd ${WRKSRC}; \
7671: aclocal; autoheader; automake -a --foreign -i; autoconf
1.1 grant 7672:
1.100 rillig 7673: ...
1.222 sevan 7674: </pre>
1.75 rillig 7675: <p>Packages which use GNU Automake will almost certainly
1.87 wiz 7676: require GNU Make.</p>
1.75 rillig 7677: <p>There are times when the configure process makes
1.87 wiz 7678: additional changes to the generated files, which then causes
7679: the build process to try to re-execute the automake sequence.
7680: This is prevented by touching various files in the configure
7681: stage. If this causes problems with your package you can set
7682: <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
7683: Makefile.</p>
1.75 rillig 7684: </div>
7685: </div>
1.148 asau 7686: <div class="sect1">
1.75 rillig 7687: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 7688: <a name="programming-languages"></a>21.4. Programming languages</h2></div></div></div>
1.148 asau 7689: <div class="sect2">
1.87 wiz 7690: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7691: <a name="basic-programming-languages"></a>21.4.1. C, C++, and Fortran</h3></div></div></div>
1.87 wiz 7692: <p>Compilers for the C, C++, and Fortran languages comes with
7693: the NetBSD base system. By default, pkgsrc assumes that a package
7694: is written in C and will hide all other compilers (via the wrapper
1.267 ! rillig 7695: framework, see <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a>).</p>
1.87 wiz 7696: <p>To declare which language's compiler a package needs, set
7697: the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
1.128 wiz 7698: currently are <span class="quote">“<span class="quote">c</span>”</span>, <span class="quote">“<span class="quote">c++</span>”</span>, and
7699: <span class="quote">“<span class="quote">fortran</span>”</span> (and any combination). The default is
7700: <span class="quote">“<span class="quote">c</span>”</span>. Packages using GNU configure scripts, even if
1.87 wiz 7701: written in C++, usually need a C compiler for the configure
7702: phase.</p>
7703: </div>
1.148 asau 7704: <div class="sect2">
1.87 wiz 7705: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7706: <a name="java-programming-language"></a>21.4.2. Java</h3></div></div></div>
1.87 wiz 7707: <p>If a program is written in Java, use the Java framework in
7708: pkgsrc. The package must include
7709: <code class="filename">../../mk/java-vm.mk</code>. This Makefile fragment
7710: provides the following variables:</p>
1.148 asau 7711: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7712: <li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
1.87 wiz 7713: dependency on the JDK is added. If
1.128 wiz 7714: <code class="varname">USE_JAVA</code> is set to <span class="quote">“<span class="quote">run</span>”</span>, then
1.87 wiz 7715: there is only a runtime dependency on the JDK. The default is
1.128 wiz 7716: <span class="quote">“<span class="quote">yes</span>”</span>, which also adds a build dependency on the
1.87 wiz 7717: JDK.</p></li>
1.128 wiz 7718: <li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
1.87 wiz 7719: a package needs a Java2 implementation. The supported values
1.128 wiz 7720: are <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">1.4</span>”</span>, and
7721: <span class="quote">“<span class="quote">1.5</span>”</span>. <span class="quote">“<span class="quote">yes</span>”</span> accepts any Java2
7722: implementation, <span class="quote">“<span class="quote">1.4</span>”</span> insists on versions 1.4 or
7723: above, and <span class="quote">“<span class="quote">1.5</span>”</span> only accepts versions 1.5 or
1.87 wiz 7724: above. This variable is not set by default.</p></li>
1.130 wiz 7725: <li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
7726: automatically set to the runtime location of the used Java
7727: implementation dependency. It may be used to set
7728: <code class="varname">JAVA_HOME</code> to a good value if the program
7729: needs this variable to be defined.
7730: </p></li>
1.87 wiz 7731: </ul></div>
7732: </div>
1.148 asau 7733: <div class="sect2">
1.87 wiz 7734: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7735: <a name="perl-scripts"></a>21.4.3. Packages containing perl scripts</h3></div></div></div>
1.87 wiz 7736: <p>If your package contains interpreted perl scripts, add
1.128 wiz 7737: <span class="quote">“<span class="quote">perl</span>”</span> to the <code class="varname">USE_TOOLS</code> variable
1.87 wiz 7738: and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
7739: interpreter path is set. <code class="varname">REPLACE_PERL</code> should
7740: contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
1.183 wiz 7741: that you want adjusted. Every occurrence of
7742: <code class="filename">*/bin/perl</code> in a she-bang line will be
7743: replaced with the full path to the perl executable.</p>
1.87 wiz 7744: <p>If a particular version of perl is needed, set the
7745: <code class="varname">PERL5_REQD</code> variable to the version number. The
1.128 wiz 7746: default is <span class="quote">“<span class="quote">5.0</span>”</span>.</p>
1.267 ! rillig 7747: <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 7748: about handling perl modules.</p>
7749: </div>
1.148 asau 7750: <div class="sect2">
1.87 wiz 7751: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7752: <a name="shell-scripts"></a>21.4.4. Packages containing shell scripts</h3></div></div></div>
1.147 wiz 7753: <p><code class="varname">REPLACE_SH</code>,
7754: <code class="varname">REPLACE_BASH</code>, <code class="varname">REPLACE_CSH</code>,
7755: and <code class="varname">REPLACE_KSH</code> can be used to replace shell
7756: hash bangs in files. Please use the appropriate one, prefering
7757: <code class="varname">REPLACE_SH</code> in case this shell is sufficient.
1.183 wiz 7758: Each should contain a list of scripts, relative to
7759: <code class="varname">WRKSRC</code>, that you want adjusted. Every
7760: occurrence of the matching shell in a she-bang line will be
7761: replaced with the full path to the shell executable.
1.147 wiz 7762: When using <code class="varname">REPLACE_BASH</code>, don't forget to add
7763: <code class="filename">bash</code> to <code class="varname">USE_TOOLS</code>.</p>
7764: </div>
1.148 asau 7765: <div class="sect2">
1.147 wiz 7766: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7767: <a name="other-programming-languages"></a>21.4.5. Other programming languages</h3></div></div></div>
1.87 wiz 7768: <p>Currently, there is no special handling for other languages
7769: in pkgsrc. If a compiler package provides a
7770: <code class="filename">buildlink3.mk</code> file, include that, otherwise
7771: just add a (build) dependency on the appropriate compiler
7772: package.</p>
7773: </div>
7774: </div>
1.148 asau 7775: <div class="sect1">
1.87 wiz 7776: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 7777: <a name="fixes.build"></a>21.5. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.77 rillig 7778: <p>The most common failures when building a package are that
7779: some platforms do not provide certain header files, functions or
7780: libraries, or they provide the functions in a library that the
7781: original package author didn't know. To work around this, you
7782: can rewrite the source code in most cases so that it does not
7783: use the missing functions or provides a replacement function.</p>
1.148 asau 7784: <div class="sect2">
1.77 rillig 7785: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7786: <a name="fixes.build.cpp"></a>21.5.1. Compiling C and C++ code conditionally</h3></div></div></div>
1.77 rillig 7787: <p>If a package already comes with a GNU configure script, the
7788: preferred way to fix the build failure is to change the
7789: configure script, not the code. In the other cases, you can
7790: utilize the C preprocessor, which defines certain macros
7791: depending on the operating system and hardware architecture it
7792: compiles for. These macros can be queried using for example
7793: <code class="varname">#if defined(__i386)</code>. Almost every operating
7794: system, hardware architecture and compiler has its own macro.
7795: For example, if the macros <code class="varname">__GNUC__</code>,
7796: <code class="varname">__i386__</code> and <code class="varname">__NetBSD__</code>
7797: are all defined, you know that you are using NetBSD on an i386
7798: compatible CPU, and your compiler is GCC.</p>
7799: <p>The list of the following macros for hardware and
7800: operating system depends on the compiler that is used. For
7801: example, if you want to conditionally compile code on Solaris,
7802: don't use <code class="varname">__sun__</code>, as the SunPro compiler
7803: does not define it. Use <code class="varname">__sun</code> instead.</p>
1.148 asau 7804: <div class="sect3">
1.75 rillig 7805: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7806: <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 7807: <p>To distinguish between 4.4 BSD-derived systems and the
7808: rest of the world, you should use the following code.</p>
7809: <pre class="programlisting">
1.100 rillig 7810: #include <sys/param.h>
7811: #if (defined(BSD) && BSD >= 199306)
7812: /* BSD-specific code goes here */
7813: #else
7814: /* non-BSD-specific code goes here */
7815: #endif
1.75 rillig 7816: </pre>
1.77 rillig 7817: <p>If this distinction is not fine enough, you can also test
7818: for the following macros.</p>
1.75 rillig 7819: <pre class="programlisting">
1.151 obache 7820: Cygwin __CYGWIN__
7821: DragonFly __DragonFly__
1.100 rillig 7822: FreeBSD __FreeBSD__
1.151 obache 7823: Haiku __HAIKU__
1.100 rillig 7824: Interix __INTERIX
7825: IRIX __sgi (TODO: get a definite source for this)
7826: Linux linux, __linux, __linux__
1.193 dholland 7827: Mac OS X __APPLE__
1.151 obache 7828: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7829: Minix3 __minix
1.100 rillig 7830: NetBSD __NetBSD__
7831: OpenBSD __OpenBSD__
7832: Solaris sun, __sun
1.75 rillig 7833: </pre>
7834: </div>
1.148 asau 7835: <div class="sect3">
1.75 rillig 7836: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7837: <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 7838: <pre class="programlisting">
1.100 rillig 7839: i386 i386, __i386, __i386__
7840: MIPS __mips
7841: SPARC sparc, __sparc
1.75 rillig 7842: </pre>
7843: </div>
1.148 asau 7844: <div class="sect3">
1.75 rillig 7845: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7846: <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 7847: <pre class="programlisting">
1.100 rillig 7848: GCC __GNUC__ (major version), __GNUC_MINOR__
7849: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7850: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7851: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
1.75 rillig 7852: </pre>
7853: </div>
7854: </div>
1.148 asau 7855: <div class="sect2">
1.78 rillig 7856: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7857: <a name="compiler-bugs"></a>21.5.2. How to handle compiler bugs</h3></div></div></div>
1.78 rillig 7858: <p>Some source files trigger bugs in the compiler, based on
1.87 wiz 7859: combinations of compiler version and architecture and almost
7860: always relation to optimisation being enabled. Common symptoms
7861: are gcc internal errors or never finishing compiling a
1.78 rillig 7862: file.</p>
7863: <p>Typically, a workaround involves testing the
7864: <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
7865: optimisation for that combination of file,
1.198 tnn 7866: <code class="varname">MACHINE_ARCH</code> and compiler.</p>
7867: <p>This used to be a big problem in the past, but is rarely
7868: needed now as compiler technology has matured. If you still need
7869: to add a compiler specific workaround, please do so in the file
7870: <code class="filename">hacks.mk</code> and describe the symptom and
7871: compiler version as detailed as possible.</p>
1.78 rillig 7872: </div>
1.148 asau 7873: <div class="sect2">
1.78 rillig 7874: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7875: <a name="undefined-reference"></a>21.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span>
1.128 wiz 7876: </h3></div></div></div>
1.92 rillig 7877: <p>This error message often means that a package did not
1.78 rillig 7878: link to a shared library it needs. The following functions are
7879: known to cause this error message over and over.</p>
7880: <div class="informaltable">
1.216 tnn 7881: <a name="undefined-reference-functions"></a><table class="informaltable" border="1">
1.78 rillig 7882: <colgroup>
7883: <col>
7884: <col>
7885: <col>
7886: </colgroup>
7887: <thead><tr>
7888: <th>Function</th>
7889: <th>Library</th>
7890: <th>Affected platforms</th>
7891: </tr></thead>
7892: <tbody>
7893: <tr>
7894: <td>accept, bind, connect</td>
7895: <td>-lsocket</td>
7896: <td>Solaris</td>
7897: </tr>
7898: <tr>
7899: <td>crypt</td>
7900: <td>-lcrypt</td>
7901: <td>DragonFly, NetBSD</td>
7902: </tr>
7903: <tr>
7904: <td>dlopen, dlsym</td>
7905: <td>-ldl</td>
7906: <td>Linux</td>
7907: </tr>
7908: <tr>
7909: <td>gethost*</td>
7910: <td>-lnsl</td>
7911: <td>Solaris</td>
7912: </tr>
7913: <tr>
7914: <td>inet_aton</td>
7915: <td>-lresolv</td>
7916: <td>Solaris</td>
7917: </tr>
7918: <tr>
7919: <td>nanosleep, sem_*, timer_*</td>
7920: <td>-lrt</td>
7921: <td>Solaris</td>
7922: </tr>
7923: <tr>
7924: <td>openpty</td>
7925: <td>-lutil</td>
7926: <td>Linux</td>
7927: </tr>
7928: </tbody>
7929: </table>
7930: </div>
7931: <p>To fix these linker errors, it is often sufficient to say
1.87 wiz 7932: <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
7933: -l<em class="replaceable"><code>foo</code></em></code> to the package
1.110 hubertf 7934: <code class="filename">Makefile</code> and then say <span class="command"><strong>bmake clean;
1.87 wiz 7935: bmake</strong></span>.</p>
1.148 asau 7936: <div class="sect3">
1.92 rillig 7937: <div class="titlepage"><div><div><h4 class="title">
1.267 ! rillig 7938: <a name="undefined-reference-sunpro"></a>21.5.3.1. Special issue: The SunPro compiler</h4></div></div></div>
1.92 rillig 7939: <p>When you are using the SunPro compiler, there is another
7940: possibility. That compiler cannot handle the following code:</p>
7941: <pre class="programlisting">
1.100 rillig 7942: extern int extern_func(int);
1.93 rillig 7943:
1.100 rillig 7944: static inline int
7945: inline_func(int x)
7946: {
1.92 rillig 7947: return extern_func(x);
1.100 rillig 7948: }
1.93 rillig 7949:
1.100 rillig 7950: int main(void)
7951: {
1.92 rillig 7952: return 0;
1.100 rillig 7953: }
1.92 rillig 7954: </pre>
7955: <p>It generates the code for <code class="function">inline_func</code> even if
7956: that function is never used. This code then refers to
7957: <code class="function">extern_func</code>, which can usually not be resolved. To
7958: solve this problem you can try to tell the package to disable inlining
7959: of functions.</p>
7960: </div>
1.87 wiz 7961: </div>
1.148 asau 7962: <div class="sect2">
1.87 wiz 7963: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7964: <a name="out-of-memory"></a>21.5.4. Running out of memory</h3></div></div></div>
1.87 wiz 7965: <p>Sometimes packages fail to build because the compiler runs
7966: into an operating system specific soft limit. With the
7967: <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
1.204 wiz 7968: to unlimit the resources. Currently, the allowed values are any combination of
7969: <span class="quote">“<span class="quote">cputime</span>”</span>, <span class="quote">“<span class="quote">datasize</span>”</span>,
7970: <span class="quote">“<span class="quote">memorysize</span>”</span>, and <span class="quote">“<span class="quote">stacksize</span>”</span>.
1.87 wiz 7971: Setting this variable is similar to running the shell builtin
1.110 hubertf 7972: <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
1.87 wiz 7973: segment size or maximum stack size of a process, respectively, to
7974: their hard limits.</p>
1.78 rillig 7975: </div>
1.75 rillig 7976: </div>
1.148 asau 7977: <div class="sect1">
1.75 rillig 7978: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 7979: <a name="fixes.install"></a>21.6. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.148 asau 7980: <div class="sect2">
1.75 rillig 7981: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7982: <a name="install-scripts"></a>21.6.1. Creating needed directories</h3></div></div></div>
1.110 hubertf 7983: <p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
1.87 wiz 7984: with some operating systems cannot create more than one
7985: directory at a time. As such, you should call
7986: <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
7987: <pre class="programlisting">
1.100 rillig 7988: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7989: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.222 sevan 7990: </pre>
1.128 wiz 7991: <p>You can also just append <span class="quote">“<span class="quote"><code class="literal">dir1
7992: dir2</code></span>”</span> to the
1.87 wiz 7993: <code class="varname">INSTALLATION_DIRS</code> variable, which will
7994: automatically do the right thing.</p>
1.75 rillig 7995: </div>
1.148 asau 7996: <div class="sect2">
1.75 rillig 7997: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 7998: <a name="where-to-install-documentation"></a>21.6.2. Where to install documentation</h3></div></div></div>
1.83 wiz 7999: <p>In general, documentation should be installed into
1.87 wiz 8000: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8001: <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code> (the latter
8002: includes the version number of the package).</p>
1.84 wiz 8003: <p>Many modern packages using GNU autoconf allow to set the
1.87 wiz 8004: directory where HTML documentation is installed with the
1.128 wiz 8005: <span class="quote">“<span class="quote">--with-html-dir</span>”</span> option. Sometimes using this flag
1.87 wiz 8006: is needed because otherwise the documentation ends up in
8007: <code class="filename">${PREFIX}/share/doc/html</code> or other
8008: places.</p>
8009: <p>An exception to the above is that library API documentation
1.250 leot 8010: 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 8011: browsers (devhelp) should be left at their default location, which
8012: is <code class="filename">${PREFIX}/share/gtk-doc</code>. Such
8013: documentation can be recognized from files ending in
8014: <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
8015: (It is also acceptable to install such files in
8016: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8017: <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
8018: <code class="filename">.devhelp*</code> file must be directly in that
8019: directory then, no additional subdirectory level is allowed in
8020: this case. This is usually achieved by using
1.128 wiz 8021: <span class="quote">“<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>”</span>.
1.87 wiz 8022: <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
8023: though.)</p>
1.75 rillig 8024: </div>
1.148 asau 8025: <div class="sect2">
1.75 rillig 8026: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8027: <a name="installing-score-files"></a>21.6.3. Installing highscore files</h3></div></div></div>
1.75 rillig 8028: <p>Certain packages, most of them in the games category, install
1.87 wiz 8029: a score file that allows all users on the system to record their
8030: highscores. In order for this to work, the binaries need to be
8031: installed setgid and the score files owned by the appropriate
1.142 wiz 8032: group and/or owner (traditionally the "games" user/group). Set
8033: <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
1.87 wiz 8034: following variables, documented in more detail in
8035: <code class="filename">mk/defaults/mk.conf</code>, control this
1.142 wiz 8036: behaviour: <code class="varname">GAMEDATAMODE</code>,
8037: <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
1.210 leot 8038: <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.
8039: Other useful variables are: <code class="varname">GAMEDIR_PERMS</code>,
8040: <code class="varname">GAMEDATA_PERMS</code> and
8041: <code class="varname">SETGID_GAMES_PERMS</code>.</p>
8042: <p>An example that illustrates some of the variables described above is
8043: <code class="filename">games/moon-buggy</code>. <code class="varname">OWN_DIRS_PERMS</code> is
8044: used to properly set directory permissions of the directory where the
8045: scorefile is saved, <code class="varname">REQD_FILES_PERMS</code> is used to create a
8046: dummy scorefile (<code class="filename">mbscore</code>) with the proper permissions
8047: and <code class="varname">SPECIAL_PERMS</code> is used to install setgid the game
8048: binary:</p>
8049: <pre class="programlisting">
1.223 rillig 8050: USE_GAMESGROUP= yes
1.210 leot 8051:
1.223 rillig 8052: BUILD_DEFS+= VARBASE
1.210 leot 8053:
1.223 rillig 8054: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
8055: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
8056: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
1.222 sevan 8057: </pre>
1.210 leot 8058: <p>Various <code class="varname">INSTALL_*</code> variables are also available:
8059: <code class="varname">INSTALL_GAME</code> to install setgid game binaries,
8060: <code class="varname">INSTALL_GAME_DIR</code> to install game directories that are
8061: needed to be accessed by setgid games and
8062: <code class="varname">INSTALL_GAME_DATA</code> to install scorefiles.</p>
1.114 jmcneill 8063: <p>A package should therefore never hard code file ownership or
1.210 leot 8064: access permissions but rely on <code class="varname">*_PERMS</code> as described above
8065: or alternatively on <code class="varname">INSTALL_GAME</code>,
8066: <code class="varname">INSTALL_GAME_DATA</code> and
8067: <code class="varname">INSTALL_GAME_DIR</code> to set these correctly.</p>
1.75 rillig 8068: </div>
1.148 asau 8069: <div class="sect2">
1.75 rillig 8070: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8071: <a name="destdir-support"></a>21.6.4. Adding DESTDIR support to packages</h3></div></div></div>
1.114 jmcneill 8072: <p><code class="varname">DESTDIR</code> support means that a package
8073: installs into a staging directory, not the final location of the
8074: files. Then a binary package is created which can be used for
8075: installation as usual. There are two ways: Either the package must
1.128 wiz 8076: install as root (<span class="quote">“<span class="quote">destdir</span>”</span>) or the package can
8077: install as non-root user (<span class="quote">“<span class="quote">user-destdir</span>”</span>).</p>
1.148 asau 8078: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8079: <li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
1.224 leot 8080: set to <span class="quote">“<span class="quote">destdir</span>”</span> or <span class="quote">“<span class="quote">user-destdir</span>”</span>.
8081: By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
1.145 wiz 8082: is set to <span class="quote">“<span class="quote">user-destdir</span>”</span> to help catching more
8083: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
1.114 jmcneill 8084: <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
8085: the inclusion.</p></li>
1.128 wiz 8086: <li class="listitem"><p>All installation operations have to be prefixed with
1.103 wiz 8087: <code class="filename">${DESTDIR}</code>.</p></li>
1.128 wiz 8088: <li class="listitem"><p>automake gets this DESTDIR mostly right
1.103 wiz 8089: automatically. Many manual rules and pre/post-install often are
8090: incorrect; fix them.</p></li>
1.128 wiz 8091: <li class="listitem"><p>If files are installed with special owner/group
1.118 imil 8092: use <code class="varname">SPECIAL_PERMS</code>.</p></li>
1.128 wiz 8093: <li class="listitem"><p>In general, packages should support
1.103 wiz 8094: <code class="varname">UNPRIVILEGED</code> to be able to use
8095: DESTDIR.</p></li>
8096: </ul></div>
8097: </div>
1.148 asau 8098: <div class="sect2">
1.103 wiz 8099: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8100: <a name="hardcoded-paths"></a>21.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
1.87 wiz 8101: <p>Your package may also contain scripts with hardcoded paths to
8102: other interpreters besides (or as well as) perl. To correct the
8103: full pathname to the script interpreter, you need to set the
8104: following definitions in your <code class="filename">Makefile</code> (we
1.110 hubertf 8105: shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
1.87 wiz 8106: <pre class="programlisting">
1.100 rillig 8107: REPLACE_INTERPRETER+= tcl
8108: REPLACE.tcl.old= .*/bin/tclsh
8109: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
8110: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
8111: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.222 sevan 8112: </pre>
1.148 asau 8113: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8114: <h3 class="title">Note</h3>
8115: <p>Before March 2006, these variables were called
1.87 wiz 8116: <code class="varname">_REPLACE.*</code> and
8117: <code class="varname">_REPLACE_FILES.*</code>.</p>
1.75 rillig 8118: </div>
8119: </div>
1.148 asau 8120: <div class="sect2">
1.75 rillig 8121: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8122: <a name="perl-modules"></a>21.6.6. Packages installing perl modules</h3></div></div></div>
1.75 rillig 8123: <p>Makefiles of packages providing perl5 modules should include
1.87 wiz 8124: the Makefile fragment
8125: <code class="filename">../../lang/perl5/module.mk</code>. It provides a
1.110 hubertf 8126: <span class="command"><strong>do-configure</strong></span> target for the standard perl
1.87 wiz 8127: configuration for such modules as well as various hooks to tune
8128: this configuration. See comments in this file for
8129: details.</p>
1.75 rillig 8130: <p>Perl5 modules will install into different places depending
1.87 wiz 8131: on the version of perl used during the build process. To
8132: address this, pkgsrc will append lines to the
8133: <code class="filename">PLIST</code> corresponding to the files listed in
8134: the installed <code class="filename">.packlist</code> file generated by
8135: most perl5 modules. This is invoked by defining
8136: <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
1.153 wiz 8137: packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
8138: (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
8139: e.g.:</p>
1.75 rillig 8140: <pre class="programlisting">
1.153 wiz 8141: PERL5_PACKLIST= auto/Pg/.packlist
1.222 sevan 8142: </pre>
1.153 wiz 8143: <p>The perl5 config variables
8144: <code class="varname">installarchlib</code>,
8145: <code class="varname">installscript</code>,
8146: <code class="varname">installvendorbin</code>,
8147: <code class="varname">installvendorscript</code>,
8148: <code class="varname">installvendorarch</code>,
8149: <code class="varname">installvendorlib</code>,
8150: <code class="varname">installvendorman1dir</code>, and
8151: <code class="varname">installvendorman3dir</code> represent those
8152: locations in which components of perl5 modules may be installed,
8153: provided as variable with uppercase and prefixed with
8154: <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
8155: and may be used by perl5 packages that don't have a packlist.
8156: These variables are also substituted for in the
8157: <code class="filename">PLIST</code> as uppercase prefixed with
8158: <code class="varname">PERL5_SUB_</code>.</p>
1.75 rillig 8159: </div>
1.148 asau 8160: <div class="sect2">
1.75 rillig 8161: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8162: <a name="faq.info-files"></a>21.6.7. Packages installing info files</h3></div></div></div>
1.75 rillig 8163: <p>Some packages install info files or use the
1.128 wiz 8164: <span class="quote">“<span class="quote">makeinfo</span>”</span> or <span class="quote">“<span class="quote">install-info</span>”</span>
1.87 wiz 8165: commands. <code class="varname">INFO_FILES</code> should be defined in
8166: the package Makefile so that <code class="filename">INSTALL</code> and
8167: <code class="filename">DEINSTALL</code> scripts will be generated to
8168: handle registration of the info files in the Info directory
1.128 wiz 8169: file. The <span class="quote">“<span class="quote">install-info</span>”</span> command used for the info
1.87 wiz 8170: files registration is either provided by the system, or by a
8171: special purpose package automatically added as dependency if
8172: needed.</p>
1.75 rillig 8173: <p><code class="varname">PKGINFODIR</code> is the directory under
1.87 wiz 8174: <code class="filename">${PREFIX}</code> where info files are primarily
8175: located. <code class="varname">PKGINFODIR</code> defaults to
1.128 wiz 8176: <span class="quote">“<span class="quote">info</span>”</span> and can be overridden by the user.</p>
1.75 rillig 8177: <p>The info files for the package should be listed in the
1.87 wiz 8178: package <code class="filename">PLIST</code>; however any split info files
8179: need not be listed.</p>
1.128 wiz 8180: <p>A package which needs the <span class="quote">“<span class="quote">makeinfo</span>”</span> command
8181: at build time must add <span class="quote">“<span class="quote">makeinfo</span>”</span> to
1.87 wiz 8182: <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
1.128 wiz 8183: version of the <span class="quote">“<span class="quote">makeinfo</span>”</span> command is needed it
1.87 wiz 8184: should be noted with the <code class="varname">TEXINFO_REQD</code>
8185: variable in the package <code class="filename">Makefile</code>. By
8186: default, a minimum version of 3.12 is required. If the system
1.110 hubertf 8187: does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
1.87 wiz 8188: does not match the required minimum, a build dependency on the
1.250 leot 8189: <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 8190: be added automatically.</p>
1.75 rillig 8191: <p>The build and installation process of the software provided
1.87 wiz 8192: by the package should not use the
1.110 hubertf 8193: <span class="command"><strong>install-info</strong></span> command as the registration of
1.87 wiz 8194: info files is the task of the package
8195: <code class="filename">INSTALL</code> script, and it must use the
1.110 hubertf 8196: appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
1.75 rillig 8197: <p>To achieve this goal, the pkgsrc infrastructure creates
1.110 hubertf 8198: overriding scripts for the <span class="command"><strong>install-info</strong></span> and
8199: <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
1.87 wiz 8200: in <code class="varname">PATH</code>.</p>
1.110 hubertf 8201: <p>The script overriding <span class="command"><strong>install-info</strong></span> has
1.87 wiz 8202: no effect except the logging of a message. The script overriding
1.110 hubertf 8203: <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
1.87 wiz 8204: value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
1.110 hubertf 8205: <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
1.75 rillig 8206: </div>
1.148 asau 8207: <div class="sect2">
1.75 rillig 8208: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8209: <a name="manpages"></a>21.6.8. Packages installing man pages</h3></div></div></div>
1.81 rillig 8210: <p>All packages that install manual pages should install them
1.87 wiz 8211: into the same directory, so that there is one common place to look
8212: for them. In pkgsrc, this place is
8213: <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
8214: should be used in packages. The default for
8215: <code class="varname">PKGMANDIR</code> is
1.128 wiz 8216: <span class="quote">“<span class="quote"><code class="filename">man</code></span>”</span>. Another often-used value
8217: is <span class="quote">“<span class="quote"><code class="filename">share/man</code></span>”</span>.</p>
1.148 asau 8218: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8219: <h3 class="title">Note</h3>
1.87 wiz 8220: <p>The support for a custom <code class="varname">PKGMANDIR</code>
8221: is far from complete.</p>
1.75 rillig 8222: </div>
1.81 rillig 8223: <p>The <code class="filename">PLIST</code> files can just use
1.87 wiz 8224: <code class="filename">man/</code> as the top level directory for the man
8225: page file entries, and the pkgsrc framework will convert as
8226: needed. In all other places, the correct
8227: <code class="varname">PKGMANDIR</code> must be used.</p>
8228: <p>Packages that are
8229: configured with <code class="varname">GNU_CONFIGURE</code> set as
1.128 wiz 8230: <span class="quote">“<span class="quote">yes</span>”</span>, by default will use the
1.87 wiz 8231: <code class="filename">./configure</code>
8232: --mandir switch to set where the man pages should be installed.
8233: The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
8234: to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
8235: <p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
8236: use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
1.128 wiz 8237: to <span class="quote">“<span class="quote">no</span>”</span>.
1.87 wiz 8238: Or if the <code class="filename">./configure</code> script uses
8239: a non-standard use of --mandir, you can set
8240: <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
1.267 ! rillig 8241: <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 8242: information on installation of compressed manual pages.</p>
1.75 rillig 8243: </div>
1.148 asau 8244: <div class="sect2">
1.75 rillig 8245: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8246: <a name="gconf-data-files"></a>21.6.9. Packages installing GConf data files</h3></div></div></div>
1.87 wiz 8247: <p>If a package installs <code class="filename">.schemas</code> or
1.107 rillig 8248: <code class="filename">.entries</code> files, used by GConf,
1.87 wiz 8249: you need to take some extra steps to make sure they get registered
8250: in the database:</p>
1.128 wiz 8251: <div class="orderedlist"><ol class="orderedlist" type="1">
8252: <li class="listitem"><p>Include <code class="filename">../../devel/GConf/schemas.mk</code>
1.87 wiz 8253: instead of its <code class="filename">buildlink3.mk</code> file. This
1.107 rillig 8254: takes care of rebuilding the GConf database at installation and
1.87 wiz 8255: deinstallation time, and tells the package where to install
1.107 rillig 8256: GConf data files using some standard configure arguments. It
1.87 wiz 8257: also disallows any access to the database directly from the
8258: package.</p></li>
1.128 wiz 8259: <li class="listitem"><p>Ensure that the package installs its
1.87 wiz 8260: <code class="filename">.schemas</code> files under
8261: <code class="filename">${PREFIX}/share/gconf/schemas</code>. If they get
8262: installed under <code class="filename">${PREFIX}/etc</code>, you will
8263: need to manually patch the package.</p></li>
1.128 wiz 8264: <li class="listitem"><p>Check the PLIST and remove any entries under the etc/gconf
1.87 wiz 8265: directory, as they will be handled automatically. See
1.267 ! rillig 8266: <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 8267: <li class="listitem"><p>Define the <code class="varname">GCONF_SCHEMAS</code> variable in
1.87 wiz 8268: your <code class="filename">Makefile</code> with a list of all
8269: <code class="filename">.schemas</code> files installed by the package, if
8270: any. Names must not contain any directories in them.</p></li>
1.128 wiz 8271: <li class="listitem"><p>Define the <code class="varname">GCONF_ENTRIES</code> variable in
1.87 wiz 8272: your <code class="filename">Makefile</code> with a
8273: list of all <code class="filename">.entries</code> files installed by the
8274: package, if any. Names must not contain any directories in
8275: them.</p></li>
1.75 rillig 8276: </ol></div>
8277: </div>
1.148 asau 8278: <div class="sect2">
1.75 rillig 8279: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8280: <a name="scrollkeeper-data-files"></a>21.6.10. Packages installing scrollkeeper/rarian data files</h3></div></div></div>
1.87 wiz 8281: <p>If a package installs <code class="filename">.omf</code> files, used by
1.119 mishka 8282: scrollkeeper/rarian, you need to take some extra steps to make sure they
1.87 wiz 8283: get registered in the database:</p>
1.128 wiz 8284: <div class="orderedlist"><ol class="orderedlist" type="1">
8285: <li class="listitem"><p>Include
1.119 mishka 8286: <code class="filename">../../mk/omf-scrollkeeper.mk</code>
8287: instead of rarian's <code class="filename">buildlink3.mk</code> file. This
1.87 wiz 8288: takes care of rebuilding the scrollkeeper database at
8289: installation and deinstallation time, and disallows any access
8290: to it directly from the package.</p></li>
1.128 wiz 8291: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87 wiz 8292: <code class="filename">libdata/scrollkeeper</code> directory, as they
8293: will be handled automatically.</p></li>
1.128 wiz 8294: <li class="listitem"><p>Remove the <code class="filename">share/omf</code> directory from
1.119 mishka 8295: the PLIST. It will be handled by rarian. (<span class="command"><strong>make
8296: print-PLIST</strong></span> does this automatically.)</p></li>
1.75 rillig 8297: </ol></div>
8298: </div>
1.148 asau 8299: <div class="sect2">
1.75 rillig 8300: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8301: <a name="x11-fonts"></a>21.6.11. Packages installing X11 fonts</h3></div></div></div>
1.75 rillig 8302: <p>If a package installs font files, you will need to rebuild
1.87 wiz 8303: the fonts database in the directory where they get installed at
8304: installation and deinstallation time. This can be automatically
8305: done by using the pkginstall framework.</p>
1.75 rillig 8306: <p>You can list the directories where fonts are installed in the
1.87 wiz 8307: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
8308: variables, where <em class="replaceable"><code>type</code></em> can be one of
1.128 wiz 8309: <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 8310: Also make sure that the database file
8311: <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
1.75 rillig 8312: <p>Note that you should not create new directories for fonts;
1.87 wiz 8313: instead use the standard ones to avoid that the user needs to
8314: manually configure his X server to find them.</p>
1.75 rillig 8315: </div>
1.148 asau 8316: <div class="sect2">
1.75 rillig 8317: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8318: <a name="gtk2-modules"></a>21.6.12. Packages installing GTK2 modules</h3></div></div></div>
1.75 rillig 8319: <p>If a package installs GTK2 immodules or loaders, you need to
1.87 wiz 8320: take some extra steps to get them registered in the GTK2 database
8321: properly:</p>
1.128 wiz 8322: <div class="orderedlist"><ol class="orderedlist" type="1">
8323: <li class="listitem"><p>Include
1.87 wiz 8324: <code class="filename">../../x11/gtk2/modules.mk</code> instead of its
8325: <code class="filename">buildlink3.mk</code> file. This takes care of
8326: rebuilding the database at installation and deinstallation time.</p></li>
1.128 wiz 8327: <li class="listitem"><p>Set <code class="varname">GTK2_IMMODULES=YES</code> if
1.87 wiz 8328: your package installs GTK2 immodules.</p></li>
1.128 wiz 8329: <li class="listitem"><p>Set <code class="varname">GTK2_LOADERS=YES</code> if your package installs
1.87 wiz 8330: GTK2 loaders.</p></li>
1.128 wiz 8331: <li class="listitem">
1.87 wiz 8332: <p>Patch the package to not touch any of the GTK2
8333: databases directly. These are:</p>
1.148 asau 8334: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8335: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p></li>
8336: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gtk.immodules</code></p></li>
1.75 rillig 8337: </ul></div>
8338: </li>
1.128 wiz 8339: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove
1.87 wiz 8340: any entries under the <code class="filename">libdata/gtk-2.0</code>
8341: directory, as they will be handled automatically.</p></li>
1.75 rillig 8342: </ol></div>
8343: </div>
1.148 asau 8344: <div class="sect2">
1.75 rillig 8345: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8346: <a name="sgml-xml-data"></a>21.6.13. Packages installing SGML or XML data</h3></div></div></div>
1.75 rillig 8347: <p>If a package installs SGML or XML data files that need to be
1.87 wiz 8348: registered in system-wide catalogs (like DTDs, sub-catalogs,
8349: etc.), you need to take some extra steps:</p>
1.128 wiz 8350: <div class="orderedlist"><ol class="orderedlist" type="1">
8351: <li class="listitem"><p>Include
1.87 wiz 8352: <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
8353: your <code class="filename">Makefile</code>, which takes care of
8354: registering those files in system-wide catalogs at
8355: installation and deinstallation time.</p></li>
1.128 wiz 8356: <li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
1.87 wiz 8357: any SGML catalogs installed by the package.</p></li>
1.128 wiz 8358: <li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
1.87 wiz 8359: any XML catalogs installed by the package.</p></li>
1.128 wiz 8360: <li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
1.87 wiz 8361: to be added to the SGML catalog. These come in groups of
8362: three strings; see xmlcatmgr(1) for more information
8363: (specifically, arguments recognized by the 'add' action).
8364: Note that you will normally not use this variable.</p></li>
1.128 wiz 8365: <li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
1.87 wiz 8366: to be added to the XML catalog. These come in groups of three
8367: strings; see xmlcatmgr(1) for more information (specifically,
8368: arguments recognized by the 'add' action). Note that you will
8369: normally not use this variable.</p></li>
1.75 rillig 8370: </ol></div>
8371: </div>
1.148 asau 8372: <div class="sect2">
1.75 rillig 8373: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8374: <a name="mime-database"></a>21.6.14. Packages installing extensions to the MIME database</h3></div></div></div>
1.75 rillig 8375: <p>If a package provides extensions to the MIME database by
1.87 wiz 8376: installing <code class="filename">.xml</code> files inside
8377: <code class="filename">${PREFIX}/share/mime/packages</code>, you
8378: need to take some extra steps to ensure that the database is kept
8379: consistent with respect to these new files:</p>
1.128 wiz 8380: <div class="orderedlist"><ol class="orderedlist" type="1">
8381: <li class="listitem"><p>Include
1.87 wiz 8382: <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
8383: (avoid using the <code class="filename">buildlink3.mk</code> file from
8384: this same directory, which is reserved for inclusion from
8385: other <code class="filename">buildlink3.mk</code> files). It takes
8386: care of rebuilding the MIME database at installation and
8387: deinstallation time, and disallows any access to it directly
8388: from the package.</p></li>
1.128 wiz 8389: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87 wiz 8390: <code class="filename">share/mime</code> directory,
8391: <span class="emphasis"><em>except</em></span> for files saved under
8392: <code class="filename">share/mime/packages</code>. The former are
8393: handled automatically by
8394: the update-mime-database program, but the latter are
8395: package-dependent and must be removed by the package that
8396: installed them in the first place.</p></li>
1.128 wiz 8397: <li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
1.87 wiz 8398: from the PLIST. They will be handled by the shared-mime-info
8399: package.</p></li>
1.75 rillig 8400: </ol></div>
8401: </div>
1.148 asau 8402: <div class="sect2">
1.75 rillig 8403: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8404: <a name="intltool"></a>21.6.15. Packages using intltool</h3></div></div></div>
1.93 rillig 8405: <p>If a package uses intltool during its build, add
8406: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
1.87 wiz 8407: which forces it to use the intltool package provided by pkgsrc,
8408: instead of the one bundled with the distribution file.</p>
1.75 rillig 8409: <p>This tracks intltool's build-time dependencies and uses the
1.87 wiz 8410: latest available version; this way, the package benefits of any
8411: bug fixes that may have appeared since it was released.</p>
1.75 rillig 8412: </div>
1.148 asau 8413: <div class="sect2">
1.75 rillig 8414: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8415: <a name="startup-scripts"></a>21.6.16. Packages installing startup scripts</h3></div></div></div>
1.75 rillig 8416: <p>If a package contains a rc.d script, it won't be copied into
1.87 wiz 8417: the startup directory by default, but you can enable it, by adding
8418: the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
1.110 hubertf 8419: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
1.87 wiz 8420: into <code class="filename">/etc/rc.d</code> when a package is installed, and
8421: it will automatically remove the scripts when the package is
8422: deinstalled.</p>
1.75 rillig 8423: </div>
1.148 asau 8424: <div class="sect2">
1.75 rillig 8425: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8426: <a name="tex-packages"></a>21.6.17. Packages installing TeX modules</h3></div></div></div>
1.75 rillig 8427: <p>If a package installs TeX packages into the texmf tree,
1.87 wiz 8428: the <code class="filename">ls-R</code> database of the tree needs to be
8429: updated.</p>
1.148 asau 8430: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 8431: <h3 class="title">Note</h3>
1.125 wiz 8432: <p>Except the main TeX packages such as kpathsea,
1.87 wiz 8433: packages should install files
1.125 wiz 8434: into <code class="filename">${PREFIX}/share/texmf-dist</code>,
8435: not <code class="filename">${PREFIX}/share/texmf</code>.</p>
1.75 rillig 8436: </div>
1.128 wiz 8437: <div class="orderedlist"><ol class="orderedlist" type="1">
8438: <li class="listitem"><p>Include
1.125 wiz 8439: <code class="filename">../../print/kpathsea/texmf.mk</code>. This
1.87 wiz 8440: takes care of rebuilding the <code class="filename">ls-R</code>
8441: database at installation and deinstallation time.</p></li>
1.128 wiz 8442: <li class="listitem">
1.75 rillig 8443: <p>If your package installs files into a texmf
1.87 wiz 8444: tree other than the one
1.125 wiz 8445: at <code class="filename">${PREFIX}/share/texmf-dist</code>,
8446: set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
1.87 wiz 8447: trees that need database update.</p>
1.75 rillig 8448: <p>If your package also installs font map files that need
1.110 hubertf 8449: to be registered using <span class="command"><strong>updmap</strong></span>,
1.136 dholland 8450: include <code class="filename">../../print/tex-tetex/map.mk</code> and
1.125 wiz 8451: set <code class="varname">TEX_MAP_FILES</code> and/or
8452: <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
1.110 hubertf 8453: such font map files. Then <span class="command"><strong>updmap</strong></span> will
1.87 wiz 8454: be run automatically at installation/deinstallation to
8455: enable/disable font map files for TeX output
8456: drivers.</p>
1.75 rillig 8457: </li>
1.128 wiz 8458: <li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
1.87 wiz 8459: databases are included in <code class="filename">PLIST</code>, as
1.136 dholland 8460: they will be removed only by the kpathsea package.</p></li>
1.75 rillig 8461: </ol></div>
8462: </div>
1.148 asau 8463: <div class="sect2">
1.85 jmmv 8464: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8465: <a name="emulation-packages"></a>21.6.18. Packages supporting running binaries in
1.87 wiz 8466: emulation</h3></div></div></div>
8467: <p>There are some packages that provide libraries and
8468: executables for running binaries from a one operating system
8469: on a different one (if the latter supports it). One example
8470: is running Linux binaries on NetBSD.</p>
1.250 leot 8471: <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 8472: helps in extracting and packaging Linux rpm packages.</p>
8473: <p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
1.110 hubertf 8474: avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
1.87 wiz 8475: if all libraries for each installed executable can be found by
8476: the dynamic linker. Since the standard dynamic linker is run,
8477: this fails for emulation packages, because the libraries used
8478: by the emulation are not in the standard directories.</p>
8479: </div>
1.148 asau 8480: <div class="sect2">
1.87 wiz 8481: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8482: <a name="hicolor-theme"></a>21.6.19. Packages installing hicolor theme icons</h3></div></div></div>
1.85 jmmv 8483: <p>If a package installs images under the
1.87 wiz 8484: <code class="filename">share/icons/hicolor</code> and/or updates the
8485: <code class="filename">share/icons/hicolor/icon-theme.cache</code>
8486: database, you need to take some extra steps to make sure that the
8487: shared theme directory is handled appropriately and that the cache
8488: database is rebuilt:</p>
1.128 wiz 8489: <div class="orderedlist"><ol class="orderedlist" type="1">
8490: <li class="listitem"><p>Include
1.87 wiz 8491: <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
1.128 wiz 8492: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
1.87 wiz 8493: entry that refers to the theme cache.</p></li>
1.128 wiz 8494: <li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
1.85 jmmv 8495: directories from the <code class="filename">share/icons/hicolor</code>
8496: hierarchy because they will be handled automatically.</p></li>
8497: </ol></div>
8498: <p>The best way to verify that the PLIST is correct with
8499: respect to the last two points is to regenerate it using
1.110 hubertf 8500: <span class="command"><strong>make print-PLIST</strong></span>.</p>
1.85 jmmv 8501: </div>
1.148 asau 8502: <div class="sect2">
1.85 jmmv 8503: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 8504: <a name="desktop-files"></a>21.6.20. Packages installing desktop files</h3></div></div></div>
1.85 jmmv 8505: <p>If a package installs <code class="filename">.desktop</code> files
8506: under <code class="filename">share/applications</code> and these include
1.159 rodent 8507: MIME information (MimeType key), you need to take extra steps to
8508: ensure that they are registered into the MIME database:</p>
1.128 wiz 8509: <div class="orderedlist"><ol class="orderedlist" type="1">
8510: <li class="listitem"><p>Include
1.85 jmmv 8511: <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
1.128 wiz 8512: <li class="listitem"><p>Check the PLIST and remove the entry that refers to the
1.85 jmmv 8513: <code class="filename">share/applications/mimeinfo.cache</code> file.
8514: It will be handled automatically.</p></li>
8515: </ol></div>
8516: <p>The best way to verify that the PLIST is correct with
1.110 hubertf 8517: respect to the last point is to regenerate it using <span class="command"><strong>make
1.85 jmmv 8518: print-PLIST</strong></span>.</p>
1.75 rillig 8519: </div>
8520: </div>
1.148 asau 8521: <div class="sect1">
1.87 wiz 8522: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8523: <a name="punting"></a>21.7. Marking packages as having problems</h2></div></div></div>
1.87 wiz 8524: <p>In some cases one does not have the time to solve a problem
1.125 wiz 8525: immediately. In this case, one can plainly mark a package as broken. For
8526: this, one just sets the variable <code class="varname">BROKEN</code> to the
8527: reason why the package is broken (similar to the
8528: <code class="varname">RESTRICTED</code> variable). A user trying to build
8529: the package will immediately be shown this message, and the build
8530: will not be even tried.</p>
8531: <p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
1.87 wiz 8532: intervals.</p>
8533: </div>
1.75 rillig 8534: </div>
1.148 asau 8535: <div class="chapter">
1.75 rillig 8536: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 8537: <a name="debug"></a>Chapter 22. Debugging</h2></div></div></div>
1.88 wiz 8538: <p>To check out all the gotchas when building a package, here are
8539: the steps that I do in order to get a package working. Please note
8540: this is basically the same as what was explained in the previous
8541: sections, only with some debugging aids.</p>
1.148 asau 8542: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8543: <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>
8544: <li class="listitem">
1.250 leot 8545: <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 8546: create a directory for a new package, change into it, then run
1.110 hubertf 8547: <span class="command"><strong>url2pkg</strong></span>:</p>
1.75 rillig 8548: <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>
8549: <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>
8550: <code class="prompt">%</code> <strong class="userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong></pre>
8551: </li>
1.128 wiz 8552: <li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
8553: <li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li>
8554: <li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li>
8555: <li class="listitem"><p>Add any dependencies glimpsed from documentation and the
1.88 wiz 8556: configure step to the package's
8557: <code class="filename">Makefile</code>.</p></li>
1.128 wiz 8558: <li class="listitem">
1.75 rillig 8559: <p>Make the package compile, doing multiple rounds of</p>
8560: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
8561: <code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
8562: <code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong>
8563: <code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong>
8564: <code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
8565: <code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong>
8566: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre>
1.88 wiz 8567: <p>Doing this step as non-root user will ensure that no files
8568: are modified that shouldn't be, especially during the build
1.110 hubertf 8569: phase. <span class="command"><strong>mkpatches</strong></span>,
8570: <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are
1.250 leot 8571: 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 8572: package.</p>
1.75 rillig 8573: </li>
1.128 wiz 8574: <li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if
1.267 ! rillig 8575: 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 8576: <li class="listitem">
1.76 rillig 8577: <p>Generate a <code class="filename">PLIST</code>:</p>
1.75 rillig 8578: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
8579: <code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST >PLIST</code></strong>
8580: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong>
8581: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
8582: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre>
1.88 wiz 8583: <p>You usually need to be <code class="username">root</code> to do
8584: this. Look if there are any files left:</p>
1.75 rillig 8585: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
8586: <p>If this reveals any files that are missing in
1.88 wiz 8587: <code class="filename">PLIST</code>, add them.</p>
1.75 rillig 8588: </li>
1.128 wiz 8589: <li class="listitem">
1.88 wiz 8590: <p>Now that the <code class="filename">PLIST</code> is OK, install the
8591: package again and make a binary package:</p>
1.75 rillig 8592: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong>
8593: <code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre>
8594: </li>
1.128 wiz 8595: <li class="listitem">
1.75 rillig 8596: <p>Delete the installed package:</p>
1.88 wiz 8597: <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 8598: </li>
1.128 wiz 8599: <li class="listitem">
1.110 hubertf 8600: <p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span>
1.88 wiz 8601: command, which shouldn't find anything now:</p>
1.75 rillig 8602: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
8603: </li>
1.128 wiz 8604: <li class="listitem">
1.75 rillig 8605: <p>Reinstall the binary package:</p>
1.93 rillig 8606: <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 8607: </li>
1.128 wiz 8608: <li class="listitem"><p>Play with it. Make sure everything works.</p></li>
8609: <li class="listitem">
1.250 leot 8610: <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 8611: reports:</p>
1.75 rillig 8612: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
8613: </li>
1.267 ! rillig 8614: <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 8615: </ul></div>
8616: </div>
1.148 asau 8617: <div class="chapter">
1.75 rillig 8618: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 8619: <a name="submit"></a>Chapter 23. Submitting and Committing</h2></div></div></div>
1.75 rillig 8620: <div class="toc">
8621: <p><b>Table of Contents</b></p>
1.210 leot 8622: <dl class="toc">
1.267 ! rillig 8623: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
! 8624: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
! 8625: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
! 8626: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
! 8627: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
! 8628: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
! 8629: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
! 8630: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
1.75 rillig 8631: </dl>
8632: </div>
1.148 asau 8633: <div class="sect1">
1.75 rillig 8634: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8635: <a name="submitting-binary-packages"></a>23.1. Submitting binary packages</h2></div></div></div>
1.75 rillig 8636: <p>Our policy is that we accept binaries only from pkgsrc
8637: developers to guarantee that the packages don't contain any
8638: trojan horses etc. This is not to annoy anyone but rather to
8639: protect our users! You're still free to put up your home-made
8640: binary packages and tell the world where to get them. NetBSD
8641: developers doing bulk builds and wanting to upload them please
1.267 ! rillig 8642: 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 8643: builds)</i></a>.</p>
1.75 rillig 8644: </div>
1.148 asau 8645: <div class="sect1">
1.75 rillig 8646: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8647: <a name="submitting-your-package"></a>23.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
1.75 rillig 8648: <p>First, check that your package is complete, compiles and
1.267 ! rillig 8649: runs well; see <a class="xref" href="#debug" title="Chapter 22. Debugging">Chapter 22, <i>Debugging</i></a> and the rest of this
1.257 leot 8650: document. Next, generate an uuencoded gzipped <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a>
1.82 rillig 8651: archive that contains all files that make up the package.
1.87 wiz 8652: Finally, send this package to the pkgsrc bug tracking system,
1.257 leot 8653: either with the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> command, or if you don't have
1.87 wiz 8654: that, go to the web page
1.110 hubertf 8655: <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 8656: which contains some instructions and a link to a form where you
8657: can submit packages. The
1.250 leot 8658: <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 8659: also available as a substitute for either of the above two tools.
8660: </p>
1.87 wiz 8661: <p>In the form of the problem report, the category should be
1.128 wiz 8662: <span class="quote">“<span class="quote">pkg</span>”</span>, the synopsis should include the package name
1.87 wiz 8663: and version number, and the description field should contain a
8664: short description of your package (contents of the COMMENT
8665: variable or DESCR file are OK). The uuencoded package data should
1.128 wiz 8666: go into the <span class="quote">“<span class="quote">fix</span>”</span> field.</p>
1.75 rillig 8667: <p>If you want to submit several packages, please send a
8668: separate PR for each one, it's easier for us to track things
8669: that way.</p>
8670: <p>Alternatively, you can also import new packages into
1.128 wiz 8671: pkgsrc-wip (<span class="quote">“<span class="quote">pkgsrc work-in-progress</span>”</span>); see the
1.215 wiz 8672: homepage at <a class="ulink" href="http://pkgsrc.org/wip/" target="_top">http://pkgsrc.org/wip/</a>
1.75 rillig 8673: for details.</p>
8674: </div>
1.148 asau 8675: <div class="sect1">
1.75 rillig 8676: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8677: <a name="general-notes-for-changes"></a>23.3. General notes when adding, updating, or removing packages</h2></div></div></div>
1.75 rillig 8678: <p>Please note all package additions, updates, moves, and
1.93 rillig 8679: removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
1.75 rillig 8680: important to keep this file up to date and conforming to the
8681: existing format, because it will be used by scripts to
1.110 hubertf 8682: automatically update pages on <a class="ulink" href="http://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
1.75 rillig 8683: sites. Additionally, check the
1.76 rillig 8684: <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
1.75 rillig 8685: for the package you updated or removed, in case it was mentioned
8686: there.</p>
8687: <p>When the <code class="varname">PKGREVISION</code> of a package is
8688: bumped, the change should appear in
1.93 rillig 8689: <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
1.75 rillig 8690: related or otherwise relevant. Mass bumps that result from a
8691: dependency being updated should not be mentioned. In all other
8692: cases it's the developer's decision.</p>
8693: <p>There is a make target that helps in creating proper
1.110 hubertf 8694: <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries: <span class="command"><strong>make
1.75 rillig 8695: changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
8696: and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
1.93 rillig 8697: usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
1.75 rillig 8698: file is up-to-date (to avoid having to resolve conflicts later-on)
1.110 hubertf 8699: and then to <span class="command"><strong>cd</strong></span> to the package directory. For
8700: package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
1.75 rillig 8701: For new packages, or package moves or removals, set the
8702: <code class="varname">CTYPE</code> variable on the command line to "Added",
8703: "Moved", or "Removed". You can set <code class="varname">NETBSD_LOGIN_NAME</code>
1.110 hubertf 8704: in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
1.125 wiz 8705: not the same as your NetBSD login name. The target also automatically
8706: removes possibly existing entries for the package in the
8707: <code class="filename">TODO</code> file. Don't forget to commit
1.174 asau 8708: the changes, e.g. by using <span class="command"><strong>make commit-changes-entry</strong></span>!
1.126 jakllsch 8709: If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
1.125 wiz 8710: a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
8711: makes the cvs commands use the main repository.
8712: </p>
1.75 rillig 8713: </div>
1.148 asau 8714: <div class="sect1">
1.75 rillig 8715: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8716: <a name="commit-messages"></a>23.4. Commit Messages</h2></div></div></div>
1.243 wiz 8717: <p>For several years, there have been mirrors of pkgsrc in
8718: fossil, git, and hg. Standard practise when using these tools is to
8719: make the first line of a commit message function as a summary that
8720: can be read without the rest, such as is commonly done with "git log
8721: --oneline". For this reason, we have the following guidelines for
8722: pkgsrc commit messages:</p>
8723: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8724: <li class="listitem"><p>Start the commit message with a line that explains the
1.244 wiz 8725: big picture in 65 characters or less. When a commit is for one
1.243 wiz 8726: package, include the name of the package. For updates, include the
8727: version to which it is updated.</p></li>
8728: <li class="listitem"><p>Leave the next line empty.</p></li>
8729: <li class="listitem"><p>Then come the details for the commit (changes in that
8730: package, reason for a change) and any relevant PRs. Wrap this
8731: section.</p></li>
8732: </ul></div>
8733: <p>Here is an example:
8734: </p>
8735: <pre class="programlisting">
8736: libxslt: update to 1.0.30
8737:
8738: Changes since 1.0.29:
8739: ...
8740: </pre>
8741: <p>
8742: </p>
8743: <p>Here is another example:
8744: </p>
8745: <pre class="programlisting">
8746: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8747:
8748: (rationale)
8749: </pre>
8750: <p>
8751: </p>
8752: <p>Commit messages are final: no <span class="quote">“<span class="quote">cvs admin</span>”</span> is
8753: allowed on the pkgsrc repository to change commit messages.</p>
8754: </div>
8755: <div class="sect1">
8756: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8757: <a name="committing-importing"></a>23.5. Committing: Adding a package to CVS</h2></div></div></div>
1.87 wiz 8758: <p>This section is only of interest for pkgsrc developers with write
1.140 wiz 8759: access to the pkgsrc repository.</p>
8760: <p>When the package is finished, <span class="quote">“<span class="quote">cvs add</span>”</span> the files.
8761: Start by adding the directory and then files in the directory. Don't
8762: forget to add the new package to the category's
8763: <code class="filename">Makefile</code>. Make sure you don't forget any files;
8764: you can check by running <span class="quote">“<span class="quote">cvs status</span>”</span>. An example:</p>
8765: <pre class="programlisting">
8766: <code class="prompt">$</code> cd .../pkgsrc/category
8767: <code class="prompt">$</code> cvs add pkgname
8768: <code class="prompt">$</code> cd pkgname
8769: <code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8770: <code class="prompt">$</code> cvs add patches/p*
8771: <code class="prompt">$</code> cvs status | less
1.141 wiz 8772: <code class="prompt">$</code> cvs commit
1.140 wiz 8773: <code class="prompt">$</code> cd ..
8774: <code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line
1.141 wiz 8775: <code class="prompt">$</code> cvs commit Makefile
1.174 asau 8776: <code class="prompt">$</code> cd pkgname
1.182 jnemeth 8777: <code class="prompt">$</code> make CTYPE=Added commit-changes-entry
1.140 wiz 8778: </pre>
1.87 wiz 8779: <p>The commit message of the initial import should include part of the
1.76 rillig 8780: <code class="filename">DESCR</code> file, so people reading the mailing lists know
1.87 wiz 8781: what the package is/does.</p>
1.140 wiz 8782: <p>Also mention the new package in
8783: <code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
8784: <p>Previously, <span class="quote">“<span class="quote">cvs import</span>”</span> was suggested, but it was
8785: much easier to get wrong than <span class="quote">“<span class="quote">cvs add</span>”</span>.</p>
1.75 rillig 8786: </div>
1.148 asau 8787: <div class="sect1">
1.75 rillig 8788: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8789: <a name="updating-package"></a>23.6. Updating a package to a newer version</h2></div></div></div>
1.87 wiz 8790: <p>Please always put a concise, appropriate and relevant summary of the
1.75 rillig 8791: changes between old and new versions into the commit log when updating
1.87 wiz 8792: a package. There are various reasons for this:</p>
1.148 asau 8793: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8794: <li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
1.87 wiz 8795: or its information may be overwritten by newer information.</p></li>
1.128 wiz 8796: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.87 wiz 8797: repository is very useful for people who use either cvs or anoncvs.</p></li>
1.128 wiz 8798: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.75 rillig 8799: repository is very useful for people who read the pkgsrc-changes mailing
8800: list, so that they can make tactical decisions about when to upgrade
1.87 wiz 8801: the package.</p></li>
1.75 rillig 8802: </ul></div>
1.87 wiz 8803: <p>Please also recognize that, just because a new version of a package
1.75 rillig 8804: has been released, it should not automatically be upgraded in the CVS
8805: repository. We prefer to be conservative in the packages that are
8806: included in pkgsrc - development or beta packages are not really the
8807: best thing for most places in which pkgsrc is used. Please use your
8808: judgement about what should go into pkgsrc, and bear in mind that
1.87 wiz 8809: stability is to be preferred above new and possibly untested features.</p>
1.75 rillig 8810: </div>
1.148 asau 8811: <div class="sect1">
1.75 rillig 8812: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8813: <a name="renaming-package"></a>23.7. Renaming a package in pkgsrc</h2></div></div></div>
1.122 reed 8814: <p>Renaming packages is not recommended.</p>
8815: <p>When renaming packages, be sure to fix any references to old name
8816: in other Makefiles, options, buildlink files, etc.</p>
8817: <p>Also When renaming a package, please define
8818: <code class="varname">SUPERSEDES</code> to the package name and dewey version
8819: pattern(s) of the previous package name.
8820: This may be repeated for multiple renames.
8821: The new package would be an exact replacement.
8822: </p>
1.128 wiz 8823: <p>Note that <span class="quote">“<span class="quote">successor</span>”</span> in the
1.122 reed 8824: CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
8825: mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
8826: not be an exact replacement but is a suggestion for the replaced
8827: functionality.</p>
8828: </div>
1.148 asau 8829: <div class="sect1">
1.122 reed 8830: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 8831: <a name="moving-package"></a>23.8. Moving a package in pkgsrc</h2></div></div></div>
1.122 reed 8832: <p>It is preferred that packages are not renamed or moved, but if needed
8833: please follow these steps.
8834: </p>
1.128 wiz 8835: <div class="orderedlist"><ol class="orderedlist" type="1">
8836: <li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
8837: <li class="listitem">
1.75 rillig 8838: <p>Remove all CVS dirs.</p>
1.87 wiz 8839: <p>Alternatively to the first two steps you can also do:</p>
1.75 rillig 8840: <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 8841: <p>and use that for further work.</p>
1.75 rillig 8842: </li>
1.128 wiz 8843: <li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
8844: <code class="varname">DEPENDS</code> paths that just did <span class="quote">“<span class="quote">../package</span>”</span>
8845: instead of <span class="quote">“<span class="quote">../../category/package</span>”</span>.</p></li>
8846: <li class="listitem"><p>In the modified package's Makefile, consider setting
1.122 reed 8847: <code class="varname">PREV_PKGPATH</code> to the previous category/package
8848: pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools
8849: for doing an update using pkgsrc building; for example, it can
1.257 leot 8850: search the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code>
1.122 reed 8851: (if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
8852: new <code class="varname">PKGPATH</code> for that moved package. Note that
8853: it may have multiple matches, so the tool should also check on the
8854: <code class="varname">PKGBASE</code> too. The <code class="varname">PREV_PKGPATH</code>
8855: probably has no value unless <code class="varname">SUPERSEDES</code> is not
8856: set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li>
1.128 wiz 8857: <li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new
1.75 rillig 8858: place.</p></li>
1.128 wiz 8859: <li class="listitem">
1.75 rillig 8860: <p>Check if any package depends on it:
8861: </p>
8862: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
8863: <code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
8864: </li>
1.128 wiz 8865: <li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
8866: <li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
8867: <li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
8868: <li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
8869: <li class="listitem">
1.75 rillig 8870: <p>Commit the changed and removed files:</p>
8871: <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 8872: <p>(and any packages from step 5, of course).</p>
1.75 rillig 8873: </li>
8874: </ol></div>
8875: </div>
8876: </div>
1.148 asau 8877: <div class="chapter">
1.75 rillig 8878: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 8879: <a name="devfaq"></a>Chapter 24. Frequently Asked Questions</h2></div></div></div>
1.75 rillig 8880: <p>This section contains the answers to questions that may
8881: arise when you are writing a package. If you don't find your
8882: question answered here, first have a look in the other chapters,
8883: and if you still don't have the answer, ask on the
8884: <code class="literal">pkgsrc-users</code> mailing list.</p>
1.148 asau 8885: <div class="qandaset">
1.267 ! rillig 8886: <a name="idm79126896"></a><dl>
! 8887: <dt>24.1. <a href="#devfaq.makeflags">What is the difference between
1.75 rillig 8888: MAKEFLAGS, .MAKEFLAGS and
8889: MAKE_FLAGS?</a>
8890: </dt>
1.267 ! rillig 8891: <dt>24.2. <a href="#devfaq.make">What is the difference between
1.75 rillig 8892: MAKE, GMAKE and
8893: MAKE_PROGRAM?</a>
8894: </dt>
1.267 ! rillig 8895: <dt>24.3. <a href="#devfaq.cc">What is the difference between
1.75 rillig 8896: CC, PKG_CC and
8897: PKGSRC_COMPILER?</a>
8898: </dt>
1.267 ! rillig 8899: <dt>24.4. <a href="#devfaq.bl3flags">What is the difference between
1.75 rillig 8900: BUILDLINK_LDFLAGS,
8901: BUILDLINK_LDADD and
8902: BUILDLINK_LIBS?</a>
8903: </dt>
1.267 ! rillig 8904: <dt>24.5. <a href="#devfaq.bl3prefix">Why does make show-var
1.75 rillig 8905: VARNAME=BUILDLINK_PREFIX.foo
8906: say it's empty?</a>
8907: </dt>
1.267 ! rillig 8908: <dt>24.6. <a href="#devfaq.master_sites">What does
1.78 rillig 8909: ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
8910: don't understand the := inside
8911: it.</a>
8912: </dt>
1.267 ! rillig 8913: <dt>24.7. <a href="#devfaq.mailinglists">Which mailing lists are there for package
1.78 rillig 8914: developers?</a>
8915: </dt>
1.267 ! rillig 8916: <dt>24.8. <a href="#devfaq.documentation">Where is the pkgsrc
1.80 rillig 8917: documentation?</a>
8918: </dt>
1.267 ! rillig 8919: <dt>24.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I
1.92 rillig 8920: do?</a>
8921: </dt>
1.75 rillig 8922: </dl>
1.148 asau 8923: <table border="0" style="width: 100%;">
8924: <colgroup>
1.75 rillig 8925: <col align="left" width="1%">
1.128 wiz 8926: <col>
1.148 asau 8927: </colgroup>
1.75 rillig 8928: <tbody>
1.148 asau 8929: <tr class="question">
1.75 rillig 8930: <td align="left" valign="top">
1.267 ! rillig 8931: <a name="devfaq.makeflags"></a><a name="idm79126512"></a><p><b>24.1.</b></p>
1.75 rillig 8932: </td>
8933: <td align="left" valign="top"><p>What is the difference between
8934: <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
8935: <code class="varname">MAKE_FLAGS</code>?</p></td>
8936: </tr>
8937: <tr class="answer">
1.91 rillig 8938: <td align="left" valign="top"></td>
1.75 rillig 8939: <td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed
1.257 leot 8940: to the pkgsrc-internal invocations of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, while
1.75 rillig 8941: <code class="varname">MAKE_FLAGS</code> are the flags that are passed to
8942: the <code class="varname">MAKE_PROGRAM</code> when building the
8943: package. [FIXME: What is .MAKEFLAGS for?]</p></td>
8944: </tr>
1.148 asau 8945: <tr class="question">
1.75 rillig 8946: <td align="left" valign="top">
1.267 ! rillig 8947: <a name="devfaq.make"></a><a name="idm79122544"></a><p><b>24.2.</b></p>
1.75 rillig 8948: </td>
8949: <td align="left" valign="top"><p>What is the difference between
8950: <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
8951: <code class="varname">MAKE_PROGRAM</code>?</p></td>
8952: </tr>
8953: <tr class="answer">
1.91 rillig 8954: <td align="left" valign="top"></td>
1.75 rillig 8955: <td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the
1.257 leot 8956: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc
1.75 rillig 8957: infrastructure. <code class="varname">GMAKE</code> is the path to GNU
8958: Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to
8959: use that. <code class="varname">MAKE_PROGRAM</code> is the path to the
8960: Make program that is used for building the
8961: package.</p></td>
8962: </tr>
1.148 asau 8963: <tr class="question">
1.75 rillig 8964: <td align="left" valign="top">
1.267 ! rillig 8965: <a name="devfaq.cc"></a><a name="idm79118064"></a><p><b>24.3.</b></p>
1.75 rillig 8966: </td>
8967: <td align="left" valign="top"><p>What is the difference between
8968: <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
8969: <code class="varname">PKGSRC_COMPILER</code>?</p></td>
8970: </tr>
8971: <tr class="answer">
1.91 rillig 8972: <td align="left" valign="top"></td>
1.75 rillig 8973: <td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C
8974: compiler, which can be configured by the pkgsrc user.
8975: <code class="varname">PKG_CC</code> is the path to the compiler wrapper.
8976: <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a
8977: path to a compiler, but the type of compiler that should be
1.76 rillig 8978: used. See <code class="filename">mk/compiler.mk</code> for more
1.75 rillig 8979: information about the latter variable.</p></td>
8980: </tr>
1.148 asau 8981: <tr class="question">
1.75 rillig 8982: <td align="left" valign="top">
1.267 ! rillig 8983: <a name="devfaq.bl3flags"></a><a name="idm79113968"></a><p><b>24.4.</b></p>
1.75 rillig 8984: </td>
8985: <td align="left" valign="top"><p>What is the difference between
8986: <code class="varname">BUILDLINK_LDFLAGS</code>,
8987: <code class="varname">BUILDLINK_LDADD</code> and
8988: <code class="varname">BUILDLINK_LIBS</code>?</p></td>
8989: </tr>
8990: <tr class="answer">
1.91 rillig 8991: <td align="left" valign="top"></td>
1.75 rillig 8992: <td align="left" valign="top"><p>[FIXME]</p></td>
8993: </tr>
1.148 asau 8994: <tr class="question">
1.75 rillig 8995: <td align="left" valign="top">
1.267 ! rillig 8996: <a name="devfaq.bl3prefix"></a><a name="idm79111664"></a><p><b>24.5.</b></p>
1.75 rillig 8997: </td>
1.110 hubertf 8998: <td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
1.75 rillig 8999: VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
9000: say it's empty?</p></td>
9001: </tr>
9002: <tr class="answer">
1.91 rillig 9003: <td align="left" valign="top"></td>
1.75 rillig 9004: <td align="left" valign="top"><p>For optimization reasons, some variables are only
1.128 wiz 9005: available in the <span class="quote">“<span class="quote">wrapper</span>”</span> phase and later. To
9006: <span class="quote">“<span class="quote">simulate</span>”</span> the wrapper phase, append
1.110 hubertf 9007: <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
1.75 rillig 9008: command.</p></td>
9009: </tr>
1.148 asau 9010: <tr class="question">
1.78 rillig 9011: <td align="left" valign="top">
1.267 ! rillig 9012: <a name="devfaq.master_sites"></a><a name="idm79108592"></a><p><b>24.6.</b></p>
1.78 rillig 9013: </td>
9014: <td align="left" valign="top"><p>What does
1.220 wiz 9015: <code class="code">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
9016: don't understand the <code class="code">:=</code> inside
1.78 rillig 9017: it.</p></td>
9018: </tr>
9019: <tr class="answer">
1.91 rillig 9020: <td align="left" valign="top"></td>
1.220 wiz 9021: <td align="left" valign="top"><p>The <code class="code">:=</code> is not really an
9022: assignment operator, although it looks like it.
1.78 rillig 9023: Instead, it is a degenerate form of
1.220 wiz 9024: <code class="code">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
1.257 leot 9025: which is documented in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which is
1.220 wiz 9026: commonly used in the form <code class="code">${SRCS:.c=.o}</code>. In the
1.78 rillig 9027: case of <code class="varname">MASTER_SITE_*</code>,
9028: <em class="replaceable"><code>old_string</code></em> is the empty string and
9029: <em class="replaceable"><code>new_string</code></em> is
1.220 wiz 9030: <code class="code">package/</code>. That's where the
9031: <code class="code">:</code> and the <code class="code">=</code> fall
1.78 rillig 9032: together.</p></td>
9033: </tr>
1.148 asau 9034: <tr class="question">
1.78 rillig 9035: <td align="left" valign="top">
1.267 ! rillig 9036: <a name="devfaq.mailinglists"></a><a name="idm79101680"></a><p><b>24.7.</b></p>
1.78 rillig 9037: </td>
9038: <td align="left" valign="top"><p>Which mailing lists are there for package
9039: developers?</p></td>
9040: </tr>
9041: <tr class="answer">
1.91 rillig 9042: <td align="left" valign="top"></td>
1.148 asau 9043: <td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
1.110 hubertf 9044: <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 9045: <dd><p>This is a list for technical discussions related
9046: to pkgsrc development, e.g. soliciting feedback for changes to
9047: pkgsrc infrastructure, proposed new features, questions related
9048: to porting pkgsrc to a new platform, advice for maintaining a
9049: package, patches that affect many packages, help requests moved
9050: from pkgsrc-users when an infrastructure bug is found,
9051: etc.</p></dd>
1.110 hubertf 9052: <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 9053: <dd><p>All bug reports in category "pkg" sent with
1.257 leot 9054: <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-8.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> appear here. Please do not report your bugs here
1.78 rillig 9055: directly; use one of the other mailing
9056: lists.</p></dd>
9057: </dl></div></td>
9058: </tr>
1.148 asau 9059: <tr class="question">
1.80 rillig 9060: <td align="left" valign="top">
1.267 ! rillig 9061: <a name="devfaq.documentation"></a><a name="idm79097968"></a><p><b>24.8.</b></p>
1.80 rillig 9062: </td>
9063: <td align="left" valign="top"><p>Where is the pkgsrc
9064: documentation?</p></td>
9065: </tr>
9066: <tr class="answer">
1.91 rillig 9067: <td align="left" valign="top"></td>
1.80 rillig 9068: <td align="left" valign="top">
9069: <p>There are many places where you can find
9070: documentation about pkgsrc:</p>
1.148 asau 9071: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9072: <li class="listitem"><p>The pkgsrc guide (this document) is a collection
1.80 rillig 9073: of chapters that explain large parts of pkgsrc, but some
9074: chapters tend to be outdated. Which ones they are is hard to
9075: say.</p></li>
1.128 wiz 9076: <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 9077: about certain features, announcements of new parts of the pkgsrc
9078: infrastructure and sometimes even announcements that a certain
9079: feature has been marked as obsolete. The benefit here is that
9080: each message has a date appended to it.</p></li>
1.128 wiz 9081: <li class="listitem"><p>Many of the files in the
1.80 rillig 9082: <code class="filename">mk/</code> directory start with a comment that
9083: describes the purpose of the file and how it can be used by the
1.92 rillig 9084: pkgsrc user and package authors. An easy way to find this
1.110 hubertf 9085: documentation is to run <span class="command"><strong>bmake
1.92 rillig 9086: help</strong></span>.</p></li>
1.128 wiz 9087: <li class="listitem"><p>The CVS log messages are a rich source of
1.80 rillig 9088: information, but they tend to be highly abbreviated, especially
9089: for actions that occur often. Some contain a detailed
9090: description of what has changed, but they are geared towards the
9091: other pkgsrc developers, not towards an average pkgsrc user.
9092: They also only document <span class="emphasis"><em>changes</em></span>, so if you
9093: don't know what has been before, these messages may not be worth
9094: too much to you.</p></li>
1.128 wiz 9095: <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">“<span class="quote">implicitly
9096: documented</span>”</span>, that is the documentation exists only in the
1.80 rillig 9097: mind of the developer who wrote the code. To get this
1.110 hubertf 9098: information, use the <span class="command"><strong>cvs annotate</strong></span> command
1.80 rillig 9099: to see who has written it and ask on the
9100: <code class="literal">tech-pkg</code> mailing list, so that others can
9101: find your questions later (see above). To be sure that the
9102: developer in charge reads the mail, you may CC him or
9103: her.</p></li>
9104: </ul></div>
9105: </td>
9106: </tr>
1.148 asau 9107: <tr class="question">
1.92 rillig 9108: <td align="left" valign="top">
1.267 ! rillig 9109: <a name="devfaq.too-much-time"></a><a name="idm79083248"></a><p><b>24.9.</b></p>
1.92 rillig 9110: </td>
9111: <td align="left" valign="top"><p>I have a little time to kill. What shall I
9112: do?</p></td>
9113: </tr>
9114: <tr class="answer">
9115: <td align="left" valign="top"></td>
9116: <td align="left" valign="top">
1.93 rillig 9117: <p>This is not really an FAQ yet, but here's the answer
1.92 rillig 9118: anyway.</p>
1.148 asau 9119: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9120: <li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
1.250 leot 9121: <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 9122: will tell you about newer versions of installed packages that are
9123: available, but not yet updated in pkgsrc.</p></li>
1.128 wiz 9124: <li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
1.126 jakllsch 9125: — it contains a list of suggested new packages and a list of
1.92 rillig 9126: cleanups and enhancements for pkgsrc that would be nice to
9127: have.</p></li>
1.128 wiz 9128: <li class="listitem"><p>Review packages for which review was requested on
1.180 wiz 9129: the <a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a>
1.92 rillig 9130: mailing list.</p></li>
9131: </ul></div>
9132: </td>
9133: </tr>
1.75 rillig 9134: </tbody>
9135: </table>
9136: </div>
9137: </div>
1.148 asau 9138: <div class="chapter">
1.85 jmmv 9139: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 9140: <a name="gnome"></a>Chapter 25. GNOME packaging and porting</h2></div></div></div>
1.85 jmmv 9141: <div class="toc">
9142: <p><b>Table of Contents</b></p>
1.210 leot 9143: <dl class="toc">
1.267 ! rillig 9144: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
! 9145: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
! 9146: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
! 9147: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.85 jmmv 9148: </dl>
9149: </div>
1.110 hubertf 9150: <p>Quoting <a class="ulink" href="http://www.gnome.org/" target="_top">GNOME's web
1.85 jmmv 9151: site</a>:</p>
9152: <div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
9153: environment, an intuitive and attractive desktop for users, and the
9154: GNOME development platform, an extensive framework for building
9155: applications that integrate into the rest of the desktop.</p></blockquote></div>
9156: <p>pkgsrc provides a seamless way to automatically build and install
9157: a complete GNOME environment <span class="emphasis"><em>under many different
9158: platforms</em></span>. We can say with confidence that pkgsrc is one of
9159: the most advanced build and packaging systems for GNOME due to its
9160: included technologies buildlink3, the wrappers and tools framework and
9161: automatic configuration file management. Lots of efforts are put into
9162: achieving a completely clean deinstallation of installed software
9163: components.</p>
1.110 hubertf 9164: <p>Given that pkgsrc is <a class="ulink" href="http://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
1.85 jmmv 9165: the above also means that great efforts are put into making GNOME work
1.110 hubertf 9166: under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted
1.85 jmmv 9167: pkgsrc as its preferred packaging system, contributing lots of
9168: portability fixes to make GNOME build and install under it.</p>
9169: <p>This chapter is aimed at pkgsrc developers and other people
9170: interested in helping our GNOME porting and packaging efforts. It
9171: provides instructions on how to manage the existing packages and some
9172: important information regarding their internals.</p>
1.148 asau 9173: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.85 jmmv 9174: <h3 class="title">We need your help!</h3>
9175: <p>Should you have some spare cycles to devote to NetBSD, pkgsrc
9176: and GNOME and are willing to learn new exciting stuff, please jump
1.110 hubertf 9177: straight to the <a class="ulink" href="http://www.NetBSD.org/contrib/projects.html#gnome" target="_top">pending
1.85 jmmv 9178: work</a> list! There is still a long way to go to get a
9179: fully-functional GNOME desktop under NetBSD and we need your help to
9180: achieve it!</p>
9181: </div>
1.148 asau 9182: <div class="sect1">
1.85 jmmv 9183: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9184: <a name="meta-packages"></a>25.1. Meta packages</h2></div></div></div>
1.85 jmmv 9185: <p>pkgsrc includes three GNOME-related meta packages:</p>
1.148 asau 9186: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.250 leot 9187: <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 9188: the core GNOME desktop environment. It only includes the necessary
9189: bits to get it to boot correctly, although it may lack important
9190: functionality for daily operation. The idea behind this package is
9191: to let end users build their own configurations on top of this one,
9192: first installing this meta package to achieve a functional setup and
9193: then adding individual applications.</p></li>
1.250 leot 9194: <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 9195: complete installation of the GNOME platform and desktop as defined
9196: by the GNOME project; this is based on the components distributed in
9197: the <code class="filename">platform/x.y/x.y.z/sources</code> and
9198: <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
9199: official FTP server. Developer-only tools found in those
9200: directories are not installed unless required by some other
9201: component to work properly. Similarly, packages from the bindings
9202: set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
9203: in unless required as a dependency for an end-user component. This
1.250 leot 9204: 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>
9205: <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 9206: Installs all the tools required to build a GNOME component when
9207: fetched from the CVS repository. These are required to let the
1.110 hubertf 9208: <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
1.85 jmmv 9209: </ul></div>
9210: <p>In all these packages, the <code class="varname">DEPENDS</code> lines are
9211: sorted in a way that eases updates: a package may depend on other
9212: packages listed before it but not on any listed after it. It is very
9213: important to keep this order to ease updates so... <span class="emphasis"><em>do not
9214: change it to alphabetical sorting!</em></span></p>
9215: </div>
1.148 asau 9216: <div class="sect1">
1.85 jmmv 9217: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9218: <a name="new-package"></a>25.2. Packaging a GNOME application</h2></div></div></div>
1.85 jmmv 9219: <p>Almost all GNOME applications are written in C and use a common
9220: set of tools as their build system. Things get different with the new
9221: bindings to other languages (such as Python), but the following will
9222: give you a general idea on the minimum required tools:</p>
1.148 asau 9223: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9224: <li class="listitem">
1.85 jmmv 9225: <p>Almost all GNOME applications use the GNU Autotools as their
9226: build system. As a general rule you will need to tell this to your
9227: package:</p>
1.100 rillig 9228: <pre class="programlisting">
9229: GNU_CONFIGURE=yes
1.85 jmmv 9230: USE_LIBTOOL=yes
1.100 rillig 9231: USE_TOOLS+=gmake
9232: </pre>
1.85 jmmv 9233: </li>
1.128 wiz 9234: <li class="listitem">
1.85 jmmv 9235: <p>If the package uses pkg-config to detect dependencies, add this
9236: tool to the list of required utilities:</p>
1.222 sevan 9237: <pre class="programlisting">
9238: USE_TOOLS+=pkg-config
9239: </pre>
1.250 leot 9240: <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 9241: the end of the build process to ensure that you did not miss to
9242: specify any dependency in your package and that the version
9243: requirements are all correct.</p>
9244: </li>
1.128 wiz 9245: <li class="listitem"><p>If the package uses intltool, be sure to add
1.93 rillig 9246: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
1.85 jmmv 9247: to handle dependencies and to force the package to use the latest
9248: available version.</p></li>
1.128 wiz 9249: <li class="listitem">
1.85 jmmv 9250: <p>If the package uses gtk-doc (a documentation generation
9251: utility), do <span class="emphasis"><em>not</em></span> add a dependency on it. The
9252: tool is rather big and the distfile should come with pregenerated
9253: documentation anyway; if it does not, it is a bug that you ought to
9254: report. For such packages you should disable gtk-doc (unless it is
1.89 rillig 9255: the default):</p>
1.222 sevan 9256: <pre class="programlisting">
9257: CONFIGURE_ARGS+=--disable-gtk-doc
9258: </pre>
1.89 rillig 9259: <p>The default location of installed HTML files
9260: (<code class="filename">share/gtk-doc/<package-name></code>) is correct
9261: and should not be changed unless the package insists on installing
9262: them somewhere else. Otherwise programs as
1.110 hubertf 9263: <span class="command"><strong>devhelp</strong></span> will not be able to open them. You can
1.89 rillig 9264: do that with an entry similar to:</p>
1.222 sevan 9265: <pre class="programlisting">
9266: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
9267: </pre>
1.85 jmmv 9268: </li>
9269: </ul></div>
9270: <p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
9271: files under the installation prefix to maintain databases. In this
9272: context, shared means that those exact same directories and files are
9273: used among several different packages, leading to conflicts in the
9274: <code class="filename">PLIST</code>. pkgsrc currently includes functionality to
9275: handle the most common cases, so you have to forget about using
9276: <code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
9277: omitting shared files from them. If you find yourself doing those,
9278: <span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
9279: <p>The following table lists the common situations that result in
9280: using shared directories or files. For each of them, the appropriate
9281: solution is given. After applying the solution be sure to
9282: <span class="emphasis"><em>regenerate the package's file list</em></span> with
1.110 hubertf 9283: <span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
1.85 jmmv 9284: <div class="table">
1.267 ! rillig 9285: <a name="plist-handling"></a><p class="title"><b>Table 25.1. PLIST handling for GNOME packages</b></p>
1.216 tnn 9286: <div class="table-contents"><table class="table" summary="PLIST handling for GNOME packages" border="1">
1.85 jmmv 9287: <colgroup>
9288: <col>
9289: <col>
9290: </colgroup>
9291: <thead><tr>
9292: <th>If the package...</th>
9293: <th>Then...</th>
9294: </tr></thead>
9295: <tbody>
9296: <tr>
9297: <td>Installs OMF files under <code class="filename">share/omf</code>.</td>
1.267 ! rillig 9298: <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 9299: </tr>
9300: <tr>
9301: <td>Installs icons under the
9302: <code class="filename">share/icons/hicolor</code> hierarchy or updates
9303: <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
1.267 ! rillig 9304: <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 9305: </tr>
9306: <tr>
9307: <td>Installs files under
9308: <code class="filename">share/mime/packages</code>.</td>
1.267 ! rillig 9309: <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 9310: </tr>
9311: <tr>
9312: <td>Installs <code class="filename">.desktop</code> files under
9313: <code class="filename">share/applications</code> and these include MIME
9314: information.</td>
1.267 ! rillig 9315: <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 9316: </tr>
9317: </tbody>
1.91 rillig 9318: </table></div>
1.85 jmmv 9319: </div>
1.91 rillig 9320: <br class="table-break">
1.85 jmmv 9321: </div>
1.148 asau 9322: <div class="sect1">
1.85 jmmv 9323: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9324: <a name="full-update"></a>25.3. Updating GNOME to a newer version</h2></div></div></div>
1.85 jmmv 9325: <p>When seeing GNOME as a whole, there are two kinds of
9326: updates:</p>
1.148 asau 9327: <div class="variablelist"><dl class="variablelist">
1.85 jmmv 9328: <dt><span class="term">Major update</span></dt>
9329: <dd>
9330: <p>Given that there is still a very long way for GNOME 3 (if it
9331: ever appears), we consider a major update one that goes from a
9332: <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
9333: where <code class="literal">Y</code> is even and greater than
9334: <code class="literal">X</code>. These are hard to achieve because they
9335: introduce lots of changes in the components' code and almost all
9336: GNOME distfiles are updated to newer versions. Some of them can
9337: even break API and ABI compatibility with the previous major
9338: version series. As a result, the update needs to be done all at
9339: once to minimize breakage.</p>
9340: <p>A major update typically consists of around 80 package
9341: updates and the addition of some new ones.</p>
9342: </dd>
9343: <dt><span class="term">Minor update</span></dt>
9344: <dd>
9345: <p>We consider a minor update one that goes from a
9346: <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
9347: one where <code class="literal">Y</code> is greater than
9348: <code class="literal">X</code>. These are easy to achieve because they do
9349: not update all GNOME components, can be done in an incremental way
9350: and do not break API nor ABI compatibility.</p>
9351: <p>A minor update typically consists of around 50 package
9352: updates, although the numbers here may vary a lot.</p>
9353: </dd>
9354: </dl></div>
9355: <p>In order to update the GNOME components in pkgsrc to a new stable
9356: release (either major or minor), the following steps should be
9357: followed:</p>
1.128 wiz 9358: <div class="orderedlist"><ol class="orderedlist" type="1">
9359: <li class="listitem">
1.85 jmmv 9360: <p>Get a list of all the tarballs that form the new release by
9361: using the following commands. These will leave the full list of the
1.120 snj 9362: components' distfiles into the <code class="filename">list.txt</code>
1.85 jmmv 9363: file:</p>
1.88 wiz 9364: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
1.85 jmmv 9365: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
9366: awk '{ print $9 }' >list.txt</code></strong>
1.88 wiz 9367: <code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
1.85 jmmv 9368: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
9369: awk '{ print $9 }' >>list.txt</code></strong></pre>
9370: </li>
1.128 wiz 9371: <li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
1.85 jmmv 9372: bump their version to the release you are updating them to. The
9373: three meta packages should be always consistent with versioning.
9374: Obviously remove any <code class="varname">PKGREVISION</code>s that might be
9375: in them.</p></li>
1.128 wiz 9376: <li class="listitem">
1.85 jmmv 9377: <p>For each meta package, update all its
9378: <code class="varname">DEPENDS</code> lines to match the latest versions as
9379: shown by the above commands. Do <span class="emphasis"><em>not</em></span> list any
9380: newer version (even if found in the FTP) because the meta packages
9381: are supposed to list the exact versions that form a specific GNOME
9382: release. Exceptions are permitted here if a newer version solves a
9383: serious issue in the overall desktop experience; these typically
9384: come in the form of a revision bump in pkgsrc, not in newer versions
9385: from the developers.</p>
9386: <p>Packages not listed in the <code class="filename">list.txt</code> file
9387: should be updated to the latest version available (if found in
9388: pkgsrc). This is the case, for example, of the dependencies on the
1.250 leot 9389: 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 9390: </li>
1.128 wiz 9391: <li class="listitem">
1.85 jmmv 9392: <p>Generate a patch from the modified meta packages and extract the
9393: list of "new" lines. This will provide you an outline on what
9394: packages need to be updated in pkgsrc and in what order:</p>
1.93 rillig 9395: <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 9396: </li>
1.128 wiz 9397: <li class="listitem"><p>For major desktop updates it is recommended to zap all your
1.85 jmmv 9398: installed packages and start over from scratch at this point.</p></li>
1.128 wiz 9399: <li class="listitem"><p>Now comes the longest step by far: iterate over the contents
1.85 jmmv 9400: of <code class="filename">todo.txt</code> and update the packages listed in
9401: it in order. For major desktop updates none of these should be
1.93 rillig 9402: committed until the entire set is completed because there are chances
1.85 jmmv 9403: of breaking not-yet-updated packages.</p></li>
1.128 wiz 9404: <li class="listitem"><p>Once the packages are up to date and working, commit them to
1.85 jmmv 9405: the tree one by one with appropriate log messages. At the end,
9406: commit the three meta package updates and all the corresponding
9407: changes to the <code class="filename">doc/CHANGES-<YEAR></code> and
9408: <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>
9409: </ol></div>
9410: </div>
1.148 asau 9411: <div class="sect1">
1.85 jmmv 9412: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9413: <a name="patching"></a>25.4. Patching guidelines</h2></div></div></div>
1.85 jmmv 9414: <p>GNOME is a very big component in pkgsrc which approaches 100
9415: packages. Please, it is very important that you always, always,
9416: <span class="strong"><strong>always</strong></span> feed back any portability
1.267 ! rillig 9417: 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 9418: their attention on portability issues and to ensure that future versions
9419: can be built out-of-the box on NetBSD. The less custom patches in
9420: pkgsrc, the easier further updates are. Those developers in charge of
9421: issuing major GNOME updates will be grateful if you do that.</p>
1.110 hubertf 9422: <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 9423: Bugzilla</a>. Not all components use these to track bugs, but most
9424: of them do. Do not be short on your reports: always provide detailed
9425: explanations of the current failure, how it can be improved to achieve
9426: maximum portability and, if at all possible, provide a patch against CVS
9427: head. The more verbose you are, the higher chances of your patch being
9428: accepted.</p>
9429: <p>Also, please avoid using preprocessor magic to fix portability
9430: issues. While the FreeBSD GNOME people are doing a great job in porting
9431: GNOME to their operating system, the official GNOME sources are now
9432: plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
9433: and similar macros. This hurts portability. Please see our patching
1.267 ! rillig 9434: 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 9435: details.</p>
9436: </div>
9437: </div>
1.75 rillig 9438: </div>
1.148 asau 9439: <div class="part">
1.75 rillig 9440: <div class="titlepage"><div><div><h1 class="title">
9441: <a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
1.148 asau 9442: <div class="partintro">
1.75 rillig 9443: <div></div>
9444: <p>This part of the guide deals with everything
9445: from the infrastructure that is behind the interfaces described
9446: in the developer's guide. A casual package maintainer should not
9447: need anything from this part.</p>
9448: <div class="toc">
9449: <p><b>Table of Contents</b></p>
1.210 leot 9450: <dl class="toc">
1.267 ! rillig 9451: <dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
1.75 rillig 9452: <dd><dl>
1.267 ! rillig 9453: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
! 9454: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
! 9455: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.75 rillig 9456: <dd><dl>
1.267 ! rillig 9457: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
! 9458: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.75 rillig 9459: </dl></dd>
1.267 ! rillig 9460: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
! 9461: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 9462: <dd><dl>
1.267 ! rillig 9463: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
! 9464: <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 9465: </dl></dd>
1.267 ! rillig 9466: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.81 rillig 9467: <dd><dl>
1.267 ! rillig 9468: <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>
! 9469: <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 9470: </dl></dd>
9471: </dl></dd>
1.267 ! rillig 9472: <dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
1.75 rillig 9473: <dd><dl>
1.267 ! rillig 9474: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
! 9475: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.75 rillig 9476: <dd><dl>
1.267 ! rillig 9477: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
! 9478: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.75 rillig 9479: </dl></dd>
9480: </dl></dd>
1.267 ! rillig 9481: <dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
! 9482: <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 9483: </dl>
9484: </div>
9485: </div>
1.148 asau 9486: <div class="chapter">
1.75 rillig 9487: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 9488: <a name="infr.design"></a>Chapter 26. Design of the pkgsrc infrastructure</h2></div></div></div>
1.75 rillig 9489: <div class="toc">
9490: <p><b>Table of Contents</b></p>
1.210 leot 9491: <dl class="toc">
1.267 ! rillig 9492: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
! 9493: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
! 9494: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.81 rillig 9495: <dd><dl>
1.267 ! rillig 9496: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
! 9497: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.81 rillig 9498: </dl></dd>
1.267 ! rillig 9499: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
! 9500: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 9501: <dd><dl>
1.267 ! rillig 9502: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
! 9503: <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 9504: </dl></dd>
1.267 ! rillig 9505: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.75 rillig 9506: <dd><dl>
1.267 ! rillig 9507: <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>
! 9508: <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 9509: </dl></dd>
9510: </dl>
9511: </div>
9512: <p>The pkgsrc infrastructure consists of many small Makefile
9513: fragments. Each such fragment needs a properly specified
9514: interface. This chapter explains how such an interface looks
9515: like.</p>
1.148 asau 9516: <div class="sect1">
1.75 rillig 9517: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9518: <a name="infr.vardef"></a>26.1. The meaning of variable definitions</h2></div></div></div>
1.81 rillig 9519: <p>Whenever a variable is defined in the pkgsrc
9520: infrastructure, the location and the way of definition provide
9521: much information about the intended use of that variable.
9522: Additionally, more documentation may be found in a header
9523: comment or in this pkgsrc guide.</p>
9524: <p>A special file is
9525: <code class="filename">mk/defaults/mk.conf</code>, which lists all
9526: variables that are intended to be user-defined. They are either
9527: defined using the <code class="literal">?=</code> operator or they are
9528: left undefined because defining them to anything would
1.128 wiz 9529: effectively mean <span class="quote">“<span class="quote">yes</span>”</span>. All these variables may be
1.81 rillig 9530: overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
9531: file.</p>
9532: <p>Outside this file, the following conventions apply:
9533: Variables that are defined using the <code class="literal">?=</code>
9534: operator may be overridden by a package.</p>
9535: <p>Variables that are defined using the <code class="literal">=</code>
9536: operator may be used read-only at run-time.</p>
9537: <p>Variables whose name starts with an underscore must not be
9538: accessed outside the pkgsrc infrastructure at all. They may
9539: change without further notice.</p>
1.148 asau 9540: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.81 rillig 9541: <h3 class="title">Note</h3>
9542: <p>These conventions are currently not applied
9543: consistently to the complete pkgsrc
9544: infrastructure.</p>
9545: </div>
9546: </div>
1.148 asau 9547: <div class="sect1">
1.81 rillig 9548: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9549: <a name="infr.vardef.problems"></a>26.2. Avoiding problems before they arise</h2></div></div></div>
1.81 rillig 9550: <p>All variables that contain lists of things should default
9551: to being empty. Two examples that do not follow this rule are
9552: <code class="varname">USE_LANGUAGES</code> and
9553: <code class="varname">DISTFILES</code>. These variables cannot simply be
9554: modified using the <code class="literal">+=</code> operator in package
9555: <code class="filename">Makefile</code>s (or other files included by
9556: them), since there is no guarantee whether the variable is
9557: already set or not, and what its value is. In the case of
1.128 wiz 9558: <code class="varname">DISTFILES</code>, the packages <span class="quote">“<span class="quote">know</span>”</span>
1.81 rillig 9559: the default value and just define it as in the following
9560: example.</p>
9561: <pre class="programlisting">
1.100 rillig 9562: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
1.81 rillig 9563: </pre>
9564: <p>Because of the selection of this default value, the same
9565: value appears in many package Makefiles. Similarly for
9566: <code class="varname">USE_LANGUAGES</code>, but in this case the default
1.128 wiz 9567: value (<span class="quote">“<span class="quote"><code class="literal">c</code></span>”</span>) is so short that it
1.81 rillig 9568: doesn't stand out. Nevertheless it is mentioned in many
9569: files.</p>
9570: </div>
1.148 asau 9571: <div class="sect1">
1.81 rillig 9572: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9573: <a name="infr.var"></a>26.3. Variable evaluation</h2></div></div></div>
1.148 asau 9574: <div class="sect2">
1.75 rillig 9575: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9576: <a name="infr.var.load"></a>26.3.1. At load time</h3></div></div></div>
1.75 rillig 9577: <p>Variable evaluation takes place either at load time or at
9578: runtime, depending on the context in which they occur. The
9579: contexts where variables are evaluated at load time are:</p>
1.148 asau 9580: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9581: <li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
1.75 rillig 9582: and <code class="literal">!=</code> operators,</p></li>
1.128 wiz 9583: <li class="listitem"><p>Make directives like <code class="literal">.if</code> or
1.75 rillig 9584: <code class="literal">.for</code>,</p></li>
1.128 wiz 9585: <li class="listitem"><p>Dependency lines.</p></li>
1.75 rillig 9586: </ul></div>
9587: <p>A special exception are references to the iteration
9588: variables of <code class="literal">.for</code> loops, which are expanded
9589: inline, no matter in which context they appear.</p>
9590: <p>As the values of variables may change during load time,
9591: care must be taken not to evaluate them by accident. Typical
9592: examples for variables that should not be evaluated at load time
9593: are <code class="varname">DEPENDS</code> and
9594: <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
9595: clear, here is an example:</p>
9596: <pre class="programlisting">
1.100 rillig 9597: CONFIGURE_ARGS= # none
9598: CFLAGS= -O
9599: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
1.1 grant 9600:
1.100 rillig 9601: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
1.1 grant 9602:
1.100 rillig 9603: CFLAGS+= -Wall
1.222 sevan 9604: </pre>
1.75 rillig 9605: <p>This code shows how the use of the <code class="literal">:=</code>
9606: operator can quickly lead to unexpected results. The first
9607: paragraph is fairly common code. The second paragraph evaluates
9608: the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
9609: <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
9610: <code class="literal">-Wall</code> is appended to the
9611: <code class="varname">CFLAGS</code>, but this addition will not appear in
9612: <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
9613: paragraphs from above typically occur in completely unrelated
9614: files.</p>
9615: </div>
1.148 asau 9616: <div class="sect2">
1.75 rillig 9617: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9618: <a name="infr.var.run"></a>26.3.2. At runtime</h3></div></div></div>
1.75 rillig 9619: <p>After all the files have been loaded, the values of the
9620: variables cannot be changed anymore. Variables that are used in
9621: the shell commands are expanded at this point.</p>
9622: </div>
9623: </div>
1.148 asau 9624: <div class="sect1">
1.75 rillig 9625: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9626: <a name="infr.varspec"></a>26.4. How can variables be specified?</h2></div></div></div>
1.78 rillig 9627: <p>There are many ways in which the definition and use of a
1.218 rillig 9628: variable can be restricted in order to detect bugs and violations
9629: of the (mostly unwritten) policies. A package can be checked with
9630: <code class="literal">pkglint -Wall</code> to see whether it meets these
9631: rules.</p>
1.78 rillig 9632: </div>
1.148 asau 9633: <div class="sect1">
1.78 rillig 9634: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9635: <a name="infr.design.intf"></a>26.5. Designing interfaces for Makefile fragments</h2></div></div></div>
1.76 rillig 9636: <p>Most of the <code class="filename">.mk</code> files fall into one
1.75 rillig 9637: of the following classes. Cases where a file falls into more
9638: than one class should be avoided as it often leads to subtle
9639: bugs.</p>
1.148 asau 9640: <div class="sect2">
1.75 rillig 9641: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9642: <a name="infr.design.intf.proc"></a>26.5.1. Procedures with parameters</h3></div></div></div>
1.75 rillig 9643: <p>In a traditional imperative programming language some of
1.76 rillig 9644: the <code class="filename">.mk</code> files could be described as
1.126 jakllsch 9645: procedures. They take some input parameters and—after
9646: inclusion—provide a result in output parameters. Since all
1.76 rillig 9647: variables in <code class="filename">Makefile</code>s have global scope
1.75 rillig 9648: care must be taken not to use parameter names that have already
9649: another meaning. For example, <code class="varname">PKGNAME</code> is a
9650: bad choice for a parameter name.</p>
9651: <p>Procedures are completely evaluated at preprocessing time.
9652: That is, when calling a procedure all input parameters must be
9653: completely resolvable. For example,
9654: <code class="varname">CONFIGURE_ARGS</code> should never be an input
9655: parameter since it is very likely that further text will be
9656: added after calling the procedure, which would effectively apply
9657: the procedure to only a part of the variable. Also, references
1.218 rillig 9658: to other variables will be modified after calling the
1.75 rillig 9659: procedure.</p>
9660: <p>A procedure can declare its output parameters either as
9661: suitable for use in preprocessing directives or as only
9662: available at runtime. The latter alternative is for variables
9663: that contain references to other runtime variables.</p>
9664: <p>Procedures shall be written such that it is possible to
9665: call the procedure more than once. That is, the file must not
9666: contain multiple-inclusion guards.</p>
9667: <p>Examples for procedures are
1.76 rillig 9668: <code class="filename">mk/bsd.options.mk</code> and
9669: <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
1.75 rillig 9670: that the parameters are evaluated at load time, they should be
9671: assigned using the <code class="literal">:=</code> operator, which should
9672: be used only for this purpose.</p>
9673: </div>
1.148 asau 9674: <div class="sect2">
1.75 rillig 9675: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9676: <a name="infr.design.intf.action"></a>26.5.2. Actions taken on behalf of parameters</h3></div></div></div>
1.75 rillig 9677: <p>Action files take some input parameters and may define
9678: runtime variables. They shall not define loadtime variables.
9679: There are action files that are included implicitly by the
9680: pkgsrc infrastructure, while other must be included
9681: explicitly.</p>
9682: <p>An example for action files is
1.76 rillig 9683: <code class="filename">mk/subst.mk</code>.</p>
1.75 rillig 9684: </div>
9685: </div>
1.148 asau 9686: <div class="sect1">
1.81 rillig 9687: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9688: <a name="infr.order"></a>26.6. The order in which files are loaded</h2></div></div></div>
1.81 rillig 9689: <p>Package <code class="filename">Makefile</code>s usually consist of
9690: a set of variable definitions, and include the file
9691: <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
9692: Before that, they may also include various other
9693: <code class="filename">*.mk</code> files if they need to query the
9694: availability of certain features like the type of compiler or
9695: the X11 implementation. Due to the heavy use of preprocessor
9696: directives like <code class="literal">.if</code> and
9697: <code class="literal">.for</code>, the order in which the files are loaded
9698: matters.</p>
9699: <p>This section describes at which point the various files
9700: are loaded and gives reasons for that order.</p>
1.148 asau 9701: <div class="sect2">
1.81 rillig 9702: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9703: <a name="infr.order.prefs"></a>26.6.1. The order in <code class="filename">bsd.prefs.mk</code>
1.93 rillig 9704: </h3></div></div></div>
9705: <p>The very first action in <code class="filename">bsd.prefs.mk</code>
1.81 rillig 9706: is to define some essential variables like
9707: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
9708: <code class="varname">MACHINE_ARCH</code>.</p>
9709: <p>Then, the user settings are loaded from the file specified
1.110 hubertf 9710: 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 9711: After that, those variables
1.81 rillig 9712: that have not been overridden by the user are loaded from
9713: <code class="filename">mk/defaults/mk.conf</code>.</p>
9714: <p>After the user settings, the system settings and platform
9715: settings are loaded, which may override the user
9716: settings.</p>
9717: <p>Then, the tool definitions are loaded. The tool wrappers
9718: are not yet in effect. This only happens when building a
9719: package, so the proper variables must be used instead of the
9720: direct tool names.</p>
9721: <p>As the last steps, some essential variables from the
9722: wrapper and the package system flavor are loaded, as well as the
9723: variables that have been cached in earlier phases of a package
9724: build.</p>
9725: </div>
1.148 asau 9726: <div class="sect2">
1.81 rillig 9727: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9728: <a name="infr.order.pkg"></a>26.6.2. The order in <code class="filename">bsd.pkg.mk</code>
1.93 rillig 9729: </h3></div></div></div>
1.81 rillig 9730: <p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
9731: <p>Then, the various <code class="filename">*-vars.mk</code> files are
9732: loaded, which fill default values for those variables that have
1.93 rillig 9733: not been defined by the package. These variables may later
1.81 rillig 9734: be used even in unrelated files.</p>
9735: <p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
9736: provides the target <code class="literal">error-check</code> that is added
9737: as a special dependency to all other targets that use
9738: <code class="varname">DELAYED_ERROR_MSG</code> or
9739: <code class="varname">DELAYED_WARNING_MSG</code>.</p>
9740: <p>Then, the package-specific hacks from
9741: <code class="filename">hacks.mk</code> are included.</p>
9742: <p>Then, various other files follow. Most of them don't have
9743: any dependencies on what they need to have included before or
9744: after them, though some do.</p>
9745: <p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
9746: <code class="varname">PKG_SKIP_REASON</code> is then executed, which
9747: restricts the use of these variables to all the files that have
9748: been included before. Appearances in later files will be
9749: silently ignored.</p>
9750: <p>Then, the files for the main targets are included, in the
9751: order of later execution, though the actual order should not
9752: matter.</p>
9753: <p>At last, some more files are included that don't set any
9754: interesting variables but rather just define make targets to be
9755: executed.</p>
9756: </div>
9757: </div>
1.75 rillig 9758: </div>
1.148 asau 9759: <div class="chapter">
1.75 rillig 9760: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 9761: <a name="regression"></a>Chapter 27. Regression tests</h2></div></div></div>
1.75 rillig 9762: <div class="toc">
9763: <p><b>Table of Contents</b></p>
1.210 leot 9764: <dl class="toc">
1.267 ! rillig 9765: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
! 9766: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.75 rillig 9767: <dd><dl>
1.267 ! rillig 9768: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
! 9769: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.75 rillig 9770: </dl></dd>
9771: </dl>
9772: </div>
9773: <p>The pkgsrc infrastructure consists of a large codebase,
9774: and there are many corners where every little bit of a file is
9775: well thought out, making pkgsrc likely to fail as soon as
9776: anything is changed near those parts. To prevent most changes
9777: from breaking anything, a suite of regression tests should go
9778: along with every important part of the pkgsrc infrastructure.
9779: This chapter describes how regression tests work in pkgsrc and
9780: how you can add new tests.</p>
1.148 asau 9781: <div class="sect1">
1.75 rillig 9782: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9783: <a name="regression.run"></a>27.1. Running the regression tests</h2></div></div></div>
1.250 leot 9784: <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 9785: provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
1.75 rillig 9786: can simply run that command, which will run all tests in the
1.76 rillig 9787: <code class="filename">regress</code> category.</p>
1.75 rillig 9788: </div>
1.148 asau 9789: <div class="sect1">
1.75 rillig 9790: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9791: <a name="regression.new"></a>27.2. Adding a new regression test</h2></div></div></div>
1.76 rillig 9792: <p>Every directory in the <code class="filename">regress</code>
9793: category that contains a file called <code class="filename">spec</code>
1.75 rillig 9794: is considered a regression test. This file is a shell program
1.110 hubertf 9795: that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
1.75 rillig 9796: The following functions can be overridden to suit your
9797: needs.</p>
1.148 asau 9798: <div class="sect2">
1.75 rillig 9799: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9800: <a name="regression.fun.override"></a>27.2.1. Overridable functions</h3></div></div></div>
1.218 rillig 9801: <p>These functions do not take any parameters. Although they
9802: are called in <span class="quote">“<span class="quote">set -e</span>”</span> mode, they don't stop at the
9803: first failing command. See <a class="ulink" href="http://stackoverflow.com/q/4072984" target="_top">this StackOverflow
9804: question</a> for details.</p>
1.148 asau 9805: <div class="variablelist"><dl class="variablelist">
1.218 rillig 9806: <dt><span class="term"><code class="varname">do_setup</code></span></dt>
1.75 rillig 9807: <dd><p>This function prepares the environment for the
9808: test. By default it does nothing.</p></dd>
1.218 rillig 9809: <dt><span class="term"><code class="varname">do_test</code></span></dt>
9810: <dd>
9811: <p>This function runs the actual test. By default,
1.75 rillig 9812: it calls <code class="varname">TEST_MAKE</code> with the arguments
9813: <code class="varname">MAKEARGS_TEST</code> and writes its output including
9814: error messages into the file
1.218 rillig 9815: <code class="varname">TEST_OUTFILE</code>.</p>
9816: <p>When defining this function, make sure that all output that
9817: needs to be checked is written to the correct output file.
9818: Example:</p>
9819: <pre class="programlisting">
9820: do_test() {
1.223 rillig 9821: echo "Example output"
1.218 rillig 9822: } 1>$TEST_OUTFILE 2>&1
9823: </pre>
9824: </dd>
9825: <dt><span class="term"><code class="varname">check_result</code></span></dt>
9826: <dd>
9827: <p>This function is run after the test and is
1.75 rillig 9828: typically used to compare the actual output from the one that is
9829: expected. It can make use of the various helper functions from
1.218 rillig 9830: the next section. Example:</p>
9831: <pre class="programlisting">
9832: check_result() {
1.223 rillig 9833: exit_status 0
9834: output_require "Example"
9835: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
9836: output_prohibit "no such file or directory"
1.218 rillig 9837: }
9838: </pre>
9839: </dd>
9840: <dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
1.75 rillig 9841: <dd><p>This function cleans everything up after the
9842: test has been run. By default it does nothing.</p></dd>
9843: </dl></div>
9844: </div>
1.148 asau 9845: <div class="sect2">
1.75 rillig 9846: <div class="titlepage"><div><div><h3 class="title">
1.267 ! rillig 9847: <a name="regression.fun.helper"></a>27.2.2. Helper functions</h3></div></div></div>
1.148 asau 9848: <div class="variablelist"><dl class="variablelist">
1.218 rillig 9849: <dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
1.75 rillig 9850: <dd><p>This function compares the exitcode of the
1.218 rillig 9851: <span class="command"><strong>do_test</strong></span> function with its first parameter.
1.75 rillig 9852: If they differ, the test will fail.</p></dd>
1.218 rillig 9853: <dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
9854: <dd>
9855: <p>This function checks for each of its parameters
9856: if the output from <span class="command"><strong>do_test</strong></span> matches the
1.75 rillig 9857: extended regular expression. If it does not, the test will
1.218 rillig 9858: fail. Example:</p>
9859: <pre class="programlisting">
1.219 rillig 9860: output_require "looks fine"
9861: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.218 rillig 9862: </pre>
9863: </dd>
1.75 rillig 9864: <dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt>
9865: <dd><p>This function checks for each of its parameters
1.110 hubertf 9866: if the output from <span class="command"><strong>do_test()</strong></span> does
1.75 rillig 9867: <span class="emphasis"><em>not</em></span> match the extended regular expression.
9868: If any of the regular expressions matches, the test will
9869: fail.</p></dd>
9870: </dl></div>
9871: </div>
9872: </div>
9873: </div>
1.148 asau 9874: <div class="chapter">
1.75 rillig 9875: <div class="titlepage"><div><div><h2 class="title">
1.267 ! rillig 9876: <a name="porting"></a>Chapter 28. Porting pkgsrc</h2></div></div></div>
1.75 rillig 9877: <div class="toc">
9878: <p><b>Table of Contents</b></p>
1.267 ! rillig 9879: <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 9880: </div>
9881: <p>The pkgsrc system has already been ported to many
9882: operating systems, hardware architectures and compilers. This
9883: chapter explains the necessary steps to make pkgsrc even more
9884: portable.</p>
1.148 asau 9885: <div class="sect1">
1.75 rillig 9886: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 9887: <a name="porting.opsys"></a>28.1. Porting pkgsrc to a new operating system</h2></div></div></div>
1.75 rillig 9888: <p>To port pkgsrc to a new operating system (called
9889: <code class="literal">MyOS</code> in this example), you need to touch the
9890: following files:</p>
1.148 asau 9891: <div class="variablelist"><dl class="variablelist">
1.93 rillig 9892: <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 9893: <dd><p>This file contains some basic definitions, for
9894: example the name of the C
9895: compiler.</p></dd>
1.76 rillig 9896: <dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
1.75 rillig 9897: <dd><p>Insert code that defines the variables
9898: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
9899: <code class="varname">LOWER_OS_VERSION</code>,
9900: <code class="varname">LOWER_VENDOR</code>,
9901: <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
9902: <code class="varname">APPEND_ELF</code>, and the other variables that
9903: appear in this file.</p></dd>
1.93 rillig 9904: <dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 9905: <dd><p>This file contains the platform-specific
9906: definitions that are used by pkgsrc. Start by copying one of the
9907: other files and edit it to your
9908: needs.</p></dd>
1.93 rillig 9909: <dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 9910: <dd><p>This file defines the paths to all the tools
9911: that are needed by one or the other package in pkgsrc, as well
9912: as by pkgsrc itself. Find out where these tools are on your
9913: platform and add them.</p></dd>
9914: </dl></div>
9915: <p>Now, you should be able to build some basic packages, like
1.250 leot 9916: <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 9917: </div>
9918: </div>
9919: </div>
1.148 asau 9920: <div class="appendix">
9921: <div class="titlepage"><div><div><h1 class="title">
9922: <a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
1.75 rillig 9923: <div class="toc">
9924: <p><b>Table of Contents</b></p>
1.210 leot 9925: <dl class="toc">
1.75 rillig 9926: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
9927: <dd><dl>
9928: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
9929: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
9930: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.128 wiz 9931: <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 9932: </dl></dd>
9933: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
9934: </dl>
9935: </div>
9936: <p>We checked to find a piece of software that wasn't in the packages
9937: collection, and picked GNU bison. Quite why someone would want to have
1.110 hubertf 9938: <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.75 rillig 9939: present in the tree is beyond us, but it's useful for the purposes of
9940: this exercise.</p>
1.148 asau 9941: <div class="sect1">
1.75 rillig 9942: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
9943: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.148 asau 9944: <div class="sect2">
1.75 rillig 9945: <div class="titlepage"><div><div><h3 class="title">
9946: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
9947: <pre class="programlisting">
1.100 rillig 9948: # $NetBSD$
9949: #
1.1 grant 9950:
1.100 rillig 9951: DISTNAME= bison-1.25
9952: CATEGORIES= devel
9953: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 9954:
1.136 dholland 9955: MAINTAINER= pkgsrc-users@NetBSD.org
1.100 rillig 9956: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
9957: COMMENT= GNU yacc clone
1.1 grant 9958:
1.100 rillig 9959: GNU_CONFIGURE= yes
1.152 wiz 9960: INFO_FILES= yes
1.1 grant 9961:
1.100 rillig 9962: .include "../../mk/bsd.pkg.mk"
1.1 grant 9963: </pre>
1.75 rillig 9964: </div>
1.148 asau 9965: <div class="sect2">
1.75 rillig 9966: <div class="titlepage"><div><div><h3 class="title">
9967: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
9968: <pre class="programlisting">
1.100 rillig 9969: GNU version of yacc. Can make re-entrant parsers, and numerous other
1.257 leot 9970: 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.0"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.100 rillig 9971: of the NetBSD source tree is beyond me.
1.1 grant 9972: </pre>
1.75 rillig 9973: </div>
1.148 asau 9974: <div class="sect2">
1.75 rillig 9975: <div class="titlepage"><div><div><h3 class="title">
9976: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
9977: <pre class="programlisting">
1.100 rillig 9978: @comment $NetBSD$
9979: bin/bison
9980: man/man1/bison.1.gz
9981: share/bison.simple
9982: share/bison.hairy
1.1 grant 9983: </pre>
1.75 rillig 9984: </div>
1.148 asau 9985: <div class="sect2">
1.75 rillig 9986: <div class="titlepage"><div><div><h3 class="title">
1.110 hubertf 9987: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span>
1.93 rillig 9988: </h3></div></div></div>
1.75 rillig 9989: <p>The NetBSD package system comes with
1.250 leot 9990: <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 9991: which helps to check the contents of these
9992: files. After installation it is quite easy to use, just change to the
9993: directory of the package you wish to examine and execute
1.110 hubertf 9994: <span class="command"><strong>pkglint</strong></span>:</p>
1.75 rillig 9995: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
9996: looks fine.</pre>
9997: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.110 hubertf 9998: more checks will be performed. Use e.g. <span class="command"><strong>pkglint -Call
1.75 rillig 9999: -Wall</strong></span> for a very thorough check.</p>
10000: </div>
10001: </div>
1.148 asau 10002: <div class="sect1">
1.75 rillig 10003: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10004: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
10005: <p>Create the directory where the package lives,
10006: plus any auxiliary directories:</p>
10007: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10008: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
10009: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
10010: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
1.76 rillig 10011: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.267 ! rillig 10012: <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 10013: then continue with fetching the distfile:</p>
10014: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
1.1 grant 10015: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10016: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10017: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10018: ftp: Error retrieving file: 500 Internal error
10019:
10020: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10021: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10022: ftp: Error retrieving file: 500 Internal error
10023:
10024: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10025: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1.75 rillig 10026: Successfully retrieved file.</pre>
10027: <p>Generate the checksum of the distfile into
1.76 rillig 10028: <code class="filename">distinfo</code>:</p>
1.88 wiz 10029: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
1.75 rillig 10030: <p>Now compile:</p>
10031: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1 grant 10032: >> Checksum OK for bison-1.25.tar.gz.
10033: ===> Extracting for bison-1.25
10034: ===> Patching for bison-1.25
10035: ===> Ignoring empty patch directory
10036: ===> Configuring for bison-1.25
10037: creating cache ./config.cache
10038: checking for gcc... cc
10039: checking whether we are using GNU C... yes
10040: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10041: checking how to run the C preprocessor... cc -E
10042: checking for minix/config.h... no
10043: checking for POSIXized ISC... no
10044: checking whether cross-compiling... no
10045: checking for ANSI C header files... yes
10046: checking for string.h... yes
10047: checking for stdlib.h... yes
10048: checking for memory.h... yes
10049: checking for working const... yes
10050: checking for working alloca.h... no
10051: checking for alloca... yes
10052: checking for strerror... yes
10053: updating cache ./config.cache
10054: creating ./config.status
10055: creating Makefile
10056: ===> Building for bison-1.25
10057: 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
10058: 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
10059: 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
10060: 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
10061: 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 10062: 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 10063: 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
10064: 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
10065: 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
10066: 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
10067: 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
10068: 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
10069: 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
10070: 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
10071: 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
10072: 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
10073: 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
10074: 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
10075: 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
10076: 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
10077: 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
10078: 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
10079: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10080: rm -f bison.s1
1.75 rillig 10081: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1</pre>
10082: <p>Everything seems OK, so install the files:</p>
10083: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1 grant 10084: >> Checksum OK for bison-1.25.tar.gz.
10085: ===> Installing for bison-1.25
10086: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10087: rm -f /usr/pkg/bin/bison
10088: cd /usr/pkg/share; rm -f bison.simple bison.hairy
10089: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10090: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10091: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10092: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10093: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10094: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
1.75 rillig 10095: ===> Registering installation for bison-1.25</pre>
10096: <p>You can now use bison, and also - if you decide so - remove it with
1.110 hubertf 10097: <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.75 rillig 10098: binary package, do this now:</p>
10099: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1 grant 10100: >> Checksum OK for bison-1.25.tar.gz.
10101: ===> Building package for bison-1.25
10102: Creating package bison-1.25.tgz
10103: Registering depends:.
1.75 rillig 10104: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
10105: <p>Now that you don't need the source and object files
10106: any more, clean up:</p>
10107: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
10108: ===> Cleaning for bison-1.25</pre>
10109: </div>
10110: </div>
1.148 asau 10111: <div class="appendix">
10112: <div class="titlepage"><div><div><h1 class="title">
10113: <a name="logs"></a>Appendix B. Build logs</h1></div></div></div>
1.75 rillig 10114: <div class="toc">
10115: <p><b>Table of Contents</b></p>
1.210 leot 10116: <dl class="toc">
1.75 rillig 10117: <dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
10118: <dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
10119: </dl>
10120: </div>
1.148 asau 10121: <div class="sect1">
1.75 rillig 10122: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10123: <a name="logs.building"></a>B.1. Building figlet</h2></div></div></div>
10124: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1 grant 10125: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10126: => figlet221.tar.gz doesn't seem to exist on this system.
10127: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
10128: => [172219 bytes]
10129: Connected to ftp.plig.net.
10130: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
10131: 331 Guest login ok, send your complete e-mail address as password.
10132: 230-You are user #5 of 500 simultaneous users allowed.
10133: 230-
1.68 rillig 10134: 230- ___ _ _ _
10135: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 10136: 230- | _| _| . |_| . | | | . |_| . | _| . |
10137: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
10138: 230- |_| |_| |___| |___|
10139: 230-
10140: 230-** Welcome to ftp.plig.org **
10141: 230-
10142: 230-Please note that all transfers from this FTP site are logged. If you
10143: 230-do not like this, please disconnect now.
10144: 230-
1.120 snj 10145: 230-This archive is available via
1.1 grant 10146: 230-
10147: 230-HTTP: http://ftp.plig.org/
10148: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
10149: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
10150: 230-
10151: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 10152: 230-mirrored to ftp-admin@plig.org.
1.1 grant 10153: 230-
10154: 230-
10155: 230 Logged in anonymously.
10156: Remote system type is UNIX.
10157: Using binary mode to transfer files.
10158: 200 Type okay.
10159: 250 "/pub" is new cwd.
10160: 250-"/pub/figlet" is new cwd.
10161: 250-
10162: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 10163: 250-
1.75 rillig 10164: 250- ftp://ftp.figlet.org/pub/figlet/
1.1 grant 10165: 250-
10166: 250-The official FIGlet web page is:
1.75 rillig 10167: 250- http://www.figlet.org/
1.1 grant 10168: 250-
10169: 250-If you have questions, please mailto:info@figlet.org. If you want to
10170: 250-contribute a font or something else, you can email us.
1.68 rillig 10171: 250
1.1 grant 10172: 250 "/pub/figlet/program" is new cwd.
10173: 250 "/pub/figlet/program/unix" is new cwd.
10174: local: figlet221.tar.gz remote: figlet221.tar.gz
10175: 502 Unimplemented command.
10176: 227 Entering Passive Mode (195,40,6,41,246,104)
10177: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
10178: 38% |************** | 65800 64.16 KB/s 00:01 ETA
10179: 226 Transfer completed.
10180: 172219 bytes received in 00:02 (75.99 KB/s)
10181: 221 Goodbye.
10182: => Checksum OK for figlet221.tar.gz.
10183: ===> Extracting for figlet-2.2.1nb2
10184: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
10185: ===> Patching for figlet-2.2.1nb2
10186: ===> Applying pkgsrc patches for figlet-2.2.1nb2
10187: ===> Overriding tools for figlet-2.2.1nb2
10188: ===> Creating toolchain wrappers for figlet-2.2.1nb2
10189: ===> Configuring for figlet-2.2.1nb2
10190: ===> Building for figlet-2.2.1nb2
10191: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
10192: chmod a+x figlet
10193: gcc -O2 -o chkfont chkfont.c
10194: => Unwrapping files-to-be-installed.
1.14 xtraeme 10195: <code class="prompt">#</code>
1.75 rillig 10196: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1 grant 10197: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10198: ===> Installing for figlet-2.2.1nb2
10199: install -d -o root -g wheel -m 755 /usr/pkg/bin
10200: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
10201: mkdir -p /usr/pkg/share/figlet
10202: cp figlet /usr/pkg/bin
10203: cp chkfont /usr/pkg/bin
10204: chmod 555 figlist showfigfonts
10205: cp figlist /usr/pkg/bin
10206: cp showfigfonts /usr/pkg/bin
10207: cp fonts/*.flf /usr/pkg/share/figlet
10208: cp fonts/*.flc /usr/pkg/share/figlet
10209: cp figlet.6 /usr/pkg/man/man6
10210: ===> Registering installation for figlet-2.2.1nb2
1.75 rillig 10211: <code class="prompt">#</code></pre>
10212: </div>
1.148 asau 10213: <div class="sect1">
1.75 rillig 10214: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10215: <a name="logs.package"></a>B.2. Packaging figlet</h2></div></div></div>
10216: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1 grant 10217: ===> Checking for vulnerabilities in figlet-2.2.1nb2
10218: ===> Packaging figlet-2.2.1nb2
10219: ===> Building binary package for figlet-2.2.1nb2
10220: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
10221: Using SrcDir value of /usr/pkg
1.68 rillig 10222: Registering depends:.
1.75 rillig 10223: <code class="prompt">#</code></pre>
10224: </div>
10225: </div>
1.148 asau 10226: <div class="appendix">
10227: <div class="titlepage"><div><div><h1 class="title">
10228: <a name="ftp-layout"></a>Appendix C. Directory layout of the pkgsrc FTP server</h1></div></div></div>
1.76 rillig 10229: <div class="toc">
10230: <p><b>Table of Contents</b></p>
1.210 leot 10231: <dl class="toc">
1.128 wiz 10232: <dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
10233: <dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
10234: <dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
10235: <dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
10236: <dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
1.261 leot 10237: <code class="filename">stable</code>,
1.128 wiz 10238: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 10239: source packages</a></span></dt>
10240: </dl>
10241: </div>
10242: <p>As in other big projects, the directory layout of pkgsrc
10243: is quite complex for newbies. This chapter explains where you
10244: find things on the FTP server. The base directory on
1.110 hubertf 10245: <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 10246: On other servers it may be different, but inside this directory,
10247: everything should look the same, no matter on which server you
10248: are. This directory contains some subdirectories, which are
10249: explained below.</p>
1.148 asau 10250: <div class="sect1">
1.76 rillig 10251: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10252: <a name="ftp-distfiles"></a>C.1. <code class="filename">distfiles</code>: The distributed source files</h2></div></div></div>
1.76 rillig 10253: <p>The directory <code class="filename">distfiles</code> contains lots
10254: of archive files from all pkgsrc packages, which are mirrored
10255: here. The subdirectories are called after their package names
10256: and are used when the distributed files have names that don't
10257: explicitly contain a version number or are otherwise too generic
10258: (for example <code class="filename">release.tar.gz</code>).</p>
10259: </div>
1.148 asau 10260: <div class="sect1">
1.76 rillig 10261: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10262: <a name="ftp-misc"></a>C.2. <code class="filename">misc</code>: Miscellaneous things</h2></div></div></div>
1.76 rillig 10263: <p>This directory contains things that individual pkgsrc
10264: developers find worth publishing.</p>
10265: </div>
1.148 asau 10266: <div class="sect1">
1.76 rillig 10267: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10268: <a name="ftp-packages"></a>C.3. <code class="filename">packages</code>: Binary packages</h2></div></div></div>
1.102 rillig 10269: <p>This directory contains binary packages for the various
10270: platforms that are supported by pkgsrc.
10271: 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 10272: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 10273: <li class="listitem"><p><code class="varname">OPSYS</code> is the name of the
1.109 rillig 10274: operating system for which the packages have been built. The
1.110 hubertf 10275: name is taken from the output of the <span class="command"><strong>uname</strong></span>
1.109 rillig 10276: command, so it may differ from the one you are used to
10277: hear.</p></li>
1.128 wiz 10278: <li class="listitem"><p><code class="varname">ARCH</code> is the hardware
1.108 rillig 10279: architecture of the platform for which the packages have been
1.110 hubertf 10280: built. It also includes the <code class="varname">ABI</code> (Application
10281: Binary Interface) for platforms that have several of
10282: them.</p></li>
1.128 wiz 10283: <li class="listitem"><p><code class="varname">OSVERSION</code> is the version of
1.108 rillig 10284: the operating system. For version numbers that change often (for
10285: example NetBSD-current), the often-changing part should be
10286: replaced with an <code class="literal">x</code>, for example
10287: <code class="literal">4.99.x</code>.</p></li>
1.128 wiz 10288: <li class="listitem"><p><code class="varname">TAG</code> is either
1.126 jakllsch 10289: <code class="literal">20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
1.108 rillig 10290: for a stable branch, or <code class="literal">head</code> for packages
10291: built from the HEAD branch. The latter should only be used when
10292: the packages are updated on a regular basis. Otherwise the date
10293: from checking out pkgsrc should be appended, for example
10294: <code class="literal">head_20071015</code>.</p></li>
1.102 rillig 10295: </ul></div>
10296: <p>The rationale for exactly this scheme is that the pkgsrc users looking for binary packages
10297: can quickly click through the directories on the
10298: server and find the best binary packages for their machines. Since they
10299: usually know the operating system and the hardware architecture, OPSYS
10300: and ARCH are placed first. After these choices, they can select the
10301: best combination of OSVERSION and TAG together, since it is usually the
10302: case that packages stay compatible between different version of the
10303: operating system.</p>
10304: <p>In each of these directories, there is a
10305: whole binary packages collection for a specific platform. It has a directory called
1.76 rillig 10306: <code class="filename">All</code> which contains all binary packages.
10307: Besides that, there are various category directories that
10308: contain symbolic links to the real binary packages.</p>
10309: </div>
1.148 asau 10310: <div class="sect1">
1.76 rillig 10311: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10312: <a name="ftp-reports"></a>C.4. <code class="filename">reports</code>: Bulk build reports</h2></div></div></div>
1.108 rillig 10313: <p>Here are the reports from bulk builds, for those who want
10314: to fix packages that didn't build on some of the platforms. The
1.128 wiz 10315: 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 10316: </div>
1.148 asau 10317: <div class="sect1">
1.108 rillig 10318: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.126 jakllsch 10319: <a name="ftp-source"></a>C.5. <code class="filename">current</code>,
1.261 leot 10320: <code class="filename">stable</code>,
1.126 jakllsch 10321: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 10322: source packages</h2></div></div></div>
1.128 wiz 10323: <p>These directories contain the <span class="quote">“<span class="quote">real</span>”</span> pkgsrc,
1.76 rillig 10324: that is the files that define how to create binary packages from
10325: source archives.</p>
1.262 leot 10326: <p>Each of the <code class="filename">current</code>,
10327: <code class="filename">stable</code> and
10328: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
10329: directories share the same structure. They each contain a
10330: <code class="filename">pkgsrc</code> directory and
10331: <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> file.</p>
1.76 rillig 10332: <p>The directory <code class="filename">pkgsrc</code> contains a
1.89 rillig 10333: snapshot of the CVS repository, which is updated regularly. The
1.262 leot 10334: file <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> contains the same
10335: as the directory, ready to be downloaded as a whole.</p>
10336: <p>The <code class="filename">current</code> directory contains files
10337: related to the HEAD branch of the CVS repository.
10338: In this directory there is an additional file called
10339: <code class="filename">pkgsrc-readmes.tar.{bz,gz,xz}</code> that contains
10340: all pkgsrc <code class="filename">README</code>s with information about
10341: categories and packages.
10342: </p>
10343: <p>The <code class="filename">stable</code> directory is a symlink to
10344: the latest
10345: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
10346: </p>
10347: <p>The
10348: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
10349: directories contain files related to the
10350: <code class="filename">-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
10351: stable branch of the CVS repository. In these directories there is
10352: an additional file called
10353: <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 10354: which contains the state of pkgsrc when it was branched.</p>
10355: </div>
1.75 rillig 10356: </div>
1.148 asau 10357: <div class="appendix">
10358: <div class="titlepage"><div><div><h1 class="title">
1.267 ! rillig 10359: <a name="help-topics"></a>Appendix D. Help topics</h1></div></div></div>
! 10360: <p>
! 10361: The following list contains all help topics that are available
! 10362: when running <span class="command"><strong>bmake help topic=:index</strong></span>.
! 10363: </p>
! 10364: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
! 10365: <li class="listitem"><p>#!</p></li>
! 10366: <li class="listitem"><p>-lintl</p></li>
! 10367: <li class="listitem"><p>64bit</p></li>
! 10368: <li class="listitem"><p>ABI</p></li>
! 10369: <li class="listitem"><p>ACCEPTABLE_LICENSES</p></li>
! 10370: <li class="listitem"><p>ACROREAD_FONTPATH</p></li>
! 10371: <li class="listitem"><p>ADDITIONAL</p></li>
! 10372: <li class="listitem"><p>AFAIK</p></li>
! 10373: <li class="listitem"><p>AIX</p></li>
! 10374: <li class="listitem"><p>ALLOW_VULNERABLE_PACKAGES</p></li>
! 10375: <li class="listitem"><p>ALL_ENV</p></li>
! 10376: <li class="listitem"><p>ALSA_PC</p></li>
! 10377: <li class="listitem"><p>ALTERNATIVES_SRC</p></li>
! 10378: <li class="listitem"><p>AMANDA_TMP</p></li>
! 10379: <li class="listitem"><p>AMANDA_USER</p></li>
! 10380: <li class="listitem"><p>AMANDA_VAR</p></li>
! 10381: <li class="listitem"><p>APACHE_GROUP</p></li>
! 10382: <li class="listitem"><p>APACHE_MODULE_NAME</p></li>
! 10383: <li class="listitem"><p>APACHE_MODULE_SRC</p></li>
! 10384: <li class="listitem"><p>APACHE_MODULE_SRCDIR</p></li>
! 10385: <li class="listitem"><p>APACHE_PKG_PREFIX</p></li>
! 10386: <li class="listitem"><p>APACHE_SUEXEC_CONFIGURE_ARGS</p></li>
! 10387: <li class="listitem"><p>APACHE_SUEXEC_DOCROOT</p></li>
! 10388: <li class="listitem"><p>APACHE_USER</p></li>
! 10389: <li class="listitem"><p>APPEND_ABI</p></li>
! 10390: <li class="listitem"><p>APPEND_ELF</p></li>
! 10391: <li class="listitem"><p>ARLA_CACHE</p></li>
! 10392: <li class="listitem"><p>AUDIT_PACKAGES_FLAGS</p></li>
! 10393: <li class="listitem"><p>AUTOCONF_REQD</p></li>
! 10394: <li class="listitem"><p>AUTOMAKE_OVERRIDE</p></li>
! 10395: <li class="listitem"><p>AUTOMAKE_REQD</p></li>
! 10396: <li class="listitem"><p>AUTO_MKDIRS</p></li>
! 10397: <li class="listitem"><p>BDB185_DEFAULT</p></li>
! 10398: <li class="listitem"><p>BDBBASE</p></li>
! 10399: <li class="listitem"><p>BDB_ACCEPTED</p></li>
! 10400: <li class="listitem"><p>BDB_DEFAULT</p></li>
! 10401: <li class="listitem"><p>BDB_LIBS</p></li>
! 10402: <li class="listitem"><p>BDB_TYPE</p></li>
! 10403: <li class="listitem"><p>BIND_DIR</p></li>
! 10404: <li class="listitem"><p>BIND_GROUP</p></li>
! 10405: <li class="listitem"><p>BIND_USER</p></li>
! 10406: <li class="listitem"><p>BINPKG_SITES</p></li>
! 10407: <li class="listitem"><p>BIN_INSTALL_FLAGS</p></li>
! 10408: <li class="listitem"><p>BISON_PKGDATADIR</p></li>
! 10409: <li class="listitem"><p>BOOTSTRAP_DEPENDS</p></li>
! 10410: <li class="listitem"><p>BOOTSTRAP_SETUPTOOLS</p></li>
! 10411: <li class="listitem"><p>BROKEN</p></li>
! 10412: <li class="listitem"><p>BROKEN_EXCEPT_ON_PLATFORM</p></li>
! 10413: <li class="listitem"><p>BROKEN_ON_PLATFORM</p></li>
! 10414: <li class="listitem"><p>BSDSRCDIR</p></li>
! 10415: <li class="listitem"><p>BSDXSRCDIR</p></li>
! 10416: <li class="listitem"><p>BSD_MAKE_ENV</p></li>
! 10417: <li class="listitem"><p>BUILDLINK_AUTO_DIRS</p></li>
! 10418: <li class="listitem"><p>BUILDLINK_AUTO_VARS</p></li>
! 10419: <li class="listitem"><p>BUILDLINK_CFLAGS</p></li>
! 10420: <li class="listitem"><p>BUILDLINK_CONTENTS_FILTER</p></li>
! 10421: <li class="listitem"><p>BUILDLINK_CPPFLAGS</p></li>
! 10422: <li class="listitem"><p>BUILDLINK_DEPMETHOD</p></li>
! 10423: <li class="listitem"><p>BUILDLINK_FILES</p></li>
! 10424: <li class="listitem"><p>BUILDLINK_FILES_CMD</p></li>
! 10425: <li class="listitem"><p>BUILDLINK_FNAME_TRANSFORM</p></li>
! 10426: <li class="listitem"><p>BUILDLINK_LDFLAGS</p></li>
! 10427: <li class="listitem"><p>BUILDLINK_LIBS</p></li>
! 10428: <li class="listitem"><p>BUILDLINK_OPSYS_SUPPORT_PTHREAD</p></li>
! 10429: <li class="listitem"><p>BUILDLINK_PKGNAME</p></li>
! 10430: <li class="listitem"><p>BUILDLINK_PREFIX</p></li>
! 10431: <li class="listitem"><p>BUILDLINK_RPATHDIRS</p></li>
! 10432: <li class="listitem"><p>BUILDLINK_TREE</p></li>
! 10433: <li class="listitem"><p>BUILD_DEFS</p></li>
! 10434: <li class="listitem"><p>BUILD_DEFS_EFFECTS</p></li>
! 10435: <li class="listitem"><p>BUILD_DIRS</p></li>
! 10436: <li class="listitem"><p>BUILD_ENV_SHELL</p></li>
! 10437: <li class="listitem"><p>BUILD_MAKE_CMD</p></li>
! 10438: <li class="listitem"><p>BUILD_MAKE_FLAGS</p></li>
! 10439: <li class="listitem"><p>BUILD_TARGET</p></li>
! 10440: <li class="listitem"><p>BUILTIN_FIND_FILES</p></li>
! 10441: <li class="listitem"><p>BUILTIN_FIND_FILES_VAR</p></li>
! 10442: <li class="listitem"><p>BUILTIN_FIND_GREP</p></li>
! 10443: <li class="listitem"><p>BUILTIN_FIND_HEADERS</p></li>
! 10444: <li class="listitem"><p>BUILTIN_FIND_HEADERS_VAR</p></li>
! 10445: <li class="listitem"><p>BUILTIN_PKG</p></li>
! 10446: <li class="listitem"><p>BUILTIN_TEST_CURSES_DEFINES</p></li>
! 10447: <li class="listitem"><p>BUILTIN_TEST_CURSES_FUNCS</p></li>
! 10448: <li class="listitem"><p>BUILTIN_VERSION_SCRIPT</p></li>
! 10449: <li class="listitem"><p>BUILTIN_X11_TYPE</p></li>
! 10450: <li class="listitem"><p>BUILTIN_X11_VERSION</p></li>
! 10451: <li class="listitem"><p>CACTI_GROUP</p></li>
! 10452: <li class="listitem"><p>CACTI_USER</p></li>
! 10453: <li class="listitem"><p>CANNA_GROUP</p></li>
! 10454: <li class="listitem"><p>CANNA_USER</p></li>
! 10455: <li class="listitem"><p>CAT</p></li>
! 10456: <li class="listitem"><p>CCACHE_BASE</p></li>
! 10457: <li class="listitem"><p>CCACHE_DIR</p></li>
! 10458: <li class="listitem"><p>CCACHE_LOGFILE</p></li>
! 10459: <li class="listitem"><p>CC_VERSION</p></li>
! 10460: <li class="listitem"><p>CC_VERSION_STRING</p></li>
! 10461: <li class="listitem"><p>CDRECORD_CONF</p></li>
! 10462: <li class="listitem"><p>CDROM_PKG_URL_DIR</p></li>
! 10463: <li class="listitem"><p>CDROM_PKG_URL_HOST</p></li>
! 10464: <li class="listitem"><p>CHECKOUT_DATE</p></li>
! 10465: <li class="listitem"><p>CHECK_FAKEHOME</p></li>
! 10466: <li class="listitem"><p>CHECK_FILES</p></li>
! 10467: <li class="listitem"><p>CHECK_FILES_SKIP</p></li>
! 10468: <li class="listitem"><p>CHECK_FILES_STRICT</p></li>
! 10469: <li class="listitem"><p>CHECK_HEADERS</p></li>
! 10470: <li class="listitem"><p>CHECK_HEADERS_SKIP</p></li>
! 10471: <li class="listitem"><p>CHECK_INTERPRETER</p></li>
! 10472: <li class="listitem"><p>CHECK_INTERPRETER_SKIP</p></li>
! 10473: <li class="listitem"><p>CHECK_PERMS</p></li>
! 10474: <li class="listitem"><p>CHECK_PERMS_AUTOFIX</p></li>
! 10475: <li class="listitem"><p>CHECK_PERMS_SKIP</p></li>
! 10476: <li class="listitem"><p>CHECK_PORTABILITY</p></li>
! 10477: <li class="listitem"><p>CHECK_PORTABILITY_SKIP</p></li>
! 10478: <li class="listitem"><p>CHECK_RELRO</p></li>
! 10479: <li class="listitem"><p>CHECK_RELRO_SKIP</p></li>
! 10480: <li class="listitem"><p>CHECK_RELRO_SUPPORTED</p></li>
! 10481: <li class="listitem"><p>CHECK_SHLIBS</p></li>
! 10482: <li class="listitem"><p>CHECK_SHLIBS_BLACKLIST</p></li>
! 10483: <li class="listitem"><p>CHECK_SHLIBS_SKIP</p></li>
! 10484: <li class="listitem"><p>CHECK_SHLIBS_SUPPORTED</p></li>
! 10485: <li class="listitem"><p>CHECK_SSP</p></li>
! 10486: <li class="listitem"><p>CHECK_SSP_SKIP</p></li>
! 10487: <li class="listitem"><p>CHECK_SSP_SUPPORTED</p></li>
! 10488: <li class="listitem"><p>CHECK_STRIPPED</p></li>
! 10489: <li class="listitem"><p>CHECK_STRIPPED_SKIP</p></li>
! 10490: <li class="listitem"><p>CHECK_WRKREF</p></li>
! 10491: <li class="listitem"><p>CHECK_WRKREF_EXTRA_DIRS</p></li>
! 10492: <li class="listitem"><p>CHECK_WRKREF_SKIP</p></li>
! 10493: <li class="listitem"><p>CLAMAV_DBDIR</p></li>
! 10494: <li class="listitem"><p>CLAMAV_GROUP</p></li>
! 10495: <li class="listitem"><p>CLAMAV_USER</p></li>
! 10496: <li class="listitem"><p>CLANGBASE</p></li>
! 10497: <li class="listitem"><p>CLEANDEPENDS</p></li>
! 10498: <li class="listitem"><p>CMAKE_DEPENDENCIES_REWRITE</p></li>
! 10499: <li class="listitem"><p>CMAKE_INSTALL_PREFIX</p></li>
! 10500: <li class="listitem"><p>CMAKE_MODULE_PATH_OVERRIDE</p></li>
! 10501: <li class="listitem"><p>CMAKE_PKGSRC_BUILD_FLAGS</p></li>
! 10502: <li class="listitem"><p>CMAKE_PREFIX_PATH</p></li>
! 10503: <li class="listitem"><p>CMAKE_USE_GNU_INSTALL_DIRS</p></li>
! 10504: <li class="listitem"><p>COMMON_LISP_DOCFILES</p></li>
! 10505: <li class="listitem"><p>COMMON_LISP_EXAMPLES</p></li>
! 10506: <li class="listitem"><p>COMMON_LISP_EXTRAFILES</p></li>
! 10507: <li class="listitem"><p>COMMON_LISP_PACKAGES</p></li>
! 10508: <li class="listitem"><p>COMMON_LISP_SYSTEM</p></li>
! 10509: <li class="listitem"><p>COMPILER_RPATH_FLAG</p></li>
! 10510: <li class="listitem"><p>COMPILER_USE_SYMLINKS</p></li>
! 10511: <li class="listitem"><p>CONFIGURE_ARGS</p></li>
! 10512: <li class="listitem"><p>CONFIGURE_DIRS</p></li>
! 10513: <li class="listitem"><p>CONFIGURE_ENV</p></li>
! 10514: <li class="listitem"><p>CONFIGURE_HAS_INFODIR</p></li>
! 10515: <li class="listitem"><p>CONFIGURE_HAS_MANDIR</p></li>
! 10516: <li class="listitem"><p>CONFIGURE_SCRIPT</p></li>
! 10517: <li class="listitem"><p>CONFIG_SHELL</p></li>
! 10518: <li class="listitem"><p>CONFIG_SHELL_FLAGS</p></li>
! 10519: <li class="listitem"><p>CONF_FILES</p></li>
! 10520: <li class="listitem"><p>CONF_FILES_MODE</p></li>
! 10521: <li class="listitem"><p>CONF_FILES_PERMS</p></li>
! 10522: <li class="listitem"><p>CONSERVER_DEFAULTHOST</p></li>
! 10523: <li class="listitem"><p>CONSERVER_DEFAULTPORT</p></li>
! 10524: <li class="listitem"><p>CP</p></li>
! 10525: <li class="listitem"><p>CPP</p></li>
! 10526: <li class="listitem"><p>CPP_PRECOMP_FLAGS</p></li>
! 10527: <li class="listitem"><p>CREATE_WRKDIR_SYMLINK</p></li>
! 10528: <li class="listitem"><p>CROSSBASE</p></li>
! 10529: <li class="listitem"><p>CTFCONVERT</p></li>
! 10530: <li class="listitem"><p>CTF_FILES_SKIP</p></li>
! 10531: <li class="listitem"><p>CTF_SUPPORTED</p></li>
! 10532: <li class="listitem"><p>CTYPE</p></li>
! 10533: <li class="listitem"><p>CUPS_GROUP</p></li>
! 10534: <li class="listitem"><p>CUPS_SYSTEM_GROUPS</p></li>
! 10535: <li class="listitem"><p>CUPS_USER</p></li>
! 10536: <li class="listitem"><p>CURSES_DEFAULT</p></li>
! 10537: <li class="listitem"><p>CURSES_TYPE</p></li>
! 10538: <li class="listitem"><p>CVS_EXTRACTDIR</p></li>
! 10539: <li class="listitem"><p>CVS_MODULE</p></li>
! 10540: <li class="listitem"><p>CVS_PROJECT</p></li>
! 10541: <li class="listitem"><p>CVS_REPOSITORIES</p></li>
! 10542: <li class="listitem"><p>CVS_ROOT</p></li>
! 10543: <li class="listitem"><p>CVS_ROOT_GNU</p></li>
! 10544: <li class="listitem"><p>CVS_ROOT_NONGNU</p></li>
! 10545: <li class="listitem"><p>CVS_ROOT_SOURCEFORGE</p></li>
! 10546: <li class="listitem"><p>CVS_TAG</p></li>
! 10547: <li class="listitem"><p>CXX</p></li>
! 10548: <li class="listitem"><p>CYRUS_GROUP</p></li>
! 10549: <li class="listitem"><p>CYRUS_IDLE</p></li>
! 10550: <li class="listitem"><p>CYRUS_USER</p></li>
! 10551: <li class="listitem"><p>DAEMONTOOLS_GROUP</p></li>
! 10552: <li class="listitem"><p>DAEMONTOOLS_LOG_USER</p></li>
! 10553: <li class="listitem"><p>DBUS_GROUP</p></li>
! 10554: <li class="listitem"><p>DBUS_USER</p></li>
! 10555: <li class="listitem"><p>DEFANG_GROUP</p></li>
! 10556: <li class="listitem"><p>DEFANG_USER</p></li>
! 10557: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES</p></li>
! 10558: <li class="listitem"><p>DEFAULT_DISTFILES</p></li>
! 10559: <li class="listitem"><p>DEFAULT_IRC_SERVER</p></li>
! 10560: <li class="listitem"><p>DEFAULT_SERIAL_DEVICE</p></li>
! 10561: <li class="listitem"><p>DEF_UMASK</p></li>
! 10562: <li class="listitem"><p>DEINSTALLDEPENDS</p></li>
! 10563: <li class="listitem"><p>DEINSTALL_SRC</p></li>
! 10564: <li class="listitem"><p>DEINSTALL_TEMPLATES</p></li>
! 10565: <li class="listitem"><p>DELAYED_ERROR_MSG</p></li>
! 10566: <li class="listitem"><p>DELAYED_WARNING_MSG</p></li>
! 10567: <li class="listitem"><p>DEPENDS_TARGET</p></li>
! 10568: <li class="listitem"><p>DEPENDS_TYPE</p></li>
! 10569: <li class="listitem"><p>DESTDIR</p></li>
! 10570: <li class="listitem"><p>DESTDIR_VARNAME</p></li>
! 10571: <li class="listitem"><p>DIALER_GROUP</p></li>
! 10572: <li class="listitem"><p>DIGEST_REQD</p></li>
! 10573: <li class="listitem"><p>DISTDIR</p></li>
! 10574: <li class="listitem"><p>DISTFILES</p></li>
! 10575: <li class="listitem"><p>DISTINFO_FILE</p></li>
! 10576: <li class="listitem"><p>DISTNAME</p></li>
! 10577: <li class="listitem"><p>DIST_PATH</p></li>
! 10578: <li class="listitem"><p>DIST_SUBDIR</p></li>
! 10579: <li class="listitem"><p>DJBDNS_AXFR_USER</p></li>
! 10580: <li class="listitem"><p>DJBDNS_CACHE_USER</p></li>
! 10581: <li class="listitem"><p>DJBDNS_DJBDNS_GROUP</p></li>
! 10582: <li class="listitem"><p>DJBDNS_LOG_USER</p></li>
! 10583: <li class="listitem"><p>DJBDNS_RBL_USER</p></li>
! 10584: <li class="listitem"><p>DJBDNS_TINY_USER</p></li>
! 10585: <li class="listitem"><p>DLOPEN_REQUIRE_PTHREADS</p></li>
! 10586: <li class="listitem"><p>DL_AUTO_VARS</p></li>
! 10587: <li class="listitem"><p>DL_CFLAGS</p></li>
! 10588: <li class="listitem"><p>DL_LDFLAGS</p></li>
! 10589: <li class="listitem"><p>DL_LIBS</p></li>
! 10590: <li class="listitem"><p>DNS</p></li>
! 10591: <li class="listitem"><p>DOWNLOADED_DISTFILE</p></li>
! 10592: <li class="listitem"><p>DT_LAYOUT</p></li>
! 10593: <li class="listitem"><p>DYNAMIC_SITES_CMD</p></li>
! 10594: <li class="listitem"><p>DYNAMIC_SITES_SCRIPT</p></li>
! 10595: <li class="listitem"><p>ECHO</p></li>
! 10596: <li class="listitem"><p>ECHO_N</p></li>
! 10597: <li class="listitem"><p>ELK_GUI</p></li>
! 10598: <li class="listitem"><p>EMACS_TYPE</p></li>
! 10599: <li class="listitem"><p>EMULDIR</p></li>
! 10600: <li class="listitem"><p>EMULSUBDIR</p></li>
! 10601: <li class="listitem"><p>EMULSUBDIRSLASH</p></li>
! 10602: <li class="listitem"><p>EMUL_ARCH</p></li>
! 10603: <li class="listitem"><p>EMUL_DISTRO</p></li>
! 10604: <li class="listitem"><p>EMUL_EXEC_FMT</p></li>
! 10605: <li class="listitem"><p>EMUL_IS_NATIVE</p></li>
! 10606: <li class="listitem"><p>EMUL_MODULES</p></li>
! 10607: <li class="listitem"><p>EMUL_OPSYS</p></li>
! 10608: <li class="listitem"><p>EMUL_PKG_FMT</p></li>
! 10609: <li class="listitem"><p>EMUL_PLATFORM</p></li>
! 10610: <li class="listitem"><p>EMUL_PLATFORMS</p></li>
! 10611: <li class="listitem"><p>EMUL_PREFER</p></li>
! 10612: <li class="listitem"><p>EMUL_REQD</p></li>
! 10613: <li class="listitem"><p>EMUL_TYPE</p></li>
! 10614: <li class="listitem"><p>ERROR_MSG</p></li>
! 10615: <li class="listitem"><p>EXIM_GROUP</p></li>
! 10616: <li class="listitem"><p>EXIM_USER</p></li>
! 10617: <li class="listitem"><p>EXPORT_SYMBOLS_LDFLAGS</p></li>
! 10618: <li class="listitem"><p>EXTRACTOR</p></li>
! 10619: <li class="listitem"><p>EXTRACT_CMD</p></li>
! 10620: <li class="listitem"><p>EXTRACT_CMD_DEFAULT</p></li>
! 10621: <li class="listitem"><p>EXTRACT_DIR</p></li>
! 10622: <li class="listitem"><p>EXTRACT_ELEMENTS</p></li>
! 10623: <li class="listitem"><p>EXTRACT_ENV</p></li>
! 10624: <li class="listitem"><p>EXTRACT_ONLY</p></li>
! 10625: <li class="listitem"><p>EXTRACT_OPTS</p></li>
! 10626: <li class="listitem"><p>EXTRACT_SUFX</p></li>
! 10627: <li class="listitem"><p>EXTRACT_USING</p></li>
! 10628: <li class="listitem"><p>FAILOVER_FETCH</p></li>
! 10629: <li class="listitem"><p>FAIL_MSG</p></li>
! 10630: <li class="listitem"><p>FAKE_NCURSES</p></li>
! 10631: <li class="listitem"><p>FAM</p></li>
! 10632: <li class="listitem"><p>FAM_ACCEPTED</p></li>
! 10633: <li class="listitem"><p>FAM_DEFAULT</p></li>
! 10634: <li class="listitem"><p>FAM_SERVER</p></li>
! 10635: <li class="listitem"><p>FCPATH</p></li>
! 10636: <li class="listitem"><p>FEATURE_CPPFLAGS</p></li>
! 10637: <li class="listitem"><p>FEATURE_LDFLAGS</p></li>
! 10638: <li class="listitem"><p>FEATURE_LIBS</p></li>
! 10639: <li class="listitem"><p>FETCH_AFTER_ARGS</p></li>
! 10640: <li class="listitem"><p>FETCH_BEFORE_ARGS</p></li>
! 10641: <li class="listitem"><p>FETCH_CMD</p></li>
! 10642: <li class="listitem"><p>FETCH_OUTPUT_ARGS</p></li>
! 10643: <li class="listitem"><p>FETCH_PROXY</p></li>
! 10644: <li class="listitem"><p>FETCH_RESUME_ARGS</p></li>
! 10645: <li class="listitem"><p>FETCH_USING</p></li>
! 10646: <li class="listitem"><p>FILES_SUBST</p></li>
! 10647: <li class="listitem"><p>FILES_SUBST_SED</p></li>
! 10648: <li class="listitem"><p>FIX_SYSTEM_HEADERS</p></li>
! 10649: <li class="listitem"><p>FLUXBOX_USE_GNOME</p></li>
! 10650: <li class="listitem"><p>FLUXBOX_USE_KDE</p></li>
! 10651: <li class="listitem"><p>FLUXBOX_USE_XFT</p></li>
! 10652: <li class="listitem"><p>FLUXBOX_USE_XINERAMA</p></li>
! 10653: <li class="listitem"><p>FONTDIR</p></li>
! 10654: <li class="listitem"><p>FONTS_DIRS</p></li>
! 10655: <li class="listitem"><p>FONTS_VERBOSE</p></li>
! 10656: <li class="listitem"><p>FOO_HACKS_MK</p></li>
! 10657: <li class="listitem"><p>FOSSIL_EXTRACTDIR</p></li>
! 10658: <li class="listitem"><p>FOSSIL_REPO</p></li>
! 10659: <li class="listitem"><p>FOSSIL_REPOSITORIES</p></li>
! 10660: <li class="listitem"><p>FOSSIL_VERSION</p></li>
! 10661: <li class="listitem"><p>FOX_USE_XUNICODE</p></li>
! 10662: <li class="listitem"><p>FREEWNN_GROUP</p></li>
! 10663: <li class="listitem"><p>FREEWNN_USER</p></li>
! 10664: <li class="listitem"><p>FTP_PKG_URL_DIR</p></li>
! 10665: <li class="listitem"><p>FTP_PKG_URL_HOST</p></li>
! 10666: <li class="listitem"><p>GAMEDATAMODE</p></li>
! 10667: <li class="listitem"><p>GAMEDATA_PERMS</p></li>
! 10668: <li class="listitem"><p>GAMEDIRMODE</p></li>
! 10669: <li class="listitem"><p>GAMEDIR_PERMS</p></li>
! 10670: <li class="listitem"><p>GAMEGRP</p></li>
! 10671: <li class="listitem"><p>GAMEMODE</p></li>
! 10672: <li class="listitem"><p>GAMEOWN</p></li>
! 10673: <li class="listitem"><p>GAMES_GROUP</p></li>
! 10674: <li class="listitem"><p>GAMES_USER</p></li>
! 10675: <li class="listitem"><p>GCC</p></li>
! 10676: <li class="listitem"><p>GCCBASE</p></li>
! 10677: <li class="listitem"><p>GCC_REQD</p></li>
! 10678: <li class="listitem"><p>GCC_VERSION_SUFFIX</p></li>
! 10679: <li class="listitem"><p>GEM_BUILD</p></li>
! 10680: <li class="listitem"><p>GEM_CLEANBUILD</p></li>
! 10681: <li class="listitem"><p>GEM_CLEANBUILD_EXTENSIONS</p></li>
! 10682: <li class="listitem"><p>GEM_DOCDIR</p></li>
! 10683: <li class="listitem"><p>GEM_EXTSDIR</p></li>
! 10684: <li class="listitem"><p>GEM_HOME</p></li>
! 10685: <li class="listitem"><p>GEM_LIBDIR</p></li>
! 10686: <li class="listitem"><p>GEM_NAME</p></li>
! 10687: <li class="listitem"><p>GEM_PATH</p></li>
! 10688: <li class="listitem"><p>GEM_SPECFILE</p></li>
! 10689: <li class="listitem"><p>GENERATE_PLIST</p></li>
! 10690: <li class="listitem"><p>GHOSTSCRIPT_REQD</p></li>
! 10691: <li class="listitem"><p>GITHUB_PROJECT</p></li>
! 10692: <li class="listitem"><p>GITHUB_RELEASE</p></li>
! 10693: <li class="listitem"><p>GITHUB_TAG</p></li>
! 10694: <li class="listitem"><p>GITHUB_TYPE</p></li>
! 10695: <li class="listitem"><p>GIT_BRANCH</p></li>
! 10696: <li class="listitem"><p>GIT_ENV</p></li>
! 10697: <li class="listitem"><p>GIT_EXTRACTDIR</p></li>
! 10698: <li class="listitem"><p>GIT_REPO</p></li>
! 10699: <li class="listitem"><p>GIT_REPOSITORIES</p></li>
! 10700: <li class="listitem"><p>GIT_REVISION</p></li>
! 10701: <li class="listitem"><p>GIT_TAG</p></li>
! 10702: <li class="listitem"><p>GNU</p></li>
! 10703: <li class="listitem"><p>GNU_CONFIGURE</p></li>
! 10704: <li class="listitem"><p>GNU_CONFIGURE_INFODIR</p></li>
! 10705: <li class="listitem"><p>GNU_CONFIGURE_MANDIR</p></li>
! 10706: <li class="listitem"><p>GNU_CONFIGURE_STRICT</p></li>
! 10707: <li class="listitem"><p>GO_BUILD_PATTERN</p></li>
! 10708: <li class="listitem"><p>GO_DIST_BASE</p></li>
! 10709: <li class="listitem"><p>GO_SRCPATH</p></li>
! 10710: <li class="listitem"><p>GROUP_SPECIFIC_PKGS</p></li>
! 10711: <li class="listitem"><p>GRUB_NETWORK_CARDS</p></li>
! 10712: <li class="listitem"><p>GRUB_PRESET_COMMAND</p></li>
! 10713: <li class="listitem"><p>GRUB_SCAN_ARGS</p></li>
! 10714: <li class="listitem"><p>GZIP</p></li>
! 10715: <li class="listitem"><p>HASKELL_COMPILER</p></li>
! 10716: <li class="listitem"><p>HASKELL_ENABLE_HADDOCK_DOCUMENTATION</p></li>
! 10717: <li class="listitem"><p>HASKELL_ENABLE_LIBRARY_PROFILING</p></li>
! 10718: <li class="listitem"><p>HASKELL_ENABLE_SHARED_LIBRARY</p></li>
! 10719: <li class="listitem"><p>HAS_CONFIGURE</p></li>
! 10720: <li class="listitem"><p>HEADER_TEMPLATES</p></li>
! 10721: <li class="listitem"><p>HG_REPO</p></li>
! 10722: <li class="listitem"><p>HG_REPOSITORIES</p></li>
! 10723: <li class="listitem"><p>HG_TAG</p></li>
! 10724: <li class="listitem"><p>HOST_PKGTOOLS_ARGS</p></li>
! 10725: <li class="listitem"><p>HOST_SPECIFIC_PKGS</p></li>
! 10726: <li class="listitem"><p>HOWL_GROUP</p></li>
! 10727: <li class="listitem"><p>HOWL_USER</p></li>
! 10728: <li class="listitem"><p>ICCBASE</p></li>
! 10729: <li class="listitem"><p>ICECAST_CHROOTDIR</p></li>
! 10730: <li class="listitem"><p>ICON_THEMES</p></li>
! 10731: <li class="listitem"><p>IDOBASE</p></li>
! 10732: <li class="listitem"><p>IGNORE_CCACHE</p></li>
! 10733: <li class="listitem"><p>IGNORE_INFO_DIRS</p></li>
! 10734: <li class="listitem"><p>IGNORE_INTERACTIVE_FETCH</p></li>
! 10735: <li class="listitem"><p>IMAKE</p></li>
! 10736: <li class="listitem"><p>IMAKEOPTS</p></li>
! 10737: <li class="listitem"><p>IMAKE_MAKE</p></li>
! 10738: <li class="listitem"><p>IMAKE_MANINSTALL</p></li>
! 10739: <li class="listitem"><p>IMAP_UW_CCLIENT_MBOX_FMT</p></li>
! 10740: <li class="listitem"><p>IMDICTDIR</p></li>
! 10741: <li class="listitem"><p>INCOMPAT_CURSES</p></li>
! 10742: <li class="listitem"><p>INFO_DIR</p></li>
! 10743: <li class="listitem"><p>INFO_FILES</p></li>
! 10744: <li class="listitem"><p>INFO_FILES_VERBOSE</p></li>
! 10745: <li class="listitem"><p>INFO_MSG</p></li>
! 10746: <li class="listitem"><p>INIT_SYSTEM</p></li>
! 10747: <li class="listitem"><p>INN_DATA_DIR</p></li>
! 10748: <li class="listitem"><p>INN_GROUP</p></li>
! 10749: <li class="listitem"><p>INN_USER</p></li>
! 10750: <li class="listitem"><p>INSTALLATION_DIRS</p></li>
! 10751: <li class="listitem"><p>INSTALLATION_DIRS_FROM_PLIST</p></li>
! 10752: <li class="listitem"><p>INSTALL_ENV</p></li>
! 10753: <li class="listitem"><p>INSTALL_SH_OVERRIDE</p></li>
! 10754: <li class="listitem"><p>INSTALL_SRC</p></li>
! 10755: <li class="listitem"><p>INSTALL_TEMPLATES</p></li>
! 10756: <li class="listitem"><p>INSTALL_UNSTRIPPED</p></li>
! 10757: <li class="listitem"><p>IRCD_HYBRID_IRC_GROUP</p></li>
! 10758: <li class="listitem"><p>IRCD_HYBRID_IRC_USER</p></li>
! 10759: <li class="listitem"><p>IRCD_HYBRID_MAXCONN</p></li>
! 10760: <li class="listitem"><p>IRCD_HYBRID_NICLEN</p></li>
! 10761: <li class="listitem"><p>IRCD_HYBRID_SYSLOG_EVENTS</p></li>
! 10762: <li class="listitem"><p>IRCD_HYBRID_SYSLOG_FACILITY</p></li>
! 10763: <li class="listitem"><p>IRCD_HYBRID_TOPICLEN</p></li>
! 10764: <li class="listitem"><p>IRIX</p></li>
! 10765: <li class="listitem"><p>IRRD_USE_PGP</p></li>
! 10766: <li class="listitem"><p>JABBERD_GROUP</p></li>
! 10767: <li class="listitem"><p>JABBERD_LOGDIR</p></li>
! 10768: <li class="listitem"><p>JABBERD_PIDDIR</p></li>
! 10769: <li class="listitem"><p>JABBERD_SPOOLDIR</p></li>
! 10770: <li class="listitem"><p>JABBERD_USER</p></li>
! 10771: <li class="listitem"><p>JAKARTA_HOME</p></li>
! 10772: <li class="listitem"><p>JAVA_APP_PATH</p></li>
! 10773: <li class="listitem"><p>JAVA_APP_TARGETS</p></li>
! 10774: <li class="listitem"><p>JAVA_BINPREFIX</p></li>
! 10775: <li class="listitem"><p>JAVA_CLASSPATH</p></li>
! 10776: <li class="listitem"><p>JAVA_HOME</p></li>
! 10777: <li class="listitem"><p>JAVA_LD_LIBRARY_PATH</p></li>
! 10778: <li class="listitem"><p>JAVA_NAME</p></li>
! 10779: <li class="listitem"><p>JAVA_UNLIMIT</p></li>
! 10780: <li class="listitem"><p>JAVA_WRAPPERS</p></li>
! 10781: <li class="listitem"><p>JPEG_ACCEPTED</p></li>
! 10782: <li class="listitem"><p>JPEG_DEFAULT</p></li>
! 10783: <li class="listitem"><p>KERBEROS</p></li>
! 10784: <li class="listitem"><p>KERMIT_SUID_UUCP</p></li>
! 10785: <li class="listitem"><p>KJS_USE_PCRE</p></li>
! 10786: <li class="listitem"><p>KNEWS_DOMAIN_FILE</p></li>
! 10787: <li class="listitem"><p>KNEWS_DOMAIN_NAME</p></li>
! 10788: <li class="listitem"><p>KRB5_ACCEPTED</p></li>
! 10789: <li class="listitem"><p>KRB5_DEFAULT</p></li>
! 10790: <li class="listitem"><p>LANGUAGES</p></li>
! 10791: <li class="listitem"><p>LATEX2HTML_ICONPATH</p></li>
! 10792: <li class="listitem"><p>LDCONFIG_ADD_CMD</p></li>
! 10793: <li class="listitem"><p>LDCONFIG_REMOVE_CMD</p></li>
! 10794: <li class="listitem"><p>LEAFNODE_DATA_DIR</p></li>
! 10795: <li class="listitem"><p>LEAFNODE_GROUP</p></li>
! 10796: <li class="listitem"><p>LEAFNODE_USER</p></li>
! 10797: <li class="listitem"><p>LIBDVDCSS_HOMEPAGE</p></li>
! 10798: <li class="listitem"><p>LIBDVDCSS_MASTER_SITES</p></li>
! 10799: <li class="listitem"><p>LIBTOOL</p></li>
! 10800: <li class="listitem"><p>LIBTOOLIZE_PLIST</p></li>
! 10801: <li class="listitem"><p>LIBTOOL_M4_OVERRIDE</p></li>
! 10802: <li class="listitem"><p>LIBUSB_TYPE</p></li>
! 10803: <li class="listitem"><p>LICENSE</p></li>
! 10804: <li class="listitem"><p>LINKER_RPATH_FLAG</p></li>
! 10805: <li class="listitem"><p>LINK_RPATH_FLAG</p></li>
! 10806: <li class="listitem"><p>LINUX_BASE_NODEPS</p></li>
! 10807: <li class="listitem"><p>LINUX_BASE_PREFERRED</p></li>
! 10808: <li class="listitem"><p>LINUX_BASE_REQUIRED</p></li>
! 10809: <li class="listitem"><p>LINUX_LOCALES</p></li>
! 10810: <li class="listitem"><p>LOCALBASE</p></li>
! 10811: <li class="listitem"><p>LOCALBASE_LOCKTYPE</p></li>
! 10812: <li class="listitem"><p>LOCALPATCHES</p></li>
! 10813: <li class="listitem"><p>LOVE_DATA</p></li>
! 10814: <li class="listitem"><p>LOVE_GAME</p></li>
! 10815: <li class="listitem"><p>LOVE_VERSION</p></li>
! 10816: <li class="listitem"><p>LP64PLATFORMS</p></li>
! 10817: <li class="listitem"><p>MACHINE_PLATFORM</p></li>
! 10818: <li class="listitem"><p>MAILAGENT_DOMAIN</p></li>
! 10819: <li class="listitem"><p>MAILAGENT_EMAIL</p></li>
! 10820: <li class="listitem"><p>MAILAGENT_FQDN</p></li>
! 10821: <li class="listitem"><p>MAILAGENT_ORGANIZATION</p></li>
! 10822: <li class="listitem"><p>MAJORDOMO_HOMEDIR</p></li>
! 10823: <li class="listitem"><p>MAJOR_OS_VERSION</p></li>
! 10824: <li class="listitem"><p>MAKEINFO_ARGS</p></li>
! 10825: <li class="listitem"><p>MAKE_DIRS</p></li>
! 10826: <li class="listitem"><p>MAKE_DIRS_PERMS</p></li>
! 10827: <li class="listitem"><p>MAKE_ENV</p></li>
! 10828: <li class="listitem"><p>MAKE_FILE</p></li>
! 10829: <li class="listitem"><p>MAKE_FLAGS</p></li>
! 10830: <li class="listitem"><p>MAKE_JOBS</p></li>
! 10831: <li class="listitem"><p>MAKE_JOBS_SAFE</p></li>
! 10832: <li class="listitem"><p>MAKE_PROGRAM</p></li>
! 10833: <li class="listitem"><p>MANINSTALL</p></li>
! 10834: <li class="listitem"><p>MANZ</p></li>
! 10835: <li class="listitem"><p>MASTER_SITES</p></li>
! 10836: <li class="listitem"><p>MASTER_SITE_BACKUP</p></li>
! 10837: <li class="listitem"><p>MASTER_SITE_CYGWIN</p></li>
! 10838: <li class="listitem"><p>MASTER_SITE_GNOME</p></li>
! 10839: <li class="listitem"><p>MASTER_SITE_GNU</p></li>
! 10840: <li class="listitem"><p>MASTER_SITE_LOCAL</p></li>
! 10841: <li class="listitem"><p>MASTER_SITE_MOZILLA</p></li>
! 10842: <li class="listitem"><p>MASTER_SITE_OPENOFFICE</p></li>
! 10843: <li class="listitem"><p>MASTER_SITE_OVERRIDE</p></li>
! 10844: <li class="listitem"><p>MASTER_SITE_PERL_CPAN</p></li>
! 10845: <li class="listitem"><p>MASTER_SITE_SUNSITE</p></li>
! 10846: <li class="listitem"><p>MASTER_SITE_SUSE</p></li>
! 10847: <li class="listitem"><p>MASTER_SITE_TEX_CTAN</p></li>
! 10848: <li class="listitem"><p>MASTER_SITE_XCONTRIB</p></li>
! 10849: <li class="listitem"><p>MASTER_SITE_XEMACS</p></li>
! 10850: <li class="listitem"><p>MASTER_SORT</p></li>
! 10851: <li class="listitem"><p>MASTER_SORT_RANDOM</p></li>
! 10852: <li class="listitem"><p>MASTER_SORT_REGEX</p></li>
! 10853: <li class="listitem"><p>MECAB_CHARSET</p></li>
! 10854: <li class="listitem"><p>MEDIATOMB_GROUP</p></li>
! 10855: <li class="listitem"><p>MEDIATOMB_USER</p></li>
! 10856: <li class="listitem"><p>MIPSPROBASE</p></li>
! 10857: <li class="listitem"><p>MIREDO_GROUP</p></li>
! 10858: <li class="listitem"><p>MIREDO_USER</p></li>
! 10859: <li class="listitem"><p>MISSING_FEATURES</p></li>
! 10860: <li class="listitem"><p>MKDIR</p></li>
! 10861: <li class="listitem"><p>MLDONKEY_GROUP</p></li>
! 10862: <li class="listitem"><p>MLDONKEY_HOME</p></li>
! 10863: <li class="listitem"><p>MLDONKEY_USER</p></li>
! 10864: <li class="listitem"><p>MONOTONE_GROUP</p></li>
! 10865: <li class="listitem"><p>MONOTONE_USER</p></li>
! 10866: <li class="listitem"><p>MOTIFBASE</p></li>
! 10867: <li class="listitem"><p>MOTIF_TYPE</p></li>
! 10868: <li class="listitem"><p>MOTIF_TYPE_DEFAULT</p></li>
! 10869: <li class="listitem"><p>MPI_TYPE</p></li>
! 10870: <li class="listitem"><p>MSGFMT_STRIP_MSGCTXT</p></li>
! 10871: <li class="listitem"><p>MSGFMT_STRIP_MSGID_PLURAL</p></li>
! 10872: <li class="listitem"><p>MTOOLS_ENABLE_FLOPPYD</p></li>
! 10873: <li class="listitem"><p>MUST</p></li>
! 10874: <li class="listitem"><p>MV</p></li>
! 10875: <li class="listitem"><p>MYSQL_CHARSET</p></li>
! 10876: <li class="listitem"><p>MYSQL_DATADIR</p></li>
! 10877: <li class="listitem"><p>MYSQL_EXTRA_CHARSET</p></li>
! 10878: <li class="listitem"><p>MYSQL_GROUP</p></li>
! 10879: <li class="listitem"><p>MYSQL_PKGSRCDIR</p></li>
! 10880: <li class="listitem"><p>MYSQL_USER</p></li>
! 10881: <li class="listitem"><p>MYSQL_VERSIONS_ACCEPTED</p></li>
! 10882: <li class="listitem"><p>MYSQL_VERSION_DEFAULT</p></li>
! 10883: <li class="listitem"><p>NAGIOSCMD_GROUP</p></li>
! 10884: <li class="listitem"><p>NAGIOSDIR</p></li>
! 10885: <li class="listitem"><p>NAGIOS_GROUP</p></li>
! 10886: <li class="listitem"><p>NAGIOS_USER</p></li>
! 10887: <li class="listitem"><p>NATIVE_APPEND_ABI</p></li>
! 10888: <li class="listitem"><p>NATIVE_APPEND_ELF</p></li>
! 10889: <li class="listitem"><p>NATIVE_EXEC_FMT</p></li>
! 10890: <li class="listitem"><p>NATIVE_MACHINE_PLATFORM</p></li>
! 10891: <li class="listitem"><p>NATIVE_OBJECT_FMT</p></li>
! 10892: <li class="listitem"><p>NBPAX_PROGRAM_PREFIX</p></li>
! 10893: <li class="listitem"><p>NETBSD_LOGIN_NAME</p></li>
! 10894: <li class="listitem"><p>NMH_EDITOR</p></li>
! 10895: <li class="listitem"><p>NMH_MTA</p></li>
! 10896: <li class="listitem"><p>NMH_PAGER</p></li>
! 10897: <li class="listitem"><p>NOLOGIN</p></li>
! 10898: <li class="listitem"><p>NONZERO_FILESIZE_P</p></li>
! 10899: <li class="listitem"><p>NOTE</p></li>
! 10900: <li class="listitem"><p>NOT_FOR_PLATFORM</p></li>
! 10901: <li class="listitem"><p>NOT_PAX_ASLR_SAFE</p></li>
! 10902: <li class="listitem"><p>NOT_PAX_MPROTECT_SAFE</p></li>
! 10903: <li class="listitem"><p>NO_BUILD</p></li>
! 10904: <li class="listitem"><p>NO_CHECKSUM</p></li>
! 10905: <li class="listitem"><p>NO_CONFIGURE</p></li>
! 10906: <li class="listitem"><p>NO_SKIP</p></li>
! 10907: <li class="listitem"><p>NS_PREFERRED</p></li>
! 10908: <li class="listitem"><p>NULLMAILER_GROUP</p></li>
! 10909: <li class="listitem"><p>NULLMAILER_USER</p></li>
! 10910: <li class="listitem"><p>OASIS</p></li>
! 10911: <li class="listitem"><p>OASIS_BUILD_ARGS</p></li>
! 10912: <li class="listitem"><p>OBJHOSTNAME</p></li>
! 10913: <li class="listitem"><p>OBJMACHINE</p></li>
! 10914: <li class="listitem"><p>OCAML_FINDLIB_DIRS</p></li>
! 10915: <li class="listitem"><p>OCAML_FINDLIB_REGISTER</p></li>
! 10916: <li class="listitem"><p>OCAML_FINDLIB_REGISTER_VERBOSE</p></li>
! 10917: <li class="listitem"><p>OCAML_SITELIBDIR</p></li>
! 10918: <li class="listitem"><p>OCAML_TOPKG_DOCDIR</p></li>
! 10919: <li class="listitem"><p>OCAML_USE_DUNE</p></li>
! 10920: <li class="listitem"><p>OCAML_USE_FINDLIB</p></li>
! 10921: <li class="listitem"><p>OCAML_USE_JBUILDER</p></li>
! 10922: <li class="listitem"><p>OCAML_USE_OASIS</p></li>
! 10923: <li class="listitem"><p>OCAML_USE_OASIS_DYNRUN</p></li>
! 10924: <li class="listitem"><p>OCAML_USE_OPAM</p></li>
! 10925: <li class="listitem"><p>OCAML_USE_OPT_COMPILER</p></li>
! 10926: <li class="listitem"><p>OCAML_USE_TOPKG</p></li>
! 10927: <li class="listitem"><p>OMF</p></li>
! 10928: <li class="listitem"><p>ONLY_FOR_COMPILER</p></li>
! 10929: <li class="listitem"><p>ONLY_FOR_PLATFORM</p></li>
! 10930: <li class="listitem"><p>OPENSSH_CHROOT</p></li>
! 10931: <li class="listitem"><p>OPENSSH_GROUP</p></li>
! 10932: <li class="listitem"><p>OPENSSH_USER</p></li>
! 10933: <li class="listitem"><p>OPSYS</p></li>
! 10934: <li class="listitem"><p>OPSYS_EMULDIR</p></li>
! 10935: <li class="listitem"><p>OSS_TYPE</p></li>
! 10936: <li class="listitem"><p>OSX</p></li>
! 10937: <li class="listitem"><p>OSX_TOLERATE_SDK_SKEW</p></li>
! 10938: <li class="listitem"><p>OS_HAVE_ALSA</p></li>
! 10939: <li class="listitem"><p>OS_HAVE_RCD</p></li>
! 10940: <li class="listitem"><p>OS_VARIANT</p></li>
! 10941: <li class="listitem"><p>OS_VERSION</p></li>
! 10942: <li class="listitem"><p>OTF_FONTS_DIR</p></li>
! 10943: <li class="listitem"><p>OVERRIDE_DIRDEPTH</p></li>
! 10944: <li class="listitem"><p>OVERRIDE_GEMSPEC</p></li>
! 10945: <li class="listitem"><p>OVERRIDE_GNU_CONFIG_SCRIPTS</p></li>
! 10946: <li class="listitem"><p>OVERRIDE_ROCKSPEC</p></li>
! 10947: <li class="listitem"><p>OWN_DIRS</p></li>
! 10948: <li class="listitem"><p>OWN_DIRS_PERMS</p></li>
! 10949: <li class="listitem"><p>P4GROUP</p></li>
! 10950: <li class="listitem"><p>P4PORT</p></li>
! 10951: <li class="listitem"><p>P4ROOT</p></li>
! 10952: <li class="listitem"><p>P4USER</p></li>
! 10953: <li class="listitem"><p>PACKAGES</p></li>
! 10954: <li class="listitem"><p>PALMOS_DEFAULT_SDK</p></li>
! 10955: <li class="listitem"><p>PAMBASE</p></li>
! 10956: <li class="listitem"><p>PAM_DEFAULT</p></li>
! 10957: <li class="listitem"><p>PAPERSIZE</p></li>
! 10958: <li class="listitem"><p>PASSIVE_FETCH</p></li>
! 10959: <li class="listitem"><p>PATCHDIR</p></li>
! 10960: <li class="listitem"><p>PATCHFILES</p></li>
! 10961: <li class="listitem"><p>PATCH_ARGS</p></li>
! 10962: <li class="listitem"><p>PATCH_DEBUG</p></li>
! 10963: <li class="listitem"><p>PATCH_DIST_ARGS</p></li>
! 10964: <li class="listitem"><p>PATCH_DIST_CAT</p></li>
! 10965: <li class="listitem"><p>PATCH_DIST_STRIP</p></li>
! 10966: <li class="listitem"><p>PATCH_FUZZ_FACTOR</p></li>
! 10967: <li class="listitem"><p>PATCH_STRIP</p></li>
! 10968: <li class="listitem"><p>PATH</p></li>
! 10969: <li class="listitem"><p>PCCBASE</p></li>
! 10970: <li class="listitem"><p>PEAR</p></li>
! 10971: <li class="listitem"><p>PEAR_CHANNEL</p></li>
! 10972: <li class="listitem"><p>PEAR_CHANNEL_ALIAS</p></li>
! 10973: <li class="listitem"><p>PEAR_CHANNEL_VERSION</p></li>
! 10974: <li class="listitem"><p>PEAR_CMD</p></li>
! 10975: <li class="listitem"><p>PEAR_LIB</p></li>
! 10976: <li class="listitem"><p>PEAR_PACKAGE_XML</p></li>
! 10977: <li class="listitem"><p>PERL5</p></li>
! 10978: <li class="listitem"><p>PERL5_CONFIGURE</p></li>
! 10979: <li class="listitem"><p>PERL5_CONFIGURE_DIRS</p></li>
! 10980: <li class="listitem"><p>PERL5_LDFLAGS</p></li>
! 10981: <li class="listitem"><p>PERL5_LICENSE</p></li>
! 10982: <li class="listitem"><p>PERL5_MODULE_TYPE</p></li>
! 10983: <li class="listitem"><p>PERL5_PACKLIST</p></li>
! 10984: <li class="listitem"><p>PERL5_PACKLIST_DIR</p></li>
! 10985: <li class="listitem"><p>PERL5_PERLBASE</p></li>
! 10986: <li class="listitem"><p>PERL5_SITEBASE</p></li>
! 10987: <li class="listitem"><p>PERL5_USE_PACKLIST</p></li>
! 10988: <li class="listitem"><p>PERL5_VENDORBASE</p></li>
! 10989: <li class="listitem"><p>PFCTL</p></li>
! 10990: <li class="listitem"><p>PFVAR_H</p></li>
! 10991: <li class="listitem"><p>PF_VERSION</p></li>
! 10992: <li class="listitem"><p>PGGROUP</p></li>
! 10993: <li class="listitem"><p>PGHOME</p></li>
! 10994: <li class="listitem"><p>PGPKGSRCDIR</p></li>
! 10995: <li class="listitem"><p>PGSQL_TYPE</p></li>
! 10996: <li class="listitem"><p>PGSQL_VERSIONS_ACCEPTED</p></li>
! 10997: <li class="listitem"><p>PGSQL_VERSION_DEFAULT</p></li>
! 10998: <li class="listitem"><p>PGUSER</p></li>
! 10999: <li class="listitem"><p>PG_LIB_EXT</p></li>
! 11000: <li class="listitem"><p>PHP</p></li>
! 11001: <li class="listitem"><p>PHPCOMMON_MK</p></li>
! 11002: <li class="listitem"><p>PHPPKGSRCDIR</p></li>
! 11003: <li class="listitem"><p>PHP_BASE_VERS</p></li>
! 11004: <li class="listitem"><p>PHP_CHECK_INSTALLED</p></li>
! 11005: <li class="listitem"><p>PHP_EXTENSION_DIR</p></li>
! 11006: <li class="listitem"><p>PHP_INITIAL_TEENY</p></li>
! 11007: <li class="listitem"><p>PHP_PKG_PREFIX</p></li>
! 11008: <li class="listitem"><p>PHP_VERSION</p></li>
! 11009: <li class="listitem"><p>PHP_VERSIONS_ACCEPTED</p></li>
! 11010: <li class="listitem"><p>PHP_VERSIONS_INCOMPATIBLE</p></li>
! 11011: <li class="listitem"><p>PHP_VERSION_DEFAULT</p></li>
! 11012: <li class="listitem"><p>PHP_VERSION_REQD</p></li>
! 11013: <li class="listitem"><p>PILRC_USE_GTK</p></li>
! 11014: <li class="listitem"><p>PKGCONFIG_BASE</p></li>
! 11015: <li class="listitem"><p>PKGCONFIG_FILE</p></li>
! 11016: <li class="listitem"><p>PKGCONFIG_OVERRIDE</p></li>
! 11017: <li class="listitem"><p>PKGCONFIG_OVERRIDE_STAGE</p></li>
! 11018: <li class="listitem"><p>PKGDIR</p></li>
! 11019: <li class="listitem"><p>PKGGNUDIR</p></li>
! 11020: <li class="listitem"><p>PKGINFODIR</p></li>
! 11021: <li class="listitem"><p>PKGLOCALEDIR</p></li>
! 11022: <li class="listitem"><p>PKGMANDIR</p></li>
! 11023: <li class="listitem"><p>PKGNAME</p></li>
! 11024: <li class="listitem"><p>PKGNAME_REQD</p></li>
! 11025: <li class="listitem"><p>PKGPATH</p></li>
! 11026: <li class="listitem"><p>PKGREVISION</p></li>
! 11027: <li class="listitem"><p>PKGSRC_CHANGES</p></li>
! 11028: <li class="listitem"><p>PKGSRC_COMPILER</p></li>
! 11029: <li class="listitem"><p>PKGSRC_KEEP_BIN_PKGS</p></li>
! 11030: <li class="listitem"><p>PKGSRC_LOCKTYPE</p></li>
! 11031: <li class="listitem"><p>PKGSRC_MAKE_ENV</p></li>
! 11032: <li class="listitem"><p>PKGSRC_MESSAGE_RECIPIENTS</p></li>
! 11033: <li class="listitem"><p>PKGSRC_MKPIE</p></li>
! 11034: <li class="listitem"><p>PKGSRC_MKREPRO</p></li>
! 11035: <li class="listitem"><p>PKGSRC_RUN_TEST</p></li>
! 11036: <li class="listitem"><p>PKGSRC_SETENV</p></li>
! 11037: <li class="listitem"><p>PKGSRC_SLEEPSECS</p></li>
! 11038: <li class="listitem"><p>PKGSRC_TODO</p></li>
! 11039: <li class="listitem"><p>PKGSRC_USE_CTF</p></li>
! 11040: <li class="listitem"><p>PKGSRC_USE_FORTIFY</p></li>
! 11041: <li class="listitem"><p>PKGSRC_USE_RELRO</p></li>
! 11042: <li class="listitem"><p>PKGSRC_USE_SSP</p></li>
! 11043: <li class="listitem"><p>PKGSRC_USE_STACK_CHECK</p></li>
! 11044: <li class="listitem"><p>PKGTASKS_DATAFILE</p></li>
! 11045: <li class="listitem"><p>PKGTOOLS_ARGS</p></li>
! 11046: <li class="listitem"><p>PKGTOOLS_ENV</p></li>
! 11047: <li class="listitem"><p>PKG_ALTERNATIVES</p></li>
! 11048: <li class="listitem"><p>PKG_APACHE</p></li>
! 11049: <li class="listitem"><p>PKG_APACHE_ACCEPTED</p></li>
! 11050: <li class="listitem"><p>PKG_APACHE_DEFAULT</p></li>
! 11051: <li class="listitem"><p>PKG_BEST_EXISTS</p></li>
! 11052: <li class="listitem"><p>PKG_BUILD_OPTIONS</p></li>
! 11053: <li class="listitem"><p>PKG_COMPRESSION</p></li>
! 11054: <li class="listitem"><p>PKG_CONFIG</p></li>
! 11055: <li class="listitem"><p>PKG_CONFIG_PERMS</p></li>
! 11056: <li class="listitem"><p>PKG_CREATE_USERGROUP</p></li>
! 11057: <li class="listitem"><p>PKG_DB_TMPDIR</p></li>
! 11058: <li class="listitem"><p>PKG_DEBUG_LEVEL</p></li>
! 11059: <li class="listitem"><p>PKG_DEFAULT_OPTIONS</p></li>
! 11060: <li class="listitem"><p>PKG_DESTDIR_SUPPORT</p></li>
! 11061: <li class="listitem"><p>PKG_DEVELOPER</p></li>
! 11062: <li class="listitem"><p>PKG_DISABLED_OPTIONS</p></li>
! 11063: <li class="listitem"><p>PKG_FATAL_ERRORS</p></li>
! 11064: <li class="listitem"><p>PKG_FC</p></li>
! 11065: <li class="listitem"><p>PKG_FILELIST_CMD</p></li>
! 11066: <li class="listitem"><p>PKG_GECOS</p></li>
! 11067: <li class="listitem"><p>PKG_GID</p></li>
! 11068: <li class="listitem"><p>PKG_GROUPS</p></li>
! 11069: <li class="listitem"><p>PKG_GROUPS_VARS</p></li>
! 11070: <li class="listitem"><p>PKG_HOME</p></li>
! 11071: <li class="listitem"><p>PKG_INIT_SCRIPTS</p></li>
! 11072: <li class="listitem"><p>PKG_JAVA_HOME</p></li>
! 11073: <li class="listitem"><p>PKG_JVM</p></li>
! 11074: <li class="listitem"><p>PKG_JVMS_ACCEPTED</p></li>
! 11075: <li class="listitem"><p>PKG_JVM_DEFAULT</p></li>
! 11076: <li class="listitem"><p>PKG_LEGACY_OPTIONS</p></li>
! 11077: <li class="listitem"><p>PKG_LIBTOOL</p></li>
! 11078: <li class="listitem"><p>PKG_OPTIONS</p></li>
! 11079: <li class="listitem"><p>PKG_OPTIONS_DEPRECATED_WARNINGS</p></li>
! 11080: <li class="listitem"><p>PKG_OPTIONS_LEGACY_OPTS</p></li>
! 11081: <li class="listitem"><p>PKG_OPTIONS_LEGACY_VARS</p></li>
! 11082: <li class="listitem"><p>PKG_OPTIONS_NONEMPTY_SETS</p></li>
! 11083: <li class="listitem"><p>PKG_OPTIONS_OPTIONAL_GROUPS</p></li>
! 11084: <li class="listitem"><p>PKG_OPTIONS_REQUIRED_GROUPS</p></li>
! 11085: <li class="listitem"><p>PKG_OPTIONS_VAR</p></li>
! 11086: <li class="listitem"><p>PKG_PHP</p></li>
! 11087: <li class="listitem"><p>PKG_PHP_MAJOR_VERS</p></li>
! 11088: <li class="listitem"><p>PKG_PHP_VERSION</p></li>
! 11089: <li class="listitem"><p>PKG_RCD_SCRIPTS</p></li>
! 11090: <li class="listitem"><p>PKG_REFCOUNT_DBDIR</p></li>
! 11091: <li class="listitem"><p>PKG_REGISTER_SHELLS</p></li>
! 11092: <li class="listitem"><p>PKG_RESUME_TRANSFERS</p></li>
! 11093: <li class="listitem"><p>PKG_SHELL</p></li>
! 11094: <li class="listitem"><p>PKG_SUGGESTED_OPTIONS</p></li>
! 11095: <li class="listitem"><p>PKG_SUPPORTED_OPTIONS</p></li>
! 11096: <li class="listitem"><p>PKG_SYSCONFBASE</p></li>
! 11097: <li class="listitem"><p>PKG_SYSCONFBASEDIR</p></li>
! 11098: <li class="listitem"><p>PKG_SYSCONFDIR</p></li>
! 11099: <li class="listitem"><p>PKG_SYSCONFDIR_PERMS</p></li>
! 11100: <li class="listitem"><p>PKG_SYSCONFSUBDIR</p></li>
! 11101: <li class="listitem"><p>PKG_SYSCONFVAR</p></li>
! 11102: <li class="listitem"><p>PKG_TOOLS_BIN</p></li>
! 11103: <li class="listitem"><p>PKG_UID</p></li>
! 11104: <li class="listitem"><p>PKG_UPDATE_FONTS_DB</p></li>
! 11105: <li class="listitem"><p>PKG_USERS</p></li>
! 11106: <li class="listitem"><p>PKG_USERS_VARS</p></li>
! 11107: <li class="listitem"><p>PKG_VERBOSE</p></li>
! 11108: <li class="listitem"><p>PLIST</p></li>
! 11109: <li class="listitem"><p>PLIST_AWK</p></li>
! 11110: <li class="listitem"><p>PLIST_AWK_ENV</p></li>
! 11111: <li class="listitem"><p>PLIST_SRC</p></li>
! 11112: <li class="listitem"><p>PLIST_SUBST</p></li>
! 11113: <li class="listitem"><p>PLIST_TYPE</p></li>
! 11114: <li class="listitem"><p>PLIST_VARS</p></li>
! 11115: <li class="listitem"><p>POPTOP_USE_MPPE</p></li>
! 11116: <li class="listitem"><p>POST_FETCH_HOOK</p></li>
! 11117: <li class="listitem"><p>PREFER</p></li>
! 11118: <li class="listitem"><p>PREFER_NATIVE</p></li>
! 11119: <li class="listitem"><p>PREFER_NATIVE_PTHREADS</p></li>
! 11120: <li class="listitem"><p>PREFER_PKGSRC</p></li>
! 11121: <li class="listitem"><p>PREFIX</p></li>
! 11122: <li class="listitem"><p>PREPEND_PATH</p></li>
! 11123: <li class="listitem"><p>PRE_ROOT_CMD</p></li>
! 11124: <li class="listitem"><p>PRIVILEGED_STAGES</p></li>
! 11125: <li class="listitem"><p>PS</p></li>
! 11126: <li class="listitem"><p>PTHREAD_AUTO_VARS</p></li>
! 11127: <li class="listitem"><p>PTHREAD_CFLAGS</p></li>
! 11128: <li class="listitem"><p>PTHREAD_LDFLAGS</p></li>
! 11129: <li class="listitem"><p>PTHREAD_LIBS</p></li>
! 11130: <li class="listitem"><p>PTHREAD_OPTS</p></li>
! 11131: <li class="listitem"><p>PTHREAD_TYPE</p></li>
! 11132: <li class="listitem"><p>PVM_SSH</p></li>
! 11133: <li class="listitem"><p>PYPKGPREFIX</p></li>
! 11134: <li class="listitem"><p>PYTHON_FOR_BUILD_ONLY</p></li>
! 11135: <li class="listitem"><p>PYTHON_SELF_CONFLICT</p></li>
! 11136: <li class="listitem"><p>PYTHON_VERSIONED_DEPENDENCIES</p></li>
! 11137: <li class="listitem"><p>PYTHON_VERSIONS_ACCEPTED</p></li>
! 11138: <li class="listitem"><p>PYTHON_VERSIONS_INCOMPATIBLE</p></li>
! 11139: <li class="listitem"><p>PYTHON_VERSION_DEFAULT</p></li>
! 11140: <li class="listitem"><p>PYTHON_VERSION_REQD</p></li>
! 11141: <li class="listitem"><p>PYVERSSUFFIX</p></li>
! 11142: <li class="listitem"><p>PY_NO_EGG</p></li>
! 11143: <li class="listitem"><p>QMAILDIR</p></li>
! 11144: <li class="listitem"><p>QMAIL_ALIAS_USER</p></li>
! 11145: <li class="listitem"><p>QMAIL_DAEMON_USER</p></li>
! 11146: <li class="listitem"><p>QMAIL_LOG_USER</p></li>
! 11147: <li class="listitem"><p>QMAIL_NOFILES_GROUP</p></li>
! 11148: <li class="listitem"><p>QMAIL_PASSWD_USER</p></li>
! 11149: <li class="listitem"><p>QMAIL_QMAIL_GROUP</p></li>
! 11150: <li class="listitem"><p>QMAIL_QUEUE_DIR</p></li>
! 11151: <li class="listitem"><p>QMAIL_QUEUE_EXTRA</p></li>
! 11152: <li class="listitem"><p>QMAIL_QUEUE_USER</p></li>
! 11153: <li class="listitem"><p>QMAIL_REMOTE_USER</p></li>
! 11154: <li class="listitem"><p>QMAIL_ROOT_USER</p></li>
! 11155: <li class="listitem"><p>QMAIL_SEND_USER</p></li>
! 11156: <li class="listitem"><p>QPOPPER_FAC</p></li>
! 11157: <li class="listitem"><p>QPOPPER_SPOOL_DIR</p></li>
! 11158: <li class="listitem"><p>QPOPPER_USER</p></li>
! 11159: <li class="listitem"><p>RAKE_NAME</p></li>
! 11160: <li class="listitem"><p>RASMOL_DEPTH</p></li>
! 11161: <li class="listitem"><p>RCD_DIR</p></li>
! 11162: <li class="listitem"><p>RCD_ORDER</p></li>
! 11163: <li class="listitem"><p>RCD_SCRIPTS</p></li>
! 11164: <li class="listitem"><p>RCD_SCRIPTS_DIR</p></li>
! 11165: <li class="listitem"><p>RCD_SCRIPTS_EXAMPLEDIR</p></li>
! 11166: <li class="listitem"><p>RCD_SCRIPTS_MODE</p></li>
! 11167: <li class="listitem"><p>RCD_SCRIPTS_SHELL</p></li>
! 11168: <li class="listitem"><p>RCD_SCRIPT_SRC</p></li>
! 11169: <li class="listitem"><p>RCD_SUBR</p></li>
! 11170: <li class="listitem"><p>RDOC</p></li>
! 11171: <li class="listitem"><p>READLINE_DEFAULT</p></li>
! 11172: <li class="listitem"><p>READLINE_TYPE</p></li>
! 11173: <li class="listitem"><p>REAL_ROOT_GROUP</p></li>
! 11174: <li class="listitem"><p>REAL_ROOT_USER</p></li>
! 11175: <li class="listitem"><p>RECURSIVE_MAKE</p></li>
! 11176: <li class="listitem"><p>RELAY_CTRL_DIR</p></li>
! 11177: <li class="listitem"><p>REPLACE_AWK</p></li>
! 11178: <li class="listitem"><p>REPLACE_BASH</p></li>
! 11179: <li class="listitem"><p>REPLACE_CSH</p></li>
! 11180: <li class="listitem"><p>REPLACE_KSH</p></li>
! 11181: <li class="listitem"><p>REPLACE_PERL</p></li>
! 11182: <li class="listitem"><p>REPLACE_PERL6</p></li>
! 11183: <li class="listitem"><p>REPLACE_PYTHON</p></li>
! 11184: <li class="listitem"><p>REPLACE_RUBY</p></li>
! 11185: <li class="listitem"><p>REPLACE_RUBY_DIRS</p></li>
! 11186: <li class="listitem"><p>REPLACE_RUBY_PAT</p></li>
! 11187: <li class="listitem"><p>REPLACE_SH</p></li>
! 11188: <li class="listitem"><p>REPLACE_TEXLUA</p></li>
! 11189: <li class="listitem"><p>REQD_DIRS</p></li>
! 11190: <li class="listitem"><p>REQD_DIRS_PERMS</p></li>
! 11191: <li class="listitem"><p>REQD_FILES</p></li>
! 11192: <li class="listitem"><p>REQD_FILES_MODE</p></li>
! 11193: <li class="listitem"><p>REQD_FILES_PERMS</p></li>
! 11194: <li class="listitem"><p>RESOLV_AUTO_VARS</p></li>
! 11195: <li class="listitem"><p>RESOLV_LDFLAGS</p></li>
! 11196: <li class="listitem"><p>RESOLV_LIBS</p></li>
! 11197: <li class="listitem"><p>RM</p></li>
! 11198: <li class="listitem"><p>ROCKSPEC_NAME</p></li>
! 11199: <li class="listitem"><p>ROCKSPEC_SPECFILE</p></li>
! 11200: <li class="listitem"><p>ROOT_CMD</p></li>
! 11201: <li class="listitem"><p>ROOT_GROUP</p></li>
! 11202: <li class="listitem"><p>ROOT_USER</p></li>
! 11203: <li class="listitem"><p>RPCGEN</p></li>
! 11204: <li class="listitem"><p>RPM</p></li>
! 11205: <li class="listitem"><p>RPM2PKG_PLIST</p></li>
! 11206: <li class="listitem"><p>RPM2PKG_PREFIX</p></li>
! 11207: <li class="listitem"><p>RPM2PKG_STAGE</p></li>
! 11208: <li class="listitem"><p>RPM2PKG_STRIP</p></li>
! 11209: <li class="listitem"><p>RPM2PKG_SUBPREFIX</p></li>
! 11210: <li class="listitem"><p>RPMFILES</p></li>
! 11211: <li class="listitem"><p>RPMIGNOREPATH</p></li>
! 11212: <li class="listitem"><p>RPM_DB_PREFIX</p></li>
! 11213: <li class="listitem"><p>RSSH_CVS_PATH</p></li>
! 11214: <li class="listitem"><p>RSSH_RDIST_PATH</p></li>
! 11215: <li class="listitem"><p>RSSH_RSYNC_PATH</p></li>
! 11216: <li class="listitem"><p>RSSH_SCP_PATH</p></li>
! 11217: <li class="listitem"><p>RSSH_SFTP_SERVER_PATH</p></li>
! 11218: <li class="listitem"><p>RUBY</p></li>
! 11219: <li class="listitem"><p>RUBYGEM</p></li>
! 11220: <li class="listitem"><p>RUBYGEM_NAME</p></li>
! 11221: <li class="listitem"><p>RUBYGEM_OPTIONS</p></li>
! 11222: <li class="listitem"><p>RUBY_ABI_VERSION</p></li>
! 11223: <li class="listitem"><p>RUBY_ARCH</p></li>
! 11224: <li class="listitem"><p>RUBY_ARCHINC</p></li>
! 11225: <li class="listitem"><p>RUBY_ARCHLIB</p></li>
! 11226: <li class="listitem"><p>RUBY_BASE</p></li>
! 11227: <li class="listitem"><p>RUBY_BASERIDIR</p></li>
! 11228: <li class="listitem"><p>RUBY_BUILD_RDOC</p></li>
! 11229: <li class="listitem"><p>RUBY_BUILD_RI</p></li>
! 11230: <li class="listitem"><p>RUBY_DLEXT</p></li>
! 11231: <li class="listitem"><p>RUBY_DOC</p></li>
! 11232: <li class="listitem"><p>RUBY_DYNAMIC_DIRS</p></li>
! 11233: <li class="listitem"><p>RUBY_EG</p></li>
! 11234: <li class="listitem"><p>RUBY_ENCODING_ARG</p></li>
! 11235: <li class="listitem"><p>RUBY_EXTCONF</p></li>
! 11236: <li class="listitem"><p>RUBY_EXTCONF_CHECK</p></li>
! 11237: <li class="listitem"><p>RUBY_EXTCONF_DEBUG</p></li>
! 11238: <li class="listitem"><p>RUBY_EXTCONF_MAKEFILE</p></li>
! 11239: <li class="listitem"><p>RUBY_GEM_BASE</p></li>
! 11240: <li class="listitem"><p>RUBY_INC</p></li>
! 11241: <li class="listitem"><p>RUBY_LIB</p></li>
! 11242: <li class="listitem"><p>RUBY_LIB_BASE</p></li>
! 11243: <li class="listitem"><p>RUBY_NAME</p></li>
! 11244: <li class="listitem"><p>RUBY_NOVERSION</p></li>
! 11245: <li class="listitem"><p>RUBY_PKGPREFIX</p></li>
! 11246: <li class="listitem"><p>RUBY_RAILS</p></li>
! 11247: <li class="listitem"><p>RUBY_RAILS42_VERSION</p></li>
! 11248: <li class="listitem"><p>RUBY_RAILS51_VERSION</p></li>
! 11249: <li class="listitem"><p>RUBY_RAILS52_VERSION</p></li>
! 11250: <li class="listitem"><p>RUBY_RAILS_ACCEPTED</p></li>
! 11251: <li class="listitem"><p>RUBY_RAILS_DEFAULT</p></li>
! 11252: <li class="listitem"><p>RUBY_RAILS_REQD</p></li>
! 11253: <li class="listitem"><p>RUBY_RAILS_STRICT_DEP</p></li>
! 11254: <li class="listitem"><p>RUBY_RIDIR</p></li>
! 11255: <li class="listitem"><p>RUBY_SETUP</p></li>
! 11256: <li class="listitem"><p>RUBY_SHLIB</p></li>
! 11257: <li class="listitem"><p>RUBY_SHLIBALIAS</p></li>
! 11258: <li class="listitem"><p>RUBY_SHLIBVER</p></li>
! 11259: <li class="listitem"><p>RUBY_SIMPLE_INSTALL</p></li>
! 11260: <li class="listitem"><p>RUBY_SITEARCHLIB</p></li>
! 11261: <li class="listitem"><p>RUBY_SITELIB</p></li>
! 11262: <li class="listitem"><p>RUBY_SITELIB_BASE</p></li>
! 11263: <li class="listitem"><p>RUBY_SITERIDIR</p></li>
! 11264: <li class="listitem"><p>RUBY_SLEXT</p></li>
! 11265: <li class="listitem"><p>RUBY_SRCDIR</p></li>
! 11266: <li class="listitem"><p>RUBY_STATICLIB</p></li>
! 11267: <li class="listitem"><p>RUBY_SUFFIX</p></li>
! 11268: <li class="listitem"><p>RUBY_SYSRIDIR</p></li>
! 11269: <li class="listitem"><p>RUBY_USE_PTHREAD</p></li>
! 11270: <li class="listitem"><p>RUBY_VENDORARCHLIB</p></li>
! 11271: <li class="listitem"><p>RUBY_VENDORLIB</p></li>
! 11272: <li class="listitem"><p>RUBY_VENDORLIB_BASE</p></li>
! 11273: <li class="listitem"><p>RUBY_VER</p></li>
! 11274: <li class="listitem"><p>RUBY_VERSION</p></li>
! 11275: <li class="listitem"><p>RUBY_VERSIONS_ACCEPTED</p></li>
! 11276: <li class="listitem"><p>RUBY_VERSION_DEFAULT</p></li>
! 11277: <li class="listitem"><p>RUBY_VERSION_REQD</p></li>
! 11278: <li class="listitem"><p>RUBY_VER_DIR</p></li>
! 11279: <li class="listitem"><p>RUN</p></li>
! 11280: <li class="listitem"><p>RUN_LDCONFIG</p></li>
! 11281: <li class="listitem"><p>SAWFISH_THEMES</p></li>
! 11282: <li class="listitem"><p>SCO</p></li>
! 11283: <li class="listitem"><p>SCREWS_GROUP</p></li>
! 11284: <li class="listitem"><p>SCREWS_USER</p></li>
! 11285: <li class="listitem"><p>SCRIPTS_ENV</p></li>
! 11286: <li class="listitem"><p>SCROLLKEEPER_DATADIR</p></li>
! 11287: <li class="listitem"><p>SCROLLKEEPER_REBUILDDB</p></li>
! 11288: <li class="listitem"><p>SCROLLKEEPER_UPDATEDB</p></li>
! 11289: <li class="listitem"><p>SDIST_PAWD</p></li>
! 11290: <li class="listitem"><p>SERIAL_DEVICES</p></li>
! 11291: <li class="listitem"><p>SETGIDGAME</p></li>
! 11292: <li class="listitem"><p>SETGID_GAMES_PERMS</p></li>
! 11293: <li class="listitem"><p>SETUID_ROOT_PERMS</p></li>
! 11294: <li class="listitem"><p>SH</p></li>
! 11295: <li class="listitem"><p>SHLIB</p></li>
! 11296: <li class="listitem"><p>SHORTNAME</p></li>
! 11297: <li class="listitem"><p>SIGN_PACKAGES</p></li>
! 11298: <li class="listitem"><p>SILC_CLIENT_WITH_PERL</p></li>
! 11299: <li class="listitem"><p>SITE_SPECIFIC_PKGS</p></li>
! 11300: <li class="listitem"><p>SKIP_DEPENDS</p></li>
! 11301: <li class="listitem"><p>SKIP_PORTABILITY_CHECK</p></li>
! 11302: <li class="listitem"><p>SMF_INSTANCES</p></li>
! 11303: <li class="listitem"><p>SMF_MANIFEST</p></li>
! 11304: <li class="listitem"><p>SMF_METHODS</p></li>
! 11305: <li class="listitem"><p>SMF_METHOD_SHELL</p></li>
! 11306: <li class="listitem"><p>SMF_METHOD_SRC</p></li>
! 11307: <li class="listitem"><p>SMF_NAME</p></li>
! 11308: <li class="listitem"><p>SMF_PREFIX</p></li>
! 11309: <li class="listitem"><p>SMF_SRCDIR</p></li>
! 11310: <li class="listitem"><p>SNIPROXY_GROUP</p></li>
! 11311: <li class="listitem"><p>SNIPROXY_USER</p></li>
! 11312: <li class="listitem"><p>SOURCE_BUFFSIZE</p></li>
! 11313: <li class="listitem"><p>SPECIAL_PERMS</p></li>
! 11314: <li class="listitem"><p>SPECIFIC_PKGS</p></li>
! 11315: <li class="listitem"><p>SSH_SUID</p></li>
! 11316: <li class="listitem"><p>SSYNC_PAWD</p></li>
! 11317: <li class="listitem"><p>STEP_MSG</p></li>
! 11318: <li class="listitem"><p>STRIP</p></li>
! 11319: <li class="listitem"><p>STRIP_DBG</p></li>
! 11320: <li class="listitem"><p>STRIP_DEBUG</p></li>
! 11321: <li class="listitem"><p>STRIP_DEBUG_SUPPORTED</p></li>
! 11322: <li class="listitem"><p>STRIP_FILES_SKIP</p></li>
! 11323: <li class="listitem"><p>SU</p></li>
! 11324: <li class="listitem"><p>SUBDIR</p></li>
! 11325: <li class="listitem"><p>SUBST_CLASSES</p></li>
! 11326: <li class="listitem"><p>SUBST_FILES</p></li>
! 11327: <li class="listitem"><p>SUBST_FILTER_CMD</p></li>
! 11328: <li class="listitem"><p>SUBST_MESSAGE</p></li>
! 11329: <li class="listitem"><p>SUBST_SED</p></li>
! 11330: <li class="listitem"><p>SUBST_SHOW_DIFF</p></li>
! 11331: <li class="listitem"><p>SUBST_SKIP_TEXT_CHECK</p></li>
! 11332: <li class="listitem"><p>SUBST_STAGE</p></li>
! 11333: <li class="listitem"><p>SUBST_VARS</p></li>
! 11334: <li class="listitem"><p>SUNWSPROBASE</p></li>
! 11335: <li class="listitem"><p>SUSE_PREFER</p></li>
! 11336: <li class="listitem"><p>SU_CMD</p></li>
! 11337: <li class="listitem"><p>SVN_EXTRACTDIR</p></li>
! 11338: <li class="listitem"><p>SVN_REPO</p></li>
! 11339: <li class="listitem"><p>SVN_REPOSITORIES</p></li>
! 11340: <li class="listitem"><p>SVN_REVISION</p></li>
! 11341: <li class="listitem"><p>TERMCAP_TYPE</p></li>
! 11342: <li class="listitem"><p>TERMINFO_DEFAULT</p></li>
! 11343: <li class="listitem"><p>TERMINFO_TYPE</p></li>
! 11344: <li class="listitem"><p>TEST</p></li>
! 11345: <li class="listitem"><p>TEST_DIRS</p></li>
! 11346: <li class="listitem"><p>TEST_ENV</p></li>
! 11347: <li class="listitem"><p>TEST_MAKE_CMD</p></li>
! 11348: <li class="listitem"><p>TEST_MAKE_FLAGS</p></li>
! 11349: <li class="listitem"><p>TEST_TARGET</p></li>
! 11350: <li class="listitem"><p>TEXLIVE_IGNORE_PATTERNS</p></li>
! 11351: <li class="listitem"><p>TEXLIVE_REV</p></li>
! 11352: <li class="listitem"><p>TEXMFSITE</p></li>
! 11353: <li class="listitem"><p>TEX_FORMATS</p></li>
! 11354: <li class="listitem"><p>TEX_HYPHEN_DAT</p></li>
! 11355: <li class="listitem"><p>TEX_HYPHEN_DEF</p></li>
! 11356: <li class="listitem"><p>TEX_TEXMF_DIRS</p></li>
! 11357: <li class="listitem"><p>THTTPD_LOG_FACILITY</p></li>
! 11358: <li class="listitem"><p>TO</p></li>
! 11359: <li class="listitem"><p>TOOLS_ALIASES</p></li>
! 11360: <li class="listitem"><p>TOOLS_ARGS</p></li>
! 11361: <li class="listitem"><p>TOOLS_BROKEN</p></li>
! 11362: <li class="listitem"><p>TOOLS_CMD</p></li>
! 11363: <li class="listitem"><p>TOOLS_CREATE</p></li>
! 11364: <li class="listitem"><p>TOOLS_DIR</p></li>
! 11365: <li class="listitem"><p>TOOLS_FAIL</p></li>
! 11366: <li class="listitem"><p>TOOLS_GNU_MISSING</p></li>
! 11367: <li class="listitem"><p>TOOLS_LDCONFIG</p></li>
! 11368: <li class="listitem"><p>TOOLS_NOOP</p></li>
! 11369: <li class="listitem"><p>TOOLS_PATH</p></li>
! 11370: <li class="listitem"><p>TOOLS_SCRIPT</p></li>
! 11371: <li class="listitem"><p>TTF_FONTDIR</p></li>
! 11372: <li class="listitem"><p>TTF_FONTS_DIR</p></li>
! 11373: <li class="listitem"><p>TYPE</p></li>
! 11374: <li class="listitem"><p>UAC_REQD_EXECS</p></li>
! 11375: <li class="listitem"><p>UCSPI_SSL_GROUP</p></li>
! 11376: <li class="listitem"><p>UCSPI_SSL_USER</p></li>
! 11377: <li class="listitem"><p>UNLIMIT_RESOURCES</p></li>
! 11378: <li class="listitem"><p>UNPRIVILEGED</p></li>
! 11379: <li class="listitem"><p>UNPRIVILEGED_GROUP</p></li>
! 11380: <li class="listitem"><p>UNPRIVILEGED_GROUPS</p></li>
! 11381: <li class="listitem"><p>UNPRIVILEGED_USER</p></li>
! 11382: <li class="listitem"><p>UNWRAP_FILES</p></li>
! 11383: <li class="listitem"><p>UNWRAP_PATTERNS</p></li>
! 11384: <li class="listitem"><p>UPDATE_GEMSPEC</p></li>
! 11385: <li class="listitem"><p>UPDATE_TARGET</p></li>
! 11386: <li class="listitem"><p>URI</p></li>
! 11387: <li class="listitem"><p>USA</p></li>
! 11388: <li class="listitem"><p>USERGROUP_PHASE</p></li>
! 11389: <li class="listitem"><p>USERPPP_GROUP</p></li>
! 11390: <li class="listitem"><p>USER_SPECIFIC_PKGS</p></li>
! 11391: <li class="listitem"><p>USE_ABI_DEPENDS</p></li>
! 11392: <li class="listitem"><p>USE_APR</p></li>
! 11393: <li class="listitem"><p>USE_BSD_MAKEFILE</p></li>
! 11394: <li class="listitem"><p>USE_BUILTIN</p></li>
! 11395: <li class="listitem"><p>USE_CROSS_COMPILE</p></li>
! 11396: <li class="listitem"><p>USE_CURSES</p></li>
! 11397: <li class="listitem"><p>USE_CWRAPPERS</p></li>
! 11398: <li class="listitem"><p>USE_DB185</p></li>
! 11399: <li class="listitem"><p>USE_FEATURES</p></li>
! 11400: <li class="listitem"><p>USE_GAMESGROUP</p></li>
! 11401: <li class="listitem"><p>USE_GCC_RUNTIME</p></li>
! 11402: <li class="listitem"><p>USE_IMAKE</p></li>
! 11403: <li class="listitem"><p>USE_JAVA</p></li>
! 11404: <li class="listitem"><p>USE_JAVA2</p></li>
! 11405: <li class="listitem"><p>USE_LANGUAGES</p></li>
! 11406: <li class="listitem"><p>USE_LIBTOOL</p></li>
! 11407: <li class="listitem"><p>USE_NATIVE_GCC</p></li>
! 11408: <li class="listitem"><p>USE_NETBSD_REPO</p></li>
! 11409: <li class="listitem"><p>USE_PKGSRC_GCC</p></li>
! 11410: <li class="listitem"><p>USE_PKGSRC_GCC_RUNTIME</p></li>
! 11411: <li class="listitem"><p>USE_PKGTASKS</p></li>
! 11412: <li class="listitem"><p>USE_RUBY_EXTCONF</p></li>
! 11413: <li class="listitem"><p>USE_RUBY_INSTALL</p></li>
! 11414: <li class="listitem"><p>USE_RUBY_SETUP</p></li>
! 11415: <li class="listitem"><p>USE_RUBY_SETUP_PKG</p></li>
! 11416: <li class="listitem"><p>USE_TOOLS</p></li>
! 11417: <li class="listitem"><p>UUCP_GROUP</p></li>
! 11418: <li class="listitem"><p>UUCP_USER</p></li>
! 11419: <li class="listitem"><p>VARBASE</p></li>
! 11420: <li class="listitem"><p>VARNAME</p></li>
! 11421: <li class="listitem"><p>VIM_EXTRA_OPTS</p></li>
! 11422: <li class="listitem"><p>WARNING_MSG</p></li>
! 11423: <li class="listitem"><p>WCALC_CGIDIR</p></li>
! 11424: <li class="listitem"><p>WCALC_CGIPATH</p></li>
! 11425: <li class="listitem"><p>WCALC_HTMLDIR</p></li>
! 11426: <li class="listitem"><p>WCALC_HTMLPATH</p></li>
! 11427: <li class="listitem"><p>WDM_MANAGERS</p></li>
! 11428: <li class="listitem"><p>WRAPPER_REORDER_CMDS</p></li>
! 11429: <li class="listitem"><p>WRKDIR</p></li>
! 11430: <li class="listitem"><p>WRKDIR_BASENAME</p></li>
! 11431: <li class="listitem"><p>WRKDIR_LOCKTYPE</p></li>
! 11432: <li class="listitem"><p>WRKLOG</p></li>
! 11433: <li class="listitem"><p>WRKOBJDIR</p></li>
! 11434: <li class="listitem"><p>WRKSRC</p></li>
! 11435: <li class="listitem"><p>WXGTK_ACCEPTED</p></li>
! 11436: <li class="listitem"><p>WXGTK_DEFAULT</p></li>
! 11437: <li class="listitem"><p>X10_PORT</p></li>
! 11438: <li class="listitem"><p>X11</p></li>
! 11439: <li class="listitem"><p>X11BASE</p></li>
! 11440: <li class="listitem"><p>X11_PKGSRCDIR</p></li>
! 11441: <li class="listitem"><p>X11_TYPE</p></li>
! 11442: <li class="listitem"><p>X509_CERTIFICATE</p></li>
! 11443: <li class="listitem"><p>X509_KEY</p></li>
! 11444: <li class="listitem"><p>XAW_TYPE</p></li>
! 11445: <li class="listitem"><p>XLOCK_DEFAULT_MODE</p></li>
! 11446: <li class="listitem"><p>XMKMF_FLAGS</p></li>
! 11447: <li class="listitem"><p>XXX</p></li>
! 11448: <li class="listitem"><p>XXXX</p></li>
! 11449: <li class="listitem"><p>YES</p></li>
! 11450: <li class="listitem"><p>ZERO_FILESIZE_P</p></li>
! 11451: <li class="listitem"><p>ZSH_STATIC</p></li>
! 11452: <li class="listitem"><p>__stdc__</p></li>
! 11453: <li class="listitem"><p>_vargroups</p></li>
! 11454: <li class="listitem"><p>add</p></li>
! 11455: <li class="listitem"><p>all</p></li>
! 11456: <li class="listitem"><p>alternatives</p></li>
! 11457: <li class="listitem"><p>aslr</p></li>
! 11458: <li class="listitem"><p>asprintf</p></li>
! 11459: <li class="listitem"><p>autoconf</p></li>
! 11460: <li class="listitem"><p>automake</p></li>
! 11461: <li class="listitem"><p>autoreconf</p></li>
! 11462: <li class="listitem"><p>awk</p></li>
! 11463: <li class="listitem"><p>bash</p></li>
! 11464: <li class="listitem"><p>big-endian</p></li>
! 11465: <li class="listitem"><p>bin-install</p></li>
! 11466: <li class="listitem"><p>binpkg-list</p></li>
! 11467: <li class="listitem"><p>bootstrap-depends</p></li>
! 11468: <li class="listitem"><p>broken</p></li>
! 11469: <li class="listitem"><p>broken_on_platform</p></li>
! 11470: <li class="listitem"><p>build</p></li>
! 11471: <li class="listitem"><p>build-env</p></li>
! 11472: <li class="listitem"><p>buildlink-directories</p></li>
! 11473: <li class="listitem"><p>buildlink-oss-soundcard-h</p></li>
! 11474: <li class="listitem"><p>c</p></li>
! 11475: <li class="listitem"><p>c++</p></li>
! 11476: <li class="listitem"><p>ccache</p></li>
! 11477: <li class="listitem"><p>cce</p></li>
! 11478: <li class="listitem"><p>cdefs</p></li>
! 11479: <li class="listitem"><p>changes</p></li>
! 11480: <li class="listitem"><p>changes-entry</p></li>
! 11481: <li class="listitem"><p>changes-entry-noupdate</p></li>
! 11482: <li class="listitem"><p>check</p></li>
! 11483: <li class="listitem"><p>check-clean</p></li>
! 11484: <li class="listitem"><p>check-files</p></li>
! 11485: <li class="listitem"><p>check-files-clean</p></li>
! 11486: <li class="listitem"><p>check-vulnerable</p></li>
! 11487: <li class="listitem"><p>checksum</p></li>
! 11488: <li class="listitem"><p>checksum-phase</p></li>
! 11489: <li class="listitem"><p>clean</p></li>
! 11490: <li class="listitem"><p>clean-depends</p></li>
! 11491: <li class="listitem"><p>cleandir</p></li>
! 11492: <li class="listitem"><p>commit</p></li>
! 11493: <li class="listitem"><p>commit-changes-entry</p></li>
! 11494: <li class="listitem"><p>compact</p></li>
! 11495: <li class="listitem"><p>compiler</p></li>
! 11496: <li class="listitem"><p>conf</p></li>
! 11497: <li class="listitem"><p>config.guess</p></li>
! 11498: <li class="listitem"><p>config.sub</p></li>
! 11499: <li class="listitem"><p>configuration</p></li>
! 11500: <li class="listitem"><p>configure</p></li>
! 11501: <li class="listitem"><p>configure-help</p></li>
! 11502: <li class="listitem"><p>configure_args</p></li>
! 11503: <li class="listitem"><p>cputime</p></li>
! 11504: <li class="listitem"><p>create-usergroup</p></li>
! 11505: <li class="listitem"><p>csh</p></li>
! 11506: <li class="listitem"><p>ctf</p></li>
! 11507: <li class="listitem"><p>cvs</p></li>
! 11508: <li class="listitem"><p>debug</p></li>
! 11509: <li class="listitem"><p>declaration</p></li>
! 11510: <li class="listitem"><p>declare</p></li>
! 11511: <li class="listitem"><p>defined</p></li>
! 11512: <li class="listitem"><p>depend</p></li>
! 11513: <li class="listitem"><p>dependencies</p></li>
! 11514: <li class="listitem"><p>depends</p></li>
! 11515: <li class="listitem"><p>depends-checksum</p></li>
! 11516: <li class="listitem"><p>depends-fetch</p></li>
! 11517: <li class="listitem"><p>describe</p></li>
! 11518: <li class="listitem"><p>destdir</p></li>
! 11519: <li class="listitem"><p>distclean</p></li>
! 11520: <li class="listitem"><p>distinfo</p></li>
! 11521: <li class="listitem"><p>dl</p></li>
! 11522: <li class="listitem"><p>dlopen</p></li>
! 11523: <li class="listitem"><p>do-build</p></li>
! 11524: <li class="listitem"><p>do-buildlink</p></li>
! 11525: <li class="listitem"><p>do-clean</p></li>
! 11526: <li class="listitem"><p>do-configure-post-hook</p></li>
! 11527: <li class="listitem"><p>do-extract</p></li>
! 11528: <li class="listitem"><p>do-fetch</p></li>
! 11529: <li class="listitem"><p>do-install</p></li>
! 11530: <li class="listitem"><p>emul</p></li>
! 11531: <li class="listitem"><p>emulation</p></li>
! 11532: <li class="listitem"><p>emulator</p></li>
! 11533: <li class="listitem"><p>endian</p></li>
! 11534: <li class="listitem"><p>enomem</p></li>
! 11535: <li class="listitem"><p>err</p></li>
! 11536: <li class="listitem"><p>errx</p></li>
! 11537: <li class="listitem"><p>etc</p></li>
! 11538: <li class="listitem"><p>feature</p></li>
! 11539: <li class="listitem"><p>features</p></li>
! 11540: <li class="listitem"><p>fetch</p></li>
! 11541: <li class="listitem"><p>fetch-list</p></li>
! 11542: <li class="listitem"><p>follows</p></li>
! 11543: <li class="listitem"><p>forbids</p></li>
! 11544: <li class="listitem"><p>form</p></li>
! 11545: <li class="listitem"><p>format</p></li>
! 11546: <li class="listitem"><p>fortify</p></li>
! 11547: <li class="listitem"><p>fortify_source</p></li>
! 11548: <li class="listitem"><p>fossil</p></li>
! 11549: <li class="listitem"><p>friend</p></li>
! 11550: <li class="listitem"><p>from</p></li>
! 11551: <li class="listitem"><p>fts</p></li>
! 11552: <li class="listitem"><p>fts_close</p></li>
! 11553: <li class="listitem"><p>fts_open</p></li>
! 11554: <li class="listitem"><p>fts_read</p></li>
! 11555: <li class="listitem"><p>fts_set</p></li>
! 11556: <li class="listitem"><p>full</p></li>
! 11557: <li class="listitem"><p>gcc</p></li>
! 11558: <li class="listitem"><p>getopt_long</p></li>
! 11559: <li class="listitem"><p>getprogname</p></li>
! 11560: <li class="listitem"><p>gettext</p></li>
! 11561: <li class="listitem"><p>git</p></li>
! 11562: <li class="listitem"><p>github</p></li>
! 11563: <li class="listitem"><p>glob</p></li>
! 11564: <li class="listitem"><p>gnu</p></li>
! 11565: <li class="listitem"><p>go</p></li>
! 11566: <li class="listitem"><p>golang</p></li>
! 11567: <li class="listitem"><p>guess-license</p></li>
! 11568: <li class="listitem"><p>hashbang</p></li>
! 11569: <li class="listitem"><p>heimdal</p></li>
! 11570: <li class="listitem"><p>help</p></li>
! 11571: <li class="listitem"><p>hg</p></li>
! 11572: <li class="listitem"><p>imake</p></li>
! 11573: <li class="listitem"><p>increment</p></li>
! 11574: <li class="listitem"><p>interp</p></li>
! 11575: <li class="listitem"><p>interpreter</p></li>
! 11576: <li class="listitem"><p>intl</p></li>
! 11577: <li class="listitem"><p>iso</p></li>
! 11578: <li class="listitem"><p>kerberos</p></li>
! 11579: <li class="listitem"><p>krb</p></li>
! 11580: <li class="listitem"><p>krb5</p></li>
! 11581: <li class="listitem"><p>ksh</p></li>
! 11582: <li class="listitem"><p>latex</p></li>
! 11583: <li class="listitem"><p>libnbcompat</p></li>
! 11584: <li class="listitem"><p>libs</p></li>
! 11585: <li class="listitem"><p>libtool</p></li>
! 11586: <li class="listitem"><p>licence</p></li>
! 11587: <li class="listitem"><p>license</p></li>
! 11588: <li class="listitem"><p>lintl</p></li>
! 11589: <li class="listitem"><p>little-endian</p></li>
! 11590: <li class="listitem"><p>lock</p></li>
! 11591: <li class="listitem"><p>locking</p></li>
! 11592: <li class="listitem"><p>lvalue</p></li>
! 11593: <li class="listitem"><p>make</p></li>
! 11594: <li class="listitem"><p>makesum</p></li>
! 11595: <li class="listitem"><p>memory</p></li>
! 11596: <li class="listitem"><p>mercurial</p></li>
! 11597: <li class="listitem"><p>meta</p></li>
! 11598: <li class="listitem"><p>meta-package</p></li>
! 11599: <li class="listitem"><p>meta_package</p></li>
! 11600: <li class="listitem"><p>mit-krb5</p></li>
! 11601: <li class="listitem"><p>mk.conf</p></li>
! 11602: <li class="listitem"><p>mount</p></li>
! 11603: <li class="listitem"><p>mprotect</p></li>
! 11604: <li class="listitem"><p>mremap</p></li>
! 11605: <li class="listitem"><p>nb</p></li>
! 11606: <li class="listitem"><p>nbcompat</p></li>
! 11607: <li class="listitem"><p>no</p></li>
! 11608: <li class="listitem"><p>obstack</p></li>
! 11609: <li class="listitem"><p>obstack_ptr_grow</p></li>
! 11610: <li class="listitem"><p>occurs</p></li>
! 11611: <li class="listitem"><p>only</p></li>
! 11612: <li class="listitem"><p>options</p></li>
! 11613: <li class="listitem"><p>options.mk</p></li>
! 11614: <li class="listitem"><p>order</p></li>
! 11615: <li class="listitem"><p>override</p></li>
! 11616: <li class="listitem"><p>override-intltool</p></li>
! 11617: <li class="listitem"><p>override-message-intltool</p></li>
! 11618: <li class="listitem"><p>package</p></li>
! 11619: <li class="listitem"><p>parallel</p></li>
! 11620: <li class="listitem"><p>partial</p></li>
! 11621: <li class="listitem"><p>path</p></li>
! 11622: <li class="listitem"><p>pax</p></li>
! 11623: <li class="listitem"><p>paxctl</p></li>
! 11624: <li class="listitem"><p>pbulk-index</p></li>
! 11625: <li class="listitem"><p>pc</p></li>
! 11626: <li class="listitem"><p>perl</p></li>
! 11627: <li class="listitem"><p>perl5</p></li>
! 11628: <li class="listitem"><p>perms</p></li>
! 11629: <li class="listitem"><p>php</p></li>
! 11630: <li class="listitem"><p>pkg-build-options</p></li>
! 11631: <li class="listitem"><p>pkg-config</p></li>
! 11632: <li class="listitem"><p>pkg_build_options</p></li>
! 11633: <li class="listitem"><p>platform</p></li>
! 11634: <li class="listitem"><p>plist</p></li>
! 11635: <li class="listitem"><p>post-extract</p></li>
! 11636: <li class="listitem"><p>post-fetch</p></li>
! 11637: <li class="listitem"><p>post-wrapper</p></li>
! 11638: <li class="listitem"><p>pre-configure</p></li>
! 11639: <li class="listitem"><p>pre-extract</p></li>
! 11640: <li class="listitem"><p>pre-fetch</p></li>
! 11641: <li class="listitem"><p>print-plist</p></li>
! 11642: <li class="listitem"><p>print-summary-data</p></li>
! 11643: <li class="listitem"><p>privileged-install-hook</p></li>
! 11644: <li class="listitem"><p>pypi</p></li>
! 11645: <li class="listitem"><p>python</p></li>
! 11646: <li class="listitem"><p>readme-all</p></li>
! 11647: <li class="listitem"><p>regcomp</p></li>
! 11648: <li class="listitem"><p>relro</p></li>
! 11649: <li class="listitem"><p>rename</p></li>
! 11650: <li class="listitem"><p>reorder</p></li>
! 11651: <li class="listitem"><p>replace</p></li>
! 11652: <li class="listitem"><p>replace_interpreter</p></li>
! 11653: <li class="listitem"><p>reproducible</p></li>
! 11654: <li class="listitem"><p>resolv</p></li>
! 11655: <li class="listitem"><p>root</p></li>
! 11656: <li class="listitem"><p>ruby</p></li>
! 11657: <li class="listitem"><p>setenv</p></li>
! 11658: <li class="listitem"><p>setgid</p></li>
! 11659: <li class="listitem"><p>setprogname</p></li>
! 11660: <li class="listitem"><p>setuid</p></li>
! 11661: <li class="listitem"><p>sh</p></li>
! 11662: <li class="listitem"><p>show</p></li>
! 11663: <li class="listitem"><p>show-all</p></li>
! 11664: <li class="listitem"><p>show-build-defs</p></li>
! 11665: <li class="listitem"><p>show-depends</p></li>
! 11666: <li class="listitem"><p>show-deps</p></li>
! 11667: <li class="listitem"><p>show-distfiles</p></li>
! 11668: <li class="listitem"><p>show-downlevel</p></li>
! 11669: <li class="listitem"><p>show-subdir-var</p></li>
! 11670: <li class="listitem"><p>show-tools</p></li>
! 11671: <li class="listitem"><p>show-var</p></li>
! 11672: <li class="listitem"><p>show-vars</p></li>
! 11673: <li class="listitem"><p>snprintf</p></li>
! 11674: <li class="listitem"><p>ssp</p></li>
! 11675: <li class="listitem"><p>st_mode</p></li>
! 11676: <li class="listitem"><p>stage-install</p></li>
! 11677: <li class="listitem"><p>strip</p></li>
! 11678: <li class="listitem"><p>strong</p></li>
! 11679: <li class="listitem"><p>subst</p></li>
! 11680: <li class="listitem"><p>subversion</p></li>
! 11681: <li class="listitem"><p>sun</p></li>
! 11682: <li class="listitem"><p>sunpro</p></li>
! 11683: <li class="listitem"><p>sunwspro</p></li>
! 11684: <li class="listitem"><p>svn</p></li>
! 11685: <li class="listitem"><p>test</p></li>
! 11686: <li class="listitem"><p>tex</p></li>
! 11687: <li class="listitem"><p>texlive</p></li>
! 11688: <li class="listitem"><p>tmp</p></li>
! 11689: <li class="listitem"><p>tool</p></li>
! 11690: <li class="listitem"><p>tools</p></li>
! 11691: <li class="listitem"><p>tools-libtool-m4-override</p></li>
! 11692: <li class="listitem"><p>type</p></li>
! 11693: <li class="listitem"><p>ulimit</p></li>
! 11694: <li class="listitem"><p>undefined</p></li>
! 11695: <li class="listitem"><p>undo-replace</p></li>
! 11696: <li class="listitem"><p>unlimit</p></li>
! 11697: <li class="listitem"><p>unprivileged</p></li>
! 11698: <li class="listitem"><p>unprivileged-install-hook</p></li>
! 11699: <li class="listitem"><p>unstripped</p></li>
! 11700: <li class="listitem"><p>update</p></li>
! 11701: <li class="listitem"><p>upload</p></li>
! 11702: <li class="listitem"><p>upload-distfiles</p></li>
! 11703: <li class="listitem"><p>usage</p></li>
! 11704: <li class="listitem"><p>use_tools</p></li>
! 11705: <li class="listitem"><p>user</p></li>
! 11706: <li class="listitem"><p>utimes</p></li>
! 11707: <li class="listitem"><p>vasprintf</p></li>
! 11708: <li class="listitem"><p>verbose</p></li>
! 11709: <li class="listitem"><p>vsnprintf</p></li>
! 11710: <li class="listitem"><p>warn</p></li>
! 11711: <li class="listitem"><p>warning</p></li>
! 11712: <li class="listitem"><p>warnings</p></li>
! 11713: <li class="listitem"><p>warnx</p></li>
! 11714: <li class="listitem"><p>weak</p></li>
! 11715: <li class="listitem"><p>work</p></li>
! 11716: <li class="listitem"><p>wrapper</p></li>
! 11717: <li class="listitem"><p>yes</p></li>
! 11718: </ul></div>
! 11719: </div>
! 11720: <div class="appendix">
! 11721: <div class="titlepage"><div><div><h1 class="title">
! 11722: <a name="editing"></a>Appendix E. Editing guidelines for the pkgsrc guide</h1></div></div></div>
1.75 rillig 11723: <div class="toc">
11724: <p><b>Table of Contents</b></p>
1.210 leot 11725: <dl class="toc">
1.267 ! rillig 11726: <dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
! 11727: <dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
1.75 rillig 11728: </dl>
11729: </div>
1.79 rillig 11730: <p>This section contains information on editing the pkgsrc
11731: guide itself.</p>
1.148 asau 11732: <div class="sect1">
1.75 rillig 11733: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 11734: <a name="targets"></a>E.1. Make targets</h2></div></div></div>
1.79 rillig 11735: <p>The pkgsrc guide's source code is stored in
11736: <code class="filename">pkgsrc/doc/guide/files</code>, and several files
11737: are created from it:</p>
1.148 asau 11738: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 11739: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.txt</code></p></li>
11740: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.html</code></p></li>
11741: <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>
11742: <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 11743: The PDF version of the pkgsrc guide.</p></li>
1.128 wiz 11744: <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 11745: PostScript version of the pkgsrc guide.</p></li>
1.75 rillig 11746: </ul></div>
11747: </div>
1.148 asau 11748: <div class="sect1">
1.75 rillig 11749: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 ! rillig 11750: <a name="procedure"></a>E.2. Procedure</h2></div></div></div>
1.79 rillig 11751: <p>The procedure to edit the pkgsrc guide is:</p>
1.128 wiz 11752: <div class="procedure"><ol class="procedure" type="1">
1.148 asau 11753: <li class="step"><p>Make sure you have the packages needed to
1.83 wiz 11754: regenerate the pkgsrc guide (and other XML-based NetBSD
1.151 obache 11755: documentation) installed. These are automatically installed when
1.250 leot 11756: 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 11757: <li class="step"><p>Run <span class="command"><strong>cd doc/guide</strong></span> to get to the
1.79 rillig 11758: right directory. All further steps will take place
11759: here.</p></li>
1.148 asau 11760: <li class="step"><p>Edit the XML file(s) in
1.79 rillig 11761: <code class="filename">files/</code>.</p></li>
1.148 asau 11762: <li class="step"><p>Run <span class="command"><strong>bmake</strong></span> to check the pkgsrc
1.79 rillig 11763: guide for valid XML and to build the final output files. If you
11764: get any errors at this stage, you can just edit the files, as
11765: there are only symbolic links in the working directory, pointing
11766: to the files in <code class="filename">files/</code>.</p></li>
1.148 asau 11767: <li class="step"><p><span class="command"><strong>(cd files && cvs
1.79 rillig 11768: commit)</strong></span></p></li>
1.148 asau 11769: <li class="step"><p>Run <span class="command"><strong>bmake clean && bmake</strong></span> to
1.79 rillig 11770: regenerate the output files with the proper RCS
11771: Ids.</p></li>
1.148 asau 11772: <li class="step">
1.110 hubertf 11773: <p>Run <span class="command"><strong>bmake regen</strong></span> to install and
1.91 rillig 11774: commit the files in both <code class="filename">pkgsrc/doc</code> and
11775: <code class="filename">htdocs</code>.</p>
1.148 asau 11776: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.91 rillig 11777: <h3 class="title">Note</h3>
11778: <p>If you have added, removed or renamed some chapters,
1.110 hubertf 11779: you need to synchronize them using <span class="command"><strong>cvs add</strong></span> or
11780: <span class="command"><strong>cvs delete</strong></span> in the htdocs
1.91 rillig 11781: directory.</p>
11782: </div>
11783: </li>
1.79 rillig 11784: </ol></div>
1.75 rillig 11785: </div>
11786: </div>
11787: </div></body>
1.1 grant 11788: </html>
CVSweb <webmaster@jp.NetBSD.org>