Sat May 30 19:25:38 2020 UTC ()
doc/pkgsrc.*: regen


(rillig)
diff -r1.293 -r1.294 pkgsrc/doc/pkgsrc.html
diff -r1.291 -r1.292 pkgsrc/doc/pkgsrc.txt

cvs diff -r1.293 -r1.294 pkgsrc/doc/pkgsrc.html (switch to unified diff)

--- pkgsrc/doc/pkgsrc.html 2020/05/22 18:51:44 1.293
+++ pkgsrc/doc/pkgsrc.html 2020/05/30 19:25:38 1.294
@@ -1,3449 +1,3388 @@ @@ -1,3449 +1,3388 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html> 2<html>
3<head> 3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 4<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5<title>The pkgsrc guide</title> 5<title>The pkgsrc guide</title>
6<link rel="stylesheet" type="text/css" href="/global.css"> 6<link rel="stylesheet" type="text/css" href="/global.css">
7<meta name="generator" content="DocBook XSL Stylesheets VX.X.X"> 7<meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
8<meta name="description" content="pkgsrc is a centralized package management system for Unix-like operating systems. This guide provides information for users and developers of pkgsrc. It covers installation of binary and source packages, creation of binary and source packages and a high-level overview about the infrastructure."> 8<meta name="description" content="pkgsrc is a centralized package management system for Unix-like operating systems. This guide provides information for users and developers of pkgsrc. It covers installation of binary and source packages, creation of binary and source packages and a high-level overview about the infrastructure.">
9</head> 9</head>
10<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book"> 10<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book">
11<div class="titlepage"> 11<div class="titlepage">
12<div> 12<div>
13<div><h1 class="title"> 13<div><h1 class="title">
14<a name="the-pkgsrc-guide"></a>The pkgsrc guide</h1></div> 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> 15<div><h2 class="subtitle">Documentation on the NetBSD packages system</h2></div>
16<div><div class="authorgroup"> 16<div><div class="authorgroup">
17<div class="author"> 17<div class="author">
18<h3 class="author"> 18<h3 class="author">
19<span class="firstname">Alistair</span> <span class="surname">Crooks</span> 19<span class="firstname">Alistair</span> <span class="surname">Crooks</span>
20</h3> 20</h3>
21<div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p></div></div> 21<div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p></div></div>
22</div> 22</div>
23<div class="author"> 23<div class="author">
24<h3 class="author"> 24<h3 class="author">
25<span class="firstname">Hubert</span> <span class="surname">Feyrer</span> 25<span class="firstname">Hubert</span> <span class="surname">Feyrer</span>
26</h3> 26</h3>
27<div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p></div></div> 27<div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p></div></div>
28</div> 28</div>
29<h3 class="corpauthor"> 29<h3 class="corpauthor">
30 The pkgsrc Developers 30 The pkgsrc Developers
31 </h3> 31 </h3>
32</div></div> 32</div></div>
33<div><p class="copyright">Copyright © 1994-2020 The NetBSD Foundation, Inc</p></div> 33<div><p class="copyright">Copyright © 1994-2020 The NetBSD Foundation, Inc</p></div>
34<div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot Exp $</p></div> 34<div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot Exp $</p></div>
35<div><div class="abstract"> 35<div><div class="abstract">
36<p class="title"><b>Abstract</b></p> 36<p class="title"><b>Abstract</b></p>
37<p>pkgsrc is a centralized package management system for 37<p>pkgsrc is a centralized package management system for
38 Unix-like operating systems. This guide provides information for 38 Unix-like operating systems. This guide provides information for
39 users and developers of pkgsrc. It covers installation of binary 39 users and developers of pkgsrc. It covers installation of binary
40 and source packages, creation of binary and source packages and 40 and source packages, creation of binary and source packages and
41 a high-level overview about the infrastructure.</p> 41 a high-level overview about the infrastructure.</p>
42</div></div> 42</div></div>
43</div> 43</div>
44<hr> 44<hr>
45</div> 45</div>
46<div class="toc"> 46<div class="toc">
47<p><b>Table of Contents</b></p> 47<p><b>Table of Contents</b></p>
48<dl class="toc"> 48<dl class="toc">
49<dt><span class="chapter"><a href="#introduction">1. What is pkgsrc?</a></span></dt> 49<dt><span class="chapter"><a href="#introduction">1. What is pkgsrc?</a></span></dt>
50<dd><dl> 50<dd><dl>
51<dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt> 51<dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
52<dd><dl> 52<dd><dl>
53<dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt> 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> 54<dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
55</dl></dd> 55</dl></dd>
56<dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt> 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> 57<dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
58<dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd> 58<dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
59<dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt> 59<dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
60</dl></dd> 60</dl></dd>
61<dt><span class="part"><a href="#users-guide">I. The pkgsrc user's guide</a></span></dt> 61<dt><span class="part"><a href="#users-guide">I. The pkgsrc user's guide</a></span></dt>
62<dd><dl> 62<dd><dl>
63<dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt> 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> 64<dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt>
65<dd><dl> 65<dd><dl>
66<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt> 66<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
67<dd><dl> 67<dd><dl>
68<dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt> 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> 69<dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
70</dl></dd> 70</dl></dd>
71<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt> 71<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
72<dd><dl> 72<dd><dl>
73<dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt> 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> 74<dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
75</dl></dd> 75</dl></dd>
76</dl></dd> 76</dl></dd>
77<dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt> 77<dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
78<dd><dl> 78<dd><dl>
79<dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt> 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> 80<dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
81</dl></dd> 81</dl></dd>
82<dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt> 82<dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
83<dd><dl> 83<dd><dl>
84<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt> 84<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
85<dd><dl> 85<dd><dl>
86<dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt> 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> 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> 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> 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> 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> 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> 92<dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
93</dl></dd> 93</dl></dd>
94<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt> 94<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
95<dd><dl> 95<dd><dl>
96<dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt> 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> 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> 98<dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
99</dl></dd> 99</dl></dd>
100</dl></dd> 100</dl></dd>
101<dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt> 101<dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
102<dd><dl> 102<dd><dl>
103<dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt> 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> 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> 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> 106<dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
107<dd><dl> 107<dd><dl>
108<dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt> 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> 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> 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>
111</dl></dd> 111</dl></dd>
112<dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt> 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> 113<dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
114</dl></dd> 114</dl></dd>
115<dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt> 115<dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
116<dd><dl> 116<dd><dl>
117<dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt> 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> 118<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
119</dl></dd> 119</dl></dd>
120<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk 120<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
121builds)</a></span></dt> 121builds)</a></span></dt>
122<dd><dl> 122<dd><dl>
123<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 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> 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> 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> 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="#bulk.var">8.4. Bulk build variants</a></span></dt> 127<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
128<dd><dl> 128<dd><dl>
129<dt><span class="sect2"><a href="#bulk.var.subst_noop">8.4.1. Strict SUBST blocks</a></span></dt> 129<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
130<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.2. Detect unknown configure options</a></span></dt> 130<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
131<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.3. Detect classes of bugs by forcing compiler warnings</a></span></dt> 131<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt>
132<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt> 132<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt>
133<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt> 133<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt>
134<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt> 134<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt>
135<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt> 135<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt>
136<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt> 136<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt>
137<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt> 137<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt>
138<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt> 
139<dt><span class="sect2"><a href="#bulk.var.options">8.4.11. Select random sets of options</a></span></dt> 
140<dt><span class="sect2"><a href="#bulk.var.build_defs">8.4.12. Select random configurations of BUILD_DEFS</a></span></dt> 
141</dl></dd> 138</dl></dd>
142<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 139<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
143<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 140<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
144</dl></dd> 141</dl></dd>
145<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt> 142<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
146<dd><dl> 143<dd><dl>
147<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt> 144<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
148<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt> 145<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
149</dl></dd> 146</dl></dd>
150<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt> 147<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
151<dd><dl> 148<dd><dl>
152<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt> 149<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
153<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt> 150<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
154<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt> 151<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
155<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt> 152<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
156<dt><span class="sect1"><a href="#x.org-from-pkgsrc">10.5. How can I install/use modular X.org from pkgsrc?</a></span></dt> 153<dt><span class="sect1"><a href="#x.org-from-pkgsrc">10.5. How can I install/use modular X.org from pkgsrc?</a></span></dt>
157<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt> 154<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
158<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt> 155<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
159<dt><span class="sect1"><a href="#passive-ftp">10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</a></span></dt> 156<dt><span class="sect1"><a href="#passive-ftp">10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</a></span></dt>
160<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt> 157<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
161<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make 158<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
162/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt> 159/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
163<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt> 160<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
164<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt> 161<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
165<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt> 162<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
166<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt> 163<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
167<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt> 164<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
168<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt> 165<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
169<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt> 166<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
170</dl></dd> 167</dl></dd>
171</dl></dd> 168</dl></dd>
172<dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt> 169<dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt>
173<dd><dl> 170<dd><dl>
174<dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt> 171<dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
175<dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt> 172<dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
176<dd><dl> 173<dd><dl>
177<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt> 174<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
178<dd><dl> 175<dd><dl>
179<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt> 176<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
180<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt> 177<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
181<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt> 178<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
182<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt> 179<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
183</dl></dd> 180</dl></dd>
184<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt> 181<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
185<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> 182<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>
186</dl></dd> 183</dl></dd>
187<dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt> 184<dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
188<dd><dl> 185<dd><dl>
189<dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt> 186<dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
190<dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt> 187<dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
191<dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt> 188<dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
192<dd><dl> 189<dd><dl>
193<dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt> 190<dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
194<dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt> 191<dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
195<dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt> 192<dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
196<dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt> 193<dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
197<dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt> 194<dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
198</dl></dd> 195</dl></dd>
199<dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt> 196<dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
200<dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt> 197<dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
201<dd><dl> 198<dd><dl>
202<dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt> 199<dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
203<dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt> 200<dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
204<dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt> 201<dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
205</dl></dd> 202</dl></dd>
206<dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt> 203<dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
207<dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt> 204<dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
208</dl></dd> 205</dl></dd>
209<dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt> 206<dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
210<dd><dl> 207<dd><dl>
211<dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt> 208<dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
212<dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt> 209<dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
213<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd> 210<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
214<dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt> 211<dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
215<dd><dl> 212<dd><dl>
216<dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt> 213<dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
217<dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt> 214<dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
218<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> 215<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>
219<dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt> 216<dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
220</dl></dd> 217</dl></dd>
221</dl></dd> 218</dl></dd>
222<dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt> 219<dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
223<dd><dl> 220<dd><dl>
224<dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt> 221<dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
225<dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 222<dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
226<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> 223<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>
227<dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt> 224<dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
228<dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt> 225<dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
229<dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt> 226<dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
230<dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt> 227<dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
231<dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt> 228<dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
232<dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt> 229<dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
233</dl></dd> 230</dl></dd>
234<dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt> 231<dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
235<dd><dl> 232<dd><dl>
236<dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt> 233<dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
237<dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt> 234<dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
238<dd><dl> 235<dd><dl>
239<dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt> 236<dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
240<dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating 237<dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
241 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 238 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
242 and 239 and
243 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 240 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
244 in <code class="filename">buildlink3.mk</code> files</a></span></dt> 241 in <code class="filename">buildlink3.mk</code> files</a></span></dt>
245</dl></dd> 242</dl></dd>
246<dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt> 243<dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
247<dd><dl> 244<dd><dl>
248<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> 245<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>
249<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt> 246<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
250</dl></dd> 247</dl></dd>
251</dl></dd> 248</dl></dd>
252<dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt> 249<dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
253<dd><dl> 250<dd><dl>
254<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt> 251<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
255<dd><dl> 252<dd><dl>
256<dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt> 253<dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
257<dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt> 254<dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
258</dl></dd> 255</dl></dd>
259<dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt> 256<dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
260<dd><dl> 257<dd><dl>
261<dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt> 258<dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
262<dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt> 259<dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
263<dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt> 260<dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
264<dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt> 261<dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
265</dl></dd> 262</dl></dd>
266<dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt> 263<dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
267<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> 264<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>
268<dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt> 265<dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
269<dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt> 266<dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
270<dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd> 267<dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
271<dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt> 268<dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
272<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> 269<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>
273</dl></dd> 270</dl></dd>
274<dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt> 271<dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
275<dd><dl> 272<dd><dl>
276<dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt> 273<dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
277<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> 274<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>
278<dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt> 275<dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
279<dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt> 276<dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
280</dl></dd> 277</dl></dd>
281<dt><span class="chapter"><a href="#build">19. The build process</a></span></dt> 278<dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
282<dd><dl> 279<dd><dl>
283<dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt> 280<dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
284<dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt> 281<dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
285<dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt> 282<dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
286<dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt> 283<dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
287<dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt> 284<dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
288<dd><dl> 285<dd><dl>
289<dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt> 286<dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
290<dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt> 287<dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
291</dl></dd> 288</dl></dd>
292<dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt> 289<dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
293<dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt> 290<dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
294<dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt> 291<dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
295<dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt> 292<dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
296<dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt> 293<dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
297<dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt> 294<dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
298<dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt> 295<dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
299<dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt> 296<dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
300<dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt> 297<dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
301<dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt> 298<dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
302<dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt> 299<dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
303<dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt> 300<dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
304</dl></dd> 301</dl></dd>
305<dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt> 302<dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
306<dd><dl> 303<dd><dl>
307<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt> 304<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
308<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt> 305<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
309<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt> 306<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
310</dl></dd> 307</dl></dd>
311<dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt> 308<dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
312<dd><dl> 309<dd><dl>
313<dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt> 310<dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
314<dd><dl> 311<dd><dl>
315<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> 312<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>
316<dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt> 313<dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
317<dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt> 314<dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
318<dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt> 315<dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
319<dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt> 316<dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
320<dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt> 317<dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
321<dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt> 318<dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
322<dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt> 319<dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
323<dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt> 320<dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
324<dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt> 321<dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
325<dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt> 322<dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
326</dl></dd> 323</dl></dd>
327<dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt> 324<dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
328<dd><dl> 325<dd><dl>
329<dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt> 326<dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
330<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> 327<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>
331<dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt> 328<dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
332</dl></dd> 329</dl></dd>
333<dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt> 330<dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
334<dd><dl> 331<dd><dl>
335<dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt> 332<dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
336<dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt> 333<dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
337<dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt> 334<dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
338</dl></dd> 335</dl></dd>
339<dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt> 336<dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
340<dd><dl> 337<dd><dl>
341<dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt> 338<dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
342<dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt> 339<dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
343<dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt> 340<dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
344<dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt> 341<dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
345<dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt> 342<dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
346</dl></dd> 343</dl></dd>
347<dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt> 344<dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
348<dd><dl> 345<dd><dl>
349<dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt> 346<dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
350<dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt> 347<dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
351<dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt> 348<dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
352<dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt> 349<dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
353<dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt> 350<dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
354</dl></dd> 351</dl></dd>
355<dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt> 352<dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
356<dd><dl> 353<dd><dl>
357<dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt> 354<dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
358<dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt> 355<dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
359<dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt> 356<dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
360<dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt> 357<dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
361<dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt> 358<dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
362<dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt> 359<dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
363<dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt> 360<dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
364<dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt> 361<dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
365<dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt> 362<dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
366<dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt> 363<dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
367<dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt> 364<dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
368<dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt> 365<dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
369<dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt> 366<dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
370<dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt> 367<dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
371<dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt> 368<dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
372<dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt> 369<dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
373<dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt> 370<dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
374<dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in 371<dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
375 emulation</a></span></dt> 372 emulation</a></span></dt>
376<dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt> 373<dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
377<dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt> 374<dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
378</dl></dd> 375</dl></dd>
379<dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt> 376<dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
380</dl></dd> 377</dl></dd>
381<dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt> 378<dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
382<dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt> 379<dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
383<dd><dl> 380<dd><dl>
384<dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt> 381<dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
385<dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt> 382<dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
386<dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt> 383<dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
387<dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt> 384<dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
388<dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt> 385<dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
389<dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt> 386<dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
390<dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt> 387<dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
391<dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt> 388<dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
392</dl></dd> 389</dl></dd>
393<dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt> 390<dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
394<dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt> 391<dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
395<dd><dl> 392<dd><dl>
396<dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt> 393<dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
397<dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt> 394<dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
398<dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt> 395<dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
399<dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt> 396<dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
400</dl></dd> 397</dl></dd>
401</dl></dd> 398</dl></dd>
402<dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt> 399<dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt>
403<dd><dl> 400<dd><dl>
404<dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt> 401<dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
405<dd><dl> 402<dd><dl>
406<dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt> 403<dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
407<dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt> 404<dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
408<dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt> 405<dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
409<dd><dl> 406<dd><dl>
410<dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt> 407<dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
411<dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt> 408<dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
412</dl></dd> 409</dl></dd>
413<dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt> 410<dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
414<dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt> 411<dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
415<dd><dl> 412<dd><dl>
416<dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt> 413<dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
417<dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt> 414<dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
418</dl></dd> 415</dl></dd>
419<dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt> 416<dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
420<dd><dl> 417<dd><dl>
421<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> 418<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>
422<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> 419<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>
423</dl></dd> 420</dl></dd>
424</dl></dd> 421</dl></dd>
425<dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt> 422<dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
426<dd><dl> 423<dd><dl>
427<dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt> 424<dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
428<dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt> 425<dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
429<dd><dl> 426<dd><dl>
430<dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt> 427<dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
431<dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt> 428<dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
432</dl></dd> 429</dl></dd>
433</dl></dd> 430</dl></dd>
434<dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt> 431<dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
435<dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd> 432<dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
436</dl></dd> 433</dl></dd>
437<dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt> 434<dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt>
438<dd><dl> 435<dd><dl>
439<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt> 436<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
440<dd><dl> 437<dd><dl>
441<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt> 438<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
442<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt> 439<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
443<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt> 440<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
444<dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt> 441<dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
445</dl></dd> 442</dl></dd>
446<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt> 443<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
447</dl></dd> 444</dl></dd>
448<dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt> 445<dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt>
449<dd><dl> 446<dd><dl>
450<dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt> 447<dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
451<dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt> 448<dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
452</dl></dd> 449</dl></dd>
453<dt><span class="appendix"><a href="#ftp-layout">C. Directory layout of the pkgsrc FTP server</a></span></dt> 450<dt><span class="appendix"><a href="#ftp-layout">C. Directory layout of the pkgsrc FTP server</a></span></dt>
454<dd><dl> 451<dd><dl>
455<dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt> 452<dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
456<dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt> 453<dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
457<dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt> 454<dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
458<dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt> 455<dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
459<dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>, 456<dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
460<code class="filename">stable</code>, 457<code class="filename">stable</code>,
461<code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>: 458<code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
462source packages</a></span></dt> 459source packages</a></span></dt>
463</dl></dd> 460</dl></dd>
464<dt><span class="appendix"><a href="#help-topics">D. Help topics</a></span></dt> 461<dt><span class="appendix"><a href="#help-topics">D. Help topics</a></span></dt>
465<dt><span class="appendix"><a href="#editing">E. Editing guidelines for the pkgsrc guide</a></span></dt> 462<dt><span class="appendix"><a href="#editing">E. Editing guidelines for the pkgsrc guide</a></span></dt>
466<dd><dl> 463<dd><dl>
467<dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt> 464<dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
468<dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt> 465<dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
469</dl></dd> 466</dl></dd>
470</dl> 467</dl>
471</div> 468</div>
472<div class="list-of-tables"> 469<div class="list-of-tables">
473<p><b>List of Tables</b></p> 470<p><b>List of Tables</b></p>
474<dl> 471<dl>
475<dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a> 472<dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a>
476</dt> 473</dt>
477<dt>13.1. <a href="#patch-examples">Patching examples</a> 474<dt>13.1. <a href="#patch-examples">Patching examples</a>
478</dt> 475</dt>
479<dt>25.1. <a href="#plist-handling">PLIST handling for GNOME packages</a> 476<dt>25.1. <a href="#plist-handling">PLIST handling for GNOME packages</a>
480</dt> 477</dt>
481</dl> 478</dl>
482</div> 479</div>
483<div class="chapter"> 480<div class="chapter">
484<div class="titlepage"><div><div><h1 class="title"> 481<div class="titlepage"><div><div><h1 class="title">
485<a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div> 482<a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div>
486<div class="toc"> 483<div class="toc">
487<p><b>Table of Contents</b></p> 484<p><b>Table of Contents</b></p>
488<dl class="toc"> 485<dl class="toc">
489<dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt> 486<dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
490<dd><dl> 487<dd><dl>
491<dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt> 488<dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
492<dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt> 489<dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
493</dl></dd> 490</dl></dd>
494<dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt> 491<dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
495<dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt> 492<dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
496<dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd> 493<dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
497<dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt> 494<dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
498</dl> 495</dl>
499</div> 496</div>
500<div class="sect1"> 497<div class="sect1">
501<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 498<div class="titlepage"><div><div><h2 class="title" style="clear: both">
502<a name="introduction-section"></a>1.1. Introduction</h2></div></div></div> 499<a name="introduction-section"></a>1.1. Introduction</h2></div></div></div>
503<p>There is a lot of software freely available for Unix-based 500<p>There is a lot of software freely available for Unix-based
504systems, which is usually available in form of the source code. Before 501systems, which is usually available in form of the source code. Before
505such software can be used, it needs to be configured to the local 502such software can be used, it needs to be configured to the local
506system, compiled and installed, and this is exactly what The NetBSD 503system, compiled and installed, and this is exactly what The NetBSD
507Packages Collection (pkgsrc) does. pkgsrc also has some basic commands 504Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
508to handle binary packages, so that not every user has to build the 505to handle binary packages, so that not every user has to build the
509packages for himself, which is a time-costly task.</p> 506packages for himself, which is a time-costly task.</p>
510<p>pkgsrc currently contains several thousand packages, 507<p>pkgsrc currently contains several thousand packages,
511 including:</p> 508 including:</p>
512<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 509<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
513<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 510<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
514 web server</p></li> 511 web server</p></li>
515<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 512<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
516 web browser</p></li> 513 web browser</p></li>
517<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 514<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
518 Desktop Environment</p></li> 515 Desktop Environment</p></li>
519<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 516<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
520 Desktop Environment</p></li> 517 Desktop Environment</p></li>
521</ul></div> 518</ul></div>
522<p>&#8230; just to name a few.</p> 519<p>&#8230; just to name a few.</p>
523<p>pkgsrc has built-in support for handling varying dependencies, 520<p>pkgsrc has built-in support for handling varying dependencies,
524 such as pthreads and X11, and extended features such as IPv6 support on 521 such as pthreads and X11, and extended features such as IPv6 support on
525 a range of platforms.</p> 522 a range of platforms.</p>
526<div class="sect2"> 523<div class="sect2">
527<div class="titlepage"><div><div><h3 class="title"> 524<div class="titlepage"><div><div><h3 class="title">
528<a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div> 525<a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
529<p> 526<p>
530pkgsrc provides the following key features: 527pkgsrc provides the following key features:
531</p> 528</p>
532<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 529<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
533<li class="listitem"><p>Easy building of software from source as well as the creation 530<li class="listitem"><p>Easy building of software from source as well as the creation
534 and installation of binary packages. The source and latest 531 and installation of binary packages. The source and latest
535 patches are retrieved from a master or mirror download site, checksum 532 patches are retrieved from a master or mirror download site, checksum
536 verified, then built on your system. Support for binary-only 533 verified, then built on your system. Support for binary-only
537 distributions is available for both native platforms and NetBSD 534 distributions is available for both native platforms and NetBSD
538 emulated platforms.</p></li> 535 emulated platforms.</p></li>
539<li class="listitem"><p>All packages are installed in a consistent directory tree, 536<li class="listitem"><p>All packages are installed in a consistent directory tree,
540 including binaries, libraries, man pages and other 537 including binaries, libraries, man pages and other
541 documentation.</p></li> 538 documentation.</p></li>
542<li class="listitem"><p>Tracking of package dependencies automatically, including when 539<li class="listitem"><p>Tracking of package dependencies automatically, including when
543 performing updates, to ensure required packages are installed. The 540 performing updates, to ensure required packages are installed. The
544 configuration files of various packages are handled automatically during 541 configuration files of various packages are handled automatically during
545 updates, so local changes are preserved.</p></li> 542 updates, so local changes are preserved.</p></li>
546<li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and 543<li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and
547 consists of highly portable code. This allows the greatest speed of 544 consists of highly portable code. This allows the greatest speed of
548 development when porting to a new platform. This portability also 545 development when porting to a new platform. This portability also
549 ensures that pkgsrc is <span class="emphasis"><em>consistent across all 546 ensures that pkgsrc is <span class="emphasis"><em>consistent across all
550 platforms</em></span>.</p></li> 547 platforms</em></span>.</p></li>
551<li class="listitem"><p>The installation prefix, acceptable software licenses, 548<li class="listitem"><p>The installation prefix, acceptable software licenses,
552 international encryption requirements and build-time options for a 549 international encryption requirements and build-time options for a
553 large number of packages are all set in a simple, central 550 large number of packages are all set in a simple, central
554 configuration file.</p></li> 551 configuration file.</p></li>
555<li class="listitem"><p>The entire source (not including the distribution files) is 552<li class="listitem"><p>The entire source (not including the distribution files) is
556 freely available under a BSD license, so you may extend and adapt 553 freely available under a BSD license, so you may extend and adapt
557 pkgsrc to your needs. Support for local packages and patches is 554 pkgsrc to your needs. Support for local packages and patches is
558 available right out of the box, so you can configure it specifically 555 available right out of the box, so you can configure it specifically
559 for your environment.</p></li> 556 for your environment.</p></li>
560</ul></div> 557</ul></div>
561<p>The following principles are basic to pkgsrc:</p> 558<p>The following principles are basic to pkgsrc:</p>
562<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 559<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
563<li class="listitem"><p><span class="quote">&#8220;<span class="quote">It should only work if it's right.</span>&#8221;</span> 560<li class="listitem"><p><span class="quote">&#8220;<span class="quote">It should only work if it's right.</span>&#8221;</span>
564&mdash; That means, if a package contains bugs, it's better to find 561&mdash; That means, if a package contains bugs, it's better to find
565them and to complain about them rather than to just install the package 562them and to complain about them rather than to just install the package
566and hope that it works. There are numerous checks in pkgsrc that try to 563and hope that it works. There are numerous checks in pkgsrc that try to
567find 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 564find 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
568of shell scripts), and post-installation checks (installed files, 565of shell scripts), and post-installation checks (installed files,
569references to shared libraries, script interpreters).</p></li> 566references to shared libraries, script interpreters).</p></li>
570<li class="listitem"><p><span class="quote">&#8220;<span class="quote">If it works, it should work everywhere</span>&#8221;</span> 567<li class="listitem"><p><span class="quote">&#8220;<span class="quote">If it works, it should work everywhere</span>&#8221;</span>
571&mdash; Like NetBSD has been ported to many hardware architectures, 568&mdash; Like NetBSD has been ported to many hardware architectures,
572pkgsrc has been ported to many operating systems. Care is taken that 569pkgsrc has been ported to many operating systems. Care is taken that
573packages behave the same on all platforms.</p></li> 570packages behave the same on all platforms.</p></li>
574</ul></div> 571</ul></div>
575</div> 572</div>
576<div class="sect2"> 573<div class="sect2">
577<div class="titlepage"><div><div><h3 class="title"> 574<div class="titlepage"><div><div><h3 class="title">
578<a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div> 575<a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div>
579<p>pkgsrc consists of both a source distribution and a binary 576<p>pkgsrc consists of both a source distribution and a binary
580distribution for these operating systems. After retrieving the required 577distribution for these operating systems. After retrieving the required
581source or binaries, you can be up and running with pkgsrc in just 578source or binaries, you can be up and running with pkgsrc in just
582minutes!</p> 579minutes!</p>
583<p>pkgsrc was derived from FreeBSD's ports system, and 580<p>pkgsrc was derived from FreeBSD's ports system, and
584 initially developed for NetBSD only. Since then, pkgsrc has 581 initially developed for NetBSD only. Since then, pkgsrc has
585 grown a lot, and now supports the following platforms:</p> 582 grown a lot, and now supports the following platforms:</p>
586<div class="table"> 583<div class="table">
587<a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p> 584<a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p>
588<div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1"> 585<div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1">
589<colgroup> 586<colgroup>
590<col> 587<col>
591<col> 588<col>
592<col> 589<col>
593</colgroup> 590</colgroup>
594<thead><tr> 591<thead><tr>
595<th>Platform</th> 592<th>Platform</th>
596<th>Date Support Added</th> 593<th>Date Support Added</th>
597<th>Notes</th> 594<th>Notes</th>
598</tr></thead> 595</tr></thead>
599<tbody> 596<tbody>
600<tr> 597<tr>
601<td><a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a></td> 598<td><a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a></td>
602<td align="center">Aug 1997</td> 599<td align="center">Aug 1997</td>
603<td class="auto-generated"> </td> 600<td class="auto-generated"> </td>
604</tr> 601</tr>
605<tr> 602<tr>
606<td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td> 603<td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
607<td align="center">Mar 1999</td> 604<td align="center">Mar 1999</td>
608<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Solaris" target="_top">README.Solaris</a></td> 605<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Solaris" target="_top">README.Solaris</a></td>
609</tr> 606</tr>
610<tr> 607<tr>
611<td><a class="ulink" href="https://www.kernel.org/" target="_top">Linux</a></td> 608<td><a class="ulink" href="https://www.kernel.org/" target="_top">Linux</a></td>
612<td align="center">Jun 1999</td> 609<td align="center">Jun 1999</td>
613<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux" target="_top">README.Linux</a></td> 610<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux" target="_top">README.Linux</a></td>
614</tr> 611</tr>
615<tr> 612<tr>
616<td> 613<td>
617 <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a> 614 <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a>
618 </td> 615 </td>
619<td align="center">Oct 2001</td> 616<td align="center">Oct 2001</td>
620<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.MacOSX" target="_top">README.MacOSX</a></td> 617<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.MacOSX" target="_top">README.MacOSX</a></td>
621</tr> 618</tr>
622<tr> 619<tr>
623<td><a class="ulink" href="https://www.freebsd.org/" target="_top">FreeBSD</a></td> 620<td><a class="ulink" href="https://www.freebsd.org/" target="_top">FreeBSD</a></td>
624<td align="center">Nov 2002</td> 621<td align="center">Nov 2002</td>
625<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.FreeBSD" target="_top">README.FreeBSD</a></td> 622<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.FreeBSD" target="_top">README.FreeBSD</a></td>
626</tr> 623</tr>
627<tr> 624<tr>
628<td><a class="ulink" href="https://www.openbsd.org/" target="_top">OpenBSD</a></td> 625<td><a class="ulink" href="https://www.openbsd.org/" target="_top">OpenBSD</a></td>
629<td align="center">Nov 2002</td> 626<td align="center">Nov 2002</td>
630<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OpenBSD" target="_top">README.OpenBSD</a></td> 627<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OpenBSD" target="_top">README.OpenBSD</a></td>
631</tr> 628</tr>
632<tr> 629<tr>
633<td><a class="ulink" href="https://www.sgi.com/software/irix/" target="_top">IRIX</a></td> 630<td><a class="ulink" href="https://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
634<td align="center">Dec 2002</td> 631<td align="center">Dec 2002</td>
635<td> 632<td>
636 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a> 633 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a>
637 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX5.3" target="_top">README.IRIX5.3</a> 634 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX5.3" target="_top">README.IRIX5.3</a>
638 </td> 635 </td>
639</tr> 636</tr>
640<tr> 637<tr>
641<td>BSD/OS</td> 638<td>BSD/OS</td>
642<td align="center">Dec 2003</td> 639<td align="center">Dec 2003</td>
643<td class="auto-generated"> </td> 640<td class="auto-generated"> </td>
644</tr> 641</tr>
645<tr> 642<tr>
646<td><a class="ulink" href="https://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td> 643<td><a class="ulink" href="https://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
647<td align="center">Dec 2003</td> 644<td align="center">Dec 2003</td>
648<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.AIX" target="_top">README.AIX</a></td> 645<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.AIX" target="_top">README.AIX</a></td>
649</tr> 646</tr>
650<tr> 647<tr>
651<td> 648<td>
652 <a class="ulink" href="https://www.microsoft.com/windows/sfu/" target="_top">Interix</a> 649 <a class="ulink" href="https://www.microsoft.com/windows/sfu/" target="_top">Interix</a>
653 (Microsoft Windows Services for Unix) 650 (Microsoft Windows Services for Unix)
654 </td> 651 </td>
655<td align="center">Mar 2004</td> 652<td align="center">Mar 2004</td>
656<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Interix" target="_top">README.Interix</a></td> 653<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Interix" target="_top">README.Interix</a></td>
657</tr> 654</tr>
658<tr> 655<tr>
659<td><a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td> 656<td><a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
660<td align="center">Oct 2004</td> 657<td align="center">Oct 2004</td>
661<td class="auto-generated"> </td> 658<td class="auto-generated"> </td>
662</tr> 659</tr>
663<tr> 660<tr>
664<td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td> 661<td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td>
665<td align="center">Nov 2004</td> 662<td align="center">Nov 2004</td>
666<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OSF1" target="_top">README.OSF1</a></td> 663<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OSF1" target="_top">README.OSF1</a></td>
667</tr> 664</tr>
668<tr> 665<tr>
669<td><a class="ulink" href="https://www.hp.com/products1/unix/" target="_top">HP-UX</a></td> 666<td><a class="ulink" href="https://www.hp.com/products1/unix/" target="_top">HP-UX</a></td>
670<td align="center">Apr 2007</td> 667<td align="center">Apr 2007</td>
671<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.HPUX" target="_top">README.HPUX</a></td> 668<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.HPUX" target="_top">README.HPUX</a></td>
672</tr> 669</tr>
673<tr> 670<tr>
674<td><a class="ulink" href="https://www.haiku-os.org/" target="_top">Haiku</a></td> 671<td><a class="ulink" href="https://www.haiku-os.org/" target="_top">Haiku</a></td>
675<td align="center">Sep 2010</td> 672<td align="center">Sep 2010</td>
676<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Haiku" target="_top">README.Haiku</a></td> 673<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Haiku" target="_top">README.Haiku</a></td>
677</tr> 674</tr>
678<tr> 675<tr>
679<td><a class="ulink" href="https://www.mirbsd.org/" target="_top">MirBSD</a></td> 676<td><a class="ulink" href="https://www.mirbsd.org/" target="_top">MirBSD</a></td>
680<td align="center">Jan 2011</td> 677<td align="center">Jan 2011</td>
681<td class="auto-generated"> </td> 678<td class="auto-generated"> </td>
682</tr> 679</tr>
683<tr> 680<tr>
684<td><a class="ulink" href="https://www.minix3.org/" target="_top">Minix3</a></td> 681<td><a class="ulink" href="https://www.minix3.org/" target="_top">Minix3</a></td>
685<td align="center">Nov 2011</td> 682<td align="center">Nov 2011</td>
686<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Minix3" target="_top">README.Minix3</a></td> 683<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Minix3" target="_top">README.Minix3</a></td>
687</tr> 684</tr>
688<tr> 685<tr>
689<td><a class="ulink" href="https://cygwin.com/" target="_top">Cygwin</a></td> 686<td><a class="ulink" href="https://cygwin.com/" target="_top">Cygwin</a></td>
690<td align="center">Mar 2013</td> 687<td align="center">Mar 2013</td>
691<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Cygwin" target="_top">README.Cygwin</a></td> 688<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Cygwin" target="_top">README.Cygwin</a></td>
692</tr> 689</tr>
693<tr> 690<tr>
694<td><a class="ulink" href="https://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td> 691<td><a class="ulink" href="https://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td>
695<td align="center">Jul 2013</td> 692<td align="center">Jul 2013</td>
696<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.GNUkFreeBSD" target="_top">README.GNUkFreeBSD</a></td> 693<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.GNUkFreeBSD" target="_top">README.GNUkFreeBSD</a></td>
697</tr> 694</tr>
698<tr> 695<tr>
699<td><a class="ulink" href="https://www.bitrig.org/" target="_top">Bitrig</a></td> 696<td><a class="ulink" href="https://www.bitrig.org/" target="_top">Bitrig</a></td>
700<td align="center">Jun 2014</td> 697<td align="center">Jun 2014</td>
701<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Bitrig" target="_top">README.Bitrig</a></td> 698<td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Bitrig" target="_top">README.Bitrig</a></td>
702</tr> 699</tr>
703</tbody> 700</tbody>
704</table></div> 701</table></div>
705</div> 702</div>
706<br class="table-break"> 703<br class="table-break">
707</div> 704</div>
708</div> 705</div>
709<div class="sect1"> 706<div class="sect1">
710<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 707<div class="titlepage"><div><div><h2 class="title" style="clear: both">
711<a name="overview"></a>1.2. Overview</h2></div></div></div> 708<a name="overview"></a>1.2. Overview</h2></div></div></div>
712<p>This document is divided into three parts. The first, 709<p>This document is divided into three parts. The first,
713 <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>, 710 <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>,
714 describes how one can use one of the packages in the Package 711 describes how one can use one of the packages in the Package
715 Collection, either by installing a precompiled binary package, 712 Collection, either by installing a precompiled binary package,
716 or by building one's own copy using the NetBSD package system. 713 or by building one's own copy using the NetBSD package system.
717 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 714 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
718 package so it can be easily built by other NetBSD users without 715 package so it can be easily built by other NetBSD users without
719 knowing about the package's building details. The third part, 716 knowing about the package's building details. The third part,
720 <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a> 717 <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a>
721 is intended for those who want to understand how pkgsrc is 718 is intended for those who want to understand how pkgsrc is
722 implemented.</p> 719 implemented.</p>
723<p>This document is available in various formats: 720<p>This document is available in various formats:
724 <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> 721 <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>
725</div> 722</div>
726<div class="sect1"> 723<div class="sect1">
727<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 724<div class="titlepage"><div><div><h2 class="title" style="clear: both">
728<a name="terminology"></a>1.3. Terminology</h2></div></div></div> 725<a name="terminology"></a>1.3. Terminology</h2></div></div></div>
729<p>There has been a lot of talk about <span class="quote">&#8220;<span class="quote">ports</span>&#8221;</span>, 726<p>There has been a lot of talk about <span class="quote">&#8220;<span class="quote">ports</span>&#8221;</span>,
730 <span class="quote">&#8220;<span class="quote">packages</span>&#8221;</span>, etc. so far. Here is a description of all the 727 <span class="quote">&#8220;<span class="quote">packages</span>&#8221;</span>, etc. so far. Here is a description of all the
731 terminology used within this document.</p> 728 terminology used within this document.</p>
732<div class="variablelist"><dl class="variablelist"> 729<div class="variablelist"><dl class="variablelist">
733<dt><span class="term">Package</span></dt> 730<dt><span class="term">Package</span></dt>
734<dd><p>A set of files and building instructions 731<dd><p>A set of files and building instructions
735 that describe what's necessary 732 that describe what's necessary
736 to build a certain piece of software using 733 to build a certain piece of software using
737 pkgsrc. Packages are traditionally stored under 734 pkgsrc. Packages are traditionally stored under
738 <code class="filename">/usr/pkgsrc</code>, 735 <code class="filename">/usr/pkgsrc</code>,
739 but may be stored in any location, 736 but may be stored in any location,
740 referred to as <code class="varname">PKGSRCDIR</code>.</p></dd> 737 referred to as <code class="varname">PKGSRCDIR</code>.</p></dd>
741<dt><span class="term">The NetBSD package system</span></dt> 738<dt><span class="term">The NetBSD package system</span></dt>
742<dd><p>This is the former name of <span class="quote">&#8220;<span class="quote">pkgsrc</span>&#8221;</span>. It 739<dd><p>This is the former name of <span class="quote">&#8220;<span class="quote">pkgsrc</span>&#8221;</span>. It
743 is part of the NetBSD operating system and can be bootstrapped 740 is part of the NetBSD operating system and can be bootstrapped
744 to run on non-NetBSD operating systems as well. It handles 741 to run on non-NetBSD operating systems as well. It handles
745 building (compiling), installing, and removing of 742 building (compiling), installing, and removing of
746 packages.</p></dd> 743 packages.</p></dd>
747<dt><span class="term">Distfile</span></dt> 744<dt><span class="term">Distfile</span></dt>
748<dd><p>This term describes the file or files that are 745<dd><p>This term describes the file or files that are
749 provided by the author of the piece of software to 746 provided by the author of the piece of software to
750 distribute his work. All the changes necessary to build on 747 distribute his work. All the changes necessary to build on
751 NetBSD are reflected in the corresponding package. Usually 748 NetBSD are reflected in the corresponding package. Usually
752 the distfile is in the form of a compressed tar-archive, 749 the distfile is in the form of a compressed tar-archive,
753 but other types are possible, too. Distfiles are usually 750 but other types are possible, too. Distfiles are usually
754 stored below 751 stored below
755 <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd> 752 <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd>
756<dt><span class="term">Port</span></dt> 753<dt><span class="term">Port</span></dt>
757<dd><p>This is the term used by FreeBSD and OpenBSD people 754<dd><p>This is the term used by FreeBSD and OpenBSD people
758 for what we call a package. 755 for what we call a package.
759 In NetBSD terminology, <span class="quote">&#8220;<span class="quote">port</span>&#8221;</span> refers to a different 756 In NetBSD terminology, <span class="quote">&#8220;<span class="quote">port</span>&#8221;</span> refers to a different
760 architecture.</p></dd> 757 architecture.</p></dd>
761<dt><span class="term">Precompiled/binary package</span></dt> 758<dt><span class="term">Precompiled/binary package</span></dt>
762<dd> 759<dd>
763<p>A set of binaries built with pkgsrc from a distfile 760<p>A set of binaries built with pkgsrc from a distfile
764 and stuffed together in a single <code class="filename">.tgz</code> 761 and stuffed together in a single <code class="filename">.tgz</code>
765 file so it can be installed on machines of the same 762 file so it can be installed on machines of the same
766 machine architecture without the need to 763 machine architecture without the need to
767 recompile. Packages are usually generated in 764 recompile. Packages are usually generated in
768 <code class="filename">/usr/pkgsrc/packages</code>; there is also 765 <code class="filename">/usr/pkgsrc/packages</code>; there is also
769 an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p> 766 an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p>
770<p>Sometimes, this is referred to by the term <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> too, 767<p>Sometimes, this is referred to by the term <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> too,
771 especially in the context of precompiled packages.</p> 768 especially in the context of precompiled packages.</p>
772</dd> 769</dd>
773<dt><span class="term">Program</span></dt> 770<dt><span class="term">Program</span></dt>
774<dd><p>The piece of software to be installed which will be 771<dd><p>The piece of software to be installed which will be
775 constructed from all the files in the distfile by the 772 constructed from all the files in the distfile by the
776 actions defined in the corresponding package.</p></dd> 773 actions defined in the corresponding package.</p></dd>
777</dl></div> 774</dl></div>
778<div class="sect2"> 775<div class="sect2">
779<div class="titlepage"><div><div><h3 class="title"> 776<div class="titlepage"><div><div><h3 class="title">
780<a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div> 777<a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div>
781<div class="variablelist"><dl class="variablelist"> 778<div class="variablelist"><dl class="variablelist">
782<dt><span class="term">pkgsrc users</span></dt> 779<dt><span class="term">pkgsrc users</span></dt>
783<dd> 780<dd>
784<p>The 781<p>The
785 pkgsrc users are people who use the packages provided by pkgsrc. 782 pkgsrc users are people who use the packages provided by pkgsrc.
786 Typically they are system administrators. The people using the 783 Typically they are system administrators. The people using the
787 software that is inside the packages (maybe called <span class="quote">&#8220;<span class="quote">end 784 software that is inside the packages (maybe called <span class="quote">&#8220;<span class="quote">end
788 users</span>&#8221;</span>) are not covered by the pkgsrc guide.</p> 785 users</span>&#8221;</span>) are not covered by the pkgsrc guide.</p>
789<p>There are two kinds of pkgsrc users: Some only want to 786<p>There are two kinds of pkgsrc users: Some only want to
790 install pre-built binary packages. Others build the pkgsrc 787 install pre-built binary packages. Others build the pkgsrc
791 packages from source, either for installing them directly or for 788 packages from source, either for installing them directly or for
792 building binary packages themselves. For pkgsrc users <a class="xref" href="#users-guide" title="Part I. The pkgsrc user's guide">Part I, &#8220;The pkgsrc user's guide&#8221;</a> should provide all necessary 789 building binary packages themselves. For pkgsrc users <a class="xref" href="#users-guide" title="Part I. The pkgsrc user's guide">Part I, &#8220;The pkgsrc user's guide&#8221;</a> should provide all necessary
793 documentation.</p> 790 documentation.</p>
794</dd> 791</dd>
795<dt><span class="term">package maintainers</span></dt> 792<dt><span class="term">package maintainers</span></dt>
796<dd><p>A 793<dd><p>A
797 package maintainer creates packages as described in <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a>.</p></dd> 794 package maintainer creates packages as described in <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a>.</p></dd>
798<dt><span class="term">infrastructure developers</span></dt> 795<dt><span class="term">infrastructure developers</span></dt>
799<dd><p>These people are involved in all those files 796<dd><p>These people are involved in all those files
800 that live in the <code class="filename">mk/</code> directory and below. 797 that live in the <code class="filename">mk/</code> directory and below.
801 Only these people should need to read through <a class="xref" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">Part III, &#8220;The pkgsrc infrastructure internals&#8221;</a>, though others might be curious, 798 Only these people should need to read through <a class="xref" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">Part III, &#8220;The pkgsrc infrastructure internals&#8221;</a>, though others might be curious,
802 too.</p></dd> 799 too.</p></dd>
803</dl></div> 800</dl></div>
804</div> 801</div>
805</div> 802</div>
806<div class="sect1"> 803<div class="sect1">
807<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 804<div class="titlepage"><div><div><h2 class="title" style="clear: both">
808<a name="typography"></a>1.4. Typography</h2></div></div></div> 805<a name="typography"></a>1.4. Typography</h2></div></div></div>
809<p>When giving examples for commands, shell prompts are used to 806<p>When giving examples for commands, shell prompts are used to
810 show if the command should/can be issued as root, or if 807 show if the command should/can be issued as root, or if
811 <span class="quote">&#8220;<span class="quote">normal</span>&#8221;</span> user privileges are sufficient. We use a 808 <span class="quote">&#8220;<span class="quote">normal</span>&#8221;</span> user privileges are sufficient. We use a
812 <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users' 809 <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users'
813 shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for 810 shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for
814 bourne shell and derivatives.</p> 811 bourne shell and derivatives.</p>
815</div> 812</div>
816</div> 813</div>
817<div class="part"> 814<div class="part">
818<div class="titlepage"><div><div><h1 class="title"> 815<div class="titlepage"><div><div><h1 class="title">
819<a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div> 816<a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div>
820<div class="toc"> 817<div class="toc">
821<p><b>Table of Contents</b></p> 818<p><b>Table of Contents</b></p>
822<dl class="toc"> 819<dl class="toc">
823<dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt> 820<dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
824<dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt> 821<dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt>
825<dd><dl> 822<dd><dl>
826<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt> 823<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
827<dd><dl> 824<dd><dl>
828<dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt> 825<dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
829<dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt> 826<dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
830</dl></dd> 827</dl></dd>
831<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt> 828<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
832<dd><dl> 829<dd><dl>
833<dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt> 830<dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
834<dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt> 831<dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
835</dl></dd> 832</dl></dd>
836</dl></dd> 833</dl></dd>
837<dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt> 834<dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
838<dd><dl> 835<dd><dl>
839<dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt> 836<dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
840<dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt> 837<dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
841</dl></dd> 838</dl></dd>
842<dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt> 839<dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
843<dd><dl> 840<dd><dl>
844<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt> 841<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
845<dd><dl> 842<dd><dl>
846<dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt> 843<dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
847<dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt> 844<dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
848<dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt> 845<dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
849<dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt> 846<dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
850<dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt> 847<dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
851<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> 848<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>
852<dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt> 849<dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
853</dl></dd> 850</dl></dd>
854<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt> 851<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
855<dd><dl> 852<dd><dl>
856<dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt> 853<dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
857<dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt> 854<dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
858<dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt> 855<dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
859</dl></dd> 856</dl></dd>
860</dl></dd> 857</dl></dd>
861<dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt> 858<dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
862<dd><dl> 859<dd><dl>
863<dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt> 860<dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
864<dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt> 861<dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
865<dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt> 862<dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
866<dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt> 863<dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
867<dd><dl> 864<dd><dl>
868<dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt> 865<dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
869<dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt> 866<dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
870<dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt> 867<dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
871</dl></dd> 868</dl></dd>
872<dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt> 869<dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
873<dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt> 870<dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
874</dl></dd> 871</dl></dd>
875<dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt> 872<dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
876<dd><dl> 873<dd><dl>
877<dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt> 874<dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
878<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt> 875<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
879</dl></dd> 876</dl></dd>
880<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk 877<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
881builds)</a></span></dt> 878builds)</a></span></dt>
882<dd><dl> 879<dd><dl>
883<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 880<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
884<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt> 881<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt>
885<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd> 882<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
886<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt> 883<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
887<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt> 884<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
888<dd><dl> 885<dd><dl>
889<dt><span class="sect2"><a href="#bulk.var.subst_noop">8.4.1. Strict SUBST blocks</a></span></dt> 886<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
890<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.2. Detect unknown configure options</a></span></dt> 887<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
891<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.3. Detect classes of bugs by forcing compiler warnings</a></span></dt> 888<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt>
892<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt> 889<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt>
893<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt> 890<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt>
894<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt> 891<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt>
895<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt> 892<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt>
896<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt> 893<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt>
897<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt> 894<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt>
898<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt> 
899<dt><span class="sect2"><a href="#bulk.var.options">8.4.11. Select random sets of options</a></span></dt> 
900<dt><span class="sect2"><a href="#bulk.var.build_defs">8.4.12. Select random configurations of BUILD_DEFS</a></span></dt> 
901</dl></dd> 895</dl></dd>
902<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 896<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
903<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 897<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
904</dl></dd> 898</dl></dd>
905<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt> 899<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
906<dd><dl> 900<dd><dl>
907<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt> 901<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
908<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt> 902<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
909</dl></dd> 903</dl></dd>
910<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt> 904<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
911<dd><dl> 905<dd><dl>
912<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt> 906<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
913<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt> 907<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
914<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt> 908<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
915<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt> 909<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
916<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> 910<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>
917<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt> 911<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
918<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt> 912<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
919<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> 913<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>
920<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt> 914<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
921<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make 915<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
922/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt> 916/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
923<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt> 917<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
924<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt> 918<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
925<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt> 919<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
926<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt> 920<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
927<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt> 921<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
928<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt> 922<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
929<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt> 923<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
930</dl></dd> 924</dl></dd>
931</dl> 925</dl>
932</div> 926</div>
933<div class="chapter"> 927<div class="chapter">
934<div class="titlepage"><div><div><h2 class="title"> 928<div class="titlepage"><div><div><h2 class="title">
935<a name="help-user"></a>Chapter 2. Getting help</h2></div></div></div> 929<a name="help-user"></a>Chapter 2. Getting help</h2></div></div></div>
936<p> 930<p>
937 To get help when using pkgsrc, the definitive source is this 931 To get help when using pkgsrc, the definitive source is this
938 document, the pkgsrc guide. If you don't find anything here, 932 document, the pkgsrc guide. If you don't find anything here,
939 there are alternatives: 933 there are alternatives:
940</p> 934</p>
941<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 935<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
942<li class="listitem"> 936<li class="listitem">
943<p> 937<p>
944 The built-in pkgsrc help, which is available after bootstrapping 938 The built-in pkgsrc help, which is available after bootstrapping
945 pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get 939 pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
946 help for any topic, such as a variable name like 940 help for any topic, such as a variable name like
947 <code class="varname">BUILD_DEFS</code>, a make target like 941 <code class="varname">BUILD_DEFS</code>, a make target like
948 <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like 942 <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
949 <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p> 943 <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
950<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> 944<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>
951</li> 945</li>
952<li class="listitem"><p> 946<li class="listitem"><p>
953 To see the value of a single variable, run <span class="command"><strong>bmake 947 To see the value of a single variable, run <span class="command"><strong>bmake
954 show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>. 948 show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
955</p></li> 949</p></li>
956<li class="listitem"><p> 950<li class="listitem"><p>
957 To see the values of the most common variables, run 951 To see the values of the most common variables, run
958 <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by 952 <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
959 topic. To see the variables for a single topic, run 953 topic. To see the variables for a single topic, run
960 <span class="command"><strong>bmake 954 <span class="command"><strong>bmake
961 show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example 955 show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
962 <span class="command"><strong>bmake show-all-fetch</strong></span>. 956 <span class="command"><strong>bmake show-all-fetch</strong></span>.
963</p></li> 957</p></li>
964<li class="listitem"><p> 958<li class="listitem"><p>
965 The pkgsrc-users mailing list, to which 959 The pkgsrc-users mailing list, to which
966 <a class="ulink" href="https://www.NetBSD.org/mailinglists/#pkgsrc-users" target="_top">you 960 <a class="ulink" href="https://www.NetBSD.org/mailinglists/#pkgsrc-users" target="_top">you
967 can subscribe</a> and then <a class="ulink" href="mailto:pkgsrc-users@NetBSD.org" target="_top">ask your 961 can subscribe</a> and then <a class="ulink" href="mailto:pkgsrc-users@NetBSD.org" target="_top">ask your
968 questions</a>.</p></li> 962 questions</a>.</p></li>
969<li class="listitem"><p>The #pkgsrc IRC channel, which is accessible 963<li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
970 <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a> 964 <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
971 or by using a specialized chat program such as 965 or by using a specialized chat program such as
972 <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>. 966 <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
973 Pick any user name and join the channel #pkgsrc.</p></li> 967 Pick any user name and join the channel #pkgsrc.</p></li>
974</ul></div> 968</ul></div>
975</div> 969</div>
976<div class="chapter"> 970<div class="chapter">
977<div class="titlepage"><div><div><h2 class="title"> 971<div class="titlepage"><div><div><h2 class="title">
978<a name="getting"></a>Chapter 3. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div> 972<a name="getting"></a>Chapter 3. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div>
979<div class="toc"> 973<div class="toc">
980<p><b>Table of Contents</b></p> 974<p><b>Table of Contents</b></p>
981<dl class="toc"> 975<dl class="toc">
982<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt> 976<dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
983<dd><dl> 977<dd><dl>
984<dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt> 978<dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
985<dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt> 979<dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
986</dl></dd> 980</dl></dd>
987<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt> 981<dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
988<dd><dl> 982<dd><dl>
989<dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt> 983<dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
990<dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt> 984<dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
991</dl></dd> 985</dl></dd>
992</dl> 986</dl>
993</div> 987</div>
994<p>Before you download and extract the files, you need to decide 988<p>Before you download and extract the files, you need to decide
995where you want to extract them. When using pkgsrc as root user, pkgsrc 989where you want to extract them. When using pkgsrc as root user, pkgsrc
996is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though 990is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
997free to install the sources and binary packages wherever you want in 991free to install the sources and binary packages wherever you want in
998your filesystem, provided that the pathname does not contain white-space 992your filesystem, provided that the pathname does not contain white-space
999or other characters that are interpreted specially by the shell and some 993or other characters that are interpreted specially by the shell and some
1000other programs. A safe bet is to use only letters, digits, underscores 994other programs. A safe bet is to use only letters, digits, underscores
1001and dashes.</p> 995and dashes.</p>
1002<div class="sect1"> 996<div class="sect1">
1003<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 997<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1004<a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div> 998<a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div>
1005<p>Before you download any pkgsrc files, you should decide 999<p>Before you download any pkgsrc files, you should decide
1006 whether you want the <span class="emphasis"><em>current</em></span> branch or the 1000 whether you want the <span class="emphasis"><em>current</em></span> branch or the
1007 <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a 1001 <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
1008 quarterly basis from the current branch and only gets modified 1002 quarterly basis from the current branch and only gets modified
1009 for security updates. The names of the stable branches are built 1003 for security updates. The names of the stable branches are built
1010 from the year and the quarter, for example 1004 from the year and the quarter, for example
1011 <code class="literal">2020Q1</code>.</p> 1005 <code class="literal">2020Q1</code>.</p>
1012<p>The second step is to decide <span class="emphasis"><em>how</em></span> you 1006<p>The second step is to decide <span class="emphasis"><em>how</em></span> you
1013 want to download pkgsrc. You can get it as a tar file or via CVS. 1007 want to download pkgsrc. You can get it as a tar file or via CVS.
1014 Both ways are described here.</p> 1008 Both ways are described here.</p>
1015<p>Note that tar archive contains CVS working copy. 1009<p>Note that tar archive contains CVS working copy.
1016 Thus you can switch to using CVS at any later time.</p> 1010 Thus you can switch to using CVS at any later time.</p>
1017<div class="sect2"> 1011<div class="sect2">
1018<div class="titlepage"><div><div><h3 class="title"> 1012<div class="titlepage"><div><div><h3 class="title">
1019<a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div> 1013<a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div>
1020<p>The primary download location for all pkgsrc files is 1014<p>The primary download location for all pkgsrc files is
1021 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or 1015 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or
1022 <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a> 1016 <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>
1023 (it points to the same location). 1017 (it points to the same location).
1024 There are a number of subdirectories for different purposes, 1018 There are a number of subdirectories for different purposes,
1025 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> 1019 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>
1026<p>The tar archive for the current branch is in the directory 1020<p>The tar archive for the current branch is in the directory
1027 <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>. 1021 <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>.
1028 It is autogenerated weekly.</p> 1022 It is autogenerated weekly.</p>
1029<p>To save download time we provide bzip2- and 1023<p>To save download time we provide bzip2- and
1030 xz-compressed archives which are published at 1024 xz-compressed archives which are published at
1031 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2" target="_top"><code class="filename">pkgsrc.tar.bz2</code></a> 1025 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2" target="_top"><code class="filename">pkgsrc.tar.bz2</code></a>
1032 and 1026 and
1033 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz" target="_top"><code class="filename">pkgsrc.tar.xz</code></a> 1027 <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz" target="_top"><code class="filename">pkgsrc.tar.xz</code></a>
1034 respectively. 1028 respectively.
1035 </p> 1029 </p>
1036<p>You can fetch the same files using FTP.</p> 1030<p>You can fetch the same files using FTP.</p>
1037<p>The tar file for the stable branch 2020Q1 is in the 1031<p>The tar file for the stable branch 2020Q1 is in the
1038 directory <code class="filename">pkgsrc-2020Q1</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p> 1032 directory <code class="filename">pkgsrc-2020Q1</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1039<p>To download the latest pkgsrc stable tarball, run:</p> 1033<p>To download the latest pkgsrc stable tarball, run:</p>
1040<pre class="screen"> 1034<pre class="screen">
1041<code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz</code></strong></pre> 1035<code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz</code></strong></pre>
1042<p>If you prefer, you can also fetch it using "wget", "curl", 1036<p>If you prefer, you can also fetch it using "wget", "curl",
1043 or your web browser.</p> 1037 or your web browser.</p>
1044<p>Then, extract it with:</p> 1038<p>Then, extract it with:</p>
1045<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre> 1039<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1046<p>This will create the directory <code class="filename">pkgsrc/</code> 1040<p>This will create the directory <code class="filename">pkgsrc/</code>
1047 in <code class="filename">/usr/</code> and all the package source will be  1041 in <code class="filename">/usr/</code> and all the package source will be
1048 stored under <code class="filename">/usr/pkgsrc/</code>.</p> 1042 stored under <code class="filename">/usr/pkgsrc/</code>.</p>
1049<p>To download pkgsrc-current, run:</p> 1043<p>To download pkgsrc-current, run:</p>
1050<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> 1044<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>
1051</div> 1045</div>
1052<div class="sect2"> 1046<div class="sect2">
1053<div class="titlepage"><div><div><h3 class="title"> 1047<div class="titlepage"><div><div><h3 class="title">
1054<a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div> 1048<a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div>
1055<p>To fetch a specific pkgsrc stable branch, run:</p> 1049<p>To fetch a specific pkgsrc stable branch, run:</p>
1056<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc</code></strong> 1050<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc</code></strong>
1057</pre> 1051</pre>
1058<p>This will create the directory <code class="filename">pkgsrc/</code>  1052<p>This will create the directory <code class="filename">pkgsrc/</code>
1059 in your <code class="filename">/usr/</code> directory and all the package source  1053 in your <code class="filename">/usr/</code> directory and all the package source
1060 will be stored under <code class="filename">/usr/pkgsrc/</code>.</p> 1054 will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
1061<p>To fetch the pkgsrc current branch, run:</p> 1055<p>To fetch the pkgsrc current branch, run:</p>
1062<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong> 1056<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1063</pre> 1057</pre>
1064<p>Refer to the <a class="ulink" href="https://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p> 1058<p>Refer to the <a class="ulink" href="https://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1065<p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable. E.g.:</p> 1059<p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable. E.g.:</p>
1066<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong> 1060<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1067</pre> 1061</pre>
1068<p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently. 1062<p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
1069 For Bourne shells, you can set it in your <code class="filename">.profile</code> 1063 For Bourne shells, you can set it in your <code class="filename">.profile</code>
1070 or better globally in <code class="filename">/etc/profile</code>:</p> 1064 or better globally in <code class="filename">/etc/profile</code>:</p>
1071<pre class="programlisting"> 1065<pre class="programlisting">
1072# set CVS remote shell command 1066# set CVS remote shell command
1073CVS_RSH=ssh 1067CVS_RSH=ssh
1074export CVS_RSH 1068export CVS_RSH
1075</pre> 1069</pre>
1076<p>By default, CVS doesn't do things like most people would expect it to do. 1070<p>By default, CVS doesn't do things like most people would expect it to do.
1077 But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code> 1071 But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
1078 in your home directory and saving the following lines to it. 1072 in your home directory and saving the following lines to it.
1079 This file will save you lots of headache and some bug reports, so we strongly recommend it. 1073 This file will save you lots of headache and some bug reports, so we strongly recommend it.
1080 You can find an explanation of this file in the CVS documentation.</p> 1074 You can find an explanation of this file in the CVS documentation.</p>
1081<pre class="programlisting"> 1075<pre class="programlisting">
1082# recommended CVS configuration file from the pkgsrc guide 1076# recommended CVS configuration file from the pkgsrc guide
1083cvs -q 1077cvs -q
1084checkout -P 1078checkout -P
1085update -dP 1079update -dP
1086diff -upN 1080diff -upN
1087rdiff -u 1081rdiff -u
1088release -d 1082release -d
1089</pre> 1083</pre>
1090</div> 1084</div>
1091</div> 1085</div>
1092<div class="sect1"> 1086<div class="sect1">
1093<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1087<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1094<a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div> 1088<a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div>
1095<p>The preferred way to keep pkgsrc up-to-date is via CVS 1089<p>The preferred way to keep pkgsrc up-to-date is via CVS
1096 (which also works if you have first installed it via a tar 1090 (which also works if you have first installed it via a tar
1097 file). It saves bandwidth and hard disk activity, compared to 1091 file). It saves bandwidth and hard disk activity, compared to
1098 downloading the tar file again.</p> 1092 downloading the tar file again.</p>
1099<div class="sect2"> 1093<div class="sect2">
1100<div class="titlepage"><div><div><h3 class="title"> 1094<div class="titlepage"><div><div><h3 class="title">
1101<a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div> 1095<a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div>
1102<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"> 1096<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1103<h3 class="title">Warning</h3> 1097<h3 class="title">Warning</h3>
1104<p>When updating from a tar file, you first need to 1098<p>When updating from a tar file, you first need to
1105 completely remove the old pkgsrc directory. Otherwise those 1099 completely remove the old pkgsrc directory. Otherwise those
1106 files that have been removed from pkgsrc in the mean time will 1100 files that have been removed from pkgsrc in the mean time will
1107 not be removed on your local disk, resulting in inconsistencies. 1101 not be removed on your local disk, resulting in inconsistencies.
1108 When removing the old files, any changes that you have done to 1102 When removing the old files, any changes that you have done to
1109 the pkgsrc files will be lost after updating. Therefore updating 1103 the pkgsrc files will be lost after updating. Therefore updating
1110 via CVS is strongly recommended.</p> 1104 via CVS is strongly recommended.</p>
1111</div> 1105</div>
1112<p>Note that by default the distfiles and the binary packages 1106<p>Note that by default the distfiles and the binary packages
1113 are saved in the pkgsrc tree, so don't forget to rescue them 1107 are saved in the pkgsrc tree, so don't forget to rescue them
1114 before updating. You can also configure pkgsrc to store distfiles 1108 before updating. You can also configure pkgsrc to store distfiles
1115 and packages in directories outside the pkgsrc tree by setting the 1109 and packages in directories outside the pkgsrc tree by setting the
1116 <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code> 1110 <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1117 variables. See <a class="xref" href="#configuring" title="Chapter 6. Configuring pkgsrc">Chapter 6, <i>Configuring pkgsrc</i></a> for the details.</p> 1111 variables. See <a class="xref" href="#configuring" title="Chapter 6. Configuring pkgsrc">Chapter 6, <i>Configuring pkgsrc</i></a> for the details.</p>
1118<p>To update pkgsrc from a tar file, download the tar file as 1112<p>To update pkgsrc from a tar file, download the tar file as
1119 explained above. Then, make sure that you have not made any 1113 explained above. Then, make sure that you have not made any
1120 changes to the files in the pkgsrc directory. Remove the pkgsrc 1114 changes to the files in the pkgsrc directory. Remove the pkgsrc
1121 directory and extract the new tar file. Done.</p> 1115 directory and extract the new tar file. Done.</p>
1122</div> 1116</div>
1123<div class="sect2"> 1117<div class="sect2">
1124<div class="titlepage"><div><div><h3 class="title"> 1118<div class="titlepage"><div><div><h3 class="title">
1125<a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div> 1119<a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div>
1126<p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p> 1120<p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
1127<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong> 1121<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong>
1128</pre> 1122</pre>
1129<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> 1123<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>
1130<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; env CVS_RSH=ssh cvs up -dP</code></strong> 1124<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; env CVS_RSH=ssh cvs up -dP</code></strong>
1131</pre> 1125</pre>
1132<div class="sect3"> 1126<div class="sect3">
1133<div class="titlepage"><div><div><h4 class="title"> 1127<div class="titlepage"><div><div><h4 class="title">
1134<a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div> 1128<a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
1135<p>When updating pkgsrc, the CVS program keeps track of the 1129<p>When updating pkgsrc, the CVS program keeps track of the
1136 branch you selected. But if you, for whatever reason, want to 1130 branch you selected. But if you, for whatever reason, want to
1137 switch from the stable branch to the current one, you can do it 1131 switch from the stable branch to the current one, you can do it
1138 by adding the option <span class="quote">&#8220;<span class="quote">-A</span>&#8221;</span> after the 1132 by adding the option <span class="quote">&#8220;<span class="quote">-A</span>&#8221;</span> after the
1139 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> keyword. To switch from the current branch 1133 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> keyword. To switch from the current branch
1140 back to the stable branch, add the 1134 back to the stable branch, add the
1141 <span class="quote">&#8220;<span class="quote">-rpkgsrc-2020Q1</span>&#8221;</span> option.</p> 1135 <span class="quote">&#8220;<span class="quote">-rpkgsrc-2020Q1</span>&#8221;</span> option.</p>
1142</div> 1136</div>
1143<div class="sect3"> 1137<div class="sect3">
1144<div class="titlepage"><div><div><h4 class="title"> 1138<div class="titlepage"><div><div><h4 class="title">
1145<a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div> 1139<a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div>
1146<p>When you update pkgsrc, the CVS program will only touch 1140<p>When you update pkgsrc, the CVS program will only touch
1147 those files that are registered in the CVS repository. That 1141 those files that are registered in the CVS repository. That
1148 means that any packages that you created on your own will stay 1142 means that any packages that you created on your own will stay
1149 unmodified. If you change files that are managed by CVS, later 1143 unmodified. If you change files that are managed by CVS, later
1150 updates will try to merge your changes with those that have been 1144 updates will try to merge your changes with those that have been
1151 done by others. See the CVS manual, chapter 1145 done by others. See the CVS manual, chapter
1152 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for details.</p> 1146 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for details.</p>
1153</div> 1147</div>
1154</div> 1148</div>
1155</div> 1149</div>
1156</div> 1150</div>
1157<div class="chapter"> 1151<div class="chapter">
1158<div class="titlepage"><div><div><h2 class="title"> 1152<div class="titlepage"><div><div><h2 class="title">
1159<a name="platforms"></a>Chapter 4. Using pkgsrc on systems other than NetBSD</h2></div></div></div> 1153<a name="platforms"></a>Chapter 4. Using pkgsrc on systems other than NetBSD</h2></div></div></div>
1160<div class="toc"> 1154<div class="toc">
1161<p><b>Table of Contents</b></p> 1155<p><b>Table of Contents</b></p>
1162<dl class="toc"> 1156<dl class="toc">
1163<dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt> 1157<dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
1164<dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt> 1158<dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1165</dl> 1159</dl>
1166</div> 1160</div>
1167<div class="sect1"> 1161<div class="sect1">
1168<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1162<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1169<a name="binarydist"></a>4.1. Binary distribution</h2></div></div></div> 1163<a name="binarydist"></a>4.1. Binary distribution</h2></div></div></div>
1170<p>See <a class="xref" href="#using-pkg" title="5.1. Using binary packages">Section 5.1, &#8220;Using binary packages&#8221;</a>.</p> 1164<p>See <a class="xref" href="#using-pkg" title="5.1. Using binary packages">Section 5.1, &#8220;Using binary packages&#8221;</a>.</p>
1171</div> 1165</div>
1172<div class="sect1"> 1166<div class="sect1">
1173<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1167<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1174<a name="bootstrapping-pkgsrc"></a>4.2. Bootstrapping pkgsrc</h2></div></div></div> 1168<a name="bootstrapping-pkgsrc"></a>4.2. Bootstrapping pkgsrc</h2></div></div></div>
1175<p>pkgsrc can be bootstrapped for use in two different modes: 1169<p>pkgsrc can be bootstrapped for use in two different modes:
1176 privileged and unprivileged one. In unprivileged mode in contrast 1170 privileged and unprivileged one. In unprivileged mode in contrast
1177 to privileged one all programs are installed under one particular user 1171 to privileged one all programs are installed under one particular user
1178 and cannot utilise privileged operations (packages don't create 1172 and cannot utilise privileged operations (packages don't create
1179 special users and all special file permissions like setuid are ignored). 1173 special users and all special file permissions like setuid are ignored).
1180 </p> 1174 </p>
1181<p>Installing the bootstrap kit from source should be as simple as:</p> 1175<p>Installing the bootstrap kit from source should be as simple as:</p>
1182<pre class="screen"> 1176<pre class="screen">
1183<code class="prompt">#</code> <strong class="userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong> 1177<code class="prompt">#</code> <strong class="userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1184<code class="prompt">#</code> <strong class="userinput"><code>cd pkgsrc/bootstrap</code></strong> 1178<code class="prompt">#</code> <strong class="userinput"><code>cd pkgsrc/bootstrap</code></strong>
1185<code class="prompt">#</code> <strong class="userinput"><code>./bootstrap</code></strong> 1179<code class="prompt">#</code> <strong class="userinput"><code>./bootstrap</code></strong>
1186 </pre> 1180 </pre>
1187<p>To bootstrap in unprivileged mode pass <span class="quote">&#8220;<span class="quote">--unprivileged</span>&#8221;</span> flag to <span class="command"><strong>bootstrap</strong></span></p> 1181<p>To bootstrap in unprivileged mode pass <span class="quote">&#8220;<span class="quote">--unprivileged</span>&#8221;</span> flag to <span class="command"><strong>bootstrap</strong></span></p>
1188<p>By default, in privileged mode pkgsrc uses 1182<p>By default, in privileged mode pkgsrc uses
1189 <code class="filename">/usr/pkg</code> for <span class="emphasis"><em>prefix</em></span> 1183 <code class="filename">/usr/pkg</code> for <span class="emphasis"><em>prefix</em></span>
1190 where programs will be installed in, 1184 where programs will be installed in,
1191 and <code class="filename">/usr/pkg/pkgdb</code> for the package database 1185 and <code class="filename">/usr/pkg/pkgdb</code> for the package database
1192 directory where pkgsrc will do its internal bookkeeping, 1186 directory where pkgsrc will do its internal bookkeeping,
1193 <code class="filename">/var</code> is used as <span class="emphasis"><em>varbase</em></span>, 1187 <code class="filename">/var</code> is used as <span class="emphasis"><em>varbase</em></span>,
1194 where packages install their persistent data. 1188 where packages install their persistent data.
1195 In unprivileged mode pkgsrc uses 1189 In unprivileged mode pkgsrc uses
1196 <code class="filename">~/pkg</code> for <span class="emphasis"><em>prefix</em></span>, 1190 <code class="filename">~/pkg</code> for <span class="emphasis"><em>prefix</em></span>,
1197 <code class="filename">~/pkg/pkgdb</code> for the package database, 1191 <code class="filename">~/pkg/pkgdb</code> for the package database,
1198 and <code class="filename">~/pkg/var</code> for <span class="emphasis"><em>varbase</em></span>. 1192 and <code class="filename">~/pkg/var</code> for <span class="emphasis"><em>varbase</em></span>.
1199 </p> 1193 </p>
1200<p>You can change default layout using command-line arguments. 1194<p>You can change default layout using command-line arguments.
1201 Run <span class="quote">&#8220;<span class="quote">./bootstrap --help</span>&#8221;</span> to get details. 1195 Run <span class="quote">&#8220;<span class="quote">./bootstrap --help</span>&#8221;</span> to get details.
1202 </p> 1196 </p>
1203<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 1197<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1204<h3 class="title">Note</h3> 1198<h3 class="title">Note</h3>
1205<p>The bootstrap installs a <span class="command"><strong>bmake</strong></span> tool. 1199<p>The bootstrap installs a <span class="command"><strong>bmake</strong></span> tool.
1206 Use this <span class="command"><strong>bmake</strong></span> when building via pkgsrc. 1200 Use this <span class="command"><strong>bmake</strong></span> when building via pkgsrc.
1207 For examples in this guide, use <span class="command"><strong>bmake</strong></span> 1201 For examples in this guide, use <span class="command"><strong>bmake</strong></span>
1208 instead of <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span>.</p> 1202 instead of <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span>.</p>
1209</div> 1203</div>
1210<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 1204<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1211<h3 class="title">Note</h3> 1205<h3 class="title">Note</h3>
1212<p>It is possible to bootstrap multiple instances of pkgsrc 1206<p>It is possible to bootstrap multiple instances of pkgsrc
1213 using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span> 1207 using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span>
1214 corresponding to the installation you're working with to build 1208 corresponding to the installation you're working with to build
1215 and install packages. 1209 and install packages.
1216 </p> 1210 </p>
1217</div> 1211</div>
1218</div> 1212</div>
1219</div> 1213</div>
1220<div class="chapter"> 1214<div class="chapter">
1221<div class="titlepage"><div><div><h2 class="title"> 1215<div class="titlepage"><div><div><h2 class="title">
1222<a name="using"></a>Chapter 5. Using pkgsrc</h2></div></div></div> 1216<a name="using"></a>Chapter 5. Using pkgsrc</h2></div></div></div>
1223<div class="toc"> 1217<div class="toc">
1224<p><b>Table of Contents</b></p> 1218<p><b>Table of Contents</b></p>
1225<dl class="toc"> 1219<dl class="toc">
1226<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt> 1220<dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1227<dd><dl> 1221<dd><dl>
1228<dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt> 1222<dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
1229<dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt> 1223<dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
1230<dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt> 1224<dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
1231<dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt> 1225<dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
1232<dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt> 1226<dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
1233<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> 1227<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>
1234<dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt> 1228<dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1235</dl></dd> 1229</dl></dd>
1236<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt> 1230<dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1237<dd><dl> 1231<dd><dl>
1238<dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt> 1232<dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
1239<dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt> 1233<dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
1240<dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt> 1234<dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1241</dl></dd> 1235</dl></dd>
1242</dl> 1236</dl>
1243</div> 1237</div>
1244<p>Basically, there are two ways of using pkgsrc. The first 1238<p>Basically, there are two ways of using pkgsrc. The first
1245is to only install the package tools and to use binary packages 1239is to only install the package tools and to use binary packages
1246that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span> 1240that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>
1247in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span> 1241in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span>
1248of pkgsrc, too. Then you are able to build your own packages, 1242of pkgsrc, too. Then you are able to build your own packages,
1249and you can still use binary packages from someone else.</p> 1243and you can still use binary packages from someone else.</p>
1250<div class="sect1"> 1244<div class="sect1">
1251<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1245<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1252<a name="using-pkg"></a>5.1. Using binary packages</h2></div></div></div> 1246<a name="using-pkg"></a>5.1. Using binary packages</h2></div></div></div>
1253<p>On the <a class="ulink" href="https://cdn.NetBSD.org/" target="_top">cdn.NetBSD.org</a> 1247<p>On the <a class="ulink" href="http://cdn.NetBSD.org/" target="_top">cdn.NetBSD.org</a>
1254 site and mirrors, there are collections of binary packages, 1248 site and mirrors, there are collections of binary packages,
1255 ready to be installed. These binary packages have been built using the 1249 ready to be installed. These binary packages have been built using the
1256 default settings for the directories, that is:</p> 1250 default settings for the directories, that is:</p>
1257<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1251<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1258<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> 1252<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>
1259<li class="listitem"><p><code class="filename">/usr/pkg/etc</code> for configuration files,</p></li> 1253<li class="listitem"><p><code class="filename">/usr/pkg/etc</code> for configuration files,</p></li>
1260<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> 1254<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>
1261</ul></div> 1255</ul></div>
1262<p>If you cannot use these directories for whatever reasons (maybe 1256<p>If you cannot use these directories for whatever reasons (maybe
1263 because you're not root), you cannot use these binary packages, but 1257 because you're not root), you cannot use these binary packages, but
1264 have to build the packages yourself, which is explained in <a class="xref" href="#bootstrapping-pkgsrc" title="4.2. Bootstrapping pkgsrc">Section 4.2, &#8220;Bootstrapping pkgsrc&#8221;</a>.</p> 1258 have to build the packages yourself, which is explained in <a class="xref" href="#bootstrapping-pkgsrc" title="4.2. Bootstrapping pkgsrc">Section 4.2, &#8220;Bootstrapping pkgsrc&#8221;</a>.</p>
1265<div class="sect2"> 1259<div class="sect2">
1266<div class="titlepage"><div><div><h3 class="title"> 1260<div class="titlepage"><div><div><h3 class="title">
1267<a name="finding-binary-packages"></a>5.1.1. Finding binary packages</h3></div></div></div> 1261<a name="finding-binary-packages"></a>5.1.1. Finding binary packages</h3></div></div></div>
1268<p>To install binary packages, you first need to know from where 1262<p>To install binary packages, you first need to know from where
1269 to get them. The first place where you should look is on the main 1263 to get them. The first place where you should look is on the main
1270 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> 1264
 1265 pkgsrc FTP server in the directory <a class="ulink" href="http://cdn.NetBSD.org/pub/pkgsrc/packages/" target="_top"><code class="filename">/pub/pkgsrc/packages</code></a>.</p>
1271<p>This directory contains binary packages for multiple 1266<p>This directory contains binary packages for multiple
1272 platforms. First, select your operating system. (Ignore the 1267 platforms. First, select your operating system. (Ignore the
1273 directories with version numbers attached to it, they just exist for 1268 directories with version numbers attached to it, they just exist for
1274 legacy reasons.) Then, select your hardware architecture, and in the 1269 legacy reasons.) Then, select your hardware architecture, and in the
1275 third step, the OS version and the <span class="quote">&#8220;<span class="quote">version</span>&#8221;</span> of pkgsrc.</p> 1270 third step, the OS version and the <span class="quote">&#8220;<span class="quote">version</span>&#8221;</span> of pkgsrc.</p>
1276<p>In this directory, you often find a file called 1271<p>In this directory, you often find a file called
1277 <code class="filename">bootstrap.tar.gz</code> which contains the package 1272 <code class="filename">bootstrap.tar.gz</code> which contains the package
1278 management tools. If the file is missing, it is likely that your 1273 management tools. If the file is missing, it is likely that your
1279 operating system already provides those tools. Download the file and 1274 operating system already provides those tools. Download the file and
1280 extract it in the <code class="filename">/</code> directory. It will create 1275 extract it in the <code class="filename">/</code> directory. It will create
1281 the directories <code class="filename">/usr/pkg</code> (containing the tools 1276 the directories <code class="filename">/usr/pkg</code> (containing the tools
1282 for managing binary packages and the database of installed packages).</p> 1277 for managing binary packages and the database of installed packages).</p>
1283</div> 1278</div>
1284<div class="sect2"> 1279<div class="sect2">
1285<div class="titlepage"><div><div><h3 class="title"> 1280<div class="titlepage"><div><div><h3 class="title">
1286<a name="installing-binary-packages"></a>5.1.2. Installing binary packages</h3></div></div></div> 1281<a name="installing-binary-packages"></a>5.1.2. Installing binary packages</h3></div></div></div>
1287<p>In the directory from the last section, there is a 1282<p>In the directory from the last section, there is a
1288 subdirectory called <code class="filename">All/</code>, which contains all the 1283 subdirectory called <code class="filename">All/</code>, which contains all the
1289 binary packages that are available for the platform, excluding those 1284 binary packages that are available for the platform, excluding those
1290 that may not be distributed via FTP or CDROM (depending on which 1285 that may not be distributed via FTP or CDROM (depending on which
1291 medium you are using).</p> 1286 medium you are using).</p>
1292<p>To install packages directly from an FTP or HTTP server, run 1287<p>To install packages directly from an FTP or HTTP server, run
1293 the following commands in a Bourne-compatible shell (be sure to 1288 the following commands in a Bourne-compatible shell (be sure to
1294 <span class="command"><strong>su</strong></span> to root first):</p> 1289 <span class="command"><strong>su</strong></span> to root first):</p>
1295<pre class="screen"> 1290<pre class="screen">
1296<code class="prompt">#</code> <strong class="userinput"><code>PATH="/usr/pkg/sbin:$PATH"</code></strong> 1291<code class="prompt">#</code> <strong class="userinput"><code>PATH="/usr/pkg/sbin:$PATH"</code></strong>
1297<code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"</code></strong> 1292
 1293<code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages"</code></strong>
1298<code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="$PKG_PATH/<em class="replaceable"><code>OPSYS</code></em>/<em class="replaceable"><code>ARCH</code></em>/<em class="replaceable"><code>VERSIONS</code></em>/All/"</code></strong> 1294<code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="$PKG_PATH/<em class="replaceable"><code>OPSYS</code></em>/<em class="replaceable"><code>ARCH</code></em>/<em class="replaceable"><code>VERSIONS</code></em>/All/"</code></strong>
1299<code class="prompt">#</code> <strong class="userinput"><code>export PATH PKG_PATH</code></strong> 1295<code class="prompt">#</code> <strong class="userinput"><code>export PATH PKG_PATH</code></strong>
1300</pre> 1296</pre>
1301<p>Instead of URLs, you can also use local paths, for example if 1297<p>Instead of URLs, you can also use local paths, for example if
1302 you are installing from a set of CDROMs, DVDs or an NFS-mounted 1298 you are installing from a set of CDROMs, DVDs or an NFS-mounted
1303 repository. If you want to install packages from multiple sources, 1299 repository. If you want to install packages from multiple sources,
1304 you can separate them by a semicolon in 1300 you can separate them by a semicolon in
1305 <code class="varname">PKG_PATH</code>.</p> 1301 <code class="varname">PKG_PATH</code>.</p>
1306<p>After these preparations, installing a package is very 1302<p>After these preparations, installing a package is very
1307 easy:</p> 1303 easy:</p>
1308<pre class="screen"> 1304<pre class="screen">
1309<code class="prompt">#</code> <strong class="userinput"><code>pkg_add libreoffice</code></strong> 1305<code class="prompt">#</code> <strong class="userinput"><code>pkg_add libreoffice</code></strong>
1310<code class="prompt">#</code> <strong class="userinput"><code>pkg_add ap24-php71-*</code></strong> 1306<code class="prompt">#</code> <strong class="userinput"><code>pkg_add ap24-php71-*</code></strong>
1311</pre> 1307</pre>
1312<p>Note that any prerequisite packages needed to run the 1308<p>Note that any prerequisite packages needed to run the
1313 package in question will be installed, too, assuming they are 1309 package in question will be installed, too, assuming they are
1314 present where you install from.</p> 1310 present where you install from.</p>
1315<p>Adding packages might install vulnerable packages. 1311<p>Adding packages might install vulnerable packages.
1316 Thus you should run <span class="command"><strong>pkg_admin audit</strong></span> 1312 Thus you should run <span class="command"><strong>pkg_admin audit</strong></span>
1317 regularly, especially after installing new packages, and verify 1313 regularly, especially after installing new packages, and verify
1318 that the vulnerabilities are acceptable for your configuration.</p> 1314 that the vulnerabilities are acceptable for your configuration.</p>
1319<p>After you've installed packages, be sure to have 1315<p>After you've installed packages, be sure to have
1320 <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your 1316 <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your
1321 <code class="varname">PATH</code> so you can actually start the just 1317 <code class="varname">PATH</code> so you can actually start the just
1322 installed program.</p> 1318 installed program.</p>
1323</div> 1319</div>
1324<div class="sect2"> 1320<div class="sect2">
1325<div class="titlepage"><div><div><h3 class="title"> 1321<div class="titlepage"><div><div><h3 class="title">
1326<a name="using.pkg_delete"></a>5.1.3. Deinstalling packages</h3></div></div></div> 1322<a name="using.pkg_delete"></a>5.1.3. Deinstalling packages</h3></div></div></div>
1327<p>To deinstall a package, it does not matter whether it was 1323<p>To deinstall a package, it does not matter whether it was
1328 installed from source code or from a binary package. The 1324 installed from source code or from a binary package. The
1329 <span class="command"><strong>pkg_delete</strong></span> command does not know it anyway. 1325 <span class="command"><strong>pkg_delete</strong></span> command does not know it anyway.
1330 To delete a package, you can just run <span class="command"><strong>pkg_delete 1326 To delete a package, you can just run <span class="command"><strong>pkg_delete
1331 <em class="replaceable"><code>package-name</code></em></strong></span>. The package 1327 <em class="replaceable"><code>package-name</code></em></strong></span>. The package
1332 name can be given with or without version number. Wildcards can 1328 name can be given with or without version number. Wildcards can
1333 also be used to deinstall a set of packages, for example 1329 also be used to deinstall a set of packages, for example
1334 <code class="literal">*emacs*</code>. Be sure to include them in quotes, 1330 <code class="literal">*emacs*</code>. Be sure to include them in quotes,
1335 so that the shell does not expand them before 1331 so that the shell does not expand them before
1336 <code class="literal">pkg_delete</code> sees them.</p> 1332 <code class="literal">pkg_delete</code> sees them.</p>
1337<p>The <code class="option">-r</code> option is very powerful: it 1333<p>The <code class="option">-r</code> option is very powerful: it
1338 removes all the packages that require the package in question 1334 removes all the packages that require the package in question
1339 and then removes the package itself. For example: 1335 and then removes the package itself. For example:
1340 1336
1341 </p> 1337 </p>
1342<pre class="screen"> 1338<pre class="screen">
1343<code class="prompt">#</code> <strong class="userinput"><code>pkg_delete -r jpeg</code></strong> 1339<code class="prompt">#</code> <strong class="userinput"><code>pkg_delete -r jpeg</code></strong>
1344 </pre> 1340 </pre>
1345<p> 1341<p>
1346 1342
1347 will remove jpeg and all the packages that used it; this allows 1343 will remove jpeg and all the packages that used it; this allows
1348 upgrading the jpeg package.</p> 1344 upgrading the jpeg package.</p>
1349</div> 1345</div>
1350<div class="sect2"> 1346<div class="sect2">
1351<div class="titlepage"><div><div><h3 class="title"> 1347<div class="titlepage"><div><div><h3 class="title">
1352<a name="using.pkg_info"></a>5.1.4. Getting information about installed packages</h3></div></div></div> 1348<a name="using.pkg_info"></a>5.1.4. Getting information about installed packages</h3></div></div></div>
1353<p>The <span class="command"><strong>pkg_info</strong></span> shows information about 1349<p>The <span class="command"><strong>pkg_info</strong></span> shows information about
1354 installed packages or binary package files.</p> 1350 installed packages or binary package files.</p>
1355</div> 1351</div>
1356<div class="sect2"> 1352<div class="sect2">
1357<div class="titlepage"><div><div><h3 class="title"> 1353<div class="titlepage"><div><div><h3 class="title">
1358<a name="vulnerabilities"></a>5.1.5. Checking for security vulnerabilities in installed packages</h3></div></div></div> 1354<a name="vulnerabilities"></a>5.1.5. Checking for security vulnerabilities in installed packages</h3></div></div></div>
1359<p> 1355<p>
1360 The pkgsrc Security Team and Packages Groups maintain a list of 1356 The pkgsrc Security Team and Packages Groups maintain a list of
1361 known security vulnerabilities to packages which are (or have been) 1357 known security vulnerabilities to packages which are (or have been)
1362 included in pkgsrc. The list is available from the NetBSD 1358 included in pkgsrc. The list is available from the NetBSD
1363 FTP site at <a class="ulink" href="https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a>. 1359
 1360 FTP site at <a class="ulink" href="http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a>.
1364 </p> 1361 </p>
1365<p> 1362<p>
1366 Through <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, 1363 Through <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1367 this list can be downloaded 1364 this list can be downloaded
1368 automatically, and a security audit of all packages installed on a system 1365 automatically, and a security audit of all packages installed on a system
1369 can take place. 1366 can take place.
1370 </p> 1367 </p>
1371<p> 1368<p>
1372 There are two components to auditing. The first 1369 There are two components to auditing. The first
1373 step, <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, 1370 step, <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1374 is for downloading 1371 is for downloading
1375 the list of vulnerabilities from the NetBSD FTP site. The second 1372 the list of vulnerabilities from the NetBSD FTP site. The second
1376 step, <span class="command"><strong>pkg_admin audit</strong></span>, checks to see if any of your 1373 step, <span class="command"><strong>pkg_admin audit</strong></span>, checks to see if any of your
1377 installed packages are vulnerable. If a package is vulnerable, you 1374 installed packages are vulnerable. If a package is vulnerable, you
1378 will see output similar to the following: 1375 will see output similar to the following:
1379 </p> 1376 </p>
1380<pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see 1377<pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see
1381 https://www.samba.org/samba/whatsnew/macroexploit.html</pre> 1378 https://www.samba.org/samba/whatsnew/macroexploit.html</pre>
1382<p> 1379<p>
1383 You may wish to have the 1380 You may wish to have the
1384 <a class="ulink" href="https://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a> 1381
 1382 <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a>
1385 file downloaded daily so that 1383 file downloaded daily so that
1386 it remains current. This may be done by adding an appropriate entry 1384 it remains current. This may be done by adding an appropriate entry
1387 to the root users <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?crontab+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span></a> entry. For example the entry 1385 to the root users <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?crontab+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span></a> entry. For example the entry
1388 </p> 1386 </p>
1389<pre class="screen"> 1387<pre class="screen">
1390# Download vulnerabilities file 1388# Download vulnerabilities file
13910 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities &gt;/dev/null 2&gt;&amp;1 13890 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities &gt;/dev/null 2&gt;&amp;1
1392# Audit the installed packages and email results to root 1390# Audit the installed packages and email results to root
13939 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \ 13919 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1394 root &gt;/dev/null 2&gt;&amp;1 1392 root &gt;/dev/null 2&gt;&amp;1
1395 </pre> 1393 </pre>
1396<p> 1394<p>
1397 will update the vulnerability list every day at 3AM, followed by an audit 1395 will update the vulnerability list every day at 3AM, followed by an audit
1398 at 3:09AM. The result of the audit are then emailed to root. 1396 at 3:09AM. The result of the audit are then emailed to root.
1399 1397
1400 On NetBSD this may be accomplished instead by adding the following 1398 On NetBSD this may be accomplished instead by adding the following
1401 line to <code class="filename">/etc/daily.conf</code>: 1399 line to <code class="filename">/etc/daily.conf</code>:
1402 </p> 1400 </p>
1403<pre class="screen"> 1401<pre class="screen">
1404fetch_pkg_vulnerabilities=YES 1402fetch_pkg_vulnerabilities=YES
1405 </pre> 1403 </pre>
1406<p> 1404<p>
1407 to fetch the vulnerability list from the daily security script. The system 1405 to fetch the vulnerability list from the daily security script. The system
1408 is set to audit the packages by default but can be set explicitly, if 1406 is set to audit the packages by default but can be set explicitly, if
1409 desired (not required), by adding the following line to 1407 desired (not required), by adding the following line to
1410<code class="filename">/etc/security.conf</code>: 1408<code class="filename">/etc/security.conf</code>:
1411 </p> 1409 </p>
1412<pre class="screen"> 1410<pre class="screen">
1413check_pkg_vulnerabilities=YES 1411check_pkg_vulnerabilities=YES
1414 </pre> 1412 </pre>
1415<p> 1413<p>
1416 see <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?daily.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">daily.conf</span>(5)</span></a> and <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?security.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">security.conf</span>(5)</span></a> for more details. 1414 see <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?daily.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">daily.conf</span>(5)</span></a> and <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?security.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">security.conf</span>(5)</span></a> for more details.
1417 </p> 1415 </p>
1418</div> 1416</div>
1419<div class="sect2"> 1417<div class="sect2">
1420<div class="titlepage"><div><div><h3 class="title"> 1418<div class="titlepage"><div><div><h3 class="title">
1421<a name="pkg_versions"></a>5.1.6. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div> 1419<a name="pkg_versions"></a>5.1.6. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div>
1422<p> 1420<p>
1423 Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/README.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a> and run 1421 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
1424 <span class="command"><strong>lintpkgsrc</strong></span> with the <span class="quote">&#8220;<span class="quote">-i</span>&#8221;</span> 1422 <span class="command"><strong>lintpkgsrc</strong></span> with the <span class="quote">&#8220;<span class="quote">-i</span>&#8221;</span>
1425 argument to check if your packages are up-to-date, e.g. 1423 argument to check if your packages are up-to-date, e.g.
1426 </p> 1424 </p>
1427<pre class="screen"> 1425<pre class="screen">
1428<code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong> 1426<code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong>
1429... 1427...
1430Version mismatch: 'tcsh' 6.09.00 vs 6.10.00 1428Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1431 </pre> 1429 </pre>
1432<p>You can then use <span class="command"><strong>make update</strong></span> to update the 1430<p>You can then use <span class="command"><strong>make update</strong></span> to update the
1433 package on your system and rebuild any dependencies. 1431 package on your system and rebuild any dependencies.
1434 </p> 1432 </p>
1435</div> 1433</div>
1436<div class="sect2"> 1434<div class="sect2">
1437<div class="titlepage"><div><div><h3 class="title"> 1435<div class="titlepage"><div><div><h3 class="title">
1438<a name="using.pkg_admin"></a>5.1.7. Other administrative functions</h3></div></div></div> 1436<a name="using.pkg_admin"></a>5.1.7. Other administrative functions</h3></div></div></div>
1439<p>The <span class="command"><strong>pkg_admin</strong></span> executes various 1437<p>The <span class="command"><strong>pkg_admin</strong></span> executes various
1440 administrative functions on the package system.</p> 1438 administrative functions on the package system.</p>
1441</div> 1439</div>
1442</div> 1440</div>
1443<div class="sect1"> 1441<div class="sect1">
1444<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1442<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1445<a name="building-packages-from-source"></a>5.2. Building packages from source</h2></div></div></div> 1443<a name="building-packages-from-source"></a>5.2. Building packages from source</h2></div></div></div>
1446<p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code> 1444<p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
1447 directory now contains a set of packages, organized into 1445 directory now contains a set of packages, organized into
1448 categories. You can browse the online index of packages, or run 1446 categories. You can browse the online index of packages, or run
1449 <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code> 1447 <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code>
1450 directory to build local <code class="filename">README.html</code> files for 1448 directory to build local <code class="filename">README.html</code> files for
1451 all packages, viewable with any web browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p> 1449 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>
1452<p>The default <span class="emphasis"><em>prefix</em></span> for installed packages 1450<p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
1453 is <code class="filename">/usr/pkg</code>. If you wish to change this, you 1451 is <code class="filename">/usr/pkg</code>. If you wish to change this, you
1454 should do so by setting <code class="varname">LOCALBASE</code> in 1452 should do so by setting <code class="varname">LOCALBASE</code> in
1455 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. You should not try to use multiple 1453 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. You should not try to use multiple
1456 different <code class="varname">LOCALBASE</code> definitions on the same 1454 different <code class="varname">LOCALBASE</code> definitions on the same
1457 system (inside a chroot is an exception). </p> 1455 system (inside a chroot is an exception). </p>
1458<p>The rest of this chapter assumes that the package is already 1456<p>The rest of this chapter assumes that the package is already
1459 in pkgsrc. If it is not, see <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a> for 1457 in pkgsrc. If it is not, see <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a> for
1460 instructions how to create your own packages.</p> 1458 instructions how to create your own packages.</p>
1461<div class="sect2"> 1459<div class="sect2">
1462<div class="titlepage"><div><div><h3 class="title"> 1460<div class="titlepage"><div><div><h3 class="title">
1463<a name="requirements"></a>5.2.1. Requirements</h3></div></div></div> 1461<a name="requirements"></a>5.2.1. Requirements</h3></div></div></div>
1464<p>To build packages from source, you need a working C 1462<p>To build packages from source, you need a working C
1465 compiler. On NetBSD, you need to install the 1463 compiler. On NetBSD, you need to install the
1466 <span class="quote">&#8220;<span class="quote">comp</span>&#8221;</span> and the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> distribution 1464 <span class="quote">&#8220;<span class="quote">comp</span>&#8221;</span> and the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> distribution
1467 sets. If you want to build X11-related packages, the 1465 sets. If you want to build X11-related packages, the
1468 <span class="quote">&#8220;<span class="quote">xbase</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">xcomp</span>&#8221;</span> distribution 1466 <span class="quote">&#8220;<span class="quote">xbase</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">xcomp</span>&#8221;</span> distribution
1469 sets are required, too.</p> 1467 sets are required, too.</p>
1470</div> 1468</div>
1471<div class="sect2"> 1469<div class="sect2">
1472<div class="titlepage"><div><div><h3 class="title"> 1470<div class="titlepage"><div><div><h3 class="title">
1473<a name="fetching-distfiles"></a>5.2.2. Fetching distfiles</h3></div></div></div> 1471<a name="fetching-distfiles"></a>5.2.2. Fetching distfiles</h3></div></div></div>
1474<p>The first step for building a package is downloading the 1472<p>The first step for building a package is downloading the
1475 distfiles (i.e. the unmodified source). If they have not yet been 1473 distfiles (i.e. the unmodified source). If they have not yet been
1476 downloaded, pkgsrc will fetch them automatically.</p> 1474 downloaded, pkgsrc will fetch them automatically.</p>
1477<p>If you have all files that you need in the 1475<p>If you have all files that you need in the
1478 <code class="filename">distfiles</code> directory, 1476 <code class="filename">distfiles</code> directory,
1479 you don't need to connect. If the distfiles are on CD-ROM, you can 1477 you don't need to connect. If the distfiles are on CD-ROM, you can
1480 mount the CD-ROM on <code class="filename">/cdrom</code> and add: 1478 mount the CD-ROM on <code class="filename">/cdrom</code> and add:
1481 </p> 1479 </p>
1482<pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre> 1480<pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre>
1483<p> 1481<p>
1484 to your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 1482 to your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1485<p>By default a list of distribution sites will be randomly 1483<p>By default a list of distribution sites will be randomly
1486 intermixed to prevent huge load on servers which holding popular 1484 intermixed to prevent huge load on servers which holding popular
1487 packages (for example, SourceForge.net mirrors). Thus, every 1485 packages (for example, SourceForge.net mirrors). Thus, every
1488 time when you need to fetch yet another distfile all the mirrors 1486 time when you need to fetch yet another distfile all the mirrors
1489 will be tried in new (random) order. You can turn this feature 1487 will be tried in new (random) order. You can turn this feature
1490 off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for 1488 off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for
1491 <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p> 1489 <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p>
1492<p>You can overwrite some of the major distribution sites to 1490<p>You can overwrite some of the major distribution sites to
1493 fit to sites that are close to your own. By setting one or two 1491 fit to sites that are close to your own. By setting one or two
1494 variables you can modify the order in which the master sites are 1492 variables you can modify the order in which the master sites are
1495 accessed. <code class="varname">MASTER_SORT</code> contains a whitespace 1493 accessed. <code class="varname">MASTER_SORT</code> contains a whitespace
1496 delimited list of domain suffixes. 1494 delimited list of domain suffixes.
1497 <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it 1495 <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it
1498 contains a whitespace delimited list of regular expressions. It 1496 contains a whitespace delimited list of regular expressions. It
1499 has higher priority than <code class="varname">MASTER_SORT</code>. Have a 1497 has higher priority than <code class="varname">MASTER_SORT</code>. Have a
1500 look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find 1498 look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find
1501 some examples. This may save some of your bandwidth and 1499 some examples. This may save some of your bandwidth and
1502 time.</p> 1500 time.</p>
1503<p>You can change these settings either in your shell's environment, or, 1501<p>You can change these settings either in your shell's environment, or,
1504 if you want to keep the settings, by editing the 1502 if you want to keep the settings, by editing the
1505 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file, 1503 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file,
1506 and adding the definitions there.</p> 1504 and adding the definitions there.</p>
1507<p> 1505<p>
1508 If a package depends on many other packages (such as 1506 If a package depends on many other packages (such as
1509 <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a>), the build process may 1507 <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
1510 alternate between periods of 1508 alternate between periods of
1511 downloading source, and compiling. To ensure you have all the source 1509 downloading source, and compiling. To ensure you have all the source
1512 downloaded initially you can run the command: 1510 downloaded initially you can run the command:
1513 </p> 1511 </p>
1514<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre> 1512<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre>
1515<p> 1513<p>
1516 which will output and run a set of shell commands to fetch the 1514 which will output and run a set of shell commands to fetch the
1517 necessary files into the <code class="filename">distfiles</code> directory. You can 1515 necessary files into the <code class="filename">distfiles</code> directory. You can
1518 also choose to download the files manually. 1516 also choose to download the files manually.
1519 </p> 1517 </p>
1520</div> 1518</div>
1521<div class="sect2"> 1519<div class="sect2">
1522<div class="titlepage"><div><div><h3 class="title"> 1520<div class="titlepage"><div><div><h3 class="title">
1523<a name="how-to-build-and-install"></a>5.2.3. How to build and install</h3></div></div></div> 1521<a name="how-to-build-and-install"></a>5.2.3. How to build and install</h3></div></div></div>
1524<p> 1522<p>
1525 Once the software has downloaded, any patches will be applied, then it 1523 Once the software has downloaded, any patches will be applied, then it
1526 will be compiled for you. This may take some time depending on your 1524 will be compiled for you. This may take some time depending on your
1527 computer, and how many other packages the software depends on and their 1525 computer, and how many other packages the software depends on and their
1528 compile time. 1526 compile time.
1529 </p> 1527 </p>
1530<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 1528<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1531<h3 class="title">Note</h3> 1529<h3 class="title">Note</h3>
1532<p>If using bootstrap or pkgsrc on a non-NetBSD system, 1530<p>If using bootstrap or pkgsrc on a non-NetBSD system,
1533 use the pkgsrc <span class="command"><strong>bmake</strong></span> command instead of 1531 use the pkgsrc <span class="command"><strong>bmake</strong></span> command instead of
1534 <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> in the examples in this guide.</p> 1532 <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> in the examples in this guide.</p>
1535</div> 1533</div>
1536<p>For example, type</p> 1534<p>For example, type</p>
1537<pre class="screen"> 1535<pre class="screen">
1538<code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong> 1536<code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
1539<code class="prompt">%</code> <strong class="userinput"><code>make</code></strong> 1537<code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
1540 </pre> 1538 </pre>
1541<p>at the shell prompt to build the various components of the 1539<p>at the shell prompt to build the various components of the
1542 package.</p> 1540 package.</p>
1543<p>The next stage is to actually install the newly compiled 1541<p>The next stage is to actually install the newly compiled
1544 program onto your system. Do this by entering: 1542 program onto your system. Do this by entering:
1545 1543
1546 </p> 1544 </p>
1547<pre class="screen"> 1545<pre class="screen">
1548<code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong> 1546<code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong>
1549 </pre> 1547 </pre>
1550<p> 1548<p>
1551 1549
1552 while you are still in the directory for whatever package you 1550 while you are still in the directory for whatever package you
1553 are installing.</p> 1551 are installing.</p>
1554<p>Installing the package on your system may require you to 1552<p>Installing the package on your system may require you to
1555 be root. However, pkgsrc has a 1553 be root. However, pkgsrc has a
1556 <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you 1554 <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you
1557 to only become root for the actual installation step.</p> 1555 to only become root for the actual installation step.</p>
1558<p>That's it, the software should now be installed and setup for use. 1556<p>That's it, the software should now be installed and setup for use.
1559 You can now enter: 1557 You can now enter:
1560 1558
1561 </p> 1559 </p>
1562<pre class="screen"> 1560<pre class="screen">
1563<code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong> 1561<code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong>
1564 </pre> 1562 </pre>
1565<p> 1563<p>
1566 1564
1567 to remove the compiled files in the work directory, as you shouldn't need 1565 to remove the compiled files in the work directory, as you shouldn't need
1568 them any more. If other packages were also added to your system 1566 them any more. If other packages were also added to your system
1569 (dependencies) to allow your program to compile, you can tidy these up 1567 (dependencies) to allow your program to compile, you can tidy these up
1570 also with the command:</p> 1568 also with the command:</p>
1571<pre class="screen"> 1569<pre class="screen">
1572<code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong> 1570<code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong>
1573 </pre> 1571 </pre>
1574<p>Taking the figlet utility as an example, we can install it on our 1572<p>Taking the figlet utility as an example, we can install it on our
1575 system by building as shown in <a class="xref" href="#logs" title="Appendix B. Build logs">Appendix B, <i>Build logs</i></a>.</p> 1573 system by building as shown in <a class="xref" href="#logs" title="Appendix B. Build logs">Appendix B, <i>Build logs</i></a>.</p>
1576<p>The program is installed under the default root of the 1574<p>The program is installed under the default root of the
1577 packages tree - <code class="filename">/usr/pkg</code>. Should this not 1575 packages tree - <code class="filename">/usr/pkg</code>. Should this not
1578 conform to your tastes, set the <code class="varname">LOCALBASE</code> 1576 conform to your tastes, set the <code class="varname">LOCALBASE</code>
1579 variable in your environment, and it will use that value as the 1577 variable in your environment, and it will use that value as the
1580 root of your packages tree. So, to use 1578 root of your packages tree. So, to use
1581 <code class="filename">/usr/local</code>, set 1579 <code class="filename">/usr/local</code>, set
1582 <code class="varname">LOCALBASE=/usr/local</code> in your environment. 1580 <code class="varname">LOCALBASE=/usr/local</code> in your environment.
1583 Please note that you should use a directory which is dedicated to 1581 Please note that you should use a directory which is dedicated to
1584 packages and not shared with other programs (i.e., do not try and 1582 packages and not shared with other programs (i.e., do not try and
1585 use <code class="varname">LOCALBASE=/usr</code>). Also, you should not try 1583 use <code class="varname">LOCALBASE=/usr</code>). Also, you should not try
1586 to add any of your own files or directories (such as 1584 to add any of your own files or directories (such as
1587 <code class="filename">src/</code>, <code class="filename">obj/</code>, or 1585 <code class="filename">src/</code>, <code class="filename">obj/</code>, or
1588 <code class="filename">pkgsrc/</code>) below the 1586 <code class="filename">pkgsrc/</code>) below the
1589 <code class="varname">LOCALBASE</code> tree. This is to prevent possible 1587 <code class="varname">LOCALBASE</code> tree. This is to prevent possible
1590 conflicts between programs and other files installed by the 1588 conflicts between programs and other files installed by the
1591 package system and whatever else may have been installed 1589 package system and whatever else may have been installed
1592 there.</p> 1590 there.</p>
1593<p>Some packages look in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to 1591<p>Some packages look in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1594 alter some configuration options at build time. Have a look at 1592 alter some configuration options at build time. Have a look at
1595 <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview 1593 <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview
1596 of what will be set there by default. Environment variables such 1594 of what will be set there by default. Environment variables such
1597 as <code class="varname">LOCALBASE</code> can be set in 1595 as <code class="varname">LOCALBASE</code> can be set in
1598 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to save having to remember to 1596 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to save having to remember to
1599 set them each time you want to use pkgsrc.</p> 1597 set them each time you want to use pkgsrc.</p>
1600<p>Occasionally, people want to <span class="quote">&#8220;<span class="quote">look under the 1598<p>Occasionally, people want to <span class="quote">&#8220;<span class="quote">look under the
1601 covers</span>&#8221;</span> to see what is going on when a package is building 1599 covers</span>&#8221;</span> to see what is going on when a package is building
1602 or being installed. This may be for debugging purposes, or out of 1600 or being installed. This may be for debugging purposes, or out of
1603 simple curiosity. A number of utility values have been added to 1601 simple curiosity. A number of utility values have been added to
1604 help with this.</p> 1602 help with this.</p>
1605<div class="orderedlist"><ol class="orderedlist" type="1"> 1603<div class="orderedlist"><ol class="orderedlist" type="1">
1606<li class="listitem"> 1604<li class="listitem">
1607<p>If you invoke the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with 1605<p>If you invoke the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with
1608 <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of 1606 <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of
1609 information will be displayed. For example,</p> 1607 information will be displayed. For example,</p>
1610<pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre> 1608<pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre>
1611<p>will show all the commands that are invoked, up to and 1609<p>will show all the commands that are invoked, up to and
1612 including the <span class="quote">&#8220;<span class="quote">patch</span>&#8221;</span> stage.</p> 1610 including the <span class="quote">&#8220;<span class="quote">patch</span>&#8221;</span> stage.</p>
1613</li> 1611</li>
1614<li class="listitem"> 1612<li class="listitem">
1615<p>If you want to know the value of a certain <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> 1613<p>If you want to know the value of a certain <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1616 definition, then the <code class="varname">VARNAME</code> definition 1614 definition, then the <code class="varname">VARNAME</code> definition
1617 should be used, in conjunction with the show-var 1615 should be used, in conjunction with the show-var
1618 target. e.g. to show the expansion of the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> 1616 target. e.g. to show the expansion of the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1619 variable <code class="varname">LOCALBASE</code>:</p> 1617 variable <code class="varname">LOCALBASE</code>:</p>
1620<pre class="screen"> 1618<pre class="screen">
1621<code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong> 1619<code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1622/usr/pkg 1620/usr/pkg
1623<code class="prompt">%</code> 1621<code class="prompt">%</code>
1624 </pre> 1622 </pre>
1625</li> 1623</li>
1626</ol></div> 1624</ol></div>
1627<p>If you want to install a binary package that you've either 1625<p>If you want to install a binary package that you've either
1628 created yourself (see next section), that you put into 1626 created yourself (see next section), that you put into
1629 pkgsrc/packages manually or that is located on a remote FTP 1627 pkgsrc/packages manually or that is located on a remote FTP
1630 server, you can use the "bin-install" target. This target will 1628 server, you can use the "bin-install" target. This target will
1631 install a binary package - if available - via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>, 1629 install a binary package - if available - via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>,
1632 else do a <span class="command"><strong>make package</strong></span>. The list of remote FTP 1630 else do a <span class="command"><strong>make package</strong></span>. The list of remote FTP
1633 sites searched is kept in the variable 1631 sites searched is kept in the variable
1634 <code class="varname">BINPKG_SITES</code>, which defaults to 1632 <code class="varname">BINPKG_SITES</code>, which defaults to
1635 ftp.NetBSD.org. Any flags that should be added to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> 1633 ftp.NetBSD.org. Any flags that should be added to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>
1636 can be put into <code class="varname">BIN_INSTALL_FLAGS</code>. See 1634 can be put into <code class="varname">BIN_INSTALL_FLAGS</code>. See
1637 <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more 1635 <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more
1638 details.</p> 1636 details.</p>
1639<p>A final word of warning: If you set up a system that has a 1637<p>A final word of warning: If you set up a system that has a
1640 non-standard setting for <code class="varname">LOCALBASE</code>, be sure to 1638 non-standard setting for <code class="varname">LOCALBASE</code>, be sure to
1641 set that before any packages are installed, as you cannot use 1639 set that before any packages are installed, as you cannot use
1642 several directories for the same purpose. Doing so will result in 1640 several directories for the same purpose. Doing so will result in
1643 pkgsrc not being able to properly detect your installed packages, 1641 pkgsrc not being able to properly detect your installed packages,
1644 and fail miserably. Note also that precompiled binary packages are 1642 and fail miserably. Note also that precompiled binary packages are
1645 usually built with the default <code class="varname">LOCALBASE</code> of 1643 usually built with the default <code class="varname">LOCALBASE</code> of
1646 <code class="filename">/usr/pkg</code>, and that you should 1644 <code class="filename">/usr/pkg</code>, and that you should
1647 <span class="emphasis"><em>not</em></span> install any if you use a non-standard 1645 <span class="emphasis"><em>not</em></span> install any if you use a non-standard
1648 <code class="varname">LOCALBASE</code>.</p> 1646 <code class="varname">LOCALBASE</code>.</p>
1649</div> 1647</div>
1650</div> 1648</div>
1651</div> 1649</div>
1652<div class="chapter"> 1650<div class="chapter">
1653<div class="titlepage"><div><div><h2 class="title"> 1651<div class="titlepage"><div><div><h2 class="title">
1654<a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div> 1652<a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div>
1655<div class="toc"> 1653<div class="toc">
1656<p><b>Table of Contents</b></p> 1654<p><b>Table of Contents</b></p>
1657<dl class="toc"> 1655<dl class="toc">
1658<dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt> 1656<dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
1659<dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt> 1657<dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
1660<dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt> 1658<dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
1661<dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt> 1659<dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1662<dd><dl> 1660<dd><dl>
1663<dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt> 1661<dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
1664<dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt> 1662<dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
1665<dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt> 1663<dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1666</dl></dd> 1664</dl></dd>
1667<dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt> 1665<dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
1668<dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt> 1666<dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1669</dl> 1667</dl>
1670</div> 1668</div>
1671<a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually 1669<a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1672called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for 1670called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
1673that file depends on the installation. On NetBSD, when you use 1671that file depends on the installation. On NetBSD, when you use
1674<a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory 1672<a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory
1675<code class="filename">/etc/</code>. In all other cases the default location is 1673<code class="filename">/etc/</code>. In all other cases the default location is
1676<code class="literal">${PREFIX}/etc/</code>, depending on where you told the 1674<code class="literal">${PREFIX}/etc/</code>, depending on where you told the
1677bootstrap program to install the binary packages.</p> 1675bootstrap program to install the binary packages.</p>
1678<p>The format of the configuration file is that of the usual 1676<p>The format of the configuration file is that of the usual
1679BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration 1677BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
1680is done by setting variables in this file. Note that you can define all 1678is done by setting variables in this file. Note that you can define all
1681kinds of variables, and no special error checking (for example for 1679kinds of variables, and no special error checking (for example for
1682spelling mistakes) takes place.</p> 1680spelling mistakes) takes place.</p>
1683<div class="sect1"> 1681<div class="sect1">
1684<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1682<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1685<a name="general-configuration"></a>6.1. General configuration</h2></div></div></div> 1683<a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1686<p>The following variables apply to all 1684<p>The following variables apply to all
1687 pkgsrc packages. A complete list of the variables that can be 1685 pkgsrc packages. A complete list of the variables that can be
1688 configured by the user is available in 1686 configured by the user is available in
1689 <code class="filename">mk/defaults/mk.conf</code>, together with some 1687 <code class="filename">mk/defaults/mk.conf</code>, together with some
1690 comments that describe each variable's intent.</p> 1688 comments that describe each variable's intent.</p>
1691<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1689<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1692<li class="listitem"><p><code class="varname">LOCALBASE</code>: Where 1690<li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1693 packages will be installed. The default is 1691 packages will be installed. The default is
1694 <code class="filename">/usr/pkg</code>. Do not mix binary packages 1692 <code class="filename">/usr/pkg</code>. Do not mix binary packages
1695 with different <code class="varname">LOCALBASE</code>s!</p></li> 1693 with different <code class="varname">LOCALBASE</code>s!</p></li>
1696<li class="listitem"><p><code class="varname">CROSSBASE</code>: Where 1694<li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
1697 <span class="quote">&#8220;<span class="quote">cross</span>&#8221;</span> category packages will be 1695 <span class="quote">&#8220;<span class="quote">cross</span>&#8221;</span> category packages will be
1698 installed. The default is 1696 installed. The default is
1699 <code class="filename">${LOCALBASE}/cross</code>.</p></li> 1697 <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1700<li class="listitem"><p><code class="varname">X11BASE</code>: Where 1698<li class="listitem"><p><code class="varname">X11BASE</code>: Where
1701 X11 is installed on the system. The default is 1699 X11 is installed on the system. The default is
1702 <code class="filename">/usr/X11R7</code>.</p></li> 1700 <code class="filename">/usr/X11R7</code>.</p></li>
1703<li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the 1701<li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1704 downloaded copies of the original source distributions used 1702 downloaded copies of the original source distributions used
1705 for building pkgsrc packages. The default is 1703 for building pkgsrc packages. The default is
1706 <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li> 1704 <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1707<li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the 1705<li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1708 database about installed packages is stored. The default is 1706 database about installed packages is stored. The default is
1709 <code class="filename">/usr/pkg/pkgdb</code>.</p></li> 1707 <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1710<li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>: 1708<li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1711 If set, override the packages' 1709 If set, override the packages'
1712 <code class="varname">MASTER_SITES</code> with this value.</p></li> 1710 <code class="varname">MASTER_SITES</code> with this value.</p></li>
1713<li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>: 1711<li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1714 Backup location(s) for distribution files and patch files 1712 Backup location(s) for distribution files and patch files
1715 if not found locally or in 1713 if not found locally or in
1716 <code class="filename">${MASTER_SITES}</code> or 1714 <code class="filename">${MASTER_SITES}</code> or
1717 <code class="filename">${PATCH_SITES}</code> respectively. 1715 <code class="filename">${PATCH_SITES}</code> respectively.
1718 The defaults is 1716 The defaults is
1719 <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li> 1717 <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1720<li class="listitem"><p><code class="varname">BINPKG_SITES</code>: 1718<li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1721 List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and 1719 List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
1722 <em class="replaceable"><code>arch</code></em> are replaced with OS 1720 <em class="replaceable"><code>arch</code></em> are replaced with OS
1723 release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture 1721 release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture
1724 (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li> 1722 (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li>
1725<li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>: 1723<li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1726 List of acceptable licenses. License names are case-sensitive. 1724 List of acceptable licenses. License names are case-sensitive.
1727 Whenever you try to build a package whose license is not in this 1725 Whenever you try to build a package whose license is not in this
1728 list, you will get an error message. If the license condition is 1726 list, you will get an error message. If the license condition is
1729 simple enough, the error message will include specific 1727 simple enough, the error message will include specific
1730 instructions on how to change this variable.</p></li> 1728 instructions on how to change this variable.</p></li>
1731</ul></div> 1729</ul></div>
1732</div> 1730</div>
1733<div class="sect1"> 1731<div class="sect1">
1734<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1732<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1735<a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div> 1733<a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1736<p> 1734<p>
1737 </p> 1735 </p>
1738<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1736<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1739<li class="listitem"><p><code class="varname">PACKAGES</code>: The top level 1737<li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1740 directory for the binary packages. The default is 1738 directory for the binary packages. The default is
1741 <code class="filename">${PKGSRCDIR}/packages</code>.</p></li> 1739 <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1742<li class="listitem"><p><code class="varname">WRKOBJDIR</code>: 1740<li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1743 The top level directory where, if defined, the separate 1741 The top level directory where, if defined, the separate
1744 working directories will get created, and symbolically 1742 working directories will get created, and symbolically
1745 linked to from <code class="filename">${WRKDIR}</code> (see below). 1743 linked to from <code class="filename">${WRKDIR}</code> (see below).
1746 This is useful for building packages on several 1744 This is useful for building packages on several
1747 architectures, then <code class="filename">${PKGSRCDIR}</code> 1745 architectures, then <code class="filename">${PKGSRCDIR}</code>
1748 can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code> 1746 can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
1749 is local to every architecture. (It should be noted that 1747 is local to every architecture. (It should be noted that
1750 <code class="varname">PKGSRCDIR</code> should not be set by the user 1748 <code class="varname">PKGSRCDIR</code> should not be set by the user
1751 &mdash; it is an internal definition which refers to the 1749 &mdash; it is an internal definition which refers to the
1752 root of the pkgsrc tree. It is possible to have many 1750 root of the pkgsrc tree. It is possible to have many
1753 pkgsrc tree instances.)</p></li> 1751 pkgsrc tree instances.)</p></li>
1754<li class="listitem"><p><code class="varname">LOCALPATCHES</code>: 1752<li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1755 Directory for local patches that aren't part of pkgsrc. 1753 Directory for local patches that aren't part of pkgsrc.
1756 See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more 1754 See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more
1757 information.</p></li> 1755 information.</p></li>
1758<li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of 1756<li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1759 the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's 1757 the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1760 BSD-style Makefile. If this is not set, 1758 BSD-style Makefile. If this is not set,
1761 <code class="varname">MAKECONF</code> is set to 1759 <code class="varname">MAKECONF</code> is set to
1762 <code class="filename">/dev/null</code> to avoid picking up 1760 <code class="filename">/dev/null</code> to avoid picking up
1763 settings used by builds in <code class="filename">/usr/src</code>.</p></li> 1761 settings used by builds in <code class="filename">/usr/src</code>.</p></li>
1764</ul></div> 1762</ul></div>
1765</div> 1763</div>
1766<div class="sect1"> 1764<div class="sect1">
1767<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1765<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1768<a name="variables-affecting-installation"></a>6.3. Variables affecting the installation process</h2></div></div></div> 1766<a name="variables-affecting-installation"></a>6.3. Variables affecting the installation process</h2></div></div></div>
1769<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGSRC</code>: 1767<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGSRC</code>:
1770 By default, binary packages of built packages are 1768 By default, binary packages of built packages are
1771 preserved in <code class="filename">${PACKAGES}/All</code>. Setting 1769 preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1772 this variable to "no" prevents this.</p></li></ul></div> 1770 this variable to "no" prevents this.</p></li></ul></div>
1773<p>Packages have to support installation into a 1771<p>Packages have to support installation into a
1774 subdirectory of <code class="varname">WRKDIR</code>. This allows a package 1772 subdirectory of <code class="varname">WRKDIR</code>. This allows a package
1775 to be built, before the actual filesystem is touched. DESTDIR 1773 to be built, before the actual filesystem is touched. DESTDIR
1776 support exists in two variations:</p> 1774 support exists in two variations:</p>
1777<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1775<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1778<li class="listitem"><p>Basic DESTDIR support means that the package 1776<li class="listitem"><p>Basic DESTDIR support means that the package
1779 installation and packaging is still run as root.</p></li> 1777 installation and packaging is still run as root.</p></li>
1780<li class="listitem"><p>Full DESTDIR support can run the complete 1778<li class="listitem"><p>Full DESTDIR support can run the complete
1781 build, installation and packaging as normal user. Root 1779 build, installation and packaging as normal user. Root
1782 privileges are only needed to add packages.</p></li> 1780 privileges are only needed to add packages.</p></li>
1783</ul></div> 1781</ul></div>
1784<p>With basic DESTDIR support, <strong class="userinput"><code>make 1782<p>With basic DESTDIR support, <strong class="userinput"><code>make
1785 clean</code></strong> needs to be run as root.</p> 1783 clean</code></strong> needs to be run as root.</p>
1786<p>Considering the <code class="filename">foo/bar</code> package, 1784<p>Considering the <code class="filename">foo/bar</code> package,
1787 DESTDIR full support can be tested using the following commands 1785 DESTDIR full support can be tested using the following commands
1788 1786
1789</p> 1787</p>
1790<pre class="programlisting"> 1788<pre class="programlisting">
1791<code class="prompt">$</code> id 1789<code class="prompt">$</code> id
1792uid=1000(myusername) gid=100(users) groups=100(users),0(wheel) 1790uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1793<code class="prompt">$</code> mkdir $HOME/packages 1791<code class="prompt">$</code> mkdir $HOME/packages
1794<code class="prompt">$</code> cd $PKGSRCDIR/foo/bar 1792<code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
1795</pre> 1793</pre>
1796<p> 1794<p>
1797 1795
1798 Verify <code class="varname">DESTDIR</code> full support, no root privileges 1796 Verify <code class="varname">DESTDIR</code> full support, no root privileges
1799 should be needed 1797 should be needed
1800 1798
1801</p> 1799</p>
1802<pre class="programlisting"> 1800<pre class="programlisting">
1803<code class="prompt">$</code> make stage-install 1801<code class="prompt">$</code> make stage-install
1804</pre> 1802</pre>
1805<p> 1803<p>
1806 1804
1807 Create a package without root privileges 1805 Create a package without root privileges
1808 1806
1809</p> 1807</p>
1810<pre class="programlisting"> 1808<pre class="programlisting">
1811<code class="prompt">$</code> make PACKAGES=$HOME/packages package 1809<code class="prompt">$</code> make PACKAGES=$HOME/packages package
1812</pre> 1810</pre>
1813<p> 1811<p>
1814 1812
1815 For the following command, you must be able to gain root 1813 For the following command, you must be able to gain root
1816 privileges using <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> 1814 privileges using <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a>
1817 1815
1818</p> 1816</p>
1819<pre class="programlisting"> 1817<pre class="programlisting">
1820<code class="prompt">$</code> make PACKAGES=$HOME/packages install 1818<code class="prompt">$</code> make PACKAGES=$HOME/packages install
1821</pre> 1819</pre>
1822<p> 1820<p>
1823 1821
1824 Then, as a simple user 1822 Then, as a simple user
1825 1823
1826</p> 1824</p>
1827<pre class="programlisting"> 1825<pre class="programlisting">
1828<code class="prompt">$</code> make clean 1826<code class="prompt">$</code> make clean
1829</pre> 1827</pre>
1830<p> 1828<p>
1831 1829
1832 </p> 1830 </p>
1833</div> 1831</div>
1834<div class="sect1"> 1832<div class="sect1">
1835<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1833<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1836<a name="conf.compiler"></a>6.4. Selecting and configuring the compiler</h2></div></div></div> 1834<a name="conf.compiler"></a>6.4. Selecting and configuring the compiler</h2></div></div></div>
1837<div class="sect2"> 1835<div class="sect2">
1838<div class="titlepage"><div><div><h3 class="title"> 1836<div class="titlepage"><div><div><h3 class="title">
1839<a name="selecting-the-compiler"></a>6.4.1. Selecting the compiler</h3></div></div></div> 1837<a name="selecting-the-compiler"></a>6.4.1. Selecting the compiler</h3></div></div></div>
1840<p>By default, pkgsrc will use GCC to build packages. This may be 1838<p>By default, pkgsrc will use GCC to build packages. This may be
1841 overridden by setting the following variables in /etc/mk.conf:</p> 1839 overridden by setting the following variables in /etc/mk.conf:</p>
1842<div class="variablelist"><dl class="variablelist"> 1840<div class="variablelist"><dl class="variablelist">
1843<dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt> 1841<dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
1844<dd> 1842<dd>
1845<p>This is a list of values specifying the chain of 1843<p>This is a list of values specifying the chain of
1846 compilers to invoke when building packages. Valid values 1844 compilers to invoke when building packages. Valid values
1847 are:</p> 1845 are:</p>
1848<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1846<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1849<li class="listitem"><p><code class="varname">ccc</code>: 1847<li class="listitem"><p><code class="varname">ccc</code>:
1850 Compaq C Compilers (Tru64)</p></li> 1848 Compaq C Compilers (Tru64)</p></li>
1851<li class="listitem"><p><code class="varname">ccache</code>: 1849<li class="listitem"><p><code class="varname">ccache</code>:
1852 compiler cache (chainable)</p></li> 1850 compiler cache (chainable)</p></li>
1853<li class="listitem"><p><code class="varname">clang</code>: 1851<li class="listitem"><p><code class="varname">clang</code>:
1854 Clang C and Objective-C compiler</p></li> 1852 Clang C and Objective-C compiler</p></li>
1855<li class="listitem"><p><code class="varname">distcc</code>: 1853<li class="listitem"><p><code class="varname">distcc</code>:
1856 distributed C/C++ (chainable)</p></li> 1854 distributed C/C++ (chainable)</p></li>
1857<li class="listitem"><p><code class="varname">f2c</code>: 1855<li class="listitem"><p><code class="varname">f2c</code>:
1858 Fortran 77 to C compiler (chainable)</p></li> 1856 Fortran 77 to C compiler (chainable)</p></li>
1859<li class="listitem"><p><code class="varname">icc</code>: 1857<li class="listitem"><p><code class="varname">icc</code>:
1860 Intel C++ Compiler (Linux)</p></li> 1858 Intel C++ Compiler (Linux)</p></li>
1861<li class="listitem"><p><code class="varname">ido</code>: 1859<li class="listitem"><p><code class="varname">ido</code>:
1862 SGI IRIS Development Option cc (IRIX 5)</p></li> 1860 SGI IRIS Development Option cc (IRIX 5)</p></li>
1863<li class="listitem"><p><code class="varname">gcc</code>: 1861<li class="listitem"><p><code class="varname">gcc</code>:
1864 GNU C/C++ Compiler</p></li> 1862 GNU C/C++ Compiler</p></li>
1865<li class="listitem"><p><code class="varname">hp</code>: 1863<li class="listitem"><p><code class="varname">hp</code>:
1866 HP-UX C/aC++ compilers</p></li> 1864 HP-UX C/aC++ compilers</p></li>
1867<li class="listitem"><p><code class="varname">mipspro</code>: 1865<li class="listitem"><p><code class="varname">mipspro</code>:
1868 Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li> 1866 Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1869<li class="listitem"><p><code class="varname">mipspro-ucode</code>: 1867<li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1870 Silicon Graphics, Inc. MIPSpro (o32)</p></li> 1868 Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1871<li class="listitem"><p><code class="varname">sunpro</code>: 1869<li class="listitem"><p><code class="varname">sunpro</code>:
1872 Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li> 1870 Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1873<li class="listitem"><p><code class="varname">xlc</code>: 1871<li class="listitem"><p><code class="varname">xlc</code>:
1874 IBM's XL C/C++ compiler suite</p></li> 1872 IBM's XL C/C++ compiler suite</p></li>
1875</ul></div> 1873</ul></div>
1876<p>The default is 1874<p>The default is
1877 <span class="quote">&#8220;<span class="quote"><code class="varname">gcc</code></span>&#8221;</span>. You can use 1875 <span class="quote">&#8220;<span class="quote"><code class="varname">gcc</code></span>&#8221;</span>. You can use
1878 <code class="varname">ccache</code> and/or 1876 <code class="varname">ccache</code> and/or
1879 <code class="varname">distcc</code> with an appropriate 1877 <code class="varname">distcc</code> with an appropriate
1880 <code class="varname">PKGSRC_COMPILER</code> setting, 1878 <code class="varname">PKGSRC_COMPILER</code> setting,
1881 e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">ccache gcc</code></span>&#8221;</span>. This 1879 e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">ccache gcc</code></span>&#8221;</span>. This
1882 variable should always be terminated with a value for 1880 variable should always be terminated with a value for
1883 a real compiler. Note that only one real compiler 1881 a real compiler. Note that only one real compiler
1884 should be listed (e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">sunpro gcc</code></span>&#8221;</span> 1882 should be listed (e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">sunpro gcc</code></span>&#8221;</span>
1885 is not allowed).</p> 1883 is not allowed).</p>
1886</dd> 1884</dd>
1887<dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt> 1885<dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
1888<dd><p>This specifies the minimum version of GCC to use 1886<dd><p>This specifies the minimum version of GCC to use
1889 when building packages. If the system GCC doesn't 1887 when building packages. If the system GCC doesn't
1890 satisfy this requirement, then pkgsrc will build and 1888 satisfy this requirement, then pkgsrc will build and
1891 install one of the GCC packages to use instead.</p></dd> 1889 install one of the GCC packages to use instead.</p></dd>
1892<dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt> 1890<dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1893<dd><p>Specifies which version of python to use when several 1891<dd><p>Specifies which version of python to use when several
1894 options are available.</p></dd> 1892 options are available.</p></dd>
1895<dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt> 1893<dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1896<dd><p>Specifies the Fortran compiler to use. 1894<dd><p>Specifies the Fortran compiler to use.
1897 The default is <code class="varname">gfortran</code>.</p></dd> 1895 The default is <code class="varname">gfortran</code>.</p></dd>
1898<dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt> 1896<dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
1899<dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code> 1897<dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
1900 <code class="varname">gfortran</code> is used, this option specifies which 1898 <code class="varname">gfortran</code> is used, this option specifies which
1901 version to use.</p></dd> 1899 version to use.</p></dd>
1902</dl></div> 1900</dl></div>
1903</div> 1901</div>
1904<div class="sect2"> 1902<div class="sect2">
1905<div class="titlepage"><div><div><h3 class="title"> 1903<div class="titlepage"><div><div><h3 class="title">
1906<a name="conf.cflags"></a>6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div> 1904<a name="conf.cflags"></a>6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1907<p>If you wish to set the <code class="varname">CFLAGS</code> variable, 1905<p>If you wish to set the <code class="varname">CFLAGS</code> variable,
1908 please make sure to use the <code class="literal">+=</code> operator 1906 please make sure to use the <code class="literal">+=</code> operator
1909 instead of the <code class="literal">=</code> operator:</p> 1907 instead of the <code class="literal">=</code> operator:</p>
1910<pre class="programlisting"> 1908<pre class="programlisting">
1911CFLAGS+= -your -flags 1909CFLAGS+= -your -flags
1912</pre> 1910</pre>
1913<p>Using <code class="varname">CFLAGS=</code> (i.e. without the 1911<p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1914 <span class="quote">&#8220;<span class="quote">+</span>&#8221;</span>) may lead to problems with packages that 1912 <span class="quote">&#8220;<span class="quote">+</span>&#8221;</span>) may lead to problems with packages that
1915 need to add their own flags. You may want to take a look 1913 need to add their own flags. You may want to take a look
1916 at the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/README.html" target="_top"><code class="filename">devel/cpuflags</code></a> 1914 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>
1917 package if you're interested in optimization specifically 1915 package if you're interested in optimization specifically
1918 for the current CPU. </p> 1916 for the current CPU. </p>
1919</div> 1917</div>
1920<div class="sect2"> 1918<div class="sect2">
1921<div class="titlepage"><div><div><h3 class="title"> 1919<div class="titlepage"><div><div><h3 class="title">
1922<a name="conf.ldflags"></a>6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div> 1920<a name="conf.ldflags"></a>6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1923<p>If you want to pass flags to the linker, both in the configure 1921<p>If you want to pass flags to the linker, both in the configure
1924step and the build step, you can do this in two ways. Either set 1922step and the build step, you can do this in two ways. Either set
1925<code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>. The difference 1923<code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>. The difference
1926between the two is that <code class="varname">LIBS</code> will be appended to 1924between the two is that <code class="varname">LIBS</code> will be appended to
1927the command line, while <code class="varname">LDFLAGS</code> come earlier. 1925the command line, while <code class="varname">LDFLAGS</code> come earlier.
1928<code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF 1926<code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
1929machines depending on the setting of <code class="varname">USE_IMAKE</code> or 1927machines depending on the setting of <code class="varname">USE_IMAKE</code> or
1930the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>. As with 1928the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>. As with
1931<code class="varname">CFLAGS</code>, if you do not wish to override these 1929<code class="varname">CFLAGS</code>, if you do not wish to override these
1932settings, use the <code class="literal">+=</code> operator:</p> 1930settings, use the <code class="literal">+=</code> operator:</p>
1933<pre class="programlisting"> 1931<pre class="programlisting">
1934LDFLAGS+= -your -linkerflags 1932LDFLAGS+= -your -linkerflags
1935</pre> 1933</pre>
1936</div> 1934</div>
1937</div> 1935</div>
1938<div class="sect1"> 1936<div class="sect1">
1939<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1937<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1940<a name="developer-advanced-settings"></a>6.5. Developer/advanced settings</h2></div></div></div> 1938<a name="developer-advanced-settings"></a>6.5. Developer/advanced settings</h2></div></div></div>
1941<p> 1939<p>
1942 </p> 1940 </p>
1943<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 1941<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1944<li class="listitem"> 1942<li class="listitem">
1945<p><code class="varname">PKG_DEVELOPER</code>: 1943<p><code class="varname">PKG_DEVELOPER</code>:
1946 Run some sanity checks that package developers want: 1944 Run some sanity checks that package developers want:
1947 </p> 1945 </p>
1948<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "> 1946<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1949<li class="listitem"><p>make sure patches apply with zero 1947<li class="listitem"><p>make sure patches apply with zero
1950 fuzz</p></li> 1948 fuzz</p></li>
1951<li class="listitem"><p>run check-shlibs to see that all 1949<li class="listitem"><p>run check-shlibs to see that all
1952 binaries will find their shared libs.</p></li> 1950 binaries will find their shared libs.</p></li>
1953</ul></div> 1951</ul></div>
1954<p> 1952<p>
1955 </p> 1953 </p>
1956</li> 1954</li>
1957<li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level 1955<li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1958 of debugging output which is displayed whilst making and 1956 of debugging output which is displayed whilst making and
1959 installing the package. The default value for this is 0, 1957 installing the package. The default value for this is 0,
1960 which will not display the commands as they are executed 1958 which will not display the commands as they are executed
1961 (normal, default, quiet operation); the value 1 will display 1959 (normal, default, quiet operation); the value 1 will display
1962 all shell commands before their invocation, and the value 2 1960 all shell commands before their invocation, and the value 2
1963 will display both the shell commands before their invocation, 1961 will display both the shell commands before their invocation,
1964 as well as their actual execution progress with <span class="command"><strong>set 1962 as well as their actual execution progress with <span class="command"><strong>set
1965 -x</strong></span>.</p></li> 1963 -x</strong></span>.</p></li>
1966</ul></div> 1964</ul></div>
1967<p> 1965<p>
1968 </p> 1966 </p>
1969</div> 1967</div>
1970<div class="sect1"> 1968<div class="sect1">
1971<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1969<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1972<a name="selecting-build-options"></a>6.6. Selecting Build Options</h2></div></div></div> 1970<a name="selecting-build-options"></a>6.6. Selecting Build Options</h2></div></div></div>
1973<p>Some packages have build time options, usually to select 1971<p>Some packages have build time options, usually to select
1974 between different dependencies, enable optional support for big 1972 between different dependencies, enable optional support for big
1975 dependencies or enable experimental features.</p> 1973 dependencies or enable experimental features.</p>
1976<p>To see which options, if any, a package supports, and which 1974<p>To see which options, if any, a package supports, and which
1977 options are mutually exclusive, run <span class="command"><strong>make 1975 options are mutually exclusive, run <span class="command"><strong>make
1978 show-options</strong></span>, for example:</p> 1976 show-options</strong></span>, for example:</p>
1979<pre class="programlisting"> 1977<pre class="programlisting">
1980 The following options are supported by this package: 1978 The following options are supported by this package:
1981 ssl Enable SSL support. 1979 ssl Enable SSL support.
1982 Exactly one of the following gecko options is required: 1980 Exactly one of the following gecko options is required:
1983 firefox Use firefox as gecko rendering engine. 1981 firefox Use firefox as gecko rendering engine.
1984 mozilla Use mozilla as gecko rendering engine. 1982 mozilla Use mozilla as gecko rendering engine.
1985 At most one of the following database options may be selected: 1983 At most one of the following database options may be selected:
1986 mysql Enable support for MySQL database. 1984 mysql Enable support for MySQL database.
1987 pgsql Enable support for PostgreSQL database. 1985 pgsql Enable support for PostgreSQL database.
1988 1986
1989 These options are enabled by default: firefox 1987 These options are enabled by default: firefox
1990 These options are currently enabled: mozilla ssl 1988 These options are currently enabled: mozilla ssl
1991</pre> 1989</pre>
1992<p>The following variables can be defined in 1990<p>The following variables can be defined in
1993 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to 1991 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1994 enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>, 1992 enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
1995 which can be used to select or disable options for all packages 1993 which can be used to select or disable options for all packages
1996 that support them, and 1994 that support them, and
1997 <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>, 1995 <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
1998 which can be used to select or disable options specifically for 1996 which can be used to select or disable options specifically for
1999 package <em class="replaceable"><code>pkgbase</code></em>. Options listed in 1997 package <em class="replaceable"><code>pkgbase</code></em>. Options listed in
2000 these variables are selected, options preceded by <span class="quote">&#8220;<span class="quote">-</span>&#8221;</span> 1998 these variables are selected, options preceded by <span class="quote">&#8220;<span class="quote">-</span>&#8221;</span>
2001 are disabled. A few examples:</p> 1999 are disabled. A few examples:</p>
2002<pre class="screen"> 2000<pre class="screen">
2003<code class="prompt">$</code> <span class="command"><strong>grep "PKG.*OPTION" <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a></strong></span> 2001<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>
2004PKG_DEFAULT_OPTIONS= -arts -dvdread -esound 2002PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
2005PKG_OPTIONS.kdebase= debug -sasl 2003PKG_OPTIONS.kdebase= debug -sasl
2006PKG_OPTIONS.apache= suexec </pre> 2004PKG_OPTIONS.apache= suexec </pre>
2007<p>It is important to note that options that were specifically 2005<p>It is important to note that options that were specifically
2008 suggested by the package maintainer must be explicitly removed if 2006 suggested by the package maintainer must be explicitly removed if
2009 you do not wish to include the option. If you are unsure you can view 2007 you do not wish to include the option. If you are unsure you can view
2010 the current state with <span class="command"><strong>make show-options</strong></span>.</p> 2008 the current state with <span class="command"><strong>make show-options</strong></span>.</p>
2011<p>The following settings are consulted in the order given, and 2009<p>The following settings are consulted in the order given, and
2012 the last setting that selects or disables an option is 2010 the last setting that selects or disables an option is
2013 used:</p> 2011 used:</p>
2014<div class="orderedlist"><ol class="orderedlist" type="1"> 2012<div class="orderedlist"><ol class="orderedlist" type="1">
2015<li class="listitem"><p>the default options as suggested by the package 2013<li class="listitem"><p>the default options as suggested by the package
2016 maintainer</p></li> 2014 maintainer</p></li>
2017<li class="listitem"><p>the options implied by the settings of legacy 2015<li class="listitem"><p>the options implied by the settings of legacy
2018 variables (see below)</p></li> 2016 variables (see below)</p></li>
2019<li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li> 2017<li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
2020<li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li> 2018<li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
2021</ol></div> 2019</ol></div>
2022<p>For groups of mutually exclusive options, the last option 2020<p>For groups of mutually exclusive options, the last option
2023 selected is used, all others are automatically disabled. If an 2021 selected is used, all others are automatically disabled. If an
2024 option of the group is explicitly disabled, the previously 2022 option of the group is explicitly disabled, the previously
2025 selected option, if any, is used. It is an error if no option 2023 selected option, if any, is used. It is an error if no option
2026 from a required group of options is selected, and building the 2024 from a required group of options is selected, and building the
2027 package will fail.</p> 2025 package will fail.</p>
2028<p>Before the options framework was introduced, build options 2026<p>Before the options framework was introduced, build options
2029 were selected by setting a variable (often named 2027 were selected by setting a variable (often named
2030 <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in 2028 <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
2031 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option. To ease 2029 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option. To ease
2032 transition to the options framework for the user, these legacy 2030 transition to the options framework for the user, these legacy
2033 variables are converted to the appropriate options setting 2031 variables are converted to the appropriate options setting
2034 (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>) 2032 (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
2035 automatically. A warning is issued to prompt the user to update 2033 automatically. A warning is issued to prompt the user to update
2036 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework 2034 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
2037 directly. Support for the legacy variables will be removed 2035 directly. Support for the legacy variables will be removed
2038 eventually.</p> 2036 eventually.</p>
2039</div> 2037</div>
2040</div> 2038</div>
2041<div class="chapter"> 2039<div class="chapter">
2042<div class="titlepage"><div><div><h2 class="title"> 2040<div class="titlepage"><div><div><h2 class="title">
2043<a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div> 2041<a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div>
2044<div class="toc"> 2042<div class="toc">
2045<p><b>Table of Contents</b></p> 2043<p><b>Table of Contents</b></p>
2046<dl class="toc"> 2044<dl class="toc">
2047<dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt> 2045<dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
2048<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt> 2046<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
2049</dl> 2047</dl>
2050</div> 2048</div>
2051<div class="sect1"> 2049<div class="sect1">
2052<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2050<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2053<a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div> 2051<a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div>
2054<p>Once you have built and installed a package, you can create 2052<p>Once you have built and installed a package, you can create
2055 a <span class="emphasis"><em>binary package</em></span> which can be installed on 2053 a <span class="emphasis"><em>binary package</em></span> which can be installed on
2056 another system with <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. This saves having to build 2054 another system with <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. This saves having to build
2057 the same package on a group of hosts and wasting CPU time. It also 2055 the same package on a group of hosts and wasting CPU time. It also
2058 provides a simple means for others to install your package, should 2056 provides a simple means for others to install your package, should
2059 you distribute it.</p> 2057 you distribute it.</p>
2060<p>To create a binary package, change into the appropriate 2058<p>To create a binary package, change into the appropriate
2061 directory in pkgsrc, and run <span class="command"><strong>make 2059 directory in pkgsrc, and run <span class="command"><strong>make
2062 package</strong></span>:</p> 2060 package</strong></span>:</p>
2063<pre class="screen"> 2061<pre class="screen">
2064<code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong> 2062<code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
2065<code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong> 2063<code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong>
2066</pre> 2064</pre>
2067<p>This will build and install your package (if not already done), 2065<p>This will build and install your package (if not already done),
2068 and then build a binary package from what was installed. You can 2066 and then build a binary package from what was installed. You can
2069 then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate 2067 then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate
2070 it. Binary packages are created by default in 2068 it. Binary packages are created by default in
2071 <code class="filename">/usr/pkgsrc/packages</code>, in the form of a 2069 <code class="filename">/usr/pkgsrc/packages</code>, in the form of a
2072 gzipped tar file. See <a class="xref" href="#logs.package" title="B.2. Packaging figlet">Section B.2, &#8220;Packaging figlet&#8221;</a> for a 2070 gzipped tar file. See <a class="xref" href="#logs.package" title="B.2. Packaging figlet">Section B.2, &#8220;Packaging figlet&#8221;</a> for a
2073 continuation of the above <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/misc/figlet/README.html" target="_top"><code class="filename">misc/figlet</code></a> example.</p> 2071 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>
2074<p>See <a class="xref" href="#submit" title="Chapter 23. Submitting and Committing">Chapter 23, <i>Submitting and Committing</i></a> for information on how to submit 2072<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
2075 such a binary package.</p> 2073 such a binary package.</p>
2076</div> 2074</div>
2077<div class="sect1"> 2075<div class="sect1">
2078<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2076<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2079<a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div> 2077<a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div>
2080<p>See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, &#8220;Other helpful targets&#8221;</a>.</p> 2078<p>See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, &#8220;Other helpful targets&#8221;</a>.</p>
2081</div> 2079</div>
2082</div> 2080</div>
2083<div class="chapter"> 2081<div class="chapter">
2084<div class="titlepage"><div><div><h2 class="title"> 2082<div class="titlepage"><div><div><h2 class="title">
2085<a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk 2083<a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
2086builds)</h2></div></div></div> 2084builds)</h2></div></div></div>
2087<div class="toc"> 2085<div class="toc">
2088<p><b>Table of Contents</b></p> 2086<p><b>Table of Contents</b></p>
2089<dl class="toc"> 2087<dl class="toc">
2090<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 2088<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
2091<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt> 2089<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a pbulk-style bulk build</a></span></dt>
2092<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd> 2090<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
2093<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt> 2091<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
2094<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt> 2092<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
2095<dd><dl> 2093<dd><dl>
2096<dt><span class="sect2"><a href="#bulk.var.subst_noop">8.4.1. Strict SUBST blocks</a></span></dt> 2094<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
2097<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.2. Detect unknown configure options</a></span></dt> 2095<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
2098<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.3. Detect classes of bugs by forcing compiler warnings</a></span></dt> 2096<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt>
2099<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt> 2097<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt>
2100<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt> 2098<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt>
2101<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt> 2099<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt>
2102<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt> 2100<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt>
2103<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt> 2101<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt>
2104<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt> 2102<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt>
2105<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt> 
2106<dt><span class="sect2"><a href="#bulk.var.options">8.4.11. Select random sets of options</a></span></dt> 
2107<dt><span class="sect2"><a href="#bulk.var.build_defs">8.4.12. Select random configurations of BUILD_DEFS</a></span></dt> 
2108</dl></dd> 2103</dl></dd>
2109<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 2104<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
2110<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 2105<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
2111</dl> 2106</dl>
2112</div> 2107</div>
2113<p>For a number of reasons, you may want to build binary packages 2108<p>For a number of reasons, you may want to build binary packages
2114for a large selected set of packages in pkgsrc, or even for all pkgsrc packages. 2109for a large selected set of packages in pkgsrc, or even for all pkgsrc packages.
2115For instance, when you have multiple machines that should run the same software, 2110For instance, when you have multiple machines that should run the same software,
2116it is wasted time if they all build their packages themselves from source. 2111it is wasted time if they all build their packages themselves from source.
2117Or you may want to build a list of packages you want and check them before 2112Or you may want to build a list of packages you want and check them before
2118deploying onto production systems. 2113deploying onto production systems.
2119There is a way of getting a set of binary packages: 2114There is a way of getting a set of binary packages:
2120the bulk build system, or pbulk ("p" stands for "parallel"). 2115the bulk build system, or pbulk ("p" stands for "parallel").
2121This chapter describes how to set it up.</p> 2116This chapter describes how to set it up.</p>
2122<div class="sect1"> 2117<div class="sect1">
2123<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2118<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2124<a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div> 2119<a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div>
2125<p>First of all, you have to decide whether you build all packages 2120<p>First of all, you have to decide whether you build all packages
2126or a limited set of them. Full bulk builds usually consume a lot more resources, 2121or a limited set of them. Full bulk builds usually consume a lot more resources,
2127both space and time, than builds for some practical sets of packages. 2122both space and time, than builds for some practical sets of packages.
2128A number of particularly heavy packages exist that are not actually 2123A number of particularly heavy packages exist that are not actually
2129interesting to a wide audience. (The approximate resource consumption for a 2124interesting to a wide audience. (The approximate resource consumption for a
2130full bulk build is given in section <a class="xref" href="#bulk.req" title="8.3. Requirements of a full bulk build">Section 8.3, &#8220;Requirements of a full bulk build&#8221;</a>.) 2125full bulk build is given in section <a class="xref" href="#bulk.req" title="8.3. Requirements of a full bulk build">Section 8.3, &#8220;Requirements of a full bulk build&#8221;</a>.)
2131For limited bulk builds you need to make a list of packages you want to build. 2126For limited bulk builds you need to make a list of packages you want to build.
2132Note that all their dependencies will be built, so you don't need to track them manually. 2127Note that all their dependencies will be built, so you don't need to track them manually.
2133</p> 2128</p>
2134<p>During bulk builds various packages are installed and deinstalled 2129<p>During bulk builds various packages are installed and deinstalled
2135in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is), 2130in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is),
2136so make sure that you don't need any package during the builds. 2131so make sure that you don't need any package during the builds.
2137Essentially, you should provide a fresh system, either a chroot environment 2132Essentially, you should provide a fresh system, either a chroot environment
2138or something even more restrictive, depending on what the operating system provides, 2133or something even more restrictive, depending on what the operating system provides,
2139or dedicate the whole physical machine. 2134or dedicate the whole physical machine.
2140As a useful side effect this makes sure that bulk builds cannot 2135As a useful side effect this makes sure that bulk builds cannot
2141break anything in your system. There have been numerous cases where 2136break anything in your system. There have been numerous cases where
2142certain packages tried to install files outside the 2137certain packages tried to install files outside the
2143<code class="filename">LOCALBASE</code> or wanted to edit some files in 2138<code class="filename">LOCALBASE</code> or wanted to edit some files in
2144<code class="filename">/etc</code>. 2139<code class="filename">/etc</code>.
2145</p> 2140</p>
2146</div> 2141</div>
2147<div class="sect1"> 2142<div class="sect1">
2148<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2143<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2149<a name="bulk.pbulk"></a>8.2. Running a pbulk-style bulk build</h2></div></div></div> 2144<a name="bulk.pbulk"></a>8.2. Running a pbulk-style bulk build</h2></div></div></div>
2150<p>Running a pbulk-style bulk build works roughly as follows:</p> 2145<p>Running a pbulk-style bulk build works roughly as follows:</p>
2151<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2146<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2152<li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li> 2147<li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li>
2153<li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li> 2148<li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li>
2154</ul></div> 2149</ul></div>
2155<div class="sect2"> 2150<div class="sect2">
2156<div class="titlepage"><div><div><h3 class="title"> 2151<div class="titlepage"><div><div><h3 class="title">
2157<a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div> 2152<a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div>
2158<p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p> 2153<p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p>
2159<p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine). 2154<p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine).
2160Configure network access to fetch distribution files. 2155Configure network access to fetch distribution files.
2161Create a user with name "pbulk".</p> 2156Create a user with name "pbulk".</p>
2162<p>Fetch and extract pkgsrc. Use a command like one of these:</p> 2157<p>Fetch and extract pkgsrc. Use a command like one of these:</p>
2163<pre class="screen"> 2158<pre class="screen">
2164<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong> 2159<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
2165<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong> 2160<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
2166<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)</code></strong> 2161<code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)</code></strong>
2167</pre> 2162</pre>
2168<p>Or any other way that fits (e.g., curl, wget).</p> 2163<p>Or any other way that fits (e.g., curl, wget).</p>
2169<p>Deploy and configure pbulk tools, e.g.:</p> 2164<p>Deploy and configure pbulk tools, e.g.:</p>
2170<pre class="screen"> 2165<pre class="screen">
2171<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> 2166<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>
2172<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> 2167<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>
2173<code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong> 2168<code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong>
2174</pre> 2169</pre>
2175<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 2170<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2176<h3 class="title">Note</h3> 2171<h3 class="title">Note</h3>
2177<p><code class="filename">mk.conf.frag</code> is a fragment of 2172<p><code class="filename">mk.conf.frag</code> is a fragment of
2178<code class="filename">mk.conf</code> that contains settings you want to 2173<code class="filename">mk.conf</code> that contains settings you want to
2179apply to packages you build. For instance,</p> 2174apply to packages you build. For instance,</p>
2180<pre class="programlisting"> 2175<pre class="programlisting">
2181PKG_DEVELOPER= yes # perform more checks 2176PKG_DEVELOPER= yes # perform more checks
2182X11_TYPE= modular # use pkgsrc X11 2177X11_TYPE= modular # use pkgsrc X11
2183SKIP_LICENSE_CHECK= yes # accept all licences (useful 2178SKIP_LICENSE_CHECK= yes # accept all licences (useful
2184 # when building all packages) 2179 # when building all packages)
2185</pre> 2180</pre>
2186</div> 2181</div>
2187<p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code> 2182<p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code>
2188with your list of packages, one per line without empty lines or comments. E.g.:</p> 2183with your list of packages, one per line without empty lines or comments. E.g.:</p>
2189<pre class="programlisting"> 2184<pre class="programlisting">
2190www/firefox 2185www/firefox
2191mail/thunderbird 2186mail/thunderbird
2192misc/libreoffice4 2187misc/libreoffice4
2193</pre> 2188</pre>
2194<p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code> 2189<p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code>
2195and make final amendments, if wanted.</p> 2190and make final amendments, if wanted.</p>
2196<p>Start it:</p> 2191<p>Start it:</p>
2197<pre class="screen"> 2192<pre class="screen">
2198<code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong> 2193<code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong>
2199</pre> 2194</pre>
2200<p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports, 2195<p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports,
2201plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code> 2196plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code>
2202</p> 2197</p>
2203<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 2198<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2204<h3 class="title">Note</h3> 2199<h3 class="title">Note</h3>
2205<p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases. 2200<p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases.
2206While being ready to run, it serves as a good starting point to understand and build more complex setups. 2201While being ready to run, it serves as a good starting point to understand and build more complex setups.
2207The script is kept small enough for better understanding.</p> 2202The script is kept small enough for better understanding.</p>
2208</div> 2203</div>
2209<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 2204<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2210<h3 class="title">Note</h3> 2205<h3 class="title">Note</h3>
2211<p>The <code class="filename">pbulk.sh</code> script supports running 2206<p>The <code class="filename">pbulk.sh</code> script supports running
2212unprivileged bulk build and helps configuring distributed bulk builds.</p> 2207unprivileged bulk build and helps configuring distributed bulk builds.</p>
2213</div> 2208</div>
2214</div> 2209</div>
2215</div> 2210</div>
2216<div class="sect1"> 2211<div class="sect1">
2217<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2212<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2218<a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div> 2213<a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div>
2219<p>A complete bulk build requires lots of disk space. Some of the 2214<p>A complete bulk build requires lots of disk space. Some of the
2220disk space can be read-only, some other must be writable. Some can be on 2215disk space can be read-only, some other must be writable. Some can be on
2221remote filesystems (such as NFS) and some should be local. Some can be 2216remote filesystems (such as NFS) and some should be local. Some can be
2222temporary filesystems, others must survive a sudden reboot.</p> 2217temporary filesystems, others must survive a sudden reboot.</p>
2223<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2218<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2224<li class="listitem"><p>40 GB for the distfiles (read-write, remote, temporary)</p></li> 2219<li class="listitem"><p>40 GB for the distfiles (read-write, remote, temporary)</p></li>
2225<li class="listitem"><p>30 GB for the binary packages (read-write, remote, permanent)</p></li> 2220<li class="listitem"><p>30 GB for the binary packages (read-write, remote, permanent)</p></li>
2226<li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li> 2221<li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li>
2227<li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li> 2222<li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li>
2228<li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li> 2223<li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li>
2229<li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li> 2224<li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li>
2230</ul></div> 2225</ul></div>
2231</div> 2226</div>
2232<div class="sect1"> 2227<div class="sect1">
2233<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2228<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2234<a name="bulk.var"></a>8.4. Bulk build variants</h2></div></div></div> 2229<a name="bulk.var"></a>8.4. Bulk build variants</h2></div></div></div>
2235<p>To ensure that pkgsrc packages work in different configurations, it 2230<p>To ensure that pkgsrc packages work in different configurations, it
2236makes sense to run non-default bulk builds from time to time. This 2231makes sense to run non-default bulk builds from time to time. This
2237section lists some ideas for bulk builds that intentionally let packages 2232section lists some ideas for bulk builds that intentionally let packages
2238fail if they don't follow the pkgsrc style.</p> 2233fail if they don't follow the pkgsrc style.</p>
2239<div class="sect2"> 2234<div class="sect2">
2240<div class="titlepage"><div><div><h3 class="title"> 2235<div class="titlepage"><div><div><h3 class="title">
2241<a name="bulk.var.subst_noop"></a>8.4.1. Strict SUBST blocks</h3></div></div></div> 2236<a name="bulk.var.confopt"></a>8.4.1. Detect unknown configure options</h3></div></div></div>
2242<p>Up to May 2020, the SUBST blocks ignored files that didn't exist, 
2243as well as substitutions that didn't have any effect. There were quite a 
2244few SUBST blocks that were redundant, and these have been removed 
2245already.</p> 
2246<p>The next step would be to not only check that each filename pattern 
2247has an effect but also that each substitution in SUBST_SED or SUBST_VARS 
2248applies to at least one file.</p> 
2249<p>To do this, <code class="filename">mk/subst.mk</code> would have to be 
2250adjusted, in a similar way as the check for no-op SUBST_FILES. There are 
2251several regression tests in <code class="filename">regress/infra-unittests</code> 
2252that help to get all edge cases correct.</p> 
2253<p>When a package fails this additional check, there are various 
2254possible causes why the <code class="varname">SUBST_SED</code> became a 
2255no-op.</p> 
2256<div class="orderedlist"><ol class="orderedlist" type="1"> 
2257<li class="listitem"><p>The pattern used to be found in a former version of the 
2258package, but is not needed anymore. In that case, just remove 
2259it.</p></li> 
2260<li class="listitem"><p>The pattern contains a typo. In that case, fix the typo 
2261and bump <code class="varname">PKGREVISION</code>, since the fixed typo will 
2262probably modify the resulting binary package.</p></li> 
2263<li class="listitem"><p>There is a patch that is applied before the SUBST block, 
2264and the patch accidentally contains the change that was intended for the 
2265SUBST block. In that case, remove the respective hunk from the 
2266patch.</p></li> 
2267</ol></div> 
2268</div> 
2269<div class="sect2"> 
2270<div class="titlepage"><div><div><h3 class="title"> 
2271<a name="bulk.var.confopt"></a>8.4.2. Detect unknown configure options</h3></div></div></div> 
2272<p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2237<p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2273<pre class="programlisting"> 2238<pre class="programlisting">
2274GNU_CONFIGURE_STRICT= yes 2239GNU_CONFIGURE_STRICT= yes
2275</pre> 2240</pre>
2276<p>When a package fails this additional check, the most common cause 2241<p>When a package fails this additional check, the most common cause
2277is that the configure option was valid for an older version of the 2242is that the configure option was valid for an older version of the
2278package but does not apply anymore. In that case, just remove it.</p> 2243package but does not apply anymore. In that case, just remove it.</p>
2279</div> 2244</div>
2280<div class="sect2"> 2245<div class="sect2">
2281<div class="titlepage"><div><div><h3 class="title"> 2246<div class="titlepage"><div><div><h3 class="title">
2282<a name="bulk.var.comperr"></a>8.4.3. Detect classes of bugs by forcing compiler warnings</h3></div></div></div> 2247<a name="bulk.var.comperr"></a>8.4.2. Detect classes of bugs by forcing compiler warnings</h3></div></div></div>
2283<p>The job of a compiler is not restricted to producing executable 2248<p>The job of a compiler is not restricted to producing executable
2284code, most compilers also detects typical mistakes.</p> 2249code, most compilers also detect typical programming mistakes. The pkgsrc
2285<p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2250compiler wrappers make it easy to force compiler options when the package
 2251is built. This can be used to find typical bugs across all packages that
 2252are in pkgsrc. By reporting these bugs upstream, the packages will be
 2253more reliable with the next updates.</p>
 2254<p>Add some of the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
2286<pre class="programlisting"> 2255<pre class="programlisting">
2287CFLAGS+= -Werror=char-subscripts 2256CFLAGS+= -Werror=char-subscripts
 2257CFLAGS+= -Werror=implicit-function-declaration
2288</pre> 2258</pre>
2289<p>When a package fails this additional check, first document the 2259<p>When a package fails to build using these stricter compiler
2290circumstances in which the compiler produced the error message. This 2260options, document the circumstances in which the compiler produced the
2291includes:</p> 2261error message. This includes:</p>
2292<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2262<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2293<li class="listitem"><p>The platform 2263<li class="listitem"><p>The platform
2294(<code class="varname">MACHINE_PLATFORM</code>)</p></li> 2264(<code class="varname">MACHINE_PLATFORM</code>)</p></li>
2295<li class="listitem"><p>The source file</p></li> 2265<li class="listitem"><p>The source file</p></li>
2296<li class="listitem"><p>An excerpt of the code. GCC and Clang already do this as 2266<li class="listitem"><p>An excerpt of the code. GCC and Clang already do this as
2297part of the diagnostic.</p></li> 2267part of the diagnostic.</p></li>
2298<li class="listitem"><p>The error message from the compiler.</p></li> 2268<li class="listitem"><p>The exact error message from the compiler.</p></li>
2299</ul></div> 2269</ul></div>
2300<p>If a package produces these error messages, but the package is 2270<p>If a package produces these error messages, but the package is
2301fine, document this in the package Makefile, like this:</p> 2271fine, record this in your local <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, like this, to skip this check
 2272in the next builds:</p>
2302<pre class="programlisting"> 2273<pre class="programlisting">
 2274.if ${PKGPATH} == category/package
2303# Version ${VERSION} failed on ${MACHINE_PLATFORM}: 2275# Version ${VERSION} failed on ${MACHINE_PLATFORM}:
2304# error message 2276# error message
2305# code 2277# code
2306# reason why the code does not need to be fixed 2278# Reason why the code does not need to be fixed.
2307BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts 2279BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
 2280.endif
2308</pre> 2281</pre>
2309<p>If the error messages from the compiler are valid and the code 2282<p>If the error messages from the compiler are valid and the code
2310needs to be fixed, prepare a patch for a single source file, or if it's a 2283needs to be fixed, prepare a local patch (see
2311one-liner fix, add a SUBST block to the package Makefile. In any case, 2284<code class="varname">LOCALPATCHES</code>) and report the bug to the upstream
2312report it to the upstream authors of the package.</p> 2285authors of the package, providing them with the information you collected
 2286above.</p>
 2287<p>Patches that are not essential for the package to work should only
 2288be reported upstream but not committed to pkgsrc, to make future updates
 2289easier.</p>
2313</div> 2290</div>
2314<div class="sect2"> 2291<div class="sect2">
2315<div class="titlepage"><div><div><h3 class="title"> 2292<div class="titlepage"><div><div><h3 class="title">
2316<a name="bulk.var.dirs"></a>8.4.4. Use custom directories</h3></div></div></div> 2293<a name="bulk.var.dirs"></a>8.4.3. Use custom directories</h3></div></div></div>
2317<p>Some directories like <code class="varname">PREFIX</code>, 2294<p>Some directories like <code class="varname">PREFIX</code>,
2318<code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>, 2295<code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>,
2319<code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be 2296<code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be
2320configured in pkgsrc. Set these to arbitrary paths during bootstrap or 2297configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2321afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2298afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2322<pre class="programlisting"> 2299<pre class="programlisting">
2323PREFIX= /a-random-uuid 2300PREFIX= /a-random-uuid
2324PKG_SYSCONFDIR= /a-random-uuid 2301PKG_SYSCONFDIR= /a-random-uuid
2325VARBASE= /a-random-uuid 2302VARBASE= /a-random-uuid
2326PKGMANDIR= a-random-uuid 2303PKGMANDIR= a-random-uuid
2327PKG_INFODIR= a-random-uuid 2304PKG_INFODIR= a-random-uuid
2328</pre> 2305</pre>
2329</div> 2306</div>
2330<div class="sect2"> 2307<div class="sect2">
2331<div class="titlepage"><div><div><h3 class="title"> 2308<div class="titlepage"><div><div><h3 class="title">
2332<a name="bulk.var.warn"></a>8.4.5. Turn warnings into errors</h3></div></div></div> 2309<a name="bulk.var.warn"></a>8.4.4. Turn warnings into errors</h3></div></div></div>
2333<p>When building a package, warnings are typically ignored since they 2310<p>When building a package, warnings are typically ignored since they
2334just flow by and do not cause the build to fail immediately. To find 2311just flow by and do not cause the build to fail immediately. To find
2335these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2312these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2336<pre class="programlisting"> 2313<pre class="programlisting">
2337DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" 2314DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2338WARNING_MSG= ${FAIL_MSG} "(was warning)" 2315WARNING_MSG= ${FAIL_MSG} "(was warning)"
2339</pre> 2316</pre>
2340<p>(There are many more classes of warnings in pkgsrc, and most of 2317<p>(There are many more classes of warnings in pkgsrc, and most of
2341them can be redefined with a simple definition like above.</p> 2318them can be redefined with a simple definition like above.</p>
2342<p>If a package suggest to add <code class="varname">USE_TOOLS+=perl</code> to 2319<p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to
2343the package Makefile, research whether the package actually needs Perl. 2320the package Makefile, research whether the package actually needs Perl.
2344If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package 2321If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package
2345Makefile, and if it doesn't, add 2322Makefile, and if it doesn't, add
2346<code class="varname">TOOLS_BROKEN+=perl</code>.</p> 2323<code class="varname">TOOLS_BROKEN+=perl</code>.</p>
2347</div> 2324</div>
2348<div class="sect2"> 2325<div class="sect2">
2349<div class="titlepage"><div><div><h3 class="title"> 2326<div class="titlepage"><div><div><h3 class="title">
2350<a name="bulk.var.pkglint"></a>8.4.6. Reject packages for which pkglint reports errors</h3></div></div></div> 2327<a name="bulk.var.pkglint"></a>8.4.5. Reject packages for which pkglint reports errors</h3></div></div></div>
2351<p>Using pkglint as part of the regular build process is mostly a 2328<p>Using pkglint as part of the regular build process is mostly a
2352waste of time. If you want to fix some of the warnings, just run pkglint 2329waste of time. If you want to fix some of the warnings, just run pkglint
2353recursively on the whole pkgsrc tree. This will take a few minutes (up to 2330recursively on the whole pkgsrc tree. This will take a few minutes (up to
235410), which is much faster than a complete bulk build.</p> 233110), which is much faster than a complete bulk build.</p>
2355</div> 2332</div>
2356<div class="sect2"> 2333<div class="sect2">
2357<div class="titlepage"><div><div><h3 class="title"> 2334<div class="titlepage"><div><div><h3 class="title">
2358<a name="bulk.var.strings"></a>8.4.7. Reject packages that contain forbidden strings</h3></div></div></div> 2335<a name="bulk.var.strings"></a>8.4.6. Reject packages that contain forbidden strings</h3></div></div></div>
2359<p>To ensure that the binary packages don't contain references to the 2336<p>To ensure that the binary packages don't contain references to the
2360build directory, there is already <code class="varname">CHECK_WRKREF</code>. If 2337build directory, there is already <code class="varname">CHECK_WRKREF</code>. If
2361that variable includes the item <code class="literal">extra</code>, it is 2338that variable includes the item <code class="literal">extra</code>, it is
2362possible to define additional patterns that must not appear in any 2339possible to define additional patterns that must not appear in any
2363installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2340installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2364<pre class="programlisting"> 2341<pre class="programlisting">
2365CHECK_WRKREF= extra 2342CHECK_WRKREF= extra
2366CHECK_WRKREF_EXTRA_DIRS+= /usr/local 2343CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2367CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg 2344CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2368CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@ 2345CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2369</pre> 2346</pre>
2370<p>The above patterns will probably generate many false positives, 2347<p>The above patterns will probably generate many false positives,
2371therefore the results need to be taken with a grain of salt.</p> 2348therefore the results need to be taken with a grain of salt.</p>
2372</div> 2349</div>
2373<div class="sect2"> 2350<div class="sect2">
2374<div class="titlepage"><div><div><h3 class="title"> 2351<div class="titlepage"><div><div><h3 class="title">
2375<a name="bulk.var.test"></a>8.4.8. Reject packages whose self-test fails</h3></div></div></div> 2352<a name="bulk.var.test"></a>8.4.7. Reject packages whose self-test fails</h3></div></div></div>
2376<p>To run the test suites that come with each package, add this line 2353<p>To run the test suites that come with each package, add this line
2377to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2354to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2378<pre class="programlisting"> 2355<pre class="programlisting">
2379PKGSRC_RUN_TEST= yes 2356PKGSRC_RUN_TEST= yes
2380</pre> 2357</pre>
2381<p>Be prepared that even the most basic packages fail this test. When 2358<p>Be prepared that even the most basic packages fail this test. When
2382doing a bulk build with this, it will often abort in the early phase 2359doing a bulk build with this, it will often abort in the early phase
2383where the packages are scanned for their dependencies since there are 2360where the packages are scanned for their dependencies since there are
2384cyclic dependencies. There is still a lot to do in this area.</p> 2361cyclic dependencies. There is still a lot to do in this area.</p>
2385</div> 2362</div>
2386<div class="sect2"> 2363<div class="sect2">
2387<div class="titlepage"><div><div><h3 class="title"> 2364<div class="titlepage"><div><div><h3 class="title">
2388<a name="bulk.var.shvar"></a>8.4.9. Reject packages that use undefined shell variables</h3></div></div></div> 2365<a name="bulk.var.shvar"></a>8.4.8. Reject packages that use undefined shell variables</h3></div></div></div>
2389<p>To catch typos in the shell snippets from the Makefile fragments, 2366<p>To catch typos in the shell snippets from the Makefile fragments,
2390add the <code class="literal">-u</code> flag to most of the commands by adding this 2367add the <code class="literal">-u</code> flag to most of the commands by adding this
2391line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2368line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2392<pre class="programlisting"> 2369<pre class="programlisting">
2393RUN= @set -eu; 2370RUN= @set -eu;
2394</pre> 2371</pre>
2395<p>See <code class="filename">mk/misc/common.mk</code> for the existing 2372<p>See <code class="filename">mk/misc/common.mk</code> for the existing
2396definition.</p> 2373definition.</p>
2397</div> 2374</div>
2398<div class="sect2"> 2375<div class="sect2">
2399<div class="titlepage"><div><div><h3 class="title"> 2376<div class="titlepage"><div><div><h3 class="title">
2400<a name="bulk.var.quiet"></a>8.4.10. Turn off verbose logging</h3></div></div></div> 2377<a name="bulk.var.quiet"></a>8.4.9. Turn off verbose logging</h3></div></div></div>
2401<p>The build logs of a package are often quite long. This allows error 2378<p>The build logs of a package are often quite long. This allows error
2402messages or other interesting details to hide between the noise. To make 2379messages or other interesting details to hide between the noise. To make
2403the actual error message stand out more, add these lines to 2380the actual error message stand out more, add these lines to
2404<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2381<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2405<pre class="programlisting"> 2382<pre class="programlisting">
2406GNU_CONFIGURE_QUIET= yes 2383GNU_CONFIGURE_QUIET= yes
2407MAKE_FLAGS+= -s 2384MAKE_FLAGS+= -s
2408</pre> 2385</pre>
2409<p>The <code class="literal">-s</code> option works for both GNU Make and BSD 2386<p>The <code class="literal">-s</code> option works for both GNU Make and BSD
2410Make. On exotic platforms with their own make, it may be a little 2387Make. On exotic platforms with their own make, it may be a little
2411different.</p> 2388different.</p>
2412</div> 2389</div>
2413<div class="sect2"> 
2414<div class="titlepage"><div><div><h3 class="title"> 
2415<a name="bulk.var.options"></a>8.4.11. Select random sets of options</h3></div></div></div> 
2416<p>Most bulk builds run with the default package options. This means 
2417that other combinations of options are not regularly tested. To do this, 
2418run a bulk build with these configurations.</p> 
2419<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 
2420<li class="listitem"><p>no options enabled</p></li> 
2421<li class="listitem"><p>all options enabled</p></li> 
2422<li class="listitem"><p>2n + 0</p></li> 
2423<li class="listitem"><p>2n + 1</p></li> 
2424<li class="listitem"><p>4n + 0..1</p></li> 
2425<li class="listitem"><p>4n + 2..3</p></li> 
2426<li class="listitem"><p>8n + 0..3</p></li> 
2427<li class="listitem"><p>8n + 4..7</p></li> 
2428<li class="listitem"><p>2048n + 0..1023</p></li> 
2429<li class="listitem"><p>2048n + 1024..2047</p></li> 
2430</ul></div> 
2431<p>Open questions are:</p> 
2432<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 
2433<li class="listitem"><p>how to collect all options from the entire 
2434pkgsrc</p></li> 
2435<li class="listitem"><p>how to handle mutually exclusive 
2436options</p></li> 
2437<li class="listitem"><p>the sets of mutually exclusive options are defined 
2438per-package</p></li> 
2439<li class="listitem"><p>the sets of nonempty sets are defined 
2440per-package</p></li> 
2441</ul></div> 
2442</div> 
2443<div class="sect2"> 
2444<div class="titlepage"><div><div><h3 class="title"> 
2445<a name="bulk.var.build_defs"></a>8.4.12. Select random configurations of BUILD_DEFS</h3></div></div></div> 
2446<p>Just like the <code class="varname">PKG_OPTIONS</code>, the 
2447<code class="varname">BUILD_DEFS</code> also allow different variants of pkgsrc to 
2448be created. The same ideas as in <a class="xref" href="#bulk.var.options" title="8.4.11. Select random sets of options">Section 8.4.11, &#8220;Select random sets of options&#8221;</a> 
2449apply.</p> 
2450</div> 
2451</div> 2390</div>
2452<div class="sect1"> 2391<div class="sect1">
2453<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2392<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2454<a name="creating-cdroms"></a>8.5. Creating a multiple CD-ROM packages collection</h2></div></div></div> 2393<a name="creating-cdroms"></a>8.5. Creating a multiple CD-ROM packages collection</h2></div></div></div>
2455<p>After your pkgsrc bulk-build has completed, you may wish to 2394<p>After your pkgsrc bulk-build has completed, you may wish to
2456 create a CD-ROM set of the resulting binary packages to assist 2395 create a CD-ROM set of the resulting binary packages to assist
2457 in installing packages on other machines. The 2396 in installing packages on other machines. The
2458 <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 2397 <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
2459 a simple tool for creating the ISO 9660 images. 2398 a simple tool for creating the ISO 9660 images.
2460 <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a 2399 <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a
2461 way that keeps all the dependencies for a given package on the same 2400 way that keeps all the dependencies for a given package on the same
2462 CD as that package.</p> 2401 CD as that package.</p>
2463<div class="sect2"> 2402<div class="sect2">
2464<div class="titlepage"><div><div><h3 class="title"> 2403<div class="titlepage"><div><div><h3 class="title">
2465<a name="cdpack-example"></a>8.5.1. Example of cdpack</h3></div></div></div> 2404<a name="cdpack-example"></a>8.5.1. Example of cdpack</h3></div></div></div>
2466<p>Complete documentation for cdpack is found in the cdpack(1) 2405<p>Complete documentation for cdpack is found in the cdpack(1)
2467 man page. The following short example assumes that the binary 2406 man page. The following short example assumes that the binary
2468 packages are left in 2407 packages are left in
2469 <code class="filename">/usr/pkgsrc/packages/All</code> and that 2408 <code class="filename">/usr/pkgsrc/packages/All</code> and that
2470 sufficient disk space exists in <code class="filename">/u2</code> to 2409 sufficient disk space exists in <code class="filename">/u2</code> to
2471 hold the ISO 9660 images.</p> 2410 hold the ISO 9660 images.</p>
2472<pre class="screen"> 2411<pre class="screen">
2473<code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong> 2412<code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong>
2474<code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong> 2413<code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
2475<code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong> 2414<code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
2476 </pre> 2415 </pre>
2477<p>If you wish to include a common set of files 2416<p>If you wish to include a common set of files
2478 (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>, 2417 (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>,
2479 etc.) on each CD in the collection, then you need to create a 2418 etc.) on each CD in the collection, then you need to create a
2480 directory which contains these files, e.g.:</p> 2419 directory which contains these files, e.g.:</p>
2481<pre class="screen"> 2420<pre class="screen">
2482<code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong> 2421<code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong>
2483<code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong> 2422<code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
2484<code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong> 2423<code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
2485<code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong> 2424<code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong>
2486<code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong> 2425<code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
2487<code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong> 2426<code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
2488<code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong> 2427<code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
2489 </pre> 2428 </pre>
2490<p>Now create the images:</p> 2429<p>Now create the images:</p>
2491<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong></pre> 2430<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong></pre>
2492<p>Each image will contain <code class="filename">README</code>, 2431<p>Each image will contain <code class="filename">README</code>,
2493 <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code> 2432 <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code>
2494 in their root directories.</p> 2433 in their root directories.</p>
2495</div> 2434</div>
2496</div> 2435</div>
2497</div> 2436</div>
2498<div class="chapter"> 2437<div class="chapter">
2499<div class="titlepage"><div><div><h2 class="title"> 2438<div class="titlepage"><div><div><h2 class="title">
2500<a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div> 2439<a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div>
2501<div class="toc"> 2440<div class="toc">
2502<p><b>Table of Contents</b></p> 2441<p><b>Table of Contents</b></p>
2503<dl class="toc"> 2442<dl class="toc">
2504<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt> 2443<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
2505<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt> 2444<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
2506</dl> 2445</dl>
2507</div> 2446</div>
2508<p>The files that are installed by pkgsrc are organized in a way that 2447<p>The files that are installed by pkgsrc are organized in a way that
2509is similar to what you find in the <code class="filename">/usr</code> directory 2448is similar to what you find in the <code class="filename">/usr</code> directory
2510of the base system. But some details are different. This is because 2449of the base system. But some details are different. This is because
2511pkgsrc initially came from FreeBSD and had adopted its file system 2450pkgsrc initially came from FreeBSD and had adopted its file system
2512hierarchy. Later it was largely influenced by NetBSD. But no matter 2451hierarchy. Later it was largely influenced by NetBSD. But no matter
2513which operating system you are using pkgsrc with, you can expect the 2452which operating system you are using pkgsrc with, you can expect the
2514same layout for pkgsrc.</p> 2453same layout for pkgsrc.</p>
2515<p>There are mainly four root directories for pkgsrc, which are all 2454<p>There are mainly four root directories for pkgsrc, which are all
2516configurable in the <code class="filename">bootstrap/bootstrap</code> script. 2455configurable in the <code class="filename">bootstrap/bootstrap</code> script.
2517When pkgsrc has been installed as root, the default locations 2456When pkgsrc has been installed as root, the default locations
2518are:</p> 2457are:</p>
2519<pre class="programlisting"> 2458<pre class="programlisting">
2520LOCALBASE= /usr/pkg 2459LOCALBASE= /usr/pkg
2521PKG_SYSCONFBASE= /usr/pkg/etc 2460PKG_SYSCONFBASE= /usr/pkg/etc
2522VARBASE= /var 2461VARBASE= /var
2523PKG_DBDIR= /usr/pkg/pkgdb 2462PKG_DBDIR= /usr/pkg/pkgdb
2524</pre> 2463</pre>
2525<p>In unprivileged mode (when pkgsrc has been installed as any other 2464<p>In unprivileged mode (when pkgsrc has been installed as any other
2526user), the default locations are:</p> 2465user), the default locations are:</p>
2527<pre class="programlisting"> 2466<pre class="programlisting">
2528LOCALBASE= ${HOME}/pkg 2467LOCALBASE= ${HOME}/pkg
2529PKG_SYSCONFBASE= ${HOME}/pkg/etc 2468PKG_SYSCONFBASE= ${HOME}/pkg/etc
2530VARBASE= ${HOME}/pkg/var 2469VARBASE= ${HOME}/pkg/var
2531PKG_DBDIR= ${HOME}/pkg/pkgdb 2470PKG_DBDIR= ${HOME}/pkg/pkgdb
2532</pre> 2471</pre>
2533<p>What these four directories are for, and what they look like is 2472<p>What these four directories are for, and what they look like is
2534explained below.</p> 2473explained below.</p>
2535<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2474<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2536<li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the 2475<li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the
2537<code class="filename">/usr</code> directory in the base system. It is the 2476<code class="filename">/usr</code> directory in the base system. It is the
2538<span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> directory where the files are installed and contains 2477<span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> directory where the files are installed and contains
2539the well-known subdirectories like <code class="filename">bin</code>, 2478the well-known subdirectories like <code class="filename">bin</code>,
2540<code class="filename">include</code>, <code class="filename">lib</code>, 2479<code class="filename">include</code>, <code class="filename">lib</code>,
2541<code class="filename">share</code> and 2480<code class="filename">share</code> and
2542<code class="filename">sbin</code>.</p></li> 2481<code class="filename">sbin</code>.</p></li>
2543<li class="listitem"><p><code class="varname">VARBASE</code> corresponds to 2482<li class="listitem"><p><code class="varname">VARBASE</code> corresponds to
2544<code class="filename">/var</code> in the base system. Some programs (especially 2483<code class="filename">/var</code> in the base system. Some programs (especially
2545games, network daemons) need write access to it during normal 2484games, network daemons) need write access to it during normal
2546operation.</p></li> 2485operation.</p></li>
2547<li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to 2486<li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to
2548<code class="filename">/etc</code> in the base system. It contains configuration 2487<code class="filename">/etc</code> in the base system. It contains configuration
2549files of the packages, as well as pkgsrc's <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> 2488files of the packages, as well as pkgsrc's <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
2550itself.</p></li> 2489itself.</p></li>
2551</ul></div> 2490</ul></div>
2552<div class="sect1"> 2491<div class="sect1">
2553<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2492<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2554<a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code> 2493<a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code>
2555</h2></div></div></div> 2494</h2></div></div></div>
2556<p>The following directories exist in a typical pkgsrc installation 2495<p>The following directories exist in a typical pkgsrc installation
2557in <code class="filename">${LOCALBASE}</code>.</p> 2496in <code class="filename">${LOCALBASE}</code>.</p>
2558<div class="variablelist"><dl class="variablelist"> 2497<div class="variablelist"><dl class="variablelist">
2559<dt><span class="term"><code class="filename">bin</code></span></dt> 2498<dt><span class="term"><code class="filename">bin</code></span></dt>
2560<dd><p>Contains executable programs that are intended to be 2499<dd><p>Contains executable programs that are intended to be
2561directly used by the end user.</p></dd> 2500directly used by the end user.</p></dd>
2562<dt><span class="term"><code class="filename">emul</code></span></dt> 2501<dt><span class="term"><code class="filename">emul</code></span></dt>
2563<dd><p>Contains files for the emulation layers of various other 2502<dd><p>Contains files for the emulation layers of various other
2564operating systems, especially for 2503operating systems, especially for
2565NetBSD.</p></dd> 2504NetBSD.</p></dd>
2566<dt><span class="term"><code class="filename">etc</code> (the usual location of 2505<dt><span class="term"><code class="filename">etc</code> (the usual location of
2567<code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt> 2506<code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt>
2568<dd><p>Contains 2507<dd><p>Contains
2569the configuration files.</p></dd> 2508the configuration files.</p></dd>
2570<dt><span class="term"><code class="filename">include</code></span></dt> 2509<dt><span class="term"><code class="filename">include</code></span></dt>
2571<dd><p>Contains headers for the C and C++ programming 2510<dd><p>Contains headers for the C and C++ programming
2572languages.</p></dd> 2511languages.</p></dd>
2573<dt><span class="term"><code class="filename">info</code></span></dt> 2512<dt><span class="term"><code class="filename">info</code></span></dt>
2574<dd><p>Contains GNU info files of various 2513<dd><p>Contains GNU info files of various
2575packages.</p></dd> 2514packages.</p></dd>
2576<dt><span class="term"><code class="filename">lib</code></span></dt> 2515<dt><span class="term"><code class="filename">lib</code></span></dt>
2577<dd><p>Contains shared and static 2516<dd><p>Contains shared and static
2578libraries.</p></dd> 2517libraries.</p></dd>
2579<dt><span class="term"><code class="filename">libdata</code></span></dt> 2518<dt><span class="term"><code class="filename">libdata</code></span></dt>
2580<dd><p>Contains data files that don't change after 2519<dd><p>Contains data files that don't change after
2581installation. Other data files belong into 2520installation. Other data files belong into
2582<code class="filename">${VARBASE}</code>.</p></dd> 2521<code class="filename">${VARBASE}</code>.</p></dd>
2583<dt><span class="term"><code class="filename">libexec</code></span></dt> 2522<dt><span class="term"><code class="filename">libexec</code></span></dt>
2584<dd><p>Contains programs that are not intended to be used by 2523<dd><p>Contains programs that are not intended to be used by
2585end users, such as helper programs or network 2524end users, such as helper programs or network
2586daemons.</p></dd> 2525daemons.</p></dd>
2587<dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt> 2526<dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt>
2588<dd><p>Contains programs that are intended to be executed as 2527<dd><p>Contains programs that are intended to be executed as
2589CGI scripts by a web server.</p></dd> 2528CGI scripts by a web server.</p></dd>
2590<dt><span class="term"><code class="filename">man</code> (the usual value of 2529<dt><span class="term"><code class="filename">man</code> (the usual value of
2591<code class="filename">${PKGMANDIR}</code>)</span></dt> 2530<code class="filename">${PKGMANDIR}</code>)</span></dt>
2592<dd><p>Contains brief 2531<dd><p>Contains brief
2593documentation in form of manual pages.</p></dd> 2532documentation in form of manual pages.</p></dd>
2594<dt><span class="term"><code class="filename">sbin</code></span></dt> 2533<dt><span class="term"><code class="filename">sbin</code></span></dt>
2595<dd><p>Contains programs that are intended to be used only by 2534<dd><p>Contains programs that are intended to be used only by
2596the super-user.</p></dd> 2535the super-user.</p></dd>
2597<dt><span class="term"><code class="filename">share</code></span></dt> 2536<dt><span class="term"><code class="filename">share</code></span></dt>
2598<dd><p>Contains platform-independent data files that don't 2537<dd><p>Contains platform-independent data files that don't
2599change after installation.</p></dd> 2538change after installation.</p></dd>
2600<dt><span class="term"><code class="filename">share/doc</code></span></dt> 2539<dt><span class="term"><code class="filename">share/doc</code></span></dt>
2601<dd><p>Contains documentation files provided by the 2540<dd><p>Contains documentation files provided by the
2602packages.</p></dd> 2541packages.</p></dd>
2603<dt><span class="term"><code class="filename">share/examples</code></span></dt> 2542<dt><span class="term"><code class="filename">share/examples</code></span></dt>
2604<dd><p>Contains example files provided by the packages. Among 2543<dd><p>Contains example files provided by the packages. Among
2605others, the original configuration files are saved here and copied to 2544others, the original configuration files are saved here and copied to
2606<code class="filename">${PKG_SYSCONFDIR}</code> during 2545<code class="filename">${PKG_SYSCONFDIR}</code> during
2607installation.</p></dd> 2546installation.</p></dd>
2608<dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt> 2547<dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt>
2609<dd><p>Contains the original files for rc.d 2548<dd><p>Contains the original files for rc.d
2610scripts.</p></dd> 2549scripts.</p></dd>
2611<dt><span class="term"><code class="filename">var</code> (the usual location of 2550<dt><span class="term"><code class="filename">var</code> (the usual location of
2612<code class="filename">${VARBASE}</code>)</span></dt> 2551<code class="filename">${VARBASE}</code>)</span></dt>
2613<dd><p>Contains files 2552<dd><p>Contains files
2614that may be modified after 2553that may be modified after
2615installation.</p></dd> 2554installation.</p></dd>
2616</dl></div> 2555</dl></div>
2617</div> 2556</div>
2618<div class="sect1"> 2557<div class="sect1">
2619<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2558<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2620<a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code> 2559<a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code>
2621</h2></div></div></div> 2560</h2></div></div></div>
2622<div class="variablelist"><dl class="variablelist"> 2561<div class="variablelist"><dl class="variablelist">
2623<dt><span class="term"><code class="filename">db/pkg</code> (the usual location of 2562<dt><span class="term"><code class="filename">db/pkg</code> (the usual location of
2624<code class="filename">${PKG_DBDIR}</code>)</span></dt> 2563<code class="filename">${PKG_DBDIR}</code>)</span></dt>
2625<dd><p>Contains 2564<dd><p>Contains
2626information about the currently installed 2565information about the currently installed
2627packages.</p></dd> 2566packages.</p></dd>
2628<dt><span class="term"><code class="filename">games</code></span></dt> 2567<dt><span class="term"><code class="filename">games</code></span></dt>
2629<dd><p>Contains highscore 2568<dd><p>Contains highscore
2630files.</p></dd> 2569files.</p></dd>
2631<dt><span class="term"><code class="filename">log</code></span></dt> 2570<dt><span class="term"><code class="filename">log</code></span></dt>
2632<dd><p>Contains log files.</p></dd> 2571<dd><p>Contains log files.</p></dd>
2633<dt><span class="term"><code class="filename">run</code></span></dt> 2572<dt><span class="term"><code class="filename">run</code></span></dt>
2634<dd><p>Contains informational files about daemons that are 2573<dd><p>Contains informational files about daemons that are
2635currently running.</p></dd> 2574currently running.</p></dd>
2636</dl></div> 2575</dl></div>
2637</div> 2576</div>
2638</div> 2577</div>
2639<div class="chapter"> 2578<div class="chapter">
2640<div class="titlepage"><div><div><h2 class="title"> 2579<div class="titlepage"><div><div><h2 class="title">
2641<a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div> 2580<a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div>
2642<div class="toc"> 2581<div class="toc">
2643<p><b>Table of Contents</b></p> 2582<p><b>Table of Contents</b></p>
2644<dl class="toc"> 2583<dl class="toc">
2645<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt> 2584<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
2646<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt> 2585<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
2647<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt> 2586<dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
2648<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt> 2587<dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
2649<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> 2588<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>
2650<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt> 2589<dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
2651<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt> 2590<dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
2652<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> 2591<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>
2653<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt> 2592<dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
2654<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make 2593<dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
2655/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt> 2594/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
2656<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt> 2595<dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
2657<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt> 2596<dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
2658<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt> 2597<dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
2659<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt> 2598<dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
2660<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt> 2599<dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
2661<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt> 2600<dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
2662<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt> 2601<dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
2663</dl> 2602</dl>
2664</div> 2603</div>
2665<p>This section contains hints, tips &amp; tricks on special things in 2604<p>This section contains hints, tips &amp; tricks on special things in
2666pkgsrc that we didn't find a better place for in the previous chapters, and 2605pkgsrc that we didn't find a better place for in the previous chapters, and
2667it contains items for both pkgsrc users and developers.</p> 2606it contains items for both pkgsrc users and developers.</p>
2668<div class="sect1"> 2607<div class="sect1">
2669<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2608<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2670<a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div> 2609<a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div>
2671<p>The following mailing lists may be of interest to pkgsrc users:</p> 2610<p>The following mailing lists may be of interest to pkgsrc users:</p>
2672<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2611<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2673<li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-users" target="_top">pkgsrc-users</a>: 2612<li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-users" target="_top">pkgsrc-users</a>:
2674 This is a general purpose list for most issues regarding 2613 This is a general purpose list for most issues regarding
2675 pkgsrc, regardless of platform, e.g. soliciting user help 2614 pkgsrc, regardless of platform, e.g. soliciting user help
2676 for pkgsrc configuration, unexpected build failures, using 2615 for pkgsrc configuration, unexpected build failures, using
2677 particular packages, upgrading pkgsrc installations, 2616 particular packages, upgrading pkgsrc installations,
2678 questions regarding the pkgsrc release branches, etc. General announcements or 2617 questions regarding the pkgsrc release branches, etc. General announcements or
2679 proposals for changes that impact the pkgsrc user community, 2618 proposals for changes that impact the pkgsrc user community,
2680 e.g. major infrastructure changes, new features, package 2619 e.g. major infrastructure changes, new features, package
2681 removals, etc., may also be posted.</p></li> 2620 removals, etc., may also be posted.</p></li>
2682<li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-bulk" target="_top">pkgsrc-bulk</a>: 2621<li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-bulk" target="_top">pkgsrc-bulk</a>:
2683 A list where the results of pkgsrc bulk builds are sent and 2622 A list where the results of pkgsrc bulk builds are sent and
2684 discussed.</p></li> 2623 discussed.</p></li>
2685<li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-changes" target="_top">pkgsrc-changes</a>: 2624<li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-changes" target="_top">pkgsrc-changes</a>:
2686 This list is for those who are interested in getting a 2625 This list is for those who are interested in getting a
2687 commit message for every change committed to pkgsrc. It is 2626 commit message for every change committed to pkgsrc. It is
2688 also available in digest form, meaning one daily message 2627 also available in digest form, meaning one daily message
2689 containing all commit messages for changes to the package 2628 containing all commit messages for changes to the package
2690 source tree in that 24 hour period.</p></li> 2629 source tree in that 24 hour period.</p></li>
2691</ul></div> 2630</ul></div>
2692<p>To subscribe, do:</p> 2631<p>To subscribe, do:</p>
2693<pre class="programlisting"> 2632<pre class="programlisting">
2694<code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org 2633<code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
2695</pre> 2634</pre>
2696<p>Archives for all these mailing lists are available from 2635<p>Archives for all these mailing lists are available from
2697<a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>.</p> 2636<a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>.</p>
2698</div> 2637</div>
2699<div class="sect1"> 2638<div class="sect1">
2700<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2639<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2701<a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div> 2640<a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div>
2702<p>The directory <code class="filename">pkgsrc/pkgtools</code> contains 2641<p>The directory <code class="filename">pkgsrc/pkgtools</code> contains
2703a number of useful utilities for both users and developers of pkgsrc. This 2642a number of useful utilities for both users and developers of pkgsrc. This
2704section attempts only to make the reader aware of some of the utilities and when 2643section attempts only to make the reader aware of some of the utilities and when
2705they might be useful, and not to duplicate the documentation that comes 2644they might be useful, and not to duplicate the documentation that comes
2706with each package.</p> 2645with each package.</p>
2707<p>Utilities used by pkgsrc (automatically installed when needed):</p> 2646<p>Utilities used by pkgsrc (automatically installed when needed):</p>
2708<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>: 2647<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>:
2709 Symlinks for use by buildlink.</p></li></ul></div> 2648 Symlinks for use by buildlink.</p></li></ul></div>
2710<p>OS tool augmentation (automatically installed when needed):</p> 2649<p>OS tool augmentation (automatically installed when needed):</p>
2711<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2650<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2712<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>: 2651<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>:
2713 Calculates various kinds of checksums (including SHA3).</p></li> 2652 Calculates various kinds of checksums (including SHA3).</p></li>
2714<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>: 2653<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>:
2715 Compatibility library for pkgsrc tools.</p></li> 2654 Compatibility library for pkgsrc tools.</p></li>
2716<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 2655<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
2717 non-BSD systems due to lack of native mtree.</p></li> 2656 non-BSD systems due to lack of native mtree.</p></li>
2718<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>: 2657<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>:
2719 Up-to-date replacement for 2658 Up-to-date replacement for
2720 <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating 2659 <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating
2721 systems where pkg_install is not present.</p></li> 2660 systems where pkg_install is not present.</p></li>
2722</ul></div> 2661</ul></div>
2723<p>Utilities used by pkgsrc (not automatically installed):</p> 2662<p>Utilities used by pkgsrc (not automatically installed):</p>
2724<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2663<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2725<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>: 2664<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>:
2726 Create a binary package from an 2665 Create a binary package from an
2727 already-installed package. Used by <span class="command"><strong>make replace</strong></span> to 2666 already-installed package. Used by <span class="command"><strong>make replace</strong></span> to
2728 save the old package.</p></li> 2667 save the old package.</p></li>
2729<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>: 2668<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>:
2730 Adds extra functionality to pkgsrc, allowing it to fetch distfiles 2669 Adds extra functionality to pkgsrc, allowing it to fetch distfiles
2731 from multiple locations. It currently supports the following 2670 from multiple locations. It currently supports the following
2732 methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li> 2671 methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li>
2733<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 2672<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
2734 the best compiler flags to optimise code for your current 2673 the best compiler flags to optimise code for your current
2735 CPU and compiler. </p></li> 2674 CPU and compiler. </p></li>
2736</ul></div> 2675</ul></div>
2737<p>Utilities for keeping track of installed packages, being up to date, 2676<p>Utilities for keeping track of installed packages, being up to date,
2738etc:</p> 2677etc:</p>
2739<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2678<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2740<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 2679<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
2741 update tool similar to apt(1). Download, install, and upgrade 2680 update tool similar to apt(1). Download, install, and upgrade
2742 binary packages easily.</p></li> 2681 binary packages easily.</p></li>
2743<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 2682<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
2744 packages whose installed versions do not match the latest pkgsrc 2683 packages whose installed versions do not match the latest pkgsrc
2745 entries.</p></li> 2684 entries.</p></li>
2746<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 2685<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
2747 dependency graphs of packages, to aid in choosing a strategy for 2686 dependency graphs of packages, to aid in choosing a strategy for
2748 updating.</p></li> 2687 updating.</p></li>
2749<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 2688<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
2750 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> 2689 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>
2751<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 2690<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
2752 pkglint(1) program checks a pkgsrc entry for errors.</p></li> 2691 pkglint(1) program checks a pkgsrc entry for errors.</p></li>
2753<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 2692<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
2754 does various checks on the complete pkgsrc system.</p></li> 2693 does various checks on the complete pkgsrc system.</p></li>
2755<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 2694<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
2756 packages you have installed.</p></li> 2695 packages you have installed.</p></li>
2757</ul></div> 2696</ul></div>
2758<p>Utilities for people maintaining or creating individual packages:</p> 2697<p>Utilities for people maintaining or creating individual packages:</p>
2759<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2698<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2760<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 2699<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
2761 making and maintaining patches for a package (includes pkgdiff, 2700 making and maintaining patches for a package (includes pkgdiff,
2762 pkgvi, mkpatches, etc.).</p></li> 2701 pkgvi, mkpatches, etc.).</p></li>
2763<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 2702<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
2764 converting to pkgsrc.</p></li> 2703 converting to pkgsrc.</p></li>
2765</ul></div> 2704</ul></div>
2766<p>Utilities for people maintaining pkgsrc (or: more obscure pkg 2705<p>Utilities for people maintaining pkgsrc (or: more obscure pkg
2767utilities)</p> 2706utilities)</p>
2768<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2707<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2769<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 2708<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
2770 packages in a chrooted area.</p></li> 2709 packages in a chrooted area.</p></li>
2771<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 2710<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
2772 kernel version for chrooted cross builds.</p></li> 2711 kernel version for chrooted cross builds.</p></li>
2773</ul></div> 2712</ul></div>
2774</div> 2713</div>
2775<div class="sect1"> 2714<div class="sect1">
2776<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2715<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2777<a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div> 2716<a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div>
2778<p>To install packages from source as a non-root user, download 2717<p>To install packages from source as a non-root user, download
2779pkgsrc 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 2718pkgsrc 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
2780directory and run the command <span class="command"><strong>./bootstrap/bootstrap 2719directory and run the command <span class="command"><strong>./bootstrap/bootstrap
2781--unprivileged</strong></span>.</p> 2720--unprivileged</strong></span>.</p>
2782<p>This will install the binary part of pkgsrc to 2721<p>This will install the binary part of pkgsrc to
2783<code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> 2722<code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
2784into <code class="filename">~/pkg/etc</code>.</p> 2723into <code class="filename">~/pkg/etc</code>.</p>
2785<p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p> 2724<p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
2786</div> 2725</div>
2787<div class="sect1"> 2726<div class="sect1">
2788<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2727<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2789<a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div> 2728<a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
2790<p>By default, resuming transfers in pkgsrc is disabled, but you can 2729<p>By default, resuming transfers in pkgsrc is disabled, but you can
2791enable this feature by adding the option 2730enable this feature by adding the option
2792<code class="varname">PKG_RESUME_TRANSFERS=YES</code> into 2731<code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
2793<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete 2732<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete
2794distfile is found, pkgsrc will try to resume it.</p> 2733distfile is found, pkgsrc will try to resume it.</p>
2795<p>You can also 2734<p>You can also
2796use a different program than the platform default program by changing the 2735use a different program than the platform default program by changing the
2797<code class="varname">FETCH_USING</code> variable. You can specify the program by 2736<code class="varname">FETCH_USING</code> variable. You can specify the program by
2798using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled 2737using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled
2799by using the value manual. A value of custom disables the system defaults 2738by using the value manual. A value of custom disables the system defaults
2800and dependency tracking for the fetch program. In that case you have to 2739and dependency tracking for the fetch program. In that case you have to
2801provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>, 2740provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>,
2802<code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>, 2741<code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>,
2803<code class="varname">FETCH_AFTER_ARGS</code>.</p> 2742<code class="varname">FETCH_AFTER_ARGS</code>.</p>
2804<p>For example, if you want to use 2743<p>For example, if you want to use
2805<code class="filename">wget</code> to download, you'll have to use something 2744<code class="filename">wget</code> to download, you'll have to use something
2806like:</p> 2745like:</p>
2807<pre class="programlisting"> 2746<pre class="programlisting">
2808FETCH_USING= wget 2747FETCH_USING= wget
2809</pre> 2748</pre>
2810</div> 2749</div>
2811<div class="sect1"> 2750<div class="sect1">
2812<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2751<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2813<a name="x.org-from-pkgsrc"></a>10.5. How can I install/use modular X.org from pkgsrc?</h2></div></div></div> 2752<a name="x.org-from-pkgsrc"></a>10.5. How can I install/use modular X.org from pkgsrc?</h2></div></div></div>
2814<p>If you want to use modular X.org from pkgsrc instead of your system's own X11 2753<p>If you want to use modular X.org from pkgsrc instead of your system's own X11
2815(<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...) 2754(<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...)
2816you will have to add the following line into 2755you will have to add the following line into
2817<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p> 2756<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
2818<pre class="programlisting"> 2757<pre class="programlisting">
2819X11_TYPE=modular 2758X11_TYPE=modular
2820</pre> 2759</pre>
2821</div> 2760</div>
2822<div class="sect1"> 2761<div class="sect1">
2823<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2762<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2824<a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div> 2763<a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div>
2825<p>If you are sitting behind a firewall which does not allow direct 2764<p>If you are sitting behind a firewall which does not allow direct
2826connections to Internet hosts (i.e. non-NAT), you may specify the 2765connections to Internet hosts (i.e. non-NAT), you may specify the
2827relevant proxy hosts. This is done using an environment variable in the 2766relevant proxy hosts. This is done using an environment variable in the
2828form of a URL, e.g. in Amdahl, the machine 2767form of a URL, e.g. in Amdahl, the machine
2829<span class="quote">&#8220;<span class="quote">orpheus.amdahl.com</span>&#8221;</span> is one of the firewalls, and it uses 2768<span class="quote">&#8220;<span class="quote">orpheus.amdahl.com</span>&#8221;</span> is one of the firewalls, and it uses
2830port 80 as the proxy port number. So the proxy environment variables 2769port 80 as the proxy port number. So the proxy environment variables
2831are:</p> 2770are:</p>
2832<pre class="programlisting"> 2771<pre class="programlisting">
2833ftp_proxy=ftp://orpheus.amdahl.com:80/ 2772ftp_proxy=ftp://orpheus.amdahl.com:80/
2834http_proxy=http://orpheus.amdahl.com:80/ 2773http_proxy=http://orpheus.amdahl.com:80/
2835</pre> 2774</pre>
2836</div> 2775</div>
2837<div class="sect1"> 2776<div class="sect1">
2838<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2777<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2839<a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div> 2778<a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div>
2840<p>Some fetch tools are not prepared to support HTTPS by default 2779<p>Some fetch tools are not prepared to support HTTPS by default
2841(for example, the one in NetBSD 6.0), or the one installed by the 2780(for example, the one in NetBSD 6.0), or the one installed by the
2842pkgsrc bootstrap (to avoid an openssl dependency that low in the 2781pkgsrc bootstrap (to avoid an openssl dependency that low in the
2843dependency graph).</p> 2782dependency graph).</p>
2844<p>Usually you won't notice, because distribution files are 2783<p>Usually you won't notice, because distribution files are
2845mirrored weekly to <span class="quote">&#8220;<span class="quote">ftp.NetBSD.org</span>&#8221;</span>, but that might not 2784mirrored weekly to <span class="quote">&#8220;<span class="quote">ftp.NetBSD.org</span>&#8221;</span>, but that might not
2846be often enough if you are following pkgsrc-current. In that case, set 2785be often enough if you are following pkgsrc-current. In that case, set
2847<code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to 2786<code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to
2848<span class="quote">&#8220;<span class="quote">curl</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">wget</span>&#8221;</span>, which are both compiled 2787<span class="quote">&#8220;<span class="quote">curl</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">wget</span>&#8221;</span>, which are both compiled
2849with HTTPS support by default. Of course, these tools need to be 2788with HTTPS support by default. Of course, these tools need to be
2850installed before you can use them this way.</p> 2789installed before you can use them this way.</p>
2851</div> 2790</div>
2852<div class="sect1"> 2791<div class="sect1">
2853<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2792<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2854<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> 2793<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>
2855<p>This depends on which utility is used to retrieve distfiles. From 2794<p>This depends on which utility is used to retrieve distfiles. From
2856<code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned 2795<code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned
2857the first available command from the following list:</p> 2796the first available command from the following list:</p>
2858<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2797<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2859<li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li> 2798<li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li>
2860<li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li> 2799<li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li>
2861</ul></div> 2800</ul></div>
2862<p>On a default NetBSD installation, this will be 2801<p>On a default NetBSD installation, this will be
2863<code class="filename">/usr/bin/ftp</code>, which automatically tries passive 2802<code class="filename">/usr/bin/ftp</code>, which automatically tries passive
2864connections first, and falls back to active connections if the server 2803connections first, and falls back to active connections if the server
2865refuses to do passive. For the other tools, add the following to your 2804refuses to do passive. For the other tools, add the following to your
2866<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file: 2805<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file:
2867<code class="varname">PASSIVE_FETCH=1</code>.</p> 2806<code class="varname">PASSIVE_FETCH=1</code>.</p>
2868<p>Having that option present will prevent 2807<p>Having that option present will prevent
2869<code class="filename">/usr/bin/ftp</code> from falling back to active 2808<code class="filename">/usr/bin/ftp</code> from falling back to active
2870transfers.</p> 2809transfers.</p>
2871</div> 2810</div>
2872<div class="sect1"> 2811<div class="sect1">
2873<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2812<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2874<a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div> 2813<a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div>
2875<p>You would like to download all the distfiles in a single batch 2814<p>You would like to download all the distfiles in a single batch
2876from work or university, where you can't run a <span class="command"><strong>make 2815from work or university, where you can't run a <span class="command"><strong>make
2877fetch</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>, 2816fetch</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>,
2878but downloading the entire directory may not be appropriate.</p> 2817but downloading the entire directory may not be appropriate.</p>
2879<p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in 2818<p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in
2880<code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the 2819<code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the
2881resulting list to your machine at work/school and use it there. If you 2820resulting list to your machine at work/school and use it there. If you
2882don't have a NetBSD-compatible <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?ftp+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a> (like tnftp) at work, don't 2821don't have a NetBSD-compatible <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?ftp+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a> (like tnftp) at work, don't
2883forget to set <code class="varname">FETCH_CMD</code> to something that fetches a 2822forget to set <code class="varname">FETCH_CMD</code> to something that fetches a
2884URL:</p> 2823URL:</p>
2885<p>At home:</p> 2824<p>At home:</p>
2886<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong> 2825<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
2887<code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong> 2826<code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
2888<code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre> 2827<code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre>
2889<p>At work:</p> 2828<p>At work:</p>
2890<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre> 2829<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre>
2891<p>then tar up <code class="filename">/tmp/distfiles</code> and take it 2830<p>then tar up <code class="filename">/tmp/distfiles</code> and take it
2892home.</p> 2831home.</p>
2893<p>If you have a machine running NetBSD, and you want to get 2832<p>If you have a machine running NetBSD, and you want to get
2894<span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your 2833<span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your
2895machine architecture), you can do so by using the above-mentioned 2834machine architecture), you can do so by using the above-mentioned
2896<span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles 2835<span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles
2897directly by running:</p> 2836directly by running:</p>
2898<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre> 2837<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre>
2899<p>If you even decide to ignore 2838<p>If you even decide to ignore
2900<code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything 2839<code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything
2901by running:</p> 2840by running:</p>
2902<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre> 2841<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre>
2903</div> 2842</div>
2904<div class="sect1"> 2843<div class="sect1">
2905<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2844<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2906<a name="tmac.andoc-missing"></a>10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make 2845<a name="tmac.andoc-missing"></a>10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
2907/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</h2></div></div></div> 2846/usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</h2></div></div></div>
2908<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> 2847<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>
2909package, you get the error from make that it doesn't know how to make 2848package, you get the error from make that it doesn't know how to make
2910<code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that 2849<code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that
2911you don't have installed the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> set (nroff, ...) from 2850you don't have installed the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> set (nroff, ...) from
2912the NetBSD base distribution on your machine. It is recommended to do 2851the NetBSD base distribution on your machine. It is recommended to do
2913that to format man pages.</p> 2852that to format man pages.</p>
2914<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 2853<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
2915can get away with setting <code class="varname">NOMAN=YES</code> either in the 2854can get away with setting <code class="varname">NOMAN=YES</code> either in the
2916environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2855environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2917</div> 2856</div>
2918<div class="sect1"> 2857<div class="sect1">
2919<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2858<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2920<a name="bsd.own.mk-missing"></a>10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</h2></div></div></div> 2859<a name="bsd.own.mk-missing"></a>10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</h2></div></div></div>
2921<p>You didn't install the compiler set, <code class="filename">comp.tgz</code>, 2860<p>You didn't install the compiler set, <code class="filename">comp.tgz</code>,
2922when you installed your NetBSD machine. Please get and install it, by 2861when you installed your NetBSD machine. Please get and install it, by
2923extracting it in <code class="filename">/</code>:</p> 2862extracting it in <code class="filename">/</code>:</p>
2924<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong> 2863<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong>
2925<code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre> 2864<code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre>
2926<p><code class="filename">comp.tgz</code> is part of every NetBSD release. Get 2865<p><code class="filename">comp.tgz</code> is part of every NetBSD release. Get
2927the one that corresponds to your release (determine via <span class="command"><strong>uname 2866the one that corresponds to your release (determine via <span class="command"><strong>uname
2928-r</strong></span>).</p> 2867-r</strong></span>).</p>
2929</div> 2868</div>
2930<div class="sect1"> 2869<div class="sect1">
2931<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2870<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2932<a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' with pkgsrc</h2></div></div></div> 2871<a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' with pkgsrc</h2></div></div></div>
2933<p>When installing packages as non-root user and using the just-in-time 2872<p>When installing packages as non-root user and using the just-in-time
2934<a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> feature of pkgsrc, it can become annoying to type in the root 2873<a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> feature of pkgsrc, it can become annoying to type in the root
2935password for each required package installed. To avoid this, the sudo 2874password for each required package installed. To avoid this, the sudo
2936package can be used, which does password caching over a limited time. To 2875package can be used, which does password caching over a limited time. To
2937use it, install sudo (either as binary package or from 2876use it, install sudo (either as binary package or from
2938<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 2877<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
2939following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere 2878following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere
2940<span class="emphasis"><em>after</em></span> the definition of the 2879<span class="emphasis"><em>after</em></span> the definition of the
2941<code class="varname">LOCALBASE</code> variable:</p> 2880<code class="varname">LOCALBASE</code> variable:</p>
2942<pre class="programlisting"> 2881<pre class="programlisting">
2943.if exists(${LOCALBASE}/bin/sudo) 2882.if exists(${LOCALBASE}/bin/sudo)
2944SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c 2883SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2945.endif 2884.endif
2946</pre> 2885</pre>
2947</div> 2886</div>
2948<div class="sect1"> 2887<div class="sect1">
2949<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2888<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2950<a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div> 2889<a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div>
2951<p>As the system administrator, you can choose where configuration files 2890<p>As the system administrator, you can choose where configuration files
2952are installed. The default settings make all these files go into 2891are installed. The default settings make all these files go into
2953<code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may 2892<code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may
2954be suboptimal depending on your expectations (e.g., a read-only, 2893be suboptimal depending on your expectations (e.g., a read-only,
2955NFS-exported <code class="varname">PREFIX</code> with a need of per-machine 2894NFS-exported <code class="varname">PREFIX</code> with a need of per-machine
2956configuration of the provided packages).</p> 2895configuration of the provided packages).</p>
2957<p>In order to change the defaults, you can modify the 2896<p>In order to change the defaults, you can modify the
2958<code class="varname">PKG_SYSCONFBASE</code> variable (in 2897<code class="varname">PKG_SYSCONFBASE</code> variable (in
2959<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration 2898<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration
2960directory; some common examples include <code class="filename">/etc</code> or 2899directory; some common examples include <code class="filename">/etc</code> or
2961<code class="filename">/etc/pkg</code>.</p> 2900<code class="filename">/etc/pkg</code>.</p>
2962<p>Furthermore, you can change this value on a per-package basis by 2901<p>Furthermore, you can change this value on a per-package basis by
2963setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable. 2902setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable.
2964<code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the 2903<code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the
2965package you would like to modify, that is, the contents of 2904package you would like to modify, that is, the contents of
2966<code class="varname">PKGBASE</code>.</p> 2905<code class="varname">PKGBASE</code>.</p>
2967<p>Note that after changing these settings, you must rebuild and 2906<p>Note that after changing these settings, you must rebuild and
2968reinstall any affected packages.</p> 2907reinstall any affected packages.</p>
2969</div> 2908</div>
2970<div class="sect1"> 2909<div class="sect1">
2971<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2910<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2972<a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div> 2911<a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div>
2973<p>Please be aware that there can often be bugs in third-party software, 2912<p>Please be aware that there can often be bugs in third-party software,
2974and some of these bugs can leave a machine vulnerable to exploitation by 2913and some of these bugs can leave a machine vulnerable to exploitation by
2975attackers. In an effort to lessen the exposure, the NetBSD packages team 2914attackers. In an effort to lessen the exposure, the NetBSD packages team
2976maintains a database of known-exploits to packages which have at one time 2915maintains a database of known-exploits to packages which have at one time
2977been included in pkgsrc. The database can be downloaded automatically, and 2916been included in pkgsrc. The database can be downloaded automatically, and
2978a security audit of all packages installed on a system can take place. To 2917a security audit of all packages installed on a system can take place. To
2979do this, refer to the following two tools (installed as part of the 2918do this, refer to the following two tools (installed as part of the
2980<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> 2919<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>
2981<div class="orderedlist"><ol class="orderedlist" type="1"> 2920<div class="orderedlist"><ol class="orderedlist" type="1">
2982<li class="listitem"> 2921<li class="listitem">
2983<p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to 2922<p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to
2984 download a list of the security vulnerabilities information. This list 2923 download a list of the security vulnerabilities information. This list
2985 is kept up to date by the pkgsrc security team, and is distributed 2924 is kept up to date by the pkgsrc security team, and is distributed
2986 from the NetBSD ftp server:</p> 2925 from the NetBSD ftp server:</p>
2987<p><a class="ulink" href="https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a></p> 2926<p><a class="ulink" href="https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a></p>
2988</li> 2927</li>
2989<li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the 2928<li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the
2990 current machine, checking each known vulnerability. If a 2929 current machine, checking each known vulnerability. If a
2991 vulnerable package is installed, it will be shown by output to stdout, 2930 vulnerable package is installed, it will be shown by output to stdout,
2992 including a description of the type of vulnerability, and a URL 2931 including a description of the type of vulnerability, and a URL
2993 containing more information.</p></li> 2932 containing more information.</p></li>
2994</ol></div> 2933</ol></div>
2995<p>Use of these tools is strongly recommended! 2934<p>Use of these tools is strongly recommended!
2996See <a class="xref" href="#vulnerabilities" title="5.1.5. Checking for security vulnerabilities in installed packages">Section 5.1.5, &#8220;Checking for security vulnerabilities in installed packages&#8221;</a> for instructions on how to automate checking and 2935See <a class="xref" href="#vulnerabilities" title="5.1.5. Checking for security vulnerabilities in installed packages">Section 5.1.5, &#8220;Checking for security vulnerabilities in installed packages&#8221;</a> for instructions on how to automate checking and
2997reporting.</p> 2936reporting.</p>
2998<p>If this database is installed, pkgsrc builds will use it to 2937<p>If this database is installed, pkgsrc builds will use it to
2999perform a security check before building any package.</p> 2938perform a security check before building any package.</p>
3000</div> 2939</div>
3001<div class="sect1"> 2940<div class="sect1">
3002<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2941<div class="titlepage"><div><div><h2 class="title" style="clear: both">
3003<a name="ufaq-cflags"></a>10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</h2></div></div></div> 2942<a name="ufaq-cflags"></a>10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</h2></div></div></div>
3004<p>When you add your own preferences to the 2943<p>When you add your own preferences to the
3005 <code class="varname">CFLAGS</code> variable in your 2944 <code class="varname">CFLAGS</code> variable in your
3006 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in 2945 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in
3007 environment variables to the <code class="filename">./configure</code> 2946 environment variables to the <code class="filename">./configure</code>
3008 scripts and to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>. Some package authors ignore the 2947 scripts and to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>. Some package authors ignore the
3009 <code class="varname">CFLAGS</code> from the environment variable by 2948 <code class="varname">CFLAGS</code> from the environment variable by
3010 overriding them in the <code class="filename">Makefile</code>s of their 2949 overriding them in the <code class="filename">Makefile</code>s of their
3011 package.</p> 2950 package.</p>
3012<p>Currently there is no solution to this problem. If you 2951<p>Currently there is no solution to this problem. If you
3013 really need the package to use your <code class="varname">CFLAGS</code> 2952 really need the package to use your <code class="varname">CFLAGS</code>
3014 you should run <span class="command"><strong>make patch</strong></span> in the package 2953 you should run <span class="command"><strong>make patch</strong></span> in the package
3015 directory and then inspect any <code class="filename">Makefile</code> and 2954 directory and then inspect any <code class="filename">Makefile</code> and
3016 <code class="filename">Makefile.in</code> for whether they define 2955 <code class="filename">Makefile.in</code> for whether they define
3017 <code class="varname">CFLAGS</code> explicitly. Usually you can remove 2956 <code class="varname">CFLAGS</code> explicitly. Usually you can remove
3018 these lines. But be aware that some <span class="quote">&#8220;<span class="quote">smart</span>&#8221;</span> 2957 these lines. But be aware that some <span class="quote">&#8220;<span class="quote">smart</span>&#8221;</span>
3019 programmers write so bad code that it only works for the 2958 programmers write so bad code that it only works for the
3020 specific combination of <code class="varname">CFLAGS</code> they have 2959 specific combination of <code class="varname">CFLAGS</code> they have
3021 chosen.</p> 2960 chosen.</p>
3022<p>To find out where the CFLAGS are ignored, add the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p> 2961<p>To find out where the CFLAGS are ignored, add the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
3023<pre class="programlisting"> 2962<pre class="programlisting">
3024CPPFLAGS+= -Dpkgsrc___CPPFLAGS 2963CPPFLAGS+= -Dpkgsrc___CPPFLAGS
3025CFLAGS+= -Dpkgsrc___CFLAGS 2964CFLAGS+= -Dpkgsrc___CFLAGS
3026CXXFLAGS+= -Dpkgsrc___CXXFLAGS 2965CXXFLAGS+= -Dpkgsrc___CXXFLAGS
3027</pre> 2966</pre>
3028<p>Then run <span class="command"><strong>bmake show-all-configure show-all-build</strong></span> 2967<p>Then run <span class="command"><strong>bmake show-all-configure show-all-build</strong></span>
3029to see whether the above flags are passed to the actual build 2968to see whether the above flags are passed to the actual build
3030commands in general.</p> 2969commands in general.</p>
3031<p>To find out whether the flags are passed to individual compiler 2970<p>To find out whether the flags are passed to individual compiler
3032commands, have a look at the file <code class="filename">work/.work.log</code>. In 2971commands, have a look at the file <code class="filename">work/.work.log</code>. In
3033most cases, the flags from the original command lines (the lines starting 2972most cases, the flags from the original command lines (the lines starting
3034with <code class="literal">[*]</code>) are passed unmodified to the actual compiler 2973with <code class="literal">[*]</code>) are passed unmodified to the actual compiler
3035(the lines starting with <code class="literal">&lt;.&gt;</code>). If the flag is 2974(the lines starting with <code class="literal">&lt;.&gt;</code>). If the flag is
3036missing from the actual compiler command, it must have been removed by 2975missing from the actual compiler command, it must have been removed by
3037the <a class="link" href="#build.wrapper" title="19.10. The wrapper phase">pkgsrc compiler wrappers</a>.</p> 2976the <a class="link" href="#build.wrapper" title="19.10. The wrapper phase">pkgsrc compiler wrappers</a>.</p>
3038</div> 2977</div>
3039<div class="sect1"> 2978<div class="sect1">
3040<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2979<div class="titlepage"><div><div><h2 class="title" style="clear: both">
3041<a name="ufaq-fail"></a>10.16. A package does not build. What shall I do?</h2></div></div></div> 2980<a name="ufaq-fail"></a>10.16. A package does not build. What shall I do?</h2></div></div></div>
3042<div class="procedure"><ol class="procedure" type="1"> 2981<div class="procedure"><ol class="procedure" type="1">
3043<li class="step"><p>Make sure that your copy of pkgsrc is consistent. A 2982<li class="step"><p>Make sure that your copy of pkgsrc is consistent. A
3044 case that occurs often is that people only update pkgsrc in 2983 case that occurs often is that people only update pkgsrc in
3045 parts, because of performance reasons. Since pkgsrc is one large 2984 parts, because of performance reasons. Since pkgsrc is one large
3046 system, not a collection of many small systems, there are 2985 system, not a collection of many small systems, there are
3047 sometimes changes that only work when the whole pkgsrc tree is 2986 sometimes changes that only work when the whole pkgsrc tree is
3048 updated.</p></li> 2987 updated.</p></li>
3049<li class="step"><p>Make sure that you don't have any CVS conflicts. 2988<li class="step"><p>Make sure that you don't have any CVS conflicts.
3050 Search for <span class="quote">&#8220;<span class="quote">&lt;&lt;&lt;&lt;&lt;&lt;</span>&#8221;</span> or 2989 Search for <span class="quote">&#8220;<span class="quote">&lt;&lt;&lt;&lt;&lt;&lt;</span>&#8221;</span> or
3051 <span class="quote">&#8220;<span class="quote">&gt;&gt;&gt;&gt;&gt;&gt;</span>&#8221;</span> in all your pkgsrc 2990 <span class="quote">&#8220;<span class="quote">&gt;&gt;&gt;&gt;&gt;&gt;</span>&#8221;</span> in all your pkgsrc
3052 files.</p></li> 2991 files.</p></li>
3053<li class="step"><p>Make sure that you don't have old copies of the packages 2992<li class="step"><p>Make sure that you don't have old copies of the packages
3054 extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to 2993 extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to
3055 verify this.</p></li> 2994 verify this.</p></li>
3056<li class="step"><p>If you are a package developer who wants to invest 2995<li class="step"><p>If you are a package developer who wants to invest
3057 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> 2996 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>
3058<li class="step"><p>If the problem still exists, write a mail to the 2997<li class="step"><p>If the problem still exists, write a mail to the
3059 <code class="literal">pkgsrc-users</code> mailing list.</p></li> 2998 <code class="literal">pkgsrc-users</code> mailing list.</p></li>
3060</ol></div> 2999</ol></div>
3061</div> 3000</div>
3062<div class="sect1"> 3001<div class="sect1">
3063<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 3002<div class="titlepage"><div><div><h2 class="title" style="clear: both">
3064<a name="faq.rcs-conflicts"></a>10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</h2></div></div></div> 3003<a name="faq.rcs-conflicts"></a>10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</h2></div></div></div>
3065<p>You have modified a file from pkgsrc, and someone else has 3004<p>You have modified a file from pkgsrc, and someone else has
3066modified that same file afterwards in the CVS repository. Both changes 3005modified that same file afterwards in the CVS repository. Both changes
3067are in the same region of the file, so when you updated pkgsrc, the 3006are in the same region of the file, so when you updated pkgsrc, the
3068<code class="literal">cvs</code> command marked the conflicting changes in the 3007<code class="literal">cvs</code> command marked the conflicting changes in the
3069file. Because of these markers, the file is no longer a valid 3008file. Because of these markers, the file is no longer a valid
3070<code class="filename">Makefile</code>.</p> 3009<code class="filename">Makefile</code>.</p>
3071<p>Have a look at that file, and if you don't need your local changes 3010<p>Have a look at that file, and if you don't need your local changes
3072anymore, you can remove that file and run <span class="command"><strong>cvs -q update 3011anymore, you can remove that file and run <span class="command"><strong>cvs -q update
3073-dP</strong></span> in that directory to download the current version.</p> 3012-dP</strong></span> in that directory to download the current version.</p>
3074</div> 3013</div>
3075</div> 3014</div>
3076</div> 3015</div>
3077<div class="part"> 3016<div class="part">
3078<div class="titlepage"><div><div><h1 class="title"> 3017<div class="titlepage"><div><div><h1 class="title">
3079<a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div> 3018<a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div>
3080<div class="partintro"> 3019<div class="partintro">
3081<div></div> 3020<div></div>
3082<p>This part of the book deals with creating and 3021<p>This part of the book deals with creating and
3083 modifying packages. It starts with a <span class="quote">&#8220;<span class="quote">HOWTO</span>&#8221;</span>-like 3022 modifying packages. It starts with a <span class="quote">&#8220;<span class="quote">HOWTO</span>&#8221;</span>-like
3084 guide on creating a new package. The remaining chapters are more 3023 guide on creating a new package. The remaining chapters are more
3085 like a reference manual for pkgsrc.</p> 3024 like a reference manual for pkgsrc.</p>
3086<div class="toc"> 3025<div class="toc">
3087<p><b>Table of Contents</b></p> 3026<p><b>Table of Contents</b></p>
3088<dl class="toc"> 3027<dl class="toc">
3089<dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt> 3028<dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
3090<dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt> 3029<dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
3091<dd><dl> 3030<dd><dl>
3092<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt> 3031<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
3093<dd><dl> 3032<dd><dl>
3094<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt> 3033<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
3095<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt> 3034<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
3096<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt> 3035<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
3097<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt> 3036<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
3098</dl></dd> 3037</dl></dd>
3099<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt> 3038<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
3100<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> 3039<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>
3101</dl></dd> 3040</dl></dd>
3102<dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt> 3041<dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
3103<dd><dl> 3042<dd><dl>
3104<dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt> 3043<dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
3105<dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt> 3044<dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
3106<dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt> 3045<dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
3107<dd><dl> 3046<dd><dl>
3108<dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt> 3047<dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
3109<dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt> 3048<dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
3110<dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt> 3049<dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
3111<dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt> 3050<dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
3112<dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt> 3051<dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
3113</dl></dd> 3052</dl></dd>
3114<dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt> 3053<dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
3115<dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt> 3054<dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
3116<dd><dl> 3055<dd><dl>
3117<dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt> 3056<dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
3118<dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt> 3057<dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
3119<dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt> 3058<dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
3120</dl></dd> 3059</dl></dd>
3121<dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt> 3060<dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
3122<dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt> 3061<dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
3123</dl></dd> 3062</dl></dd>
3124<dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt> 3063<dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
3125<dd><dl> 3064<dd><dl>
3126<dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt> 3065<dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
3127<dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt> 3066<dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
3128<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd> 3067<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
3129<dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt> 3068<dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
3130<dd><dl> 3069<dd><dl>
3131<dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt> 3070<dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
3132<dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt> 3071<dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
3133<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> 3072<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>
3134<dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt> 3073<dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
3135</dl></dd> 3074</dl></dd>
3136</dl></dd> 3075</dl></dd>
3137<dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt> 3076<dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
3138<dd><dl> 3077<dd><dl>
3139<dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt> 3078<dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
3140<dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 3079<dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
3141<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> 3080<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>
3142<dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt> 3081<dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
3143<dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt> 3082<dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
3144<dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt> 3083<dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
3145<dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt> 3084<dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
3146<dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt> 3085<dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
3147<dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt> 3086<dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
3148</dl></dd> 3087</dl></dd>
3149<dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt> 3088<dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
3150<dd><dl> 3089<dd><dl>
3151<dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt> 3090<dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
3152<dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt> 3091<dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
3153<dd><dl> 3092<dd><dl>
3154<dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt> 3093<dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
3155<dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating 3094<dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
3156 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 3095 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
3157 and 3096 and
3158 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 3097 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
3159 in <code class="filename">buildlink3.mk</code> files</a></span></dt> 3098 in <code class="filename">buildlink3.mk</code> files</a></span></dt>
3160</dl></dd> 3099</dl></dd>
3161<dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt> 3100<dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
3162<dd><dl> 3101<dd><dl>
3163<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> 3102<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>
3164<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt> 3103<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
3165</dl></dd> 3104</dl></dd>
3166</dl></dd> 3105</dl></dd>
3167<dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt> 3106<dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
3168<dd><dl> 3107<dd><dl>
3169<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt> 3108<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
3170<dd><dl> 3109<dd><dl>
3171<dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt> 3110<dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
3172<dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt> 3111<dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
3173</dl></dd> 3112</dl></dd>
3174<dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt> 3113<dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
3175<dd><dl> 3114<dd><dl>
3176<dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt> 3115<dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
3177<dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt> 3116<dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
3178<dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt> 3117<dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
3179<dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt> 3118<dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
3180</dl></dd> 3119</dl></dd>
3181<dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt> 3120<dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
3182<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> 3121<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>
3183<dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt> 3122<dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
3184<dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt> 3123<dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
3185<dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd> 3124<dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
3186<dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt> 3125<dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
3187<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> 3126<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>
3188</dl></dd> 3127</dl></dd>
3189<dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt> 3128<dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
3190<dd><dl> 3129<dd><dl>
3191<dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt> 3130<dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
3192<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> 3131<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>
3193<dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt> 3132<dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
3194<dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt> 3133<dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
3195</dl></dd> 3134</dl></dd>
3196<dt><span class="chapter"><a href="#build">19. The build process</a></span></dt> 3135<dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
3197<dd><dl> 3136<dd><dl>
3198<dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt> 3137<dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
3199<dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt> 3138<dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
3200<dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt> 3139<dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
3201<dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt> 3140<dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
3202<dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt> 3141<dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
3203<dd><dl> 3142<dd><dl>
3204<dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt> 3143<dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
3205<dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt> 3144<dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
3206</dl></dd> 3145</dl></dd>
3207<dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt> 3146<dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
3208<dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt> 3147<dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
3209<dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt> 3148<dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
3210<dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt> 3149<dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
3211<dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt> 3150<dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
3212<dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt> 3151<dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
3213<dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt> 3152<dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
3214<dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt> 3153<dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
3215<dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt> 3154<dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
3216<dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt> 3155<dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
3217<dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt> 3156<dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
3218<dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt> 3157<dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
3219</dl></dd> 3158</dl></dd>
3220<dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt> 3159<dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
3221<dd><dl> 3160<dd><dl>
3222<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt> 3161<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
3223<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt> 3162<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
3224<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt> 3163<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
3225</dl></dd> 3164</dl></dd>
3226<dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt> 3165<dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
3227<dd><dl> 3166<dd><dl>
3228<dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt> 3167<dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
3229<dd><dl> 3168<dd><dl>
3230<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> 3169<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>
3231<dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt> 3170<dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
3232<dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt> 3171<dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
3233<dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt> 3172<dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
3234<dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt> 3173<dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
3235<dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt> 3174<dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
3236<dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt> 3175<dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
3237<dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt> 3176<dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
3238<dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt> 3177<dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
3239<dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt> 3178<dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
3240<dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt> 3179<dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
3241</dl></dd> 3180</dl></dd>
3242<dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt> 3181<dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
3243<dd><dl> 3182<dd><dl>
3244<dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt> 3183<dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
3245<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> 3184<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>
3246<dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt> 3185<dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
3247</dl></dd> 3186</dl></dd>
3248<dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt> 3187<dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
3249<dd><dl> 3188<dd><dl>
3250<dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt> 3189<dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
3251<dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt> 3190<dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
3252<dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt> 3191<dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
3253</dl></dd> 3192</dl></dd>
3254<dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt> 3193<dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
3255<dd><dl> 3194<dd><dl>
3256<dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt> 3195<dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
3257<dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt> 3196<dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
3258<dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt> 3197<dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
3259<dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt> 3198<dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
3260<dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt> 3199<dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
3261</dl></dd> 3200</dl></dd>
3262<dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt> 3201<dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
3263<dd><dl> 3202<dd><dl>
3264<dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt> 3203<dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
3265<dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt> 3204<dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
3266<dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt> 3205<dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
3267<dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt> 3206<dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
3268<dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt> 3207<dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
3269</dl></dd> 3208</dl></dd>
3270<dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt> 3209<dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
3271<dd><dl> 3210<dd><dl>
3272<dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt> 3211<dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
3273<dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt> 3212<dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
3274<dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt> 3213<dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
3275<dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt> 3214<dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
3276<dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt> 3215<dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
3277<dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt> 3216<dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
3278<dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt> 3217<dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
3279<dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt> 3218<dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
3280<dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt> 3219<dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
3281<dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt> 3220<dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
3282<dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt> 3221<dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
3283<dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt> 3222<dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
3284<dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt> 3223<dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
3285<dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt> 3224<dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
3286<dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt> 3225<dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
3287<dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt> 3226<dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
3288<dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt> 3227<dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
3289<dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in 3228<dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
3290 emulation</a></span></dt> 3229 emulation</a></span></dt>
3291<dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt> 3230<dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
3292<dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt> 3231<dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
3293</dl></dd> 3232</dl></dd>
3294<dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt> 3233<dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
3295</dl></dd> 3234</dl></dd>
3296<dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt> 3235<dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
3297<dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt> 3236<dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
3298<dd><dl> 3237<dd><dl>
3299<dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt> 3238<dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
3300<dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt> 3239<dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
3301<dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt> 3240<dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
3302<dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt> 3241<dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
3303<dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt> 3242<dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
3304<dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt> 3243<dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
3305<dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt> 3244<dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
3306<dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt> 3245<dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
3307</dl></dd> 3246</dl></dd>
3308<dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt> 3247<dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
3309<dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt> 3248<dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
3310<dd><dl> 3249<dd><dl>
3311<dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt> 3250<dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
3312<dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt> 3251<dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
3313<dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt> 3252<dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
3314<dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt> 3253<dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
3315</dl></dd> 3254</dl></dd>
3316</dl> 3255</dl>
3317</div> 3256</div>
3318</div> 3257</div>
3319<div class="chapter"> 3258<div class="chapter">
3320<div class="titlepage"><div><div><h2 class="title"> 3259<div class="titlepage"><div><div><h2 class="title">
3321<a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div> 3260<a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div>
3322<p> 3261<p>
3323 To get help when developing pkgsrc, the definitive source is this 3262 To get help when developing pkgsrc, the definitive source is this
3324 document, the pkgsrc guide. If you don't find anything here, 3263 document, the pkgsrc guide. If you don't find anything here,
3325 there are alternatives: 3264 there are alternatives:
3326</p> 3265</p>
3327<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 3266<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3328<li class="listitem"> 3267<li class="listitem">
3329<p> 3268<p>
3330 The built-in pkgsrc help, which is available after bootstrapping 3269 The built-in pkgsrc help, which is available after bootstrapping
3331 pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get 3270 pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
3332 help for any topic, such as a variable name like 3271 help for any topic, such as a variable name like
3333 <code class="varname">BUILD_DEFS</code>, a make target like 3272 <code class="varname">BUILD_DEFS</code>, a make target like
3334 <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like 3273 <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
3335 <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p> 3274 <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
3336<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> 3275<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>
3337</li> 3276</li>
3338<li class="listitem"><p> 3277<li class="listitem"><p>
3339 To see the value of a single variable, run <span class="command"><strong>bmake 3278 To see the value of a single variable, run <span class="command"><strong>bmake
3340 show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>. 3279 show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
3341</p></li> 3280</p></li>
3342<li class="listitem"><p> 3281<li class="listitem"><p>
3343 To see the values of the most common variables, run 3282 To see the values of the most common variables, run
3344 <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by 3283 <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
3345 topic. To see the variables for a single topic, run 3284 topic. To see the variables for a single topic, run
3346 <span class="command"><strong>bmake 3285 <span class="command"><strong>bmake
3347 show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example 3286 show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
3348 <span class="command"><strong>bmake show-all-fetch</strong></span>. 3287 <span class="command"><strong>bmake show-all-fetch</strong></span>.
3349</p></li> 3288</p></li>
3350<li class="listitem"><p> 3289<li class="listitem"><p>
3351 The tech-pkg mailing list, to which 3290 The tech-pkg mailing list, to which
3352 <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you 3291 <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you
3353 can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your 3292 can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your
3354 questions</a>.</p></li> 3293 questions</a>.</p></li>
3355<li class="listitem"><p>The #pkgsrc IRC channel, which is accessible 3294<li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
3356 <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a> 3295 <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
3357 or by using a specialized chat program such as 3296 or by using a specialized chat program such as
3358 <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>. 3297 <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
3359 Pick any user name and join the channel #pkgsrc.</p></li> 3298 Pick any user name and join the channel #pkgsrc.</p></li>
3360</ul></div> 3299</ul></div>
3361</div> 3300</div>
3362<div class="chapter"> 3301<div class="chapter">
3363<div class="titlepage"><div><div><h2 class="title"> 3302<div class="titlepage"><div><div><h2 class="title">
3364<a name="creating"></a>Chapter 12. Creating a new pkgsrc package from scratch</h2></div></div></div> 3303<a name="creating"></a>Chapter 12. Creating a new pkgsrc package from scratch</h2></div></div></div>
3365<div class="toc"> 3304<div class="toc">
3366<p><b>Table of Contents</b></p> 3305<p><b>Table of Contents</b></p>
3367<dl class="toc"> 3306<dl class="toc">
3368<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt> 3307<dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
3369<dd><dl> 3308<dd><dl>
3370<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt> 3309<dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
3371<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt> 3310<dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
3372<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt> 3311<dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
3373<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt> 3312<dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
3374</dl></dd> 3313</dl></dd>
3375<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt> 3314<dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
3376<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> 3315<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>
3377</dl> 3316</dl>
3378</div> 3317</div>
3379<p>When you find a package that is not yet in pkgsrc, you 3318<p>When you find a package that is not yet in pkgsrc, you
3380most likely have a URL from where you can download the source 3319most likely have a URL from where you can download the source
3381code. Starting with this URL, creating a package involves only a 3320code. Starting with this URL, creating a package involves only a
3382few steps.</p> 3321few steps.</p>
3383<div class="procedure"><ol class="procedure" type="1"> 3322<div class="procedure"><ol class="procedure" type="1">
3384<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> 3323<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>
3385<li class="step"><p>Then, choose one of the top-level directories as the 3324<li class="step"><p>Then, choose one of the top-level directories as the
3386category in which you want to place your package. You can also create a 3325category in which you want to place your package. You can also create a
3387directory of your own (maybe called <code class="filename">local</code>). In that 3326directory of your own (maybe called <code class="filename">local</code>). In that
3388category directory, create another directory for your package and change 3327category directory, create another directory for your package and change
3389into it.</p></li> 3328into it.</p></li>
3390<li class="step"><p>Run the program <span class="command"><strong>url2pkg</strong></span>, which will ask 3329<li class="step"><p>Run the program <span class="command"><strong>url2pkg</strong></span>, which will ask
3391you for a URL. Enter the URL of the distribution file (in most cases a 3330you for a URL. Enter the URL of the distribution file (in most cases a
3392<code class="filename">.tar.gz</code> file) and watch how the basic ingredients 3331<code class="filename">.tar.gz</code> file) and watch how the basic ingredients
3393of your package are created automatically. The distribution file is 3332of your package are created automatically. The distribution file is
3394extracted automatically to fill in some details in the 3333extracted automatically to fill in some details in the
3395<code class="filename">Makefile</code> that would otherwise have to be done 3334<code class="filename">Makefile</code> that would otherwise have to be done
3396manually.</p></li> 3335manually.</p></li>
3397<li class="step"> 3336<li class="step">
3398<p>Examine the extracted files to determine the dependencies of 3337<p>Examine the extracted files to determine the dependencies of
3399your package. Ideally, this is mentioned in some 3338your package. Ideally, this is mentioned in some
3400<code class="filename">README</code> file, but things may differ. For each of 3339<code class="filename">README</code> file, but things may differ. For each of
3401these dependencies, look where it exists in pkgsrc, and if there is a 3340these dependencies, look where it exists in pkgsrc, and if there is a
3402file called <code class="filename">buildlink3.mk</code> in that directory, add a 3341file called <code class="filename">buildlink3.mk</code> in that directory, add a
3403line to your package <code class="filename">Makefile</code> which includes that 3342line to your package <code class="filename">Makefile</code> which includes that
3404file just before the last line. If the 3343file just before the last line. If the
3405<code class="filename">buildlink3.mk</code> file does not exist, it must be 3344<code class="filename">buildlink3.mk</code> file does not exist, it must be
3406created first. The <code class="filename">buildlink3.mk</code> file makes sure 3345created first. The <code class="filename">buildlink3.mk</code> file makes sure
3407that the package's include files and libraries are provided.</p> 3346that the package's include files and libraries are provided.</p>
3408<p>If you just need binaries from a package, add a 3347<p>If you just need binaries from a package, add a
3409<code class="varname">DEPENDS</code> line to the Makefile, which specifies the 3348<code class="varname">DEPENDS</code> line to the Makefile, which specifies the
3410version of the dependency and where it can be found in pkgsrc. This line 3349version of the dependency and where it can be found in pkgsrc. This line
3411should be placed in the third paragraph. If the dependency is only 3350should be placed in the third paragraph. If the dependency is only
3412needed for building the package, but not when using it, use 3351needed for building the package, but not when using it, use
3413<code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code> 3352<code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
3414instead of <code class="varname">DEPENDS</code>. 3353instead of <code class="varname">DEPENDS</code>.
3415The difference between <code class="varname">TOOL_DEPENDS</code> and 3354The difference between <code class="varname">TOOL_DEPENDS</code> and
3416<code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling: 3355<code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
3417<code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span> 3356<code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
3418packages, i.e. packages for the architecture where the package 3357packages, i.e. packages for the architecture where the package
3419is built; 3358is built;
3420<code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span> 3359<code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
3421packages, i.e. packages for the architecture for which the package 3360packages, i.e. packages for the architecture for which the package
3422is built. There is also <code class="varname">TEST_DEPENDS</code>, which is used 3361is built. There is also <code class="varname">TEST_DEPENDS</code>, which is used
3423to specify a dependency used only for testing the resulting package 3362to specify a dependency used only for testing the resulting package
3424built, using the upstream project's included test suite. 3363built, using the upstream project's included test suite.
3425Your package may then look like this:</p> 3364Your package may then look like this:</p>
3426<pre class="programlisting"> 3365<pre class="programlisting">
3427[...] 3366[...]
3428 3367
3429TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt 3368TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
3430DEPENDS+= screen-[0-9]*:../../misc/screen 3369DEPENDS+= screen-[0-9]*:../../misc/screen
3431DEPENDS+= screen&gt;=4.0:../../misc/screen 3370DEPENDS+= screen&gt;=4.0:../../misc/screen
3432 3371
3433[...] 3372[...]
3434 3373
3435.include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk" 3374.include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
3436.include "../../devel/glib2/buildlink3.mk" 3375.include "../../devel/glib2/buildlink3.mk"
3437.include "../../mk/bsd.pkg.mk" 3376.include "../../mk/bsd.pkg.mk"
3438</pre> 3377</pre>
3439</li> 3378</li>
3440<li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need 3379<li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
3441to be done to make your package a <span class="quote">&#8220;<span class="quote">good</span>&#8221;</span> one. If you don't 3380to be done to make your package a <span class="quote">&#8220;<span class="quote">good</span>&#8221;</span> one. If you don't
3442know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint 3381know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
3443--explain</strong></span> or <span class="command"><strong>pkglint 3382--explain</strong></span> or <span class="command"><strong>pkglint
3444-e</strong></span>, which outputs additional 3383-e</strong></span>, which outputs additional
3445explanations.</p></li> 3384explanations.</p></li>
3446<li class="step"><p>In many cases the package is not yet ready to build. You can 3385<li class="step"><p>In many cases the package is not yet ready to build. You can
3447find instructions for the most common cases in the next section, <a class="xref" href="#creating.common" title="12.1. Common types of packages">Section 12.1, &#8220;Common types of packages&#8221;</a>. After you have followed the instructions 3386find instructions for the most common cases in the next section, <a class="xref" href="#creating.common" title="12.1. Common types of packages">Section 12.1, &#8220;Common types of packages&#8221;</a>. After you have followed the instructions
3448over there, you can hopefully continue here.</p></li> 3387over there, you can hopefully continue here.</p></li>
3449<li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working 3388<li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working

cvs diff -r1.291 -r1.292 pkgsrc/doc/pkgsrc.txt (switch to unified diff)

--- pkgsrc/doc/pkgsrc.txt 2020/05/22 18:51:44 1.291
+++ pkgsrc/doc/pkgsrc.txt 2020/05/30 19:25:38 1.292
@@ -1,3076 +1,3009 @@ @@ -1,3076 +1,3009 @@
1The pkgsrc guide 1The pkgsrc guide
2 2
3Documentation on the NetBSD packages system 3Documentation on the NetBSD packages system
4 4
5Alistair Crooks 5Alistair Crooks
6 6
7<agc@NetBSD.org> 7<agc@NetBSD.org>
8 8
9Hubert Feyrer 9Hubert Feyrer
10 10
11<hubertf@NetBSD.org> 11<hubertf@NetBSD.org>
12 12
13The pkgsrc Developers 13The pkgsrc Developers
14 14
15Copyright 1994-2020 The NetBSD Foundation, Inc 15Copyright 1994-2020 The NetBSD Foundation, Inc
16 16
17$NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot Exp $ 17$NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot Exp $
18 18
19Abstract 19Abstract
20 20
21pkgsrc is a centralized package management system for Unix-like operating 21pkgsrc is a centralized package management system for Unix-like operating
22systems. This guide provides information for users and developers of pkgsrc. It 22systems. This guide provides information for users and developers of pkgsrc. It
23covers installation of binary and source packages, creation of binary and 23covers installation of binary and source packages, creation of binary and
24source packages and a high-level overview about the infrastructure. 24source packages and a high-level overview about the infrastructure.
25 25
26------------------------------------------------------------------------------- 26-------------------------------------------------------------------------------
27 27
28Table of Contents 28Table of Contents
29 29
301. What is pkgsrc? 301. What is pkgsrc?
31 31
32 1.1. Introduction 32 1.1. Introduction
33 33
34 1.1.1. Why pkgsrc? 34 1.1.1. Why pkgsrc?
35 1.1.2. Supported platforms 35 1.1.2. Supported platforms
36 36
37 1.2. Overview 37 1.2. Overview
38 1.3. Terminology 38 1.3. Terminology
39 39
40 1.3.1. Roles involved in pkgsrc 40 1.3.1. Roles involved in pkgsrc
41 41
42 1.4. Typography 42 1.4. Typography
43 43
44I. The pkgsrc user's guide 44I. The pkgsrc user's guide
45 45
46 2. Getting help 46 2. Getting help
47 3. Where to get pkgsrc and how to keep it up-to-date 47 3. Where to get pkgsrc and how to keep it up-to-date
48 48
49 3.1. Getting pkgsrc for the first time 49 3.1. Getting pkgsrc for the first time
50 50
51 3.1.1. As tar archive 51 3.1.1. As tar archive
52 3.1.2. Via anonymous CVS 52 3.1.2. Via anonymous CVS
53 53
54 3.2. Keeping pkgsrc up-to-date 54 3.2. Keeping pkgsrc up-to-date
55 55
56 3.2.1. Via tar files 56 3.2.1. Via tar files
57 3.2.2. Via CVS 57 3.2.2. Via CVS
58 58
59 4. Using pkgsrc on systems other than NetBSD 59 4. Using pkgsrc on systems other than NetBSD
60 60
61 4.1. Binary distribution 61 4.1. Binary distribution
62 4.2. Bootstrapping pkgsrc 62 4.2. Bootstrapping pkgsrc
63 63
64 5. Using pkgsrc 64 5. Using pkgsrc
65 65
66 5.1. Using binary packages 66 5.1. Using binary packages
67 67
68 5.1.1. Finding binary packages 68 5.1.1. Finding binary packages
69 5.1.2. Installing binary packages 69 5.1.2. Installing binary packages
70 5.1.3. Deinstalling packages 70 5.1.3. Deinstalling packages
71 5.1.4. Getting information about installed packages 71 5.1.4. Getting information about installed packages
72 5.1.5. Checking for security vulnerabilities in installed packages 72 5.1.5. Checking for security vulnerabilities in installed packages
73 5.1.6. Finding if newer versions of your installed packages are in 73 5.1.6. Finding if newer versions of your installed packages are in
74 pkgsrc 74 pkgsrc
75 5.1.7. Other administrative functions 75 5.1.7. Other administrative functions
76 76
77 5.2. Building packages from source 77 5.2. Building packages from source
78 78
79 5.2.1. Requirements 79 5.2.1. Requirements
80 5.2.2. Fetching distfiles 80 5.2.2. Fetching distfiles
81 5.2.3. How to build and install 81 5.2.3. How to build and install
82 82
83 6. Configuring pkgsrc 83 6. Configuring pkgsrc
84 84
85 6.1. General configuration 85 6.1. General configuration
86 6.2. Variables affecting the build process 86 6.2. Variables affecting the build process
87 6.3. Variables affecting the installation process 87 6.3. Variables affecting the installation process
88 6.4. Selecting and configuring the compiler 88 6.4. Selecting and configuring the compiler
89 89
90 6.4.1. Selecting the compiler 90 6.4.1. Selecting the compiler
91 6.4.2. Additional flags to the compiler (CFLAGS) 91 6.4.2. Additional flags to the compiler (CFLAGS)
92 6.4.3. Additional flags to the linker (LDFLAGS) 92 6.4.3. Additional flags to the linker (LDFLAGS)
93 93
94 6.5. Developer/advanced settings 94 6.5. Developer/advanced settings
95 6.6. Selecting Build Options 95 6.6. Selecting Build Options
96 96
97 7. Creating binary packages 97 7. Creating binary packages
98 98
99 7.1. Building a single binary package 99 7.1. Building a single binary package
100 7.2. Settings for creation of binary packages 100 7.2. Settings for creation of binary packages
101 101
102 8. Creating binary packages for everything in pkgsrc (bulk builds) 102 8. Creating binary packages for everything in pkgsrc (bulk builds)
103 103
104 8.1. Preparations 104 8.1. Preparations
105 8.2. Running a pbulk-style bulk build 105 8.2. Running a pbulk-style bulk build
106 106
107 8.2.1. Configuration 107 8.2.1. Configuration
108 108
109 8.3. Requirements of a full bulk build 109 8.3. Requirements of a full bulk build
110 8.4. Bulk build variants 110 8.4. Bulk build variants
111 111
112 8.4.1. Strict SUBST blocks 112 8.4.1. Detect unknown configure options
113 8.4.2. Detect unknown configure options 113 8.4.2. Detect classes of bugs by forcing compiler warnings
114 8.4.3. Detect classes of bugs by forcing compiler warnings 114 8.4.3. Use custom directories
115 8.4.4. Use custom directories 115 8.4.4. Turn warnings into errors
116 8.4.5. Turn warnings into errors 116 8.4.5. Reject packages for which pkglint reports errors
117 8.4.6. Reject packages for which pkglint reports errors 117 8.4.6. Reject packages that contain forbidden strings
118 8.4.7. Reject packages that contain forbidden strings 118 8.4.7. Reject packages whose self-test fails
119 8.4.8. Reject packages whose self-test fails 119 8.4.8. Reject packages that use undefined shell variables
120 8.4.9. Reject packages that use undefined shell variables 120 8.4.9. Turn off verbose logging
121 8.4.10. Turn off verbose logging 
122 8.4.11. Select random sets of options 
123 8.4.12. Select random configurations of BUILD_DEFS 
124 121
125 8.5. Creating a multiple CD-ROM packages collection 122 8.5. Creating a multiple CD-ROM packages collection
126 123
127 8.5.1. Example of cdpack 124 8.5.1. Example of cdpack
128 125
129 9. Directory layout of the installed files 126 9. Directory layout of the installed files
130 127
131 9.1. File system layout in ${LOCALBASE} 128 9.1. File system layout in ${LOCALBASE}
132 9.2. File system layout in ${VARBASE} 129 9.2. File system layout in ${VARBASE}
133 130
134 10. Frequently Asked Questions 131 10. Frequently Asked Questions
135 132
136 10.1. Are there any mailing lists for pkg-related discussion? 133 10.1. Are there any mailing lists for pkg-related discussion?
137 10.2. Utilities for package management (pkgtools) 134 10.2. Utilities for package management (pkgtools)
138 10.3. How to use pkgsrc as non-root 135 10.3. How to use pkgsrc as non-root
139 10.4. How to resume transfers when fetching distfiles? 136 10.4. How to resume transfers when fetching distfiles?
140 10.5. How can I install/use modular X.org from pkgsrc? 137 10.5. How can I install/use modular X.org from pkgsrc?
141 10.6. How to fetch files from behind a firewall 138 10.6. How to fetch files from behind a firewall
142 10.7. How to fetch files from HTTPS sites 139 10.7. How to fetch files from HTTPS sites
143 10.8. How do I tell make fetch to do passive FTP? 140 10.8. How do I tell make fetch to do passive FTP?
144 10.9. How to fetch all distfiles at once 141 10.9. How to fetch all distfiles at once
145 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" 142 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
146 mean? 143 mean?
147 10.11. What does "Could not find bsd.own.mk" mean? 144 10.11. What does "Could not find bsd.own.mk" mean?
148 10.12. Using 'sudo' with pkgsrc 145 10.12. Using 'sudo' with pkgsrc
149 10.13. How do I change the location of configuration files? 146 10.13. How do I change the location of configuration files?
150 10.14. Automated security checks 147 10.14. Automated security checks
151 10.15. Why do some packages ignore my CFLAGS? 148 10.15. Why do some packages ignore my CFLAGS?
152 10.16. A package does not build. What shall I do? 149 10.16. A package does not build. What shall I do?
153 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? 150 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
154 merge conflicts" mean? 151 merge conflicts" mean?
155 152
156II. The pkgsrc developer's guide 153II. The pkgsrc developer's guide
157 154
158 11. Getting help 155 11. Getting help
159 12. Creating a new pkgsrc package from scratch 156 12. Creating a new pkgsrc package from scratch
160 157
161 12.1. Common types of packages 158 12.1. Common types of packages
162 159
163 12.1.1. Perl modules 160 12.1.1. Perl modules
164 12.1.2. Python modules and programs 161 12.1.2. Python modules and programs
165 12.1.3. R packages 162 12.1.3. R packages
166 12.1.4. TeXlive packages 163 12.1.4. TeXlive packages
167 164
168 12.2. Examples 165 12.2. Examples
169 166
170 12.2.1. How the www/nvu package came into pkgsrc 167 12.2.1. How the www/nvu package came into pkgsrc
171 168
172 13. Package components - files, directories and contents 169 13. Package components - files, directories and contents
173 170
174 13.1. Makefile 171 13.1. Makefile
175 13.2. distinfo 172 13.2. distinfo
176 13.3. patches/* 173 13.3. patches/*
177 174
178 13.3.1. Structure of a single patch file 175 13.3.1. Structure of a single patch file
179 13.3.2. Creating patch files 176 13.3.2. Creating patch files
180 13.3.3. Sources where the patch files come from 177 13.3.3. Sources where the patch files come from
181 13.3.4. Patching guidelines 178 13.3.4. Patching guidelines
182 13.3.5. Feedback to the author 179 13.3.5. Feedback to the author
183 180
184 13.4. Other mandatory files 181 13.4. Other mandatory files
185 13.5. Optional files 182 13.5. Optional files
186 183
187 13.5.1. Files affecting the binary package 184 13.5.1. Files affecting the binary package
188 13.5.2. Files affecting the build process 185 13.5.2. Files affecting the build process
189 13.5.3. Files affecting nothing at all 186 13.5.3. Files affecting nothing at all
190 187
191 13.6. work* 188 13.6. work*
192 13.7. files/* 189 13.7. files/*
193 190
194 14. Programming in Makefiles 191 14. Programming in Makefiles
195 192
196 14.1. Caveats 193 14.1. Caveats
197 14.2. Makefile variables 194 14.2. Makefile variables
198 195
199 14.2.1. Naming conventions 196 14.2.1. Naming conventions
200 197
201 14.3. Code snippets 198 14.3. Code snippets
202 199
203 14.3.1. Adding things to a list 200 14.3.1. Adding things to a list
204 14.3.2. Echoing a string exactly as-is 201 14.3.2. Echoing a string exactly as-is
205 14.3.3. Passing CFLAGS to GNU configure scripts 202 14.3.3. Passing CFLAGS to GNU configure scripts
206 14.3.4. Handling possibly empty variables 203 14.3.4. Handling possibly empty variables
207 204
208 15. PLIST issues 205 15. PLIST issues
209 206
210 15.1. RCS ID 207 15.1. RCS ID
211 15.2. Semi-automatic PLIST generation 208 15.2. Semi-automatic PLIST generation
212 15.3. Tweaking output of make print-PLIST 209 15.3. Tweaking output of make print-PLIST
213 15.4. Variable substitution in PLIST 210 15.4. Variable substitution in PLIST
214 15.5. Man page compression 211 15.5. Man page compression
215 15.6. Changing PLIST source with PLIST_SRC 212 15.6. Changing PLIST source with PLIST_SRC
216 15.7. Platform-specific and differing PLISTs 213 15.7. Platform-specific and differing PLISTs
217 15.8. Build-specific PLISTs 214 15.8. Build-specific PLISTs
218 15.9. Sharing directories between packages 215 15.9. Sharing directories between packages
219 216
220 16. Buildlink methodology 217 16. Buildlink methodology
221 218
222 16.1. Converting packages to use buildlink3 219 16.1. Converting packages to use buildlink3
223 16.2. Writing buildlink3.mk files 220 16.2. Writing buildlink3.mk files
224 221
225 16.2.1. Anatomy of a buildlink3.mk file 222 16.2.1. Anatomy of a buildlink3.mk file
226 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and 223 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
227 BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files 224 BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
228 225
229 16.3. Writing builtin.mk files 226 16.3. Writing builtin.mk files
230 227
231 16.3.1. Anatomy of a builtin.mk file 228 16.3.1. Anatomy of a builtin.mk file
232 16.3.2. Global preferences for native or pkgsrc software 229 16.3.2. Global preferences for native or pkgsrc software
233 230
234 17. The pkginstall framework 231 17. The pkginstall framework
235 232
236 17.1. Files and directories outside the installation prefix 233 17.1. Files and directories outside the installation prefix
237 234
238 17.1.1. Directory manipulation 235 17.1.1. Directory manipulation
239 17.1.2. File manipulation 236 17.1.2. File manipulation
240 237
241 17.2. Configuration files 238 17.2. Configuration files
242 239
243 17.2.1. How PKG_SYSCONFDIR is set 240 17.2.1. How PKG_SYSCONFDIR is set
244 17.2.2. Telling the software where configuration files are 241 17.2.2. Telling the software where configuration files are
245 17.2.3. Patching installations 242 17.2.3. Patching installations
246 17.2.4. Disabling handling of configuration files 243 17.2.4. Disabling handling of configuration files
247 244
248 17.3. System startup scripts 245 17.3. System startup scripts
249 246
250 17.3.1. Disabling handling of system startup scripts 247 17.3.1. Disabling handling of system startup scripts
251 248
252 17.4. System users and groups 249 17.4. System users and groups
253 17.5. System shells 250 17.5. System shells
254 251
255 17.5.1. Disabling shell registration 252 17.5.1. Disabling shell registration
256 253
257 17.6. Fonts 254 17.6. Fonts
258 255
259 17.6.1. Disabling automatic update of the fonts databases 256 17.6.1. Disabling automatic update of the fonts databases
260 257
261 18. Options handling 258 18. Options handling
262 259
263 18.1. Global default options 260 18.1. Global default options
264 18.2. Converting packages to use bsd.options.mk 261 18.2. Converting packages to use bsd.options.mk
265 18.3. Option Names 262 18.3. Option Names
266 18.4. Determining the options of dependencies 263 18.4. Determining the options of dependencies
267 264
268 19. The build process 265 19. The build process
269 266
270 19.1. Introduction 267 19.1. Introduction
271 19.2. Program location 268 19.2. Program location
272 19.3. Directories used during the build process 269 19.3. Directories used during the build process
273 19.4. Running a phase 270 19.4. Running a phase
274 19.5. The fetch phase 271 19.5. The fetch phase
275 272
276 19.5.1. What to fetch and where to get it from 273 19.5.1. What to fetch and where to get it from
277 19.5.2. How are the files fetched? 274 19.5.2. How are the files fetched?
278 275
279 19.6. The checksum phase 276 19.6. The checksum phase
280 19.7. The extract phase 277 19.7. The extract phase
281 19.8. The patch phase 278 19.8. The patch phase
282 19.9. The tools phase 279 19.9. The tools phase
283 19.10. The wrapper phase 280 19.10. The wrapper phase
284 19.11. The configure phase 281 19.11. The configure phase
285 19.12. The build phase 282 19.12. The build phase
286 19.13. The test phase 283 19.13. The test phase
287 19.14. The install phase 284 19.14. The install phase
288 19.15. The package phase 285 19.15. The package phase
289 19.16. Cleaning up 286 19.16. Cleaning up
290 19.17. Other helpful targets 287 19.17. Other helpful targets
291 288
292 20. Tools needed for building or running 289 20. Tools needed for building or running
293 290
294 20.1. Tools for pkgsrc builds 291 20.1. Tools for pkgsrc builds
295 20.2. Tools needed by packages 292 20.2. Tools needed by packages
296 20.3. Tools provided by platforms 293 20.3. Tools provided by platforms
297 294
298 21. Making your package work 295 21. Making your package work
299 296
300 21.1. General operation 297 21.1. General operation
301 298
302 21.1.1. How to pull in user-settable variables from mk.conf 299 21.1.1. How to pull in user-settable variables from mk.conf
303 21.1.2. User interaction 300 21.1.2. User interaction
304 21.1.3. Handling licenses 301 21.1.3. Handling licenses
305 21.1.4. Restricted packages 302 21.1.4. Restricted packages
306 21.1.5. Handling dependencies 303 21.1.5. Handling dependencies
307 21.1.6. Handling conflicts with other packages 304 21.1.6. Handling conflicts with other packages
308 21.1.7. Packages that cannot or should not be built 305 21.1.7. Packages that cannot or should not be built
309 21.1.8. Packages which should not be deleted, once installed 306 21.1.8. Packages which should not be deleted, once installed
310 21.1.9. Handling packages with security problems 307 21.1.9. Handling packages with security problems
311 21.1.10. How to handle incrementing versions when fixing an 308 21.1.10. How to handle incrementing versions when fixing an
312 existing package 309 existing package
313 21.1.11. Substituting variable text in the package files (the SUBST 310 21.1.11. Substituting variable text in the package files (the SUBST
314 framework) 311 framework)
315 312
316 21.2. The fetch phase 313 21.2. The fetch phase
317 314
318 21.2.1. Packages whose distfiles aren't available for plain 315 21.2.1. Packages whose distfiles aren't available for plain
319 downloading 316 downloading
320 21.2.2. How to handle modified distfiles with the 'old' name 317 21.2.2. How to handle modified distfiles with the 'old' name
321 21.2.3. Packages hosted on github.com 318 21.2.3. Packages hosted on github.com
322 319
323 21.3. The configure phase 320 21.3. The configure phase
324 321
325 21.3.1. Shared libraries - libtool 322 21.3.1. Shared libraries - libtool
326 21.3.2. Using libtool on GNU packages that already support libtool 323 21.3.2. Using libtool on GNU packages that already support libtool
327 21.3.3. GNU Autoconf/Automake 324 21.3.3. GNU Autoconf/Automake
328 325
329 21.4. Programming languages 326 21.4. Programming languages
330 327
331 21.4.1. C, C++, and Fortran 328 21.4.1. C, C++, and Fortran
332 21.4.2. Java 329 21.4.2. Java
333 21.4.3. Packages containing perl scripts 330 21.4.3. Packages containing perl scripts
334 21.4.4. Packages containing shell scripts 331 21.4.4. Packages containing shell scripts
335 21.4.5. Other programming languages 332 21.4.5. Other programming languages
336 333
337 21.5. The build phase 334 21.5. The build phase
338 335
339 21.5.1. Compiling C and C++ code conditionally 336 21.5.1. Compiling C and C++ code conditionally
340 21.5.2. How to handle compiler bugs 337 21.5.2. How to handle compiler bugs
341 21.5.3. No such file or directory 338 21.5.3. No such file or directory
342 21.5.4. Undefined reference to "..." 339 21.5.4. Undefined reference to "..."
343 21.5.5. Running out of memory 340 21.5.5. Running out of memory
344 341
345 21.6. The install phase 342 21.6. The install phase
346 343
347 21.6.1. Creating needed directories 344 21.6.1. Creating needed directories
348 21.6.2. Where to install documentation 345 21.6.2. Where to install documentation
349 21.6.3. Installing highscore files 346 21.6.3. Installing highscore files
350 21.6.4. Adding DESTDIR support to packages 347 21.6.4. Adding DESTDIR support to packages
351 21.6.5. Packages with hardcoded paths to other interpreters 348 21.6.5. Packages with hardcoded paths to other interpreters
352 21.6.6. Packages installing perl modules 349 21.6.6. Packages installing perl modules
353 21.6.7. Packages installing info files 350 21.6.7. Packages installing info files
354 21.6.8. Packages installing man pages 351 21.6.8. Packages installing man pages
355 21.6.9. Packages installing GConf data files 352 21.6.9. Packages installing GConf data files
356 21.6.10. Packages installing scrollkeeper/rarian data files 353 21.6.10. Packages installing scrollkeeper/rarian data files
357 21.6.11. Packages installing X11 fonts 354 21.6.11. Packages installing X11 fonts
358 21.6.12. Packages installing GTK2 modules 355 21.6.12. Packages installing GTK2 modules
359 21.6.13. Packages installing SGML or XML data 356 21.6.13. Packages installing SGML or XML data
360 21.6.14. Packages installing extensions to the MIME database 357 21.6.14. Packages installing extensions to the MIME database
361 21.6.15. Packages using intltool 358 21.6.15. Packages using intltool
362 21.6.16. Packages installing startup scripts 359 21.6.16. Packages installing startup scripts
363 21.6.17. Packages installing TeX modules 360 21.6.17. Packages installing TeX modules
364 21.6.18. Packages supporting running binaries in emulation 361 21.6.18. Packages supporting running binaries in emulation
365 21.6.19. Packages installing hicolor theme icons 362 21.6.19. Packages installing hicolor theme icons
366 21.6.20. Packages installing desktop files 363 21.6.20. Packages installing desktop files
367 364
368 21.7. Marking packages as having problems 365 21.7. Marking packages as having problems
369 366
370 22. Debugging 367 22. Debugging
371 23. Submitting and Committing 368 23. Submitting and Committing
372 369
373 23.1. Submitting binary packages 370 23.1. Submitting binary packages
374 23.2. Submitting source packages (for non-NetBSD-developers) 371 23.2. Submitting source packages (for non-NetBSD-developers)
375 23.3. General notes when adding, updating, or removing packages 372 23.3. General notes when adding, updating, or removing packages
376 23.4. Commit Messages 373 23.4. Commit Messages
377 23.5. Committing: Adding a package to CVS 374 23.5. Committing: Adding a package to CVS
378 23.6. Updating a package to a newer version 375 23.6. Updating a package to a newer version
379 23.7. Renaming a package in pkgsrc 376 23.7. Renaming a package in pkgsrc
380 23.8. Moving a package in pkgsrc 377 23.8. Moving a package in pkgsrc
381 378
382 24. Frequently Asked Questions 379 24. Frequently Asked Questions
383 25. GNOME packaging and porting 380 25. GNOME packaging and porting
384 381
385 25.1. Meta packages 382 25.1. Meta packages
386 25.2. Packaging a GNOME application 383 25.2. Packaging a GNOME application
387 25.3. Updating GNOME to a newer version 384 25.3. Updating GNOME to a newer version
388 25.4. Patching guidelines 385 25.4. Patching guidelines
389 386
390III. The pkgsrc infrastructure internals 387III. The pkgsrc infrastructure internals
391 388
392 26. Design of the pkgsrc infrastructure 389 26. Design of the pkgsrc infrastructure
393 390
394 26.1. The meaning of variable definitions 391 26.1. The meaning of variable definitions
395 26.2. Avoiding problems before they arise 392 26.2. Avoiding problems before they arise
396 26.3. Variable evaluation 393 26.3. Variable evaluation
397 394
398 26.3.1. At load time 395 26.3.1. At load time
399 26.3.2. At runtime 396 26.3.2. At runtime
400 397
401 26.4. How can variables be specified? 398 26.4. How can variables be specified?
402 26.5. Designing interfaces for Makefile fragments 399 26.5. Designing interfaces for Makefile fragments
403 400
404 26.5.1. Procedures with parameters 401 26.5.1. Procedures with parameters
405 26.5.2. Actions taken on behalf of parameters 402 26.5.2. Actions taken on behalf of parameters
406 403
407 26.6. The order in which files are loaded 404 26.6. The order in which files are loaded
408 405
409 26.6.1. The order in bsd.prefs.mk 406 26.6.1. The order in bsd.prefs.mk
410 26.6.2. The order in bsd.pkg.mk 407 26.6.2. The order in bsd.pkg.mk
411 408
412 27. Regression tests 409 27. Regression tests
413 410
414 27.1. Running the regression tests 411 27.1. Running the regression tests
415 27.2. Adding a new regression test 412 27.2. Adding a new regression test
416 413
417 27.2.1. Overridable functions 414 27.2.1. Overridable functions
418 27.2.2. Helper functions 415 27.2.2. Helper functions
419 416
420 28. Porting pkgsrc 417 28. Porting pkgsrc
421 418
422 28.1. Porting pkgsrc to a new operating system 419 28.1. Porting pkgsrc to a new operating system
423 420
424A. A simple example package: bison 421A. A simple example package: bison
425 422
426 A.1. files 423 A.1. files
427 424
428 A.1.1. Makefile 425 A.1.1. Makefile
429 A.1.2. DESCR 426 A.1.2. DESCR
430 A.1.3. PLIST 427 A.1.3. PLIST
431 A.1.4. Checking a package with pkglint 428 A.1.4. Checking a package with pkglint
432 429
433 A.2. Steps for building, installing, packaging 430 A.2. Steps for building, installing, packaging
434 431
435B. Build logs 432B. Build logs
436 433
437 B.1. Building figlet 434 B.1. Building figlet
438 B.2. Packaging figlet 435 B.2. Packaging figlet
439 436
440C. Directory layout of the pkgsrc FTP server 437C. Directory layout of the pkgsrc FTP server
441 438
442 C.1. distfiles: The distributed source files 439 C.1. distfiles: The distributed source files
443 C.2. misc: Miscellaneous things 440 C.2. misc: Miscellaneous things
444 C.3. packages: Binary packages 441 C.3. packages: Binary packages
445 C.4. reports: Bulk build reports 442 C.4. reports: Bulk build reports
446 C.5. current, stable, pkgsrc-20xxQy: source packages 443 C.5. current, stable, pkgsrc-20xxQy: source packages
447 444
448D. Help topics 445D. Help topics
449E. Editing guidelines for the pkgsrc guide 446E. Editing guidelines for the pkgsrc guide
450 447
451 E.1. Make targets 448 E.1. Make targets
452 E.2. Procedure 449 E.2. Procedure
453 450
454List of Tables 451List of Tables
455 452
4561.1. Platforms supported by pkgsrc 4531.1. Platforms supported by pkgsrc
45713.1. Patching examples 45413.1. Patching examples
45825.1. PLIST handling for GNOME packages 45525.1. PLIST handling for GNOME packages
459 456
460Chapter 1. What is pkgsrc? 457Chapter 1. What is pkgsrc?
461 458
462Table of Contents 459Table of Contents
463 460
4641.1. Introduction 4611.1. Introduction
465 462
466 1.1.1. Why pkgsrc? 463 1.1.1. Why pkgsrc?
467 1.1.2. Supported platforms 464 1.1.2. Supported platforms
468 465
4691.2. Overview 4661.2. Overview
4701.3. Terminology 4671.3. Terminology
471 468
472 1.3.1. Roles involved in pkgsrc 469 1.3.1. Roles involved in pkgsrc
473 470
4741.4. Typography 4711.4. Typography
475 472
4761.1. Introduction 4731.1. Introduction
477 474
478There is a lot of software freely available for Unix-based systems, which is 475There is a lot of software freely available for Unix-based systems, which is
479usually available in form of the source code. Before such software can be used, 476usually available in form of the source code. Before such software can be used,
480it needs to be configured to the local system, compiled and installed, and this 477it needs to be configured to the local system, compiled and installed, and this
481is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has 478is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
482some basic commands to handle binary packages, so that not every user has to 479some basic commands to handle binary packages, so that not every user has to
483build the packages for himself, which is a time-costly task. 480build the packages for himself, which is a time-costly task.
484 481
485pkgsrc currently contains several thousand packages, including: 482pkgsrc currently contains several thousand packages, including:
486 483
487 * www/apache24 - The Apache web server 484 * www/apache24 - The Apache web server
488 485
489 * www/firefox - The Firefox web browser 486 * www/firefox - The Firefox web browser
490 487
491 * meta-pkgs/gnome - The GNOME Desktop Environment 488 * meta-pkgs/gnome - The GNOME Desktop Environment
492 489
493 * meta-pkgs/kde4 - The K Desktop Environment 490 * meta-pkgs/kde4 - The K Desktop Environment
494 491
495? just to name a few. 492? just to name a few.
496 493
497pkgsrc has built-in support for handling varying dependencies, such as pthreads 494pkgsrc has built-in support for handling varying dependencies, such as pthreads
498and X11, and extended features such as IPv6 support on a range of platforms. 495and X11, and extended features such as IPv6 support on a range of platforms.
499 496
5001.1.1. Why pkgsrc? 4971.1.1. Why pkgsrc?
501 498
502pkgsrc provides the following key features: 499pkgsrc provides the following key features:
503 500
504 * Easy building of software from source as well as the creation and 501 * Easy building of software from source as well as the creation and
505 installation of binary packages. The source and latest patches are 502 installation of binary packages. The source and latest patches are
506 retrieved from a master or mirror download site, checksum verified, then 503 retrieved from a master or mirror download site, checksum verified, then
507 built on your system. Support for binary-only distributions is available 504 built on your system. Support for binary-only distributions is available
508 for both native platforms and NetBSD emulated platforms. 505 for both native platforms and NetBSD emulated platforms.
509 506
510 * All packages are installed in a consistent directory tree, including 507 * All packages are installed in a consistent directory tree, including
511 binaries, libraries, man pages and other documentation. 508 binaries, libraries, man pages and other documentation.
512 509
513 * Tracking of package dependencies automatically, including when performing 510 * Tracking of package dependencies automatically, including when performing
514 updates, to ensure required packages are installed. The configuration files 511 updates, to ensure required packages are installed. The configuration files
515 of various packages are handled automatically during updates, so local 512 of various packages are handled automatically during updates, so local
516 changes are preserved. 513 changes are preserved.
517 514
518 * Like NetBSD, pkgsrc is designed with portability in mind and consists of 515 * Like NetBSD, pkgsrc is designed with portability in mind and consists of
519 highly portable code. This allows the greatest speed of development when 516 highly portable code. This allows the greatest speed of development when
520 porting to a new platform. This portability also ensures that pkgsrc is  517 porting to a new platform. This portability also ensures that pkgsrc is
521 consistent across all platforms. 518 consistent across all platforms.
522 519
523 * The installation prefix, acceptable software licenses, international 520 * The installation prefix, acceptable software licenses, international
524 encryption requirements and build-time options for a large number of 521 encryption requirements and build-time options for a large number of
525 packages are all set in a simple, central configuration file. 522 packages are all set in a simple, central configuration file.
526 523
527 * The entire source (not including the distribution files) is freely 524 * The entire source (not including the distribution files) is freely
528 available under a BSD license, so you may extend and adapt pkgsrc to your 525 available under a BSD license, so you may extend and adapt pkgsrc to your
529 needs. Support for local packages and patches is available right out of the 526 needs. Support for local packages and patches is available right out of the
530 box, so you can configure it specifically for your environment. 527 box, so you can configure it specifically for your environment.
531 528
532The following principles are basic to pkgsrc: 529The following principles are basic to pkgsrc:
533 530
534 * "It should only work if it's right." ? That means, if a package contains 531 * "It should only work if it's right." ? That means, if a package contains
535 bugs, it's better to find them and to complain about them rather than to 532 bugs, it's better to find them and to complain about them rather than to
536 just install the package and hope that it works. There are numerous checks 533 just install the package and hope that it works. There are numerous checks
537 in pkgsrc that try to find such bugs: static analysis tools (pkgtools/ 534 in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
538 pkglint), build-time checks (portability of shell scripts), and 535 pkglint), build-time checks (portability of shell scripts), and
539 post-installation checks (installed files, references to shared libraries, 536 post-installation checks (installed files, references to shared libraries,
540 script interpreters). 537 script interpreters).
541 538
542 * "If it works, it should work everywhere" ? Like NetBSD has been ported to 539 * "If it works, it should work everywhere" ? Like NetBSD has been ported to
543 many hardware architectures, pkgsrc has been ported to many operating 540 many hardware architectures, pkgsrc has been ported to many operating
544 systems. Care is taken that packages behave the same on all platforms. 541 systems. Care is taken that packages behave the same on all platforms.
545 542
5461.1.2. Supported platforms 5431.1.2. Supported platforms
547 544
548pkgsrc consists of both a source distribution and a binary distribution for 545pkgsrc consists of both a source distribution and a binary distribution for
549these operating systems. After retrieving the required source or binaries, you 546these operating systems. After retrieving the required source or binaries, you
550can be up and running with pkgsrc in just minutes! 547can be up and running with pkgsrc in just minutes!
551 548
552pkgsrc was derived from FreeBSD's ports system, and initially developed for 549pkgsrc was derived from FreeBSD's ports system, and initially developed for
553NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following 550NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
554platforms: 551platforms:
555 552
556Table 1.1. Platforms supported by pkgsrc 553Table 1.1. Platforms supported by pkgsrc
557 554
558+-----------------------------------------------------------------------------+ 555+-----------------------------------------------------------------------------+
559| Platform | Date Support | Notes | 556| Platform | Date Support | Notes |
560| | Added | | 557| | Added | |
561|--------------------------------------+---------------+----------------------| 558|--------------------------------------+---------------+----------------------|
562|NetBSD | Aug 1997 | | 559|NetBSD | Aug 1997 | |
563|--------------------------------------+---------------+----------------------| 560|--------------------------------------+---------------+----------------------|
564|Solaris | Mar 1999 |README.Solaris | 561|Solaris | Mar 1999 |README.Solaris |
565|--------------------------------------+---------------+----------------------| 562|--------------------------------------+---------------+----------------------|
566|Linux | Jun 1999 |README.Linux | 563|Linux | Jun 1999 |README.Linux |
567|--------------------------------------+---------------+----------------------| 564|--------------------------------------+---------------+----------------------|
568|Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.MacOSX | 565|Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.MacOSX |
569|--------------------------------------+---------------+----------------------| 566|--------------------------------------+---------------+----------------------|
570|FreeBSD | Nov 2002 |README.FreeBSD | 567|FreeBSD | Nov 2002 |README.FreeBSD |
571|--------------------------------------+---------------+----------------------| 568|--------------------------------------+---------------+----------------------|
572|OpenBSD | Nov 2002 |README.OpenBSD | 569|OpenBSD | Nov 2002 |README.OpenBSD |
573|--------------------------------------+---------------+----------------------| 570|--------------------------------------+---------------+----------------------|
574|IRIX | Dec 2002 |README.IRIX | 571|IRIX | Dec 2002 |README.IRIX |
575| | |README.IRIX5.3 | 572| | |README.IRIX5.3 |
576|--------------------------------------+---------------+----------------------| 573|--------------------------------------+---------------+----------------------|
577|BSD/OS | Dec 2003 | | 574|BSD/OS | Dec 2003 | |
578|--------------------------------------+---------------+----------------------| 575|--------------------------------------+---------------+----------------------|
579|AIX | Dec 2003 |README.AIX | 576|AIX | Dec 2003 |README.AIX |
580|--------------------------------------+---------------+----------------------| 577|--------------------------------------+---------------+----------------------|
581|Interix (Microsoft Windows Services | Mar 2004 |README.Interix | 578|Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
582|for Unix) | | | 579|for Unix) | | |
583|--------------------------------------+---------------+----------------------| 580|--------------------------------------+---------------+----------------------|
584|DragonFlyBSD | Oct 2004 | | 581|DragonFlyBSD | Oct 2004 | |
585|--------------------------------------+---------------+----------------------| 582|--------------------------------------+---------------+----------------------|
586|OSF/1 | Nov 2004 |README.OSF1 | 583|OSF/1 | Nov 2004 |README.OSF1 |
587|--------------------------------------+---------------+----------------------| 584|--------------------------------------+---------------+----------------------|
588|HP-UX | Apr 2007 |README.HPUX | 585|HP-UX | Apr 2007 |README.HPUX |
589|--------------------------------------+---------------+----------------------| 586|--------------------------------------+---------------+----------------------|
590|Haiku | Sep 2010 |README.Haiku | 587|Haiku | Sep 2010 |README.Haiku |
591|--------------------------------------+---------------+----------------------| 588|--------------------------------------+---------------+----------------------|
592|MirBSD | Jan 2011 | | 589|MirBSD | Jan 2011 | |
593|--------------------------------------+---------------+----------------------| 590|--------------------------------------+---------------+----------------------|
594|Minix3 | Nov 2011 |README.Minix3 | 591|Minix3 | Nov 2011 |README.Minix3 |
595|--------------------------------------+---------------+----------------------| 592|--------------------------------------+---------------+----------------------|
596|Cygwin | Mar 2013 |README.Cygwin | 593|Cygwin | Mar 2013 |README.Cygwin |
597|--------------------------------------+---------------+----------------------| 594|--------------------------------------+---------------+----------------------|
598|GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD | 595|GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
599|--------------------------------------+---------------+----------------------| 596|--------------------------------------+---------------+----------------------|
600|Bitrig | Jun 2014 |README.Bitrig | 597|Bitrig | Jun 2014 |README.Bitrig |
601+-----------------------------------------------------------------------------+ 598+-----------------------------------------------------------------------------+
602 599
603 600
6041.2. Overview 6011.2. Overview
605 602
606This document is divided into three parts. The first, The pkgsrc user's guide, 603This document is divided into three parts. The first, The pkgsrc user's guide,
607describes how one can use one of the packages in the Package Collection, either 604describes how one can use one of the packages in the Package Collection, either
608by installing a precompiled binary package, or by building one's own copy using 605by installing a precompiled binary package, or by building one's own copy using
609the NetBSD package system. The second part, The pkgsrc developer's guide, 606the NetBSD package system. The second part, The pkgsrc developer's guide,
610explains how to prepare a package so it can be easily built by other NetBSD 607explains how to prepare a package so it can be easily built by other NetBSD
611users without knowing about the package's building details. The third part, The 608users without knowing about the package's building details. The third part, The
612pkgsrc infrastructure internals is intended for those who want to understand 609pkgsrc infrastructure internals is intended for those who want to understand
613how pkgsrc is implemented. 610how pkgsrc is implemented.
614 611
615This document is available in various formats: HTML, PDF, PS, TXT. 612This document is available in various formats: HTML, PDF, PS, TXT.
616 613
6171.3. Terminology 6141.3. Terminology
618 615
619There has been a lot of talk about "ports", "packages", etc. so far. Here is a 616There has been a lot of talk about "ports", "packages", etc. so far. Here is a
620description of all the terminology used within this document. 617description of all the terminology used within this document.
621 618
622Package 619Package
623 620
624 A set of files and building instructions that describe what's necessary to 621 A set of files and building instructions that describe what's necessary to
625 build a certain piece of software using pkgsrc. Packages are traditionally 622 build a certain piece of software using pkgsrc. Packages are traditionally
626 stored under /usr/pkgsrc, but may be stored in any location, referred to as 623 stored under /usr/pkgsrc, but may be stored in any location, referred to as
627 PKGSRCDIR. 624 PKGSRCDIR.
628 625
629The NetBSD package system 626The NetBSD package system
630 627
631 This is the former name of "pkgsrc". It is part of the NetBSD operating 628 This is the former name of "pkgsrc". It is part of the NetBSD operating
632 system and can be bootstrapped to run on non-NetBSD operating systems as 629 system and can be bootstrapped to run on non-NetBSD operating systems as
633 well. It handles building (compiling), installing, and removing of 630 well. It handles building (compiling), installing, and removing of
634 packages. 631 packages.
635 632
636Distfile 633Distfile
637 634
638 This term describes the file or files that are provided by the author of 635 This term describes the file or files that are provided by the author of
639 the piece of software to distribute his work. All the changes necessary to 636 the piece of software to distribute his work. All the changes necessary to
640 build on NetBSD are reflected in the corresponding package. Usually the 637 build on NetBSD are reflected in the corresponding package. Usually the
641 distfile is in the form of a compressed tar-archive, but other types are 638 distfile is in the form of a compressed tar-archive, but other types are
642 possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles. 639 possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
643 640
644Port 641Port
645 642
646 This is the term used by FreeBSD and OpenBSD people for what we call a 643 This is the term used by FreeBSD and OpenBSD people for what we call a
647 package. In NetBSD terminology, "port" refers to a different architecture. 644 package. In NetBSD terminology, "port" refers to a different architecture.
648 645
649Precompiled/binary package 646Precompiled/binary package
650 647
651 A set of binaries built with pkgsrc from a distfile and stuffed together in 648 A set of binaries built with pkgsrc from a distfile and stuffed together in
652 a single .tgz file so it can be installed on machines of the same machine 649 a single .tgz file so it can be installed on machines of the same machine
653 architecture without the need to recompile. Packages are usually generated 650 architecture without the need to recompile. Packages are usually generated
654 in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org. 651 in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
655 652
656 Sometimes, this is referred to by the term "package" too, especially in the 653 Sometimes, this is referred to by the term "package" too, especially in the
657 context of precompiled packages. 654 context of precompiled packages.
658 655
659Program 656Program
660 657
661 The piece of software to be installed which will be constructed from all 658 The piece of software to be installed which will be constructed from all
662 the files in the distfile by the actions defined in the corresponding 659 the files in the distfile by the actions defined in the corresponding
663 package. 660 package.
664 661
6651.3.1. Roles involved in pkgsrc 6621.3.1. Roles involved in pkgsrc
666 663
667pkgsrc users 664pkgsrc users
668 665
669 The pkgsrc users are people who use the packages provided by pkgsrc. 666 The pkgsrc users are people who use the packages provided by pkgsrc.
670 Typically they are system administrators. The people using the software 667 Typically they are system administrators. The people using the software
671 that is inside the packages (maybe called "end users") are not covered by 668 that is inside the packages (maybe called "end users") are not covered by
672 the pkgsrc guide. 669 the pkgsrc guide.
673 670
674 There are two kinds of pkgsrc users: Some only want to install pre-built 671 There are two kinds of pkgsrc users: Some only want to install pre-built
675 binary packages. Others build the pkgsrc packages from source, either for 672 binary packages. Others build the pkgsrc packages from source, either for
676 installing them directly or for building binary packages themselves. For 673 installing them directly or for building binary packages themselves. For
677 pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary 674 pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
678 documentation. 675 documentation.
679 676
680package maintainers 677package maintainers
681 678
682 A package maintainer creates packages as described in Part II, "The pkgsrc 679 A package maintainer creates packages as described in Part II, "The pkgsrc
683 developer's guide". 680 developer's guide".
684 681
685infrastructure developers 682infrastructure developers
686 683
687 These people are involved in all those files that live in the mk/ directory 684 These people are involved in all those files that live in the mk/ directory
688 and below. Only these people should need to read through Part III, "The 685 and below. Only these people should need to read through Part III, "The
689 pkgsrc infrastructure internals", though others might be curious, too. 686 pkgsrc infrastructure internals", though others might be curious, too.
690 687
6911.4. Typography 6881.4. Typography
692 689
693When giving examples for commands, shell prompts are used to show if the 690When giving examples for commands, shell prompts are used to show if the
694command should/can be issued as root, or if "normal" user privileges are 691command should/can be issued as root, or if "normal" user privileges are
695sufficient. We use a # for root's shell prompt, a % for users' shell prompt, 692sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
696assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives. 693assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
697 694
698Part I. The pkgsrc user's guide 695Part I. The pkgsrc user's guide
699 696
700Table of Contents 697Table of Contents
701 698
7022. Getting help 6992. Getting help
7033. Where to get pkgsrc and how to keep it up-to-date 7003. Where to get pkgsrc and how to keep it up-to-date
704 701
705 3.1. Getting pkgsrc for the first time 702 3.1. Getting pkgsrc for the first time
706 703
707 3.1.1. As tar archive 704 3.1.1. As tar archive
708 3.1.2. Via anonymous CVS 705 3.1.2. Via anonymous CVS
709 706
710 3.2. Keeping pkgsrc up-to-date 707 3.2. Keeping pkgsrc up-to-date
711 708
712 3.2.1. Via tar files 709 3.2.1. Via tar files
713 3.2.2. Via CVS 710 3.2.2. Via CVS
714 711
7154. Using pkgsrc on systems other than NetBSD 7124. Using pkgsrc on systems other than NetBSD
716 713
717 4.1. Binary distribution 714 4.1. Binary distribution
718 4.2. Bootstrapping pkgsrc 715 4.2. Bootstrapping pkgsrc
719 716
7205. Using pkgsrc 7175. Using pkgsrc
721 718
722 5.1. Using binary packages 719 5.1. Using binary packages
723 720
724 5.1.1. Finding binary packages 721 5.1.1. Finding binary packages
725 5.1.2. Installing binary packages 722 5.1.2. Installing binary packages
726 5.1.3. Deinstalling packages 723 5.1.3. Deinstalling packages
727 5.1.4. Getting information about installed packages 724 5.1.4. Getting information about installed packages
728 5.1.5. Checking for security vulnerabilities in installed packages 725 5.1.5. Checking for security vulnerabilities in installed packages
729 5.1.6. Finding if newer versions of your installed packages are in 726 5.1.6. Finding if newer versions of your installed packages are in
730 pkgsrc 727 pkgsrc
731 5.1.7. Other administrative functions 728 5.1.7. Other administrative functions
732 729
733 5.2. Building packages from source 730 5.2. Building packages from source
734 731
735 5.2.1. Requirements 732 5.2.1. Requirements
736 5.2.2. Fetching distfiles 733 5.2.2. Fetching distfiles
737 5.2.3. How to build and install 734 5.2.3. How to build and install
738 735
7396. Configuring pkgsrc 7366. Configuring pkgsrc
740 737
741 6.1. General configuration 738 6.1. General configuration
742 6.2. Variables affecting the build process 739 6.2. Variables affecting the build process
743 6.3. Variables affecting the installation process 740 6.3. Variables affecting the installation process
744 6.4. Selecting and configuring the compiler 741 6.4. Selecting and configuring the compiler
745 742
746 6.4.1. Selecting the compiler 743 6.4.1. Selecting the compiler
747 6.4.2. Additional flags to the compiler (CFLAGS) 744 6.4.2. Additional flags to the compiler (CFLAGS)
748 6.4.3. Additional flags to the linker (LDFLAGS) 745 6.4.3. Additional flags to the linker (LDFLAGS)
749 746
750 6.5. Developer/advanced settings 747 6.5. Developer/advanced settings
751 6.6. Selecting Build Options 748 6.6. Selecting Build Options
752 749
7537. Creating binary packages 7507. Creating binary packages
754 751
755 7.1. Building a single binary package 752 7.1. Building a single binary package
756 7.2. Settings for creation of binary packages 753 7.2. Settings for creation of binary packages
757 754
7588. Creating binary packages for everything in pkgsrc (bulk builds) 7558. Creating binary packages for everything in pkgsrc (bulk builds)
759 756
760 8.1. Preparations 757 8.1. Preparations
761 8.2. Running a pbulk-style bulk build 758 8.2. Running a pbulk-style bulk build
762 759
763 8.2.1. Configuration 760 8.2.1. Configuration
764 761
765 8.3. Requirements of a full bulk build 762 8.3. Requirements of a full bulk build
766 8.4. Bulk build variants 763 8.4. Bulk build variants
767 764
768 8.4.1. Strict SUBST blocks 765 8.4.1. Detect unknown configure options
769 8.4.2. Detect unknown configure options 766 8.4.2. Detect classes of bugs by forcing compiler warnings
770 8.4.3. Detect classes of bugs by forcing compiler warnings 767 8.4.3. Use custom directories
771 8.4.4. Use custom directories 768 8.4.4. Turn warnings into errors
772 8.4.5. Turn warnings into errors 769 8.4.5. Reject packages for which pkglint reports errors
773 8.4.6. Reject packages for which pkglint reports errors 770 8.4.6. Reject packages that contain forbidden strings
774 8.4.7. Reject packages that contain forbidden strings 771 8.4.7. Reject packages whose self-test fails
775 8.4.8. Reject packages whose self-test fails 772 8.4.8. Reject packages that use undefined shell variables
776 8.4.9. Reject packages that use undefined shell variables 773 8.4.9. Turn off verbose logging
777 8.4.10. Turn off verbose logging 
778 8.4.11. Select random sets of options 
779 8.4.12. Select random configurations of BUILD_DEFS 
780 774
781 8.5. Creating a multiple CD-ROM packages collection 775 8.5. Creating a multiple CD-ROM packages collection
782 776
783 8.5.1. Example of cdpack 777 8.5.1. Example of cdpack
784 778
7859. Directory layout of the installed files 7799. Directory layout of the installed files
786 780
787 9.1. File system layout in ${LOCALBASE} 781 9.1. File system layout in ${LOCALBASE}
788 9.2. File system layout in ${VARBASE} 782 9.2. File system layout in ${VARBASE}
789 783
79010. Frequently Asked Questions 78410. Frequently Asked Questions
791 785
792 10.1. Are there any mailing lists for pkg-related discussion? 786 10.1. Are there any mailing lists for pkg-related discussion?
793 10.2. Utilities for package management (pkgtools) 787 10.2. Utilities for package management (pkgtools)
794 10.3. How to use pkgsrc as non-root 788 10.3. How to use pkgsrc as non-root
795 10.4. How to resume transfers when fetching distfiles? 789 10.4. How to resume transfers when fetching distfiles?
796 10.5. How can I install/use modular X.org from pkgsrc? 790 10.5. How can I install/use modular X.org from pkgsrc?
797 10.6. How to fetch files from behind a firewall 791 10.6. How to fetch files from behind a firewall
798 10.7. How to fetch files from HTTPS sites 792 10.7. How to fetch files from HTTPS sites
799 10.8. How do I tell make fetch to do passive FTP? 793 10.8. How do I tell make fetch to do passive FTP?
800 10.9. How to fetch all distfiles at once 794 10.9. How to fetch all distfiles at once
801 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean? 795 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
802 10.11. What does "Could not find bsd.own.mk" mean? 796 10.11. What does "Could not find bsd.own.mk" mean?
803 10.12. Using 'sudo' with pkgsrc 797 10.12. Using 'sudo' with pkgsrc
804 10.13. How do I change the location of configuration files? 798 10.13. How do I change the location of configuration files?
805 10.14. Automated security checks 799 10.14. Automated security checks
806 10.15. Why do some packages ignore my CFLAGS? 800 10.15. Why do some packages ignore my CFLAGS?
807 10.16. A package does not build. What shall I do? 801 10.16. A package does not build. What shall I do?
808 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge 802 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
809 conflicts" mean? 803 conflicts" mean?
810 804
811Chapter 2. Getting help 805Chapter 2. Getting help
812 806
813To get help when using pkgsrc, the definitive source is this document, the 807To get help when using pkgsrc, the definitive source is this document, the
814pkgsrc guide. If you don't find anything here, there are alternatives: 808pkgsrc guide. If you don't find anything here, there are alternatives:
815 809
816 * The built-in pkgsrc help, which is available after bootstrapping pkgsrc. 810 * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
817 Run bmake help topic=? to get help for any topic, such as a variable name 811 Run bmake help topic=? to get help for any topic, such as a variable name
818 like BUILD_DEFS, a make target like do-build, a missing C or C++ function 812 like BUILD_DEFS, a make target like do-build, a missing C or C++ function
819 like strcasecmp or any other topic. 813 like strcasecmp or any other topic.
820 814
821 The available help topics are listed in Appendix D, Help topics. 815 The available help topics are listed in Appendix D, Help topics.
822 816
823 * To see the value of a single variable, run bmake show-var VARNAME=X. 817 * To see the value of a single variable, run bmake show-var VARNAME=X.
824 818
825 * To see the values of the most common variables, run bmake show-all. These 819 * To see the values of the most common variables, run bmake show-all. These
826 variables are grouped by topic. To see the variables for a single topic, 820 variables are grouped by topic. To see the variables for a single topic,
827 run bmake show-all-topic, for example bmake show-all-fetch. 821 run bmake show-all-topic, for example bmake show-all-fetch.
828 822
829 * The pkgsrc-users mailing list, to which you can subscribe and then ask your 823 * The pkgsrc-users mailing list, to which you can subscribe and then ask your
830 questions. 824 questions.
831 825
832 * The #pkgsrc IRC channel, which is accessible via a web browser or by using 826 * The #pkgsrc IRC channel, which is accessible via a web browser or by using
833 a specialized chat program such as XChat. Pick any user name and join the 827 a specialized chat program such as XChat. Pick any user name and join the
834 channel #pkgsrc. 828 channel #pkgsrc.
835 829
836Chapter 3. Where to get pkgsrc and how to keep it up-to-date 830Chapter 3. Where to get pkgsrc and how to keep it up-to-date
837 831
838Table of Contents 832Table of Contents
839 833
8403.1. Getting pkgsrc for the first time 8343.1. Getting pkgsrc for the first time
841 835
842 3.1.1. As tar archive 836 3.1.1. As tar archive
843 3.1.2. Via anonymous CVS 837 3.1.2. Via anonymous CVS
844 838
8453.2. Keeping pkgsrc up-to-date 8393.2. Keeping pkgsrc up-to-date
846 840
847 3.2.1. Via tar files 841 3.2.1. Via tar files
848 3.2.2. Via CVS 842 3.2.2. Via CVS
849 843
850Before you download and extract the files, you need to decide where you want to 844Before you download and extract the files, you need to decide where you want to
851extract them. When using pkgsrc as root user, pkgsrc is usually installed in / 845extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
852usr/pkgsrc. You are though free to install the sources and binary packages 846usr/pkgsrc. You are though free to install the sources and binary packages
853wherever you want in your filesystem, provided that the pathname does not 847wherever you want in your filesystem, provided that the pathname does not
854contain white-space or other characters that are interpreted specially by the 848contain white-space or other characters that are interpreted specially by the
855shell and some other programs. A safe bet is to use only letters, digits, 849shell and some other programs. A safe bet is to use only letters, digits,
856underscores and dashes. 850underscores and dashes.
857 851
8583.1. Getting pkgsrc for the first time 8523.1. Getting pkgsrc for the first time
859 853
860Before you download any pkgsrc files, you should decide whether you want the  854Before you download any pkgsrc files, you should decide whether you want the
861current branch or the stable branch. The latter is forked on a quarterly basis 855current branch or the stable branch. The latter is forked on a quarterly basis
862from the current branch and only gets modified for security updates. The names 856from the current branch and only gets modified for security updates. The names
863of the stable branches are built from the year and the quarter, for example 857of the stable branches are built from the year and the quarter, for example
8642020Q1. 8582020Q1.
865 859
866The second step is to decide how you want to download pkgsrc. You can get it as 860The second step is to decide how you want to download pkgsrc. You can get it as
867a tar file or via CVS. Both ways are described here. 861a tar file or via CVS. Both ways are described here.
868 862
869Note that tar archive contains CVS working copy. Thus you can switch to using 863Note that tar archive contains CVS working copy. Thus you can switch to using
870CVS at any later time. 864CVS at any later time.
871 865
8723.1.1. As tar archive 8663.1.1. As tar archive
873 867
874The primary download location for all pkgsrc files is https://cdn.NetBSD.org/ 868The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
875pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same 869pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
876location). There are a number of subdirectories for different purposes, which 870location). There are a number of subdirectories for different purposes, which
877are described in detail in Appendix C, Directory layout of the pkgsrc FTP 871are described in detail in Appendix C, Directory layout of the pkgsrc FTP
878server. 872server.
879 873
880The tar archive for the current branch is in the directory current and is 874The tar archive for the current branch is in the directory current and is
881called pkgsrc.tar.gz. It is autogenerated weekly. 875called pkgsrc.tar.gz. It is autogenerated weekly.
882 876
883To save download time we provide bzip2- and xz-compressed archives which are 877To save download time we provide bzip2- and xz-compressed archives which are
884published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively. 878published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
885 879
886You can fetch the same files using FTP. 880You can fetch the same files using FTP.
887 881
888The tar file for the stable branch 2020Q1 is in the directory pkgsrc-2020Q1 and 882The tar file for the stable branch 2020Q1 is in the directory pkgsrc-2020Q1 and
889is also called pkgsrc.tar.gz. 883is also called pkgsrc.tar.gz.
890 884
891To download the latest pkgsrc stable tarball, run: 885To download the latest pkgsrc stable tarball, run:
892 886
893$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz 887$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz
894 888
895If you prefer, you can also fetch it using "wget", "curl", or your web browser. 889If you prefer, you can also fetch it using "wget", "curl", or your web browser.
896 890
897Then, extract it with: 891Then, extract it with:
898 892
899$ tar -xzf pkgsrc.tar.gz -C /usr 893$ tar -xzf pkgsrc.tar.gz -C /usr
900 894
901This will create the directory pkgsrc/ in /usr/ and all the package source will 895This will create the directory pkgsrc/ in /usr/ and all the package source will
902be stored under /usr/pkgsrc/. 896be stored under /usr/pkgsrc/.
903 897
904To download pkgsrc-current, run: 898To download pkgsrc-current, run:
905 899
906$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz 900$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
907 901
9083.1.2. Via anonymous CVS 9023.1.2. Via anonymous CVS
909 903
910To fetch a specific pkgsrc stable branch, run: 904To fetch a specific pkgsrc stable branch, run:
911 905
912$ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc 906$ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc
913 907
914This will create the directory pkgsrc/ in your /usr/ directory and all the 908This will create the directory pkgsrc/ in your /usr/ directory and all the
915package source will be stored under /usr/pkgsrc/. 909package source will be stored under /usr/pkgsrc/.
916 910
917To fetch the pkgsrc current branch, run: 911To fetch the pkgsrc current branch, run:
918 912
919$ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc 913$ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
920 914
921Refer to the list of available mirrors to choose a faster CVS mirror, if 915Refer to the list of available mirrors to choose a faster CVS mirror, if
922needed. 916needed.
923 917
924If you get error messages from rsh, you need to set CVS_RSH variable. E.g.: 918If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
925 919
926$ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc 920$ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
927 921
928Refer to documentation on your command shell how to set CVS_RSH=ssh 922Refer to documentation on your command shell how to set CVS_RSH=ssh
929permanently. For Bourne shells, you can set it in your .profile or better 923permanently. For Bourne shells, you can set it in your .profile or better
930globally in /etc/profile: 924globally in /etc/profile:
931 925
932# set CVS remote shell command 926# set CVS remote shell command
933CVS_RSH=ssh 927CVS_RSH=ssh
934export CVS_RSH 928export CVS_RSH
935 929
936By default, CVS doesn't do things like most people would expect it to do. But 930By default, CVS doesn't do things like most people would expect it to do. But
937there is a way to convince CVS, by creating a file called .cvsrc in your home 931there is a way to convince CVS, by creating a file called .cvsrc in your home
938directory and saving the following lines to it. This file will save you lots of 932directory and saving the following lines to it. This file will save you lots of
939headache and some bug reports, so we strongly recommend it. You can find an 933headache and some bug reports, so we strongly recommend it. You can find an
940explanation of this file in the CVS documentation. 934explanation of this file in the CVS documentation.
941 935
942# recommended CVS configuration file from the pkgsrc guide 936# recommended CVS configuration file from the pkgsrc guide
943cvs -q 937cvs -q
944checkout -P 938checkout -P
945update -dP 939update -dP
946diff -upN 940diff -upN
947rdiff -u 941rdiff -u
948release -d 942release -d
949 943
9503.2. Keeping pkgsrc up-to-date 9443.2. Keeping pkgsrc up-to-date
951 945
952The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you 946The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
953have first installed it via a tar file). It saves bandwidth and hard disk 947have first installed it via a tar file). It saves bandwidth and hard disk
954activity, compared to downloading the tar file again. 948activity, compared to downloading the tar file again.
955 949
9563.2.1. Via tar files 9503.2.1. Via tar files
957 951
958Warning 952Warning
959 953
960When updating from a tar file, you first need to completely remove the old 954When updating from a tar file, you first need to completely remove the old
961pkgsrc directory. Otherwise those files that have been removed from pkgsrc in 955pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
962the mean time will not be removed on your local disk, resulting in 956the mean time will not be removed on your local disk, resulting in
963inconsistencies. When removing the old files, any changes that you have done to 957inconsistencies. When removing the old files, any changes that you have done to
964the pkgsrc files will be lost after updating. Therefore updating via CVS is 958the pkgsrc files will be lost after updating. Therefore updating via CVS is
965strongly recommended. 959strongly recommended.
966 960
967Note that by default the distfiles and the binary packages are saved in the 961Note that by default the distfiles and the binary packages are saved in the
968pkgsrc tree, so don't forget to rescue them before updating. You can also 962pkgsrc tree, so don't forget to rescue them before updating. You can also
969configure pkgsrc to store distfiles and packages in directories outside the 963configure pkgsrc to store distfiles and packages in directories outside the
970pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,  964pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
971Configuring pkgsrc for the details. 965Configuring pkgsrc for the details.
972 966
973To update pkgsrc from a tar file, download the tar file as explained above. 967To update pkgsrc from a tar file, download the tar file as explained above.
974Then, make sure that you have not made any changes to the files in the pkgsrc 968Then, make sure that you have not made any changes to the files in the pkgsrc
975directory. Remove the pkgsrc directory and extract the new tar file. Done. 969directory. Remove the pkgsrc directory and extract the new tar file. Done.
976 970
9773.2.2. Via CVS 9713.2.2. Via CVS
978 972
979To update pkgsrc via CVS, change to the pkgsrc directory and run cvs: 973To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
980 974
981$ cd /usr/pkgsrc && cvs update -dP 975$ cd /usr/pkgsrc && cvs update -dP
982 976
983If you get error messages from rsh, you need to set CVS_RSH variable as 977If you get error messages from rsh, you need to set CVS_RSH variable as
984described above. E.g.: 978described above. E.g.:
985 979
986$ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP 980$ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
987 981
9883.2.2.1. Switching between different pkgsrc branches 9823.2.2.1. Switching between different pkgsrc branches
989 983
990When updating pkgsrc, the CVS program keeps track of the branch you selected. 984When updating pkgsrc, the CVS program keeps track of the branch you selected.
991But if you, for whatever reason, want to switch from the stable branch to the 985But if you, for whatever reason, want to switch from the stable branch to the
992current one, you can do it by adding the option "-A" after the "update" 986current one, you can do it by adding the option "-A" after the "update"
993keyword. To switch from the current branch back to the stable branch, add the " 987keyword. To switch from the current branch back to the stable branch, add the "
994-rpkgsrc-2020Q1" option. 988-rpkgsrc-2020Q1" option.
995 989
9963.2.2.2. What happens to my changes when updating? 9903.2.2.2. What happens to my changes when updating?
997 991
998When you update pkgsrc, the CVS program will only touch those files that are 992When you update pkgsrc, the CVS program will only touch those files that are
999registered in the CVS repository. That means that any packages that you created 993registered in the CVS repository. That means that any packages that you created
1000on your own will stay unmodified. If you change files that are managed by CVS, 994on your own will stay unmodified. If you change files that are managed by CVS,
1001later updates will try to merge your changes with those that have been done by 995later updates will try to merge your changes with those that have been done by
1002others. See the CVS manual, chapter "update" for details. 996others. See the CVS manual, chapter "update" for details.
1003 997
1004Chapter 4. Using pkgsrc on systems other than NetBSD 998Chapter 4. Using pkgsrc on systems other than NetBSD
1005 999
1006Table of Contents 1000Table of Contents
1007 1001
10084.1. Binary distribution 10024.1. Binary distribution
10094.2. Bootstrapping pkgsrc 10034.2. Bootstrapping pkgsrc
1010 1004
10114.1. Binary distribution 10054.1. Binary distribution
1012 1006
1013See Section 5.1, "Using binary packages". 1007See Section 5.1, "Using binary packages".
1014 1008
10154.2. Bootstrapping pkgsrc 10094.2. Bootstrapping pkgsrc
1016 1010
1017pkgsrc can be bootstrapped for use in two different modes: privileged and 1011pkgsrc can be bootstrapped for use in two different modes: privileged and
1018unprivileged one. In unprivileged mode in contrast to privileged one all 1012unprivileged one. In unprivileged mode in contrast to privileged one all
1019programs are installed under one particular user and cannot utilise privileged 1013programs are installed under one particular user and cannot utilise privileged
1020operations (packages don't create special users and all special file 1014operations (packages don't create special users and all special file
1021permissions like setuid are ignored). 1015permissions like setuid are ignored).
1022 1016
1023Installing the bootstrap kit from source should be as simple as: 1017Installing the bootstrap kit from source should be as simple as:
1024 1018
1025# env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc 1019# env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1026# cd pkgsrc/bootstrap 1020# cd pkgsrc/bootstrap
1027# ./bootstrap 1021# ./bootstrap
1028 1022
1029 1023
1030To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap 1024To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1031 1025
1032By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs 1026By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1033will be installed in, and /usr/pkg/pkgdb for the package database directory 1027will be installed in, and /usr/pkg/pkgdb for the package database directory
1034where pkgsrc will do its internal bookkeeping, /var is used as varbase, where 1028where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1035packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg 1029packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1036for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase. 1030for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1037 1031
1038You can change default layout using command-line arguments. Run "./bootstrap 1032You can change default layout using command-line arguments. Run "./bootstrap
1039--help" to get details. 1033--help" to get details.
1040 1034
1041Note 1035Note
1042 1036
1043The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc. 1037The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1044For examples in this guide, use bmake instead of "make". 1038For examples in this guide, use bmake instead of "make".
1045 1039
1046Note 1040Note
1047 1041
1048It is possible to bootstrap multiple instances of pkgsrc using non-intersecting 1042It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1049directories. Use bmake corresponding to the installation you're working with to 1043directories. Use bmake corresponding to the installation you're working with to
1050build and install packages. 1044build and install packages.
1051 1045
1052Chapter 5. Using pkgsrc 1046Chapter 5. Using pkgsrc
1053 1047
1054Table of Contents 1048Table of Contents
1055 1049
10565.1. Using binary packages 10505.1. Using binary packages
1057 1051
1058 5.1.1. Finding binary packages 1052 5.1.1. Finding binary packages
1059 5.1.2. Installing binary packages 1053 5.1.2. Installing binary packages
1060 5.1.3. Deinstalling packages 1054 5.1.3. Deinstalling packages
1061 5.1.4. Getting information about installed packages 1055 5.1.4. Getting information about installed packages
1062 5.1.5. Checking for security vulnerabilities in installed packages 1056 5.1.5. Checking for security vulnerabilities in installed packages
1063 5.1.6. Finding if newer versions of your installed packages are in pkgsrc 1057 5.1.6. Finding if newer versions of your installed packages are in pkgsrc
1064 5.1.7. Other administrative functions 1058 5.1.7. Other administrative functions
1065 1059
10665.2. Building packages from source 10605.2. Building packages from source
1067 1061
1068 5.2.1. Requirements 1062 5.2.1. Requirements
1069 5.2.2. Fetching distfiles 1063 5.2.2. Fetching distfiles
1070 5.2.3. How to build and install 1064 5.2.3. How to build and install
1071 1065
1072Basically, there are two ways of using pkgsrc. The first is to only install the 1066Basically, there are two ways of using pkgsrc. The first is to only install the
1073package tools and to use binary packages that someone else has prepared. This 1067package tools and to use binary packages that someone else has prepared. This
1074is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too. 1068is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1075Then you are able to build your own packages, and you can still use binary 1069Then you are able to build your own packages, and you can still use binary
1076packages from someone else. 1070packages from someone else.
1077 1071
10785.1. Using binary packages 10725.1. Using binary packages
1079 1073
1080On the cdn.NetBSD.org site and mirrors, there are collections of binary 1074On the cdn.NetBSD.org site and mirrors, there are collections of binary
1081packages, ready to be installed. These binary packages have been built using 1075packages, ready to be installed. These binary packages have been built using
1082the default settings for the directories, that is: 1076the default settings for the directories, that is:
1083 1077
1084 * /usr/pkg for LOCALBASE, where most of the files are installed, 1078 * /usr/pkg for LOCALBASE, where most of the files are installed,
1085 1079
1086 * /usr/pkg/etc for configuration files, 1080 * /usr/pkg/etc for configuration files,
1087 1081
1088 * /var for VARBASE, where those files are installed that may change after 1082 * /var for VARBASE, where those files are installed that may change after
1089 installation. 1083 installation.
1090 1084
1091If you cannot use these directories for whatever reasons (maybe because you're 1085If you cannot use these directories for whatever reasons (maybe because you're
1092not root), you cannot use these binary packages, but have to build the packages 1086not root), you cannot use these binary packages, but have to build the packages
1093yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc". 1087yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1094 1088
10955.1.1. Finding binary packages 10895.1.1. Finding binary packages
1096 1090
1097To install binary packages, you first need to know from where to get them. The 1091To install binary packages, you first need to know from where to get them. The
1098first place where you should look is on the main pkgsrc FTP server in the 1092first place where you should look is on the main pkgsrc FTP server in the
1099directory /pub/pkgsrc/packages. 1093directory /pub/pkgsrc/packages.
1100 1094
1101This directory contains binary packages for multiple platforms. First, select 1095This directory contains binary packages for multiple platforms. First, select
1102your operating system. (Ignore the directories with version numbers attached to 1096your operating system. (Ignore the directories with version numbers attached to
1103it, they just exist for legacy reasons.) Then, select your hardware 1097it, they just exist for legacy reasons.) Then, select your hardware
1104architecture, and in the third step, the OS version and the "version" of 1098architecture, and in the third step, the OS version and the "version" of
1105pkgsrc. 1099pkgsrc.
1106 1100
1107In this directory, you often find a file called bootstrap.tar.gz which contains 1101In this directory, you often find a file called bootstrap.tar.gz which contains
1108the package management tools. If the file is missing, it is likely that your 1102the package management tools. If the file is missing, it is likely that your
1109operating system already provides those tools. Download the file and extract it 1103operating system already provides those tools. Download the file and extract it
1110in the / directory. It will create the directories /usr/pkg (containing the 1104in the / directory. It will create the directories /usr/pkg (containing the
1111tools for managing binary packages and the database of installed packages). 1105tools for managing binary packages and the database of installed packages).
1112 1106
11135.1.2. Installing binary packages 11075.1.2. Installing binary packages
1114 1108
1115In the directory from the last section, there is a subdirectory called All/, 1109In the directory from the last section, there is a subdirectory called All/,
1116which contains all the binary packages that are available for the platform, 1110which contains all the binary packages that are available for the platform,
1117excluding those that may not be distributed via FTP or CDROM (depending on 1111excluding those that may not be distributed via FTP or CDROM (depending on
1118which medium you are using). 1112which medium you are using).
1119 1113
1120To install packages directly from an FTP or HTTP server, run the following 1114To install packages directly from an FTP or HTTP server, run the following
1121commands in a Bourne-compatible shell (be sure to su to root first): 1115commands in a Bourne-compatible shell (be sure to su to root first):
1122 1116
1123# PATH="/usr/pkg/sbin:$PATH" 1117# PATH="/usr/pkg/sbin:$PATH"
1124# PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages" 1118
 1119# PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages"
1125# PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/" 1120# PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1126# export PATH PKG_PATH 1121# export PATH PKG_PATH
1127 1122
1128Instead of URLs, you can also use local paths, for example if you are 1123Instead of URLs, you can also use local paths, for example if you are
1129installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want 1124installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1130to install packages from multiple sources, you can separate them by a semicolon 1125to install packages from multiple sources, you can separate them by a semicolon
1131in PKG_PATH. 1126in PKG_PATH.
1132 1127
1133After these preparations, installing a package is very easy: 1128After these preparations, installing a package is very easy:
1134 1129
1135# pkg_add libreoffice 1130# pkg_add libreoffice
1136# pkg_add ap24-php71-* 1131# pkg_add ap24-php71-*
1137 1132
1138Note that any prerequisite packages needed to run the package in question will 1133Note that any prerequisite packages needed to run the package in question will
1139be installed, too, assuming they are present where you install from. 1134be installed, too, assuming they are present where you install from.
1140 1135
1141Adding packages might install vulnerable packages. Thus you should run  1136Adding packages might install vulnerable packages. Thus you should run
1142pkg_admin audit regularly, especially after installing new packages, and verify 1137pkg_admin audit regularly, especially after installing new packages, and verify
1143that the vulnerabilities are acceptable for your configuration. 1138that the vulnerabilities are acceptable for your configuration.
1144 1139
1145After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin 1140After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1146in your PATH so you can actually start the just installed program. 1141in your PATH so you can actually start the just installed program.
1147 1142
11485.1.3. Deinstalling packages 11435.1.3. Deinstalling packages
1149 1144
1150To deinstall a package, it does not matter whether it was installed from source 1145To deinstall a package, it does not matter whether it was installed from source
1151code or from a binary package. The pkg_delete command does not know it anyway. 1146code or from a binary package. The pkg_delete command does not know it anyway.
1152To delete a package, you can just run pkg_delete package-name. The package name 1147To delete a package, you can just run pkg_delete package-name. The package name
1153can be given with or without version number. Wildcards can also be used to 1148can be given with or without version number. Wildcards can also be used to
1154deinstall a set of packages, for example *emacs*. Be sure to include them in 1149deinstall a set of packages, for example *emacs*. Be sure to include them in
1155quotes, so that the shell does not expand them before pkg_delete sees them. 1150quotes, so that the shell does not expand them before pkg_delete sees them.
1156 1151
1157The -r option is very powerful: it removes all the packages that require the 1152The -r option is very powerful: it removes all the packages that require the
1158package in question and then removes the package itself. For example: 1153package in question and then removes the package itself. For example:
1159 1154
1160# pkg_delete -r jpeg 1155# pkg_delete -r jpeg
1161 1156
1162 1157
1163will remove jpeg and all the packages that used it; this allows upgrading the 1158will remove jpeg and all the packages that used it; this allows upgrading the
1164jpeg package. 1159jpeg package.
1165 1160
11665.1.4. Getting information about installed packages 11615.1.4. Getting information about installed packages
1167 1162
1168The pkg_info shows information about installed packages or binary package 1163The pkg_info shows information about installed packages or binary package
1169files. 1164files.
1170 1165
11715.1.5. Checking for security vulnerabilities in installed packages 11665.1.5. Checking for security vulnerabilities in installed packages
1172 1167
1173The pkgsrc Security Team and Packages Groups maintain a list of known security 1168The pkgsrc Security Team and Packages Groups maintain a list of known security
1174vulnerabilities to packages which are (or have been) included in pkgsrc. The 1169vulnerabilities to packages which are (or have been) included in pkgsrc. The
1175list is available from the NetBSD FTP site at https://ftp.NetBSD.org/pub/NetBSD 1170list is available from the NetBSD FTP site at http://ftp.NetBSD.org/pub/NetBSD/
1176/packages/vulns/pkg-vulnerabilities. 1171packages/vulns/pkg-vulnerabilities.
1177 1172
1178Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded 1173Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1179automatically, and a security audit of all packages installed on a system can 1174automatically, and a security audit of all packages installed on a system can
1180take place. 1175take place.
1181 1176
1182There are two components to auditing. The first step, pkg_admin 1177There are two components to auditing. The first step, pkg_admin
1183fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from 1178fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1184the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of 1179the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1185your installed packages are vulnerable. If a package is vulnerable, you will 1180your installed packages are vulnerable. If a package is vulnerable, you will
1186see output similar to the following: 1181see output similar to the following:
1187 1182
1188Package samba-2.0.9 has a local-root-shell vulnerability, see 1183Package samba-2.0.9 has a local-root-shell vulnerability, see
1189 https://www.samba.org/samba/whatsnew/macroexploit.html 1184 https://www.samba.org/samba/whatsnew/macroexploit.html
1190 1185
1191You may wish to have the vulnerabilities file downloaded daily so that it 1186You may wish to have the vulnerabilities file downloaded daily so that it
1192remains current. This may be done by adding an appropriate entry to the root 1187remains current. This may be done by adding an appropriate entry to the root
1193users crontab(5) entry. For example the entry 1188users crontab(5) entry. For example the entry
1194 1189
1195# Download vulnerabilities file 1190# Download vulnerabilities file
11960 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1 11910 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1197# Audit the installed packages and email results to root 1192# Audit the installed packages and email results to root
11989 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \ 11939 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1199 root >/dev/null 2>&1 1194 root >/dev/null 2>&1
1200 1195
1201 1196
1202will update the vulnerability list every day at 3AM, followed by an audit at 1197will update the vulnerability list every day at 3AM, followed by an audit at
12033:09AM. The result of the audit are then emailed to root. On NetBSD this may be 11983:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1204accomplished instead by adding the following line to /etc/daily.conf: 1199accomplished instead by adding the following line to /etc/daily.conf:
1205 1200
1206fetch_pkg_vulnerabilities=YES 1201fetch_pkg_vulnerabilities=YES
1207 1202
1208 1203
1209to fetch the vulnerability list from the daily security script. The system is 1204to fetch the vulnerability list from the daily security script. The system is
1210set to audit the packages by default but can be set explicitly, if desired (not 1205set to audit the packages by default but can be set explicitly, if desired (not
1211required), by adding the following line to /etc/security.conf: 1206required), by adding the following line to /etc/security.conf:
1212 1207
1213check_pkg_vulnerabilities=YES 1208check_pkg_vulnerabilities=YES
1214 1209
1215 1210
1216see daily.conf(5) and security.conf(5) for more details. 1211see daily.conf(5) and security.conf(5) for more details.
1217 1212
12185.1.6. Finding if newer versions of your installed packages are in pkgsrc 12135.1.6. Finding if newer versions of your installed packages are in pkgsrc
1219 1214
1220Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check 1215Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1221if your packages are up-to-date, e.g. 1216if your packages are up-to-date, e.g.
1222 1217
1223% lintpkgsrc -i 1218% lintpkgsrc -i
1224... 1219...
1225Version mismatch: 'tcsh' 6.09.00 vs 6.10.00 1220Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1226 1221
1227 1222
1228You can then use make update to update the package on your system and rebuild 1223You can then use make update to update the package on your system and rebuild
1229any dependencies. 1224any dependencies.
1230 1225
12315.1.7. Other administrative functions 12265.1.7. Other administrative functions
1232 1227
1233The pkg_admin executes various administrative functions on the package system. 1228The pkg_admin executes various administrative functions on the package system.
1234 1229
12355.2. Building packages from source 12305.2. Building packages from source
1236 1231
1237After obtaining pkgsrc, the pkgsrc directory now contains a set of packages, 1232After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1238organized into categories. You can browse the online index of packages, or run  1233organized into categories. You can browse the online index of packages, or run
1239make readme from the pkgsrc directory to build local README.html files for all 1234make readme from the pkgsrc directory to build local README.html files for all
1240packages, viewable with any web browser such as www/lynx or www/firefox. 1235packages, viewable with any web browser such as www/lynx or www/firefox.
1241 1236
1242The default prefix for installed packages is /usr/pkg. If you wish to change 1237The default prefix for installed packages is /usr/pkg. If you wish to change
1243this, you should do so by setting LOCALBASE in mk.conf. You should not try to 1238this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1244use multiple different LOCALBASE definitions on the same system (inside a 1239use multiple different LOCALBASE definitions on the same system (inside a
1245chroot is an exception). 1240chroot is an exception).
1246 1241
1247The rest of this chapter assumes that the package is already in pkgsrc. If it 1242The rest of this chapter assumes that the package is already in pkgsrc. If it
1248is not, see Part II, "The pkgsrc developer's guide" for instructions how to 1243is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1249create your own packages. 1244create your own packages.
1250 1245
12515.2.1. Requirements 12465.2.1. Requirements
1252 1247
1253To build packages from source, you need a working C compiler. On NetBSD, you 1248To build packages from source, you need a working C compiler. On NetBSD, you
1254need to install the "comp" and the "text" distribution sets. If you want to 1249need to install the "comp" and the "text" distribution sets. If you want to
1255build X11-related packages, the "xbase" and "xcomp" distribution sets are 1250build X11-related packages, the "xbase" and "xcomp" distribution sets are
1256required, too. 1251required, too.
1257 1252
12585.2.2. Fetching distfiles 12535.2.2. Fetching distfiles
1259 1254
1260The first step for building a package is downloading the distfiles (i.e. the 1255The first step for building a package is downloading the distfiles (i.e. the
1261unmodified source). If they have not yet been downloaded, pkgsrc will fetch 1256unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1262them automatically. 1257them automatically.
1263 1258
1264If you have all files that you need in the distfiles directory, you don't need 1259If you have all files that you need in the distfiles directory, you don't need
1265to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom 1260to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1266and add: 1261and add:
1267 1262
1268DISTDIR=/cdrom/pkgsrc/distfiles 1263DISTDIR=/cdrom/pkgsrc/distfiles
1269 1264
1270to your mk.conf. 1265to your mk.conf.
1271 1266
1272By default a list of distribution sites will be randomly intermixed to prevent 1267By default a list of distribution sites will be randomly intermixed to prevent
1273huge load on servers which holding popular packages (for example, 1268huge load on servers which holding popular packages (for example,
1274SourceForge.net mirrors). Thus, every time when you need to fetch yet another 1269SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1275distfile all the mirrors will be tried in new (random) order. You can turn this 1270distfile all the mirrors will be tried in new (random) order. You can turn this
1276feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already 1271feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1277disabled). 1272disabled).
1278 1273
1279You can overwrite some of the major distribution sites to fit to sites that are 1274You can overwrite some of the major distribution sites to fit to sites that are
1280close to your own. By setting one or two variables you can modify the order in 1275close to your own. By setting one or two variables you can modify the order in
1281which the master sites are accessed. MASTER_SORT contains a whitespace 1276which the master sites are accessed. MASTER_SORT contains a whitespace
1282delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it 1277delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1283contains a whitespace delimited list of regular expressions. It has higher 1278contains a whitespace delimited list of regular expressions. It has higher
1284priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find 1279priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1285some examples. This may save some of your bandwidth and time. 1280some examples. This may save some of your bandwidth and time.
1286 1281
1287You can change these settings either in your shell's environment, or, if you 1282You can change these settings either in your shell's environment, or, if you
1288want to keep the settings, by editing the mk.conf file, and adding the 1283want to keep the settings, by editing the mk.conf file, and adding the
1289definitions there. 1284definitions there.
1290 1285
1291If a package depends on many other packages (such as meta-pkgs/kde4), the build 1286If a package depends on many other packages (such as meta-pkgs/kde4), the build
1292process may alternate between periods of downloading source, and compiling. To 1287process may alternate between periods of downloading source, and compiling. To
1293ensure you have all the source downloaded initially you can run the command: 1288ensure you have all the source downloaded initially you can run the command:
1294 1289
1295% make fetch-list | sh 1290% make fetch-list | sh
1296 1291
1297which will output and run a set of shell commands to fetch the necessary files 1292which will output and run a set of shell commands to fetch the necessary files
1298into the distfiles directory. You can also choose to download the files 1293into the distfiles directory. You can also choose to download the files
1299manually. 1294manually.
1300 1295
13015.2.3. How to build and install 12965.2.3. How to build and install
1302 1297
1303Once the software has downloaded, any patches will be applied, then it will be 1298Once the software has downloaded, any patches will be applied, then it will be
1304compiled for you. This may take some time depending on your computer, and how 1299compiled for you. This may take some time depending on your computer, and how
1305many other packages the software depends on and their compile time. 1300many other packages the software depends on and their compile time.
1306 1301
1307Note 1302Note
1308 1303
1309If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake 1304If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1310command instead of "make" in the examples in this guide. 1305command instead of "make" in the examples in this guide.
1311 1306
1312For example, type 1307For example, type
1313 1308
1314% cd misc/figlet 1309% cd misc/figlet
1315% make 1310% make
1316 1311
1317 1312
1318at the shell prompt to build the various components of the package. 1313at the shell prompt to build the various components of the package.
1319 1314
1320The next stage is to actually install the newly compiled program onto your 1315The next stage is to actually install the newly compiled program onto your
1321system. Do this by entering: 1316system. Do this by entering:
1322 1317
1323% make install 1318% make install
1324 1319
1325 1320
1326while you are still in the directory for whatever package you are installing. 1321while you are still in the directory for whatever package you are installing.
1327 1322
1328Installing the package on your system may require you to be root. However, 1323Installing the package on your system may require you to be root. However,
1329pkgsrc has a just-in-time-su feature, which allows you to only become root for 1324pkgsrc has a just-in-time-su feature, which allows you to only become root for
1330the actual installation step. 1325the actual installation step.
1331 1326
1332That's it, the software should now be installed and setup for use. You can now 1327That's it, the software should now be installed and setup for use. You can now
1333enter: 1328enter:
1334 1329
1335% make clean 1330% make clean
1336 1331
1337 1332
1338to remove the compiled files in the work directory, as you shouldn't need them 1333to remove the compiled files in the work directory, as you shouldn't need them
1339any more. If other packages were also added to your system (dependencies) to 1334any more. If other packages were also added to your system (dependencies) to
1340allow your program to compile, you can tidy these up also with the command: 1335allow your program to compile, you can tidy these up also with the command:
1341 1336
1342% make clean-depends 1337% make clean-depends
1343 1338
1344 1339
1345Taking the figlet utility as an example, we can install it on our system by 1340Taking the figlet utility as an example, we can install it on our system by
1346building as shown in Appendix B, Build logs. 1341building as shown in Appendix B, Build logs.
1347 1342
1348The program is installed under the default root of the packages tree - /usr/ 1343The program is installed under the default root of the packages tree - /usr/
1349pkg. Should this not conform to your tastes, set the LOCALBASE variable in your 1344pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1350environment, and it will use that value as the root of your packages tree. So, 1345environment, and it will use that value as the root of your packages tree. So,
1351to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note 1346to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1352that you should use a directory which is dedicated to packages and not shared 1347that you should use a directory which is dedicated to packages and not shared
1353with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should 1348with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1354not try to add any of your own files or directories (such as src/, obj/, or 1349not try to add any of your own files or directories (such as src/, obj/, or
1355pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts 1350pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1356between programs and other files installed by the package system and whatever 1351between programs and other files installed by the package system and whatever
1357else may have been installed there. 1352else may have been installed there.
1358 1353
1359Some packages look in mk.conf to alter some configuration options at build 1354Some packages look in mk.conf to alter some configuration options at build
1360time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will 1355time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1361be set there by default. Environment variables such as LOCALBASE can be set in 1356be set there by default. Environment variables such as LOCALBASE can be set in
1362mk.conf to save having to remember to set them each time you want to use 1357mk.conf to save having to remember to set them each time you want to use
1363pkgsrc. 1358pkgsrc.
1364 1359
1365Occasionally, people want to "look under the covers" to see what is going on 1360Occasionally, people want to "look under the covers" to see what is going on
1366when a package is building or being installed. This may be for debugging 1361when a package is building or being installed. This may be for debugging
1367purposes, or out of simple curiosity. A number of utility values have been 1362purposes, or out of simple curiosity. A number of utility values have been
1368added to help with this. 1363added to help with this.
1369 1364
1370 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge 1365 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1371 amount of information will be displayed. For example, 1366 amount of information will be displayed. For example,
1372 1367
1373 make patch PKG_DEBUG_LEVEL=2 1368 make patch PKG_DEBUG_LEVEL=2
1374 1369
1375 will show all the commands that are invoked, up to and including the "patch 1370 will show all the commands that are invoked, up to and including the "patch
1376 " stage. 1371 " stage.
1377 1372
1378 2. If you want to know the value of a certain make(1) definition, then the 1373 2. If you want to know the value of a certain make(1) definition, then the
1379 VARNAME definition should be used, in conjunction with the show-var target. 1374 VARNAME definition should be used, in conjunction with the show-var target.
1380 e.g. to show the expansion of the make(1) variable LOCALBASE: 1375 e.g. to show the expansion of the make(1) variable LOCALBASE:
1381 1376
1382 % make show-var VARNAME=LOCALBASE 1377 % make show-var VARNAME=LOCALBASE
1383 /usr/pkg 1378 /usr/pkg
1384 % 1379 %
1385 1380
1386 1381
1387If you want to install a binary package that you've either created yourself 1382If you want to install a binary package that you've either created yourself
1388(see next section), that you put into pkgsrc/packages manually or that is 1383(see next section), that you put into pkgsrc/packages manually or that is
1389located on a remote FTP server, you can use the "bin-install" target. This 1384located on a remote FTP server, you can use the "bin-install" target. This
1390target will install a binary package - if available - via pkg_add(1), else do a 1385target will install a binary package - if available - via pkg_add(1), else do a
1391make package. The list of remote FTP sites searched is kept in the variable 1386make package. The list of remote FTP sites searched is kept in the variable
1392BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added 1387BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1393to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf 1388to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1394for more details. 1389for more details.
1395 1390
1396A final word of warning: If you set up a system that has a non-standard setting 1391A final word of warning: If you set up a system that has a non-standard setting
1397for LOCALBASE, be sure to set that before any packages are installed, as you 1392for LOCALBASE, be sure to set that before any packages are installed, as you
1398cannot use several directories for the same purpose. Doing so will result in 1393cannot use several directories for the same purpose. Doing so will result in
1399pkgsrc not being able to properly detect your installed packages, and fail 1394pkgsrc not being able to properly detect your installed packages, and fail
1400miserably. Note also that precompiled binary packages are usually built with 1395miserably. Note also that precompiled binary packages are usually built with
1401the default LOCALBASE of /usr/pkg, and that you should not install any if you 1396the default LOCALBASE of /usr/pkg, and that you should not install any if you
1402use a non-standard LOCALBASE. 1397use a non-standard LOCALBASE.
1403 1398
1404Chapter 6. Configuring pkgsrc 1399Chapter 6. Configuring pkgsrc
1405 1400
1406Table of Contents 1401Table of Contents
1407 1402
14086.1. General configuration 14036.1. General configuration
14096.2. Variables affecting the build process 14046.2. Variables affecting the build process
14106.3. Variables affecting the installation process 14056.3. Variables affecting the installation process
14116.4. Selecting and configuring the compiler 14066.4. Selecting and configuring the compiler
1412 1407
1413 6.4.1. Selecting the compiler 1408 6.4.1. Selecting the compiler
1414 6.4.2. Additional flags to the compiler (CFLAGS) 1409 6.4.2. Additional flags to the compiler (CFLAGS)
1415 6.4.3. Additional flags to the linker (LDFLAGS) 1410 6.4.3. Additional flags to the linker (LDFLAGS)
1416 1411
14176.5. Developer/advanced settings 14126.5. Developer/advanced settings
14186.6. Selecting Build Options 14136.6. Selecting Build Options
1419 1414
1420The whole pkgsrc system is configured in a single file, usually called mk.conf. 1415The whole pkgsrc system is configured in a single file, usually called mk.conf.
1421In which directory pkgsrc looks for that file depends on the installation. On 1416In which directory pkgsrc looks for that file depends on the installation. On
1422NetBSD, when you use make(1) from the base system, it is in the directory /etc 1417NetBSD, when you use make(1) from the base system, it is in the directory /etc
1423/. In all other cases the default location is ${PREFIX}/etc/, depending on 1418/. In all other cases the default location is ${PREFIX}/etc/, depending on
1424where you told the bootstrap program to install the binary packages. 1419where you told the bootstrap program to install the binary packages.
1425 1420
1426The format of the configuration file is that of the usual BSD-style Makefiles. 1421The format of the configuration file is that of the usual BSD-style Makefiles.
1427The whole pkgsrc configuration is done by setting variables in this file. Note 1422The whole pkgsrc configuration is done by setting variables in this file. Note
1428that you can define all kinds of variables, and no special error checking (for 1423that you can define all kinds of variables, and no special error checking (for
1429example for spelling mistakes) takes place. 1424example for spelling mistakes) takes place.
1430 1425
14316.1. General configuration 14266.1. General configuration
1432 1427
1433The following variables apply to all pkgsrc packages. A complete list of the 1428The following variables apply to all pkgsrc packages. A complete list of the
1434variables that can be configured by the user is available in mk/defaults/ 1429variables that can be configured by the user is available in mk/defaults/
1435mk.conf, together with some comments that describe each variable's intent. 1430mk.conf, together with some comments that describe each variable's intent.
1436 1431
1437 * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do 1432 * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1438 not mix binary packages with different LOCALBASEs! 1433 not mix binary packages with different LOCALBASEs!
1439 1434
1440 * CROSSBASE: Where "cross" category packages will be installed. The default 1435 * CROSSBASE: Where "cross" category packages will be installed. The default
1441 is ${LOCALBASE}/cross. 1436 is ${LOCALBASE}/cross.
1442 1437
1443 * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7. 1438 * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1444 1439
1445 * DISTDIR: Where to store the downloaded copies of the original source 1440 * DISTDIR: Where to store the downloaded copies of the original source
1446 distributions used for building pkgsrc packages. The default is $ 1441 distributions used for building pkgsrc packages. The default is $
1447 {PKGSRCDIR}/distfiles. 1442 {PKGSRCDIR}/distfiles.
1448 1443
1449 * PKG_DBDIR: Where the database about installed packages is stored. The 1444 * PKG_DBDIR: Where the database about installed packages is stored. The
1450 default is /usr/pkg/pkgdb. 1445 default is /usr/pkg/pkgdb.
1451 1446
1452 * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this 1447 * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1453 value. 1448 value.
1454 1449
1455 * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch 1450 * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1456 files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES} 1451 files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1457 respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$ 1452 respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1458 {DIST_SUBDIR}/. 1453 {DIST_SUBDIR}/.
1459 1454
1460 * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced 1455 * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1461 with OS release ("2.0", etc.) and architecture ("mipsel", etc.). 1456 with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1462 1457
1463 * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are 1458 * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1464 case-sensitive. Whenever you try to build a package whose license is not in 1459 case-sensitive. Whenever you try to build a package whose license is not in
1465 this list, you will get an error message. If the license condition is 1460 this list, you will get an error message. If the license condition is
1466 simple enough, the error message will include specific instructions on how 1461 simple enough, the error message will include specific instructions on how
1467 to change this variable. 1462 to change this variable.
1468 1463
14696.2. Variables affecting the build process 14646.2. Variables affecting the build process
1470 1465
1471 * PACKAGES: The top level directory for the binary packages. The default is $ 1466 * PACKAGES: The top level directory for the binary packages. The default is $
1472 {PKGSRCDIR}/packages. 1467 {PKGSRCDIR}/packages.
1473 1468
1474 * WRKOBJDIR: The top level directory where, if defined, the separate working 1469 * WRKOBJDIR: The top level directory where, if defined, the separate working
1475 directories will get created, and symbolically linked to from ${WRKDIR} 1470 directories will get created, and symbolically linked to from ${WRKDIR}
1476 (see below). This is useful for building packages on several architectures, 1471 (see below). This is useful for building packages on several architectures,
1477 then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every 1472 then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1478 architecture. (It should be noted that PKGSRCDIR should not be set by the 1473 architecture. (It should be noted that PKGSRCDIR should not be set by the
1479 user ? it is an internal definition which refers to the root of the pkgsrc 1474 user ? it is an internal definition which refers to the root of the pkgsrc
1480 tree. It is possible to have many pkgsrc tree instances.) 1475 tree. It is possible to have many pkgsrc tree instances.)
1481 1476
1482 * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See 1477 * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1483 Section 13.3, "patches/*" for more information. 1478 Section 13.3, "patches/*" for more information.
1484 1479
1485 * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style 1480 * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1486 Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking 1481 Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1487 up settings used by builds in /usr/src. 1482 up settings used by builds in /usr/src.
1488 1483
14896.3. Variables affecting the installation process 14846.3. Variables affecting the installation process
1490 1485
1491 * PKGSRC_KEEP_BIN_PKGSRC: By default, binary packages of built packages are 1486 * PKGSRC_KEEP_BIN_PKGSRC: By default, binary packages of built packages are
1492 preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this. 1487 preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1493 1488
1494Packages have to support installation into a subdirectory of WRKDIR. This 1489Packages have to support installation into a subdirectory of WRKDIR. This
1495allows a package to be built, before the actual filesystem is touched. DESTDIR 1490allows a package to be built, before the actual filesystem is touched. DESTDIR
1496support exists in two variations: 1491support exists in two variations:
1497 1492
1498 * Basic DESTDIR support means that the package installation and packaging is 1493 * Basic DESTDIR support means that the package installation and packaging is
1499 still run as root. 1494 still run as root.
1500 1495
1501 * Full DESTDIR support can run the complete build, installation and packaging 1496 * Full DESTDIR support can run the complete build, installation and packaging
1502 as normal user. Root privileges are only needed to add packages. 1497 as normal user. Root privileges are only needed to add packages.
1503 1498
1504With basic DESTDIR support, make clean needs to be run as root. 1499With basic DESTDIR support, make clean needs to be run as root.
1505 1500
1506Considering the foo/bar package, DESTDIR full support can be tested using the 1501Considering the foo/bar package, DESTDIR full support can be tested using the
1507following commands 1502following commands
1508 1503
1509$ id 1504$ id
1510uid=1000(myusername) gid=100(users) groups=100(users),0(wheel) 1505uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1511$ mkdir $HOME/packages 1506$ mkdir $HOME/packages
1512$ cd $PKGSRCDIR/foo/bar 1507$ cd $PKGSRCDIR/foo/bar
1513 1508
1514Verify DESTDIR full support, no root privileges should be needed 1509Verify DESTDIR full support, no root privileges should be needed
1515 1510
1516$ make stage-install 1511$ make stage-install
1517 1512
1518Create a package without root privileges 1513Create a package without root privileges
1519 1514
1520$ make PACKAGES=$HOME/packages package 1515$ make PACKAGES=$HOME/packages package
1521 1516
1522For the following command, you must be able to gain root privileges using su(1) 1517For the following command, you must be able to gain root privileges using su(1)
1523 1518
1524$ make PACKAGES=$HOME/packages install 1519$ make PACKAGES=$HOME/packages install
1525 1520
1526Then, as a simple user 1521Then, as a simple user
1527 1522
1528$ make clean 1523$ make clean
1529 1524
15306.4. Selecting and configuring the compiler 15256.4. Selecting and configuring the compiler
1531 1526
15326.4.1. Selecting the compiler 15276.4.1. Selecting the compiler
1533 1528
1534By default, pkgsrc will use GCC to build packages. This may be overridden by 1529By default, pkgsrc will use GCC to build packages. This may be overridden by
1535setting the following variables in /etc/mk.conf: 1530setting the following variables in /etc/mk.conf:
1536 1531
1537PKGSRC_COMPILER: 1532PKGSRC_COMPILER:
1538 1533
1539 This is a list of values specifying the chain of compilers to invoke when 1534 This is a list of values specifying the chain of compilers to invoke when
1540 building packages. Valid values are: 1535 building packages. Valid values are:
1541 1536
1542 + ccc: Compaq C Compilers (Tru64) 1537 + ccc: Compaq C Compilers (Tru64)
1543 1538
1544 + ccache: compiler cache (chainable) 1539 + ccache: compiler cache (chainable)
1545 1540
1546 + clang: Clang C and Objective-C compiler 1541 + clang: Clang C and Objective-C compiler
1547 1542
1548 + distcc: distributed C/C++ (chainable) 1543 + distcc: distributed C/C++ (chainable)
1549 1544
1550 + f2c: Fortran 77 to C compiler (chainable) 1545 + f2c: Fortran 77 to C compiler (chainable)
1551 1546
1552 + icc: Intel C++ Compiler (Linux) 1547 + icc: Intel C++ Compiler (Linux)
1553 1548
1554 + ido: SGI IRIS Development Option cc (IRIX 5) 1549 + ido: SGI IRIS Development Option cc (IRIX 5)
1555 1550
1556 + gcc: GNU C/C++ Compiler 1551 + gcc: GNU C/C++ Compiler
1557 1552
1558 + hp: HP-UX C/aC++ compilers 1553 + hp: HP-UX C/aC++ compilers
1559 1554
1560 + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64) 1555 + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1561 1556
1562 + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32) 1557 + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1563 1558
1564 + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio 1559 + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1565 1560
1566 + xlc: IBM's XL C/C++ compiler suite 1561 + xlc: IBM's XL C/C++ compiler suite
1567 1562
1568 The default is "gcc". You can use ccache and/or distcc with an appropriate 1563 The default is "gcc". You can use ccache and/or distcc with an appropriate
1569 PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be 1564 PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1570 terminated with a value for a real compiler. Note that only one real 1565 terminated with a value for a real compiler. Note that only one real
1571 compiler should be listed (e.g. "sunpro gcc" is not allowed). 1566 compiler should be listed (e.g. "sunpro gcc" is not allowed).
1572 1567
1573GCC_REQD: 1568GCC_REQD:
1574 1569
1575 This specifies the minimum version of GCC to use when building packages. If 1570 This specifies the minimum version of GCC to use when building packages. If
1576 the system GCC doesn't satisfy this requirement, then pkgsrc will build and 1571 the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1577 install one of the GCC packages to use instead. 1572 install one of the GCC packages to use instead.
1578 1573
1579PYTHON_VERSION_DEFAULT: 1574PYTHON_VERSION_DEFAULT:
1580 1575
1581 Specifies which version of python to use when several options are 1576 Specifies which version of python to use when several options are
1582 available. 1577 available.
1583 1578
1584PKGSRC_FORTRAN: 1579PKGSRC_FORTRAN:
1585 1580
1586 Specifies the Fortran compiler to use. The default is gfortran. 1581 Specifies the Fortran compiler to use. The default is gfortran.
1587 1582
1588GFORTRAN_VERSION: 1583GFORTRAN_VERSION:
1589 1584
1590 If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to 1585 If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1591 use. 1586 use.
1592 1587
15936.4.2. Additional flags to the compiler (CFLAGS) 15886.4.2. Additional flags to the compiler (CFLAGS)
1594 1589
1595If you wish to set the CFLAGS variable, please make sure to use the += operator 1590If you wish to set the CFLAGS variable, please make sure to use the += operator
1596instead of the = operator: 1591instead of the = operator:
1597 1592
1598CFLAGS+= -your -flags 1593CFLAGS+= -your -flags
1599 1594
1600Using CFLAGS= (i.e. without the "+") may lead to problems with packages that 1595Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1601need to add their own flags. You may want to take a look at the devel/cpuflags 1596need to add their own flags. You may want to take a look at the devel/cpuflags
1602package if you're interested in optimization specifically for the current CPU. 1597package if you're interested in optimization specifically for the current CPU.
1603 1598
16046.4.3. Additional flags to the linker (LDFLAGS) 15996.4.3. Additional flags to the linker (LDFLAGS)
1605 1600
1606If you want to pass flags to the linker, both in the configure step and the 1601If you want to pass flags to the linker, both in the configure step and the
1607build step, you can do this in two ways. Either set LDFLAGS or LIBS. The 1602build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1608difference between the two is that LIBS will be appended to the command line, 1603difference between the two is that LIBS will be appended to the command line,
1609while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF 1604while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1610machines depending on the setting of USE_IMAKE or the inclusion of mk/ 1605machines depending on the setting of USE_IMAKE or the inclusion of mk/
1611x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these 1606x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1612settings, use the += operator: 1607settings, use the += operator:
1613 1608
1614LDFLAGS+= -your -linkerflags 1609LDFLAGS+= -your -linkerflags
1615 1610
16166.5. Developer/advanced settings 16116.5. Developer/advanced settings
1617 1612
1618 * PKG_DEVELOPER: Run some sanity checks that package developers want: 1613 * PKG_DEVELOPER: Run some sanity checks that package developers want:
1619 1614
1620 + make sure patches apply with zero fuzz 1615 + make sure patches apply with zero fuzz
1621 1616
1622 + run check-shlibs to see that all binaries will find their shared libs. 1617 + run check-shlibs to see that all binaries will find their shared libs.
1623 1618
1624 * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst 1619 * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1625 making and installing the package. The default value for this is 0, which 1620 making and installing the package. The default value for this is 0, which
1626 will not display the commands as they are executed (normal, default, quiet 1621 will not display the commands as they are executed (normal, default, quiet
1627 operation); the value 1 will display all shell commands before their 1622 operation); the value 1 will display all shell commands before their
1628 invocation, and the value 2 will display both the shell commands before 1623 invocation, and the value 2 will display both the shell commands before
1629 their invocation, as well as their actual execution progress with set -x. 1624 their invocation, as well as their actual execution progress with set -x.
1630 1625
16316.6. Selecting Build Options 16266.6. Selecting Build Options
1632 1627
1633Some packages have build time options, usually to select between different 1628Some packages have build time options, usually to select between different
1634dependencies, enable optional support for big dependencies or enable 1629dependencies, enable optional support for big dependencies or enable
1635experimental features. 1630experimental features.
1636 1631
1637To see which options, if any, a package supports, and which options are 1632To see which options, if any, a package supports, and which options are
1638mutually exclusive, run make show-options, for example: 1633mutually exclusive, run make show-options, for example:
1639 1634
1640 The following options are supported by this package: 1635 The following options are supported by this package:
1641 ssl Enable SSL support. 1636 ssl Enable SSL support.
1642 Exactly one of the following gecko options is required: 1637 Exactly one of the following gecko options is required:
1643 firefox Use firefox as gecko rendering engine. 1638 firefox Use firefox as gecko rendering engine.
1644 mozilla Use mozilla as gecko rendering engine. 1639 mozilla Use mozilla as gecko rendering engine.
1645 At most one of the following database options may be selected: 1640 At most one of the following database options may be selected:
1646 mysql Enable support for MySQL database. 1641 mysql Enable support for MySQL database.
1647 pgsql Enable support for PostgreSQL database. 1642 pgsql Enable support for PostgreSQL database.
1648 1643
1649 These options are enabled by default: firefox 1644 These options are enabled by default: firefox
1650 These options are currently enabled: mozilla ssl 1645 These options are currently enabled: mozilla ssl
1651 1646
1652The following variables can be defined in mk.conf to select which options to 1647The following variables can be defined in mk.conf to select which options to
1653enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or 1648enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1654disable options for all packages that support them, and PKG_OPTIONS.pkgbase, 1649disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1655which can be used to select or disable options specifically for package pkgbase 1650which can be used to select or disable options specifically for package pkgbase
1656. Options listed in these variables are selected, options preceded by "-" are 1651. Options listed in these variables are selected, options preceded by "-" are
1657disabled. A few examples: 1652disabled. A few examples:
1658 1653
1659$ grep "PKG.*OPTION" mk.conf 1654$ grep "PKG.*OPTION" mk.conf
1660PKG_DEFAULT_OPTIONS= -arts -dvdread -esound 1655PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1661PKG_OPTIONS.kdebase= debug -sasl 1656PKG_OPTIONS.kdebase= debug -sasl
1662PKG_OPTIONS.apache= suexec 1657PKG_OPTIONS.apache= suexec
1663 1658
1664It is important to note that options that were specifically suggested by the 1659It is important to note that options that were specifically suggested by the
1665package maintainer must be explicitly removed if you do not wish to include the 1660package maintainer must be explicitly removed if you do not wish to include the
1666option. If you are unsure you can view the current state with make show-options 1661option. If you are unsure you can view the current state with make show-options
1667. 1662.
1668 1663
1669The following settings are consulted in the order given, and the last setting 1664The following settings are consulted in the order given, and the last setting
1670that selects or disables an option is used: 1665that selects or disables an option is used:
1671 1666
1672 1. the default options as suggested by the package maintainer 1667 1. the default options as suggested by the package maintainer
1673 1668
1674 2. the options implied by the settings of legacy variables (see below) 1669 2. the options implied by the settings of legacy variables (see below)
1675 1670
1676 3. PKG_DEFAULT_OPTIONS 1671 3. PKG_DEFAULT_OPTIONS
1677 1672
1678 4. PKG_OPTIONS.pkgbase 1673 4. PKG_OPTIONS.pkgbase
1679 1674
1680For groups of mutually exclusive options, the last option selected is used, all 1675For groups of mutually exclusive options, the last option selected is used, all
1681others are automatically disabled. If an option of the group is explicitly 1676others are automatically disabled. If an option of the group is explicitly
1682disabled, the previously selected option, if any, is used. It is an error if no 1677disabled, the previously selected option, if any, is used. It is an error if no
1683option from a required group of options is selected, and building the package 1678option from a required group of options is selected, and building the package
1684will fail. 1679will fail.
1685 1680
1686Before the options framework was introduced, build options were selected by 1681Before the options framework was introduced, build options were selected by
1687setting a variable (often named USE_FOO) in mk.conf for each option. To ease 1682setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1688transition to the options framework for the user, these legacy variables are 1683transition to the options framework for the user, these legacy variables are
1689converted to the appropriate options setting (PKG_OPTIONS.pkgbase) 1684converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1690automatically. A warning is issued to prompt the user to update mk.conf to use 1685automatically. A warning is issued to prompt the user to update mk.conf to use
1691the options framework directly. Support for the legacy variables will be 1686the options framework directly. Support for the legacy variables will be
1692removed eventually. 1687removed eventually.
1693 1688
1694Chapter 7. Creating binary packages 1689Chapter 7. Creating binary packages
1695 1690
1696Table of Contents 1691Table of Contents
1697 1692
16987.1. Building a single binary package 16937.1. Building a single binary package
16997.2. Settings for creation of binary packages 16947.2. Settings for creation of binary packages
1700 1695
17017.1. Building a single binary package 16967.1. Building a single binary package
1702 1697
1703Once you have built and installed a package, you can create a binary package 1698Once you have built and installed a package, you can create a binary package
1704which can be installed on another system with pkg_add(1). This saves having to 1699which can be installed on another system with pkg_add(1). This saves having to
1705build the same package on a group of hosts and wasting CPU time. It also 1700build the same package on a group of hosts and wasting CPU time. It also
1706provides a simple means for others to install your package, should you 1701provides a simple means for others to install your package, should you
1707distribute it. 1702distribute it.
1708 1703
1709To create a binary package, change into the appropriate directory in pkgsrc, 1704To create a binary package, change into the appropriate directory in pkgsrc,
1710and run make package: 1705and run make package:
1711 1706
1712$ cd misc/figlet 1707$ cd misc/figlet
1713$ make package 1708$ make package
1714 1709
1715This will build and install your package (if not already done), and then build 1710This will build and install your package (if not already done), and then build
1716a binary package from what was installed. You can then use the pkg_* tools to 1711a binary package from what was installed. You can then use the pkg_* tools to
1717manipulate it. Binary packages are created by default in /usr/pkgsrc/packages, 1712manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1718in the form of a gzipped tar file. See Section B.2, "Packaging figlet" for a 1713in the form of a gzipped tar file. See Section B.2, "Packaging figlet" for a
1719continuation of the above misc/figlet example. 1714continuation of the above misc/figlet example.
1720 1715
1721See Chapter 23, Submitting and Committing for information on how to submit such 1716See Chapter 23, Submitting and Committing for information on how to submit such
1722a binary package. 1717a binary package.
1723 1718
17247.2. Settings for creation of binary packages 17197.2. Settings for creation of binary packages
1725 1720
1726See Section 19.17, "Other helpful targets". 1721See Section 19.17, "Other helpful targets".
1727 1722
1728Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds) 1723Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1729 1724
1730Table of Contents 1725Table of Contents
1731 1726
17328.1. Preparations 17278.1. Preparations
17338.2. Running a pbulk-style bulk build 17288.2. Running a pbulk-style bulk build
1734 1729
1735 8.2.1. Configuration 1730 8.2.1. Configuration
1736 1731
17378.3. Requirements of a full bulk build 17328.3. Requirements of a full bulk build
17388.4. Bulk build variants 17338.4. Bulk build variants
1739 1734
1740 8.4.1. Strict SUBST blocks 1735 8.4.1. Detect unknown configure options
1741 8.4.2. Detect unknown configure options 1736 8.4.2. Detect classes of bugs by forcing compiler warnings
1742 8.4.3. Detect classes of bugs by forcing compiler warnings 1737 8.4.3. Use custom directories
1743 8.4.4. Use custom directories 1738 8.4.4. Turn warnings into errors
1744 8.4.5. Turn warnings into errors 1739 8.4.5. Reject packages for which pkglint reports errors
1745 8.4.6. Reject packages for which pkglint reports errors 1740 8.4.6. Reject packages that contain forbidden strings
1746 8.4.7. Reject packages that contain forbidden strings 1741 8.4.7. Reject packages whose self-test fails
1747 8.4.8. Reject packages whose self-test fails 1742 8.4.8. Reject packages that use undefined shell variables
1748 8.4.9. Reject packages that use undefined shell variables 1743 8.4.9. Turn off verbose logging
1749 8.4.10. Turn off verbose logging 
1750 8.4.11. Select random sets of options 
1751 8.4.12. Select random configurations of BUILD_DEFS 
1752 1744
17538.5. Creating a multiple CD-ROM packages collection 17458.5. Creating a multiple CD-ROM packages collection
1754 1746
1755 8.5.1. Example of cdpack 1747 8.5.1. Example of cdpack
1756 1748
1757For a number of reasons, you may want to build binary packages for a large 1749For a number of reasons, you may want to build binary packages for a large
1758selected set of packages in pkgsrc, or even for all pkgsrc packages. For 1750selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1759instance, when you have multiple machines that should run the same software, it 1751instance, when you have multiple machines that should run the same software, it
1760is wasted time if they all build their packages themselves from source. Or you 1752is wasted time if they all build their packages themselves from source. Or you
1761may want to build a list of packages you want and check them before deploying 1753may want to build a list of packages you want and check them before deploying
1762onto production systems. There is a way of getting a set of binary packages: 1754onto production systems. There is a way of getting a set of binary packages:
1763the bulk build system, or pbulk ("p" stands for "parallel"). This chapter 1755the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1764describes how to set it up. 1756describes how to set it up.
1765 1757
17668.1. Preparations 17588.1. Preparations
1767 1759
1768First of all, you have to decide whether you build all packages or a limited 1760First of all, you have to decide whether you build all packages or a limited
1769set of them. Full bulk builds usually consume a lot more resources, both space 1761set of them. Full bulk builds usually consume a lot more resources, both space
1770and time, than builds for some practical sets of packages. A number of 1762and time, than builds for some practical sets of packages. A number of
1771particularly heavy packages exist that are not actually interesting to a wide 1763particularly heavy packages exist that are not actually interesting to a wide
1772audience. (The approximate resource consumption for a full bulk build is given 1764audience. (The approximate resource consumption for a full bulk build is given
1773in section Section 8.3, "Requirements of a full bulk build".) For limited bulk 1765in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1774builds you need to make a list of packages you want to build. Note that all 1766builds you need to make a list of packages you want to build. Note that all
1775their dependencies will be built, so you don't need to track them manually. 1767their dependencies will be built, so you don't need to track them manually.
1776 1768
1777During bulk builds various packages are installed and deinstalled in /usr/pkg 1769During bulk builds various packages are installed and deinstalled in /usr/pkg
1778(or whatever LOCALBASE is), so make sure that you don't need any package during 1770(or whatever LOCALBASE is), so make sure that you don't need any package during
1779the builds. Essentially, you should provide a fresh system, either a chroot 1771the builds. Essentially, you should provide a fresh system, either a chroot
1780environment or something even more restrictive, depending on what the operating 1772environment or something even more restrictive, depending on what the operating
1781system provides, or dedicate the whole physical machine. As a useful side 1773system provides, or dedicate the whole physical machine. As a useful side
1782effect this makes sure that bulk builds cannot break anything in your system. 1774effect this makes sure that bulk builds cannot break anything in your system.
1783There have been numerous cases where certain packages tried to install files 1775There have been numerous cases where certain packages tried to install files
1784outside the LOCALBASE or wanted to edit some files in /etc. 1776outside the LOCALBASE or wanted to edit some files in /etc.
1785 1777
17868.2. Running a pbulk-style bulk build 17788.2. Running a pbulk-style bulk build
1787 1779
1788Running a pbulk-style bulk build works roughly as follows: 1780Running a pbulk-style bulk build works roughly as follows:
1789 1781
1790 * First, build the pbulk infrastructure in a fresh pkgsrc location. 1782 * First, build the pbulk infrastructure in a fresh pkgsrc location.
1791 1783
1792 * Then, build each of the packages from a clean installation directory using 1784 * Then, build each of the packages from a clean installation directory using
1793 the infrastructure. 1785 the infrastructure.
1794 1786
17958.2.1. Configuration 17878.2.1. Configuration
1796 1788
1797To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh. 1789To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1798 1790
1799In order to use it, prepare a clear system (real one, chroot environment, jail, 1791In order to use it, prepare a clear system (real one, chroot environment, jail,
1800zone, virtual machine). Configure network access to fetch distribution files. 1792zone, virtual machine). Configure network access to fetch distribution files.
1801Create a user with name "pbulk". 1793Create a user with name "pbulk".
1802 1794
1803Fetch and extract pkgsrc. Use a command like one of these: 1795Fetch and extract pkgsrc. Use a command like one of these:
1804 1796
1805# (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-) 1797# (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1806# (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-) 1798# (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1807# (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc) 1799# (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1808 1800
1809Or any other way that fits (e.g., curl, wget). 1801Or any other way that fits (e.g., curl, wget).
1810 1802
1811Deploy and configure pbulk tools, e.g.: 1803Deploy and configure pbulk tools, e.g.:
1812 1804
1813# sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD) 1805# sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1814# sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment 1806# sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1815# sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build 1807# sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1816 1808
1817Note 1809Note
1818 1810
1819mk.conf.frag is a fragment of mk.conf that contains settings you want to apply 1811mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1820to packages you build. For instance, 1812to packages you build. For instance,
1821 1813
1822PKG_DEVELOPER= yes # perform more checks 1814PKG_DEVELOPER= yes # perform more checks
1823X11_TYPE= modular # use pkgsrc X11 1815X11_TYPE= modular # use pkgsrc X11
1824SKIP_LICENSE_CHECK= yes # accept all licences (useful 1816SKIP_LICENSE_CHECK= yes # accept all licences (useful
1825 # when building all packages) 1817 # when building all packages)
1826 1818
1827If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list 1819If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1828with your list of packages, one per line without empty lines or comments. E.g.: 1820with your list of packages, one per line without empty lines or comments. E.g.:
1829 1821
1830www/firefox 1822www/firefox
1831mail/thunderbird 1823mail/thunderbird
1832misc/libreoffice4 1824misc/libreoffice4
1833 1825
1834At this point you can also review configuration in /usr/pbulk/etc and make 1826At this point you can also review configuration in /usr/pbulk/etc and make
1835final amendments, if wanted. 1827final amendments, if wanted.
1836 1828
1837Start it: 1829Start it:
1838 1830
1839# /usr/pbulk/bin/bulkbuild 1831# /usr/pbulk/bin/bulkbuild
1840 1832
1841After it finishes, you'll have /mnt filled with distribution files, binary 1833After it finishes, you'll have /mnt filled with distribution files, binary
1842packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt 1834packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1843 1835
1844Note 1836Note
1845 1837
1846The pbulk.sh script does not cover all possible use cases. While being ready to 1838The pbulk.sh script does not cover all possible use cases. While being ready to
1847run, it serves as a good starting point to understand and build more complex 1839run, it serves as a good starting point to understand and build more complex
1848setups. The script is kept small enough for better understanding. 1840setups. The script is kept small enough for better understanding.
1849 1841
1850Note 1842Note
1851 1843
1852The pbulk.sh script supports running unprivileged bulk build and helps 1844The pbulk.sh script supports running unprivileged bulk build and helps
1853configuring distributed bulk builds. 1845configuring distributed bulk builds.
1854 1846
18558.3. Requirements of a full bulk build 18478.3. Requirements of a full bulk build
1856 1848
1857A complete bulk build requires lots of disk space. Some of the disk space can 1849A complete bulk build requires lots of disk space. Some of the disk space can
1858be read-only, some other must be writable. Some can be on remote filesystems 1850be read-only, some other must be writable. Some can be on remote filesystems
1859(such as NFS) and some should be local. Some can be temporary filesystems, 1851(such as NFS) and some should be local. Some can be temporary filesystems,
1860others must survive a sudden reboot. 1852others must survive a sudden reboot.
1861 1853
1862 * 40 GB for the distfiles (read-write, remote, temporary) 1854 * 40 GB for the distfiles (read-write, remote, temporary)
1863 1855
1864 * 30 GB for the binary packages (read-write, remote, permanent) 1856 * 30 GB for the binary packages (read-write, remote, permanent)
1865 1857
1866 * 1 GB for the pkgsrc tree (read-only, remote, permanent) 1858 * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1867 1859
1868 * 5 GB for LOCALBASE (read-write, local, temporary) 1860 * 5 GB for LOCALBASE (read-write, local, temporary)
1869 1861
1870 * 10 GB for the log files (read-write, remote, permanent) 1862 * 10 GB for the log files (read-write, remote, permanent)
1871 1863
1872 * 5 GB for temporary files (read-write, local, temporary) 1864 * 5 GB for temporary files (read-write, local, temporary)
1873 1865
18748.4. Bulk build variants 18668.4. Bulk build variants
1875 1867
1876To ensure that pkgsrc packages work in different configurations, it makes sense 1868To ensure that pkgsrc packages work in different configurations, it makes sense
1877to run non-default bulk builds from time to time. This section lists some ideas 1869to run non-default bulk builds from time to time. This section lists some ideas
1878for bulk builds that intentionally let packages fail if they don't follow the 1870for bulk builds that intentionally let packages fail if they don't follow the
1879pkgsrc style. 1871pkgsrc style.
1880 1872
18818.4.1. Strict SUBST blocks 18738.4.1. Detect unknown configure options
1882 
1883Up to May 2020, the SUBST blocks ignored files that didn't exist, as well as 
1884substitutions that didn't have any effect. There were quite a few SUBST blocks 
1885that were redundant, and these have been removed already. 
1886 
1887The next step would be to not only check that each filename pattern has an 
1888effect but also that each substitution in SUBST_SED or SUBST_VARS applies to at 
1889least one file. 
1890 
1891To do this, mk/subst.mk would have to be adjusted, in a similar way as the 
1892check for no-op SUBST_FILES. There are several regression tests in regress/ 
1893infra-unittests that help to get all edge cases correct. 
1894 
1895When a package fails this additional check, there are various possible causes 
1896why the SUBST_SED became a no-op. 
1897 
1898 1. The pattern used to be found in a former version of the package, but is not 
1899 needed anymore. In that case, just remove it. 
1900 
1901 2. The pattern contains a typo. In that case, fix the typo and bump 
1902 PKGREVISION, since the fixed typo will probably modify the resulting binary 
1903 package. 
1904 
1905 3. There is a patch that is applied before the SUBST block, and the patch 
1906 accidentally contains the change that was intended for the SUBST block. In 
1907 that case, remove the respective hunk from the patch. 
1908 
19098.4.2. Detect unknown configure options 
1910 1874
1911Add the following line to mk.conf. 1875Add the following line to mk.conf.
1912 1876
1913GNU_CONFIGURE_STRICT= yes 1877GNU_CONFIGURE_STRICT= yes
1914 1878
1915When a package fails this additional check, the most common cause is that the 1879When a package fails this additional check, the most common cause is that the
1916configure option was valid for an older version of the package but does not 1880configure option was valid for an older version of the package but does not
1917apply anymore. In that case, just remove it. 1881apply anymore. In that case, just remove it.
1918 1882
19198.4.3. Detect classes of bugs by forcing compiler warnings 18838.4.2. Detect classes of bugs by forcing compiler warnings
1920 1884
1921The job of a compiler is not restricted to producing executable code, most 1885The job of a compiler is not restricted to producing executable code, most
1922compilers also detects typical mistakes. 1886compilers also detect typical programming mistakes. The pkgsrc compiler
 1887wrappers make it easy to force compiler options when the package is built. This
 1888can be used to find typical bugs across all packages that are in pkgsrc. By
 1889reporting these bugs upstream, the packages will be more reliable with the next
 1890updates.
1923 1891
1924Add the following line to mk.conf. 1892Add some of the following lines to mk.conf:
1925 1893
1926CFLAGS+= -Werror=char-subscripts 1894CFLAGS+= -Werror=char-subscripts
 1895CFLAGS+= -Werror=implicit-function-declaration
1927 1896
1928When a package fails this additional check, first document the circumstances in 1897When a package fails to build using these stricter compiler options, document
1929which the compiler produced the error message. This includes: 1898the circumstances in which the compiler produced the error message. This
 1899includes:
1930 1900
1931 * The platform (MACHINE_PLATFORM) 1901 * The platform (MACHINE_PLATFORM)
1932 1902
1933 * The source file 1903 * The source file
1934 1904
1935 * An excerpt of the code. GCC and Clang already do this as part of the 1905 * An excerpt of the code. GCC and Clang already do this as part of the
1936 diagnostic. 1906 diagnostic.
1937 1907
1938 * The error message from the compiler. 1908 * The exact error message from the compiler.
1939 1909
1940If a package produces these error messages, but the package is fine, document 1910If a package produces these error messages, but the package is fine, record
1941this in the package Makefile, like this: 1911this in your local mk.conf, like this, to skip this check in the next builds:
1942 1912
 1913.if ${PKGPATH} == category/package
1943# Version ${VERSION} failed on ${MACHINE_PLATFORM}: 1914# Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1944# error message 1915# error message
1945# code 1916# code
1946# reason why the code does not need to be fixed 1917# Reason why the code does not need to be fixed.
1947BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts 1918BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
 1919.endif
1948 1920
1949If the error messages from the compiler are valid and the code needs to be 1921If the error messages from the compiler are valid and the code needs to be
1950fixed, prepare a patch for a single source file, or if it's a one-liner fix, 1922fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1951add a SUBST block to the package Makefile. In any case, report it to the 1923upstream authors of the package, providing them with the information you
1952upstream authors of the package. 1924collected above.
1953 1925
19548.4.4. Use custom directories 1926Patches that are not essential for the package to work should only be reported
 1927upstream but not committed to pkgsrc, to make future updates easier.
 1928
 19298.4.3. Use custom directories
1955 1930
1956Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR 1931Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
1957can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or 1932can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
1958afterwards in mk.conf. 1933afterwards in mk.conf.
1959 1934
1960PREFIX= /a-random-uuid 1935PREFIX= /a-random-uuid
1961PKG_SYSCONFDIR= /a-random-uuid 1936PKG_SYSCONFDIR= /a-random-uuid
1962VARBASE= /a-random-uuid 1937VARBASE= /a-random-uuid
1963PKGMANDIR= a-random-uuid 1938PKGMANDIR= a-random-uuid
1964PKG_INFODIR= a-random-uuid 1939PKG_INFODIR= a-random-uuid
1965 1940
19668.4.5. Turn warnings into errors 19418.4.4. Turn warnings into errors
1967 1942
1968When building a package, warnings are typically ignored since they just flow by 1943When building a package, warnings are typically ignored since they just flow by
1969and do not cause the build to fail immediately. To find these warnings, 1944and do not cause the build to fail immediately. To find these warnings,
1970redefine them to errors in mk.conf. 1945redefine them to errors in mk.conf.
1971 1946
1972DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" 1947DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
1973WARNING_MSG= ${FAIL_MSG} "(was warning)" 1948WARNING_MSG= ${FAIL_MSG} "(was warning)"
1974 1949
1975(There are many more classes of warnings in pkgsrc, and most of them can be 1950(There are many more classes of warnings in pkgsrc, and most of them can be
1976redefined with a simple definition like above. 1951redefined with a simple definition like above.
1977 1952
1978If a package suggest to add USE_TOOLS+=perl to the package Makefile, research 1953If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1979whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the 1954whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
1980package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl. 1955package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
1981 1956
19828.4.6. Reject packages for which pkglint reports errors 19578.4.5. Reject packages for which pkglint reports errors
1983 1958
1984Using pkglint as part of the regular build process is mostly a waste of time. 1959Using pkglint as part of the regular build process is mostly a waste of time.
1985If you want to fix some of the warnings, just run pkglint recursively on the 1960If you want to fix some of the warnings, just run pkglint recursively on the
1986whole pkgsrc tree. This will take a few minutes (up to 10), which is much 1961whole pkgsrc tree. This will take a few minutes (up to 10), which is much
1987faster than a complete bulk build. 1962faster than a complete bulk build.
1988 1963
19898.4.7. Reject packages that contain forbidden strings 19648.4.6. Reject packages that contain forbidden strings
1990 1965
1991To ensure that the binary packages don't contain references to the build 1966To ensure that the binary packages don't contain references to the build
1992directory, there is already CHECK_WRKREF. If that variable includes the item 1967directory, there is already CHECK_WRKREF. If that variable includes the item
1993extra, it is possible to define additional patterns that must not appear in any 1968extra, it is possible to define additional patterns that must not appear in any
1994installed file. This is specified in mk.conf. 1969installed file. This is specified in mk.conf.
1995 1970
1996CHECK_WRKREF= extra 1971CHECK_WRKREF= extra
1997CHECK_WRKREF_EXTRA_DIRS+= /usr/local 1972CHECK_WRKREF_EXTRA_DIRS+= /usr/local
1998CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg 1973CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
1999CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@ 1974CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2000 1975
2001The above patterns will probably generate many false positives, therefore the 1976The above patterns will probably generate many false positives, therefore the
2002results need to be taken with a grain of salt. 1977results need to be taken with a grain of salt.
2003 1978
20048.4.8. Reject packages whose self-test fails 19798.4.7. Reject packages whose self-test fails
2005 1980
2006To run the test suites that come with each package, add this line to mk.conf. 1981To run the test suites that come with each package, add this line to mk.conf.
2007 1982
2008PKGSRC_RUN_TEST= yes 1983PKGSRC_RUN_TEST= yes
2009 1984
2010Be prepared that even the most basic packages fail this test. When doing a bulk 1985Be prepared that even the most basic packages fail this test. When doing a bulk
2011build with this, it will often abort in the early phase where the packages are 1986build with this, it will often abort in the early phase where the packages are
2012scanned for their dependencies since there are cyclic dependencies. There is 1987scanned for their dependencies since there are cyclic dependencies. There is
2013still a lot to do in this area. 1988still a lot to do in this area.
2014 1989
20158.4.9. Reject packages that use undefined shell variables 19908.4.8. Reject packages that use undefined shell variables
2016 1991
2017To catch typos in the shell snippets from the Makefile fragments, add the -u 1992To catch typos in the shell snippets from the Makefile fragments, add the -u
2018flag to most of the commands by adding this line to mk.conf. 1993flag to most of the commands by adding this line to mk.conf.
2019 1994
2020RUN= @set -eu; 1995RUN= @set -eu;
2021 1996
2022See mk/misc/common.mk for the existing definition. 1997See mk/misc/common.mk for the existing definition.
2023 1998
20248.4.10. Turn off verbose logging 19998.4.9. Turn off verbose logging
2025 2000
2026The build logs of a package are often quite long. This allows error messages or 2001The build logs of a package are often quite long. This allows error messages or
2027other interesting details to hide between the noise. To make the actual error 2002other interesting details to hide between the noise. To make the actual error
2028message stand out more, add these lines to mk.conf. 2003message stand out more, add these lines to mk.conf.
2029 2004
2030GNU_CONFIGURE_QUIET= yes 2005GNU_CONFIGURE_QUIET= yes
2031MAKE_FLAGS+= -s 2006MAKE_FLAGS+= -s
2032 2007
2033The -s option works for both GNU Make and BSD Make. On exotic platforms with 2008The -s option works for both GNU Make and BSD Make. On exotic platforms with
2034their own make, it may be a little different. 2009their own make, it may be a little different.
2035 2010
20368.4.11. Select random sets of options 
2037 
2038Most bulk builds run with the default package options. This means that other 
2039combinations of options are not regularly tested. To do this, run a bulk build 
2040with these configurations. 
2041 
2042 * no options enabled 
2043 
2044 * all options enabled 
2045 
2046 * 2n + 0 
2047 
2048 * 2n + 1 
2049 
2050 * 4n + 0..1 
2051 
2052 * 4n + 2..3 
2053 
2054 * 8n + 0..3 
2055 
2056 * 8n + 4..7 
2057 
2058 * 2048n + 0..1023 
2059 
2060 * 2048n + 1024..2047 
2061 
2062Open questions are: 
2063 
2064 * how to collect all options from the entire pkgsrc 
2065 
2066 * how to handle mutually exclusive options 
2067 
2068 * the sets of mutually exclusive options are defined per-package 
2069 
2070 * the sets of nonempty sets are defined per-package 
2071 
20728.4.12. Select random configurations of BUILD_DEFS 
2073 
2074Just like the PKG_OPTIONS, the BUILD_DEFS also allow different variants of 
2075pkgsrc to be created. The same ideas as in Section 8.4.11, "Select random sets 
2076of options" apply. 
2077 
20788.5. Creating a multiple CD-ROM packages collection 20118.5. Creating a multiple CD-ROM packages collection
2079 2012
2080After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set 2013After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2081of the resulting binary packages to assist in installing packages on other 2014of the resulting binary packages to assist in installing packages on other
2082machines. The pkgtools/cdpack package provides a simple tool for creating the 2015machines. The pkgtools/cdpack package provides a simple tool for creating the
2083ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that 2016ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2084keeps all the dependencies for a given package on the same CD as that package. 2017keeps all the dependencies for a given package on the same CD as that package.
2085 2018
20868.5.1. Example of cdpack 20198.5.1. Example of cdpack
2087 2020
2088Complete documentation for cdpack is found in the cdpack(1) man page. The 2021Complete documentation for cdpack is found in the cdpack(1) man page. The
2089following short example assumes that the binary packages are left in /usr/ 2022following short example assumes that the binary packages are left in /usr/
2090pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the 2023pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2091ISO 9660 images. 2024ISO 9660 images.
2092 2025
2093# mkdir /u2/images 2026# mkdir /u2/images
2094# pkg_add /usr/pkgsrc/packages/All/cdpack 2027# pkg_add /usr/pkgsrc/packages/All/cdpack
2095# cdpack /usr/pkgsrc/packages/All /u2/images 2028# cdpack /usr/pkgsrc/packages/All /u2/images
2096 2029
2097 2030
2098If you wish to include a common set of files (COPYRIGHT, README, etc.) on each 2031If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2099CD in the collection, then you need to create a directory which contains these 2032CD in the collection, then you need to create a directory which contains these
2100files, e.g.: 2033files, e.g.:
2101 2034
2102# mkdir /tmp/common 2035# mkdir /tmp/common
2103# echo "This is a README" > /tmp/common/README 2036# echo "This is a README" > /tmp/common/README
2104# echo "Another file" > /tmp/common/COPYING 2037# echo "Another file" > /tmp/common/COPYING
2105# mkdir /tmp/common/bin 2038# mkdir /tmp/common/bin
2106# echo "#!/bin/sh" > /tmp/common/bin/myscript 2039# echo "#!/bin/sh" > /tmp/common/bin/myscript
2107# echo "echo Hello world" >> /tmp/common/bin/myscript 2040# echo "echo Hello world" >> /tmp/common/bin/myscript
2108# chmod 755 /tmp/common/bin/myscript 2041# chmod 755 /tmp/common/bin/myscript
2109 2042
2110 2043
2111Now create the images: 2044Now create the images:
2112 2045
2113# cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images 2046# cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2114 2047
2115Each image will contain README, COPYING, and bin/myscript in their root 2048Each image will contain README, COPYING, and bin/myscript in their root
2116directories. 2049directories.
2117 2050
2118Chapter 9. Directory layout of the installed files 2051Chapter 9. Directory layout of the installed files
2119 2052
2120Table of Contents 2053Table of Contents
2121 2054
21229.1. File system layout in ${LOCALBASE} 20559.1. File system layout in ${LOCALBASE}
21239.2. File system layout in ${VARBASE} 20569.2. File system layout in ${VARBASE}
2124 2057
2125The files that are installed by pkgsrc are organized in a way that is similar 2058The files that are installed by pkgsrc are organized in a way that is similar
2126to what you find in the /usr directory of the base system. But some details are 2059to what you find in the /usr directory of the base system. But some details are
2127different. This is because pkgsrc initially came from FreeBSD and had adopted 2060different. This is because pkgsrc initially came from FreeBSD and had adopted
2128its file system hierarchy. Later it was largely influenced by NetBSD. But no 2061its file system hierarchy. Later it was largely influenced by NetBSD. But no
2129matter which operating system you are using pkgsrc with, you can expect the 2062matter which operating system you are using pkgsrc with, you can expect the
2130same layout for pkgsrc. 2063same layout for pkgsrc.
2131 2064
2132There are mainly four root directories for pkgsrc, which are all configurable 2065There are mainly four root directories for pkgsrc, which are all configurable
2133in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the 2066in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2134default locations are: 2067default locations are:
2135 2068
2136LOCALBASE= /usr/pkg 2069LOCALBASE= /usr/pkg
2137PKG_SYSCONFBASE= /usr/pkg/etc 2070PKG_SYSCONFBASE= /usr/pkg/etc
2138VARBASE= /var 2071VARBASE= /var
2139PKG_DBDIR= /usr/pkg/pkgdb 2072PKG_DBDIR= /usr/pkg/pkgdb
2140 2073
2141In unprivileged mode (when pkgsrc has been installed as any other user), the 2074In unprivileged mode (when pkgsrc has been installed as any other user), the
2142default locations are: 2075default locations are:
2143 2076
2144LOCALBASE= ${HOME}/pkg 2077LOCALBASE= ${HOME}/pkg
2145PKG_SYSCONFBASE= ${HOME}/pkg/etc 2078PKG_SYSCONFBASE= ${HOME}/pkg/etc
2146VARBASE= ${HOME}/pkg/var 2079VARBASE= ${HOME}/pkg/var
2147PKG_DBDIR= ${HOME}/pkg/pkgdb 2080PKG_DBDIR= ${HOME}/pkg/pkgdb
2148 2081
2149What these four directories are for, and what they look like is explained 2082What these four directories are for, and what they look like is explained
2150below. 2083below.
2151 2084
2152 * LOCALBASE corresponds to the /usr directory in the base system. It is the " 2085 * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2153 main" directory where the files are installed and contains the well-known 2086 main" directory where the files are installed and contains the well-known
2154 subdirectories like bin, include, lib, share and sbin. 2087 subdirectories like bin, include, lib, share and sbin.
2155 2088
2156 * VARBASE corresponds to /var in the base system. Some programs (especially 2089 * VARBASE corresponds to /var in the base system. Some programs (especially
2157 games, network daemons) need write access to it during normal operation. 2090 games, network daemons) need write access to it during normal operation.
2158 2091
2159 * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains 2092 * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2160 configuration files of the packages, as well as pkgsrc's mk.conf itself. 2093 configuration files of the packages, as well as pkgsrc's mk.conf itself.
2161 2094
21629.1. File system layout in ${LOCALBASE} 20959.1. File system layout in ${LOCALBASE}
2163 2096
2164The following directories exist in a typical pkgsrc installation in $ 2097The following directories exist in a typical pkgsrc installation in $
2165{LOCALBASE}. 2098{LOCALBASE}.
2166 2099
2167bin 2100bin
2168 2101
2169 Contains executable programs that are intended to be directly used by the 2102 Contains executable programs that are intended to be directly used by the
2170 end user. 2103 end user.
2171 2104
2172emul 2105emul
2173 2106
2174 Contains files for the emulation layers of various other operating systems, 2107 Contains files for the emulation layers of various other operating systems,
2175 especially for NetBSD. 2108 especially for NetBSD.
2176 2109
2177etc (the usual location of ${PKG_SYSCONFDIR}) 2110etc (the usual location of ${PKG_SYSCONFDIR})
2178 2111
2179 Contains the configuration files. 2112 Contains the configuration files.
2180 2113
2181include 2114include
2182 2115
2183 Contains headers for the C and C++ programming languages. 2116 Contains headers for the C and C++ programming languages.
2184 2117
2185info 2118info
2186 2119
2187 Contains GNU info files of various packages. 2120 Contains GNU info files of various packages.
2188 2121
2189lib 2122lib
2190 2123
2191 Contains shared and static libraries. 2124 Contains shared and static libraries.
2192 2125
2193libdata 2126libdata
2194 2127
2195 Contains data files that don't change after installation. Other data files 2128 Contains data files that don't change after installation. Other data files
2196 belong into ${VARBASE}. 2129 belong into ${VARBASE}.
2197 2130
2198libexec 2131libexec
2199 2132
2200 Contains programs that are not intended to be used by end users, such as 2133 Contains programs that are not intended to be used by end users, such as
2201 helper programs or network daemons. 2134 helper programs or network daemons.
2202 2135
2203libexec/cgi-bin 2136libexec/cgi-bin
2204 2137
2205 Contains programs that are intended to be executed as CGI scripts by a web 2138 Contains programs that are intended to be executed as CGI scripts by a web
2206 server. 2139 server.
2207 2140
2208man (the usual value of ${PKGMANDIR}) 2141man (the usual value of ${PKGMANDIR})
2209 2142
2210 Contains brief documentation in form of manual pages. 2143 Contains brief documentation in form of manual pages.
2211 2144
2212sbin 2145sbin
2213 2146
2214 Contains programs that are intended to be used only by the super-user. 2147 Contains programs that are intended to be used only by the super-user.
2215 2148
2216share 2149share
2217 2150
2218 Contains platform-independent data files that don't change after 2151 Contains platform-independent data files that don't change after
2219 installation. 2152 installation.
2220 2153
2221share/doc 2154share/doc
2222 2155
2223 Contains documentation files provided by the packages. 2156 Contains documentation files provided by the packages.
2224 2157
2225share/examples 2158share/examples
2226 2159
2227 Contains example files provided by the packages. Among others, the original 2160 Contains example files provided by the packages. Among others, the original
2228 configuration files are saved here and copied to ${PKG_SYSCONFDIR} during 2161 configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2229 installation. 2162 installation.
2230 2163
2231share/examples/rc.d 2164share/examples/rc.d
2232 2165
2233 Contains the original files for rc.d scripts. 2166 Contains the original files for rc.d scripts.
2234 2167
2235var (the usual location of ${VARBASE}) 2168var (the usual location of ${VARBASE})
2236 2169
2237 Contains files that may be modified after installation. 2170 Contains files that may be modified after installation.
2238 2171
22399.2. File system layout in ${VARBASE} 21729.2. File system layout in ${VARBASE}
2240 2173
2241db/pkg (the usual location of ${PKG_DBDIR}) 2174db/pkg (the usual location of ${PKG_DBDIR})
2242 2175
2243 Contains information about the currently installed packages. 2176 Contains information about the currently installed packages.
2244 2177
2245games 2178games
2246 2179
2247 Contains highscore files. 2180 Contains highscore files.
2248 2181
2249log 2182log
2250 2183
2251 Contains log files. 2184 Contains log files.
2252 2185
2253run 2186run
2254 2187
2255 Contains informational files about daemons that are currently running. 2188 Contains informational files about daemons that are currently running.
2256 2189
2257Chapter 10. Frequently Asked Questions 2190Chapter 10. Frequently Asked Questions
2258 2191
2259Table of Contents 2192Table of Contents
2260 2193
226110.1. Are there any mailing lists for pkg-related discussion? 219410.1. Are there any mailing lists for pkg-related discussion?
226210.2. Utilities for package management (pkgtools) 219510.2. Utilities for package management (pkgtools)
226310.3. How to use pkgsrc as non-root 219610.3. How to use pkgsrc as non-root
226410.4. How to resume transfers when fetching distfiles? 219710.4. How to resume transfers when fetching distfiles?
226510.5. How can I install/use modular X.org from pkgsrc? 219810.5. How can I install/use modular X.org from pkgsrc?
226610.6. How to fetch files from behind a firewall 219910.6. How to fetch files from behind a firewall
226710.7. How to fetch files from HTTPS sites 220010.7. How to fetch files from HTTPS sites
226810.8. How do I tell make fetch to do passive FTP? 220110.8. How do I tell make fetch to do passive FTP?
226910.9. How to fetch all distfiles at once 220210.9. How to fetch all distfiles at once
227010.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean? 220310.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
227110.11. What does "Could not find bsd.own.mk" mean? 220410.11. What does "Could not find bsd.own.mk" mean?
227210.12. Using 'sudo' with pkgsrc 220510.12. Using 'sudo' with pkgsrc
227310.13. How do I change the location of configuration files? 220610.13. How do I change the location of configuration files?
227410.14. Automated security checks 220710.14. Automated security checks
227510.15. Why do some packages ignore my CFLAGS? 220810.15. Why do some packages ignore my CFLAGS?
227610.16. A package does not build. What shall I do? 220910.16. A package does not build. What shall I do?
227710.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge 221010.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
2278 conflicts" mean? 2211 conflicts" mean?
2279 2212
2280This section contains hints, tips & tricks on special things in pkgsrc that we 2213This section contains hints, tips & tricks on special things in pkgsrc that we
2281didn't find a better place for in the previous chapters, and it contains items 2214didn't find a better place for in the previous chapters, and it contains items
2282for both pkgsrc users and developers. 2215for both pkgsrc users and developers.
2283 2216
228410.1. Are there any mailing lists for pkg-related discussion? 221710.1. Are there any mailing lists for pkg-related discussion?
2285 2218
2286The following mailing lists may be of interest to pkgsrc users: 2219The following mailing lists may be of interest to pkgsrc users:
2287 2220
2288 * pkgsrc-users: This is a general purpose list for most issues regarding 2221 * pkgsrc-users: This is a general purpose list for most issues regarding
2289 pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc 2222 pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2290 configuration, unexpected build failures, using particular packages, 2223 configuration, unexpected build failures, using particular packages,
2291 upgrading pkgsrc installations, questions regarding the pkgsrc release 2224 upgrading pkgsrc installations, questions regarding the pkgsrc release
2292 branches, etc. General announcements or proposals for changes that impact 2225 branches, etc. General announcements or proposals for changes that impact
2293 the pkgsrc user community, e.g. major infrastructure changes, new features, 2226 the pkgsrc user community, e.g. major infrastructure changes, new features,
2294 package removals, etc., may also be posted. 2227 package removals, etc., may also be posted.
2295 2228
2296 * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and 2229 * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2297 discussed. 2230 discussed.
2298 2231
2299 * pkgsrc-changes: This list is for those who are interested in getting a 2232 * pkgsrc-changes: This list is for those who are interested in getting a
2300 commit message for every change committed to pkgsrc. It is also available 2233 commit message for every change committed to pkgsrc. It is also available
2301 in digest form, meaning one daily message containing all commit messages 2234 in digest form, meaning one daily message containing all commit messages
2302 for changes to the package source tree in that 24 hour period. 2235 for changes to the package source tree in that 24 hour period.
2303 2236
2304To subscribe, do: 2237To subscribe, do:
2305 2238
2306% echo subscribe listname | mail majordomo@NetBSD.org 2239% echo subscribe listname | mail majordomo@NetBSD.org
2307 2240
2308Archives for all these mailing lists are available from https:// 2241Archives for all these mailing lists are available from https://
2309mail-index.NetBSD.org/. 2242mail-index.NetBSD.org/.
2310 2243
231110.2. Utilities for package management (pkgtools) 224410.2. Utilities for package management (pkgtools)
2312 2245
2313The directory pkgsrc/pkgtools contains a number of useful utilities for both 2246The directory pkgsrc/pkgtools contains a number of useful utilities for both
2314users and developers of pkgsrc. This section attempts only to make the reader 2247users and developers of pkgsrc. This section attempts only to make the reader
2315aware of some of the utilities and when they might be useful, and not to 2248aware of some of the utilities and when they might be useful, and not to
2316duplicate the documentation that comes with each package. 2249duplicate the documentation that comes with each package.
2317 2250
2318Utilities used by pkgsrc (automatically installed when needed): 2251Utilities used by pkgsrc (automatically installed when needed):
2319 2252
2320 * pkgtools/x11-links: Symlinks for use by buildlink. 2253 * pkgtools/x11-links: Symlinks for use by buildlink.
2321 2254
2322OS tool augmentation (automatically installed when needed): 2255OS tool augmentation (automatically installed when needed):
2323 2256
2324 * pkgtools/digest: Calculates various kinds of checksums (including SHA3). 2257 * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
2325 2258
2326 * pkgtools/libnbcompat: Compatibility library for pkgsrc tools. 2259 * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2327 2260
2328 * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree. 2261 * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2329 2262
2330 * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or 2263 * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2331 for use on operating systems where pkg_install is not present. 2264 for use on operating systems where pkg_install is not present.
2332 2265
2333Utilities used by pkgsrc (not automatically installed): 2266Utilities used by pkgsrc (not automatically installed):
2334 2267
2335 * pkgtools/pkg_tarup: Create a binary package from an already-installed 2268 * pkgtools/pkg_tarup: Create a binary package from an already-installed
2336 package. Used by make replace to save the old package. 2269 package. Used by make replace to save the old package.
2337 2270
2338 * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch 2271 * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2339 distfiles from multiple locations. It currently supports the following 2272 distfiles from multiple locations. It currently supports the following
2340 methods: multiple CD-ROMs and network FTP/HTTP connections. 2273 methods: multiple CD-ROMs and network FTP/HTTP connections.
2341 2274
2342 * devel/cpuflags: Determine the best compiler flags to optimise code for your 2275 * devel/cpuflags: Determine the best compiler flags to optimise code for your
2343 current CPU and compiler. 2276 current CPU and compiler.
2344 2277
2345Utilities for keeping track of installed packages, being up to date, etc: 2278Utilities for keeping track of installed packages, being up to date, etc:
2346 2279
2347 * pkgtools/pkgin: A package update tool similar to apt(1). Download, install, 2280 * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2348 and upgrade binary packages easily. 2281 and upgrade binary packages easily.
2349 2282
2350 * pkgtools/pkg_chk: Reports on packages whose installed versions do not match 2283 * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2351 the latest pkgsrc entries. 2284 the latest pkgsrc entries.
2352 2285
2353 * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a 2286 * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2354 strategy for updating. 2287 strategy for updating.
2355 2288
2356 * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses 2289 * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2357 graphviz). 2290 graphviz).
2358 2291
2359 * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors. 2292 * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2360 2293
2361 * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the 2294 * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2362 complete pkgsrc system. 2295 complete pkgsrc system.
2363 2296
2364 * pkgtools/pkgsurvey: Report what packages you have installed. 2297 * pkgtools/pkgsurvey: Report what packages you have installed.
2365 2298
2366Utilities for people maintaining or creating individual packages: 2299Utilities for people maintaining or creating individual packages:
2367 2300
2368 * pkgtools/pkgdiff: Automate making and maintaining patches for a package 2301 * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2369 (includes pkgdiff, pkgvi, mkpatches, etc.). 2302 (includes pkgdiff, pkgvi, mkpatches, etc.).
2370 2303
2371 * pkgtools/url2pkg: Aids in converting to pkgsrc. 2304 * pkgtools/url2pkg: Aids in converting to pkgsrc.
2372 2305
2373Utilities for people maintaining pkgsrc (or: more obscure pkg utilities) 2306Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2374 2307
2375 * pkgtools/pkg_comp: Build packages in a chrooted area. 2308 * pkgtools/pkg_comp: Build packages in a chrooted area.
2376 2309
2377 * pkgtools/libkver: Spoof kernel version for chrooted cross builds. 2310 * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2378 2311
237910.3. How to use pkgsrc as non-root 231210.3. How to use pkgsrc as non-root
2380 2313
2381To install packages from source as a non-root user, download pkgsrc as 2314To install packages from source as a non-root user, download pkgsrc as
2382described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd 2315described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
2383into that directory and run the command ./bootstrap/bootstrap --unprivileged. 2316into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2384 2317
2385This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc 2318This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2386configuration mk.conf into ~/pkg/etc. 2319configuration mk.conf into ~/pkg/etc.
2387 2320
2388For more details, see mk/unprivileged.mk. 2321For more details, see mk/unprivileged.mk.
2389 2322
239010.4. How to resume transfers when fetching distfiles? 232310.4. How to resume transfers when fetching distfiles?
2391 2324
2392By default, resuming transfers in pkgsrc is disabled, but you can enable this 2325By default, resuming transfers in pkgsrc is disabled, but you can enable this
2393feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during 2326feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2394a fetch step, an incomplete distfile is found, pkgsrc will try to resume it. 2327a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
2395 2328
2396You can also use a different program than the platform default program by 2329You can also use a different program than the platform default program by
2397changing the FETCH_USING variable. You can specify the program by using of ftp, 2330changing the FETCH_USING variable. You can specify the program by using of ftp,
2398fetch, wget or curl. Alternatively, fetching can be disabled by using the value 2331fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2399manual. A value of custom disables the system defaults and dependency tracking 2332manual. A value of custom disables the system defaults and dependency tracking
2400for the fetch program. In that case you have to provide FETCH_CMD, 2333for the fetch program. In that case you have to provide FETCH_CMD,
2401FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS. 2334FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
2402 2335
2403For example, if you want to use wget to download, you'll have to use something 2336For example, if you want to use wget to download, you'll have to use something
2404like: 2337like:
2405 2338
2406FETCH_USING= wget 2339FETCH_USING= wget
2407 2340
240810.5. How can I install/use modular X.org from pkgsrc? 234110.5. How can I install/use modular X.org from pkgsrc?
2409 2342
2410If you want to use modular X.org from pkgsrc instead of your system's own X11 2343If you want to use modular X.org from pkgsrc instead of your system's own X11
2411(/usr/X11R6, /usr/openwin, ...) you will have to add the following line into 2344(/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
2412mk.conf: 2345mk.conf:
2413 2346
2414X11_TYPE=modular 2347X11_TYPE=modular
2415 2348
241610.6. How to fetch files from behind a firewall 234910.6. How to fetch files from behind a firewall
2417 2350
2418If you are sitting behind a firewall which does not allow direct connections to 2351If you are sitting behind a firewall which does not allow direct connections to
2419Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This 2352Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2420is done using an environment variable in the form of a URL, e.g. in Amdahl, the 2353is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2421machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as 2354machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2422the proxy port number. So the proxy environment variables are: 2355the proxy port number. So the proxy environment variables are:
2423 2356
2424ftp_proxy=ftp://orpheus.amdahl.com:80/ 2357ftp_proxy=ftp://orpheus.amdahl.com:80/
2425http_proxy=http://orpheus.amdahl.com:80/ 2358http_proxy=http://orpheus.amdahl.com:80/
2426 2359
242710.7. How to fetch files from HTTPS sites 236010.7. How to fetch files from HTTPS sites
2428 2361
2429Some fetch tools are not prepared to support HTTPS by default (for example, the 2362Some fetch tools are not prepared to support HTTPS by default (for example, the
2430one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an 2363one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2431openssl dependency that low in the dependency graph). 2364openssl dependency that low in the dependency graph).
2432 2365
2433Usually you won't notice, because distribution files are mirrored weekly to " 2366Usually you won't notice, because distribution files are mirrored weekly to "
2434ftp.NetBSD.org", but that might not be often enough if you are following 2367ftp.NetBSD.org", but that might not be often enough if you are following
2435pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or 2368pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2436"wget", which are both compiled with HTTPS support by default. Of course, these 2369"wget", which are both compiled with HTTPS support by default. Of course, these
2437tools need to be installed before you can use them this way. 2370tools need to be installed before you can use them this way.
2438 2371
243910.8. How do I tell make fetch to do passive FTP? 237210.8. How do I tell make fetch to do passive FTP?
2440 2373
2441This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk, 2374This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2442FETCH_CMD is assigned the first available command from the following list: 2375FETCH_CMD is assigned the first available command from the following list:
2443 2376
2444 * ${LOCALBASE}/bin/ftp 2377 * ${LOCALBASE}/bin/ftp
2445 2378
2446 * /usr/bin/ftp 2379 * /usr/bin/ftp
2447 2380
2448On a default NetBSD installation, this will be /usr/bin/ftp, which 2381On a default NetBSD installation, this will be /usr/bin/ftp, which
2449automatically tries passive connections first, and falls back to active 2382automatically tries passive connections first, and falls back to active
2450connections if the server refuses to do passive. For the other tools, add the 2383connections if the server refuses to do passive. For the other tools, add the
2451following to your mk.conf file: PASSIVE_FETCH=1. 2384following to your mk.conf file: PASSIVE_FETCH=1.
2452 2385
2453Having that option present will prevent /usr/bin/ftp from falling back to 2386Having that option present will prevent /usr/bin/ftp from falling back to
2454active transfers. 2387active transfers.
2455 2388
245610.9. How to fetch all distfiles at once 238910.9. How to fetch all distfiles at once
2457 2390
2458You would like to download all the distfiles in a single batch from work or 2391You would like to download all the distfiles in a single batch from work or
2459university, where you can't run a make fetch. There is an archive of distfiles 2392university, where you can't run a make fetch. There is an archive of distfiles
2460on ftp.NetBSD.org, but downloading the entire directory may not be appropriate. 2393on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2461 2394
2462The answer here is to do a make fetch-list in /usr/pkgsrc or one of its 2395The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2463subdirectories, carry the resulting list to your machine at work/school and use 2396subdirectories, carry the resulting list to your machine at work/school and use
2464it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work, 2397it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2465don't forget to set FETCH_CMD to something that fetches a URL: 2398don't forget to set FETCH_CMD to something that fetches a URL:
2466 2399
2467At home: 2400At home:
2468 2401
2469% cd /usr/pkgsrc 2402% cd /usr/pkgsrc
2470% make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh 2403% make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2471% scp /tmp/fetch.sh work:/tmp 2404% scp /tmp/fetch.sh work:/tmp
2472 2405
2473At work: 2406At work:
2474 2407
2475% sh /tmp/fetch.sh 2408% sh /tmp/fetch.sh
2476 2409
2477then tar up /tmp/distfiles and take it home. 2410then tar up /tmp/distfiles and take it home.
2478 2411
2479If you have a machine running NetBSD, and you want to get all distfiles (even 2412If you have a machine running NetBSD, and you want to get all distfiles (even
2480ones that aren't for your machine architecture), you can do so by using the 2413ones that aren't for your machine architecture), you can do so by using the
2481above-mentioned make fetch-list approach, or fetch the distfiles directly by 2414above-mentioned make fetch-list approach, or fetch the distfiles directly by
2482running: 2415running:
2483 2416
2484% make mirror-distfiles 2417% make mirror-distfiles
2485 2418
2486If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get 2419If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2487everything by running: 2420everything by running:
2488 2421
2489% make fetch NO_SKIP=yes 2422% make fetch NO_SKIP=yes
2490 2423
249110.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean? 242410.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2492 2425
2493When compiling the pkgtools/pkg_install package, you get the error from make 2426When compiling the pkgtools/pkg_install package, you get the error from make
2494that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates 2427that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2495that you don't have installed the "text" set (nroff, ...) from the NetBSD base 2428that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2496distribution on your machine. It is recommended to do that to format man pages. 2429distribution on your machine. It is recommended to do that to format man pages.
2497 2430
2498In the case of the pkgtools/pkg_install package, you can get away with setting 2431In the case of the pkgtools/pkg_install package, you can get away with setting
2499NOMAN=YES either in the environment or in mk.conf. 2432NOMAN=YES either in the environment or in mk.conf.
2500 2433
250110.11. What does "Could not find bsd.own.mk" mean? 243410.11. What does "Could not find bsd.own.mk" mean?
2502 2435
2503You didn't install the compiler set, comp.tgz, when you installed your NetBSD 2436You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2504machine. Please get and install it, by extracting it in /: 2437machine. Please get and install it, by extracting it in /:
2505 2438
2506# cd / 2439# cd /
2507# tar --unlink -zxvpf .../comp.tgz 2440# tar --unlink -zxvpf .../comp.tgz
2508 2441
2509comp.tgz is part of every NetBSD release. Get the one that corresponds to your 2442comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2510release (determine via uname -r). 2443release (determine via uname -r).
2511 2444
251210.12. Using 'sudo' with pkgsrc 244510.12. Using 'sudo' with pkgsrc
2513 2446
2514When installing packages as non-root user and using the just-in-time su(1) 2447When installing packages as non-root user and using the just-in-time su(1)
2515feature of pkgsrc, it can become annoying to type in the root password for each 2448feature of pkgsrc, it can become annoying to type in the root password for each
2516required package installed. To avoid this, the sudo package can be used, which 2449required package installed. To avoid this, the sudo package can be used, which
2517does password caching over a limited time. To use it, install sudo (either as 2450does password caching over a limited time. To use it, install sudo (either as
2518binary package or from security/sudo) and then put the following into your 2451binary package or from security/sudo) and then put the following into your
2519mk.conf, somewhere after the definition of the LOCALBASE variable: 2452mk.conf, somewhere after the definition of the LOCALBASE variable:
2520 2453
2521.if exists(${LOCALBASE}/bin/sudo) 2454.if exists(${LOCALBASE}/bin/sudo)
2522SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c 2455SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2523.endif 2456.endif
2524 2457
252510.13. How do I change the location of configuration files? 245810.13. How do I change the location of configuration files?
2526 2459
2527As the system administrator, you can choose where configuration files are 2460As the system administrator, you can choose where configuration files are
2528installed. The default settings make all these files go into ${PREFIX}/etc or 2461installed. The default settings make all these files go into ${PREFIX}/etc or
2529some of its subdirectories; this may be suboptimal depending on your 2462some of its subdirectories; this may be suboptimal depending on your
2530expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine 2463expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2531configuration of the provided packages). 2464configuration of the provided packages).
2532 2465
2533In order to change the defaults, you can modify the PKG_SYSCONFBASE variable 2466In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
2534(in mk.conf) to point to your preferred configuration directory; some common 2467(in mk.conf) to point to your preferred configuration directory; some common
2535examples include /etc or /etc/pkg. 2468examples include /etc or /etc/pkg.
2536 2469
2537Furthermore, you can change this value on a per-package basis by setting the 2470Furthermore, you can change this value on a per-package basis by setting the
2538PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually 2471PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2539matches the name of the package you would like to modify, that is, the contents 2472matches the name of the package you would like to modify, that is, the contents
2540of PKGBASE. 2473of PKGBASE.
2541 2474
2542Note that after changing these settings, you must rebuild and reinstall any 2475Note that after changing these settings, you must rebuild and reinstall any
2543affected packages. 2476affected packages.
2544 2477
254510.14. Automated security checks 247810.14. Automated security checks
2546 2479
2547Please be aware that there can often be bugs in third-party software, and some 2480Please be aware that there can often be bugs in third-party software, and some
2548of these bugs can leave a machine vulnerable to exploitation by attackers. In 2481of these bugs can leave a machine vulnerable to exploitation by attackers. In
2549an effort to lessen the exposure, the NetBSD packages team maintains a database 2482an effort to lessen the exposure, the NetBSD packages team maintains a database
2550of known-exploits to packages which have at one time been included in pkgsrc. 2483of known-exploits to packages which have at one time been included in pkgsrc.
2551The database can be downloaded automatically, and a security audit of all 2484The database can be downloaded automatically, and a security audit of all
2552packages installed on a system can take place. To do this, refer to the 2485packages installed on a system can take place. To do this, refer to the
2553following two tools (installed as part of the pkgtools/pkg_install package): 2486following two tools (installed as part of the pkgtools/pkg_install package):
2554 2487
2555 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the 2488 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2556 security vulnerabilities information. This list is kept up to date by the 2489 security vulnerabilities information. This list is kept up to date by the
2557 pkgsrc security team, and is distributed from the NetBSD ftp server: 2490 pkgsrc security team, and is distributed from the NetBSD ftp server:
2558 2491
2559 https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities 2492 https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
2560 2493
2561 2. pkg_admin audit, an easy way to audit the current machine, checking each 2494 2. pkg_admin audit, an easy way to audit the current machine, checking each
2562 known vulnerability. If a vulnerable package is installed, it will be shown 2495 known vulnerability. If a vulnerable package is installed, it will be shown
2563 by output to stdout, including a description of the type of vulnerability, 2496 by output to stdout, including a description of the type of vulnerability,
2564 and a URL containing more information. 2497 and a URL containing more information.
2565 2498
2566Use of these tools is strongly recommended! See Section 5.1.5, "Checking for 2499Use of these tools is strongly recommended! See Section 5.1.5, "Checking for
2567security vulnerabilities in installed packages" for instructions on how to 2500security vulnerabilities in installed packages" for instructions on how to
2568automate checking and reporting. 2501automate checking and reporting.
2569 2502
2570If this database is installed, pkgsrc builds will use it to perform a security 2503If this database is installed, pkgsrc builds will use it to perform a security
2571check before building any package. 2504check before building any package.
2572 2505
257310.15. Why do some packages ignore my CFLAGS? 250610.15. Why do some packages ignore my CFLAGS?
2574 2507
2575When you add your own preferences to the CFLAGS variable in your mk.conf, these 2508When you add your own preferences to the CFLAGS variable in your mk.conf, these
2576flags are passed in environment variables to the ./configure scripts and to 2509flags are passed in environment variables to the ./configure scripts and to
2577make(1). Some package authors ignore the CFLAGS from the environment variable 2510make(1). Some package authors ignore the CFLAGS from the environment variable
2578by overriding them in the Makefiles of their package. 2511by overriding them in the Makefiles of their package.
2579 2512
2580Currently there is no solution to this problem. If you really need the package 2513Currently there is no solution to this problem. If you really need the package
2581to use your CFLAGS you should run make patch in the package directory and then 2514to use your CFLAGS you should run make patch in the package directory and then
2582inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly. 2515inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2583Usually you can remove these lines. But be aware that some "smart" programmers 2516Usually you can remove these lines. But be aware that some "smart" programmers
2584write so bad code that it only works for the specific combination of CFLAGS 2517write so bad code that it only works for the specific combination of CFLAGS
2585they have chosen. 2518they have chosen.
2586 2519
2587To find out where the CFLAGS are ignored, add the following lines to mk.conf: 2520To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2588 2521
2589CPPFLAGS+= -Dpkgsrc___CPPFLAGS 2522CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2590CFLAGS+= -Dpkgsrc___CFLAGS 2523CFLAGS+= -Dpkgsrc___CFLAGS
2591CXXFLAGS+= -Dpkgsrc___CXXFLAGS 2524CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2592 2525
2593Then run bmake show-all-configure show-all-build to see whether the above flags 2526Then run bmake show-all-configure show-all-build to see whether the above flags
2594are passed to the actual build commands in general. 2527are passed to the actual build commands in general.
2595 2528
2596To find out whether the flags are passed to individual compiler commands, have 2529To find out whether the flags are passed to individual compiler commands, have
2597a look at the file work/.work.log. In most cases, the flags from the original 2530a look at the file work/.work.log. In most cases, the flags from the original
2598command lines (the lines starting with [*]) are passed unmodified to the actual 2531command lines (the lines starting with [*]) are passed unmodified to the actual
2599compiler (the lines starting with <.>). If the flag is missing from the actual 2532compiler (the lines starting with <.>). If the flag is missing from the actual
2600compiler command, it must have been removed by the pkgsrc compiler wrappers. 2533compiler command, it must have been removed by the pkgsrc compiler wrappers.
2601 2534
260210.16. A package does not build. What shall I do? 253510.16. A package does not build. What shall I do?
2603 2536
2604 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often 2537 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2605 is that people only update pkgsrc in parts, because of performance reasons. 2538 is that people only update pkgsrc in parts, because of performance reasons.
2606 Since pkgsrc is one large system, not a collection of many small systems, 2539 Since pkgsrc is one large system, not a collection of many small systems,
2607 there are sometimes changes that only work when the whole pkgsrc tree is 2540 there are sometimes changes that only work when the whole pkgsrc tree is
2608 updated. 2541 updated.
2609 2542
2610 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or " 2543 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2611 >>>>>>" in all your pkgsrc files. 2544 >>>>>>" in all your pkgsrc files.
2612 2545
2613 3. Make sure that you don't have old copies of the packages extracted. Run  2546 3. Make sure that you don't have old copies of the packages extracted. Run
2614 make clean clean-depends to verify this. 2547 make clean clean-depends to verify this.
2615 2548
2616 4. If you are a package developer who wants to invest some work, have a look 2549 4. If you are a package developer who wants to invest some work, have a look
2617 at Chapter 21, Making your package work. 2550 at Chapter 21, Making your package work.
2618 2551
2619 5. If the problem still exists, write a mail to the pkgsrc-users mailing list. 2552 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
2620 2553
262110.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge 255410.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
2622conflicts" mean? 2555conflicts" mean?
2623 2556
2624You have modified a file from pkgsrc, and someone else has modified that same 2557You have modified a file from pkgsrc, and someone else has modified that same
2625file afterwards in the CVS repository. Both changes are in the same region of 2558file afterwards in the CVS repository. Both changes are in the same region of
2626the file, so when you updated pkgsrc, the cvs command marked the conflicting 2559the file, so when you updated pkgsrc, the cvs command marked the conflicting
2627changes in the file. Because of these markers, the file is no longer a valid 2560changes in the file. Because of these markers, the file is no longer a valid
2628Makefile. 2561Makefile.
2629 2562
2630Have a look at that file, and if you don't need your local changes anymore, you 2563Have a look at that file, and if you don't need your local changes anymore, you
2631can remove that file and run cvs -q update -dP in that directory to download 2564can remove that file and run cvs -q update -dP in that directory to download
2632the current version. 2565the current version.
2633 2566
2634Part II. The pkgsrc developer's guide 2567Part II. The pkgsrc developer's guide
2635 2568
2636This part of the book deals with creating and modifying packages. It starts 2569This part of the book deals with creating and modifying packages. It starts
2637with a "HOWTO"-like guide on creating a new package. The remaining chapters are 2570with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2638more like a reference manual for pkgsrc. 2571more like a reference manual for pkgsrc.
2639 2572
2640Table of Contents 2573Table of Contents
2641 2574
264211. Getting help 257511. Getting help
264312. Creating a new pkgsrc package from scratch 257612. Creating a new pkgsrc package from scratch
2644 2577
2645 12.1. Common types of packages 2578 12.1. Common types of packages
2646 2579
2647 12.1.1. Perl modules 2580 12.1.1. Perl modules
2648 12.1.2. Python modules and programs 2581 12.1.2. Python modules and programs
2649 12.1.3. R packages 2582 12.1.3. R packages
2650 12.1.4. TeXlive packages 2583 12.1.4. TeXlive packages
2651 2584
2652 12.2. Examples 2585 12.2. Examples
2653 2586
2654 12.2.1. How the www/nvu package came into pkgsrc 2587 12.2.1. How the www/nvu package came into pkgsrc
2655 2588
265613. Package components - files, directories and contents 258913. Package components - files, directories and contents
2657 2590
2658 13.1. Makefile 2591 13.1. Makefile
2659 13.2. distinfo 2592 13.2. distinfo
2660 13.3. patches/* 2593 13.3. patches/*
2661 2594
2662 13.3.1. Structure of a single patch file 2595 13.3.1. Structure of a single patch file
2663 13.3.2. Creating patch files 2596 13.3.2. Creating patch files
2664 13.3.3. Sources where the patch files come from 2597 13.3.3. Sources where the patch files come from
2665 13.3.4. Patching guidelines 2598 13.3.4. Patching guidelines
2666 13.3.5. Feedback to the author 2599 13.3.5. Feedback to the author
2667 2600
2668 13.4. Other mandatory files 2601 13.4. Other mandatory files
2669 13.5. Optional files 2602 13.5. Optional files
2670 2603
2671 13.5.1. Files affecting the binary package 2604 13.5.1. Files affecting the binary package
2672 13.5.2. Files affecting the build process 2605 13.5.2. Files affecting the build process
2673 13.5.3. Files affecting nothing at all 2606 13.5.3. Files affecting nothing at all
2674 2607
2675 13.6. work* 2608 13.6. work*
2676 13.7. files/* 2609 13.7. files/*
2677 2610
267814. Programming in Makefiles 261114. Programming in Makefiles
2679 2612
2680 14.1. Caveats 2613 14.1. Caveats
2681 14.2. Makefile variables 2614 14.2. Makefile variables
2682 2615
2683 14.2.1. Naming conventions 2616 14.2.1. Naming conventions
2684 2617
2685 14.3. Code snippets 2618 14.3. Code snippets
2686 2619
2687 14.3.1. Adding things to a list 2620 14.3.1. Adding things to a list
2688 14.3.2. Echoing a string exactly as-is 2621 14.3.2. Echoing a string exactly as-is
2689 14.3.3. Passing CFLAGS to GNU configure scripts 2622 14.3.3. Passing CFLAGS to GNU configure scripts
2690 14.3.4. Handling possibly empty variables 2623 14.3.4. Handling possibly empty variables
2691 2624
269215. PLIST issues 262515. PLIST issues
2693 2626
2694 15.1. RCS ID 2627 15.1. RCS ID
2695 15.2. Semi-automatic PLIST generation 2628 15.2. Semi-automatic PLIST generation
2696 15.3. Tweaking output of make print-PLIST 2629 15.3. Tweaking output of make print-PLIST
2697 15.4. Variable substitution in PLIST 2630 15.4. Variable substitution in PLIST
2698 15.5. Man page compression 2631 15.5. Man page compression
2699 15.6. Changing PLIST source with PLIST_SRC 2632 15.6. Changing PLIST source with PLIST_SRC
2700 15.7. Platform-specific and differing PLISTs 2633 15.7. Platform-specific and differing PLISTs
2701 15.8. Build-specific PLISTs 2634 15.8. Build-specific PLISTs
2702 15.9. Sharing directories between packages 2635 15.9. Sharing directories between packages
2703 2636
270416. Buildlink methodology 263716. Buildlink methodology
2705 2638
2706 16.1. Converting packages to use buildlink3 2639 16.1. Converting packages to use buildlink3
2707 16.2. Writing buildlink3.mk files 2640 16.2. Writing buildlink3.mk files
2708 2641
2709 16.2.1. Anatomy of a buildlink3.mk file 2642 16.2.1. Anatomy of a buildlink3.mk file
2710 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS. 2643 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
2711 pkg in buildlink3.mk files 2644 pkg in buildlink3.mk files
2712 2645
2713 16.3. Writing builtin.mk files 2646 16.3. Writing builtin.mk files
2714 2647
2715 16.3.1. Anatomy of a builtin.mk file 2648 16.3.1. Anatomy of a builtin.mk file
2716 16.3.2. Global preferences for native or pkgsrc software 2649 16.3.2. Global preferences for native or pkgsrc software
2717 2650
271817. The pkginstall framework 265117. The pkginstall framework
2719 2652
2720 17.1. Files and directories outside the installation prefix 2653 17.1. Files and directories outside the installation prefix
2721 2654
2722 17.1.1. Directory manipulation 2655 17.1.1. Directory manipulation
2723 17.1.2. File manipulation 2656 17.1.2. File manipulation
2724 2657
2725 17.2. Configuration files 2658 17.2. Configuration files
2726 2659
2727 17.2.1. How PKG_SYSCONFDIR is set 2660 17.2.1. How PKG_SYSCONFDIR is set
2728 17.2.2. Telling the software where configuration files are 2661 17.2.2. Telling the software where configuration files are
2729 17.2.3. Patching installations 2662 17.2.3. Patching installations
2730 17.2.4. Disabling handling of configuration files 2663 17.2.4. Disabling handling of configuration files
2731 2664
2732 17.3. System startup scripts 2665 17.3. System startup scripts
2733 2666
2734 17.3.1. Disabling handling of system startup scripts 2667 17.3.1. Disabling handling of system startup scripts
2735 2668
2736 17.4. System users and groups 2669 17.4. System users and groups
2737 17.5. System shells 2670 17.5. System shells
2738 2671
2739 17.5.1. Disabling shell registration 2672 17.5.1. Disabling shell registration
2740 2673
2741 17.6. Fonts 2674 17.6. Fonts
2742 2675
2743 17.6.1. Disabling automatic update of the fonts databases 2676 17.6.1. Disabling automatic update of the fonts databases
2744 2677
274518. Options handling 267818. Options handling
2746 2679
2747 18.1. Global default options 2680 18.1. Global default options
2748 18.2. Converting packages to use bsd.options.mk 2681 18.2. Converting packages to use bsd.options.mk
2749 18.3. Option Names 2682 18.3. Option Names
2750 18.4. Determining the options of dependencies 2683 18.4. Determining the options of dependencies
2751 2684
275219. The build process 268519. The build process
2753 2686
2754 19.1. Introduction 2687 19.1. Introduction
2755 19.2. Program location 2688 19.2. Program location
2756 19.3. Directories used during the build process 2689 19.3. Directories used during the build process
2757 19.4. Running a phase 2690 19.4. Running a phase
2758 19.5. The fetch phase 2691 19.5. The fetch phase
2759 2692
2760 19.5.1. What to fetch and where to get it from 2693 19.5.1. What to fetch and where to get it from
2761 19.5.2. How are the files fetched? 2694 19.5.2. How are the files fetched?
2762 2695
2763 19.6. The checksum phase 2696 19.6. The checksum phase
2764 19.7. The extract phase 2697 19.7. The extract phase
2765 19.8. The patch phase 2698 19.8. The patch phase
2766 19.9. The tools phase 2699 19.9. The tools phase
2767 19.10. The wrapper phase 2700 19.10. The wrapper phase
2768 19.11. The configure phase 2701 19.11. The configure phase
2769 19.12. The build phase 2702 19.12. The build phase
2770 19.13. The test phase 2703 19.13. The test phase
2771 19.14. The install phase 2704 19.14. The install phase
2772 19.15. The package phase 2705 19.15. The package phase
2773 19.16. Cleaning up 2706 19.16. Cleaning up
2774 19.17. Other helpful targets 2707 19.17. Other helpful targets
2775 2708
277620. Tools needed for building or running 270920. Tools needed for building or running
2777 2710
2778 20.1. Tools for pkgsrc builds 2711 20.1. Tools for pkgsrc builds
2779 20.2. Tools needed by packages 2712 20.2. Tools needed by packages
2780 20.3. Tools provided by platforms 2713 20.3. Tools provided by platforms
2781 2714
278221. Making your package work 271521. Making your package work
2783 2716
2784 21.1. General operation 2717 21.1. General operation
2785 2718
2786 21.1.1. How to pull in user-settable variables from mk.conf 2719 21.1.1. How to pull in user-settable variables from mk.conf
2787 21.1.2. User interaction 2720 21.1.2. User interaction
2788 21.1.3. Handling licenses 2721 21.1.3. Handling licenses
2789 21.1.4. Restricted packages 2722 21.1.4. Restricted packages
2790 21.1.5. Handling dependencies 2723 21.1.5. Handling dependencies
2791 21.1.6. Handling conflicts with other packages 2724 21.1.6. Handling conflicts with other packages
2792 21.1.7. Packages that cannot or should not be built 2725 21.1.7. Packages that cannot or should not be built
2793 21.1.8. Packages which should not be deleted, once installed 2726 21.1.8. Packages which should not be deleted, once installed
2794 21.1.9. Handling packages with security problems 2727 21.1.9. Handling packages with security problems
2795 21.1.10. How to handle incrementing versions when fixing an existing 2728 21.1.10. How to handle incrementing versions when fixing an existing
2796 package 2729 package
2797 21.1.11. Substituting variable text in the package files (the SUBST 2730 21.1.11. Substituting variable text in the package files (the SUBST
2798 framework) 2731 framework)
2799 2732
2800 21.2. The fetch phase 2733 21.2. The fetch phase
2801 2734
2802 21.2.1. Packages whose distfiles aren't available for plain downloading 2735 21.2.1. Packages whose distfiles aren't available for plain downloading
2803 21.2.2. How to handle modified distfiles with the 'old' name 2736 21.2.2. How to handle modified distfiles with the 'old' name
2804 21.2.3. Packages hosted on github.com 2737 21.2.3. Packages hosted on github.com
2805 2738
2806 21.3. The configure phase 2739 21.3. The configure phase
2807 2740
2808 21.3.1. Shared libraries - libtool 2741 21.3.1. Shared libraries - libtool
2809 21.3.2. Using libtool on GNU packages that already support libtool 2742 21.3.2. Using libtool on GNU packages that already support libtool
2810 21.3.3. GNU Autoconf/Automake 2743 21.3.3. GNU Autoconf/Automake
2811 2744
2812 21.4. Programming languages 2745 21.4. Programming languages
2813 2746
2814 21.4.1. C, C++, and Fortran 2747 21.4.1. C, C++, and Fortran
2815 21.4.2. Java 2748 21.4.2. Java
2816 21.4.3. Packages containing perl scripts 2749 21.4.3. Packages containing perl scripts
2817 21.4.4. Packages containing shell scripts 2750 21.4.4. Packages containing shell scripts
2818 21.4.5. Other programming languages 2751 21.4.5. Other programming languages
2819 2752
2820 21.5. The build phase 2753 21.5. The build phase
2821 2754
2822 21.5.1. Compiling C and C++ code conditionally 2755 21.5.1. Compiling C and C++ code conditionally
2823 21.5.2. How to handle compiler bugs 2756 21.5.2. How to handle compiler bugs
2824 21.5.3. No such file or directory 2757 21.5.3. No such file or directory
2825 21.5.4. Undefined reference to "..." 2758 21.5.4. Undefined reference to "..."
2826 21.5.5. Running out of memory 2759 21.5.5. Running out of memory
2827 2760
2828 21.6. The install phase 2761 21.6. The install phase
2829 2762
2830 21.6.1. Creating needed directories 2763 21.6.1. Creating needed directories
2831 21.6.2. Where to install documentation 2764 21.6.2. Where to install documentation
2832 21.6.3. Installing highscore files 2765 21.6.3. Installing highscore files
2833 21.6.4. Adding DESTDIR support to packages 2766 21.6.4. Adding DESTDIR support to packages
2834 21.6.5. Packages with hardcoded paths to other interpreters 2767 21.6.5. Packages with hardcoded paths to other interpreters
2835 21.6.6. Packages installing perl modules 2768 21.6.6. Packages installing perl modules
2836 21.6.7. Packages installing info files 2769 21.6.7. Packages installing info files
2837 21.6.8. Packages installing man pages 2770 21.6.8. Packages installing man pages
2838 21.6.9. Packages installing GConf data files 2771 21.6.9. Packages installing GConf data files
2839 21.6.10. Packages installing scrollkeeper/rarian data files 2772 21.6.10. Packages installing scrollkeeper/rarian data files
2840 21.6.11. Packages installing X11 fonts 2773 21.6.11. Packages installing X11 fonts
2841 21.6.12. Packages installing GTK2 modules 2774 21.6.12. Packages installing GTK2 modules
2842 21.6.13. Packages installing SGML or XML data 2775 21.6.13. Packages installing SGML or XML data
2843 21.6.14. Packages installing extensions to the MIME database 2776 21.6.14. Packages installing extensions to the MIME database
2844 21.6.15. Packages using intltool 2777 21.6.15. Packages using intltool
2845 21.6.16. Packages installing startup scripts 2778 21.6.16. Packages installing startup scripts
2846 21.6.17. Packages installing TeX modules 2779 21.6.17. Packages installing TeX modules
2847 21.6.18. Packages supporting running binaries in emulation 2780 21.6.18. Packages supporting running binaries in emulation
2848 21.6.19. Packages installing hicolor theme icons 2781 21.6.19. Packages installing hicolor theme icons
2849 21.6.20. Packages installing desktop files 2782 21.6.20. Packages installing desktop files
2850 2783
2851 21.7. Marking packages as having problems 2784 21.7. Marking packages as having problems
2852 2785
285322. Debugging 278622. Debugging
285423. Submitting and Committing 278723. Submitting and Committing
2855 2788
2856 23.1. Submitting binary packages 2789 23.1. Submitting binary packages
2857 23.2. Submitting source packages (for non-NetBSD-developers) 2790 23.2. Submitting source packages (for non-NetBSD-developers)
2858 23.3. General notes when adding, updating, or removing packages 2791 23.3. General notes when adding, updating, or removing packages
2859 23.4. Commit Messages 2792 23.4. Commit Messages
2860 23.5. Committing: Adding a package to CVS 2793 23.5. Committing: Adding a package to CVS
2861 23.6. Updating a package to a newer version 2794 23.6. Updating a package to a newer version
2862 23.7. Renaming a package in pkgsrc 2795 23.7. Renaming a package in pkgsrc
2863 23.8. Moving a package in pkgsrc 2796 23.8. Moving a package in pkgsrc
2864 2797
286524. Frequently Asked Questions 279824. Frequently Asked Questions
286625. GNOME packaging and porting 279925. GNOME packaging and porting
2867 2800
2868 25.1. Meta packages 2801 25.1. Meta packages
2869 25.2. Packaging a GNOME application 2802 25.2. Packaging a GNOME application
2870 25.3. Updating GNOME to a newer version 2803 25.3. Updating GNOME to a newer version
2871 25.4. Patching guidelines 2804 25.4. Patching guidelines
2872 2805
2873Chapter 11. Getting help 2806Chapter 11. Getting help
2874 2807
2875To get help when developing pkgsrc, the definitive source is this document, the 2808To get help when developing pkgsrc, the definitive source is this document, the
2876pkgsrc guide. If you don't find anything here, there are alternatives: 2809pkgsrc guide. If you don't find anything here, there are alternatives:
2877 2810
2878 * The built-in pkgsrc help, which is available after bootstrapping pkgsrc. 2811 * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2879 Run bmake help topic=? to get help for any topic, such as a variable name 2812 Run bmake help topic=? to get help for any topic, such as a variable name
2880 like BUILD_DEFS, a make target like do-build, a missing C or C++ function 2813 like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2881 like strcasecmp or any other topic. 2814 like strcasecmp or any other topic.
2882 2815
2883 The available help topics are listed in Appendix D, Help topics. 2816 The available help topics are listed in Appendix D, Help topics.
2884 2817
2885 * To see the value of a single variable, run bmake show-var VARNAME=X. 2818 * To see the value of a single variable, run bmake show-var VARNAME=X.
2886 2819
2887 * To see the values of the most common variables, run bmake show-all. These 2820 * To see the values of the most common variables, run bmake show-all. These
2888 variables are grouped by topic. To see the variables for a single topic, 2821 variables are grouped by topic. To see the variables for a single topic,
2889 run bmake show-all-topic, for example bmake show-all-fetch. 2822 run bmake show-all-topic, for example bmake show-all-fetch.
2890 2823
2891 * The tech-pkg mailing list, to which you can subscribe and then ask your 2824 * The tech-pkg mailing list, to which you can subscribe and then ask your
2892 questions. 2825 questions.
2893 2826
2894 * The #pkgsrc IRC channel, which is accessible via a web browser or by using 2827 * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2895 a specialized chat program such as XChat. Pick any user name and join the 2828 a specialized chat program such as XChat. Pick any user name and join the
2896 channel #pkgsrc. 2829 channel #pkgsrc.
2897 2830
2898Chapter 12. Creating a new pkgsrc package from scratch 2831Chapter 12. Creating a new pkgsrc package from scratch
2899 2832
2900Table of Contents 2833Table of Contents
2901 2834
290212.1. Common types of packages 283512.1. Common types of packages
2903 2836
2904 12.1.1. Perl modules 2837 12.1.1. Perl modules
2905 12.1.2. Python modules and programs 2838 12.1.2. Python modules and programs
2906 12.1.3. R packages 2839 12.1.3. R packages
2907 12.1.4. TeXlive packages 2840 12.1.4. TeXlive packages
2908 2841
290912.2. Examples 284212.2. Examples
2910 2843
2911 12.2.1. How the www/nvu package came into pkgsrc 2844 12.2.1. How the www/nvu package came into pkgsrc
2912 2845
2913When you find a package that is not yet in pkgsrc, you most likely have a URL 2846When you find a package that is not yet in pkgsrc, you most likely have a URL
2914from where you can download the source code. Starting with this URL, creating a 2847from where you can download the source code. Starting with this URL, creating a
2915package involves only a few steps. 2848package involves only a few steps.
2916 2849
2917 1. First, install the packages pkgtools/url2pkg and pkgtools/pkglint. 2850 1. First, install the packages pkgtools/url2pkg and pkgtools/pkglint.
2918 2851
2919 2. Then, choose one of the top-level directories as the category in which you 2852 2. Then, choose one of the top-level directories as the category in which you
2920 want to place your package. You can also create a directory of your own 2853 want to place your package. You can also create a directory of your own
2921 (maybe called local). In that category directory, create another directory 2854 (maybe called local). In that category directory, create another directory
2922 for your package and change into it. 2855 for your package and change into it.
2923 2856
2924 3. Run the program url2pkg, which will ask you for a URL. Enter the URL of the 2857 3. Run the program url2pkg, which will ask you for a URL. Enter the URL of the
2925 distribution file (in most cases a .tar.gz file) and watch how the basic 2858 distribution file (in most cases a .tar.gz file) and watch how the basic
2926 ingredients of your package are created automatically. The distribution 2859 ingredients of your package are created automatically. The distribution
2927 file is extracted automatically to fill in some details in the Makefile 2860 file is extracted automatically to fill in some details in the Makefile
2928 that would otherwise have to be done manually. 2861 that would otherwise have to be done manually.
2929 2862
2930 4. Examine the extracted files to determine the dependencies of your package. 2863 4. Examine the extracted files to determine the dependencies of your package.
2931 Ideally, this is mentioned in some README file, but things may differ. For 2864 Ideally, this is mentioned in some README file, but things may differ. For
2932 each of these dependencies, look where it exists in pkgsrc, and if there is 2865 each of these dependencies, look where it exists in pkgsrc, and if there is
2933 a file called buildlink3.mk in that directory, add a line to your package 2866 a file called buildlink3.mk in that directory, add a line to your package
2934 Makefile which includes that file just before the last line. If the 2867 Makefile which includes that file just before the last line. If the
2935 buildlink3.mk file does not exist, it must be created first. The 2868 buildlink3.mk file does not exist, it must be created first. The
2936 buildlink3.mk file makes sure that the package's include files and 2869 buildlink3.mk file makes sure that the package's include files and
2937 libraries are provided. 2870 libraries are provided.
2938 2871
2939 If you just need binaries from a package, add a DEPENDS line to the 2872 If you just need binaries from a package, add a DEPENDS line to the
2940 Makefile, which specifies the version of the dependency and where it can be 2873 Makefile, which specifies the version of the dependency and where it can be
2941 found in pkgsrc. This line should be placed in the third paragraph. If the 2874 found in pkgsrc. This line should be placed in the third paragraph. If the
2942 dependency is only needed for building the package, but not when using it, 2875 dependency is only needed for building the package, but not when using it,
2943 use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference 2876 use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference
2944 between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling: 2877 between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling:
2945 TOOL_DEPENDS are native packages, i.e. packages for the architecture where 2878 TOOL_DEPENDS are native packages, i.e. packages for the architecture where
2946 the package is built; BUILD_DEPENDS are target packages, i.e. packages for 2879 the package is built; BUILD_DEPENDS are target packages, i.e. packages for
2947 the architecture for which the package is built. There is also 2880 the architecture for which the package is built. There is also
2948 TEST_DEPENDS, which is used to specify a dependency used only for testing 2881 TEST_DEPENDS, which is used to specify a dependency used only for testing
2949 the resulting package built, using the upstream project's included test 2882 the resulting package built, using the upstream project's included test
2950 suite. Your package may then look like this: 2883 suite. Your package may then look like this:
2951 2884
2952 [...] 2885 [...]
2953 2886
2954 TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt 2887 TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
2955 DEPENDS+= screen-[0-9]*:../../misc/screen 2888 DEPENDS+= screen-[0-9]*:../../misc/screen
2956 DEPENDS+= screen>=4.0:../../misc/screen 2889 DEPENDS+= screen>=4.0:../../misc/screen
2957 2890
2958 [...] 2891 [...]
2959 2892
2960 .include "../../category/package/buildlink3.mk" 2893 .include "../../category/package/buildlink3.mk"
2961 .include "../../devel/glib2/buildlink3.mk" 2894 .include "../../devel/glib2/buildlink3.mk"
2962 .include "../../mk/bsd.pkg.mk" 2895 .include "../../mk/bsd.pkg.mk"
2963 2896
2964 5. Run pkglint to see what things still need to be done to make your package a 2897 5. Run pkglint to see what things still need to be done to make your package a
2965 "good" one. If you don't know what pkglint's warnings want to tell you, try 2898 "good" one. If you don't know what pkglint's warnings want to tell you, try
2966 pkglint --explain or pkglint -e, which outputs additional explanations. 2899 pkglint --explain or pkglint -e, which outputs additional explanations.
2967 2900
2968 6. In many cases the package is not yet ready to build. You can find 2901 6. In many cases the package is not yet ready to build. You can find
2969 instructions for the most common cases in the next section, Section 12.1, 2902 instructions for the most common cases in the next section, Section 12.1,
2970 "Common types of packages". After you have followed the instructions over 2903 "Common types of packages". After you have followed the instructions over
2971 there, you can hopefully continue here. 2904 there, you can hopefully continue here.
2972 2905
2973 7. Run bmake clean to clean the working directory from the extracted files. 2906 7. Run bmake clean to clean the working directory from the extracted files.
2974 Besides these files, a lot of cache files and other system information has 2907 Besides these files, a lot of cache files and other system information has
2975 been saved in the working directory, which may become wrong after you 2908 been saved in the working directory, which may become wrong after you
2976 edited the Makefile. 2909 edited the Makefile.
2977 2910
2978 8. Now, run bmake to build the package. For the various things that can go 2911 8. Now, run bmake to build the package. For the various things that can go
2979 wrong in this phase, consult Chapter 21, Making your package work. 2912 wrong in this phase, consult Chapter 21, Making your package work.
2980 2913
2981 9. When the package builds fine, the next step is to install the package. Run  2914 9. When the package builds fine, the next step is to install the package. Run
2982 bmake install and hope that everything works. 2915 bmake install and hope that everything works.
2983 2916
298410. Up to now, the file PLIST, which contains a list of the files that are 291710. Up to now, the file PLIST, which contains a list of the files that are
2985 installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to 2918 installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
2986 generate a probably correct list. Check the file using your preferred text 2919 generate a probably correct list. Check the file using your preferred text
2987 editor to see if the list of files looks plausible. 2920 editor to see if the list of files looks plausible.
2988 2921
298911. Run pkglint again to see if the generated PLIST contains garbage or not. 292211. Run pkglint again to see if the generated PLIST contains garbage or not.
2990 2923
299112. When you ran bmake install, the package has been registered in the database 292412. When you ran bmake install, the package has been registered in the database
2992 of installed files, but with an empty list of files. To fix this, run bmake 2925 of installed files, but with an empty list of files. To fix this, run bmake
2993 deinstall and bmake install again. Now the package is registered with the 2926 deinstall and bmake install again. Now the package is registered with the
2994 list of files from PLIST. 2927 list of files from PLIST.
2995 2928
299613. Run bmake package to create a binary package from the set of installed 292913. Run bmake package to create a binary package from the set of installed
2997 files. 2930 files.
2998 2931
299912.1. Common types of packages 293212.1. Common types of packages
3000 2933
300112.1.1. Perl modules 293412.1.1. Perl modules
3002 2935
3003Simple Perl modules are handled automatically by url2pkg, including 2936Simple Perl modules are handled automatically by url2pkg, including
3004dependencies. 2937dependencies.
3005 2938
300612.1.2. Python modules and programs 293912.1.2. Python modules and programs
3007 2940
3008Python modules and programs packages are easily created using a set of 2941Python modules and programs packages are easily created using a set of
3009predefined variables. 2942predefined variables.
3010 2943
3011If some Python versions are not supported by the software, set the 2944If some Python versions are not supported by the software, set the
3012PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not 2945PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
3013supported, e.g. 2946supported, e.g.
3014 2947
3015PYTHON_VERSIONS_INCOMPATIBLE= 27 2948PYTHON_VERSIONS_INCOMPATIBLE= 27
3016 2949
3017If the packaged software is a Python module, include one of ../../lang/python/ 2950If the packaged software is a Python module, include one of ../../lang/python/
3018egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk. 2951egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk.
3019 2952
3020Most Python packages use either "distutils" or easy-setup/setuptools ("eggs"). 2953Most Python packages use either "distutils" or easy-setup/setuptools ("eggs").
3021If the packaged software is using setuptools, you only need to include "../../ 2954If the packaged software is using setuptools, you only need to include "../../
3022lang/python/egg.mk". Otherwise, if the software uses "distutils", include ".. 2955lang/python/egg.mk". Otherwise, if the software uses "distutils", include "..
3023/../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils" 2956/../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils"
3024uses a script called setup.py; if the "distutils" driver is not called 2957uses a script called setup.py; if the "distutils" driver is not called
3025setup.py, set the PYSETUP variable to the name of the script. 2958setup.py, set the PYSETUP variable to the name of the script.
3026 2959
3027Either way, the package directory should be called "py-software" and PKGNAME 2960Either way, the package directory should be called "py-software" and PKGNAME
3028should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g. 2961should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
3029 2962
3030DISTNAME= foopymodule-1.2.10 2963DISTNAME= foopymodule-1.2.10
3031PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 2964PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
3032 2965
3033If it is an application, include "../../lang/python/application.mk". In order 2966If it is an application, include "../../lang/python/application.mk". In order
3034to correctly set the path to the Python interpreter, use the REPLACE_PYTHON 2967to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
3035variable and set it to the list of files (paths relative to WRKSRC) that must 2968variable and set it to the list of files (paths relative to WRKSRC) that must
3036be corrected. For example: 2969be corrected. For example:
3037 2970
3038REPLACE_PYTHON= *.py 2971REPLACE_PYTHON= *.py
3039 2972
3040Some Python modules have separate distributions for Python-2.x and Python-3.x 2973Some Python modules have separate distributions for Python-2.x and Python-3.x
3041support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set 2974support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
3042PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended 2975PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
3043upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc 2976upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
3044infrastructure will depend on the appropriate package version. For example: 2977infrastructure will depend on the appropriate package version. For example:
3045 2978
3046PYTHON_VERSIONED_DEPENDENCIES=dialog 2979PYTHON_VERSIONED_DEPENDENCIES=dialog
3047 2980
3048Look inside versioned_dependencies.mk for a list of supported packages. 2981Look inside versioned_dependencies.mk for a list of supported packages.
3049 2982
305012.1.3. R packages 298312.1.3. R packages
3051 2984
3052Simple R packages from CRAN are handled automatically by R2pkg, which is 2985Simple R packages from CRAN are handled automatically by R2pkg, which is
3053available in pkgtools/R2pkg. Individual packages (and optionally their 2986available in pkgtools/R2pkg. Individual packages (and optionally their
3054dependencies) may be created and updated. R packages generally follow the same 2987dependencies) may be created and updated. R packages generally follow the same
3055form, and most of the relevant information needed is contained in a DESCRIPTION 2988form, and most of the relevant information needed is contained in a DESCRIPTION
3056file as part of each R package on CRAN. Consequently, R2pkg downloads that 2989file as part of each R package on CRAN. Consequently, R2pkg downloads that
3057information and creates or updates a package in the canonical form. The 2990information and creates or updates a package in the canonical form. The
3058resulting package should be reviewed for correctness. 2991resulting package should be reviewed for correctness.
3059 2992
306012.1.4. TeXlive packages 299312.1.4. TeXlive packages
3061 2994
3062TeXlive packages from CTAN are handled automatically by texlive2pkg, which is 2995TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
3063available in pkgtools/texlive2pkg. 2996available in pkgtools/texlive2pkg.
3064 2997
3065If the TeXlive package name is not known, it may be useful to search CTAN. A " 2998If the TeXlive package name is not known, it may be useful to search CTAN. A "
3066Contained in" field on the package page typically identifies the basename of 2999Contained in" field on the package page typically identifies the basename of
3067the package file in the TeXlive archive. 3000the package file in the TeXlive archive.
3068 3001
3069If the TeXlive package name is known, download the files from the TeXlive 3002If the TeXlive package name is known, download the files from the TeXlive
3070archive. For package foo, you will need to download foo.tar.xz. Most TeXlive 3003archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
3071packages also have associated documentation packages, so download 3004packages also have associated documentation packages, so download
3072foo.doc.tar.xz at the same time. These files should be placed in the 3005foo.doc.tar.xz at the same time. These files should be placed in the
3073appropriate category directory, which is often but not always print. Then run 3006appropriate category directory, which is often but not always print. Then run
3074the following command in the category directory. 3007the following command in the category directory.
3075 3008
3076texlive2pkg foo.tar.xz foo.doc.tar.xz 3009texlive2pkg foo.tar.xz foo.doc.tar.xz