Annotation of htdocs/docs/pkgsrc/using.html, revision 1.2
1.1 dsieger 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2: <html>
3: <head>
4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5: <title>Chapter 4. Using pkgsrc</title>
1.2 ! rillig 6: <link rel="stylesheet" href="/global.css" type="text/css">
1.1 dsieger 7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
8: <link rel="start" href="index.html" title="The pkgsrc guide">
9: <link rel="up" href="users-guide.html" title="Part I. The pkgsrc user's guide">
10: <link rel="prev" href="platforms.html" title="Chapter 3. Using pkgsrc on systems other than NetBSD">
11: <link rel="next" href="configuring.html" title="Chapter 5. Configuring pkgsrc">
12: </head>
13: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14: <div class="navheader">
15: <table width="100%" summary="Navigation header">
16: <tr><th colspan="3" align="center">Chapter 4. Using pkgsrc</th></tr>
17: <tr>
18: <td width="20%" align="left">
19: <a accesskey="p" href="platforms.html">Prev</a> </td>
20: <th width="60%" align="center">Part I. The pkgsrc user's guide</th>
21: <td width="20%" align="right"> <a accesskey="n" href="configuring.html">Next</a>
22: </td>
23: </tr>
24: </table>
25: <hr>
26: </div>
27: <div class="chapter" lang="en">
28: <div class="titlepage"><div><div><h2 class="title">
29: <a name="using"></a>Chapter 4. Using pkgsrc</h2></div></div></div>
30: <div class="toc">
31: <p><b>Table of Contents</b></p>
32: <dl>
33: <dt><span class="sect1"><a href="using.html#using-pkg">4.1. Using binary packages</a></span></dt>
34: <dd><dl>
35: <dt><span class="sect2"><a href="using.html#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt>
36: <dt><span class="sect2"><a href="using.html#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt>
37: <dt><span class="sect2"><a href="using.html#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt>
38: <dt><span class="sect2"><a href="using.html#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt>
39: <dt><span class="sect2"><a href="using.html#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
40: <dt><span class="sect2"><a href="using.html#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
41: <dt><span class="sect2"><a href="using.html#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt>
42: <dt><span class="sect2"><a href="using.html#a-word-of-warning">4.1.8. A word of warning</a></span></dt>
43: </dl></dd>
44: <dt><span class="sect1"><a href="using.html#building-packages-from-source">4.2. Building packages from source</a></span></dt>
45: <dd><dl>
46: <dt><span class="sect2"><a href="using.html#requirements">4.2.1. Requirements</a></span></dt>
47: <dt><span class="sect2"><a href="using.html#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt>
48: <dt><span class="sect2"><a href="using.html#how-to-build-and-install">4.2.3. How to build and install</a></span></dt>
49: </dl></dd>
50: </dl>
51: </div>
52: <p>Basically, there are two ways of using pkgsrc. The first
53: is to only install the package tools and to use binary packages
54: that someone else has prepared. This is the “<span class="quote">pkg</span>”
55: in pkgsrc. The second way is to install the “<span class="quote">src</span>”
56: of pkgsrc, too. Then you are able to build your own packages,
57: and you can still use binary packages from someone else.</p>
58: <div class="sect1" lang="en">
59: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
60: <a name="using-pkg"></a>4.1. Using binary packages</h2></div></div></div>
61: <p>To use binary packages, you need some tools to manage
62: them. On NetBSD, these tools are already installed. On all other
63: operating systems, you need to install them first. For the
64: following platforms, prebuilt versions of the package tools
65: are available and can simply be downloaded and unpacked in the
66: <code class="filename">/</code> directory:</p>
67: <div class="informaltable">
68: <a name="binary-bootstrap-kits"></a><table border="1">
69: <colgroup>
70: <col>
71: <col>
72: </colgroup>
73: <thead><tr>
74: <th>Platform</th>
75: <th>URL</th>
76: </tr></thead>
77: <tbody>
78: <tr>
79: <td>Solaris 9</td>
80: <td><code class="filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
81: </tr>
82: <tr>
83: <td>Solaris 10</td>
84: <td><code class="filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
85: </tr>
86: </tbody>
87: </table>
88: </div>
89: <p>These pre-built package tools use
90: <code class="filename">/usr/pkg</code> for the base directory, and
91: <code class="filename">/var/db/pkg</code> for the database of installed
92: packages. If you cannot use these directories for whatever
93: reasons (maybe because you're not root), you have to build the
94: package tools yourself, which is explained in <a href="platforms.html#bootstrapping-pkgsrc" title="3.2. Bootstrapping pkgsrc">Section 3.2, “Bootstrapping pkgsrc”</a>.</p>
95: <div class="sect2" lang="en">
96: <div class="titlepage"><div><div><h3 class="title">
97: <a name="finding-binary-packages"></a>4.1.1. Finding binary packages</h3></div></div></div>
98: <p>To install binary packages, you first need to know from
99: where to get them. You can get them on CD-ROMs, DVDs, or via FTP
100: or HTTP.</p>
101: <p>The binary packages can be found at the following
102: locations.</p>
103: <div class="informaltable">
104: <a name="binary-packages"></a><table border="1">
105: <colgroup>
106: <col>
107: <col>
108: </colgroup>
109: <thead><tr>
110: <th>Platform</th>
111: <th>URL</th>
112: </tr></thead>
113: <tbody>
114: <tr>
115: <td>NetBSD</td>
116: <td><code class="filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/</code></td>
117: </tr>
118: <tr>
119: <td>Solaris 9</td>
120: <td><code class="filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/</code></td>
121: </tr>
122: <tr>
123: <td>Solaris 10</td>
124: <td><code class="filename">http://public.enst.fr/pkgsrc/packages/</code></td>
125: </tr>
126: </tbody>
127: </table>
128: </div>
129: <p>Most of these directories contain binary packages for
130: multiple platforms. Select the appropriate subdirectories,
131: according to your machine architecture and operating system,
132: until you find a directory called <code class="filename">All</code>. This
133: directory contains all the binary packages. Further, there are
134: subdirectories for categories that contain symbolic links that
135: point to the actual binary package in
136: <code class="filename">../All</code>. This directory layout is used for
137: all package repositories, no matter if they are accessed via
138: HTTP, FTP, NFS, CD-ROM, or the local filesystem.</p>
139: </div>
140: <div class="sect2" lang="en">
141: <div class="titlepage"><div><div><h3 class="title">
142: <a name="installing-binary-packages"></a>4.1.2. Installing binary packages</h3></div></div></div>
143: <p>If you have the files on a CD-ROM or downloaded them to
144: your hard disk, you can install them with the following command
145: (be sure to <span><strong class="command">su</strong></span> to root first):</p>
146: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add /path/to/package.tgz</code></strong></pre>
147: <p>If you have FTP access and you don't want to download the
148: packages via FTP prior to installation, you can do this
149: automatically by giving <span><strong class="command">pkg_add</strong></span> an FTP URL:</p>
150: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package</code></strong></pre>
151: <p>Note that any prerequisite packages needed to run the
152: package in question will be installed, too, assuming they are
153: present where you install from.</p>
154: <p>To save some typing, you can set the
155: <code class="varname">PKG_PATH</code> environment variable to a semicolon-separated
156: list of paths (including remote URLs); trailing slashes are not allowed.
157: </p>
158: <p>Additionally to the <code class="filename">All</code> directory
159: there exists a <code class="filename">vulnerable</code> directory to
160: which binary packages with known vulnerabilities are
161: moved, since removing them could cause missing dependencies. To
162: use these packages, add the <code class="filename">vulnerable</code>
163: directory to your <code class="varname">PKG_PATH</code>. However, you should run
164: <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/audit-packages/README.html" target="_top"><code class="filename">security/audit-packages</code></a> regularly,
165: especially after installing new packages, and verify that the
166: vulnerabilities are acceptable for your configuration. An example
167: <code class="varname">PKG_PATH</code> would be:
168: <code class="filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/vulnerable</code>
169: Please note that semicolon (';') is a shell meta-character, so
170: you'll probably have to quote it.</p>
171: <p>After you've installed packages, be sure to have
172: <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your
173: <code class="varname">PATH</code> so you can actually start the just
174: installed program.</p>
175: </div>
176: <div class="sect2" lang="en">
177: <div class="titlepage"><div><div><h3 class="title">
178: <a name="using.pkg_delete"></a>4.1.3. Deinstalling packages</h3></div></div></div>
179: <p>To deinstall a package, it does not matter whether it was
180: installed from source code or from a binary package. The
181: <span><strong class="command">pkg_delete</strong></span> command does not know it anyway.
182: To delete a package, you can just run <span><strong class="command">pkg_delete
183: <em class="replaceable"><code>package-name</code></em></strong></span>. The package
184: name can be given with or without version number. Wildcards can
185: also be used to deinstall a set of packages, for example
186: <code class="literal">*emacs*</code>. Be sure to include them in quotes,
187: so that the shell does not expand them before
188: <code class="literal">pkg_delete</code> sees them.</p>
189: <p>The <code class="option">-r</code> option is very powerful: it
190: removes all the packages that require the package in question
191: and then removes the package itself. For example:
192:
193: </p>
194: <pre class="screen">
195: <code class="prompt">#</code> <strong class="userinput"><code>pkg_delete -r jpeg</code></strong>
196: </pre>
197: <p>
198:
199: will remove jpeg and all the packages that used it; this allows
200: upgrading the jpeg package.</p>
201: </div>
202: <div class="sect2" lang="en">
203: <div class="titlepage"><div><div><h3 class="title">
204: <a name="using.pkg_info"></a>4.1.4. Getting information about installed packages</h3></div></div></div>
205: <p>The <span><strong class="command">pkg_info</strong></span> shows information about
206: installed packages or binary package files.</p>
207: </div>
208: <div class="sect2" lang="en">
209: <div class="titlepage"><div><div><h3 class="title">
210: <a name="vulnerabilities"></a>4.1.5. Checking for security vulnerabilities in installed packages</h3></div></div></div>
211: <p>
212: The NetBSD Security-Officer and Packages Groups maintain a list of
213: known security vulnerabilities to packages which are (or have been)
214: included in pkgsrc. The list is available from the NetBSD
215: FTP site at <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities</a>.
216: </p>
217: <p>
218: Through <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/audit-packages/README.html" target="_top"><code class="filename">security/audit-packages</code></a>,
219: this list can be downloaded
220: automatically, and a security audit of all packages installed on a system
221: can take place.
222: </p>
223: <p>
224: There are two components to
225: <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/audit-packages/README.html" target="_top"><code class="filename">security/audit-packages</code></a>. The first
226: component, “<span class="quote">download-vulnerability-list</span>”, is for downloading
227: the list of vulnerabilities from the NetBSD FTP site. The second
228: component, “<span class="quote">audit-packages</span>”, checks to see if any of your
229: installed packages are vulnerable. If a package is vulnerable, you
230: will see output similar to the following:
231: </p>
232: <pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see
233: http://www.samba.org/samba/whatsnew/macroexploit.html</pre>
234: <p>
235: One can set up <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/audit-packages/README.html" target="_top"><code class="filename">security/audit-packages</code></a> to download the
236: <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a>
237: file daily, and include a package audit in the daily security script.
238: Details on this are located in the <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/security/audit-packages/MESSAGE?rev=HEAD&content-type=text/x-cvsweb-markup" target="_top">MESSAGE</a>
239: file for <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/audit-packages/README.html" target="_top"><code class="filename">security/audit-packages</code></a>.
240: </p>
241: </div>
242: <div class="sect2" lang="en">
243: <div class="titlepage"><div><div><h3 class="title">
244: <a name="pkg_versions"></a>4.1.6. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div>
245: <p>
246: Install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a> and run
247: <span><strong class="command">lintpkgsrc</strong></span> with the “<span class="quote">-i</span>”
248: argument to check if your packages are up-to-date, e.g.
249: </p>
250: <pre class="screen">
251: <code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong>
252: ...
253: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
254: </pre>
255: <p>You can then use <span><strong class="command">make update</strong></span> to update the
256: package on your system and rebuild any dependencies.
257: </p>
258: </div>
259: <div class="sect2" lang="en">
260: <div class="titlepage"><div><div><h3 class="title">
261: <a name="using.pkg_admin"></a>4.1.7. Other administrative functions</h3></div></div></div>
262: <p>The <span><strong class="command">pkg_admin</strong></span> executes various
263: administrative functions on the package system.</p>
264: </div>
265: <div class="sect2" lang="en">
266: <div class="titlepage"><div><div><h3 class="title">
267: <a name="a-word-of-warning"></a>4.1.8. A word of warning</h3></div></div></div>
268: <p>Please pay very careful attention to the warnings
269: expressed in the <a href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> manual page about the
270: inherent dangers of installing binary packages which you did
271: not create yourself, and the security holes that can be
272: introduced onto your system by indiscriminate adding of such
273: files.</p>
274: <p>The same warning of course applies to every package you
275: install from source when you haven't completely read and
276: understood the source code of the package, the compiler that
277: is used to build the package and all the other tools that are
278: involved.</p>
279: </div>
280: </div>
281: <div class="sect1" lang="en">
282: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
283: <a name="building-packages-from-source"></a>4.2. Building packages from source</h2></div></div></div>
284: <p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
285: directory now contains a set of packages, organized into
286: categories. You can browse the online index of packages, or run
287: <span><strong class="command">make readme</strong></span> from the <code class="filename">pkgsrc</code>
288: directory to build local <code class="filename">README.html</code> files for
289: all packages, viewable with any web browser such as <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p>
290: <p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
291: is <code class="filename">/usr/pkg</code>. If you wish to change this, you
292: should do so by setting <code class="varname">LOCALBASE</code> in
293: <code class="filename">mk.conf</code>. You should not try to use multiple
294: different <code class="varname">LOCALBASE</code> definitions on the same
295: system (inside a chroot is an exception). </p>
296: <p>The rest of this chapter assumes that the package is already
297: in pkgsrc. If it is not, see <a href="developers-guide.html" title="Part II. The pkgsrc developer's guide">Part II, “The pkgsrc developer's guide”</a> for
298: instructions how to create your own packages.</p>
299: <div class="sect2" lang="en">
300: <div class="titlepage"><div><div><h3 class="title">
301: <a name="requirements"></a>4.2.1. Requirements</h3></div></div></div>
302: <p>To build packages from source, you need a working C
303: compiler. On NetBSD, you need to install the
304: “<span class="quote">comp</span>” and the “<span class="quote">text</span>” distribution
305: sets. If you want to build X11-related packages, the
306: “<span class="quote">xbase</span>” and “<span class="quote">xcomp</span>” distribution
307: sets are required, too.</p>
308: </div>
309: <div class="sect2" lang="en">
310: <div class="titlepage"><div><div><h3 class="title">
311: <a name="fetching-distfiles"></a>4.2.2. Fetching distfiles</h3></div></div></div>
312: <p>The first step for building a package is downloading the
313: distfiles (i.e. the unmodified source). If they have not yet been
314: downloaded, pkgsrc will fetch them automatically.</p>
315: <p>If you have all files that you need in the
316: <code class="filename">distfiles</code> directory,
317: you don't need to connect. If the distfiles are on CD-ROM, you can
318: mount the CD-ROM on <code class="filename">/cdrom</code> and add:
319: </p>
320: <pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre>
321: <p>
322: to your <code class="filename">mk.conf</code>.</p>
323: <p>By default a list of distribution sites will be randomly
324: intermixed to prevent huge load on servers which holding popular
325: packages (for example, SourceForge.net mirrors). Thus, every
326: time when you need to fetch yet another distfile all the mirrors
327: will be tried in new (random) order. You can turn this feature
328: off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for
329: <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p>
330: <p>You can overwrite some of the major distribution sites to
331: fit to sites that are close to your own. By setting one or two
332: variables you can modify the order in which the master sites are
333: accessed. <code class="varname">MASTER_SORT</code> contains a whitespace
334: delimited list of domain suffixes.
335: <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it
336: contains a whitespace delimited list of regular expressions. It
337: has higher priority than <code class="varname">MASTER_SORT</code>. Have a
338: look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find
339: some examples. This may save some of your bandwidth and
340: time.</p>
341: <p>You can change these settings either in your shell's environment, or,
342: if you want to keep the settings, by editing the
343: <code class="filename">/etc/mk.conf</code> file,
344: and adding the definitions there.</p>
345: <p>
346: If a package depends on many other packages (such as
347: <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde3/README.html" target="_top"><code class="filename">meta-pkgs/kde3</code></a>), the build process may
348: alternate between periods of
349: downloading source, and compiling. To ensure you have all the source
350: downloaded initially you can run the command:
351: </p>
352: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre>
353: <p>
354: which will output and run a set of shell commands to fetch the
355: necessary files into the <code class="filename">distfiles</code> directory. You can
356: also choose to download the files manually.
357: </p>
358: </div>
359: <div class="sect2" lang="en">
360: <div class="titlepage"><div><div><h3 class="title">
361: <a name="how-to-build-and-install"></a>4.2.3. How to build and install</h3></div></div></div>
362: <p>
363: Once the software has downloaded, any patches will be applied, then it
364: will be compiled for you. This may take some time depending on your
365: computer, and how many other packages the software depends on and their
366: compile time.
367: </p>
368: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
369: <h3 class="title">Note</h3>
370: <p>If using bootstrap or pkgsrc on a non-NetBSD system,
371: use the pkgsrc <span><strong class="command">bmake</strong></span> command instead of
372: “<span class="quote">make</span>” in the examples in this guide.</p>
373: </div>
374: <p>For example, type</p>
375: <pre class="screen">
376: <code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
377: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
378: </pre>
379: <p>at the shell prompt to build the various components of the
380: package.</p>
381: <p>The next stage is to actually install the newly compiled
382: program onto your system. Do this by entering:
383:
384: </p>
385: <pre class="screen">
386: <code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong>
387: </pre>
388: <p>
389:
390: while you are still in the directory for whatever package you
391: are installing.</p>
392: <p>Installing the package on your system may require you to
393: be root. However, pkgsrc has a
394: <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you
395: to only become root for the actual installation step.</p>
396: <p>That's it, the software should now be installed and setup for use.
397: You can now enter:
398:
399: </p>
400: <pre class="screen">
401: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong>
402: </pre>
403: <p>
404:
405: to remove the compiled files in the work directory, as you shouldn't need
406: them any more. If other packages were also added to your system
407: (dependencies) to allow your program to compile, you can tidy these up
408: also with the command:</p>
409: <pre class="screen">
410: <code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong>
411: </pre>
412: <p>Taking the figlet utility as an example, we can install it on our
413: system by building as shown in <a href="logs.html" title="Appendix B. Build logs">Appendix B, <i>Build logs</i></a>.</p>
414: <p>The program is installed under the default root of the
415: packages tree - <code class="filename">/usr/pkg</code>. Should this not
416: conform to your tastes, set the <code class="varname">LOCALBASE</code>
417: variable in your environment, and it will use that value as the
418: root of your packages tree. So, to use
419: <code class="filename">/usr/local</code>, set
420: <code class="varname">LOCALBASE=/usr/local</code> in your environment.
421: Please note that you should use a directory which is dedicated to
422: packages and not shared with other programs (i.e., do not try and
423: use <code class="varname">LOCALBASE=/usr</code>). Also, you should not try
424: to add any of your own files or directories (such as
425: <code class="filename">src/</code>, <code class="filename">obj/</code>, or
426: <code class="filename">pkgsrc/</code>) below the
427: <code class="varname">LOCALBASE</code> tree. This is to prevent possible
428: conflicts between programs and other files installed by the
429: package system and whatever else may have been installed
430: there.</p>
431: <p>Some packages look in <code class="filename">/etc/mk.conf</code> to
432: alter some configuration options at build time. Have a look at
433: <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview
434: of what will be set there by default. Environment variables such
435: as <code class="varname">LOCALBASE</code> can be set in
436: <code class="filename">/etc/mk.conf</code> to save having to remember to
437: set them each time you want to use pkgsrc.</p>
438: <p>Occasionally, people want to “<span class="quote">look under the
439: covers</span>” to see what is going on when a package is building
440: or being installed. This may be for debugging purposes, or out of
441: simple curiosity. A number of utility values have been added to
442: help with this.</p>
443: <div class="orderedlist"><ol type="1">
444: <li>
445: <p>If you invoke the <a href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with
446: <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of
447: information will be displayed. For example,</p>
448: <pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre>
449: <p>will show all the commands that are invoked, up to and
450: including the “<span class="quote">patch</span>” stage.</p>
451: </li>
452: <li>
453: <p>If you want to know the value of a certain <a href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
454: definition, then the <code class="varname">VARNAME</code> definition
455: should be used, in conjunction with the show-var
456: target. e.g. to show the expansion of the <a href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
457: variable <code class="varname">LOCALBASE</code>:</p>
458: <pre class="screen">
459: <code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
460: /usr/pkg
461: <code class="prompt">%</code>
462: </pre>
463: </li>
464: </ol></div>
465: <p>If you want to install a binary package that you've either
466: created yourself (see next section), that you put into
467: pkgsrc/packages manually or that is located on a remote FTP
468: server, you can use the "bin-install" target. This target will
469: install a binary package - if available - via <a href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>,
470: else do a <span><strong class="command">make package</strong></span>. The list of remote FTP
471: sites searched is kept in the variable
472: <code class="varname">BINPKG_SITES</code>, which defaults to
473: ftp.NetBSD.org. Any flags that should be added to <a href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>
474: can be put into <code class="varname">BIN_INSTALL_FLAGS</code>. See
475: <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more
476: details.</p>
477: <p>A final word of warning: If you set up a system that has a
478: non-standard setting for <code class="varname">LOCALBASE</code>, be sure to
479: set that before any packages are installed, as you cannot use
480: several directories for the same purpose. Doing so will result in
481: pkgsrc not being able to properly detect your installed packages,
482: and fail miserably. Note also that precompiled binary packages are
483: usually built with the default <code class="varname">LOCALBASE</code> of
484: <code class="filename">/usr/pkg</code>, and that you should
485: <span class="emphasis"><em>not</em></span> install any if you use a non-standard
486: <code class="varname">LOCALBASE</code>.</p>
487: </div>
488: </div>
489: </div>
490: <div class="navfooter">
491: <hr>
492: <table width="100%" summary="Navigation footer">
493: <tr>
494: <td width="40%" align="left">
495: <a accesskey="p" href="platforms.html">Prev</a> </td>
496: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
497: <td width="40%" align="right"> <a accesskey="n" href="configuring.html">Next</a>
498: </td>
499: </tr>
500: <tr>
501: <td width="40%" align="left" valign="top">Chapter 3. Using pkgsrc on systems other than NetBSD </td>
502: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
503: <td width="40%" align="right" valign="top"> Chapter 5. Configuring pkgsrc</td>
504: </tr>
505: </table>
506: </div>
507: </body>
508: </html>
CVSweb <webmaster@jp.NetBSD.org>