Annotation of pkgsrc/doc/pkgsrc.html, revision 1.73
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.67 hubertf 4: "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
1.67 hubertf 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.67 hubertf 22: <h1 class="title"><a name="the-pkgsrc-guide"></a>The
23: pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
1.48 dillo 64: <p class="copyright">Copyright © 1994-2005 The
1.1 grant 65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.73 ! rillig 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.16
! 70: 2006/05/12 23:03:22 rillig Exp $</p>
1.1 grant 71: </div>
72:
73: <div>
74: <div class="abstract">
75: <p class="title"><b>Abstract</b></p>
76:
77: <p>Information about using the NetBSD package system
78: (pkgsrc) from both a user view for installing packages
79: as well as from a pkgsrc developers' view for creating
80: new packages.</p>
81: </div>
82: </div>
83: </div>
84: <hr />
85: </div>
86:
87: <div class="toc">
88: <p><b>Table of Contents</b></p>
89:
90: <dl>
1.51 rillig 91: <dt><span class="chapter"><a href="#introduction">1. What
92: is pkgsrc?</a></span></dt>
1.1 grant 93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.46 gdt 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
1.59 rillig 117: to get pkgsrc and how to keep it
118: up-to-date</a></span></dt>
1.1 grant 119:
120: <dd>
121: <dl>
1.30 wiz 122: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 123: As tar file</a></span></dt>
124:
1.30 wiz 125: <dt><span class="sect1"><a href="#via-sup">2.2. Via
126: SUP</a></span></dt>
1.1 grant 127:
1.30 wiz 128: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
129: CVS</a></span></dt>
1.59 rillig 130:
131: <dt><span class="sect1"><a href=
132: "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
133: CVS</a></span></dt>
1.1 grant 134: </dl>
135: </dd>
136:
137: <dt><span class="chapter"><a href="#platforms">3. Using
138: pkgsrc on systems other than NetBSD</a></span></dt>
139:
140: <dd>
141: <dl>
1.30 wiz 142: <dt><span class="sect1"><a href=
143: "#bootstrapping-pkgsrc">3.1. Bootstrapping
144: pkgsrc</a></span></dt>
1.1 grant 145:
1.30 wiz 146: <dt><span class="sect1"><a href=
1.47 reed 147: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 148: notes</a></span></dt>
1.1 grant 149:
150: <dd>
151: <dl>
152: <dt><span class="sect2"><a href=
1.30 wiz 153: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 154: X)</a></span></dt>
155:
156: <dt><span class="sect2"><a href=
1.30 wiz 157: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 158:
159: <dt><span class="sect2"><a href=
1.30 wiz 160: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 161:
1.30 wiz 162: <dt><span class="sect2"><a href="#irix">3.2.4.
163: IRIX</a></span></dt>
1.1 grant 164:
1.30 wiz 165: <dt><span class="sect2"><a href="#linux">3.2.5.
166: Linux</a></span></dt>
1.1 grant 167:
168: <dt><span class="sect2"><a href=
1.30 wiz 169: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 170:
171: <dt><span class="sect2"><a href=
1.30 wiz 172: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 173: </dl>
174: </dd>
175: </dl>
176: </dd>
177:
178: <dt><span class="chapter"><a href="#using">4. Using
179: pkgsrc</a></span></dt>
180:
181: <dd>
182: <dl>
1.70 rillig 183: <dt><span class="sect1"><a href="#using-pkg">4.1.
184: Using binary packages</a></span></dt>
1.1 grant 185:
186: <dd>
187: <dl>
188: <dt><span class="sect2"><a href=
1.70 rillig 189: "#finding-binary-packages">4.1.1. Finding
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.70 rillig 193: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 194: binary packages</a></span></dt>
1.1 grant 195:
196: <dt><span class="sect2"><a href=
1.30 wiz 197: "#a-word-of-warning">4.1.3. A word of
1.1 grant 198: warning</a></span></dt>
199: </dl>
200: </dd>
201:
1.30 wiz 202: <dt><span class="sect1"><a href=
203: "#building-packages-from-source">4.2. Building
204: packages from source</a></span></dt>
1.1 grant 205:
206: <dd>
207: <dl>
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#requirements">4.2.1.
1.1 grant 210: Requirements</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 214: distfiles</a></span></dt>
215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#how-to-build-and-install">4.2.3. How to build
218: and install</a></span></dt>
1.1 grant 219:
220: <dt><span class="sect2"><a href=
1.30 wiz 221: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 222: compiler</a></span></dt>
223: </dl>
224: </dd>
225: </dl>
226: </dd>
227:
1.38 dillo 228: <dt><span class="chapter"><a href="#configuring">5.
229: Configuring pkgsrc</a></span></dt>
230:
231: <dd>
232: <dl>
233: <dt><span class="sect1"><a href=
1.45 wiz 234: "#general-configuration">5.1. General
235: configuration</a></span></dt>
236:
237: <dt><span class="sect1"><a href=
238: "#variables-affecting-build">5.2. Variables
239: affecting the build process</a></span></dt>
240:
241: <dt><span class="sect1"><a href=
242: "#developer-advanced-settings">5.3.
243: Developer/advanced settings</a></span></dt>
244:
245: <dt><span class="sect1"><a href=
246: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 247: Options</a></span></dt>
1.38 dillo 248: </dl>
249: </dd>
250:
251: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 252: binary packages</a></span></dt>
253:
254: <dd>
255: <dl>
1.30 wiz 256: <dt><span class="sect1"><a href=
1.38 dillo 257: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 258: single binary package</a></span></dt>
1.1 grant 259:
1.30 wiz 260: <dt><span class="sect1"><a href=
1.38 dillo 261: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 262: Settings for creation of binary
263: packages</a></span></dt>
264:
1.38 dillo 265: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 266: Doing a bulk build of all packages</a></span></dt>
267:
268: <dd>
269: <dl>
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#binary.configuration">6.3.1.
1.1 grant 272: Configuration</a></span></dt>
273:
274: <dt><span class="sect2"><a href=
1.38 dillo 275: "#other-environmental-considerations">6.3.2.
1.30 wiz 276: Other environmental
1.1 grant 277: considerations</a></span></dt>
278:
279: <dt><span class="sect2"><a href=
1.38 dillo 280: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#what-it-does">6.3.4. What it
1.1 grant 284: does</a></span></dt>
285:
286: <dt><span class="sect2"><a href=
1.38 dillo 287: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 288: requirements</a></span></dt>
289:
290: <dt><span class="sect2"><a href=
1.38 dillo 291: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 292: sandbox for chrooted builds</a></span></dt>
1.1 grant 293:
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 296: partial set of packages</a></span></dt>
1.13 hubertf 297:
298: <dt><span class="sect2"><a href=
1.38 dillo 299: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 300: bulk build</a></span></dt>
1.1 grant 301: </dl>
302: </dd>
303:
1.30 wiz 304: <dt><span class="sect1"><a href=
1.38 dillo 305: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 306: packages collection</a></span></dt>
1.1 grant 307:
308: <dd>
309: <dl>
310: <dt><span class="sect2"><a href=
1.38 dillo 311: "#cdpack-example">6.4.1. Example of
1.1 grant 312: cdpack</a></span></dt>
313: </dl>
314: </dd>
315: </dl>
316: </dd>
317:
1.38 dillo 318: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 319: Asked Questions</a></span></dt>
320:
321: <dd>
322: <dl>
1.30 wiz 323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 325: lists for pkg-related discussion?</a></span></dt>
1.1 grant 326:
1.30 wiz 327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 329: documentation?</a></span></dt>
1.1 grant 330:
1.5 hubertf 331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 333: management (pkgtools)</a></span></dt>
1.1 grant 334:
1.30 wiz 335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 337: non-root</a></span></dt>
338:
339: <dt><span class="sect1"><a href=
1.38 dillo 340: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 341: when fetching distfiles?</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.38 dillo 344: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 345: XFree86 from pkgsrc?</a></span></dt>
346:
347: <dt><span class="sect1"><a href=
1.38 dillo 348: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 349: X.org from pkgsrc?</a></span></dt>
1.1 grant 350:
1.30 wiz 351: <dt><span class="sect1"><a href=
1.38 dillo 352: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 353: from behind a firewall</a></span></dt>
1.1 grant 354:
1.38 dillo 355: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 356: How do I tell <span><strong class="command">make
357: fetch</strong></span> to do passive
1.1 grant 358: FTP?</a></span></dt>
359:
1.30 wiz 360: <dt><span class="sect1"><a href=
1.38 dillo 361: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 362: distfiles at once</a></span></dt>
1.1 grant 363:
1.30 wiz 364: <dt><span class="sect1"><a href=
1.38 dillo 365: "#tmac.andoc-missing">7.11. What does
1.30 wiz 366: “<span class="quote">Don't know how to make
367: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 368: mean?</a></span></dt>
1.13 hubertf 369:
1.30 wiz 370: <dt><span class="sect1"><a href=
1.38 dillo 371: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 372: “<span class="quote">Could not find
1.14 xtraeme 373: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 374:
1.30 wiz 375: <dt><span class="sect1"><a href=
1.38 dillo 376: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 377: pkgsrc</a></span></dt>
1.1 grant 378:
1.38 dillo 379: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 380: How do I change the location of configuration
381: files?</a></span></dt>
1.1 grant 382:
383: <dt><span class="sect1"><a href=
1.38 dillo 384: "#audit-packages">7.15. Automated security
1.1 grant 385: checks</a></span></dt>
386: </dl>
387: </dd>
388: </dl>
389: </dd>
390:
1.46 gdt 391: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 392: pkgsrc developer's guide</a></span></dt>
393:
394: <dd>
395: <dl>
1.38 dillo 396: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 397: Package components - files, directories and
398: contents</a></span></dt>
399:
400: <dd>
401: <dl>
402: <dt><span class="sect1"><a href=
1.45 wiz 403: "#components.Makefile">8.1. <code xmlns=
404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 405: "filename">Makefile</code></a></span></dt>
406:
407: <dt><span class="sect1"><a href=
1.45 wiz 408: "#components.distinfo">8.2. <code xmlns=
409: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 410: "filename">distinfo</code></a></span></dt>
411:
412: <dt><span class="sect1"><a href=
1.38 dillo 413: "#components.patches">8.3.
1.27 rillig 414: patches/*</a></span></dt>
415:
1.30 wiz 416: <dt><span class="sect1"><a href=
1.38 dillo 417: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 418: files</a></span></dt>
1.27 rillig 419:
420: <dt><span class="sect1"><a href=
1.38 dillo 421: "#components.optional">8.5. Optional
1.27 rillig 422: files</a></span></dt>
423:
1.38 dillo 424: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 425: <code xmlns=
426: "http://www.w3.org/TR/xhtml1/transitional" class=
427: "filename">work*</code></a></span></dt>
1.27 rillig 428:
1.38 dillo 429: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 430: <code xmlns=
431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 432: "filename">files/*</code></a></span></dt>
433: </dl>
434: </dd>
435:
1.38 dillo 436: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 437: Programming in <code xmlns=
438: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 439: "filename">Makefile</code>s</a></span></dt>
440:
441: <dd>
442: <dl>
443: <dt><span class="sect1"><a href=
1.45 wiz 444: "#makefile.variables">9.1. <code xmlns=
445: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 446: "filename">Makefile</code>
447: variables</a></span></dt>
448:
1.27 rillig 449: <dd>
450: <dl>
451: <dt><span class="sect2"><a href=
1.38 dillo 452: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 453: conventions</a></span></dt>
454: </dl>
455: </dd>
456:
1.25 rillig 457: <dt><span class="sect1"><a href=
1.38 dillo 458: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 459:
460: <dd>
461: <dl>
462: <dt><span class="sect2"><a href=
1.38 dillo 463: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 464: list</a></span></dt>
465:
466: <dt><span class="sect2"><a href=
1.38 dillo 467: "#converting-internal-to-external">9.2.2.
1.30 wiz 468: Converting an internal list into an external
469: list</a></span></dt>
1.25 rillig 470:
471: <dt><span class="sect2"><a href=
1.38 dillo 472: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 473: variables to a shell command</a></span></dt>
1.27 rillig 474:
475: <dt><span class="sect2"><a href=
1.38 dillo 476: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 477: guideline</a></span></dt>
478:
479: <dt><span class="sect2"><a href=
1.38 dillo 480: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 481: for a bug in BSD Make</a></span></dt>
1.25 rillig 482: </dl>
483: </dd>
484: </dl>
485: </dd>
486:
1.38 dillo 487: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 488: issues</a></span></dt>
489:
490: <dd>
491: <dl>
1.38 dillo 492: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 493: ID</a></span></dt>
1.1 grant 494:
1.30 wiz 495: <dt><span class="sect1"><a href=
1.38 dillo 496: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 497: <code xmlns=
498: "http://www.w3.org/TR/xhtml1/transitional" class=
499: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 500:
1.38 dillo 501: <dt><span class="sect1"><a href=
502: "#print-PLIST">10.3. Tweaking output of
503: <span><strong class="command">make
1.14 xtraeme 504: print-PLIST</strong></span></a></span></dt>
1.1 grant 505:
1.38 dillo 506: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 507: Variable substitution in PLIST</a></span></dt>
508:
1.30 wiz 509: <dt><span class="sect1"><a href=
1.48 dillo 510: "#manpage-compression">10.5. Man page
511: compression</a></span></dt>
1.1 grant 512:
1.30 wiz 513: <dt><span class="sect1"><a href=
1.38 dillo 514: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 515: <code class=
1.14 xtraeme 516: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 517:
1.30 wiz 518: <dt><span class="sect1"><a href=
1.47 reed 519: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 520: and differing PLISTs</a></span></dt>
1.1 grant 521:
522: <dt><span class="sect1"><a href=
1.38 dillo 523: "#faq.common-dirs">10.8. Sharing directories
524: between packages</a></span></dt>
1.1 grant 525: </dl>
526: </dd>
527:
1.38 dillo 528: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 529: Buildlink methodology</a></span></dt>
530:
531: <dd>
532: <dl>
1.30 wiz 533: <dt><span class="sect1"><a href=
1.38 dillo 534: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 535: packages to use buildlink3</a></span></dt>
1.1 grant 536:
1.30 wiz 537: <dt><span class="sect1"><a href=
1.38 dillo 538: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 539: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
540: class="filename">buildlink3.mk</code>
1.14 xtraeme 541: files</a></span></dt>
1.1 grant 542:
543: <dd>
544: <dl>
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 547: buildlink3.mk file</a></span></dt>
1.1 grant 548:
549: <dt><span class="sect2"><a href=
1.38 dillo 550: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 551: <code class=
1.72 rillig 552: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 553: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 554: <code xmlns=
555: "http://www.w3.org/TR/xhtml1/transitional"
556: class="filename">buildlink3.mk</code>
1.1 grant 557: files</a></span></dt>
558: </dl>
559: </dd>
560:
1.30 wiz 561: <dt><span class="sect1"><a href=
1.45 wiz 562: "#writing-builtin.mk">11.3. Writing <code xmlns=
563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 564: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 565:
566: <dd>
567: <dl>
568: <dt><span class="sect2"><a href=
1.38 dillo 569: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 570: <code xmlns=
571: "http://www.w3.org/TR/xhtml1/transitional"
572: class="filename">builtin.mk</code>
1.1 grant 573: file</a></span></dt>
574:
575: <dt><span class="sect2"><a href=
1.38 dillo 576: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 577: preferences for native or pkgsrc
578: software</a></span></dt>
1.1 grant 579: </dl>
580: </dd>
581: </dl>
582: </dd>
583:
1.38 dillo 584: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 585: pkginstall framework</a></span></dt>
586:
587: <dd>
588: <dl>
589: <dt><span class="sect1"><a href=
1.38 dillo 590: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 591: directories outside the installation
592: prefix</a></span></dt>
593:
594: <dd>
595: <dl>
596: <dt><span class="sect2"><a href=
1.38 dillo 597: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 598: manipulation</a></span></dt>
599:
600: <dt><span class="sect2"><a href=
1.38 dillo 601: "#files-outside-prefix">12.1.2. File
1.35 jmmv 602: manipulation</a></span></dt>
603: </dl>
604: </dd>
605:
1.38 dillo 606: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 607: Configuration files</a></span></dt>
608:
609: <dd>
610: <dl>
611: <dt><span class="sect2"><a href=
1.38 dillo 612: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 613: <code class="varname">PKG_SYSCONFDIR</code> is
614: set</a></span></dt>
615:
616: <dt><span class="sect2"><a href=
1.38 dillo 617: "#conf-files-configure">12.2.2. Telling the
1.47 reed 618: software where configuration files
1.35 jmmv 619: are</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.38 dillo 622: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 623: installations</a></span></dt>
624:
625: <dt><span class="sect2"><a href=
1.38 dillo 626: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 627: handling of configuration files</a></span></dt>
628: </dl>
629: </dd>
630:
631: <dt><span class="sect1"><a href=
1.38 dillo 632: "#rcd-scripts">12.3. System startup
1.35 jmmv 633: scripts</a></span></dt>
634:
635: <dd>
636: <dl>
637: <dt><span class="sect2"><a href=
1.38 dillo 638: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 639: handling of system startup
640: scripts</a></span></dt>
641: </dl>
642: </dd>
643:
644: <dt><span class="sect1"><a href=
1.38 dillo 645: "#users-and-groups">12.4. System users and
1.35 jmmv 646: groups</a></span></dt>
647:
1.38 dillo 648: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 649: System shells</a></span></dt>
650:
651: <dd>
652: <dl>
653: <dt><span class="sect2"><a href=
1.65 hubertf 654: "#shells-disable">12.5.1. Disabling shell
655: registration</a></span></dt>
656: </dl>
657: </dd>
658:
659: <dt><span class="sect1"><a href="#fonts">12.6.
660: Fonts</a></span></dt>
661:
662: <dd>
663: <dl>
664: <dt><span class="sect2"><a href=
665: "#fonts-disable">12.6.1. Disabling automatic
666: update of the fonts databases</a></span></dt>
1.35 jmmv 667: </dl>
668: </dd>
669: </dl>
670: </dd>
671:
1.38 dillo 672: <dt><span class="chapter"><a href="#options">13.
1.1 grant 673: Options handling</a></span></dt>
674:
675: <dd>
676: <dl>
1.30 wiz 677: <dt><span class="sect1"><a href=
1.38 dillo 678: "#global-default-options">13.1. Global default
1.30 wiz 679: options</a></span></dt>
1.1 grant 680:
1.30 wiz 681: <dt><span class="sect1"><a href=
1.38 dillo 682: "#converting-to-options">13.2. Converting packages
1.45 wiz 683: to use <code xmlns=
684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 685: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 686:
687: <dt><span class="sect1"><a href=
688: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 689: </dl>
690: </dd>
691:
1.38 dillo 692: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 693: build process</a></span></dt>
694:
695: <dd>
696: <dl>
697: <dt><span class="sect1"><a href=
1.56 rillig 698: "#build.intro">14.1. Introduction</a></span></dt>
699:
700: <dt><span class="sect1"><a href=
701: "#build.prefix">14.2. Program
1.1 grant 702: location</a></span></dt>
703:
1.30 wiz 704: <dt><span class="sect1"><a href=
1.56 rillig 705: "#build.builddirs">14.3. Directories used during
706: the build process</a></span></dt>
707:
708: <dt><span class="sect1"><a href=
709: "#build.running">14.4. Running a
710: phase</a></span></dt>
711:
712: <dt><span class="sect1"><a href=
713: "#build.fetch">14.5. The <span class=
714: "emphasis"><em>fetch</em></span>
715: phase</a></span></dt>
716:
717: <dt><span class="sect1"><a href=
718: "#build.checksum">14.6. The <span class=
719: "emphasis"><em>checksum</em></span>
720: phase</a></span></dt>
721:
722: <dt><span class="sect1"><a href=
723: "#build.extract">14.7. The <span class=
724: "emphasis"><em>extract</em></span>
725: phase</a></span></dt>
726:
727: <dt><span class="sect1"><a href=
728: "#build.patch">14.8. The <span class=
729: "emphasis"><em>patch</em></span>
730: phase</a></span></dt>
731:
732: <dt><span class="sect1"><a href=
733: "#build.tools">14.9. The <span class=
734: "emphasis"><em>tools</em></span>
735: phase</a></span></dt>
736:
737: <dt><span class="sect1"><a href=
738: "#build.wrapper">14.10. The <span class=
739: "emphasis"><em>wrapper</em></span>
740: phase</a></span></dt>
741:
742: <dt><span class="sect1"><a href=
743: "#build.configure">14.11. The <span class=
744: "emphasis"><em>configure</em></span>
745: phase</a></span></dt>
746:
747: <dt><span class="sect1"><a href=
748: "#build.build">14.12. The <span class=
749: "emphasis"><em>build</em></span>
750: phase</a></span></dt>
751:
752: <dt><span class="sect1"><a href=
753: "#build.test">14.13. The <span class=
754: "emphasis"><em>test</em></span>
755: phase</a></span></dt>
756:
757: <dt><span class="sect1"><a href=
758: "#build.install">14.14. The <span class=
759: "emphasis"><em>install</em></span>
760: phase</a></span></dt>
1.1 grant 761:
762: <dt><span class="sect1"><a href=
1.56 rillig 763: "#build.package">14.15. The <span class=
764: "emphasis"><em>package</em></span>
765: phase</a></span></dt>
766:
767: <dt><span class="sect1"><a href=
768: "#build.helpful-targets">14.16. Other helpful
1.1 grant 769: targets</a></span></dt>
770: </dl>
771: </dd>
772:
1.68 rillig 773: <dt><span class="chapter"><a href="#tools">15. Tools
774: needed for building or running</a></span></dt>
775:
776: <dd>
777: <dl>
778: <dt><span class="sect1"><a href=
779: "#pkgsrc-tools">15.1. Tools for pkgsrc
780: builds</a></span></dt>
781:
782: <dt><span class="sect1"><a href=
783: "#package-tools">15.2. Tools needed by
784: packages</a></span></dt>
785:
786: <dt><span class="sect1"><a href=
787: "#platform-tools">15.3. Tools provided by
788: platforms</a></span></dt>
789: </dl>
790: </dd>
791:
792: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 793: your package work</a></span></dt>
1.1 grant 794:
795: <dd>
796: <dl>
1.30 wiz 797: <dt><span class="sect1"><a href=
1.68 rillig 798: "#general-operation">16.1. General
1.30 wiz 799: operation</a></span></dt>
1.1 grant 800:
801: <dd>
802: <dl>
803: <dt><span class="sect2"><a href=
1.68 rillig 804: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 805: pull in variables from
806: /etc/mk.conf</a></span></dt>
1.1 grant 807:
808: <dt><span class="sect2"><a href=
1.68 rillig 809: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 810: to install documentation</a></span></dt>
811:
812: <dt><span class="sect2"><a href=
1.68 rillig 813: "#restricted-packages">16.1.3. Restricted
1.1 grant 814: packages</a></span></dt>
815:
816: <dt><span class="sect2"><a href=
1.68 rillig 817: "#dependencies">16.1.4. Handling
1.1 grant 818: dependencies</a></span></dt>
819:
820: <dt><span class="sect2"><a href=
1.68 rillig 821: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 822: other packages</a></span></dt>
823:
824: <dt><span class="sect2"><a href=
1.68 rillig 825: "#not-building-packages">16.1.6. Packages that
1.30 wiz 826: cannot or should not be built</a></span></dt>
1.1 grant 827:
828: <dt><span class="sect2"><a href=
1.68 rillig 829: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 830: should not be deleted, once
831: installed</a></span></dt>
1.1 grant 832:
833: <dt><span class="sect2"><a href=
1.68 rillig 834: "#security-handling">16.1.8. Handling packages
1.1 grant 835: with security problems</a></span></dt>
836:
837: <dt><span class="sect2"><a href=
1.68 rillig 838: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 839: bugs</a></span></dt>
840:
841: <dt><span class="sect2"><a href=
1.68 rillig 842: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 843: incrementing versions when fixing an existing
1.1 grant 844: package</a></span></dt>
845:
846: <dt><span class="sect2"><a href=
1.68 rillig 847: "#portability-of-packages">16.1.11. Portability
1.30 wiz 848: of packages</a></span></dt>
1.1 grant 849: </dl>
850: </dd>
851:
1.30 wiz 852: <dt><span class="sect1"><a href=
1.68 rillig 853: "#downloading-issues">16.2. Possible downloading
1.30 wiz 854: issues</a></span></dt>
1.1 grant 855:
856: <dd>
857: <dl>
858: <dt><span class="sect2"><a href=
1.68 rillig 859: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 860: distfiles aren't available for plain
1.1 grant 861: downloading</a></span></dt>
862:
863: <dt><span class="sect2"><a href=
1.68 rillig 864: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 865: handle modified distfiles with the 'old'
866: name</a></span></dt>
1.1 grant 867: </dl>
868: </dd>
869:
1.30 wiz 870: <dt><span class="sect1"><a href=
1.68 rillig 871: "#configuration-gotchas">16.3. Configuration
1.30 wiz 872: gotchas</a></span></dt>
1.1 grant 873:
874: <dd>
875: <dl>
876: <dt><span class="sect2"><a href=
1.68 rillig 877: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 878: libtool</a></span></dt>
879:
880: <dt><span class="sect2"><a href=
1.68 rillig 881: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 882: packages that already support
883: libtool</a></span></dt>
884:
885: <dt><span class="sect2"><a href=
1.68 rillig 886: "#autoconf-automake">16.3.3. GNU
1.1 grant 887: Autoconf/Automake</a></span></dt>
888: </dl>
889: </dd>
890:
1.30 wiz 891: <dt><span class="sect1"><a href=
1.68 rillig 892: "#fixes-build">16.4. Building the
1.55 rillig 893: package</a></span></dt>
1.1 grant 894:
895: <dd>
896: <dl>
897: <dt><span class="sect2"><a href=
1.68 rillig 898: "#cpp-defines">16.4.1. CPP
1.1 grant 899: defines</a></span></dt>
1.51 rillig 900:
901: <dt><span class="sect2"><a href=
1.68 rillig 902: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 903: defines for some platforms</a></span></dt>
904:
905: <dt><span class="sect2"><a href=
1.68 rillig 906: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 907: defines</a></span></dt>
1.1 grant 908: </dl>
909: </dd>
910:
1.30 wiz 911: <dt><span class="sect1"><a href=
1.68 rillig 912: "#package-specific-actions">16.5. Package specific
1.30 wiz 913: actions</a></span></dt>
1.1 grant 914:
915: <dd>
916: <dl>
917: <dt><span class="sect2"><a href=
1.68 rillig 918: "#user-interaction">16.5.1. User
1.2 hubertf 919: interaction</a></span></dt>
1.1 grant 920:
921: <dt><span class="sect2"><a href=
1.68 rillig 922: "#handling-licenses">16.5.2. Handling
1.1 grant 923: licenses</a></span></dt>
924:
925: <dt><span class="sect2"><a href=
1.68 rillig 926: "#installing-score-files">16.5.3. Installing
1.30 wiz 927: score files</a></span></dt>
1.1 grant 928:
929: <dt><span class="sect2"><a href=
1.68 rillig 930: "#perl-scripts">16.5.4. Packages containing
1.30 wiz 931: perl scripts</a></span></dt>
1.1 grant 932:
933: <dt><span class="sect2"><a href=
1.68 rillig 934: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 935: hardcoded paths to other
936: interpreters</a></span></dt>
1.1 grant 937:
938: <dt><span class="sect2"><a href=
1.68 rillig 939: "#perl-modules">16.5.6. Packages installing
1.30 wiz 940: perl modules</a></span></dt>
1.1 grant 941:
942: <dt><span class="sect2"><a href=
1.68 rillig 943: "#faq.info-files">16.5.7. Packages installing
1.1 grant 944: info files</a></span></dt>
945:
946: <dt><span class="sect2"><a href=
1.68 rillig 947: "#manpages">16.5.8. Packages installing man
1.57 minskim 948: pages</a></span></dt>
949:
950: <dt><span class="sect2"><a href=
1.68 rillig 951: "#gconf2-data-files">16.5.9. Packages
1.30 wiz 952: installing GConf2 data files</a></span></dt>
1.1 grant 953:
954: <dt><span class="sect2"><a href=
1.68 rillig 955: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 956: installing scrollkeeper data
957: files</a></span></dt>
1.1 grant 958:
959: <dt><span class="sect2"><a href=
1.68 rillig 960: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 961: fonts</a></span></dt>
962:
963: <dt><span class="sect2"><a href=
1.68 rillig 964: "#gtk2-modules">16.5.12. Packages installing
1.30 wiz 965: GTK2 modules</a></span></dt>
1.1 grant 966:
967: <dt><span class="sect2"><a href=
1.68 rillig 968: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 969: SGML or XML data</a></span></dt>
1.1 grant 970:
971: <dt><span class="sect2"><a href=
1.68 rillig 972: "#mime-database">16.5.14. Packages installing
1.1 grant 973: extensions to the MIME database</a></span></dt>
974:
975: <dt><span class="sect2"><a href=
1.68 rillig 976: "#intltool">16.5.15. Packages using
1.1 grant 977: intltool</a></span></dt>
1.18 xtraeme 978:
979: <dt><span class="sect2"><a href=
1.68 rillig 980: "#startup-scripts">16.5.16. Packages installing
1.18 xtraeme 981: startup scripts</a></span></dt>
1.57 minskim 982:
983: <dt><span class="sect2"><a href=
1.68 rillig 984: "#tex-packages">16.5.17. Packages installing
1.57 minskim 985: TeX modules</a></span></dt>
1.1 grant 986: </dl>
987: </dd>
988:
1.30 wiz 989: <dt><span class="sect1"><a href=
1.68 rillig 990: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 991: author</a></span></dt>
1.1 grant 992: </dl>
993: </dd>
994:
1.68 rillig 995: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 996: Debugging</a></span></dt>
997:
1.68 rillig 998: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 999: Submitting and Committing</a></span></dt>
1000:
1001: <dd>
1002: <dl>
1.30 wiz 1003: <dt><span class="sect1"><a href=
1.68 rillig 1004: "#submitting-your-package">18.1. Submitting your
1.30 wiz 1005: packages</a></span></dt>
1.1 grant 1006:
1.30 wiz 1007: <dt><span class="sect1"><a href=
1.68 rillig 1008: "#general-notes-for-changes">18.2. General notes
1.41 wiz 1009: when adding, updating, or removing
1010: packages</a></span></dt>
1011:
1012: <dt><span class="sect1"><a href=
1.68 rillig 1013: "#committing-importing">18.3. Committing: Importing
1.30 wiz 1014: a package into CVS</a></span></dt>
1.1 grant 1015:
1.30 wiz 1016: <dt><span class="sect1"><a href=
1.68 rillig 1017: "#updating-package">18.4. Updating a package to a
1.30 wiz 1018: newer version</a></span></dt>
1.1 grant 1019:
1.30 wiz 1020: <dt><span class="sect1"><a href=
1.68 rillig 1021: "#moving-package">18.5. Moving a package in
1.30 wiz 1022: pkgsrc</a></span></dt>
1.1 grant 1023: </dl>
1024: </dd>
1.69 rillig 1025:
1.72 rillig 1026: <dt><span class="chapter"><a href="#devfaq">19.
1027: Frequently Asked Questions</a></span></dt>
1028: </dl>
1029: </dd>
1030:
1031: <dt><span class="part"><a href="#infrastructure">III. The
1.73 ! rillig 1032: pkgsrc infrastructure internals</a></span></dt>
1.72 rillig 1033:
1034: <dd>
1035: <dl>
1.73 ! rillig 1036: <dt><span class="chapter"><a href="#infr.design">20.
! 1037: Design of the pkgsrc infrastructure</a></span></dt>
! 1038:
! 1039: <dd>
! 1040: <dl>
! 1041: <dt><span class="sect1"><a href="#infr.var">20.1.
! 1042: Variable evaluation</a></span></dt>
! 1043:
! 1044: <dd>
! 1045: <dl>
! 1046: <dt><span class="sect2"><a href=
! 1047: "#infr.var.load">20.1.1. At load
! 1048: time</a></span></dt>
! 1049:
! 1050: <dt><span class="sect2"><a href=
! 1051: "#infr.var.run">20.1.2. At
! 1052: runtime</a></span></dt>
! 1053: </dl>
! 1054: </dd>
! 1055:
! 1056: <dt><span class="sect1"><a href=
! 1057: "#infr.design.intf">20.2. Designing interfaces for
! 1058: Makefile fragments</a></span></dt>
! 1059:
! 1060: <dd>
! 1061: <dl>
! 1062: <dt><span class="sect2"><a href=
! 1063: "#infr.design.intf.proc">20.2.1. Procedures
! 1064: with parameters</a></span></dt>
! 1065:
! 1066: <dt><span class="sect2"><a href=
! 1067: "#infr.design.intf.action">20.2.2. Actions
! 1068: taken on behalf of parameters</a></span></dt>
! 1069: </dl>
! 1070: </dd>
! 1071: </dl>
! 1072: </dd>
! 1073:
! 1074: <dt><span class="chapter"><a href="#regression">21.
1.72 rillig 1075: Regression tests</a></span></dt>
1076:
1077: <dd>
1078: <dl>
1079: <dt><span class="sect1"><a href=
1.73 ! rillig 1080: "#regression.descr">21.1. The regression tests
1.72 rillig 1081: framework</a></span></dt>
1082:
1083: <dt><span class="sect1"><a href=
1.73 ! rillig 1084: "#regression.run">21.2. Running the regression
1.72 rillig 1085: tests</a></span></dt>
1086:
1087: <dt><span class="sect1"><a href=
1.73 ! rillig 1088: "#regression.new">21.3. Adding a new regression
1.72 rillig 1089: test</a></span></dt>
1090:
1091: <dd>
1092: <dl>
1093: <dt><span class="sect2"><a href=
1.73 ! rillig 1094: "#regression.fun.override">21.3.1. Overridable
1.72 rillig 1095: functions</a></span></dt>
1096:
1097: <dt><span class="sect2"><a href=
1.73 ! rillig 1098: "#regression.fun.helper">21.3.2. Helper
1.72 rillig 1099: functions</a></span></dt>
1100: </dl>
1101: </dd>
1102: </dl>
1103: </dd>
1104:
1.73 ! rillig 1105: <dt><span class="chapter"><a href="#porting">22.
1.69 rillig 1106: Porting pkgsrc</a></span></dt>
1107:
1108: <dd>
1109: <dl>
1110: <dt><span class="sect1"><a href=
1.73 ! rillig 1111: "#porting.opsys">22.1. Porting pkgsrc to a new
1.69 rillig 1112: operating system</a></span></dt>
1113:
1114: <dt><span class="sect1"><a href=
1.73 ! rillig 1115: "#porting.compiler">22.2. Adding support for a new
1.69 rillig 1116: compiler</a></span></dt>
1117: </dl>
1118: </dd>
1.1 grant 1119: </dl>
1120: </dd>
1121:
1.46 gdt 1122: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1123: example package: bison</a></span></dt>
1124:
1125: <dd>
1126: <dl>
1.46 gdt 1127: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1128: files</a></span></dt>
1129:
1130: <dd>
1131: <dl>
1.30 wiz 1132: <dt><span class="sect2"><a href=
1.46 gdt 1133: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1134:
1.30 wiz 1135: <dt><span class="sect2"><a href=
1.46 gdt 1136: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1137:
1.30 wiz 1138: <dt><span class="sect2"><a href=
1.46 gdt 1139: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1140:
1.30 wiz 1141: <dt><span class="sect2"><a href=
1.46 gdt 1142: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1143: package with <span><strong class=
1.14 xtraeme 1144: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1145: </dl>
1146: </dd>
1147:
1.46 gdt 1148: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1149: Steps for building, installing,
1150: packaging</a></span></dt>
1.1 grant 1151: </dl>
1152: </dd>
1153:
1.46 gdt 1154: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1155: logs</a></span></dt>
1156:
1157: <dd>
1158: <dl>
1.46 gdt 1159: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1160: Building figlet</a></span></dt>
1161:
1.46 gdt 1162: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1163: Packaging figlet</a></span></dt>
1164: </dl>
1165: </dd>
1166:
1.46 gdt 1167: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1168: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1169:
1.46 gdt 1170: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1171: guidelines for the pkgsrc guide</a></span></dt>
1172:
1173: <dd>
1174: <dl>
1.46 gdt 1175: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1176: Targets</a></span></dt>
1177:
1.46 gdt 1178: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1179: Procedure</a></span></dt>
1180: </dl>
1181: </dd>
1.1 grant 1182: </dl>
1183: </div>
1184:
1.67 hubertf 1185: <div class="chapter" lang="en">
1.1 grant 1186: <div class="titlepage">
1187: <div>
1188: <div>
1.67 hubertf 1189: <h2 class="title"><a name=
1.51 rillig 1190: "introduction"></a>Chapter 1. What is
1191: pkgsrc?</h2>
1.1 grant 1192: </div>
1193: </div>
1194: </div>
1195:
1196: <div class="toc">
1197: <p><b>Table of Contents</b></p>
1198:
1199: <dl>
1.30 wiz 1200: <dt><span class="sect1"><a href=
1201: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1202:
1203: <dt><span class="sect1"><a href="#overview">1.2.
1204: Overview</a></span></dt>
1205:
1206: <dt><span class="sect1"><a href="#terminology">1.3.
1207: Terminology</a></span></dt>
1208:
1209: <dt><span class="sect1"><a href="#typography">1.4.
1210: Typography</a></span></dt>
1211: </dl>
1212: </div>
1213:
1.67 hubertf 1214: <div class="sect1" lang="en">
1.1 grant 1215: <div class="titlepage">
1216: <div>
1217: <div>
1218: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1219: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1220: </div>
1221: </div>
1222: </div>
1223:
1.47 reed 1224: <p>There is a lot of software freely available for
1225: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1226: Unix-flavoured systems, too, sometimes with some
1227: modifications. The NetBSD Packages Collection (pkgsrc)
1228: incorporates any such changes necessary to make that
1229: software run, and makes the installation (and
1230: de-installation) of the software package easy by means of a
1231: single command.</p>
1232:
1233: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1234: the <span><strong class="command">pkg_*</strong></span>
1235: tools so that installation and de-installation, printing of
1236: an inventory of all installed packages and retrieval of
1237: one-line comments or more verbose descriptions are all
1238: simple.</p>
1.1 grant 1239:
1240: <p>pkgsrc currently contains several thousand packages,
1241: including:</p>
1242:
1243: <div class="itemizedlist">
1244: <ul type="disc">
1245: <li>
1246: <p><a xmlns=
1247: "http://www.w3.org/TR/xhtml1/transitional" href=
1248: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1249: target="_top"><code xmlns="" class=
1250: "filename">www/apache</code></a> - The Apache web
1.20 ben 1251: server</p>
1.1 grant 1252: </li>
1253:
1254: <li>
1255: <p><a xmlns=
1256: "http://www.w3.org/TR/xhtml1/transitional" href=
1257: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1258: target="_top"><code xmlns="" class=
1259: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1260: browser</p>
1.1 grant 1261: </li>
1262:
1263: <li>
1264: <p><a xmlns=
1265: "http://www.w3.org/TR/xhtml1/transitional" href=
1266: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1267: target="_top"><code xmlns="" class=
1268: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1269: Desktop Environment</p>
1.1 grant 1270: </li>
1271:
1272: <li>
1273: <p><a xmlns=
1274: "http://www.w3.org/TR/xhtml1/transitional" href=
1275: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1276: target="_top"><code xmlns="" class=
1277: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1278: Environment</p>
1.1 grant 1279: </li>
1280: </ul>
1281: </div>
1282:
1283: <p>...just to name a few.</p>
1284:
1285: <p>pkgsrc has built-in support for handling varying
1286: dependencies, such as pthreads and X11, and extended
1287: features such as IPv6 support on a range of platforms.</p>
1288:
1289: <p>pkgsrc was derived from FreeBSD's ports system, and
1290: initially developed for NetBSD only. Since then, pkgsrc has
1291: grown a lot, and now supports the following platforms:</p>
1292:
1293: <div class="itemizedlist">
1294: <ul type="disc">
1295: <li>
1296: <p><a href="http://developer.apple.com/darwin/"
1297: target="_top">Darwin</a> (<a href=
1298: "http://www.apple.com/macosx/" target="_top">Mac OS
1299: X</a>)</p>
1300: </li>
1301:
1302: <li>
1.3 hubertf 1303: <p><a href="http://www.DragonFlyBSD.org/" target=
1.70 rillig 1304: "_top">DragonFly BSD</a></p>
1.3 hubertf 1305: </li>
1306:
1307: <li>
1.1 grant 1308: <p><a href="http://www.FreeBSD.org/" target=
1309: "_top">FreeBSD</a></p>
1310: </li>
1311:
1312: <li>
1.3 hubertf 1313: <p>Microsoft Windows, via <a href=
1314: "http://www.microsoft.com/windows/sfu/" target=
1315: "_top">Interix</a></p>
1.1 grant 1316: </li>
1317:
1318: <li>
1319: <p><a href="http://www.sgi.com/software/irix6.5/"
1320: target="_top">IRIX</a></p>
1321: </li>
1322:
1323: <li>
1324: <p><a href="http://www.linux.org/" target=
1325: "_top">Linux</a></p>
1326: </li>
1327:
1328: <li>
1329: <p><a href="http://www.NetBSD.org/" target=
1330: "_top">NetBSD</a> (of course)</p>
1331: </li>
1332:
1333: <li>
1.17 sketch 1334: <p><a href="http://h30097.www3.hp.com/" target=
1335: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1336: </li>
1337:
1338: <li>
1.1 grant 1339: <p><a href="http://www.openbsd.org/" target=
1340: "_top">OpenBSD</a></p>
1341: </li>
1342:
1343: <li>
1344: <p><a href="http://www.sun.com/solaris/" target=
1345: "_top">Solaris</a></p>
1346: </li>
1347: </ul>
1348: </div>
1349: </div>
1350:
1.67 hubertf 1351: <div class="sect1" lang="en">
1.1 grant 1352: <div class="titlepage">
1353: <div>
1354: <div>
1355: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1356: "overview"></a>1.2. Overview</h2>
1.1 grant 1357: </div>
1358: </div>
1359: </div>
1360:
1.73 ! rillig 1361: <p>This document is divided into three parts. The first,
1.1 grant 1362: <a href="#users-guide" title=
1.46 gdt 1363: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1364: user's guide</a>, describes how one can use one of the
1365: packages in the Package Collection, either by installing a
1366: precompiled binary package, or by building one's own copy
1367: using the NetBSD package system. The second part, <a href=
1.1 grant 1368: "#developers-guide" title=
1.46 gdt 1369: "Part II. The pkgsrc developer's guide">The
1370: pkgsrc developer's guide</a>, explains how to prepare a
1371: package so it can be easily built by other NetBSD users
1.73 ! rillig 1372: without knowing about the package's building details. The
! 1373: third part, <a href="#infrastructure" title=
! 1374: "Part III. The pkgsrc infrastructure internals">The
! 1375: pkgsrc infrastructure internals</a> is intended for those
! 1376: who want to understand how pkgsrc is implemented.</p>
! 1377:
! 1378: <p>This document is available in various formats:
! 1379: <span class="simplelist"><a href="index.html" target=
! 1380: "_top">HTML</a>, <a href="pkgsrc.pdf" target=
! 1381: "_top">PDF</a>, <a href="pkgsrc.ps" target="_top">PS</a>,
! 1382: <a href="pkgsrc.txt" target="_top">TXT</a></span>.</p>
1.1 grant 1383: </div>
1384:
1.67 hubertf 1385: <div class="sect1" lang="en">
1.1 grant 1386: <div class="titlepage">
1387: <div>
1388: <div>
1389: <h2 class="title" style="clear: both"><a name=
1390: "terminology"></a>1.3. Terminology</h2>
1391: </div>
1392: </div>
1393: </div>
1394:
1395: <p>There has been a lot of talk about “<span class=
1396: "quote">ports</span>”, “<span class=
1397: "quote">packages</span>”, etc. so far. Here is a
1398: description of all the terminology used within this
1399: document.</p>
1400:
1401: <div class="variablelist">
1402: <dl>
1403: <dt><span class="term">Package</span></dt>
1404:
1405: <dd>
1406: <p>A set of files and building instructions that
1407: describe what's necessary to build a certain piece of
1408: software using pkgsrc. Packages are traditionally
1.45 wiz 1409: stored under <code xmlns=
1410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1411: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1412: </dd>
1413:
1414: <dt><span class="term">The NetBSD package
1415: system</span></dt>
1416:
1417: <dd>
1418: <p>This is the former name of “<span class=
1419: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1420: NetBSD operating system and can be bootstrapped to
1421: run on non-NetBSD operating systems as well. It
1422: handles building (compiling), installing, and
1423: removing of packages.</p>
1.1 grant 1424: </dd>
1425:
1426: <dt><span class="term">Distfile</span></dt>
1427:
1428: <dd>
1429: <p>This term describes the file or files that are
1430: provided by the author of the piece of software to
1431: distribute his work. All the changes necessary to
1432: build on NetBSD are reflected in the corresponding
1433: package. Usually the distfile is in the form of a
1434: compressed tar-archive, but other types are possible,
1.45 wiz 1435: too. Distfiles are usually stored below <code xmlns=
1436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1437: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1438: </dd>
1439:
1440: <dt><span class="term">Port</span></dt>
1441:
1442: <dd>
1443: <p>This is the term used by FreeBSD and OpenBSD
1444: people for what we call a package. In NetBSD
1445: terminology, “<span class=
1446: "quote">port</span>” refers to a different
1447: architecture.</p>
1448: </dd>
1449:
1450: <dt><span class="term">Precompiled/binary
1451: package</span></dt>
1452:
1453: <dd>
1454: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1455: distfile and stuffed together in a single
1.45 wiz 1456: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1457: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1458: installed on machines of the same machine
1459: architecture without the need to recompile. Packages
1.45 wiz 1460: are usually generated in <code xmlns=
1461: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1462: "filename">/usr/pkgsrc/packages</code>; there is also
1463: an archive on <a href=
1.1 grant 1464: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1465: "_top">ftp.NetBSD.org</a>.</p>
1466:
1467: <p>Sometimes, this is referred to by the term
1468: “<span class="quote">package</span>” too,
1469: especially in the context of precompiled
1470: packages.</p>
1471: </dd>
1472:
1473: <dt><span class="term">Program</span></dt>
1474:
1475: <dd>
1476: <p>The piece of software to be installed which will
1.47 reed 1477: be constructed from all the files in the distfile by
1.1 grant 1478: the actions defined in the corresponding package.</p>
1479: </dd>
1480: </dl>
1481: </div>
1482: </div>
1483:
1.67 hubertf 1484: <div class="sect1" lang="en">
1.1 grant 1485: <div class="titlepage">
1486: <div>
1487: <div>
1488: <h2 class="title" style="clear: both"><a name=
1489: "typography"></a>1.4. Typography</h2>
1490: </div>
1491: </div>
1492: </div>
1493:
1494: <p>When giving examples for commands, shell prompts are
1495: used to show if the command should/can be issued as root,
1496: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1497: privileges are sufficient. We use a <code class=
1498: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1499: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1500: assuming they use the C-shell or tcsh.</p>
1.1 grant 1501: </div>
1502: </div>
1503:
1.67 hubertf 1504: <div class="part" lang="en">
1.1 grant 1505: <div class="titlepage">
1506: <div>
1507: <div>
1.67 hubertf 1508: <h1 class="title"><a name=
1.48 dillo 1509: "users-guide"></a>Part I. The pkgsrc user's
1510: guide</h1>
1.1 grant 1511: </div>
1512: </div>
1513: </div>
1514:
1515: <div class="toc">
1516: <p><b>Table of Contents</b></p>
1517:
1518: <dl>
1519: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1520: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1521:
1522: <dd>
1523: <dl>
1.30 wiz 1524: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1525: As tar file</a></span></dt>
1.1 grant 1526:
1.30 wiz 1527: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1528: SUP</a></span></dt>
1529:
1.30 wiz 1530: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1531: CVS</a></span></dt>
1.59 rillig 1532:
1533: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1534: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1535: </dl>
1536: </dd>
1537:
1538: <dt><span class="chapter"><a href="#platforms">3. Using
1539: pkgsrc on systems other than NetBSD</a></span></dt>
1540:
1541: <dd>
1542: <dl>
1.30 wiz 1543: <dt><span class="sect1"><a href=
1544: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1545: pkgsrc</a></span></dt>
1.1 grant 1546:
1.30 wiz 1547: <dt><span class="sect1"><a href=
1.47 reed 1548: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1549: notes</a></span></dt>
1.1 grant 1550:
1551: <dd>
1552: <dl>
1.30 wiz 1553: <dt><span class="sect2"><a href="#darwin">3.2.1.
1554: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1555:
1.30 wiz 1556: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1557: FreeBSD</a></span></dt>
1.22 tv 1558:
1.30 wiz 1559: <dt><span class="sect2"><a href="#interix">3.2.3.
1560: Interix</a></span></dt>
1.1 grant 1561:
1.30 wiz 1562: <dt><span class="sect2"><a href="#irix">3.2.4.
1563: IRIX</a></span></dt>
1.1 grant 1564:
1.30 wiz 1565: <dt><span class="sect2"><a href="#linux">3.2.5.
1566: Linux</a></span></dt>
1.1 grant 1567:
1.30 wiz 1568: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1569: OpenBSD</a></span></dt>
1.1 grant 1570:
1.30 wiz 1571: <dt><span class="sect2"><a href="#solaris">3.2.7.
1572: Solaris</a></span></dt>
1.1 grant 1573: </dl>
1574: </dd>
1575: </dl>
1576: </dd>
1577:
1578: <dt><span class="chapter"><a href="#using">4. Using
1579: pkgsrc</a></span></dt>
1580:
1581: <dd>
1582: <dl>
1.70 rillig 1583: <dt><span class="sect1"><a href="#using-pkg">4.1.
1584: Using binary packages</a></span></dt>
1.1 grant 1585:
1586: <dd>
1587: <dl>
1588: <dt><span class="sect2"><a href=
1.70 rillig 1589: "#finding-binary-packages">4.1.1. Finding binary
1590: packages</a></span></dt>
1.1 grant 1591:
1592: <dt><span class="sect2"><a href=
1.70 rillig 1593: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 1594: binary packages</a></span></dt>
1.1 grant 1595:
1596: <dt><span class="sect2"><a href=
1.30 wiz 1597: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1598: warning</a></span></dt>
1599: </dl>
1600: </dd>
1601:
1.30 wiz 1602: <dt><span class="sect1"><a href=
1603: "#building-packages-from-source">4.2. Building
1604: packages from source</a></span></dt>
1.1 grant 1605:
1606: <dd>
1607: <dl>
1608: <dt><span class="sect2"><a href=
1.30 wiz 1609: "#requirements">4.2.1.
1610: Requirements</a></span></dt>
1.1 grant 1611:
1612: <dt><span class="sect2"><a href=
1.30 wiz 1613: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1614: distfiles</a></span></dt>
1615:
1616: <dt><span class="sect2"><a href=
1.30 wiz 1617: "#how-to-build-and-install">4.2.3. How to build
1618: and install</a></span></dt>
1.1 grant 1619:
1620: <dt><span class="sect2"><a href=
1.30 wiz 1621: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1622: compiler</a></span></dt>
1623: </dl>
1624: </dd>
1625: </dl>
1626: </dd>
1627:
1.38 dillo 1628: <dt><span class="chapter"><a href="#configuring">5.
1629: Configuring pkgsrc</a></span></dt>
1630:
1631: <dd>
1632: <dl>
1633: <dt><span class="sect1"><a href=
1.45 wiz 1634: "#general-configuration">5.1. General
1635: configuration</a></span></dt>
1636:
1637: <dt><span class="sect1"><a href=
1638: "#variables-affecting-build">5.2. Variables affecting
1639: the build process</a></span></dt>
1640:
1641: <dt><span class="sect1"><a href=
1642: "#developer-advanced-settings">5.3.
1643: Developer/advanced settings</a></span></dt>
1644:
1645: <dt><span class="sect1"><a href=
1646: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1647: Options</a></span></dt>
1.38 dillo 1648: </dl>
1649: </dd>
1650:
1651: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1652: binary packages</a></span></dt>
1653:
1654: <dd>
1655: <dl>
1.30 wiz 1656: <dt><span class="sect1"><a href=
1.38 dillo 1657: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1658: single binary package</a></span></dt>
1.1 grant 1659:
1.30 wiz 1660: <dt><span class="sect1"><a href=
1.38 dillo 1661: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1662: Settings for creation of binary
1663: packages</a></span></dt>
1664:
1.38 dillo 1665: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1666: Doing a bulk build of all packages</a></span></dt>
1667:
1668: <dd>
1669: <dl>
1670: <dt><span class="sect2"><a href=
1.38 dillo 1671: "#binary.configuration">6.3.1.
1.1 grant 1672: Configuration</a></span></dt>
1673:
1674: <dt><span class="sect2"><a href=
1.38 dillo 1675: "#other-environmental-considerations">6.3.2.
1.30 wiz 1676: Other environmental
1.1 grant 1677: considerations</a></span></dt>
1678:
1679: <dt><span class="sect2"><a href=
1.38 dillo 1680: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1681:
1682: <dt><span class="sect2"><a href=
1.38 dillo 1683: "#what-it-does">6.3.4. What it
1.30 wiz 1684: does</a></span></dt>
1.1 grant 1685:
1686: <dt><span class="sect2"><a href=
1.38 dillo 1687: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1688: requirements</a></span></dt>
1689:
1690: <dt><span class="sect2"><a href=
1.38 dillo 1691: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1692: sandbox for chrooted builds</a></span></dt>
1.1 grant 1693:
1694: <dt><span class="sect2"><a href=
1.38 dillo 1695: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1696: partial set of packages</a></span></dt>
1.13 hubertf 1697:
1698: <dt><span class="sect2"><a href=
1.38 dillo 1699: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1700: build</a></span></dt>
1.1 grant 1701: </dl>
1702: </dd>
1703:
1.30 wiz 1704: <dt><span class="sect1"><a href=
1.38 dillo 1705: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1706: packages collection</a></span></dt>
1.1 grant 1707:
1708: <dd>
1709: <dl>
1710: <dt><span class="sect2"><a href=
1.38 dillo 1711: "#cdpack-example">6.4.1. Example of
1.1 grant 1712: cdpack</a></span></dt>
1713: </dl>
1714: </dd>
1715: </dl>
1716: </dd>
1717:
1.38 dillo 1718: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1719: Asked Questions</a></span></dt>
1720:
1721: <dd>
1722: <dl>
1.30 wiz 1723: <dt><span class="sect1"><a href=
1.38 dillo 1724: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1725: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1726:
1.38 dillo 1727: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1728: Where's the pkgviews documentation?</a></span></dt>
1729:
1.38 dillo 1730: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1731: Utilities for package management
1732: (pkgtools)</a></span></dt>
1733:
1.30 wiz 1734: <dt><span class="sect1"><a href=
1.38 dillo 1735: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1736: non-root</a></span></dt>
1.1 grant 1737:
1.30 wiz 1738: <dt><span class="sect1"><a href=
1.38 dillo 1739: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1740: fetching distfiles?</a></span></dt>
1.14 xtraeme 1741:
1.30 wiz 1742: <dt><span class="sect1"><a href=
1.38 dillo 1743: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1744: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1745:
1.30 wiz 1746: <dt><span class="sect1"><a href=
1.38 dillo 1747: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1748: from pkgsrc?</a></span></dt>
1.1 grant 1749:
1.30 wiz 1750: <dt><span class="sect1"><a href=
1.38 dillo 1751: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1752: behind a firewall</a></span></dt>
1.1 grant 1753:
1.38 dillo 1754: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1755: How do I tell <span><strong class="command">make
1.14 xtraeme 1756: fetch</strong></span> to do passive
1.1 grant 1757: FTP?</a></span></dt>
1758:
1.30 wiz 1759: <dt><span class="sect1"><a href=
1.38 dillo 1760: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1761: distfiles at once</a></span></dt>
1.1 grant 1762:
1.30 wiz 1763: <dt><span class="sect1"><a href=
1.38 dillo 1764: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1765: “<span class="quote">Don't know how to make
1766: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1767: mean?</a></span></dt>
1.13 hubertf 1768:
1.30 wiz 1769: <dt><span class="sect1"><a href=
1.38 dillo 1770: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1771: “<span class="quote">Could not find
1.14 xtraeme 1772: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1773:
1.30 wiz 1774: <dt><span class="sect1"><a href=
1.38 dillo 1775: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1776: pkgsrc</a></span></dt>
1.1 grant 1777:
1.38 dillo 1778: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1779: do I change the location of configuration
1780: files?</a></span></dt>
1.1 grant 1781:
1782: <dt><span class="sect1"><a href=
1.38 dillo 1783: "#audit-packages">7.15. Automated security
1.1 grant 1784: checks</a></span></dt>
1785: </dl>
1786: </dd>
1787: </dl>
1788: </div>
1789:
1.67 hubertf 1790: <div class="chapter" lang="en">
1.1 grant 1791: <div class="titlepage">
1792: <div>
1793: <div>
1.67 hubertf 1794: <h2 class="title"><a name=
1.1 grant 1795: "getting"></a>Chapter 2. Where to get
1.59 rillig 1796: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1797: </div>
1798: </div>
1799: </div>
1800:
1801: <div class="toc">
1802: <p><b>Table of Contents</b></p>
1803:
1804: <dl>
1.30 wiz 1805: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1806: tar file</a></span></dt>
1807:
1.30 wiz 1808: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1809: SUP</a></span></dt>
1810:
1.30 wiz 1811: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1812: CVS</a></span></dt>
1.59 rillig 1813:
1814: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1815: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1816: </dl>
1817: </div>
1818:
1819: <p>There are three ways to get pkgsrc. Either as a tar
1820: file, via SUP, or via CVS. All three ways are described
1821: here.</p>
1822:
1.67 hubertf 1823: <div class="sect1" lang="en">
1.1 grant 1824: <div class="titlepage">
1825: <div>
1826: <div>
1827: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1828: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1829: </div>
1830: </div>
1831: </div>
1832:
1833: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1834: file from <a href=
1.11 ben 1835: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1836: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1837: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1838: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1839: </div>
1840:
1.67 hubertf 1841: <div class="sect1" lang="en">
1.1 grant 1842: <div class="titlepage">
1843: <div>
1844: <div>
1845: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1846: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1847: </div>
1848: </div>
1849: </div>
1850:
1851: <p>As an alternative to the tar file, you can get pkgsrc
1852: via the Software Update Protocol, SUP. To do so, make
1853: sure your supfile has a line</p>
1854: <pre class="programlisting">
1.51 rillig 1855: release=pkgsrc
1.1 grant 1856: </pre>
1857:
1.45 wiz 1858: <p>in it, see the examples in <code xmlns=
1859: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1860: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1861: the <code xmlns=
1862: "http://www.w3.org/TR/xhtml1/transitional" class=
1863: "filename">/usr/pkgsrc</code> directory exists. Then,
1864: simply run <span><strong class="command">sup -v
1865: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1866: </div>
1867:
1.67 hubertf 1868: <div class="sect1" lang="en">
1.1 grant 1869: <div class="titlepage">
1870: <div>
1871: <div>
1872: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 1873: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1874: </div>
1875: </div>
1876: </div>
1877:
1878: <p>To get pkgsrc via CVS, make sure you have
1879: “<span class="quote">cvs</span>” installed.
1.27 rillig 1880: To do an initial (full) checkout of pkgsrc, do the
1881: following steps:</p>
1.1 grant 1882: <pre class="screen">
1.14 xtraeme 1883: <code class="prompt">%</code> <strong class=
1884: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1885: <code class="prompt">%</code> <strong class=
1886: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1887: <code class="prompt">%</code> <strong class=
1888: "userinput"><code>cd /usr</code></strong>
1889: <code class="prompt">%</code> <strong class=
1890: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1891: </pre>
1892:
1.45 wiz 1893: <p>This will create the <code xmlns=
1894: "http://www.w3.org/TR/xhtml1/transitional" class=
1895: "filename">pkgsrc</code> directory in your <code xmlns=
1896: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1897: "filename">/usr</code>, and all the package source will
1.45 wiz 1898: be stored under <code xmlns=
1899: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1900: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1901: initial checkout, make sure you have <code class=
1902: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1903: <pre class="screen">
1.14 xtraeme 1904: <code class="prompt">%</code> <strong class=
1905: "userinput"><code>cd /usr/pkgsrc</code></strong>
1906: <code class="prompt">%</code> <strong class=
1907: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1908: </pre>
1909:
1910: <p>Please also note that it is possible to have multiple
1911: copies of the pkgsrc hierarchy in use at any one time -
1912: all work is done relatively within the pkgsrc tree.</p>
1913: </div>
1.59 rillig 1914:
1.67 hubertf 1915: <div class="sect1" lang="en">
1.59 rillig 1916: <div class="titlepage">
1917: <div>
1918: <div>
1919: <h2 class="title" style="clear: both"><a name=
1920: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1921: up-to-date via CVS</h2>
1922: </div>
1923: </div>
1924: </div>
1925:
1926: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1927: "http://www.w3.org/TR/xhtml1/transitional" class=
1928: "filename">CVS</code> directories, you can update it
1929: using the <a href=
1930: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1931: <span class="citerefentry"><span class=
1932: "refentrytitle">cvs</span>(1)</span></a> program. First,
1933: <span><strong class="command">cd</strong></span> to the
1934: top level directory of pkgsrc. Then run
1935: <span><strong class="command">cvs -q update
1936: -dP</strong></span>, and you're done.</p>
1937:
1938: <p>If that doesn't work and the file <code xmlns=
1939: "http://www.w3.org/TR/xhtml1/transitional" class=
1940: "filename">CVS/Root</code> contains the string
1941: “<span class="quote">:pserver:</span>”, you
1942: have to run <span><strong class="command">cvs
1943: login</strong></span> once to get known to the NetBSD CVS
1944: server. The <span><strong class=
1945: "command">cvs</strong></span> utility will then ask you
1946: for a password. Just enter “<span class=
1947: "quote">anoncvs</span>”. Then try again to
1948: update.</p>
1949: </div>
1.1 grant 1950: </div>
1951:
1.67 hubertf 1952: <div class="chapter" lang="en">
1.1 grant 1953: <div class="titlepage">
1954: <div>
1955: <div>
1.67 hubertf 1956: <h2 class="title"><a name=
1.1 grant 1957: "platforms"></a>Chapter 3. Using pkgsrc on
1958: systems other than NetBSD</h2>
1959: </div>
1960: </div>
1961: </div>
1962:
1963: <div class="toc">
1964: <p><b>Table of Contents</b></p>
1965:
1966: <dl>
1.30 wiz 1967: <dt><span class="sect1"><a href=
1968: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1969: pkgsrc</a></span></dt>
1.1 grant 1970:
1.30 wiz 1971: <dt><span class="sect1"><a href=
1.47 reed 1972: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1973: notes</a></span></dt>
1.1 grant 1974:
1975: <dd>
1976: <dl>
1.30 wiz 1977: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1978: Darwin (Mac OS X)</a></span></dt>
1979:
1.30 wiz 1980: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1981: FreeBSD</a></span></dt>
1982:
1.30 wiz 1983: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1984: Interix</a></span></dt>
1985:
1.30 wiz 1986: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1987: IRIX</a></span></dt>
1988:
1.30 wiz 1989: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1990: Linux</a></span></dt>
1991:
1.30 wiz 1992: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1993: OpenBSD</a></span></dt>
1994:
1.30 wiz 1995: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1996: Solaris</a></span></dt>
1997: </dl>
1998: </dd>
1999: </dl>
2000: </div>
2001:
1.67 hubertf 2002: <div class="sect1" lang="en">
1.1 grant 2003: <div class="titlepage">
2004: <div>
2005: <div>
2006: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2007: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
2008: pkgsrc</h2>
1.1 grant 2009: </div>
2010: </div>
2011: </div>
2012:
1.27 rillig 2013: <p>For operating systems other than NetBSD, we provide a
1.1 grant 2014: bootstrap kit to build the required tools to use pkgsrc
2015: on your platform. Besides support for native NetBSD,
2016: pkgsrc and the bootstrap kit have support for the
2017: following operating systems:</p>
2018:
2019: <div class="itemizedlist">
2020: <ul type="disc">
2021: <li>
2022: <p>Darwin (Mac OS X)</p>
2023: </li>
2024:
2025: <li>
1.70 rillig 2026: <p>DragonFly BSD</p>
1.16 grant 2027: </li>
2028:
2029: <li>
1.1 grant 2030: <p>FreeBSD</p>
2031: </li>
2032:
2033: <li>
2034: <p>Interix (Windows 2000, XP, 2003)</p>
2035: </li>
2036:
2037: <li>
2038: <p>IRIX</p>
2039: </li>
2040:
2041: <li>
2042: <p>Linux</p>
2043: </li>
2044:
2045: <li>
2046: <p>OpenBSD</p>
2047: </li>
2048:
2049: <li>
2050: <p>Solaris</p>
2051: </li>
1.16 grant 2052:
2053: <li>
2054: <p>Tru64 (Digital UNIX/OSF1)</p>
2055: </li>
1.1 grant 2056: </ul>
2057: </div>
2058:
2059: <p>Support for other platforms is under development.</p>
2060:
2061: <p>Installing the bootstrap kit should be as simple
2062: as:</p>
2063: <pre class="screen">
1.14 xtraeme 2064: <code class="prompt">#</code> <strong class=
2065: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
2066: <code class="prompt">#</code> <strong class=
2067: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2068: <code class="prompt">#</code> <strong class=
2069: "userinput"><code>./bootstrap</code></strong>
1.1 grant 2070: </pre>
2071:
2072: <p>See <a href="#getting" title=
1.59 rillig 2073: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.67 hubertf 2074: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 2075: up-to-date</i></a> for other ways to get pkgsrc before
2076: bootstrapping. The given <span><strong class=
2077: "command">bootstrap</strong></span> command will use the
2078: defaults of <code xmlns=
1.45 wiz 2079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2080: "filename">/usr/pkg</code> for the <span class=
2081: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 2082: installed in, and <code xmlns=
2083: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2084: "filename">/var/db/pkg</code> for the package database
1.27 rillig 2085: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 2086: However, these can also be set using command-line
1.27 rillig 2087: arguments.</p>
1.1 grant 2088:
2089: <p>Binary packages for the pkgsrc tools and an initial
2090: set of packages is available for supported platforms. An
2091: up-to-date list of these can be found on <a href=
2092: "http://www.pkgsrc.org/" target=
1.63 dillo 2093: "_top">www.pkgsrc.org</a>. Note that this only works for
2094: privileged builds that install into <code xmlns=
2095: "http://www.w3.org/TR/xhtml1/transitional" class=
2096: "filename">/usr/pkg</code>.</p>
1.47 reed 2097:
2098: <div class="note" style=
2099: "margin-left: 0.5in; margin-right: 0.5in;">
2100: <h3 class="title">Note</h3>
2101:
2102: <p>The bootstrap installs a <span><strong class=
2103: "command">bmake</strong></span> tool. Use this
2104: <span><strong class="command">bmake</strong></span>
2105: when building via pkgsrc. For examples in this guide,
2106: use <span><strong class="command">bmake</strong></span>
2107: instead of “<span class=
2108: "quote">make</span>”.</p>
2109: </div>
1.1 grant 2110: </div>
2111:
1.67 hubertf 2112: <div class="sect1" lang="en">
1.1 grant 2113: <div class="titlepage">
2114: <div>
2115: <div>
2116: <h2 class="title" style="clear: both"><a name=
1.47 reed 2117: "platform-specific-notes"></a>3.2. Platform-specific
2118: notes</h2>
1.1 grant 2119: </div>
2120: </div>
2121: </div>
2122:
2123: <p>Here are some platform-specific notes you should be
2124: aware of.</p>
2125:
1.67 hubertf 2126: <div class="sect2" lang="en">
1.1 grant 2127: <div class="titlepage">
2128: <div>
2129: <div>
1.67 hubertf 2130: <h3 class="title"><a name=
1.30 wiz 2131: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2132: </div>
2133: </div>
2134: </div>
2135:
2136: <p>Darwin 5.x and 6.x are supported. There are two
2137: methods of using pkgsrc on Mac OS X, by using a
2138: <a href="#platform.osx-image" title=
2139: "3.2.1.1. Using a disk image">disk image</a>, or a
2140: <a href="#platform.osx-ufs" title=
2141: "3.2.1.2. Using a UFS partition">UFS
2142: partition</a>.</p>
2143:
2144: <p>Before you start, you will need to download and
2145: install the Mac OS X Developer Tools from Apple's
2146: Developer Connection. See <a href=
2147: "http://developer.apple.com/macosx/" target=
2148: "_top">http://developer.apple.com/macosx/</a> for
2149: details. Also, make sure you install X11 for Mac OS X
2150: and the X11 SDK from <a href=
2151: "http://www.apple.com/macosx/x11/download/" target=
2152: "_top">http://www.apple.com/macosx/x11/download/</a> if
2153: you intend to build packages that use the X11 Window
2154: System.</p>
2155:
2156: <p>If you already have a UFS partition, or have a spare
2157: partition that you can format as UFS, it is recommended
2158: to use that instead of the disk image. It'll be
2159: somewhat faster and will mount automatically at boot
2160: time, where you must manually mount a disk image.</p>
2161:
2162: <div class="note" style=
2163: "margin-left: 0.5in; margin-right: 0.5in;">
2164: <h3 class="title">Note</h3>
2165:
2166: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2167: because pkgsrc currently requires the file system to
1.1 grant 2168: be case-sensitive, and HFS+ is not.</p>
2169: </div>
2170:
1.67 hubertf 2171: <div class="sect3" lang="en">
1.1 grant 2172: <div class="titlepage">
2173: <div>
2174: <div>
1.67 hubertf 2175: <h4 class="title"><a name=
2176: "platform.osx-image"></a>3.2.1.1. Using a
2177: disk image</h4>
1.1 grant 2178: </div>
2179: </div>
2180: </div>
2181:
2182: <p>Create the disk image:</p>
2183: <pre class="screen">
1.14 xtraeme 2184: <code class="prompt">#</code> <strong class=
2185: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2186: <code class="prompt">#</code> <strong class=
2187: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2188: <code class="prompt">#</code> <strong class=
2189: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2190: <code class="prompt">#</code> <strong class=
2191: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2192: </pre>
2193:
2194: <p>That's it!</p>
2195: </div>
2196:
1.67 hubertf 2197: <div class="sect3" lang="en">
1.1 grant 2198: <div class="titlepage">
2199: <div>
2200: <div>
1.67 hubertf 2201: <h4 class="title"><a name=
2202: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2203: UFS partition</h4>
2204: </div>
2205: </div>
2206: </div>
2207:
1.45 wiz 2208: <p>By default, <code xmlns=
2209: "http://www.w3.org/TR/xhtml1/transitional" class=
2210: "filename">/usr</code> will be on your root file
2211: system, normally HFS+. It is possible to use the
2212: default <span class="emphasis"><em>prefix</em></span>
2213: of <code xmlns=
2214: "http://www.w3.org/TR/xhtml1/transitional" class=
2215: "filename">/usr/pkg</code> by symlinking <code xmlns=
2216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2217: "filename">/usr/pkg</code> to a directory on a UFS
2218: file system. Obviously, another symlink is required
2219: if you want to place the package database directory
2220: outside the <span class=
2221: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2222: <pre class="screen">
1.14 xtraeme 2223: <code class="prompt">#</code> <strong class=
1.59 rillig 2224: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2225: </pre>
2226:
2227: <p>If you created your partitions at the time of
2228: installing Mac OS X and formatted the target
2229: partition as UFS, it should automatically mount on
1.45 wiz 2230: <code xmlns=
2231: "http://www.w3.org/TR/xhtml1/transitional" class=
2232: "filename">/Volumes/<volume name></code> when
2233: the machine boots. If you are (re)formatting a
2234: partition as UFS, you need to ensure that the
2235: partition map correctly reflects “<span class=
2236: "quote">Apple_UFS</span>” and not
2237: “<span class=
1.1 grant 2238: "quote">Apple_HFS</span>”.</p>
2239:
2240: <p>The problem is that none of the disk tools will
2241: let you touch a disk that is booted from. You can
2242: unmount the partition, but even if you newfs it, the
2243: partition type will be incorrect and the automounter
2244: won't mount it. It can be mounted manually, but it
2245: won't appear in Finder.</p>
2246:
2247: <p>You'll need to boot off of the OS X Installation
2248: (User) CD. When the Installation program starts, go
2249: up to the menu and select Disk Utility. Now, you will
2250: be able to select the partition you want to be UFS,
2251: and Format it Apple UFS. Quit the Disk Utility, quit
2252: the installer which will reboot your machine. The new
2253: UFS file system will appear in Finder.</p>
2254:
2255: <p>Be aware that the permissions on the new file
2256: system will be writable by root only.</p>
2257:
2258: <p>This note is as of 10.2 (Jaguar) and applies to
2259: earlier versions. Hopefully Apple will fix Disk
2260: Utility in 10.3 (Panther).</p>
2261: </div>
2262: </div>
2263:
1.67 hubertf 2264: <div class="sect2" lang="en">
1.1 grant 2265: <div class="titlepage">
2266: <div>
2267: <div>
1.67 hubertf 2268: <h3 class="title"><a name=
1.30 wiz 2269: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2270: </div>
2271: </div>
2272: </div>
2273:
2274: <p>FreeBSD 4.7 and 5.0 have been tested and are
2275: supported, other versions may work.</p>
2276:
2277: <p>Care should be taken so that the tools that this kit
2278: installs do not conflict with the FreeBSD userland
2279: tools. There are several steps:</p>
2280:
2281: <div class="orderedlist">
2282: <ol type="1">
2283: <li>
2284: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2285: <code xmlns=
2286: "http://www.w3.org/TR/xhtml1/transitional" class=
2287: "filename">/var/db/pkg</code>. It is therefore
2288: recommended that you choose a different location
2289: (e.g. <code xmlns=
2290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2291: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2292: --pkgdbdir option to the bootstrap script.</p>
2293: </li>
2294:
2295: <li>
2296: <p>If you do not intend to use the FreeBSD ports
2297: tools, it's probably a good idea to move them out
2298: of the way to avoid confusion, e.g.</p>
2299: <pre class="screen">
1.14 xtraeme 2300: <code class="prompt">#</code> <strong class=
2301: "userinput"><code>cd /usr/sbin</code></strong>
2302: <code class="prompt">#</code> <strong class=
2303: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2304: <code class="prompt">#</code> <strong class=
2305: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2306: <code class="prompt">#</code> <strong class=
2307: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2308: <code class="prompt">#</code> <strong class=
2309: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2310: </pre>
2311: </li>
2312:
2313: <li>
1.45 wiz 2314: <p>An example <code xmlns=
2315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2316: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2317: placed in <code xmlns=
2318: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2319: "filename">/etc/mk.conf.example</code> file when
2320: you use the bootstrap script.</p>
1.1 grant 2321: </li>
2322: </ol>
2323: </div>
2324: </div>
2325:
1.67 hubertf 2326: <div class="sect2" lang="en">
1.1 grant 2327: <div class="titlepage">
2328: <div>
2329: <div>
1.67 hubertf 2330: <h3 class="title"><a name=
1.30 wiz 2331: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2332: </div>
2333: </div>
2334: </div>
2335:
1.47 reed 2336: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2337: Windows NT kernel, providing a Unix-like environment
2338: with a tighter kernel integration than available with
2339: Cygwin. It is part of the Windows Services for Unix
2340: package, available for free for any licensed copy of
1.22 tv 2341: Windows 2000, XP (not including XP Home), or 2003. SFU
2342: can be downloaded from <a href=
2343: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2344: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2345:
2346: <p>Services for Unix 3.5, current as of this writing,
2347: has been tested. 3.0 or 3.1 may work, but are not
2348: officially supported. (The main difference in 3.0/3.1
2349: is lack of pthreads.)</p>
2350:
1.67 hubertf 2351: <div class="sect3" lang="en">
1.1 grant 2352: <div class="titlepage">
2353: <div>
2354: <div>
2355: <h4 class="title"><a name=
2356: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2357: installing Interix/SFU</h4>
1.1 grant 2358: </div>
2359: </div>
2360: </div>
2361:
2362: <p>At an absolute minimum, the following packages
2363: must be installed from the Windows Services for Unix
2364: 3.5 distribution in order to use pkgsrc:</p>
2365:
2366: <div class="itemizedlist">
2367: <ul type="disc">
2368: <li>
2369: <p>Utilities -> Base Utilities</p>
2370: </li>
2371:
2372: <li>
2373: <p>Interix GNU Components -> (all)</p>
2374: </li>
2375:
2376: <li>
2377: <p>Remote Connectivity</p>
2378: </li>
2379:
2380: <li>
2381: <p>Interix SDK</p>
2382: </li>
2383: </ul>
2384: </div>
2385:
2386: <p>When using pkgsrc on Interix, DO NOT install the
2387: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2388: without shared module support, installed to
2389: /usr/local, and will only cause confusion. Instead,
2390: install Perl 5.8 from pkgsrc (or from a binary
2391: package).</p>
2392:
2393: <p>The Remote Connectivity subcomponent "Windows
2394: Remote Shell Service" does not need to be installed,
2395: but Remote Connectivity itself should be installed in
2396: order to have a working inetd.</p>
2397:
1.52 tv 2398: <p>During installation you may be asked whether to
2399: enable setuid behavior for Interix programs, and
2400: whether to make pathnames default to case-sensitive.
2401: Setuid should be enabled, and case-sensitivity MUST
2402: be enabled. (Without case-sensitivity, a large number
2403: of packages including perl will not build.)</p>
2404:
2405: <p>NOTE: Newer Windows service packs change the way
2406: binary execution works (via the Data Execution
2407: Prevention feature). In order to use pkgsrc and other
2408: gcc-compiled binaries reliably, a hotfix containing
2409: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2410: (899522 or newer) must be installed. Hotfixes are
2411: available from Microsoft through a support contract;
2412: however, a NetBSD developer has made most Interix
2413: hotfixes available for personal use from <a href=
2414: "http://www.duh.org/interix/hotfixes.php" target=
2415: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2416: </div>
2417:
1.67 hubertf 2418: <div class="sect3" lang="en">
1.1 grant 2419: <div class="titlepage">
2420: <div>
2421: <div>
2422: <h4 class="title"><a name=
2423: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2424: to do if Interix/SFU is already installed</h4>
2425: </div>
2426: </div>
2427: </div>
2428:
2429: <p>If SFU is already installed and you wish to alter
2430: these settings to work with pkgsrc, note the
2431: following things.</p>
2432:
2433: <div class="itemizedlist">
2434: <ul type="disc">
2435: <li>
2436: <p>To uninstall UNIX Perl, use Add/Remove
2437: Programs, select Microsoft Windows Services for
2438: UNIX, then click Change. In the installer,
2439: choose Add or Remove, then uncheck
2440: Utilities->UNIX Perl.</p>
2441: </li>
2442:
2443: <li>
1.47 reed 2444: <p>To enable case-sensitivity for the file
2445: system, run REGEDIT.EXE, and change the
1.1 grant 2446: following registry key:</p>
2447:
2448: <p>
2449: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2450: Manager\kernel</p>
2451:
2452: <p>Set the DWORD value "obcaseinsensitive" to
2453: 0; then reboot.</p>
2454: </li>
2455:
2456: <li>
2457: <p>To enable setuid binaries (optional), run
2458: REGEDIT.EXE, and change the following registry
2459: key:</p>
2460:
2461: <p>
2462: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2463: for UNIX</p>
2464:
2465: <p>Set the DWORD value "EnableSetuidBinaries"
2466: to 1; then reboot.</p>
2467: </li>
2468: </ul>
2469: </div>
2470: </div>
2471:
1.67 hubertf 2472: <div class="sect3" lang="en">
1.1 grant 2473: <div class="titlepage">
2474: <div>
2475: <div>
2476: <h4 class="title"><a name=
2477: "platform.interix-notes"></a>3.2.3.3. Important
2478: notes for using pkgsrc</h4>
2479: </div>
2480: </div>
2481: </div>
2482:
1.52 tv 2483: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2484: or the user running "pkg_add") must be a member of
2485: the local Administrators group. Such a user must also
2486: be used to run the bootstrap. This is slightly
2487: relaxed from the normal pkgsrc requirement of
2488: "root".</p>
2489:
2490: <p>The package manager should use a umask of 002.
2491: "make install" will automatically complain if this is
2492: not the case. This ensures that directories written
2493: in /var/db/pkg are Administrators-group
2494: writeable.</p>
2495:
2496: <p>The popular Interix binary packages from
2497: http://www.interopsystems.com/ use an older version
2498: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2499: used in conjunction with pkgsrc. If you choose to use
2500: them at the same time as the pkgsrc packages, ensure
2501: that you use the proper pkg_* tools for each type of
2502: binary package.</p>
1.22 tv 2503:
2504: <p>The TERM setting used for DOS-type console windows
2505: (including those invoked by the csh and ksh startup
2506: shortcuts) is "interix". Most systems don't have a
2507: termcap/terminfo entry for it, but the following
2508: .termcap entry provides adequate emulation in most
2509: cases:</p>
2510: <pre class="programlisting">
1.51 rillig 2511: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2512: </pre>
1.1 grant 2513: </div>
1.52 tv 2514:
1.67 hubertf 2515: <div class="sect3" lang="en">
1.52 tv 2516: <div class="titlepage">
2517: <div>
2518: <div>
2519: <h4 class="title"><a name=
2520: "platform.interix-limits"></a>3.2.3.4. Limitations
2521: of the Interix platform</h4>
2522: </div>
2523: </div>
2524: </div>
2525:
2526: <p>Though Interix suffices as a familiar and flexible
2527: substitute for a full Unix-like platform, it has some
2528: drawbacks that should be noted for those desiring to
2529: make the most of Interix.</p>
2530:
2531: <div class="itemizedlist">
2532: <ul type="disc">
2533: <li>
1.54 tv 2534: <p><span class=
1.57 minskim 2535: "strong"><strong>X11:</strong></span></p>
1.52 tv 2536:
2537: <p>Interix comes with the standard set of X11R6
1.57 minskim 2538: client libraries, and can run X11 based
1.52 tv 2539: applications, but it does <span class=
2540: "emphasis"><em>not</em></span> come with an X
2541: server. Some options are <a href=
2542: "http://www.starnet.com/products/xwin32/"
2543: target="_top">StarNet X-Win32</a>, <a href=
2544: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2545: target="_top">Hummingbird Exceed</a> (available
2546: in a trimmed version for Interix from Interop
2547: Systems as the <a href=
2548: "http://www.interopsystems.com/InteropXserver.htm"
2549: target="_top">Interop X Server</a>), and the
2550: free X11 server included with <a href=
1.52 tv 2551: "http://x.cygwin.com/" target=
2552: "_top">Cygwin</a>.</p>
2553:
2554: <p>Also, StarNet Communications has graciously
2555: provided a free version of their X-Win32
2556: product that accepts connections only from
2557: localhost: <a href=
2558: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2559: target="_top">X-Win32 LX</a>, recommended by
2560: the maintainer of Interix pkgsrc support.</p>
2561: </li>
2562:
2563: <li>
1.57 minskim 2564: <p><span class="strong"><strong>X11
1.54 tv 2565: acceleration:</strong></span></p>
1.52 tv 2566:
2567: <p>Because Interix runs in a completely
2568: different NT subsystem from Win32 applications,
2569: it does not currently support various X11
2570: protocol extensions for acceleration (such as
2571: MIT-SHM or DGA). Most interactive applications
2572: to a local X server will run reasonably fast,
2573: but full motion video and other graphics
2574: intensive applications may require a
2575: faster-than-expected CPU.</p>
2576: </li>
2577:
2578: <li>
1.54 tv 2579: <p><span class=
2580: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2581:
2582: <p>Interix has no native support for audio
1.53 tv 2583: output. For audio support, pkgsrc uses the
2584: <span><strong class=
1.52 tv 2585: "command">esound</strong></span> client/server
2586: audio system on Interix. Unlike on most
2587: platforms, the <a xmlns=
2588: "http://www.w3.org/TR/xhtml1/transitional"
2589: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2590: target="_top"><code xmlns="" class=
2591: "filename">audio/esound</code></a> package does
2592: <span class="emphasis"><em>not</em></span>
2593: contain the <span><strong class=
1.53 tv 2594: "command">esd</strong></span> server component.
2595: To output audio via an Interix host, the
2596: <a xmlns=
1.52 tv 2597: "http://www.w3.org/TR/xhtml1/transitional"
2598: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2599: target="_top"><code xmlns="" class=
2600: "filename">emulators/cygwin_esound</code></a>
2601: package must also be installed.</p>
2602: </li>
2603:
2604: <li>
1.54 tv 2605: <p><span class="strong"><strong>CD/DVDs, USB,
2606: and SCSI:</strong></span></p>
1.52 tv 2607:
2608: <p>Direct device access is not currently
2609: supported in Interix, so it is not currently
2610: possible to access CD/DVD drives, USB devices,
2611: or SCSI devices through non-filesystem means.
2612: Among other things, this makes it impossible to
2613: use Interix directly for CD/DVD burning.</p>
2614: </li>
2615:
2616: <li>
1.54 tv 2617: <p><span class="strong"><strong>Tape
2618: drives:</strong></span></p>
1.52 tv 2619:
2620: <p>Due to the same limitations as for CD-ROMs
2621: and SCSI devices, tape drives are also not
2622: directly accessible in Interix. However,
2623: support is in work to make tape drive access
2624: possible by using Cygwin as a bridge (similarly
2625: to audio bridged via Cygwin's esound
2626: server).</p>
2627: </li>
2628: </ul>
2629: </div>
2630: </div>
2631:
1.67 hubertf 2632: <div class="sect3" lang="en">
1.52 tv 2633: <div class="titlepage">
2634: <div>
2635: <div>
2636: <h4 class="title"><a name=
2637: "platform.interix-knownissues"></a>3.2.3.5. Known
2638: issues for pkgsrc on Interix</h4>
2639: </div>
2640: </div>
2641: </div>
2642:
2643: <p>It is not necessary, in general, to have a "root"
2644: user on the Windows system; any member of the local
2645: Administrators group will suffice. However, some
2646: packages currently assume that the user named "root"
2647: is the privileged user. To accommodate these, you may
2648: create such a user; make sure it is in the local
2649: group Administrators (or your language
2650: equivalent).</p>
2651:
2652: <p>"pkg_add" creates directories of mode 0755, not
2653: 0775, in $PKG_DBDIR. For the time being, install
2654: packages as the local Administrator (or your language
2655: equivalent), or run the following command after
2656: installing a package to work around the issue:</p>
2657: <pre class="screen">
2658: <code class="prompt">#</code> <strong class=
2659: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2660: </pre>
2661: </div>
1.1 grant 2662: </div>
2663:
1.67 hubertf 2664: <div class="sect2" lang="en">
1.1 grant 2665: <div class="titlepage">
2666: <div>
2667: <div>
1.67 hubertf 2668: <h3 class="title"><a name=
1.30 wiz 2669: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2670: </div>
2671: </div>
2672: </div>
2673:
2674: <p>You will need a working C compiler, either gcc or
2675: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2676: the <code class="varname">CC</code> environment
2677: variable according to your preference. If you do not
2678: have a license for the MIPSpro compiler suite, you can
1.1 grant 2679: download a gcc tardist file from <a href=
2680: "http://freeware.sgi.com/" target=
2681: "_top">http://freeware.sgi.com/</a>.</p>
2682:
2683: <p>Please note that you will need IRIX 6.5.17 or
2684: higher, as this is the earliest version of IRIX
1.24 wiz 2685: providing support for <a href=
2686: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2687: <span class="citerefentry"><span class=
2688: "refentrytitle">if_indextoname</span>(3)</span></a>,
2689: <a href=
2690: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2691: <span class="citerefentry"><span class=
2692: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2693: etc.</p>
1.1 grant 2694:
1.27 rillig 2695: <p>At this point in time, pkgsrc only supports one ABI
2696: at a time. That is, you can not switch between the old
2697: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2698: you start out using "abi=n32", that's what all your
2699: packages will be built with.</p>
1.1 grant 2700:
2701: <p>Therefore, please make sure that you have no
1.14 xtraeme 2702: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2703: environment or the <code xmlns=
2704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2705: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2706: that you do not try to link n32 object files with lib64
1.45 wiz 2707: or vice versa. Check your <code xmlns=
2708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2709: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2710:
2711: <p>If you have the actual pkgsrc tree mounted via NFS
2712: from a different host, please make sure to set
1.14 xtraeme 2713: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2714: directory, as it appears that IRIX linker occasionally
1.47 reed 2715: runs into issues when trying to link over a
2716: network-mounted file system.</p>
1.1 grant 2717:
2718: <p>The bootstrapping process should set all the right
2719: options for programs such as imake(1), but you may want
2720: to set some options depending on your local setup.
1.45 wiz 2721: Please see <code xmlns=
2722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2723: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2724: course, your compiler's man pages for details.</p>
1.22 tv 2725:
2726: <p>If you are using SGI's MIPSPro compiler, please
2727: set</p>
2728: <pre class="programlisting">
1.51 rillig 2729: PKGSRC_COMPILER= mipspro
1.22 tv 2730: </pre>
2731:
1.45 wiz 2732: <p>in <code xmlns=
2733: "http://www.w3.org/TR/xhtml1/transitional" class=
2734: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2735: assume you are using gcc and may end up passing invalid
2736: flags to the compiler. Note that bootstrap should
2737: create an appropriate <code xmlns=
2738: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2739: "filename">mk.conf.example</code> by default.</p>
2740:
2741: <p>If you have both the MIPSPro compiler chain
2742: installed as well as gcc, but want to make sure that
2743: MIPRPro is used, please set your <code class=
2744: "varname">PATH</code> to <span class=
2745: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2746: gcc (often <code xmlns=
2747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2748: "filename">/usr/freeware/bin</code>), and (important)
2749: pass the '--preserve-path' flag.</p>
1.1 grant 2750: </div>
2751:
1.67 hubertf 2752: <div class="sect2" lang="en">
1.1 grant 2753: <div class="titlepage">
2754: <div>
2755: <div>
1.67 hubertf 2756: <h3 class="title"><a name=
1.30 wiz 2757: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2758: </div>
2759: </div>
2760: </div>
2761:
2762: <p>Some versions of Linux (for example Debian
2763: GNU/Linux) need either libtermcap or libcurses
2764: (libncurses). Installing the distributions
2765: libncurses-dev package (or equivalent) should fix the
2766: problem.</p>
2767:
2768: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2769: and icc (Intel C++ Compiler). gcc is the default. icc
2770: 8.0 and 8.1 on i386 have been tested.</p>
2771:
2772: <p>To bootstrap using icc, assuming the default icc
2773: installation directory:</p>
2774: <pre class="programlisting">
1.51 rillig 2775: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2776: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2777: </pre>
2778:
2779: <div class="note" style=
2780: "margin-left: 0.5in; margin-right: 0.5in;">
2781: <h3 class="title">Note</h3>
2782:
2783: <p>icc 8.1 needs the `-i-static' argument instead of
2784: -static-libcxa.</p>
2785: </div>
2786:
2787: <p>icc supports __attribute__, but the GNU configure
2788: test uses a nested function, which icc does not
2789: support. #undef'ing __attribute__ has the unfortunate
2790: side-effect of breaking many of the Linux header files,
2791: which cannot be compiled properly without
2792: __attribute__. The test must be overridden so that
2793: __attribute__ is assumed supported by the compiler.</p>
2794:
2795: <p>After bootstrapping, you should set <code class=
1.45 wiz 2796: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2797: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2798: "filename">/etc/mk.conf</code>:</p>
2799: <pre class="programlisting">
1.51 rillig 2800: PKGSRC_COMPILER= icc
1.22 tv 2801: </pre>
2802:
2803: <p>The default installation directory for icc is
1.45 wiz 2804: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2805: class="filename">/opt/intel_cc_80</code>, which is also
2806: the pkgsrc default. If you have installed it into a
2807: different directory, set <code class=
2808: "varname">ICCBASE</code> in <code xmlns=
2809: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2810: "filename">/etc/mk.conf</code>:</p>
2811: <pre class="programlisting">
1.51 rillig 2812: ICCBASE= /opt/icc
1.22 tv 2813: </pre>
2814:
2815: <p>pkgsrc uses the static linking method of the runtime
2816: libraries provided by icc, so binaries can be run on
2817: other systems which do not have the shared libraries
2818: installed.</p>
2819:
2820: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2821: the <a href=
2822: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2823: <span class="citerefentry"><span class=
2824: "refentrytitle">ld</span>(1)</span></a> command run
2825: when linking a C++ shared library and records it,
2826: throwing away the -Bstatic and -Bdynamic options
2827: interspersed between the libraries. This means that
2828: libtool-linked C++ shared libraries will have a runtime
2829: dependency on the icc libraries until this is fixed in
2830: libtool.</p>
1.22 tv 2831: </div>
2832:
1.67 hubertf 2833: <div class="sect2" lang="en">
1.22 tv 2834: <div class="titlepage">
2835: <div>
2836: <div>
1.67 hubertf 2837: <h3 class="title"><a name=
1.30 wiz 2838: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2839: </div>
2840: </div>
2841: </div>
2842:
2843: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2844:
2845: <p>Care should be taken so that the tools that this kit
2846: installs do not conflict with the OpenBSD userland
2847: tools. There are several steps:</p>
2848:
2849: <div class="orderedlist">
2850: <ol type="1">
2851: <li>
2852: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2853: <code xmlns=
2854: "http://www.w3.org/TR/xhtml1/transitional" class=
2855: "filename">/var/db/pkg</code>. It is therefore
2856: recommended that you choose a different location
2857: (e.g. <code xmlns=
2858: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2859: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2860: --pkgdbdir option to the bootstrap script.</p>
2861: </li>
2862:
2863: <li>
2864: <p>If you do not intend to use the OpenBSD ports
2865: tools, it's probably a good idea to move them out
2866: of the way to avoid confusion, e.g.</p>
2867: <pre class="screen">
1.14 xtraeme 2868: <code class="prompt">#</code> <strong class=
2869: "userinput"><code>cd /usr/sbin</code></strong>
2870: <code class="prompt">#</code> <strong class=
2871: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2872: <code class="prompt">#</code> <strong class=
2873: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2874: <code class="prompt">#</code> <strong class=
2875: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2876: <code class="prompt">#</code> <strong class=
2877: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2878: </pre>
2879: </li>
2880:
2881: <li>
1.45 wiz 2882: <p>An example <code xmlns=
2883: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2884: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2885: placed in <code xmlns=
2886: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2887: "filename">/etc/mk.conf.example</code> file when
2888: you use the bootstrap script. OpenBSD's make
1.45 wiz 2889: program uses <code xmlns=
2890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2891: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2892: work around this by enclosing all the
2893: pkgsrc-specific parts of the file with:</p>
1.1 grant 2894: <pre class="programlisting">
1.51 rillig 2895: .ifdef BSD_PKG_MK
2896: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2897: .else
2898: # OpenBSD stuff
2899: .endif
1.1 grant 2900: </pre>
2901: </li>
2902: </ol>
2903: </div>
2904: </div>
2905:
1.67 hubertf 2906: <div class="sect2" lang="en">
1.1 grant 2907: <div class="titlepage">
2908: <div>
2909: <div>
1.67 hubertf 2910: <h3 class="title"><a name=
1.30 wiz 2911: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2912: </div>
2913: </div>
2914: </div>
2915:
2916: <p>Solaris 2.6 through 9 are supported on both x86 and
2917: sparc. You will need a working C compiler. Both gcc
2918: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2919:
2920: <p>The following packages are required on Solaris 8 for
2921: the bootstrap process and to build packages.</p>
2922:
2923: <div class="itemizedlist">
2924: <ul type="disc">
2925: <li>
2926: <p>SUNWsprot</p>
2927: </li>
2928:
2929: <li>
2930: <p>SUNWarc</p>
2931: </li>
2932:
2933: <li>
2934: <p>SUNWbtool</p>
2935: </li>
2936:
2937: <li>
2938: <p>SUNWtoo</p>
2939: </li>
2940:
2941: <li>
2942: <p>SUNWlibm</p>
2943: </li>
2944: </ul>
2945: </div>
2946:
2947: <p>Please note the use of GNU binutils on Solaris is
2948: <span class="emphasis"><em>not</em></span>
2949: supported.</p>
2950:
1.70 rillig 2951: <p>Whichever compiler you use, please ensure the
2952: compiler tools and your $prefix are in your
2953: <code class="varname">PATH</code>. This includes
2954: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2955: class="filename">/usr/ccs/{bin,lib}</code> and e.g.
2956: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2957: class="filename">/usr/pkg/{bin,sbin}</code>.</p>
2958:
1.67 hubertf 2959: <div class="sect3" lang="en">
1.1 grant 2960: <div class="titlepage">
2961: <div>
2962: <div>
1.67 hubertf 2963: <h4 class="title"><a name=
2964: "solaris-gcc-note"></a>3.2.7.1. If you are
2965: using gcc</h4>
1.1 grant 2966: </div>
2967: </div>
2968: </div>
2969:
2970: <p>It makes life much simpler if you only use the
2971: same gcc consistently for building all packages.</p>
2972:
2973: <p>It is recommended that an external gcc be used
2974: only for bootstrapping, then either build gcc from
2975: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2976: href=
2977: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2978: target="_top"><code xmlns="" class=
2979: "filename">lang/gcc</code></a> or install a binary
2980: gcc package, then remove gcc used during
1.20 ben 2981: bootstrapping.</p>
1.1 grant 2982:
2983: <p>Binary packages of gcc can be found through
2984: <a href=
2985: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2986: target=
2987: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2988: </div>
2989:
1.67 hubertf 2990: <div class="sect3" lang="en">
1.1 grant 2991: <div class="titlepage">
2992: <div>
2993: <div>
1.30 wiz 2994: <h4 class="title"><a name=
2995: "solaris-sun-workshop-note"></a>3.2.7.2. If
2996: you are using Sun WorkShop</h4>
1.1 grant 2997: </div>
2998: </div>
2999: </div>
3000:
3001: <p>You will need at least the following packages
3002: installed (from WorkShop 5.0)</p>
3003:
3004: <div class="itemizedlist">
3005: <ul type="disc">
3006: <li>
3007: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
3008: </li>
3009:
3010: <li>
3011: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
3012: </li>
3013:
3014: <li>
3015: <p>SPROild - Sun WorkShop Incremental
3016: Linker</p>
3017: </li>
3018:
3019: <li>
3020: <p>SPROlang - Sun WorkShop Compilers common
3021: components</p>
3022: </li>
3023: </ul>
3024: </div>
3025:
1.14 xtraeme 3026: <p>You should set <code class="varname">CC</code>,
3027: <code class="varname">CXX</code> and optionally,
1.45 wiz 3028: <code class="varname">CPP</code> in <code xmlns=
3029: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3030: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 3031: <pre class="programlisting">
1.51 rillig 3032: CC= cc
3033: CXX= CC
3034: CPP= /usr/ccs/lib/cpp
1.1 grant 3035: </pre>
1.70 rillig 3036: </div>
3037:
3038: <div class="sect3" lang="en">
3039: <div class="titlepage">
3040: <div>
3041: <div>
3042: <h4 class="title"><a name=
3043: "solaris-sunpro-64"></a>3.2.7.3. Buildling
3044: 64-bit binaries with SunPro</h4>
3045: </div>
3046: </div>
3047: </div>
1.1 grant 3048:
1.70 rillig 3049: <p>Building 64-bit binaries is a little trickier.
3050: First, you need to bootstrap pkgsrc in 64-bit mode.
3051: One problem here is that while building one of the
3052: programs in the bootstrap kit (<code xmlns=
3053: "http://www.w3.org/TR/xhtml1/transitional" class=
3054: "filename">bmake</code>), the <code class=
3055: "varname">CFLAGS</code> variable is not honored, even
3056: if it is set in the environment. To work around this
3057: bug, you can create a simple shell script called
3058: <code xmlns=
3059: "http://www.w3.org/TR/xhtml1/transitional" class=
3060: "filename">cc64</code> and put it somewhere in the
3061: <code class="varname">PATH</code>:</p>
3062: <pre class="programlisting">
3063: #! /bin/sh
3064: exec /opt/SUNWspro/bin/cc -xtarget=ultra -xarch=v9 ${1+"$@"}
3065: </pre>
3066:
3067: <p>Then, pass the definition for <code class=
3068: "varname">CC</code> in the environment of the
3069: <span><strong class=
3070: "command">bootstrap</strong></span> command:</p>
3071: <pre class="programlisting">
3072: <code class="prompt">$</code> <strong class=
3073: "userinput"><code>cd bootstrap</code></strong>
3074: <code class="prompt">$</code> <strong class=
3075: "userinput"><code>CC=cc64 ./bootstrap</code></strong>
3076: </pre>
3077:
3078: <p>After bootstrapping, there are two alternative
3079: ways, depending on whether you want to find bugs in
3080: packages or get your system ready quickly. If you
3081: just want a running system, add the following lines
3082: to your <code xmlns=
3083: "http://www.w3.org/TR/xhtml1/transitional" class=
3084: "filename">mk.conf</code> file:</p>
1.1 grant 3085: <pre class="programlisting">
1.70 rillig 3086: CC= cc64
3087: CXX= CC64
3088: PKGSRC_COMPILER= sunpro
1.1 grant 3089: </pre>
3090:
1.70 rillig 3091: <p>This way, all calls to the compiler will be
3092: intercepted by the above wrapper and therefore get
3093: the necessary ABI options automatically. (Don't
3094: forget to create the shell script <code xmlns=
1.45 wiz 3095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3096: "filename">CC64</code>, too.)</p>
3097:
3098: <p>To find packages that ignore the user-specified
3099: <code class="varname">CFLAGS</code> and <code class=
3100: "varname">CXXFLAGS</code>, add the following lines to
3101: your <code xmlns=
1.45 wiz 3102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3103: "filename">mk.conf</code> file:</p>
3104: <pre class="programlisting">
3105: CC= cc
3106: CXX= CC
3107: PKGSRC_COMPILER= sunpro
3108: CFLAGS= -xtarget=ultra -xarch=v9
3109: CXXFLAGS= -xtarget=ultra -xarch=v9
3110: LDFLAGS= -xtarget=ultra -xarch=v9
3111: </pre>
3112:
3113: <p>Packages that don't use the flags provided in the
3114: configuration file will try to build 32-bit binaries
3115: and fail during linking. Detecting this is useful to
3116: prevent bugs on other platforms where the error would
3117: not show up but pass silently.</p>
1.1 grant 3118: </div>
1.68 rillig 3119:
3120: <div class="sect3" lang="en">
3121: <div class="titlepage">
3122: <div>
3123: <div>
3124: <h4 class="title"><a name=
1.70 rillig 3125: "plat.sunos.problems"></a>3.2.7.4. Common
1.68 rillig 3126: problems</h4>
3127: </div>
3128: </div>
3129: </div>
3130:
3131: <p>Sometimes, when using <span><strong class=
3132: "command">libtool</strong></span>, <code xmlns=
3133: "http://www.w3.org/TR/xhtml1/transitional" class=
3134: "filename">/bin/ksh</code> crashes with a
3135: segmentation fault. The workaround is to use another
3136: shell for the configure scripts, for example by
3137: installing <a xmlns=
3138: "http://www.w3.org/TR/xhtml1/transitional" href=
3139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
3140: target="_top"><code xmlns="" class=
3141: "filename">shells/bash</code></a> and adding the
1.69 rillig 3142: following lines to your <code xmlns=
1.68 rillig 3143: "http://www.w3.org/TR/xhtml1/transitional" class=
3144: "filename">mk.conf</code>:</p>
3145: <pre class="programlisting">
3146: CONFIG_SHELL= ${LOCALBASE}/bin/bash
1.69 rillig 3147: WRAPPER_SHELL= ${LOCALBASE}/bin/bash
1.68 rillig 3148: </pre>
1.71 wiz 3149:
3150: <p>Then, rebuild the <a xmlns=
3151: "http://www.w3.org/TR/xhtml1/transitional" href=
3152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool-base/README.html"
3153: target="_top"><code xmlns="" class=
3154: "filename">devel/libtool-base</code></a> package.</p>
1.68 rillig 3155: </div>
1.1 grant 3156: </div>
3157: </div>
3158: </div>
3159:
1.67 hubertf 3160: <div class="chapter" lang="en">
1.1 grant 3161: <div class="titlepage">
3162: <div>
3163: <div>
1.67 hubertf 3164: <h2 class="title"><a name=
1.1 grant 3165: "using"></a>Chapter 4. Using pkgsrc</h2>
3166: </div>
3167: </div>
3168: </div>
3169:
3170: <div class="toc">
3171: <p><b>Table of Contents</b></p>
3172:
3173: <dl>
1.70 rillig 3174: <dt><span class="sect1"><a href="#using-pkg">4.1. Using
3175: binary packages</a></span></dt>
1.1 grant 3176:
3177: <dd>
3178: <dl>
1.30 wiz 3179: <dt><span class="sect2"><a href=
1.70 rillig 3180: "#finding-binary-packages">4.1.1. Finding binary
3181: packages</a></span></dt>
1.1 grant 3182:
1.30 wiz 3183: <dt><span class="sect2"><a href=
1.70 rillig 3184: "#installing-binary-packages">4.1.2. Installing
1.30 wiz 3185: binary packages</a></span></dt>
1.1 grant 3186:
1.30 wiz 3187: <dt><span class="sect2"><a href=
3188: "#a-word-of-warning">4.1.3. A word of
3189: warning</a></span></dt>
1.1 grant 3190: </dl>
3191: </dd>
3192:
1.30 wiz 3193: <dt><span class="sect1"><a href=
3194: "#building-packages-from-source">4.2. Building packages
3195: from source</a></span></dt>
1.1 grant 3196:
3197: <dd>
3198: <dl>
1.30 wiz 3199: <dt><span class="sect2"><a href=
3200: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 3201:
1.30 wiz 3202: <dt><span class="sect2"><a href=
3203: "#fetching-distfiles">4.2.2. Fetching
3204: distfiles</a></span></dt>
1.1 grant 3205:
1.30 wiz 3206: <dt><span class="sect2"><a href=
3207: "#how-to-build-and-install">4.2.3. How to build and
3208: install</a></span></dt>
1.1 grant 3209:
1.30 wiz 3210: <dt><span class="sect2"><a href=
3211: "#selecting-the-compiler">4.2.4. Selecting the
3212: compiler</a></span></dt>
1.1 grant 3213: </dl>
3214: </dd>
3215: </dl>
3216: </div>
3217:
1.70 rillig 3218: <p>Basically, there are two ways of using pkgsrc. The first
3219: is to only install the package tools and to use binary
3220: packages that someone else has prepared. This is the
3221: “<span class="quote">pkg</span>” in pkgsrc. The
3222: second way is to install the “<span class=
3223: "quote">src</span>” of pkgsrc, too. Then you are able
3224: to build your own packages, and you can still use binary
3225: packages from someone else.</p>
3226:
1.67 hubertf 3227: <div class="sect1" lang="en">
1.1 grant 3228: <div class="titlepage">
3229: <div>
3230: <div>
3231: <h2 class="title" style="clear: both"><a name=
1.70 rillig 3232: "using-pkg"></a>4.1. Using binary
1.1 grant 3233: packages</h2>
3234: </div>
3235: </div>
3236: </div>
3237:
1.70 rillig 3238: <p>To use binary packages, you need some tools to manage
3239: them. On NetBSD, these tools are already installed. On
3240: all other operating systems, you need to install them
3241: first. For the following platforms, prebuilt versions of
3242: the package tools are available and can simply be
3243: downloaded and unpacked in the <code xmlns=
3244: "http://www.w3.org/TR/xhtml1/transitional" class=
3245: "filename">/</code> directory:</p>
3246:
3247: <div class="informaltable">
3248: <a name="binary-bootstrap-kits"></a>
3249:
3250: <table border="1">
3251: <colgroup>
3252: <col />
3253: <col />
3254: </colgroup>
3255:
3256: <thead>
3257: <tr>
3258: <th>Platform</th>
3259:
3260: <th>URL</th>
3261: </tr>
3262: </thead>
3263:
3264: <tbody>
3265: <tr>
1.72 rillig 3266: <td>Solaris 9</td>
3267:
3268: <td><code xmlns=
3269: "http://www.w3.org/TR/xhtml1/transitional" class=
3270: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
3271: </tr>
3272:
3273: <tr>
3274: <td>Solaris 10</td>
1.70 rillig 3275:
3276: <td><code xmlns=
3277: "http://www.w3.org/TR/xhtml1/transitional" class=
3278: "filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
3279: </tr>
3280: </tbody>
3281: </table>
3282: </div>
3283:
3284: <p>These prebuilt package tools use <code xmlns=
3285: "http://www.w3.org/TR/xhtml1/transitional" class=
3286: "filename">/usr/pkg</code> for the base directory, and
3287: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3288: class="filename">/var/db/pkg</code> for the database of
3289: installed packages. If you cannot use these directories
3290: for whatever reasons (maybe because you're not root), you
3291: have to build the package tools yourself, which is
3292: explained in <a href="#bootstrapping-pkgsrc" title=
3293: "3.1. Bootstrapping pkgsrc">Section 3.1,
3294: “Bootstrapping pkgsrc”</a>.</p>
1.1 grant 3295:
1.67 hubertf 3296: <div class="sect2" lang="en">
1.1 grant 3297: <div class="titlepage">
3298: <div>
3299: <div>
1.30 wiz 3300: <h3 class="title"><a name=
1.70 rillig 3301: "finding-binary-packages"></a>4.1.1. Finding
3302: binary packages</h3>
1.1 grant 3303: </div>
3304: </div>
3305: </div>
3306:
1.70 rillig 3307: <p>To install binary packages, you first need to know
3308: from where to get them. You can get them on CD-ROMs,
3309: DVDs, or via FTP or HTTP.</p>
3310:
3311: <p>For NetBSD, the binary packages are made available
3312: on <code xmlns=
3313: "http://www.w3.org/TR/xhtml1/transitional" class=
3314: "filename">ftp.NetBSD.org</code> and its mirrors, in
3315: the directory <code xmlns=
1.45 wiz 3316: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3317: "filename">/pub/NetBSD/packages/<em class=
3318: "replaceable"><code>OSVERSION</code></em>/<em class=
3319: "replaceable"><code>ARCH</code></em>/</code>. For
3320: <em class="replaceable"><code>OSVERSION</code></em>,
3321: you should insert the output of <span><strong class=
3322: "command">uname -r</strong></span>, and for <em class=
3323: "replaceable"><code>ARCH</code></em> the output of
3324: <span><strong class="command">uname
3325: -p</strong></span>.</p>
3326:
3327: <p>For some other platforms, binary packages can be
3328: found at the following locations:</p>
3329:
3330: <div class="informaltable">
3331: <a name="binary-packages"></a>
3332:
3333: <table border="1">
3334: <colgroup>
3335: <col />
3336: <col />
3337: </colgroup>
3338:
3339: <thead>
3340: <tr>
3341: <th>Platform</th>
3342:
3343: <th>URL</th>
3344: </tr>
3345: </thead>
3346:
3347: <tbody>
3348: <tr>
1.72 rillig 3349: <td>Solaris 9</td>
3350:
3351: <td><code xmlns=
3352: "http://www.w3.org/TR/xhtml1/transitional"
3353: class=
3354: "filename">ftp://ftp0.mh.bbc.co.uk/pub/pkgsrc/packages/</code></td>
3355: </tr>
3356:
3357: <tr>
3358: <td>Solaris 10</td>
1.70 rillig 3359:
3360: <td><code xmlns=
3361: "http://www.w3.org/TR/xhtml1/transitional"
3362: class=
3363: "filename">http://public.enst.fr/pkgsrc/packages/</code></td>
3364: </tr>
3365: </tbody>
3366: </table>
3367: </div>
3368:
1.72 rillig 3369: <p>Most of these directories contain the pkgsrc
3370: distribution for multiple platforms. Select the
3371: appropriate subdirectories, according to your machine
3372: architecture and operating system, until you find a
3373: directory called <code xmlns=
1.45 wiz 3374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.72 rillig 3375: "filename">All</code>. This directory contains all the
3376: binary packages. Further, there are subdirectories for
1.70 rillig 3377: categories that contain symbolic links that point to
3378: the actual binary package in <code xmlns=
1.45 wiz 3379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.70 rillig 3380: "filename">../All</code>. This directory layout is used
3381: for all package repositories, no matter if they are
3382: accessed via HTTP, FTP, NFS, CD-ROM, or the local
3383: filesystem.</p>
1.1 grant 3384: </div>
3385:
1.67 hubertf 3386: <div class="sect2" lang="en">
1.1 grant 3387: <div class="titlepage">
3388: <div>
3389: <div>
1.30 wiz 3390: <h3 class="title"><a name=
1.70 rillig 3391: "installing-binary-packages"></a>4.1.2. Installing
3392: binary packages</h3>
1.1 grant 3393: </div>
3394: </div>
3395: </div>
3396:
1.47 reed 3397: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3398: to your hard disk, you can install them with the
1.27 rillig 3399: following command (be sure to <span><strong class=
1.14 xtraeme 3400: "command">su</strong></span> to root first):</p>
1.1 grant 3401: <pre class="screen">
1.14 xtraeme 3402: <code class="prompt">#</code> <strong class=
3403: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3404: </pre>
3405:
3406: <p>If you have FTP access and you don't want to
3407: download the packages via FTP prior to installation,
1.14 xtraeme 3408: you can do this automatically by giving
3409: <span><strong class="command">pkg_add</strong></span>
3410: an FTP URL:</p>
1.1 grant 3411: <pre class="screen">
1.14 xtraeme 3412: <code class="prompt">#</code> <strong class=
1.27 rillig 3413: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3414: </pre>
3415:
1.27 rillig 3416: <p>Note that any prerequisite packages needed to run
3417: the package in question will be installed, too,
1.1 grant 3418: assuming they are present where you install from.</p>
3419:
1.23 wiz 3420: <p>To save some typing, you can set the <code class=
3421: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3422: semicolon-separated list of paths (including remote
1.23 wiz 3423: URLs); trailing slashes are not allowed.</p>
3424:
1.45 wiz 3425: <p>Additionally to the <code xmlns=
3426: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3427: "filename">All</code> directory there exists a
1.45 wiz 3428: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3429: class="filename">vulnerable</code> directory to which
3430: binary packages with known vulnerabilities are moved,
3431: since removing them could cause missing dependencies.
3432: To use these packages, add the <code xmlns=
3433: "http://www.w3.org/TR/xhtml1/transitional" class=
3434: "filename">vulnerable</code> directory to your
3435: <code class="varname">PKG_PATH</code>. However, you
3436: should run <a xmlns=
1.23 wiz 3437: "http://www.w3.org/TR/xhtml1/transitional" href=
3438: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3439: target="_top"><code xmlns="" class=
3440: "filename">security/audit-packages</code></a>
1.47 reed 3441: regularly, especially after installing new packages,
3442: and verify that the vulnerabilities are acceptable for
3443: your configuration. An example <code class=
3444: "varname">PKG_PATH</code> would be: <code xmlns=
3445: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3446: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/vulnerable</code>
1.23 wiz 3447: Please note that semicolon (';') is a shell
3448: meta-character, so you'll probably have to quote
3449: it.</p>
3450:
1.1 grant 3451: <p>After you've installed packages, be sure to have
1.45 wiz 3452: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3453: class="filename">/usr/pkg/bin</code> and <code xmlns=
3454: "http://www.w3.org/TR/xhtml1/transitional" class=
3455: "filename">/usr/pkg/sbin</code> in your <code class=
3456: "varname">PATH</code> so you can actually start the
3457: just installed program.</p>
1.1 grant 3458: </div>
3459:
1.67 hubertf 3460: <div class="sect2" lang="en">
1.1 grant 3461: <div class="titlepage">
3462: <div>
3463: <div>
1.67 hubertf 3464: <h3 class="title"><a name=
1.30 wiz 3465: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3466: warning</h3>
3467: </div>
3468: </div>
3469: </div>
3470:
3471: <p>Please pay very careful attention to the warnings
3472: expressed in the <a href=
3473: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3474: <span class="citerefentry"><span class=
3475: "refentrytitle">pkg_add</span>(1)</span></a> manual
3476: page about the inherent dangers of installing binary
3477: packages which you did not create yourself, and the
3478: security holes that can be introduced onto your system
3479: by indiscriminate adding of such files.</p>
1.66 rillig 3480:
3481: <p>The same warning of course applies to every package
3482: you install from source when you haven't completely
3483: read and understood the source code of the package, the
3484: compiler that is used to build the package and all the
3485: other tools that are involved.</p>
1.1 grant 3486: </div>
3487: </div>
3488:
1.67 hubertf 3489: <div class="sect1" lang="en">
1.1 grant 3490: <div class="titlepage">
3491: <div>
3492: <div>
3493: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3494: "building-packages-from-source"></a>4.2. Building
1.1 grant 3495: packages from source</h2>
3496: </div>
3497: </div>
3498: </div>
3499:
3500: <p>This assumes that the package is already in pkgsrc. If
3501: it is not, see <a href="#developers-guide" title=
1.46 gdt 3502: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3503: “The pkgsrc developer's guide”</a> for
3504: instructions how to create your own packages.</p>
1.1 grant 3505:
1.67 hubertf 3506: <div class="sect2" lang="en">
1.1 grant 3507: <div class="titlepage">
3508: <div>
3509: <div>
1.67 hubertf 3510: <h3 class="title"><a name=
1.30 wiz 3511: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3512: </div>
3513: </div>
3514: </div>
3515:
3516: <p>To build packages from source on a NetBSD system the
3517: “<span class="quote">comp</span>” and the
3518: “<span class="quote">text</span>”
3519: distribution sets must be installed. If you want to
1.47 reed 3520: build X11-related packages the “<span class=
1.1 grant 3521: "quote">xbase</span>” and “<span class=
3522: "quote">xcomp</span>” distribution sets are
3523: required, too.</p>
3524: </div>
3525:
1.67 hubertf 3526: <div class="sect2" lang="en">
1.1 grant 3527: <div class="titlepage">
3528: <div>
3529: <div>
1.67 hubertf 3530: <h3 class="title"><a name=
3531: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3532: distfiles</h3>
3533: </div>
3534: </div>
3535: </div>
3536:
1.27 rillig 3537: <p>The first step for building a package is downloading
3538: the distfiles (i.e. the unmodified source). If they
3539: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3540: automatically.</p>
3541:
3542: <p>You can overwrite some of the major distribution
3543: sites to fit to sites that are close to your own. Have
1.45 wiz 3544: a look at <code xmlns=
3545: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3546: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3547: some examples — in particular, look for the
1.14 xtraeme 3548: <code class="varname">MASTER_SORT</code>, <code class=
3549: "varname">MASTER_SORT_REGEX</code> and <code class=
3550: "varname">INET_COUNTRY</code> definitions. This may
3551: save some of your bandwidth and time.</p>
1.1 grant 3552:
3553: <p>You can change these settings either in your shell's
3554: environment, or, if you want to keep the settings, by
1.45 wiz 3555: editing the <code xmlns=
3556: "http://www.w3.org/TR/xhtml1/transitional" class=
3557: "filename">/etc/mk.conf</code> file, and adding the
3558: definitions there.</p>
1.1 grant 3559:
3560: <p>If you don't have a permanent Internet connection
3561: and you want to know which files to download,
1.14 xtraeme 3562: <span><strong class="command">make
3563: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3564: need. Put these distfiles into <code xmlns=
3565: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3566: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3567: </div>
3568:
1.67 hubertf 3569: <div class="sect2" lang="en">
1.1 grant 3570: <div class="titlepage">
3571: <div>
3572: <div>
1.30 wiz 3573: <h3 class="title"><a name=
3574: "how-to-build-and-install"></a>4.2.3. How to
3575: build and install</h3>
1.1 grant 3576: </div>
3577: </div>
3578: </div>
3579:
3580: <p>Assuming that the distfile has been fetched (see
3581: previous section), become root and change into the
1.47 reed 3582: relevant directory and run <span><strong class=
3583: "command">make</strong></span>.</p>
3584:
3585: <div class="note" style=
3586: "margin-left: 0.5in; margin-right: 0.5in;">
3587: <h3 class="title">Note</h3>
3588:
3589: <p>If using bootstrap or pkgsrc on a non-NetBSD
3590: system, use the pkgsrc <span><strong class=
3591: "command">bmake</strong></span> command instead of
3592: “<span class="quote">make</span>” in the
3593: examples in this guide.</p>
3594: </div>
3595:
3596: <p>For example, type</p>
1.1 grant 3597: <pre class="screen">
1.14 xtraeme 3598: <code class="prompt">%</code> <strong class=
3599: "userinput"><code>cd misc/figlet</code></strong>
3600: <code class="prompt">%</code> <strong class=
3601: "userinput"><code>make</code></strong>
1.1 grant 3602: </pre>
3603:
3604: <p>at the shell prompt to build the various components
3605: of the package, and</p>
3606: <pre class="screen">
1.14 xtraeme 3607: <code class="prompt">#</code> <strong class=
3608: "userinput"><code>make install</code></strong>
1.1 grant 3609: </pre>
3610:
3611: <p>to install the various components into the correct
3612: places on your system. Installing the package on your
3613: system requires you to be root. However, pkgsrc has a
3614: <span class="emphasis"><em>just-in-time-su</em></span>
3615: feature, which allows you to only become root for the
3616: actual installation step</p>
3617:
3618: <p>Taking the figlet utility as an example, we can
3619: install it on our system by building as shown in
3620: <a href="#logs" title=
1.67 hubertf 3621: "Appendix B. Build logs">Appendix B,
3622: <i>Build logs</i></a>.</p>
1.1 grant 3623:
3624: <p>The program is installed under the default root of
1.45 wiz 3625: the packages tree - <code xmlns=
3626: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3627: "filename">/usr/pkg</code>. Should this not conform to
3628: your tastes, set the <code class=
3629: "varname">LOCALBASE</code> variable in your
1.1 grant 3630: environment, and it will use that value as the root of
1.45 wiz 3631: your packages tree. So, to use <code xmlns=
3632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3633: "filename">/usr/local</code>, set <code class=
3634: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3635: environment. Please note that you should use a
3636: directory which is dedicated to packages and not shared
1.47 reed 3637: with other programs (i.e., do not try and use
1.14 xtraeme 3638: <code class="varname">LOCALBASE=/usr</code>). Also, you
3639: should not try to add any of your own files or
1.45 wiz 3640: directories (such as <code xmlns=
3641: "http://www.w3.org/TR/xhtml1/transitional" class=
3642: "filename">src/</code>, <code xmlns=
3643: "http://www.w3.org/TR/xhtml1/transitional" class=
3644: "filename">obj/</code>, or <code xmlns=
3645: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3646: "filename">pkgsrc/</code>) below the <code class=
3647: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3648: possible conflicts between programs and other files
3649: installed by the package system and whatever else may
3650: have been installed there.</p>
3651:
1.45 wiz 3652: <p>Some packages look in <code xmlns=
3653: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3654: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3655: configuration options at build time. Have a look at
1.45 wiz 3656: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3657: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3658: get an overview of what will be set there by default.
1.14 xtraeme 3659: Environment variables such as <code class=
1.45 wiz 3660: "varname">LOCALBASE</code> can be set in <code xmlns=
3661: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3662: "filename">/etc/mk.conf</code> to save having to
3663: remember to set them each time you want to use
3664: pkgsrc.</p>
1.1 grant 3665:
3666: <p>Occasionally, people want to “<span class=
3667: "quote">look under the covers</span>” to see what
3668: is going on when a package is building or being
3669: installed. This may be for debugging purposes, or out
3670: of simple curiosity. A number of utility values have
3671: been added to help with this.</p>
3672:
3673: <div class="orderedlist">
3674: <ol type="1">
3675: <li>
3676: <p>If you invoke the <a href=
3677: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3678: <span class="citerefentry"><span class=
3679: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3680: with <code class=
3681: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3682: amount of information will be displayed. For
3683: example,</p>
1.1 grant 3684: <pre class="screen">
1.14 xtraeme 3685: <strong class=
3686: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3687: </pre>
3688:
3689: <p>will show all the commands that are invoked,
3690: up to and including the “<span class=
3691: "quote">patch</span>” stage.</p>
3692: </li>
3693:
3694: <li>
3695: <p>If you want to know the value of a certain
1.22 tv 3696: <a href=
3697: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3698: <span class="citerefentry"><span class=
3699: "refentrytitle">make</span>(1)</span></a>
3700: definition, then the <code class=
1.14 xtraeme 3701: "varname">VARNAME</code> definition should be
3702: used, in conjunction with the show-var target.
3703: e.g. to show the expansion of the <a href=
1.1 grant 3704: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3705: <span class="citerefentry"><span class=
3706: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3707: variable <code class=
1.22 tv 3708: "varname">LOCALBASE</code>:</p>
1.1 grant 3709: <pre class="screen">
1.14 xtraeme 3710: <code class="prompt">%</code> <strong class=
3711: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3712: /usr/pkg
1.14 xtraeme 3713: <code class="prompt">%</code>
1.1 grant 3714:
3715: </pre>
3716: </li>
3717: </ol>
3718: </div>
3719:
3720: <p>If you want to install a binary package that you've
3721: either created yourself (see next section), that you
3722: put into pkgsrc/packages manually or that is located on
1.8 wiz 3723: a remote FTP server, you can use the "bin-install"
1.1 grant 3724: target. This target will install a binary package - if
3725: available - via <a href=
3726: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3727: <span class="citerefentry"><span class=
3728: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3729: <span><strong class="command">make
3730: package</strong></span>. The list of remote FTP sites
3731: searched is kept in the variable <code class=
3732: "varname">BINPKG_SITES</code>, which defaults to
3733: ftp.NetBSD.org. Any flags that should be added to
3734: <a href=
1.1 grant 3735: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3736: <span class="citerefentry"><span class=
3737: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3738: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3739: See <code xmlns=
3740: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3741: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3742: details.</p>
1.1 grant 3743:
1.47 reed 3744: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3745: has a non-standard setting for <code class=
3746: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3747: any packages are installed, as you can not use several
3748: directories for the same purpose. Doing so will result
3749: in pkgsrc not being able to properly detect your
3750: installed packages, and fail miserably. Note also that
3751: precompiled binary packages are usually built with the
1.14 xtraeme 3752: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3753: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3754: class="filename">/usr/pkg</code>, and that you should
3755: <span class="emphasis"><em>not</em></span> install any
3756: if you use a non-standard <code class=
1.14 xtraeme 3757: "varname">LOCALBASE</code>.</p>
1.1 grant 3758: </div>
3759:
1.67 hubertf 3760: <div class="sect2" lang="en">
1.1 grant 3761: <div class="titlepage">
3762: <div>
3763: <div>
1.30 wiz 3764: <h3 class="title"><a name=
3765: "selecting-the-compiler"></a>4.2.4. Selecting
3766: the compiler</h3>
1.1 grant 3767: </div>
3768: </div>
3769: </div>
3770:
3771: <p>By default, pkgsrc will use GCC to build packages.
3772: This may be overridden by setting the following
3773: variables in /etc/mk.conf:</p>
3774:
3775: <div class="variablelist">
3776: <dl>
1.14 xtraeme 3777: <dt><span class="term"><code class=
3778: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3779:
3780: <dd>
3781: <p>This is a list of values specifying the chain
3782: of compilers to invoke when building packages.
3783: Valid values are:</p>
3784:
3785: <div class="itemizedlist">
3786: <ul type="disc">
3787: <li>
1.14 xtraeme 3788: <p><code class="varname">distcc</code>:
1.1 grant 3789: distributed C/C++ (chainable)</p>
3790: </li>
3791:
3792: <li>
1.14 xtraeme 3793: <p><code class="varname">ccache</code>:
1.1 grant 3794: compiler cache (chainable)</p>
3795: </li>
3796:
3797: <li>
1.14 xtraeme 3798: <p><code class="varname">gcc</code>: GNU
3799: C/C++ Compiler</p>
1.1 grant 3800: </li>
3801:
3802: <li>
1.14 xtraeme 3803: <p><code class="varname">mipspro</code>:
1.1 grant 3804: Silicon Graphics, Inc. MIPSpro
3805: (n32/n64)</p>
3806: </li>
3807:
3808: <li>
1.14 xtraeme 3809: <p><code class="varname">mipspro</code>:
1.1 grant 3810: Silicon Graphics, Inc. MIPSpro (o32)</p>
3811: </li>
3812:
3813: <li>
1.64 kim 3814: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3815: Microsystems, Inc. WorkShip/Forte/Sun ONE
3816: Studio</p>
3817: </li>
3818: </ul>
3819: </div>
3820:
3821: <p>The default is “<span class=
1.14 xtraeme 3822: "quote"><code class=
3823: "varname">gcc</code></span>”. You can use
3824: <code class="varname">ccache</code> and/or
3825: <code class="varname">distcc</code> with an
3826: appropriate <code class=
3827: "varname">PKGSRC_COMPILER</code> setting, e.g.
3828: “<span class="quote"><code class=
3829: "varname">ccache gcc</code></span>”. This
1.1 grant 3830: variable should always be terminated with a value
3831: for a real compiler.</p>
3832: </dd>
3833:
1.14 xtraeme 3834: <dt><span class="term"><code class=
3835: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3836:
3837: <dd>
3838: <p>This specifies the minimum version of GCC to
3839: use when building packages. If the system GCC
3840: doesn't satisfy this requirement, then pkgsrc
3841: will build and install one of the GCC packages to
3842: use instead.</p>
3843: </dd>
3844: </dl>
3845: </div>
3846: </div>
3847: </div>
3848: </div>
3849:
1.67 hubertf 3850: <div class="chapter" lang="en">
1.1 grant 3851: <div class="titlepage">
3852: <div>
3853: <div>
1.67 hubertf 3854: <h2 class="title"><a name=
1.38 dillo 3855: "configuring"></a>Chapter 5. Configuring
3856: pkgsrc</h2>
3857: </div>
3858: </div>
3859: </div>
3860:
3861: <div class="toc">
3862: <p><b>Table of Contents</b></p>
3863:
3864: <dl>
3865: <dt><span class="sect1"><a href=
1.45 wiz 3866: "#general-configuration">5.1. General
3867: configuration</a></span></dt>
3868:
3869: <dt><span class="sect1"><a href=
3870: "#variables-affecting-build">5.2. Variables affecting
3871: the build process</a></span></dt>
3872:
3873: <dt><span class="sect1"><a href=
3874: "#developer-advanced-settings">5.3. Developer/advanced
3875: settings</a></span></dt>
3876:
3877: <dt><span class="sect1"><a href=
3878: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3879: Options</a></span></dt>
1.38 dillo 3880: </dl>
3881: </div>
3882:
1.67 hubertf 3883: <div class="sect1" lang="en">
1.38 dillo 3884: <div class="titlepage">
3885: <div>
3886: <div>
3887: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3888: "general-configuration"></a>5.1. General
3889: configuration</h2>
3890: </div>
3891: </div>
3892: </div>
3893:
1.47 reed 3894: <p>In this section, you can find some variables that
3895: apply to all pkgsrc packages. The preferred method of
3896: setting these variables is by setting them in
3897: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3898: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3899:
3900: <div class="itemizedlist">
3901: <ul type="disc">
3902: <li>
3903: <p><code class="varname">LOCALBASE</code>: Where
3904: packages will be installed. The default is
3905: <code xmlns=
3906: "http://www.w3.org/TR/xhtml1/transitional" class=
3907: "filename">/usr/pkg</code>. Do not mix binary
3908: packages with different <code class=
3909: "varname">LOCALBASE</code>s!</p>
3910: </li>
3911:
3912: <li>
3913: <p><code class="varname">CROSSBASE</code>: Where
3914: “<span class="quote">cross</span>”
3915: category packages will be installed. The default is
3916: <code xmlns=
3917: "http://www.w3.org/TR/xhtml1/transitional" class=
3918: "filename">${LOCALBASE}/cross</code>.</p>
3919: </li>
3920:
3921: <li>
3922: <p><code class="varname">X11BASE</code>: Where X11
3923: is installed on the system. The default is
3924: <code xmlns=
3925: "http://www.w3.org/TR/xhtml1/transitional" class=
3926: "filename">/usr/X11R6</code>.</p>
3927: </li>
3928:
3929: <li>
3930: <p><code class="varname">DISTDIR</code>: Where to
3931: store the downloaded copies of the original source
3932: distributions used for building pkgsrc packages.
3933: The default is <code xmlns=
3934: "http://www.w3.org/TR/xhtml1/transitional" class=
3935: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3936: </li>
3937:
3938: <li>
3939: <p><code class=
3940: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3941: override the packages' <code class=
3942: "varname">MASTER_SITES</code> with this value.</p>
3943: </li>
3944:
3945: <li>
3946: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3947: Backup location(s) for distribution files and patch
3948: files if not found locally or in <code xmlns=
3949: "http://www.w3.org/TR/xhtml1/transitional" class=
3950: "filename">${MASTER_SITES}</code> or <code xmlns=
3951: "http://www.w3.org/TR/xhtml1/transitional" class=
3952: "filename">${PATCH_SITES}</code> respectively. The
3953: defaults are <code xmlns=
3954: "http://www.w3.org/TR/xhtml1/transitional" class=
3955: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3956: and <code xmlns=
3957: "http://www.w3.org/TR/xhtml1/transitional" class=
3958: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3959: </li>
3960:
3961: <li>
3962: <p><code class="varname">BINPKG_SITES</code>: List
3963: of sites carrying binary pkgs.</p>
3964: </li>
3965: </ul>
3966: </div>
3967: </div>
3968:
1.67 hubertf 3969: <div class="sect1" lang="en">
1.45 wiz 3970: <div class="titlepage">
3971: <div>
3972: <div>
3973: <h2 class="title" style="clear: both"><a name=
3974: "variables-affecting-build"></a>5.2. Variables
3975: affecting the build process</h2>
3976: </div>
3977: </div>
3978: </div>
3979:
3980: <p>XXX</p>
3981:
3982: <div class="itemizedlist">
3983: <ul type="disc">
3984: <li>
3985: <p><code class="varname">PACKAGES</code>: The top
3986: level directory for the binary packages. The
3987: default is <code xmlns=
3988: "http://www.w3.org/TR/xhtml1/transitional" class=
3989: "filename">${PKGSRCDIR}/packages</code>.</p>
3990: </li>
3991:
3992: <li>
3993: <p><code class="varname">WRKOBJDIR</code>: The top
3994: level directory where, if defined, the separate
3995: working directories will get created, and
3996: symbolically linked to from <code xmlns=
3997: "http://www.w3.org/TR/xhtml1/transitional" class=
3998: "filename">${WRKDIR}</code> (see below). This is
3999: useful for building packages on several
4000: architectures, then <code xmlns=
4001: "http://www.w3.org/TR/xhtml1/transitional" class=
4002: "filename">${PKGSRCDIR}</code> can be NFS-mounted
4003: while <code xmlns=
4004: "http://www.w3.org/TR/xhtml1/transitional" class=
4005: "filename">${WRKOBJDIR}</code> is local to every
4006: architecture. (It should be noted that <code class=
4007: "varname">PKGSRCDIR</code> should not be set by the
4008: user — it is an internal definition which
4009: refers to the root of the pkgsrc tree. It is
4010: possible to have many pkgsrc tree instances.)</p>
4011: </li>
4012:
4013: <li>
4014: <p><code class="varname">LOCALPATCHES</code>:
4015: Directory for local patches that aren't part of
4016: pkgsrc. See <a href="#components.patches" title=
4017: "8.3. patches/*">Section 8.3,
4018: “patches/*”</a> for more information.
4019: <em class="replaceable"><code>rel</code></em> and
4020: <em class="replaceable"><code>arch</code></em> are
4021: replaced with OS release (“<span class=
4022: "quote">2.0</span>”, etc.) and architecture
4023: (“<span class="quote">mipsel</span>”,
4024: etc.).</p>
4025: </li>
4026:
4027: <li>
4028: <p><code class="varname">PKGMAKECONF</code>:
4029: Location of the <code xmlns=
4030: "http://www.w3.org/TR/xhtml1/transitional" class=
4031: "filename">mk.conf</code> file used by a package's
4032: BSD-style Makefile. If this is not set,
4033: <code class="varname">MAKECONF</code> is set to
4034: <code xmlns=
4035: "http://www.w3.org/TR/xhtml1/transitional" class=
4036: "filename">/dev/null</code> to avoid picking up
4037: settings used by builds in <code xmlns=
4038: "http://www.w3.org/TR/xhtml1/transitional" class=
4039: "filename">/usr/src</code>.</p>
4040: </li>
4041: </ul>
4042: </div>
4043: </div>
4044:
1.67 hubertf 4045: <div class="sect1" lang="en">
1.45 wiz 4046: <div class="titlepage">
4047: <div>
4048: <div>
4049: <h2 class="title" style="clear: both"><a name=
4050: "developer-advanced-settings"></a>5.3. Developer/advanced
4051: settings</h2>
4052: </div>
4053: </div>
4054: </div>
4055:
4056: <p>XXX</p>
4057:
4058: <div class="itemizedlist">
4059: <ul type="disc">
4060: <li>
4061: <p><code class="varname">PKG_DEVELOPER</code>: Run
4062: some sanity checks that package developers
4063: want:</p>
4064:
4065: <div class="itemizedlist">
4066: <ul type="circle">
4067: <li>
4068: <p>make sure patches apply with zero fuzz</p>
4069: </li>
4070:
4071: <li>
4072: <p>run check-shlibs to see that all binaries
4073: will find their shared libs.</p>
4074: </li>
4075: </ul>
4076: </div>
4077: </li>
4078:
4079: <li>
4080: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
4081: The level of debugging output which is displayed
4082: whilst making and installing the package. The
4083: default value for this is 0, which will not display
4084: the commands as they are executed (normal, default,
4085: quiet operation); the value 1 will display all
4086: shell commands before their invocation, and the
4087: value 2 will display both the shell commands before
4088: their invocation, and their actual execution
4089: progress with <span><strong class="command">set
4090: -x</strong></span> will be displayed.</p>
4091: </li>
1.58 erh 4092:
4093: <li>
4094: <p><code class=
4095: "varname">ALLOW_VULNERABILITIES.<em class=
4096: "replaceable"><code>pkgbase</code></em></code>: A
4097: space separated list of vulnerability IDs that may
4098: be ignored when performing the automated security
4099: checks. These IDs are listed in the
4100: pkg-vulnerabilities file and are displayed by
4101: <span><strong class=
4102: "command">audit-packages</strong></span> when it
4103: finds a vulnerable package.</p>
4104: </li>
4105:
4106: <li>
4107: <p><code class=
4108: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
4109: set to “<span class=
4110: "quote">yes</span>”, the automated security
4111: checks (which use the <a xmlns=
4112: "http://www.w3.org/TR/xhtml1/transitional" href=
4113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
4114: target="_top"><code xmlns="" class=
4115: "filename">security/audit-packages</code></a>
4116: package) will be <span class=
4117: "strong"><strong>entirely</strong></span> skipped
4118: for <span class=
4119: "strong"><strong>all</strong></span> packages
4120: built. Normally you'll want to use
4121: ALLOW_VULNERABILITIES instead of this.</p>
4122: </li>
1.45 wiz 4123: </ul>
4124: </div>
4125: </div>
4126:
1.67 hubertf 4127: <div class="sect1" lang="en">
1.45 wiz 4128: <div class="titlepage">
4129: <div>
4130: <div>
4131: <h2 class="title" style="clear: both"><a name=
4132: "selecting-build-options"></a>5.4. Selecting
4133: Build Options</h2>
1.38 dillo 4134: </div>
4135: </div>
4136: </div>
4137:
4138: <p>Some packages have build time options, usually to
4139: select between different dependencies, enable optional
4140: support for big dependencies or enable experimental
4141: features.</p>
4142:
4143: <p>To see which options, if any, a package supports, and
4144: which options are mutually exclusive, run
4145: <span><strong class="command">make
4146: show-options</strong></span>, for example:</p>
4147: <pre class="programlisting">
1.51 rillig 4148: The following options are supported by this package:
1.70 rillig 4149: ssl Enable SSL support.
1.51 rillig 4150: Exactly one of the following gecko options is required:
1.70 rillig 4151: firefox Use firefox as gecko rendering engine.
4152: mozilla Use mozilla as gecko rendering engine.
1.51 rillig 4153: At most one of the following database options may be selected:
1.70 rillig 4154: mysql Enable support for MySQL database.
4155: pgsql Enable support for PostgreSQL database.
1.51 rillig 4156:
4157: These options are enabled by default: firefox
4158: These options are currently enabled: mozilla ssl
1.38 dillo 4159: </pre>
4160:
1.45 wiz 4161: <p>The following variables can be defined in <code xmlns=
4162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4163: "filename">/etc/mk.conf</code> to select which options to
4164: enable for a package: <code class=
4165: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
4166: to select or disable options for all packages that
4167: support them, and <code class=
4168: "varname">PKG_OPTIONS.<em class=
4169: "replaceable"><code>pkgbase</code></em></code>, which can
4170: be used to select or disable options specifically for
4171: package <em class=
4172: "replaceable"><code>pkgbase</code></em>. Options listed
4173: in these variables are selected, options preceded by
1.67 hubertf 4174: “<span class="quote">-</span>” are disabled.
4175: A few examples:</p>
4176: <pre class="screen">
4177: <code class="prompt">$</code> <span><strong class=
4178: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68 rillig 4179: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1.67 hubertf 4180: PKG_OPTIONS.kdebase= debug -sasl
4181: PKG_OPTIONS.apache= suexec
4182: </pre>
1.38 dillo 4183:
1.39 dillo 4184: <p>The following settings are consulted in the order
4185: given, and the last setting that selects or disables an
4186: option is used:</p>
1.38 dillo 4187:
4188: <div class="orderedlist">
4189: <ol type="1">
4190: <li>
4191: <p>the default options as suggested by the package
4192: maintainer</p>
4193: </li>
4194:
4195: <li>
4196: <p>the options implied by the settings of legacy
4197: variables (see below)</p>
4198: </li>
4199:
4200: <li>
4201: <p><code class=
4202: "varname">PKG_DEFAULT_OPTIONS</code></p>
4203: </li>
4204:
4205: <li>
4206: <p><code class="varname">PKG_OPTIONS.<em class=
4207: "replaceable"><code>pkgbase</code></em></code></p>
4208: </li>
4209: </ol>
4210: </div>
4211:
4212: <p>For groups of mutually exclusive options, the last
4213: option selected is used, all others are automatically
4214: disabled. If an option of the group is explicitly
4215: disabled, the previously selected option, if any, is
4216: used. It is an error if no option from a required group
4217: of options is selected, and building the package will
4218: fail.</p>
4219:
4220: <p>Before the options framework was introduced, build
1.65 hubertf 4221: options were selected by setting a variable (often named
4222: <code class="varname">USE_<em class=
4223: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 4224: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4225: class="filename">/etc/mk.conf</code> for each option. To
4226: ease transition to the options framework for the user,
4227: these legacy variables are converted to the appropriate
1.65 hubertf 4228: options setting (<code class=
4229: "varname">PKG_OPTIONS.<em class=
4230: "replaceable"><code>pkgbase</code></em></code>)
4231: automatically. A warning is issued to prompt the user to
4232: update <code xmlns=
1.45 wiz 4233: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 4234: "filename">/etc/mk.conf</code> to use the options
1.65 hubertf 4235: framework directly. Support for the legacy variables will
4236: be removed eventually.</p>
1.38 dillo 4237: </div>
4238: </div>
4239:
1.67 hubertf 4240: <div class="chapter" lang="en">
1.38 dillo 4241: <div class="titlepage">
4242: <div>
4243: <div>
1.67 hubertf 4244: <h2 class="title"><a name=
1.38 dillo 4245: "binary"></a>Chapter 6. Creating binary
1.1 grant 4246: packages</h2>
4247: </div>
4248: </div>
4249: </div>
4250:
4251: <div class="toc">
4252: <p><b>Table of Contents</b></p>
4253:
4254: <dl>
1.30 wiz 4255: <dt><span class="sect1"><a href=
1.38 dillo 4256: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 4257: single binary package</a></span></dt>
1.1 grant 4258:
1.30 wiz 4259: <dt><span class="sect1"><a href=
1.38 dillo 4260: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 4261: Settings for creation of binary
4262: packages</a></span></dt>
4263:
1.38 dillo 4264: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 4265: a bulk build of all packages</a></span></dt>
4266:
4267: <dd>
4268: <dl>
4269: <dt><span class="sect2"><a href=
1.38 dillo 4270: "#binary.configuration">6.3.1.
1.1 grant 4271: Configuration</a></span></dt>
4272:
1.30 wiz 4273: <dt><span class="sect2"><a href=
1.38 dillo 4274: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 4275: environmental considerations</a></span></dt>
1.1 grant 4276:
1.38 dillo 4277: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 4278: Operation</a></span></dt>
4279:
1.30 wiz 4280: <dt><span class="sect2"><a href=
1.38 dillo 4281: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 4282:
1.30 wiz 4283: <dt><span class="sect2"><a href=
1.38 dillo 4284: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 4285: requirements</a></span></dt>
1.1 grant 4286:
1.30 wiz 4287: <dt><span class="sect2"><a href=
1.38 dillo 4288: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 4289: for chrooted builds</a></span></dt>
1.1 grant 4290:
1.30 wiz 4291: <dt><span class="sect2"><a href=
1.38 dillo 4292: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 4293: set of packages</a></span></dt>
1.13 hubertf 4294:
4295: <dt><span class="sect2"><a href=
1.38 dillo 4296: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 4297: build</a></span></dt>
1.1 grant 4298: </dl>
4299: </dd>
4300:
1.38 dillo 4301: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 4302: Creating a multiple CD-ROM packages
4303: collection</a></span></dt>
4304:
4305: <dd>
4306: <dl>
1.30 wiz 4307: <dt><span class="sect2"><a href=
1.38 dillo 4308: "#cdpack-example">6.4.1. Example of
1.30 wiz 4309: cdpack</a></span></dt>
1.1 grant 4310: </dl>
4311: </dd>
4312: </dl>
4313: </div>
4314:
1.67 hubertf 4315: <div class="sect1" lang="en">
1.1 grant 4316: <div class="titlepage">
4317: <div>
4318: <div>
4319: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4320: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 4321: a single binary package</h2>
1.1 grant 4322: </div>
4323: </div>
4324: </div>
4325:
4326: <p>Once you have built and installed a package, you can
4327: create a <span class="emphasis"><em>binary
4328: package</em></span> which can be installed on another
4329: system with <a href=
4330: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4331: <span class="citerefentry"><span class=
1.47 reed 4332: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4333: having to build the same package on a group of hosts and
4334: wasting CPU time. It also provides a simple means for
4335: others to install your package, should you distribute
4336: it.</p>
4337:
4338: <p>To create a binary package, change into the
1.14 xtraeme 4339: appropriate directory in pkgsrc, and run
4340: <span><strong class="command">make
4341: package</strong></span>:</p>
1.1 grant 4342: <pre class="screen">
1.14 xtraeme 4343: <code class="prompt">#</code> <strong class=
4344: "userinput"><code>cd misc/figlet</code></strong>
4345: <code class="prompt">#</code> <strong class=
4346: "userinput"><code>make package</code></strong>
1.1 grant 4347: </pre>
4348:
4349: <p>This will build and install your package (if not
4350: already done), and then build a binary package from what
1.14 xtraeme 4351: was installed. You can then use the <span><strong class=
4352: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4353: Binary packages are created by default in <code xmlns=
4354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4355: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4356: gzipped tar file. See <a href="#logs.package" title=
1.67 hubertf 4357: "B.2. Packaging figlet">Section B.2,
1.1 grant 4358: “Packaging figlet”</a> for a continuation of
4359: the above <a xmlns=
4360: "http://www.w3.org/TR/xhtml1/transitional" href=
4361: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4362: target="_top"><code xmlns="" class=
4363: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4364:
4365: <p>See <a href="#submit" title=
1.68 rillig 4366: "Chapter 18. Submitting and Committing">Chapter 18,
1.67 hubertf 4367: <i>Submitting and Committing</i></a> for information on
4368: how to submit such a binary package.</p>
1.1 grant 4369: </div>
4370:
1.67 hubertf 4371: <div class="sect1" lang="en">
1.1 grant 4372: <div class="titlepage">
4373: <div>
4374: <div>
4375: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4376: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4377: for creation of binary packages</h2>
4378: </div>
4379: </div>
4380: </div>
4381:
4382: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4383: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4384: “Other helpful targets”</a>.</p>
4385: </div>
4386:
1.67 hubertf 4387: <div class="sect1" lang="en">
1.1 grant 4388: <div class="titlepage">
4389: <div>
4390: <div>
4391: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 4392: "bulkbuild"></a>6.3. Doing a bulk build of all
4393: packages</h2>
1.1 grant 4394: </div>
4395: </div>
4396: </div>
4397:
4398: <p>If you want to get a full set of precompiled binary
4399: packages, this section describes how to get them. Beware
4400: that the bulk build will remove all currently installed
1.63 dillo 4401: packages from your system!</p>
4402:
4403: <p>Having an FTP server configured either on the machine
4404: doing the bulk builds or on a nearby NFS server can help
4405: to make the packages available to other machines that can
4406: then save time by installing only the binary packages.
4407: See <a href=
1.1 grant 4408: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4409: <span class="citerefentry"><span class=
4410: "refentrytitle">ftpd</span>(8)</span></a> for more
4411: information. If you use a remote NFS server's storage, be
4412: sure to not actually compile on NFS storage, as this
4413: slows things down a lot.</p>
4414:
1.67 hubertf 4415: <div class="sect2" lang="en">
1.1 grant 4416: <div class="titlepage">
4417: <div>
4418: <div>
1.67 hubertf 4419: <h3 class="title"><a name=
1.38 dillo 4420: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4421: </div>
4422: </div>
4423: </div>
4424:
1.67 hubertf 4425: <div class="sect3" lang="en">
1.1 grant 4426: <div class="titlepage">
4427: <div>
4428: <div>
1.63 dillo 4429: <h4 class="title"><a name=
4430: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4431: class="filename">build.conf</code></h4>
4432: </div>
4433: </div>
4434: </div>
4435:
4436: <p>The <code xmlns=
4437: "http://www.w3.org/TR/xhtml1/transitional" class=
4438: "filename">build.conf</code> file is the main
4439: configuration file for bulk builds. You can configure
4440: how your copy of pkgsrc is kept up to date, how the
4441: distfiles are downloaded, how the packages are built
4442: and how the report is generated. You can find an
4443: annotated example file in <code xmlns=
4444: "http://www.w3.org/TR/xhtml1/transitional" class=
4445: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4446: To use it, copy <code xmlns=
4447: "http://www.w3.org/TR/xhtml1/transitional" class=
4448: "filename">build.conf-example</code> to <code xmlns=
4449: "http://www.w3.org/TR/xhtml1/transitional" class=
4450: "filename">build.conf</code> and edit it, following
4451: the comments in that file.</p>
4452: </div>
4453:
1.67 hubertf 4454: <div class="sect3" lang="en">
1.63 dillo 4455: <div class="titlepage">
4456: <div>
4457: <div>
1.67 hubertf 4458: <h4 class="title"><a name=
1.63 dillo 4459: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4460: </div>
4461: </div>
4462: </div>
4463:
1.45 wiz 4464: <p>You may want to set variables in <code xmlns=
4465: "http://www.w3.org/TR/xhtml1/transitional" class=
4466: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4468: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4469: details of the default settings. You will want to
1.14 xtraeme 4470: ensure that <code class=
4471: "varname">ACCEPTABLE_LICENSES</code> meet your local
4472: policy. As used in this example, <code class=
4473: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4474: "emphasis"><em>all</em></span> licenses.</p>
4475: <pre class="programlisting">
1.51 rillig 4476: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4477: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4478: BSDSRCDIR= /usr/src
4479: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4480: OBJHOSTNAME?= yes # use work.`hostname`
4481: FAILOVER_FETCH= yes # insist on the correct checksum
4482: PKG_DEVELOPER?= yes
4483: _ACCEPTABLE= yes
1.1 grant 4484: </pre>
4485:
1.63 dillo 4486: <p>Some options that are especially useful for bulk
4487: builds can be found at the top lines of the file
4488: <code xmlns=
4489: "http://www.w3.org/TR/xhtml1/transitional" class=
4490: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4491: useful options of these are briefly described
4492: here.</p>
4493:
4494: <div class="itemizedlist">
4495: <ul type="disc">
4496: <li>
4497: <p>If you are on a slow machine, you may want
4498: to set <code class=
4499: "varname">USE_BULK_BROKEN_CHECK</code> to
4500: “<span class=
4501: "quote">no</span>”.</p>
4502: </li>
4503:
4504: <li>
4505: <p>If you are doing bulk builds from a
4506: read-only copy of pkgsrc, you have to set
4507: <code class="varname">BULKFILESDIR</code> to
4508: the directory where all log files are created.
4509: Otherwise the log files are created in the
4510: pkgsrc directory.</p>
4511: </li>
4512:
4513: <li>
4514: <p>Another important variable is <code class=
4515: "varname">BULK_PREREQ</code>, which is a list
4516: of packages that should be always available
4517: while building other packages.</p>
4518: </li>
4519: </ul>
1.1 grant 4520: </div>
1.68 rillig 4521:
4522: <p>Some other options are scattered in the pkgsrc
4523: infrastructure:</p>
4524:
4525: <div class="itemizedlist">
4526: <ul type="disc">
4527: <li>
1.69 rillig 4528: <p><code class=
4529: "varname">ALLOW_VULNERABLE_PACKAGES</code>
4530: should be set to <code class=
4531: "literal">yes</code>. The purpose of the bulk
4532: builds is creating binary packages, no matter
4533: if they are vulnerable or not. When uploading
4534: the packages to a public server, the vulnerable
4535: packages will be put into a directory of their
4536: own. Leaving this variable unset would prevent
4537: the bulk build system from even trying to build
4538: them, so possible building errors would not
4539: show up.</p>
4540: </li>
4541:
4542: <li>
1.68 rillig 4543: <p><code class="varname">CHECK_FILES</code>
4544: (<code xmlns=
4545: "http://www.w3.org/TR/xhtml1/transitional"
4546: class=
4547: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4548: can be set to “<span class=
4549: "quote">yes</span>” to check that the
4550: installed set of files matches the <code xmlns=
4551: "http://www.w3.org/TR/xhtml1/transitional"
4552: class="filename">PLIST</code>.</p>
4553: </li>
4554:
4555: <li>
4556: <p><code class=
4557: "varname">CHECK_INTERPRETER</code>
4558: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4559: class=
4560: "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
4561: can be set to “<span class=
4562: "quote">yes</span>” to check that the
4563: installed “<span class=
4564: "quote">#!</span>”-scripts will find
4565: their interpreter.</p>
4566: </li>
4567: </ul>
4568: </div>
1.1 grant 4569: </div>
4570:
1.67 hubertf 4571: <div class="sect3" lang="en">
1.1 grant 4572: <div class="titlepage">
4573: <div>
4574: <div>
1.67 hubertf 4575: <h4 class="title"><a name=
1.45 wiz 4576: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4577: class="filename">pre-build.local</code></h4>
1.1 grant 4578: </div>
4579: </div>
4580: </div>
4581:
4582: <p>It is possible to configure the bulk build to
1.47 reed 4583: perform certain site-specific tasks at the end of the
1.45 wiz 4584: pre-build stage. If the file <code xmlns=
4585: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4586: "filename">pre-build.local</code> exists in
1.45 wiz 4587: <code xmlns=
4588: "http://www.w3.org/TR/xhtml1/transitional" class=
4589: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4590: executed (as a <a href=
1.24 wiz 4591: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4592: <span class="citerefentry"><span class=
4593: "refentrytitle">sh</span>(1)</span></a> script) at
4594: the end of the usual pre-build stage. An example use
1.45 wiz 4595: of <code xmlns=
4596: "http://www.w3.org/TR/xhtml1/transitional" class=
4597: "filename">pre-build.local</code> is to have the
4598: line:</p>
1.1 grant 4599: <pre class="screen">
1.71 wiz 4600: echo "I do not have enough disk space to build this pig." \
4601: > misc/openoffice/$BROKENF
1.1 grant 4602: </pre>
4603:
4604: <p>to prevent the system from trying to build a
4605: particular package which requires nearly 3 GB of disk
4606: space.</p>
4607: </div>
4608: </div>
4609:
1.67 hubertf 4610: <div class="sect2" lang="en">
1.1 grant 4611: <div class="titlepage">
4612: <div>
4613: <div>
1.30 wiz 4614: <h3 class="title"><a name=
1.38 dillo 4615: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4616: environmental considerations</h3>
1.1 grant 4617: </div>
4618: </div>
4619: </div>
4620:
1.45 wiz 4621: <p>As <code xmlns=
4622: "http://www.w3.org/TR/xhtml1/transitional" class=
4623: "filename">/usr/pkg</code> will be completely deleted
4624: at the start of bulk builds, make sure your login shell
4625: is placed somewhere else. Either drop it into
4626: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4627: class="filename">/usr/local/bin</code> (and adjust your
4628: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4629: <a href=
1.1 grant 4630: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4631: <span class="citerefentry"><span class=
4632: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4633: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4634: class="filename">/etc/rc.local</code>, so you can login
4635: after a reboot (remember that your current process
4636: won't die if the package is removed, you just can't
4637: start any new instances of the shell any more). Also,
4638: if you use NetBSD earlier than 1.5, or you still want
4639: to use the pkgsrc version of ssh for some reason, be
4640: sure to install ssh before starting it from
4641: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4642: class="filename">rc.local</code>:</p>
1.1 grant 4643: <pre class="programlisting">
1.51 rillig 4644: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4645: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4646: /usr/pkg/etc/rc.d/sshd
4647: fi
1.1 grant 4648: </pre>
4649:
4650: <p>Not doing so will result in you being not able to
4651: log in via ssh after the bulk build is finished or if
4652: the machine gets rebooted or crashes. You have been
4653: warned! :)</p>
4654: </div>
4655:
1.67 hubertf 4656: <div class="sect2" lang="en">
1.1 grant 4657: <div class="titlepage">
4658: <div>
4659: <div>
1.67 hubertf 4660: <h3 class="title"><a name=
1.38 dillo 4661: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4662: </div>
4663: </div>
4664: </div>
4665:
4666: <p>Make sure you don't need any of the packages still
4667: installed.</p>
4668:
4669: <div class="warning" style=
4670: "margin-left: 0.5in; margin-right: 0.5in;">
4671: <h3 class="title">Warning</h3>
4672:
4673: <p>During the bulk build, <span class=
4674: "emphasis"><em>all packages will be
4675: removed!</em></span></p>
4676: </div>
4677:
4678: <p>Be sure to remove all other things that might
4679: interfere with builds, like some libs installed in
1.45 wiz 4680: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4681: class="filename">/usr/local</code>, etc. then become
4682: root and type:</p>
1.1 grant 4683: <pre class="screen">
1.14 xtraeme 4684: <code class="prompt">#</code> <strong class=
4685: "userinput"><code>cd /usr/pkgsrc</code></strong>
4686: <code class="prompt">#</code> <strong class=
4687: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4688: </pre>
4689:
4690: <p>If for some reason your last build didn't complete
4691: (power failure, system panic, ...), you can continue it
4692: by running:</p>
4693: <pre class="screen">
1.14 xtraeme 4694: <code class="prompt">#</code> <strong class=
4695: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4696: </pre>
4697:
4698: <p>At the end of the bulk build, you will get a summary
4699: via mail, and find build logs in the directory
1.14 xtraeme 4700: specified by <code class="varname">FTP</code> in the
1.45 wiz 4701: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4702: class="filename">build.conf</code> file.</p>
1.1 grant 4703: </div>
4704:
1.67 hubertf 4705: <div class="sect2" lang="en">
1.1 grant 4706: <div class="titlepage">
4707: <div>
4708: <div>
1.67 hubertf 4709: <h3 class="title"><a name=
1.38 dillo 4710: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4711: </div>
4712: </div>
4713: </div>
4714:
4715: <p>The bulk builds consist of three steps:</p>
4716:
4717: <div class="variablelist">
4718: <dl>
4719: <dt><span class="term">1. pre-build</span></dt>
4720:
4721: <dd>
4722: <p>The script updates your pkgsrc tree via
4723: (anon)cvs, then cleans out any broken distfiles,
4724: and removes all packages installed.</p>
4725: </dd>
4726:
4727: <dt><span class="term">2. the bulk
4728: build</span></dt>
4729:
4730: <dd>
4731: <p>This is basically “<span class=
4732: "quote">make bulk-package</span>” with an
4733: optimised order in which packages will be built.
4734: Packages that don't require other packages will
4735: be built first, and packages with many
4736: dependencies will be built later.</p>
4737: </dd>
4738:
4739: <dt><span class="term">3. post-build</span></dt>
4740:
4741: <dd>
4742: <p>Generates a report that's placed in the
1.45 wiz 4743: directory specified in the <code xmlns=
4744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4745: "filename">build.conf</code> file named
1.45 wiz 4746: <code xmlns=
4747: "http://www.w3.org/TR/xhtml1/transitional" class=
4748: "filename">broken.html</code>, a short version of
4749: that report will also be mailed to the build's
4750: admin.</p>
1.1 grant 4751: </dd>
4752: </dl>
4753: </div>
4754:
4755: <p>During the build, a list of broken packages will be
1.45 wiz 4756: compiled in <code xmlns=
4757: "http://www.w3.org/TR/xhtml1/transitional" class=
4758: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4760: "filename">.../.broken.${MACHINE}</code> if
4761: <code class="varname">OBJMACHINE</code> is set),
4762: individual build logs of broken builds can be found in
4763: the package's directory. These files are used by the
4764: bulk-targets to mark broken builds to not waste time
4765: trying to rebuild them, and they can be used to debug
4766: these broken package builds later.</p>
1.1 grant 4767: </div>
4768:
1.67 hubertf 4769: <div class="sect2" lang="en">
1.1 grant 4770: <div class="titlepage">
4771: <div>
4772: <div>
1.30 wiz 4773: <h3 class="title"><a name=
1.38 dillo 4774: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4775: space requirements</h3>
1.1 grant 4776: </div>
4777: </div>
4778: </div>
4779:
4780: <p>Currently, roughly the following requirements are
4781: valid for NetBSD 2.0/i386:</p>
4782:
4783: <div class="itemizedlist">
4784: <ul type="disc">
4785: <li>
4786: <p>10 GB - distfiles (NFS ok)</p>
4787: </li>
4788:
4789: <li>
4790: <p>8 GB - full set of all binaries (NFS ok)</p>
4791: </li>
4792:
4793: <li>
4794: <p>5 GB - temp space for compiling (local disk
4795: recommended)</p>
4796: </li>
4797: </ul>
4798: </div>
4799:
4800: <p>Note that all pkgs will be de-installed as soon as
4801: they are turned into a binary package, and that sources
4802: are removed, so there is no excessively huge demand to
4803: disk space. Afterwards, if the package is needed again,
4804: it will be installed via <a href=
4805: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4806: <span class="citerefentry"><span class=
4807: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4808: building again, so there are no cycles wasted by
4809: recompiling.</p>
4810: </div>
4811:
1.67 hubertf 4812: <div class="sect2" lang="en">
1.1 grant 4813: <div class="titlepage">
4814: <div>
4815: <div>
1.67 hubertf 4816: <h3 class="title"><a name=
4817: "setting-up-a-sandbox"></a>6.3.6. Setting up
4818: a sandbox for chrooted builds</h3>
1.1 grant 4819: </div>
4820: </div>
4821: </div>
4822:
1.12 agc 4823: <p>If you don't want all the packages nuked from a
4824: machine (rendering it useless for anything but pkg
1.23 wiz 4825: compiling), there is the possibility of doing the
4826: package bulk build inside a chroot environment.</p>
1.12 agc 4827:
4828: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4829: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4830: class="filename">/usr/sandbox</code>. This can be done
4831: by using null mounts, or manually.</p>
1.12 agc 4832:
1.45 wiz 4833: <p>There is a shell script called <code xmlns=
4834: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4835: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4836: set up the sandbox environment using null mounts. It
1.45 wiz 4837: will also create a script called <code xmlns=
4838: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4839: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4840: environment, which will allow the null mounts to be
1.14 xtraeme 4841: activated using the <span><strong class=
4842: "command">sandbox mount</strong></span> command and
4843: deactivated using the <span><strong class=
4844: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4845:
4846: <p>To set up a sandbox environment by hand, after
4847: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4848: doing a <span><strong class="command">make distribution
1.45 wiz 4849: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4850: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4851: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4852: items are present and properly configured:</p>
1.1 grant 4853:
4854: <div class="procedure">
4855: <ol type="1">
4856: <li>
4857: <p>Kernel</p>
4858: <pre class="screen">
1.14 xtraeme 4859: <code class="prompt">#</code> <strong class=
4860: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4861: </pre>
4862: </li>
4863:
4864: <li>
1.45 wiz 4865: <p><code xmlns=
4866: "http://www.w3.org/TR/xhtml1/transitional" class=
4867: "filename">/dev/*</code></p>
1.1 grant 4868: <pre class="screen">
1.14 xtraeme 4869: <code class="prompt">#</code> <strong class=
4870: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4871: </pre>
4872: </li>
4873:
4874: <li>
1.45 wiz 4875: <p><code xmlns=
4876: "http://www.w3.org/TR/xhtml1/transitional" class=
4877: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4878: "http://www.w3.org/TR/xhtml1/transitional" href=
4879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4880: target="_top"><code xmlns="" class=
4881: "filename">security/smtpd</code></a> and
4882: mail):</p>
1.1 grant 4883: <pre class="screen">
1.14 xtraeme 4884: <code class="prompt">#</code> <strong class=
4885: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4886: </pre>
4887: </li>
4888:
4889: <li>
4890: <p>Working(!) mail config (hostname,
4891: sendmail.cf):</p>
4892: <pre class="screen">
1.14 xtraeme 4893: <code class="prompt">#</code> <strong class=
4894: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4895: </pre>
4896: </li>
4897:
4898: <li>
1.45 wiz 4899: <p><code xmlns=
4900: "http://www.w3.org/TR/xhtml1/transitional" class=
4901: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4902: "http://www.w3.org/TR/xhtml1/transitional" href=
4903: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4904: target="_top"><code xmlns="" class=
4905: "filename">security/smtpd</code></a>):</p>
1.1 grant 4906: <pre class="screen">
1.14 xtraeme 4907: <code class="prompt">#</code> <strong class=
4908: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4909: </pre>
4910: </li>
4911:
4912: <li>
1.45 wiz 4913: <p><code xmlns=
4914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 4915: "filename">/usr/src</code> (system sources,
4916: e. g. for <a xmlns=
1.1 grant 4917: "http://www.w3.org/TR/xhtml1/transitional" href=
4918: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4919: target="_top"><code xmlns="" class=
1.71 wiz 4920: "filename">sysutils/aperture</code></a>):</p>
1.1 grant 4921: <pre class="screen">
1.14 xtraeme 4922: <code class="prompt">#</code> <strong class=
4923: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4924: <code class="prompt">#</code> <strong class=
1.23 wiz 4925: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4926: </pre>
4927: </li>
4928:
4929: <li>
1.45 wiz 4930: <p>Create <code xmlns=
4931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4932: "filename">/var/db/pkg</code> (not part of
4933: default install):</p>
1.1 grant 4934: <pre class="screen">
1.14 xtraeme 4935: <code class="prompt">#</code> <strong class=
4936: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4937: </pre>
4938: </li>
4939:
4940: <li>
1.45 wiz 4941: <p>Create <code xmlns=
4942: "http://www.w3.org/TR/xhtml1/transitional" class=
4943: "filename">/usr/pkg</code> (not part of default
4944: install):</p>
1.1 grant 4945: <pre class="screen">
1.14 xtraeme 4946: <code class="prompt">#</code> <strong class=
4947: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4948: </pre>
4949: </li>
4950:
4951: <li>
1.45 wiz 4952: <p>Checkout pkgsrc via cvs into <code xmlns=
4953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4954: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4955: <pre class="screen">
1.14 xtraeme 4956: <code class="prompt">#</code> <strong class=
4957: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4958: <code class="prompt">#</code> <strong class=
4959: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4960: </pre>
4961:
4962: <p>Do not mount/link this to the copy of your
4963: pkgsrc tree you do development in, as this will
4964: likely cause problems!</p>
4965: </li>
4966:
4967: <li>
1.45 wiz 4968: <p>Make <code xmlns=
4969: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4970: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4971: and <code xmlns=
4972: "http://www.w3.org/TR/xhtml1/transitional" class=
4973: "filename">.../distfiles</code> point somewhere
4974: appropriate. NFS- and/or nullfs-mounts may come
4975: in handy!</p>
1.1 grant 4976: </li>
4977:
4978: <li>
1.45 wiz 4979: <p>Edit <code xmlns=
4980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4981: "filename">/etc/mk.conf</code>, see <a href=
4982: "#binary.mk.conf" title=
1.63 dillo 4983: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 4984: “/etc/mk.conf”</a>.</p>
4985: </li>
4986:
4987: <li>
1.45 wiz 4988: <p>Adjust <code xmlns=
4989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4990: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4991: needs.</p>
4992: </li>
4993: </ol>
4994: </div>
4995:
1.47 reed 4996: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4997: build with the following steps:</p>
4998: <pre class="screen">
1.14 xtraeme 4999: <code class="prompt">#</code> <strong class=
5000: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
5001: <code class="prompt">#</code> <strong class=
5002: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 5003: </pre>
5004:
5005: <p>This will just jump inside the sandbox and start
5006: building. At the end of the build, mail will be sent
5007: with the results of the build. Created binary pkgs will
1.45 wiz 5008: be in <code xmlns=
5009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5010: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 5011: (wherever that points/mounts to/from).</p>
5012: </div>
5013:
1.67 hubertf 5014: <div class="sect2" lang="en">
1.1 grant 5015: <div class="titlepage">
5016: <div>
5017: <div>
1.30 wiz 5018: <h3 class="title"><a name=
1.38 dillo 5019: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 5020: a partial set of packages</h3>
1.1 grant 5021: </div>
5022: </div>
5023: </div>
5024:
5025: <p>In addition to building a complete set of all
1.45 wiz 5026: packages in pkgsrc, the <code xmlns=
5027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5028: "filename">pkgsrc/mk/bulk/build</code> script may be
5029: used to build a subset of the packages contained in
1.47 reed 5030: pkgsrc. By setting <code class=
1.45 wiz 5031: "varname">SPECIFIC_PKGS</code> in <code xmlns=
5032: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5033: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 5034:
5035: <div class="itemizedlist">
5036: <ul type="disc">
5037: <li>
5038: <p>SITE_SPECIFIC_PKGS</p>
5039: </li>
5040:
5041: <li>
5042: <p>HOST_SPECIFIC_PKGS</p>
5043: </li>
5044:
5045: <li>
5046: <p>GROUP_SPECIFIC_PKGS</p>
5047: </li>
5048:
5049: <li>
5050: <p>USER_SPECIFIC_PKGS</p>
5051: </li>
5052: </ul>
5053: </div>
5054:
5055: <p>will define the set of packages which should be
5056: built. The bulk build code will also include any
5057: packages which are needed as dependencies for the
5058: explicitly listed packages.</p>
5059:
5060: <p>One use of this is to do a bulk build with
1.14 xtraeme 5061: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 5062: sandbox periodically to have a complete set of the
5063: binary packages needed for your site available without
5064: the overhead of building extra packages that are not
5065: needed.</p>
5066: </div>
1.13 hubertf 5067:
1.67 hubertf 5068: <div class="sect2" lang="en">
1.13 hubertf 5069: <div class="titlepage">
5070: <div>
5071: <div>
1.67 hubertf 5072: <h3 class="title"><a name=
1.38 dillo 5073: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 5074: of a bulk build</h3>
5075: </div>
5076: </div>
5077: </div>
5078:
5079: <p>This section describes how pkgsrc developers can
5080: upload binary pkgs built by bulk builds to
5081: ftp.NetBSD.org.</p>
5082:
1.17 sketch 5083: <p>If you would like to automatically create checksum
5084: files for the binary packages you intend to upload,
5085: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 5086: in your <code xmlns=
5087: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 5088: "filename">mk/bulk/build.conf</code>.</p>
5089:
5090: <p>If you would like to PGP sign the checksum files
5091: (highly recommended!), remember to set <code class=
5092: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 5093: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5094: class="filename">mk/bulk/build.conf</code>. This will
5095: prompt you for your GPG password to sign the files
1.17 sketch 5096: before uploading everything.</p>
5097:
5098: <p>Then, make sure that you have <code class=
1.14 xtraeme 5099: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 5100: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5101: class="filename">mk/bulk/build.conf</code> file, i.e.
5102: adjust it to something like one of the following:</p>
1.13 hubertf 5103: <pre class="screen">
1.68 rillig 5104: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
1.13 hubertf 5105: </pre>
5106:
1.47 reed 5107: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 5108: "NetBSD-a.b.c" and "arch" here. If your login on
1.68 rillig 5109: ftp.NetBSD.org is different from your local login,
5110: write your login directly into the variable, e.g. my
5111: local account is "feyrer", but for my login "hubertf",
5112: I use:</p>
1.13 hubertf 5113: <pre class="screen">
5114: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
5115: </pre>
5116:
1.45 wiz 5117: <p>A separate <code xmlns=
5118: "http://www.w3.org/TR/xhtml1/transitional" class=
5119: "filename">upload</code> directory is used here to
5120: allow "closing" the directory during upload. To do so,
5121: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 5122: <pre class="screen">
1.14 xtraeme 5123: nbftp% <strong class=
5124: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 5125: </pre>
5126:
1.45 wiz 5127: <p>Please note that <code xmlns=
5128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5129: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 5130: appropriate for packages for the NetBSD operating
5131: system. Binary packages for other operating systems
1.45 wiz 5132: should go into <code xmlns=
5133: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5134: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 5135:
5136: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 5137: needs to be set up. This example shows how to set up
1.13 hubertf 5138: temporary keys for the root account <span class=
5139: "emphasis"><em>inside the sandbox</em></span> (assuming
5140: that no keys should be present there usually):</p>
5141: <pre class="screen">
1.14 xtraeme 5142: <code class="prompt">#</code> <strong class=
1.68 rillig 5143: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14 xtraeme 5144: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5145: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14 xtraeme 5146: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5147: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14 xtraeme 5148: chroot-<code class="prompt">#</code> <strong class=
5149: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 5150: </pre>
5151:
1.45 wiz 5152: <p>Now take the output of <code xmlns=
5153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5154: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 5155: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5156: class="filename">~/.ssh/authorized_keys</code> file on
5157: ftp.NetBSD.org. You can remove the key after the upload
5158: is done!</p>
1.13 hubertf 5159:
5160: <p>Next, test if your ssh connection really works:</p>
5161: <pre class="screen">
1.14 xtraeme 5162: chroot-<code class="prompt">#</code> <strong class=
5163: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 5164: </pre>
5165:
5166: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
5167:
5168: <p>Now after all this works, you can exit the sandbox
5169: and start the upload:</p>
5170: <pre class="screen">
1.14 xtraeme 5171: chroot-<code class="prompt">#</code> <strong class=
1.68 rillig 5172: "userinput"><code>exit</code></strong>
1.14 xtraeme 5173: <code class="prompt">#</code> <strong class=
1.68 rillig 5174: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14 xtraeme 5175: <code class="prompt">#</code> <strong class=
5176: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 5177: </pre>
5178:
5179: <p>The upload process may take quite some time. Use
1.24 wiz 5180: <a href=
5181: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
5182: <span class="citerefentry"><span class=
5183: "refentrytitle">ls</span>(1)</span></a> or <a href=
5184: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
5185: <span class="citerefentry"><span class=
5186: "refentrytitle">du</span>(1)</span></a> on the FTP
5187: server to monitor progress of the upload. The upload
5188: script will take care of not uploading restricted
5189: packages and putting vulnerable packages into the
1.45 wiz 5190: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5191: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 5192:
5193: <p>After the upload has ended, first thing is to revoke
5194: ssh access:</p>
5195: <pre class="screen">
1.14 xtraeme 5196: nbftp% <strong class=
5197: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 5198: Gdd:x!
5199: </pre>
5200:
5201: <p>Use whatever is needed to remove the key you've
5202: entered before! Last, move the uploaded packages out of
1.45 wiz 5203: the <code xmlns=
5204: "http://www.w3.org/TR/xhtml1/transitional" class=
5205: "filename">upload</code> directory to have them
5206: accessible to everyone:</p>
1.13 hubertf 5207: <pre class="screen">
1.14 xtraeme 5208: nbftp% <strong class=
5209: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
5210: nbftp% <strong class=
5211: "userinput"><code>mv upload/* .</code></strong>
5212: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
5213: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 5214: </pre>
5215: </div>
1.1 grant 5216: </div>
5217:
1.67 hubertf 5218: <div class="sect1" lang="en">
1.1 grant 5219: <div class="titlepage">
5220: <div>
5221: <div>
5222: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5223: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 5224: CD-ROM packages collection</h2>
1.1 grant 5225: </div>
5226: </div>
5227: </div>
5228:
5229: <p>After your pkgsrc bulk-build has completed, you may
5230: wish to create a CD-ROM set of the resulting binary
5231: packages to assist in installing packages on other
5232: machines. The <a xmlns=
5233: "http://www.w3.org/TR/xhtml1/transitional" href=
5234: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 5235: target="_top"><code xmlns="" class=
5236: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 5237: simple tool for creating the ISO 9660 images.
5238: <span><strong class="command">cdpack</strong></span>
5239: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 5240: all the dependencies for a given package on the same CD
5241: as that package.</p>
1.1 grant 5242:
1.67 hubertf 5243: <div class="sect2" lang="en">
1.1 grant 5244: <div class="titlepage">
5245: <div>
5246: <div>
1.67 hubertf 5247: <h3 class="title"><a name=
1.38 dillo 5248: "cdpack-example"></a>6.4.1. Example of
1.1 grant 5249: cdpack</h3>
5250: </div>
5251: </div>
5252: </div>
5253:
5254: <p>Complete documentation for cdpack is found in the
1.47 reed 5255: cdpack(1) man page. The following short example assumes
1.45 wiz 5256: that the binary packages are left in <code xmlns=
5257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5258: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 5259: sufficient disk space exists in <code xmlns=
5260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5261: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 5262: <pre class="screen">
1.14 xtraeme 5263: <code class="prompt">#</code> <strong class=
5264: "userinput"><code>mkdir /u2/images</code></strong>
5265: <code class="prompt">#</code> <strong class=
5266: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
5267: <code class="prompt">#</code> <strong class=
5268: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5269: </pre>
5270:
5271: <p>If you wish to include a common set of files
1.45 wiz 5272: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5273: class="filename">COPYRIGHT</code>, <code xmlns=
5274: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5275: "filename">README</code>, etc.) on each CD in the
1.1 grant 5276: collection, then you need to create a directory which
5277: contains these files. e.g.</p>
5278: <pre class="screen">
1.14 xtraeme 5279: <code class="prompt">#</code> <strong class=
5280: "userinput"><code>mkdir /tmp/common</code></strong>
5281: <code class="prompt">#</code> <strong class=
5282: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
5283: <code class="prompt">#</code> <strong class=
5284: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
5285: <code class="prompt">#</code> <strong class=
5286: "userinput"><code>mkdir /tmp/common/bin</code></strong>
5287: <code class="prompt">#</code> <strong class=
5288: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
5289: <code class="prompt">#</code> <strong class=
5290: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
5291: <code class="prompt">#</code> <strong class=
5292: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 5293: </pre>
5294:
5295: <p>Now create the images:</p>
5296: <pre class="screen">
1.14 xtraeme 5297: <code class="prompt">#</code> <strong class=
5298: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 5299: </pre>
5300:
1.45 wiz 5301: <p>Each image will contain <code xmlns=
5302: "http://www.w3.org/TR/xhtml1/transitional" class=
5303: "filename">README</code>, <code xmlns=
5304: "http://www.w3.org/TR/xhtml1/transitional" class=
5305: "filename">COPYING</code>, and <code xmlns=
5306: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5307: "filename">bin/myscript</code> in their root
1.1 grant 5308: directories.</p>
5309: </div>
5310: </div>
5311: </div>
5312:
1.67 hubertf 5313: <div class="chapter" lang="en">
1.1 grant 5314: <div class="titlepage">
5315: <div>
5316: <div>
1.67 hubertf 5317: <h2 class="title"><a name=
1.38 dillo 5318: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 5319: Questions</h2>
5320: </div>
5321: </div>
5322: </div>
5323:
5324: <div class="toc">
5325: <p><b>Table of Contents</b></p>
5326:
5327: <dl>
1.30 wiz 5328: <dt><span class="sect1"><a href=
1.38 dillo 5329: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 5330: lists for pkg-related discussion?</a></span></dt>
1.1 grant 5331:
1.38 dillo 5332: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 5333: Where's the pkgviews documentation?</a></span></dt>
5334:
1.38 dillo 5335: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 5336: Utilities for package management
5337: (pkgtools)</a></span></dt>
5338:
1.38 dillo 5339: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 5340: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 5341:
1.30 wiz 5342: <dt><span class="sect1"><a href=
1.38 dillo 5343: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 5344: fetching distfiles?</a></span></dt>
1.14 xtraeme 5345:
1.30 wiz 5346: <dt><span class="sect1"><a href=
1.38 dillo 5347: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 5348: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 5349:
1.30 wiz 5350: <dt><span class="sect1"><a href=
1.38 dillo 5351: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 5352: from pkgsrc?</a></span></dt>
1.1 grant 5353:
1.30 wiz 5354: <dt><span class="sect1"><a href=
1.38 dillo 5355: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 5356: behind a firewall</a></span></dt>
1.1 grant 5357:
1.38 dillo 5358: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 5359: do I tell <span><strong class="command">make
5360: fetch</strong></span> to do passive
5361: FTP?</a></span></dt>
1.1 grant 5362:
1.30 wiz 5363: <dt><span class="sect1"><a href=
1.38 dillo 5364: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 5365: distfiles at once</a></span></dt>
1.1 grant 5366:
1.30 wiz 5367: <dt><span class="sect1"><a href=
1.38 dillo 5368: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5369: “<span class="quote">Don't know how to make
1.14 xtraeme 5370: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5371: mean?</a></span></dt>
5372:
1.30 wiz 5373: <dt><span class="sect1"><a href=
1.38 dillo 5374: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5375: “<span class="quote">Could not find
1.14 xtraeme 5376: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5377:
1.30 wiz 5378: <dt><span class="sect1"><a href=
1.38 dillo 5379: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5380: pkgsrc</a></span></dt>
1.1 grant 5381:
1.38 dillo 5382: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5383: do I change the location of configuration
5384: files?</a></span></dt>
1.1 grant 5385:
1.38 dillo 5386: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5387: Automated security checks</a></span></dt>
5388: </dl>
5389: </div>
5390:
5391: <p>This section contains hints, tips & tricks on
5392: special things in pkgsrc that we didn't find a better place
5393: for in the previous chapters, and it contains items for
5394: both pkgsrc users and developers.</p>
5395:
1.67 hubertf 5396: <div class="sect1" lang="en">
1.1 grant 5397: <div class="titlepage">
5398: <div>
5399: <div>
5400: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5401: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5402: mailing lists for pkg-related discussion?</h2>
1.1 grant 5403: </div>
5404: </div>
5405: </div>
5406:
1.18 xtraeme 5407: <p>The following mailing lists may be of interest to
5408: pkgsrc users:</p>
5409:
5410: <div class="itemizedlist">
5411: <ul type="disc">
5412: <li>
5413: <p><a href=
5414: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.71 wiz 5415: target="_top">pkgsrc-bugs</a>: All bug reports in
5416: category "pkg" sent with <a href=
5417: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
5418: <span class="citerefentry"><span class=
5419: "refentrytitle">send-pr</span>(1)</span></a> appear
5420: here. Please do not report your bugs here directly;
5421: use one of the other mailing lists. discussed.</p>
1.18 xtraeme 5422: </li>
5423:
5424: <li>
5425: <p><a href=
5426: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5427: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5428: results of pkgsrc bulk builds are sent and
1.34 wiz 5429: discussed.</p>
1.18 xtraeme 5430: </li>
5431:
5432: <li>
5433: <p><a href=
5434: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.71 wiz 5435: target="_top">pkgsrc-changes</a>: This list is for
5436: those who are interested in getting a commit
5437: message for every change committed to pkgsrc. It is
5438: also available in digest form, meaning one daily
5439: message containing all commit messages for changes
5440: to the package source tree in that 24 hour
5441: period.</p>
1.18 xtraeme 5442: </li>
5443:
5444: <li>
5445: <p><a href=
5446: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.71 wiz 5447: target="_top">pkgsrc-users</a>: This is a general
5448: purpose list for most issues regarding pkgsrc,
5449: regardless of platform, e.g. soliciting user help
5450: for pkgsrc configuration, unexpected build
5451: failures, using particular packages, upgrading
5452: pkgsrc installations, questions regarding the
5453: pkgsrc release branches, etc. General announcements
5454: or proposals for changes that impact the pkgsrc
5455: user community, e.g. major infrastructure changes,
5456: new features, package removals, etc., may also be
5457: posted.</p>
5458: </li>
5459:
5460: <li>
5461: <p><a href=
5462: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
5463: target="_top">tech-pkg</a>: This is a list for
5464: technical discussions related to pkgsrc
5465: development, e.g. soliciting feedback for changes
5466: to pkgsrc infrastructure, proposed new features,
5467: questions related to porting pkgsrc to a new
5468: platform, advice for maintaining a package, patches
5469: that affect many packages, help requests moved from
5470: pkgsrc-users when an infrastructure bug is found,
5471: etc.</p>
1.18 xtraeme 5472: </li>
5473: </ul>
5474: </div>
5475:
5476: <p>To subscribe, do:</p>
1.1 grant 5477: <pre class="programlisting">
1.51 rillig 5478: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5479: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5480: </pre>
5481:
1.18 xtraeme 5482: <p>Archives for all these mailing lists are available
5483: from <a href="http://mail-index.NetBSD.org/" target=
5484: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5485: </div>
5486:
1.67 hubertf 5487: <div class="sect1" lang="en">
1.1 grant 5488: <div class="titlepage">
5489: <div>
5490: <div>
5491: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5492: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5493: documentation?</h2>
1.1 grant 5494: </div>
5495: </div>
5496: </div>
5497:
5498: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5499: find a pkgviews User's guide in <code xmlns=
5500: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5501: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5502: </div>
5503:
1.67 hubertf 5504: <div class="sect1" lang="en">
1.1 grant 5505: <div class="titlepage">
5506: <div>
5507: <div>
5508: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5509: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5510: management (pkgtools)</h2>
1.1 grant 5511: </div>
5512: </div>
5513: </div>
5514:
1.45 wiz 5515: <p>The <code xmlns=
5516: "http://www.w3.org/TR/xhtml1/transitional" class=
5517: "filename">pkgsrc/pkgtools</code> directory pkgtools
5518: contains a number of useful utilities for both users and
5519: developers of pkgsrc. This section attempts only to make
5520: the reader aware of the utilities and when they might be
5521: useful, and not to duplicate the documentation that comes
5522: with each package.</p>
1.1 grant 5523:
5524: <p>Utilities used by pkgsrc (automatically installed when
5525: needed):</p>
5526:
5527: <div class="itemizedlist">
5528: <ul type="disc">
5529: <li>
5530: <p><a xmlns=
5531: "http://www.w3.org/TR/xhtml1/transitional" href=
5532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5533: target="_top"><code xmlns="" class=
5534: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5535: for use by buildlink.</p>
1.1 grant 5536: </li>
5537: </ul>
5538: </div>
5539:
5540: <p>OS tool augmentation (automatically installed when
5541: needed):</p>
5542:
5543: <div class="itemizedlist">
5544: <ul type="disc">
5545: <li>
5546: <p><a xmlns=
5547: "http://www.w3.org/TR/xhtml1/transitional" href=
5548: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5549: target="_top"><code xmlns="" class=
5550: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5551: various kinds of checksums (including SHA1).</p>
1.1 grant 5552: </li>
5553:
5554: <li>
5555: <p><a xmlns=
5556: "http://www.w3.org/TR/xhtml1/transitional" href=
5557: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5558: target="_top"><code xmlns="" class=
5559: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5560: Compatibility library for pkgsrc tools.</p>
1.1 grant 5561: </li>
5562:
5563: <li>
5564: <p><a xmlns=
5565: "http://www.w3.org/TR/xhtml1/transitional" href=
5566: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5567: target="_top"><code xmlns="" class=
5568: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5569: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5570: </li>
5571:
5572: <li>
5573: <p><a xmlns=
5574: "http://www.w3.org/TR/xhtml1/transitional" href=
5575: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5576: target="_top"><code xmlns="" class=
5577: "filename">pkgtools/pkg_install</code></a>:
5578: Up-to-date replacement for <code xmlns=
5579: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5580: "filename">/usr/sbin/pkg_install</code>, or for use
5581: on operating systems where pkg_install is not
5582: present.</p>
1.1 grant 5583: </li>
5584: </ul>
5585: </div>
5586:
5587: <p>Utilities used by pkgsrc (not automatically
5588: installed):</p>
5589:
5590: <div class="itemizedlist">
5591: <ul type="disc">
5592: <li>
5593: <p><a xmlns=
5594: "http://www.w3.org/TR/xhtml1/transitional" href=
5595: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5596: target="_top"><code xmlns="" class=
5597: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5598: binary package from an already-installed package.
1.34 wiz 5599: Used by <span><strong class="command">make
5600: replace</strong></span> to save the old
5601: package.</p>
1.1 grant 5602: </li>
5603:
5604: <li>
5605: <p><a xmlns=
5606: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5607: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5608: target="_top"><code xmlns="" class=
5609: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5610: functionality to pkgsrc, allowing it to fetch
5611: distfiles from multiple locations. It currently
5612: supports the following methods: multiple CD-ROMs
5613: and network FTP/HTTP connections.</p>
1.5 hubertf 5614: </li>
5615:
5616: <li>
5617: <p><a xmlns=
5618: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5619: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5620: target="_top"><code xmlns="" class=
5621: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5622: packages someplace else (enabled by default).</p>
1.1 grant 5623: </li>
1.5 hubertf 5624:
5625: <li>
5626: <p><a xmlns=
5627: "http://www.w3.org/TR/xhtml1/transitional" href=
5628: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5629: target="_top"><code xmlns="" class=
5630: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5631: best compiler flags to optimise code for your
1.20 ben 5632: current CPU and compiler.</p>
1.5 hubertf 5633: </li>
1.1 grant 5634: </ul>
5635: </div>
5636:
5637: <p>Utilities for keeping track of installed packages,
5638: being up to date, etc:</p>
5639:
5640: <div class="itemizedlist">
5641: <ul type="disc">
5642: <li>
5643: <p><a xmlns=
5644: "http://www.w3.org/TR/xhtml1/transitional" href=
5645: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5646: target="_top"><code xmlns="" class=
5647: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5648: packages whose installed versions do not match the
1.34 wiz 5649: latest pkgsrc entries.</p>
1.1 grant 5650: </li>
5651:
5652: <li>
5653: <p><a xmlns=
5654: "http://www.w3.org/TR/xhtml1/transitional" href=
5655: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5656: target="_top"><code xmlns="" class=
5657: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5658: dependency graphs of packages, to aid in choosing a
1.34 wiz 5659: strategy for updating.</p>
1.1 grant 5660: </li>
5661:
5662: <li>
5663: <p><a xmlns=
5664: "http://www.w3.org/TR/xhtml1/transitional" href=
5665: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5666: target="_top"><code xmlns="" class=
5667: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5668: graphs from the output of <a xmlns=
5669: "http://www.w3.org/TR/xhtml1/transitional" href=
5670: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5671: target="_top"><code xmlns="" class=
5672: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5673: graphviz).</p>
1.1 grant 5674: </li>
5675:
5676: <li>
5677: <p><a xmlns=
5678: "http://www.w3.org/TR/xhtml1/transitional" href=
5679: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5680: target="_top"><code xmlns="" class=
5681: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5682: pkglint(1) program checks a pkgsrc entry for
5683: errors, lintpkgsrc(1) does various checks on the
5684: complete pkgsrc system.</p>
1.1 grant 5685: </li>
5686:
5687: <li>
5688: <p><a xmlns=
5689: "http://www.w3.org/TR/xhtml1/transitional" href=
5690: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5691: target="_top"><code xmlns="" class=
5692: "filename">pkgtools/pkgsurvey</code></a>: Report
5693: what packages you have installed.</p>
1.1 grant 5694: </li>
5695: </ul>
5696: </div>
5697:
5698: <p>Utilities for people maintaining or creating
5699: individual packages:</p>
5700:
5701: <div class="itemizedlist">
5702: <ul type="disc">
5703: <li>
5704: <p><a xmlns=
5705: "http://www.w3.org/TR/xhtml1/transitional" href=
5706: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5707: target="_top"><code xmlns="" class=
5708: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5709: making and maintaining patches for a package
1.34 wiz 5710: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5711: </li>
5712:
5713: <li>
5714: <p><a xmlns=
5715: "http://www.w3.org/TR/xhtml1/transitional" href=
5716: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5717: target="_top"><code xmlns="" class=
5718: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5719: "http://www.w3.org/TR/xhtml1/transitional" href=
5720: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5721: target="_top"><code xmlns="" class=
5722: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5723: converting to pkgsrc.</p>
1.1 grant 5724: </li>
5725:
5726: <li>
5727: <p><a xmlns=
5728: "http://www.w3.org/TR/xhtml1/transitional" href=
5729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5730: target="_top"><code xmlns="" class=
5731: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5732: pkgsrc to a Solaris package.</p>
1.1 grant 5733: </li>
5734: </ul>
5735: </div>
5736:
1.47 reed 5737: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5738: obscure pkg utilities)</p>
5739:
5740: <div class="itemizedlist">
5741: <ul type="disc">
5742: <li>
5743: <p><a xmlns=
5744: "http://www.w3.org/TR/xhtml1/transitional" href=
5745: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5746: target="_top"><code xmlns="" class=
5747: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5748: packages in a chrooted area.</p>
1.1 grant 5749: </li>
5750:
5751: <li>
5752: <p><a xmlns=
5753: "http://www.w3.org/TR/xhtml1/transitional" href=
5754: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5755: target="_top"><code xmlns="" class=
5756: "filename">pkgtools/libkver</code></a>: Spoof
5757: kernel version for chrooted cross builds.</p>
1.1 grant 5758: </li>
5759: </ul>
5760: </div>
5761: </div>
5762:
1.67 hubertf 5763: <div class="sect1" lang="en">
1.1 grant 5764: <div class="titlepage">
5765: <div>
5766: <div>
5767: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5768: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5769: as non-root</h2>
1.1 grant 5770: </div>
5771: </div>
5772: </div>
5773:
5774: <p>If you want to use pkgsrc as non-root user, you can
5775: set some variables to make pkgsrc work under these
1.33 jmmv 5776: conditions. At the very least, you need to set
5777: <code class="varname">UNPRIVILEGED</code> to
5778: “<span class="quote">yes</span>”; this will
5779: turn on unprivileged mode and set multiple related
5780: variables to allow installation of packages as
5781: non-root.</p>
5782:
5783: <p>In case the defaults are not enough, you may want to
5784: tune some other variables used. For example, if the
5785: automatic user/group detection leads to incorrect values
5786: (or not the ones you would like to use), you can change
5787: them by setting <code class=
5788: "varname">UNPRIVILEGED_USER</code> and <code class=
5789: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5790:
5791: <p>As regards bootstrapping, please note that the
5792: <span><strong class="command">bootstrap</strong></span>
5793: script will ease non-root configuration when given the
5794: “<span class=
5795: "quote">--ignore-user-check</span>” flag, as it
5796: will choose and use multiple default directories under
1.45 wiz 5797: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5798: class="filename">~/pkg</code> as the installation
1.33 jmmv 5799: targets. These directories can be overriden by the
5800: “<span class="quote">--prefix</span>” flag
5801: provided by the script, as well as some others that allow
5802: finer tuning of the tree layout.</p>
1.14 xtraeme 5803: </div>
5804:
1.67 hubertf 5805: <div class="sect1" lang="en">
1.14 xtraeme 5806: <div class="titlepage">
5807: <div>
5808: <div>
5809: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5810: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5811: transfers when fetching distfiles?</h2>
1.14 xtraeme 5812: </div>
5813: </div>
5814: </div>
5815:
1.47 reed 5816: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5817: but you can enable this feature by adding the option
5818: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5819: into <code xmlns=
5820: "http://www.w3.org/TR/xhtml1/transitional" class=
5821: "filename">/etc/mk.conf</code>. If, during a fetch step,
5822: an incomplete distfile is found, pkgsrc will try to
5823: resume it.</p>
1.15 xtraeme 5824:
5825: <p>You can also use a different program than the default
1.24 wiz 5826: <a href=
5827: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5828: <span class="citerefentry"><span class=
5829: "refentrytitle">ftp</span>(1)</span></a> by changing the
5830: <code class="varname">FETCH_CMD</code> variable. Don't
5831: forget to set <code class=
5832: "varname">FETCH_RESUME_ARGS</code> and <code class=
5833: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5834: default values.</p>
1.14 xtraeme 5835:
1.45 wiz 5836: <p>For example, if you want to use <code xmlns=
5837: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5838: "filename">wget</code> to resume downloads, you'll have
5839: to use something like:</p>
5840: <pre class="programlisting">
1.51 rillig 5841: FETCH_CMD= wget
5842: FETCH_BEFORE_ARGS= --passive-ftp
5843: FETCH_RESUME_ARGS= -c
5844: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5845: </pre>
1.1 grant 5846: </div>
5847:
1.67 hubertf 5848: <div class="sect1" lang="en">
1.1 grant 5849: <div class="titlepage">
5850: <div>
5851: <div>
5852: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5853: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5854: install/use XFree86 from pkgsrc?</h2>
5855: </div>
5856: </div>
5857: </div>
5858:
5859: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5860: system's own X11 (<code xmlns=
5861: "http://www.w3.org/TR/xhtml1/transitional" class=
5862: "filename">/usr/X11R6</code>, <code xmlns=
5863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5864: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5865: add the following line into <code xmlns=
5866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5867: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5868: <pre class="programlisting">
1.51 rillig 5869: X11_TYPE=XFree86
1.1 grant 5870: </pre>
5871: </div>
5872:
1.67 hubertf 5873: <div class="sect1" lang="en">
1.1 grant 5874: <div class="titlepage">
5875: <div>
5876: <div>
5877: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5878: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5879: install/use X.org from pkgsrc?</h2>
5880: </div>
5881: </div>
5882: </div>
5883:
5884: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5885: system's own X11 (<code xmlns=
5886: "http://www.w3.org/TR/xhtml1/transitional" class=
5887: "filename">/usr/X11R6</code>, <code xmlns=
5888: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5889: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5890: the following line into <code xmlns=
5891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5892: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5893: <pre class="programlisting">
1.51 rillig 5894: X11_TYPE=xorg
1.1 grant 5895: </pre>
1.70 rillig 5896:
5897: <div class="note" style=
5898: "margin-left: 0.5in; margin-right: 0.5in;">
5899: <h3 class="title">Note</h3>
5900:
5901: <p>The DragonFly operating system defaults to using
5902: this X.org X11 implementation from pkgsrc.</p>
5903: </div>
1.1 grant 5904: </div>
5905:
1.67 hubertf 5906: <div class="sect1" lang="en">
1.1 grant 5907: <div class="titlepage">
5908: <div>
5909: <div>
5910: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5911: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5912: files from behind a firewall</h2>
1.1 grant 5913: </div>
5914: </div>
5915: </div>
5916:
5917: <p>If you are sitting behind a firewall which does not
5918: allow direct connections to Internet hosts (i.e.
5919: non-NAT), you may specify the relevant proxy hosts. This
5920: is done using an environment variable in the form of a
1.47 reed 5921: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5922: "quote">orpheus.amdahl.com</span>” is one of the
5923: firewalls, and it uses port 80 as the proxy port number.
5924: So the proxy environment variables are:</p>
5925: <pre class="programlisting">
1.51 rillig 5926: ftp_proxy=ftp://orpheus.amdahl.com:80/
5927: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5928: </pre>
5929: </div>
5930:
1.67 hubertf 5931: <div class="sect1" lang="en">
1.1 grant 5932: <div class="titlepage">
5933: <div>
5934: <div>
5935: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 5936: "passive-ftp"></a>7.9. How do I tell
5937: <span><strong class="command">make
1.14 xtraeme 5938: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5939: </div>
5940: </div>
5941: </div>
5942:
5943: <p>This depends on which utility is used to retrieve
1.45 wiz 5944: distfiles. From <code xmlns=
5945: "http://www.w3.org/TR/xhtml1/transitional" class=
5946: "filename">bsd.pkg.mk</code>, <code class=
5947: "varname">FETCH_CMD</code> is assigned the first
5948: available command from the following list:</p>
1.34 wiz 5949:
5950: <div class="itemizedlist">
5951: <ul type="disc">
5952: <li>
1.45 wiz 5953: <p><code xmlns=
5954: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5955: "filename">${LOCALBASE}/bin/ftp</code></p>
5956: </li>
5957:
5958: <li>
1.45 wiz 5959: <p><code xmlns=
5960: "http://www.w3.org/TR/xhtml1/transitional" class=
5961: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5962: </li>
5963: </ul>
5964: </div>
1.1 grant 5965:
5966: <p>On a default NetBSD installation, this will be
1.45 wiz 5967: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5968: class="filename">/usr/bin/ftp</code>, which automatically
5969: tries passive connections first, and falls back to active
5970: connections if the server refuses to do passive. For the
5971: other tools, add the following to your <code xmlns=
5972: "http://www.w3.org/TR/xhtml1/transitional" class=
5973: "filename">/etc/mk.conf</code> file: <code class=
5974: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5975:
1.45 wiz 5976: <p>Having that option present will prevent <code xmlns=
5977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5978: "filename">/usr/bin/ftp</code> from falling back to
5979: active transfers.</p>
1.1 grant 5980: </div>
5981:
1.67 hubertf 5982: <div class="sect1" lang="en">
1.1 grant 5983: <div class="titlepage">
5984: <div>
5985: <div>
5986: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5987: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5988: fetch all distfiles at once</h2>
5989: </div>
5990: </div>
5991: </div>
5992:
5993: <p>You would like to download all the distfiles in a
5994: single batch from work or university, where you can't run
1.14 xtraeme 5995: a <span><strong class="command">make
5996: fetch</strong></span>. There is an archive of distfiles
5997: on <a href=
1.1 grant 5998: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5999: target="_top">ftp.NetBSD.org</a>, but downloading the
6000: entire directory may not be appropriate.</p>
6001:
1.14 xtraeme 6002: <p>The answer here is to do a <span><strong class=
1.45 wiz 6003: "command">make fetch-list</strong></span> in <code xmlns=
6004: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6005: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 6006: subdirectories, carry the resulting list to your machine
1.23 wiz 6007: at work/school and use it there. If you don't have a
1.24 wiz 6008: NetBSD-compatible <a href=
6009: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
6010: <span class="citerefentry"><span class=
1.72 rillig 6011: "refentrytitle">ftp</span>(1)</span></a> (like tnftp) at
6012: work, don't forget to set <code class=
1.24 wiz 6013: "varname">FETCH_CMD</code> to something that fetches a
6014: URL:</p>
1.1 grant 6015:
6016: <p>At home:</p>
6017: <pre class="screen">
1.14 xtraeme 6018: <code class="prompt">%</code> <strong class=
6019: "userinput"><code>cd /usr/pkgsrc</code></strong>
6020: <code class="prompt">%</code> <strong class=
6021: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
6022: <code class="prompt">%</code> <strong class=
6023: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 6024: </pre>
6025:
6026: <p>At work:</p>
6027: <pre class="screen">
1.14 xtraeme 6028: <code class="prompt">%</code> <strong class=
6029: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 6030: </pre>
6031:
1.45 wiz 6032: <p>then tar up <code xmlns=
6033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6034: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 6035:
6036: <p>If you have a machine running NetBSD, and you want to
6037: get <span class="emphasis"><em>all</em></span> distfiles
6038: (even ones that aren't for your machine architecture),
6039: you can do so by using the above-mentioned
1.14 xtraeme 6040: <span><strong class="command">make
6041: fetch-list</strong></span> approach, or fetch the
6042: distfiles directly by running:</p>
1.1 grant 6043: <pre class="screen">
1.14 xtraeme 6044: <code class="prompt">%</code> <strong class=
6045: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 6046: </pre>
6047:
1.14 xtraeme 6048: <p>If you even decide to ignore <code class=
6049: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
6050: can get everything by running:</p>
1.1 grant 6051: <pre class="screen">
1.14 xtraeme 6052: <code class="prompt">%</code> <strong class=
6053: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 6054: </pre>
6055: </div>
6056:
1.67 hubertf 6057: <div class="sect1" lang="en">
1.1 grant 6058: <div class="titlepage">
6059: <div>
6060: <div>
6061: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6062: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 6063: “<span class="quote">Don't know how to make
6064: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
6065: </div>
6066: </div>
6067: </div>
6068:
6069: <p>When compiling the <a xmlns=
6070: "http://www.w3.org/TR/xhtml1/transitional" href=
6071: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6072: target="_top"><code xmlns="" class=
6073: "filename">pkgtools/pkg_install</code></a> package, you
6074: get the error from make that it doesn't know how to make
6075: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6076: class="filename">/usr/share/tmac/tmac.andoc</code>? This
6077: indicates that you don't have installed the
1.23 wiz 6078: “<span class="quote">text</span>” set (nroff,
6079: ...) from the NetBSD base distribution on your machine.
1.47 reed 6080: It is recommended to do that to format man pages.</p>
1.1 grant 6081:
6082: <p>In the case of the <a xmlns=
6083: "http://www.w3.org/TR/xhtml1/transitional" href=
6084: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 6085: target="_top"><code xmlns="" class=
6086: "filename">pkgtools/pkg_install</code></a> package, you
6087: can get away with setting <code class=
1.20 ben 6088: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 6089: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6090: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 6091: </div>
6092:
1.67 hubertf 6093: <div class="sect1" lang="en">
1.1 grant 6094: <div class="titlepage">
6095: <div>
6096: <div>
6097: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6098: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 6099: “<span class="quote">Could not find
6100: bsd.own.mk</span>” mean?</h2>
6101: </div>
6102: </div>
6103: </div>
6104:
1.45 wiz 6105: <p>You didn't install the compiler set, <code xmlns=
6106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6107: "filename">comp.tgz</code>, when you installed your
1.47 reed 6108: NetBSD machine. Please get and install it, by extracting
6109: it in <code xmlns=
1.45 wiz 6110: "http://www.w3.org/TR/xhtml1/transitional" class=
6111: "filename">/</code>:</p>
1.1 grant 6112: <pre class="screen">
1.14 xtraeme 6113: <code class="prompt">#</code> <strong class=
6114: "userinput"><code>cd /</code></strong>
6115: <code class="prompt">#</code> <strong class=
6116: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 6117: </pre>
6118:
1.45 wiz 6119: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6120: class="filename">comp.tgz</code> is part of every NetBSD
6121: release. Get the one that corresponds to your release
6122: (determine via <span><strong class="command">uname
6123: -r</strong></span>).</p>
1.1 grant 6124: </div>
6125:
1.67 hubertf 6126: <div class="sect1" lang="en">
1.1 grant 6127: <div class="titlepage">
6128: <div>
6129: <div>
6130: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6131: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 6132: 'sudo' with pkgsrc</h2>
6133: </div>
6134: </div>
6135: </div>
6136:
6137: <p>When installing packages as non-root user and using
1.24 wiz 6138: the just-in-time <a href=
6139: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
6140: <span class="citerefentry"><span class=
6141: "refentrytitle">su</span>(1)</span></a> feature of
6142: pkgsrc, it can become annoying to type in the root
6143: password for each required package installed. To avoid
6144: this, the sudo package can be used, which does password
6145: caching over a limited time. To use it, install sudo
6146: (either as binary package or from <a xmlns=
6147: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 6148: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 6149: target="_top"><code xmlns="" class=
6150: "filename">security/sudo</code></a>) and then put the
6151: following into your <code xmlns=
6152: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 6153: "filename">/etc/mk.conf</code>:</p>
1.1 grant 6154: <pre class="programlisting">
1.51 rillig 6155: .if exists(${LOCALBASE}/bin/sudo)
6156: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
6157: .endif
1.1 grant 6158: </pre>
6159: </div>
6160:
1.67 hubertf 6161: <div class="sect1" lang="en">
1.1 grant 6162: <div class="titlepage">
6163: <div>
6164: <div>
6165: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 6166: "faq.conf"></a>7.14. How do I change the
6167: location of configuration files?</h2>
1.1 grant 6168: </div>
6169: </div>
6170: </div>
6171:
1.35 jmmv 6172: <p>As the system administrator, you can choose where
6173: configuration files are installed. The default settings
1.45 wiz 6174: make all these files go into <code xmlns=
6175: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 6176: "filename">${PREFIX}/etc</code> or some of its
6177: subdirectories; this may be suboptimal depending on your
6178: expectations (e.g., a read-only, NFS-exported
6179: <code class="varname">PREFIX</code> with a need of
6180: per-machine configuration of the provided packages).</p>
6181:
6182: <p>In order to change the defaults, you can modify the
6183: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 6184: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6185: class="filename">/etc/mk.conf</code>) to point to your
6186: preferred configuration directory; some common examples
6187: include <code xmlns=
6188: "http://www.w3.org/TR/xhtml1/transitional" class=
6189: "filename">/etc</code> or <code xmlns=
6190: "http://www.w3.org/TR/xhtml1/transitional" class=
6191: "filename">/etc/pkg</code>.</p>
1.35 jmmv 6192:
6193: <p>Furthermore, you can change this value on a
6194: per-package basis by setting the <code class=
6195: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
6196: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
6197: value usually matches the name of the package you would
6198: like to modify, that is, the contents of <code class=
6199: "varname">PKGBASE</code>.</p>
1.1 grant 6200:
1.47 reed 6201: <p>Note that after changing these settings, you must
1.35 jmmv 6202: rebuild and reinstall any affected packages.</p>
1.1 grant 6203: </div>
6204:
1.67 hubertf 6205: <div class="sect1" lang="en">
1.1 grant 6206: <div class="titlepage">
6207: <div>
6208: <div>
6209: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6210: "audit-packages"></a>7.15. Automated security
1.1 grant 6211: checks</h2>
6212: </div>
6213: </div>
6214: </div>
6215:
6216: <p>Please be aware that there can often be bugs in
6217: third-party software, and some of these bugs can leave a
6218: machine vulnerable to exploitation by attackers. In an
6219: effort to lessen the exposure, the NetBSD packages team
6220: maintains a database of known-exploits to packages which
6221: have at one time been included in pkgsrc. The database
6222: can be downloaded automatically, and a security audit of
6223: all packages installed on a system can take place. To do
6224: this, install the <a xmlns=
6225: "http://www.w3.org/TR/xhtml1/transitional" href=
6226: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6227: target="_top"><code xmlns="" class=
6228: "filename">security/audit-packages</code></a> package. It
1.20 ben 6229: has two components:</p>
1.1 grant 6230:
6231: <div class="orderedlist">
6232: <ol type="1">
6233: <li>
1.34 wiz 6234: <p><span><strong class=
6235: "command">download-vulnerability-list</strong></span>,
1.1 grant 6236: an easy way to download a list of the security
6237: vulnerabilities information. This list is kept up
6238: to date by the NetBSD security officer and the
6239: NetBSD packages team, and is distributed from the
6240: NetBSD ftp server:</p>
6241:
6242: <p><a href=
6243: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 6244: target=
6245: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 6246: </li>
6247:
6248: <li>
1.34 wiz 6249: <p><span><strong class=
6250: "command">audit-packages</strong></span>, an easy
6251: way to audit the current machine, checking each
1.1 grant 6252: vulnerability which is known. If a vulnerable
6253: package is installed, it will be shown by output to
6254: stdout, including a description of the type of
6255: vulnerability, and a URL containing more
6256: information.</p>
6257: </li>
6258: </ol>
6259: </div>
6260:
1.23 wiz 6261: <p>Use of the <a xmlns=
6262: "http://www.w3.org/TR/xhtml1/transitional" href=
6263: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 6264: target="_top"><code xmlns="" class=
6265: "filename">security/audit-packages</code></a> package is
1.23 wiz 6266: strongly recommended! After “<span class=
6267: "quote">audit-packages</span>” is installed, please
6268: read the package's message, which you can get by running
6269: <strong class="userinput"><code>pkg_info -D
1.65 hubertf 6270: audit-packages</code></strong>.</p>
1.58 erh 6271:
6272: <p>If this package is installed, pkgsrc builds will use
6273: it to perform a security check before building any
6274: package. See <a href="#variables-affecting-build" title=
6275: "5.2. Variables affecting the build process">Section 5.2,
6276: “Variables affecting the build process”</a>
1.59 rillig 6277: for ways to control this check.</p>
1.1 grant 6278: </div>
6279: </div>
6280: </div>
6281:
1.67 hubertf 6282: <div class="part" lang="en">
1.1 grant 6283: <div class="titlepage">
6284: <div>
6285: <div>
1.67 hubertf 6286: <h1 class="title"><a name=
1.48 dillo 6287: "developers-guide"></a>Part II. The pkgsrc
6288: developer's guide</h1>
1.1 grant 6289: </div>
6290: </div>
6291: </div>
6292:
6293: <div class="toc">
6294: <p><b>Table of Contents</b></p>
6295:
6296: <dl>
1.38 dillo 6297: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 6298: Package components - files, directories and
6299: contents</a></span></dt>
6300:
6301: <dd>
6302: <dl>
6303: <dt><span class="sect1"><a href=
1.45 wiz 6304: "#components.Makefile">8.1. <code xmlns=
6305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6306: "filename">Makefile</code></a></span></dt>
6307:
6308: <dt><span class="sect1"><a href=
1.45 wiz 6309: "#components.distinfo">8.2. <code xmlns=
6310: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6311: "filename">distinfo</code></a></span></dt>
6312:
6313: <dt><span class="sect1"><a href=
1.38 dillo 6314: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 6315:
1.30 wiz 6316: <dt><span class="sect1"><a href=
1.38 dillo 6317: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6318: files</a></span></dt>
1.27 rillig 6319:
6320: <dt><span class="sect1"><a href=
1.38 dillo 6321: "#components.optional">8.5. Optional
1.27 rillig 6322: files</a></span></dt>
6323:
1.38 dillo 6324: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6325: <code xmlns=
6326: "http://www.w3.org/TR/xhtml1/transitional" class=
6327: "filename">work*</code></a></span></dt>
1.27 rillig 6328:
1.38 dillo 6329: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6330: <code xmlns=
6331: "http://www.w3.org/TR/xhtml1/transitional" class=
6332: "filename">files/*</code></a></span></dt>
1.27 rillig 6333: </dl>
6334: </dd>
6335:
1.38 dillo 6336: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 6337: Programming in <code xmlns=
6338: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6339: "filename">Makefile</code>s</a></span></dt>
6340:
6341: <dd>
6342: <dl>
6343: <dt><span class="sect1"><a href=
1.45 wiz 6344: "#makefile.variables">9.1. <code xmlns=
6345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 6346: "filename">Makefile</code> variables</a></span></dt>
6347:
1.27 rillig 6348: <dd>
6349: <dl>
6350: <dt><span class="sect2"><a href=
1.38 dillo 6351: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6352: conventions</a></span></dt>
6353: </dl>
6354: </dd>
6355:
1.38 dillo 6356: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 6357: Code snippets</a></span></dt>
6358:
6359: <dd>
6360: <dl>
6361: <dt><span class="sect2"><a href=
1.38 dillo 6362: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 6363: list</a></span></dt>
6364:
6365: <dt><span class="sect2"><a href=
1.38 dillo 6366: "#converting-internal-to-external">9.2.2.
1.30 wiz 6367: Converting an internal list into an external
6368: list</a></span></dt>
1.25 rillig 6369:
6370: <dt><span class="sect2"><a href=
1.38 dillo 6371: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6372: variables to a shell command</a></span></dt>
1.27 rillig 6373:
6374: <dt><span class="sect2"><a href=
1.38 dillo 6375: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 6376: guideline</a></span></dt>
6377:
6378: <dt><span class="sect2"><a href=
1.38 dillo 6379: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 6380: a bug in BSD Make</a></span></dt>
1.25 rillig 6381: </dl>
6382: </dd>
6383: </dl>
6384: </dd>
6385:
1.38 dillo 6386: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 6387: issues</a></span></dt>
6388:
6389: <dd>
6390: <dl>
1.38 dillo 6391: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6392: ID</a></span></dt>
6393:
1.30 wiz 6394: <dt><span class="sect1"><a href=
1.38 dillo 6395: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 6396: <code xmlns=
6397: "http://www.w3.org/TR/xhtml1/transitional" class=
6398: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 6399:
1.38 dillo 6400: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6401: Tweaking output of <span><strong class="command">make
6402: print-PLIST</strong></span></a></span></dt>
1.1 grant 6403:
1.38 dillo 6404: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6405: Variable substitution in PLIST</a></span></dt>
6406:
1.30 wiz 6407: <dt><span class="sect1"><a href=
1.48 dillo 6408: "#manpage-compression">10.5. Man page
6409: compression</a></span></dt>
1.1 grant 6410:
1.30 wiz 6411: <dt><span class="sect1"><a href=
1.38 dillo 6412: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6413: <code class=
1.14 xtraeme 6414: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6415:
1.30 wiz 6416: <dt><span class="sect1"><a href=
1.47 reed 6417: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6418: and differing PLISTs</a></span></dt>
1.1 grant 6419:
6420: <dt><span class="sect1"><a href=
1.38 dillo 6421: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6422: packages</a></span></dt>
6423: </dl>
6424: </dd>
6425:
1.38 dillo 6426: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6427: Buildlink methodology</a></span></dt>
6428:
6429: <dd>
6430: <dl>
1.30 wiz 6431: <dt><span class="sect1"><a href=
1.38 dillo 6432: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6433: to use buildlink3</a></span></dt>
1.1 grant 6434:
1.30 wiz 6435: <dt><span class="sect1"><a href=
1.45 wiz 6436: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6438: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6439:
6440: <dd>
6441: <dl>
6442: <dt><span class="sect2"><a href=
1.38 dillo 6443: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6444: buildlink3.mk file</a></span></dt>
1.1 grant 6445:
6446: <dt><span class="sect2"><a href=
1.38 dillo 6447: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6448: <code class=
1.72 rillig 6449: "varname">BUILDLINK_API_DEPENDS.<em class=
6450: "replaceable"><code>pkg</code></em></code> in
6451: <code xmlns=
1.45 wiz 6452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6453: "filename">buildlink3.mk</code>
1.1 grant 6454: files</a></span></dt>
6455: </dl>
6456: </dd>
6457:
1.30 wiz 6458: <dt><span class="sect1"><a href=
1.45 wiz 6459: "#writing-builtin.mk">11.3. Writing <code xmlns=
6460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6461: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6462:
6463: <dd>
6464: <dl>
6465: <dt><span class="sect2"><a href=
1.38 dillo 6466: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6467: <code xmlns=
6468: "http://www.w3.org/TR/xhtml1/transitional" class=
6469: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6470:
6471: <dt><span class="sect2"><a href=
1.38 dillo 6472: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6473: preferences for native or pkgsrc
6474: software</a></span></dt>
1.1 grant 6475: </dl>
6476: </dd>
6477: </dl>
6478: </dd>
6479:
1.38 dillo 6480: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6481: pkginstall framework</a></span></dt>
6482:
6483: <dd>
6484: <dl>
6485: <dt><span class="sect1"><a href=
1.38 dillo 6486: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6487: directories outside the installation
6488: prefix</a></span></dt>
6489:
6490: <dd>
6491: <dl>
6492: <dt><span class="sect2"><a href=
1.38 dillo 6493: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6494: manipulation</a></span></dt>
6495:
6496: <dt><span class="sect2"><a href=
1.38 dillo 6497: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6498: manipulation</a></span></dt>
6499: </dl>
6500: </dd>
6501:
1.38 dillo 6502: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6503: Configuration files</a></span></dt>
6504:
6505: <dd>
6506: <dl>
6507: <dt><span class="sect2"><a href=
1.38 dillo 6508: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6509: "varname">PKG_SYSCONFDIR</code> is
6510: set</a></span></dt>
6511:
6512: <dt><span class="sect2"><a href=
1.38 dillo 6513: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6514: software where configuration files
1.35 jmmv 6515: are</a></span></dt>
6516:
6517: <dt><span class="sect2"><a href=
1.38 dillo 6518: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6519: installations</a></span></dt>
6520:
6521: <dt><span class="sect2"><a href=
1.38 dillo 6522: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6523: of configuration files</a></span></dt>
6524: </dl>
6525: </dd>
6526:
1.38 dillo 6527: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6528: System startup scripts</a></span></dt>
6529:
6530: <dd>
6531: <dl>
6532: <dt><span class="sect2"><a href=
1.38 dillo 6533: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6534: of system startup scripts</a></span></dt>
6535: </dl>
6536: </dd>
6537:
6538: <dt><span class="sect1"><a href=
1.38 dillo 6539: "#users-and-groups">12.4. System users and
1.35 jmmv 6540: groups</a></span></dt>
6541:
1.38 dillo 6542: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6543: System shells</a></span></dt>
6544:
6545: <dd>
6546: <dl>
6547: <dt><span class="sect2"><a href=
1.65 hubertf 6548: "#shells-disable">12.5.1. Disabling shell
6549: registration</a></span></dt>
6550: </dl>
6551: </dd>
6552:
6553: <dt><span class="sect1"><a href="#fonts">12.6.
6554: Fonts</a></span></dt>
6555:
6556: <dd>
6557: <dl>
6558: <dt><span class="sect2"><a href=
6559: "#fonts-disable">12.6.1. Disabling automatic
6560: update of the fonts databases</a></span></dt>
1.35 jmmv 6561: </dl>
6562: </dd>
6563: </dl>
6564: </dd>
6565:
1.38 dillo 6566: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6567: handling</a></span></dt>
6568:
6569: <dd>
6570: <dl>
1.30 wiz 6571: <dt><span class="sect1"><a href=
1.38 dillo 6572: "#global-default-options">13.1. Global default
1.30 wiz 6573: options</a></span></dt>
1.1 grant 6574:
1.30 wiz 6575: <dt><span class="sect1"><a href=
1.38 dillo 6576: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6577: use <code xmlns=
6578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6579: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6580:
6581: <dt><span class="sect1"><a href="#option-names">13.3.
6582: Option Names</a></span></dt>
1.1 grant 6583: </dl>
6584: </dd>
6585:
1.38 dillo 6586: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6587: process</a></span></dt>
6588:
6589: <dd>
6590: <dl>
1.56 rillig 6591: <dt><span class="sect1"><a href="#build.intro">14.1.
6592: Introduction</a></span></dt>
6593:
6594: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6595: Program location</a></span></dt>
6596:
1.56 rillig 6597: <dt><span class="sect1"><a href=
6598: "#build.builddirs">14.3. Directories used during the
6599: build process</a></span></dt>
1.1 grant 6600:
6601: <dt><span class="sect1"><a href=
1.56 rillig 6602: "#build.running">14.4. Running a
6603: phase</a></span></dt>
6604:
6605: <dt><span class="sect1"><a href="#build.fetch">14.5.
6606: The <span class="emphasis"><em>fetch</em></span>
6607: phase</a></span></dt>
6608:
6609: <dt><span class="sect1"><a href=
6610: "#build.checksum">14.6. The <span class=
6611: "emphasis"><em>checksum</em></span>
6612: phase</a></span></dt>
6613:
6614: <dt><span class="sect1"><a href=
6615: "#build.extract">14.7. The <span class=
6616: "emphasis"><em>extract</em></span>
6617: phase</a></span></dt>
6618:
6619: <dt><span class="sect1"><a href="#build.patch">14.8.
6620: The <span class="emphasis"><em>patch</em></span>
6621: phase</a></span></dt>
6622:
6623: <dt><span class="sect1"><a href="#build.tools">14.9.
6624: The <span class="emphasis"><em>tools</em></span>
6625: phase</a></span></dt>
6626:
6627: <dt><span class="sect1"><a href=
6628: "#build.wrapper">14.10. The <span class=
6629: "emphasis"><em>wrapper</em></span>
6630: phase</a></span></dt>
6631:
6632: <dt><span class="sect1"><a href=
6633: "#build.configure">14.11. The <span class=
6634: "emphasis"><em>configure</em></span>
6635: phase</a></span></dt>
6636:
6637: <dt><span class="sect1"><a href="#build.build">14.12.
6638: The <span class="emphasis"><em>build</em></span>
6639: phase</a></span></dt>
6640:
6641: <dt><span class="sect1"><a href="#build.test">14.13.
6642: The <span class="emphasis"><em>test</em></span>
6643: phase</a></span></dt>
6644:
6645: <dt><span class="sect1"><a href=
6646: "#build.install">14.14. The <span class=
6647: "emphasis"><em>install</em></span>
6648: phase</a></span></dt>
6649:
6650: <dt><span class="sect1"><a href=
6651: "#build.package">14.15. The <span class=
6652: "emphasis"><em>package</em></span>
6653: phase</a></span></dt>
6654:
6655: <dt><span class="sect1"><a href=
6656: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6657: targets</a></span></dt>
6658: </dl>
6659: </dd>
6660:
1.68 rillig 6661: <dt><span class="chapter"><a href="#tools">15. Tools
6662: needed for building or running</a></span></dt>
6663:
6664: <dd>
6665: <dl>
6666: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
6667: Tools for pkgsrc builds</a></span></dt>
6668:
6669: <dt><span class="sect1"><a href=
6670: "#package-tools">15.2. Tools needed by
6671: packages</a></span></dt>
6672:
6673: <dt><span class="sect1"><a href=
6674: "#platform-tools">15.3. Tools provided by
6675: platforms</a></span></dt>
6676: </dl>
6677: </dd>
6678:
6679: <dt><span class="chapter"><a href="#fixes">16. Making
1.55 rillig 6680: your package work</a></span></dt>
1.1 grant 6681:
6682: <dd>
6683: <dl>
1.30 wiz 6684: <dt><span class="sect1"><a href=
1.68 rillig 6685: "#general-operation">16.1. General
1.30 wiz 6686: operation</a></span></dt>
1.1 grant 6687:
6688: <dd>
6689: <dl>
6690: <dt><span class="sect2"><a href=
1.68 rillig 6691: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 6692: pull in variables from
6693: /etc/mk.conf</a></span></dt>
1.1 grant 6694:
6695: <dt><span class="sect2"><a href=
1.68 rillig 6696: "#where-to-install-documentation">16.1.2. Where
1.31 wiz 6697: to install documentation</a></span></dt>
6698:
6699: <dt><span class="sect2"><a href=
1.68 rillig 6700: "#restricted-packages">16.1.3. Restricted
1.1 grant 6701: packages</a></span></dt>
6702:
6703: <dt><span class="sect2"><a href=
1.68 rillig 6704: "#dependencies">16.1.4. Handling
1.1 grant 6705: dependencies</a></span></dt>
6706:
6707: <dt><span class="sect2"><a href=
1.68 rillig 6708: "#conflicts">16.1.5. Handling conflicts with
1.1 grant 6709: other packages</a></span></dt>
6710:
6711: <dt><span class="sect2"><a href=
1.68 rillig 6712: "#not-building-packages">16.1.6. Packages that
1.30 wiz 6713: cannot or should not be built</a></span></dt>
1.1 grant 6714:
6715: <dt><span class="sect2"><a href=
1.68 rillig 6716: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 6717: should not be deleted, once
6718: installed</a></span></dt>
1.1 grant 6719:
6720: <dt><span class="sect2"><a href=
1.68 rillig 6721: "#security-handling">16.1.8. Handling packages
1.1 grant 6722: with security problems</a></span></dt>
6723:
6724: <dt><span class="sect2"><a href=
1.68 rillig 6725: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 6726: bugs</a></span></dt>
6727:
6728: <dt><span class="sect2"><a href=
1.68 rillig 6729: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 6730: incrementing versions when fixing an existing
1.1 grant 6731: package</a></span></dt>
6732:
6733: <dt><span class="sect2"><a href=
1.68 rillig 6734: "#portability-of-packages">16.1.11. Portability
1.30 wiz 6735: of packages</a></span></dt>
1.1 grant 6736: </dl>
6737: </dd>
6738:
1.30 wiz 6739: <dt><span class="sect1"><a href=
1.68 rillig 6740: "#downloading-issues">16.2. Possible downloading
1.30 wiz 6741: issues</a></span></dt>
1.1 grant 6742:
6743: <dd>
6744: <dl>
6745: <dt><span class="sect2"><a href=
1.68 rillig 6746: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 6747: distfiles aren't available for plain
1.1 grant 6748: downloading</a></span></dt>
6749:
6750: <dt><span class="sect2"><a href=
1.68 rillig 6751: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 6752: handle modified distfiles with the 'old'
6753: name</a></span></dt>
1.1 grant 6754: </dl>
6755: </dd>
6756:
1.30 wiz 6757: <dt><span class="sect1"><a href=
1.68 rillig 6758: "#configuration-gotchas">16.3. Configuration
1.30 wiz 6759: gotchas</a></span></dt>
1.1 grant 6760:
6761: <dd>
6762: <dl>
6763: <dt><span class="sect2"><a href=
1.68 rillig 6764: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 6765: libtool</a></span></dt>
6766:
6767: <dt><span class="sect2"><a href=
1.68 rillig 6768: "#using-libtool">16.3.2. Using libtool on GNU
1.1 grant 6769: packages that already support
6770: libtool</a></span></dt>
6771:
6772: <dt><span class="sect2"><a href=
1.68 rillig 6773: "#autoconf-automake">16.3.3. GNU
1.1 grant 6774: Autoconf/Automake</a></span></dt>
6775: </dl>
6776: </dd>
6777:
1.68 rillig 6778: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 6779: Building the package</a></span></dt>
1.1 grant 6780:
6781: <dd>
6782: <dl>
6783: <dt><span class="sect2"><a href=
1.68 rillig 6784: "#cpp-defines">16.4.1. CPP
1.30 wiz 6785: defines</a></span></dt>
1.51 rillig 6786:
6787: <dt><span class="sect2"><a href=
1.68 rillig 6788: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 6789: defines for some platforms</a></span></dt>
6790:
6791: <dt><span class="sect2"><a href=
1.68 rillig 6792: "#cpp-list">16.4.3. Getting a list of CPP
1.51 rillig 6793: defines</a></span></dt>
1.1 grant 6794: </dl>
6795: </dd>
6796:
1.30 wiz 6797: <dt><span class="sect1"><a href=
1.68 rillig 6798: "#package-specific-actions">16.5. Package specific
1.30 wiz 6799: actions</a></span></dt>
1.1 grant 6800:
6801: <dd>
6802: <dl>
6803: <dt><span class="sect2"><a href=
1.68 rillig 6804: "#user-interaction">16.5.1. User
1.2 hubertf 6805: interaction</a></span></dt>
1.1 grant 6806:
6807: <dt><span class="sect2"><a href=
1.68 rillig 6808: "#handling-licenses">16.5.2. Handling
1.1 grant 6809: licenses</a></span></dt>
6810:
6811: <dt><span class="sect2"><a href=
1.68 rillig 6812: "#installing-score-files">16.5.3. Installing
1.30 wiz 6813: score files</a></span></dt>
1.1 grant 6814:
6815: <dt><span class="sect2"><a href=
1.68 rillig 6816: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 6817: scripts</a></span></dt>
6818:
6819: <dt><span class="sect2"><a href=
1.68 rillig 6820: "#hardcoded-paths">16.5.5. Packages with
1.30 wiz 6821: hardcoded paths to other
6822: interpreters</a></span></dt>
1.1 grant 6823:
6824: <dt><span class="sect2"><a href=
1.68 rillig 6825: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 6826: modules</a></span></dt>
6827:
6828: <dt><span class="sect2"><a href=
1.68 rillig 6829: "#faq.info-files">16.5.7. Packages installing
1.1 grant 6830: info files</a></span></dt>
6831:
6832: <dt><span class="sect2"><a href=
1.68 rillig 6833: "#manpages">16.5.8. Packages installing man
1.57 minskim 6834: pages</a></span></dt>
6835:
6836: <dt><span class="sect2"><a href=
1.68 rillig 6837: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 6838: GConf2 data files</a></span></dt>
1.1 grant 6839:
6840: <dt><span class="sect2"><a href=
1.68 rillig 6841: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 6842: installing scrollkeeper data
6843: files</a></span></dt>
1.1 grant 6844:
6845: <dt><span class="sect2"><a href=
1.68 rillig 6846: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 6847: fonts</a></span></dt>
6848:
6849: <dt><span class="sect2"><a href=
1.68 rillig 6850: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 6851: modules</a></span></dt>
6852:
6853: <dt><span class="sect2"><a href=
1.68 rillig 6854: "#sgml-xml-data">16.5.13. Packages installing
1.30 wiz 6855: SGML or XML data</a></span></dt>
1.1 grant 6856:
6857: <dt><span class="sect2"><a href=
1.68 rillig 6858: "#mime-database">16.5.14. Packages installing
1.1 grant 6859: extensions to the MIME database</a></span></dt>
6860:
6861: <dt><span class="sect2"><a href=
1.68 rillig 6862: "#intltool">16.5.15. Packages using
1.1 grant 6863: intltool</a></span></dt>
1.18 xtraeme 6864:
6865: <dt><span class="sect2"><a href=
1.68 rillig 6866: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 6867: startup scripts</a></span></dt>
1.57 minskim 6868:
6869: <dt><span class="sect2"><a href=
1.68 rillig 6870: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 6871: modules</a></span></dt>
1.1 grant 6872: </dl>
6873: </dd>
6874:
1.30 wiz 6875: <dt><span class="sect1"><a href=
1.68 rillig 6876: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 6877: author</a></span></dt>
1.1 grant 6878: </dl>
6879: </dd>
6880:
1.68 rillig 6881: <dt><span class="chapter"><a href="#debug">17.
1.1 grant 6882: Debugging</a></span></dt>
6883:
1.68 rillig 6884: <dt><span class="chapter"><a href="#submit">18.
1.1 grant 6885: Submitting and Committing</a></span></dt>
6886:
6887: <dd>
6888: <dl>
1.30 wiz 6889: <dt><span class="sect1"><a href=
1.68 rillig 6890: "#submitting-your-package">18.1. Submitting your
1.30 wiz 6891: packages</a></span></dt>
1.1 grant 6892:
1.30 wiz 6893: <dt><span class="sect1"><a href=
1.68 rillig 6894: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 6895: adding, updating, or removing
6896: packages</a></span></dt>
6897:
6898: <dt><span class="sect1"><a href=
1.68 rillig 6899: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 6900: package into CVS</a></span></dt>
1.1 grant 6901:
1.30 wiz 6902: <dt><span class="sect1"><a href=
1.68 rillig 6903: "#updating-package">18.4. Updating a package to a
1.30 wiz 6904: newer version</a></span></dt>
1.1 grant 6905:
1.30 wiz 6906: <dt><span class="sect1"><a href=
1.68 rillig 6907: "#moving-package">18.5. Moving a package in
1.30 wiz 6908: pkgsrc</a></span></dt>
1.1 grant 6909: </dl>
6910: </dd>
1.69 rillig 6911:
1.72 rillig 6912: <dt><span class="chapter"><a href="#devfaq">19.
6913: Frequently Asked Questions</a></span></dt>
1.1 grant 6914: </dl>
6915: </div>
6916:
1.67 hubertf 6917: <div class="chapter" lang="en">
1.1 grant 6918: <div class="titlepage">
6919: <div>
6920: <div>
1.67 hubertf 6921: <h2 class="title"><a name=
1.38 dillo 6922: "components"></a>Chapter 8. Package
1.27 rillig 6923: components - files, directories and contents</h2>
1.25 rillig 6924: </div>
6925: </div>
6926: </div>
6927:
6928: <div class="toc">
6929: <p><b>Table of Contents</b></p>
6930:
6931: <dl>
6932: <dt><span class="sect1"><a href=
1.45 wiz 6933: "#components.Makefile">8.1. <code xmlns=
6934: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6935: "filename">Makefile</code></a></span></dt>
6936:
6937: <dt><span class="sect1"><a href=
1.45 wiz 6938: "#components.distinfo">8.2. <code xmlns=
6939: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6940: "filename">distinfo</code></a></span></dt>
6941:
6942: <dt><span class="sect1"><a href=
1.38 dillo 6943: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6944:
1.30 wiz 6945: <dt><span class="sect1"><a href=
1.38 dillo 6946: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6947: files</a></span></dt>
1.25 rillig 6948:
1.27 rillig 6949: <dt><span class="sect1"><a href=
1.38 dillo 6950: "#components.optional">8.5. Optional
1.27 rillig 6951: files</a></span></dt>
1.25 rillig 6952:
1.38 dillo 6953: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6954: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6955: class="filename">work*</code></a></span></dt>
1.25 rillig 6956:
1.38 dillo 6957: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6958: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6959: class="filename">files/*</code></a></span></dt>
1.25 rillig 6960: </dl>
6961: </div>
6962:
1.27 rillig 6963: <p>Whenever you're preparing a package, there are a number
6964: of files involved which are described in the following
6965: sections.</p>
1.25 rillig 6966:
1.67 hubertf 6967: <div class="sect1" lang="en">
1.25 rillig 6968: <div class="titlepage">
6969: <div>
6970: <div>
6971: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6972: "components.Makefile"></a>8.1. <code xmlns=
6973: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6974: "filename">Makefile</code></h2>
1.25 rillig 6975: </div>
6976: </div>
6977: </div>
6978:
1.27 rillig 6979: <p>Building, installation and creation of a binary
1.45 wiz 6980: package are all controlled by the package's <code xmlns=
6981: "http://www.w3.org/TR/xhtml1/transitional" class=
6982: "filename">Makefile</code>. The <code xmlns=
6983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6984: "filename">Makefile</code> describes various things about
6985: a package, for example from where to get it, how to
6986: configure, build, and install it.</p>
6987:
1.45 wiz 6988: <p>A package <code xmlns=
6989: "http://www.w3.org/TR/xhtml1/transitional" class=
6990: "filename">Makefile</code> contains several sections that
6991: describe the package.</p>
1.25 rillig 6992:
1.27 rillig 6993: <p>In the first section there are the following
6994: variables, which should appear exactly in the order given
6995: here.</p>
1.25 rillig 6996:
6997: <div class="itemizedlist">
6998: <ul type="disc">
6999: <li>
1.27 rillig 7000: <p><code class="varname">DISTNAME</code> is the
7001: basename of the distribution file to be downloaded
7002: from the package's website.</p>
7003: </li>
7004:
7005: <li>
7006: <p><code class="varname">PKGNAME</code> is the name
7007: of the package, as used by pkgsrc. You only need to
1.50 rillig 7008: provide it if it differs from <code class=
7009: "varname">DISTNAME</code>. Usually it is the
7010: directory name together with the version number. It
7011: must match the regular expression <code class=
1.27 rillig 7012: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
7013: that is, it starts with a letter or digit, and
7014: contains only letters, digits, dashes, underscores,
7015: dots and plus signs.</p>
1.25 rillig 7016: </li>
7017:
7018: <li>
1.27 rillig 7019: <p><code class="varname">CATEGORIES</code> is a
7020: list of categories which the package fits in. You
7021: can choose any of the top-level directories of
7022: pkgsrc for it.</p>
1.45 wiz 7023:
7024: <p>Currently the following values are available for
7025: <code class="varname">CATEGORIES</code>. If more
7026: than one is used, they need to be separated by
7027: spaces:</p>
7028: <pre class="programlisting">
1.51 rillig 7029: archivers cross geography meta-pkgs security
7030: audio databases graphics misc shells
7031: benchmarks devel ham multimedia sysutils
7032: biology editors inputmethod net textproc
7033: cad emulators lang news time
7034: chat finance mail parallel wm
7035: comms fonts math pkgtools www
7036: converters games mbone print x11
1.45 wiz 7037: </pre>
1.25 rillig 7038: </li>
7039:
7040: <li>
1.27 rillig 7041: <p><code class="varname">MASTER_SITES</code> is a
7042: list of URLs where the distribution files can be
7043: downloaded. Each URL must end with a slash.</p>
1.45 wiz 7044:
7045: <p>The <code class="varname">MASTER_SITES</code>
7046: may make use of the following predefined sites:</p>
7047: <pre class="programlisting">
1.51 rillig 7048: ${MASTER_SITE_APACHE}
7049: ${MASTER_SITE_BACKUP}
7050: ${MASTER_SITE_CYGWIN}
7051: ${MASTER_SITE_DEBIAN}
7052: ${MASTER_SITE_FREEBSD}
7053: ${MASTER_SITE_FREEBSD_LOCAL}
7054: ${MASTER_SITE_GNOME}
7055: ${MASTER_SITE_GNU}
7056: ${MASTER_SITE_GNUSTEP}
7057: ${MASTER_SITE_IFARCHIVE}
7058: ${MASTER_SITE_MOZILLA}
7059: ${MASTER_SITE_OPENOFFICE}
7060: ${MASTER_SITE_PERL_CPAN}
7061: ${MASTER_SITE_R_CRAN}
7062: ${MASTER_SITE_SOURCEFORGE}
7063: ${MASTER_SITE_SUNSITE}
7064: ${MASTER_SITE_SUSE}
7065: ${MASTER_SITE_TEX_CTAN}
7066: ${MASTER_SITE_XCONTRIB}
7067: ${MASTER_SITE_XEMACS}
1.45 wiz 7068: </pre>
7069:
7070: <p>If one of these predefined sites is chosen, you
7071: may want to specify a subdirectory of that site.
7072: Since these macros may expand to more than one
7073: actual site, you <span class=
7074: "emphasis"><em>must</em></span> use the following
7075: construct to specify a subdirectory:</p>
7076: <pre class="programlisting">
1.51 rillig 7077: ${MASTER_SITE_GNU:=subdirectory/name/}
7078: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 7079: </pre>
7080:
7081: <p>Note the trailing slash after the subdirectory
7082: name.</p>
7083:
7084: <p>If the package has multiple <code class=
7085: "varname">DISTFILES</code> or multiple <code class=
7086: "varname">PATCHFILES</code> from different sites,
1.72 rillig 7087: set <code class="varname">SITES.foo</code> to a
1.47 reed 7088: list of URIs where file “<span class=
1.45 wiz 7089: "quote">foo</span>” may be found.
7090: “<span class="quote">foo</span>”
1.47 reed 7091: includes the suffix, e.g.:</p>
1.45 wiz 7092: <pre class="programlisting">
1.51 rillig 7093: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
7094: DISTFILES+= foo-file.tar.gz
1.72 rillig 7095: SITES.foo-file.tar.gz= \
1.69 rillig 7096: http://www.somewhere.com/somehow/ \
1.51 rillig 7097: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 7098: </pre>
7099: </li>
7100:
7101: <li>
7102: <p><code class="varname">DISTFILES</code>: Name(s)
7103: of archive file(s) containing distribution. The
7104: default is <code xmlns=
7105: "http://www.w3.org/TR/xhtml1/transitional" class=
7106: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
7107: Should only be set if you have more than one
7108: distfile.</p>
7109:
7110: <p>Note that the normal default setting of
7111: <code class="varname">DISTFILES</code> must be made
7112: explicit if you want to add to it (rather than
7113: replace it), as you usually would.</p>
7114: </li>
7115:
7116: <li>
7117: <p><code class="varname">EXTRACT_SUFX</code>:
7118: Suffix of the distribution file, will be appended
7119: to <code class="varname">DISTNAME</code>. Defaults
7120: to <code xmlns=
7121: "http://www.w3.org/TR/xhtml1/transitional" class=
7122: "filename">.tar.gz</code>.</p>
7123: </li>
7124: </ul>
7125: </div>
7126:
7127: <p>The second section contains information about
7128: separately downloaded patches, if any.</p>
7129:
7130: <div class="itemizedlist">
7131: <ul type="disc">
7132: <li>
1.47 reed 7133: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 7134: of additional files that contain distribution
7135: patches. There is no default. pkgsrc will look for
7136: them at <code class="varname">PATCH_SITES</code>.
7137: They will automatically be uncompressed before
7138: patching if the names end with <code xmlns=
7139: "http://www.w3.org/TR/xhtml1/transitional" class=
7140: "filename">.gz</code> or <code xmlns=
7141: "http://www.w3.org/TR/xhtml1/transitional" class=
7142: "filename">.Z</code>.</p>
7143: </li>
7144:
7145: <li>
7146: <p><code class="varname">PATCH_SITES</code>:
7147: Primary location(s) for distribution patch files
7148: (see <code class="varname">PATCHFILES</code> below)
7149: if not found locally.</p>
1.25 rillig 7150: </li>
7151: </ul>
7152: </div>
7153:
1.45 wiz 7154: <p>The third section contains the following
1.27 rillig 7155: variables.</p>
1.25 rillig 7156:
1.27 rillig 7157: <div class="itemizedlist">
7158: <ul type="disc">
7159: <li>
7160: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 7161: email address of the person who feels responsible
7162: for this package, and who is most likely to look at
7163: problems or questions regarding this package which
7164: have been reported with <a href=
1.45 wiz 7165: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
7166: <span class="citerefentry"><span class=
1.50 rillig 7167: "refentrytitle">send-pr</span>(1)</span></a>. Other
7168: developers should contact the <code class=
7169: "varname">MAINTAINER</code> before making major
7170: changes to the package. When packaging a new
7171: program, set <code class=
7172: "varname">MAINTAINER</code> to yourself. If you
7173: really can't maintain the package for future
7174: updates, set it to <code class="email"><<a href=
1.71 wiz 7175: "mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p>
1.27 rillig 7176: </li>
1.25 rillig 7177:
1.27 rillig 7178: <li>
7179: <p><code class="varname">HOMEPAGE</code> is a URL
7180: where users can find more information about the
1.23 wiz 7181: package.</p>
7182: </li>
1.1 grant 7183:
1.23 wiz 7184: <li>
7185: <p><code class="varname">COMMENT</code> is a
1.45 wiz 7186: one-line description of the package (should not
7187: include the package name).</p>
1.23 wiz 7188: </li>
7189: </ul>
7190: </div>
1.1 grant 7191:
1.45 wiz 7192: <p>Other variables that affect the build:</p>
1.1 grant 7193:
1.45 wiz 7194: <div class="itemizedlist">
7195: <ul type="disc">
7196: <li>
7197: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 7198: directory where the interesting distribution files
7199: of the package are found. The default is
7200: <code xmlns=
7201: "http://www.w3.org/TR/xhtml1/transitional" class=
7202: "filename">${WRKDIR}/${DISTNAME}</code>, which
7203: works for most packages.</p>
7204:
7205: <p>If a package doesn't create a subdirectory for
7206: itself (most GNU software does, for instance), but
7207: extracts itself in the current directory, you
7208: should set <code class="varname">WRKSRC=
7209: ${WRKDIR}</code>.</p>
7210:
7211: <p>If a package doesn't create a subdirectory with
7212: the name of <code class="varname">DISTNAME</code>
7213: but some different name, set <code class=
7214: "varname">WRKSRC</code> to point to the proper name
7215: in <code xmlns=
7216: "http://www.w3.org/TR/xhtml1/transitional" class=
7217: "filename">${WRKDIR}</code>, for example
7218: <code class="varname">WRKSRC=
7219: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
7220: "http://www.w3.org/TR/xhtml1/transitional" href=
7221: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
7222: target="_top"><code xmlns="" class=
7223: "filename">lang/tcl</code></a> and <a xmlns=
7224: "http://www.w3.org/TR/xhtml1/transitional" href=
7225: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
7226: target="_top"><code xmlns="" class=
7227: "filename">x11/tk</code></a> for other
7228: examples.</p>
7229:
7230: <p>The name of the working directory created by
7231: pkgsrc is taken from the <code class=
7232: "varname">WRKDIR_BASENAME</code> variable. By
7233: default, its value is <code xmlns=
7234: "http://www.w3.org/TR/xhtml1/transitional" class=
7235: "filename">work</code>. If you want to use the same
7236: pkgsrc tree for building different kinds of binary
7237: packages, you can change the variable according to
7238: your needs. Two other variables handle common cases
7239: of setting <code class=
7240: "varname">WRKDIR_BASENAME</code> individually. If
7241: <code class="varname">OBJHOSTNAME</code> is defined
7242: in <code xmlns=
1.45 wiz 7243: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7244: "filename">/etc/mk.conf</code>, the first component
7245: of the host's name is attached to the directory
7246: name. If <code class="varname">OBJMACHINE</code> is
7247: defined, the platform name is attached, which might
7248: look like <code xmlns=
7249: "http://www.w3.org/TR/xhtml1/transitional" class=
7250: "filename">work.i386</code> or <code xmlns=
1.45 wiz 7251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7252: "filename">work.sparc</code>.</p>
1.45 wiz 7253: </li>
7254: </ul>
1.1 grant 7255: </div>
7256:
7257: <p>Please pay attention to the following gotchas:</p>
7258:
7259: <div class="itemizedlist">
7260: <ul type="disc">
7261: <li>
1.14 xtraeme 7262: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 7263: if man pages are installed in compressed form by
7264: the package; see comment in <code xmlns=
1.45 wiz 7265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7266: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 7267: </li>
7268:
7269: <li>
1.45 wiz 7270: <p>Replace <code xmlns=
7271: "http://www.w3.org/TR/xhtml1/transitional" class=
7272: "filename">/usr/local</code> with
7273: “<span class="quote">${PREFIX}</span>”
7274: in all files (see patches, below).</p>
1.1 grant 7275: </li>
7276:
7277: <li>
7278: <p>If the package installs any info files, see
7279: <a href="#faq.info-files" title=
1.68 rillig 7280: "16.5.7. Packages installing info files">Section 16.5.7,
1.45 wiz 7281: “Packages installing info
1.1 grant 7282: files”</a>.</p>
7283: </li>
7284: </ul>
7285: </div>
7286: </div>
7287:
1.67 hubertf 7288: <div class="sect1" lang="en">
1.1 grant 7289: <div class="titlepage">
7290: <div>
7291: <div>
7292: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7293: "components.distinfo"></a>8.2. <code xmlns=
7294: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7295: "filename">distinfo</code></h2>
1.1 grant 7296: </div>
7297: </div>
7298: </div>
7299:
1.50 rillig 7300: <p>The <code xmlns=
7301: "http://www.w3.org/TR/xhtml1/transitional" class=
7302: "filename">distinfo</code> file contains the message
7303: digest, or checksum, of each distfile needed for the
7304: package. This ensures that the distfiles retrieved from
7305: the Internet have not been corrupted during transfer or
7306: altered by a malign force to introduce a security hole.
7307: Due to recent rumor about weaknesses of digest
7308: algorithms, all distfiles are protected using both SHA1
7309: and RMD160 message digests, as well as the file size.</p>
7310:
7311: <p>The <code xmlns=
7312: "http://www.w3.org/TR/xhtml1/transitional" class=
7313: "filename">distinfo</code> file also contains the
7314: checksums for all the patches found in the <code xmlns=
7315: "http://www.w3.org/TR/xhtml1/transitional" class=
7316: "filename">patches</code> directory (see <a href=
7317: "#components.patches" title=
7318: "8.3. patches/*">Section 8.3,
7319: “patches/*”</a>).</p>
7320:
7321: <p>To regenerate the <code xmlns=
7322: "http://www.w3.org/TR/xhtml1/transitional" class=
7323: "filename">distinfo</code> file, use the
1.14 xtraeme 7324: <span><strong class="command">make
1.50 rillig 7325: makedistinfo</strong></span> or <span><strong class=
7326: "command">make mdi</strong></span> command.</p>
1.1 grant 7327:
1.50 rillig 7328: <p>Some packages have different sets of distfiles
7329: depending on the platform, for example <a xmlns=
1.1 grant 7330: "http://www.w3.org/TR/xhtml1/transitional" href=
7331: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 7332: target="_top"><code xmlns="" class=
7333: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 7334: the same <code xmlns=
1.45 wiz 7335: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 7336: "filename">distinfo</code> file and care should be taken
7337: when upgrading such a package to ensure distfile
7338: information is not lost.</p>
1.1 grant 7339: </div>
7340:
1.67 hubertf 7341: <div class="sect1" lang="en">
1.1 grant 7342: <div class="titlepage">
7343: <div>
7344: <div>
7345: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7346: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 7347: </div>
7348: </div>
7349: </div>
7350:
7351: <p>This directory contains files that are used by the
7352: <a href=
7353: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
7354: <span class="citerefentry"><span class=
7355: "refentrytitle">patch</span>(1)</span></a> command to
7356: modify the sources as distributed in the distribution
7357: file into a form that will compile and run perfectly on
7358: NetBSD. The files are applied successively in alphabetic
7359: order (as returned by a shell “<span class=
7360: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 7361: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7362: class="filename">patch-aa</code> is applied before
7363: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7364: class="filename">patch-ab</code>, etc.</p>
7365:
7366: <p>The <code xmlns=
7367: "http://www.w3.org/TR/xhtml1/transitional" class=
7368: "filename">patch-*</code> files should be in
7369: <span><strong class="command">diff -bu</strong></span>
7370: format, and apply without a fuzz to avoid problems. (To
7371: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 7372: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 7373: not put changes for more than one file into a single
1.47 reed 7374: patch file, as this will make future modifications more
1.1 grant 7375: difficult.</p>
7376:
7377: <p>Similar, a file should be patched at most once, not
7378: several times by several different patches. If a file
7379: needs several patches, they should be combined into one
7380: file.</p>
7381:
7382: <p>One important thing to mention is to pay attention
7383: that no RCS IDs get stored in the patch files, as these
7384: will cause problems when later checked into the NetBSD
1.14 xtraeme 7385: CVS tree. Use the <span><strong class=
7386: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 7387: "http://www.w3.org/TR/xhtml1/transitional" href=
7388: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 7389: target="_top"><code xmlns="" class=
7390: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 7391: these problems.</p>
1.1 grant 7392:
7393: <p>For even more automation, we recommend using
1.14 xtraeme 7394: <span><strong class="command">mkpatches</strong></span>
7395: from the same package to make a whole set of patches. You
7396: just have to backup files before you edit them to
1.45 wiz 7397: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7398: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 7399: <span><strong class="command">cp -p filename
7400: filename.orig</strong></span> or, easier, by using
7401: <span><strong class="command">pkgvi</strong></span> again
7402: from the same package. If you upgrade a package this way,
7403: you can easily compare the new set of patches with the
7404: previously existing one with <span><strong class=
7405: "command">patchdiff</strong></span>.</p>
1.1 grant 7406:
7407: <p>When you have finished a package, remember to generate
7408: the checksums for the patch files by using the
1.14 xtraeme 7409: <span><strong class="command">make
7410: makepatchsum</strong></span> command, see <a href=
7411: "#components.distinfo" title=
1.38 dillo 7412: "8.2. distinfo">Section 8.2,
1.45 wiz 7413: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7414: class="filename">distinfo</code>”</a>.</p>
1.1 grant 7415:
1.46 gdt 7416: <p>When adding a patch that corrects a problem in the
7417: distfile (rather than e.g. enforcing pkgsrc's view of
7418: where man pages should go), send the patch as a bug
7419: report to the maintainer. This benefits non-pkgsrc users
7420: of the package, and usually enables removing the patch in
7421: future version.</p>
7422:
1.1 grant 7423: <p>Patch files that are distributed by the author or
1.14 xtraeme 7424: other maintainers can be listed in <code class=
7425: "varname">$PATCHFILES</code>.</p>
1.1 grant 7426:
7427: <p>If it is desired to store any patches that should not
7428: be committed into pkgsrc, they can be kept outside the
1.45 wiz 7429: pkgsrc tree in the <code xmlns=
7430: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7431: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7432: tree there is expected to have the same
7433: “<span class="quote">category/package</span>”
7434: structure as pkgsrc, and patches are expected to be
1.45 wiz 7435: stored inside these dirs (also known as <code xmlns=
7436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7437: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7438: if you want to keep a private patch for <code xmlns=
1.45 wiz 7439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7440: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7441: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7442: class=
1.14 xtraeme 7443: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7444: files in the named directory are expected to be patch
1.1 grant 7445: files, and <span class="emphasis"><em>they are applied
7446: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7447: </div>
7448:
1.67 hubertf 7449: <div class="sect1" lang="en">
1.27 rillig 7450: <div class="titlepage">
7451: <div>
7452: <div>
7453: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7454: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7455: mandatory files</h2>
7456: </div>
7457: </div>
7458: </div>
7459:
7460: <div class="variablelist">
7461: <dl>
1.45 wiz 7462: <dt><span class="term"><code xmlns=
7463: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7464: "filename">DESCR</code></span></dt>
7465:
7466: <dd>
7467: <p>A multi-line description of the piece of
7468: software. This should include any credits where
7469: they are due. Please bear in mind that others do
7470: not share your sense of humour (or spelling
7471: idiosyncrasies), and that others will read
7472: everything that you write here.</p>
7473: </dd>
7474:
1.45 wiz 7475: <dt><span class="term"><code xmlns=
7476: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7477: "filename">PLIST</code></span></dt>
7478:
7479: <dd>
7480: <p>This file governs the files that are installed
7481: on your system: all the binaries, manual pages,
7482: etc. There are other directives which may be
7483: entered in this file, to control the creation and
7484: deletion of directories, and the location of
7485: inserted files. See <a href="#plist" title=
1.38 dillo 7486: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7487: <i>PLIST issues</i></a> for more information.</p>
7488: </dd>
7489: </dl>
7490: </div>
7491: </div>
7492:
1.67 hubertf 7493: <div class="sect1" lang="en">
1.27 rillig 7494: <div class="titlepage">
7495: <div>
7496: <div>
7497: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7498: "components.optional"></a>8.5. Optional
1.27 rillig 7499: files</h2>
7500: </div>
7501: </div>
7502: </div>
7503:
7504: <div class="variablelist">
7505: <dl>
1.45 wiz 7506: <dt><span class="term"><code xmlns=
7507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7508: "filename">INSTALL</code></span></dt>
7509:
7510: <dd>
7511: <p>This shell script is invoked twice by <a href=
7512: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7513: <span class="citerefentry"><span class=
7514: "refentrytitle">pkg_add</span>(1)</span></a>. First
7515: time after package extraction and before files are
7516: moved in place, the second time after the files to
7517: install are moved in place. This can be used to do
7518: any custom procedures not possible with @exec
1.45 wiz 7519: commands in <code xmlns=
7520: "http://www.w3.org/TR/xhtml1/transitional" class=
7521: "filename">PLIST</code>. See <a href=
1.27 rillig 7522: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7523: <span class="citerefentry"><span class=
7524: "refentrytitle">pkg_add</span>(1)</span></a> and
7525: <a href=
7526: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7527: <span class="citerefentry"><span class=
7528: "refentrytitle">pkg_create</span>(1)</span></a> for
7529: more information.</p>
7530: </dd>
7531:
1.45 wiz 7532: <dt><span class="term"><code xmlns=
7533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7534: "filename">DEINSTALL</code></span></dt>
7535:
7536: <dd>
7537: <p>This script is executed before and after any
7538: files are removed. It is this script's
7539: responsibility to clean up any additional messy
7540: details around the package's installation, since
7541: all pkg_delete knows is how to delete the files
7542: created in the original distribution. See <a href=
7543: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7544: <span class="citerefentry"><span class=
7545: "refentrytitle">pkg_delete</span>(1)</span></a> and
7546: <a href=
7547: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7548: <span class="citerefentry"><span class=
7549: "refentrytitle">pkg_create</span>(1)</span></a> for
7550: more information.</p>
7551: </dd>
7552:
1.45 wiz 7553: <dt><span class="term"><code xmlns=
7554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7555: "filename">MESSAGE</code></span></dt>
7556:
7557: <dd>
1.50 rillig 7558: <p>This file is displayed after installation of the
1.27 rillig 7559: package. Useful for things like legal notices on
7560: almost-free software and hints for updating config
7561: files after installing modules for apache, PHP etc.
7562: Please note that you can modify variables in it
7563: easily by using <code class=
7564: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7565: <code xmlns=
7566: "http://www.w3.org/TR/xhtml1/transitional" class=
7567: "filename">Makefile</code>:</p>
1.27 rillig 7568: <pre class="programlisting">
1.51 rillig 7569: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7570: </pre>
7571:
7572: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7573: "quote">somevalue</span>” in <code xmlns=
7574: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7575: "filename">MESSAGE</code>.</p>
7576: </dd>
7577: </dl>
7578: </div>
7579: </div>
7580:
1.67 hubertf 7581: <div class="sect1" lang="en">
1.27 rillig 7582: <div class="titlepage">
7583: <div>
7584: <div>
7585: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 7586: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7588: "filename">work*</code></h2>
7589: </div>
7590: </div>
7591: </div>
7592:
7593: <p>When you type <span><strong class=
1.47 reed 7594: "command">make</strong></span>, the distribution files
7595: are unpacked into the directory denoted by <code class=
1.45 wiz 7596: "varname">WRKDIR</code>. It can be removed by running
7597: <span><strong class="command">make clean</strong></span>.
7598: Besides the sources, this directory is also used to keep
7599: various timestamp files. The directory gets <span class=
7600: "emphasis"><em>removed completely</em></span> on clean.
7601: The default is <code xmlns=
7602: "http://www.w3.org/TR/xhtml1/transitional" class=
7603: "filename">${.CURDIR}/work</code> or <code xmlns=
7604: "http://www.w3.org/TR/xhtml1/transitional" class=
7605: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7606: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7607: </div>
7608:
1.67 hubertf 7609: <div class="sect1" lang="en">
1.27 rillig 7610: <div class="titlepage">
7611: <div>
7612: <div>
7613: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7614: "files-dir"></a>8.7. <code xmlns=
7615: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7616: "filename">files/*</code></h2>
7617: </div>
7618: </div>
7619: </div>
7620:
7621: <p>If you have any files that you wish to be placed in
7622: the package prior to configuration or building, you could
7623: place these files here and use a “<span class=
7624: "quote">${CP}</span>” command in the
7625: “<span class="quote">pre-configure</span>”
7626: target to achieve this. Alternatively, you could simply
1.45 wiz 7627: diff the file against <code xmlns=
7628: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7629: "filename">/dev/null</code> and use the patch mechanism
7630: to manage the creation of this file.</p>
7631: </div>
7632: </div>
7633:
1.67 hubertf 7634: <div class="chapter" lang="en">
1.27 rillig 7635: <div class="titlepage">
7636: <div>
7637: <div>
1.67 hubertf 7638: <h2 class="title"><a name=
1.38 dillo 7639: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7640: <code xmlns=
7641: "http://www.w3.org/TR/xhtml1/transitional" class=
7642: "filename">Makefile</code>s</h2>
1.27 rillig 7643: </div>
7644: </div>
7645: </div>
7646:
7647: <div class="toc">
7648: <p><b>Table of Contents</b></p>
7649:
7650: <dl>
7651: <dt><span class="sect1"><a href=
1.45 wiz 7652: "#makefile.variables">9.1. <code xmlns=
7653: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7654: "filename">Makefile</code> variables</a></span></dt>
7655:
7656: <dd>
7657: <dl>
7658: <dt><span class="sect2"><a href=
1.38 dillo 7659: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7660: conventions</a></span></dt>
7661: </dl>
7662: </dd>
7663:
1.38 dillo 7664: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7665: Code snippets</a></span></dt>
7666:
7667: <dd>
7668: <dl>
1.30 wiz 7669: <dt><span class="sect2"><a href=
1.38 dillo 7670: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7671: list</a></span></dt>
1.27 rillig 7672:
1.30 wiz 7673: <dt><span class="sect2"><a href=
1.38 dillo 7674: "#converting-internal-to-external">9.2.2.
1.27 rillig 7675: Converting an internal list into an external
7676: list</a></span></dt>
7677:
1.30 wiz 7678: <dt><span class="sect2"><a href=
1.38 dillo 7679: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7680: variables to a shell command</a></span></dt>
1.27 rillig 7681:
1.30 wiz 7682: <dt><span class="sect2"><a href=
1.38 dillo 7683: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7684: guideline</a></span></dt>
1.27 rillig 7685:
1.30 wiz 7686: <dt><span class="sect2"><a href=
1.38 dillo 7687: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7688: bug in BSD Make</a></span></dt>
1.27 rillig 7689: </dl>
7690: </dd>
7691: </dl>
7692: </div>
7693:
1.45 wiz 7694: <p>Pkgsrc consists of many <code xmlns=
7695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7696: "filename">Makefile</code> fragments, each of which forms a
7697: well-defined part of the pkgsrc system. Using the <a href=
7698: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7699: <span class="citerefentry"><span class=
7700: "refentrytitle">make</span>(1)</span></a> system as a
7701: programming language for a big system like pkgsrc requires
7702: some discipline to keep the code correct and
7703: understandable.</p>
7704:
1.45 wiz 7705: <p>The basic ingredients for <code xmlns=
7706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7707: "filename">Makefile</code> programming are variables (which
7708: are actually macros) and shell commands. Among these shell
7709: commands may even be more complex ones like <a href=
7710: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7711: <span class="citerefentry"><span class=
7712: "refentrytitle">awk</span>(1)</span></a> programs. To make
7713: sure that every shell command runs as intended it is
7714: necessary to quote all variables correctly when they are
7715: used.</p>
7716:
7717: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7718: often in <code xmlns=
7719: "http://www.w3.org/TR/xhtml1/transitional" class=
7720: "filename">Makefile</code>s, including the pitfalls that
7721: come along with them.</p>
1.27 rillig 7722:
1.67 hubertf 7723: <div class="sect1" lang="en">
1.27 rillig 7724: <div class="titlepage">
7725: <div>
7726: <div>
7727: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7728: "makefile.variables"></a>9.1. <code xmlns=
7729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7730: "filename">Makefile</code> variables</h2>
7731: </div>
7732: </div>
7733: </div>
7734:
1.45 wiz 7735: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7736: class="filename">Makefile</code> variables contain
7737: strings that can be processed using the five operators
7738: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7739: described in the <a href=
1.27 rillig 7740: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7741: <span class="citerefentry"><span class=
7742: "refentrytitle">make</span>(1)</span></a> man page.</p>
7743:
1.45 wiz 7744: <p>When a variable's value is parsed from a <code xmlns=
7745: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7746: "filename">Makefile</code>, the hash character ``#'' and
7747: the backslash character ``\'' are handled specially. If a
7748: backslash is followed by a newline, any whitespace
7749: immediately in front of the backslash, the backslash, the
7750: newline, and any whitespace immediately behind the
7751: newline are replaced with a single space. A backspace
7752: character and an immediately following hash character are
1.47 reed 7753: replaced with a single hash character. Otherwise, the
1.27 rillig 7754: backslash is passed as is. In a variable assignment, any
7755: hash character that is not preceded by a backslash starts
7756: a comment that continues upto the end of the logical
7757: line.</p>
7758:
7759: <p><span class="emphasis"><em>Note:</em></span> Because
7760: of this parsing algorithm the only way to create a
7761: variable consisting of a single backslash is using the
7762: ``!='' operator, for example: <code class=
7763: "varname">BACKSLASH!=echo "\\"</code>.</p>
7764:
7765: <p>So far for defining variables. The other thing you can
7766: do with variables is evaluating them. A variable is
7767: evaluated when it is part of the right side of the ``:=''
7768: or the ``!='' operator, or directly before executing a
7769: shell command which the variable is part of. In all other
1.47 reed 7770: cases, <a href=
1.27 rillig 7771: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7772: <span class="citerefentry"><span class=
7773: "refentrytitle">make</span>(1)</span></a> performs lazy
7774: evaluation, that is, variables are not evaluated until
7775: there's no other way. The ``modifiers'' mentioned in the
7776: man page also evaluate the variable.</p>
7777:
7778: <p>Some of the modifiers split the string into words and
7779: then operate on the words, others operate on the string
1.47 reed 7780: as a whole. When a string is split into words, it is
7781: split as you would expect it from <a href=
1.27 rillig 7782: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7783: <span class="citerefentry"><span class=
7784: "refentrytitle">sh</span>(1)</span></a>.</p>
7785:
7786: <p>No rule without exception—the
7787: <span><strong class="command">.for</strong></span> loop
7788: does not follow the shell quoting rules but splits at
7789: sequences of whitespace.</p>
7790:
7791: <p>There are several types of variables that should be
7792: handled differently. Strings and two types of lists.</p>
7793:
7794: <div class="itemizedlist">
7795: <ul type="disc">
7796: <li>
7797: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7798: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7799: should restrict yourself to only using printable
7800: characters. Examples are <code class=
7801: "varname">PREFIX</code> and <code class=
7802: "varname">COMMENT</code>.</p>
7803: </li>
7804:
7805: <li>
7806: <p><span class="emphasis"><em>Internal
7807: lists</em></span> are lists that are never exported
7808: to any shell command. Their elements are separated
1.47 reed 7809: by whitespace. Therefore, the elements themselves
1.27 rillig 7810: cannot have embedded whitespace. Any other
7811: characters are allowed. Internal lists can be used
7812: in <span><strong class=
7813: "command">.for</strong></span> loops. Examples are
7814: <code class="varname">DEPENDS</code> and
7815: <code class="varname">BUILD_DEPENDS</code>.</p>
7816: </li>
7817:
7818: <li>
7819: <p><span class="emphasis"><em>External
7820: lists</em></span> are lists that may be exported to
7821: a shell command. Their elements can contain any
7822: characters, including whitespace. That's why they
7823: cannot be used in <span><strong class=
7824: "command">.for</strong></span> loops. Examples are
7825: <code class="varname">DISTFILES</code> and
7826: <code class="varname">MASTER_SITES</code>.</p>
7827: </li>
7828: </ul>
7829: </div>
7830:
1.67 hubertf 7831: <div class="sect2" lang="en">
1.27 rillig 7832: <div class="titlepage">
7833: <div>
7834: <div>
7835: <h3 class="title"><a name=
1.38 dillo 7836: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7837: conventions</h3>
7838: </div>
7839: </div>
7840: </div>
7841:
7842: <div class="itemizedlist">
7843: <ul type="disc">
7844: <li>
7845: <p>All variable names starting with an underscore
7846: are reserved for use by the pkgsrc
7847: infrastructure. They shall not be used by package
1.45 wiz 7848: <code xmlns=
7849: "http://www.w3.org/TR/xhtml1/transitional" class=
7850: "filename">Makefile</code>s.</p>
1.27 rillig 7851: </li>
7852:
7853: <li>
7854: <p>In <span><strong class=
7855: "command">.for</strong></span> loops you should
7856: use lowercase variable names for the iteration
7857: variables.</p>
7858: </li>
7859:
7860: <li>
7861: <p>All list variables should have a ``plural''
7862: name, e.g. <code class=
7863: "varname">PKG_OPTIONS</code> or <code class=
7864: "varname">DISTFILES</code>.</p>
7865: </li>
7866: </ul>
7867: </div>
7868: </div>
7869: </div>
7870:
1.67 hubertf 7871: <div class="sect1" lang="en">
1.27 rillig 7872: <div class="titlepage">
7873: <div>
7874: <div>
7875: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7876: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7877: </div>
7878: </div>
7879: </div>
7880:
7881: <p>This section presents you with some code snippets you
7882: should use in your own code. If you don't find anything
7883: appropriate here, you should test your code and add it
7884: here.</p>
7885:
1.67 hubertf 7886: <div class="sect2" lang="en">
1.27 rillig 7887: <div class="titlepage">
7888: <div>
7889: <div>
1.67 hubertf 7890: <h3 class="title"><a name=
1.38 dillo 7891: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7892: a list</h3>
1.27 rillig 7893: </div>
7894: </div>
7895: </div>
7896: <pre class="programlisting">
1.51 rillig 7897: STRING= foo * bar `date`
7898: INT_LIST= # empty
7899: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7900: EXT_LIST= # empty
7901: ANOTHER_EXT_LIST= a=b c=d
7902:
7903: INT_LIST+= ${STRING} # 1
7904: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7905: EXT_LIST+= ${STRING:Q} # 3
7906: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7907: </pre>
7908:
7909: <p>When you add a string to an external list (example
7910: 3), it must be quoted. In all other cases, you must not
7911: add a quoting level. You must not merge internal and
7912: external lists, unless you are sure that all entries
7913: are correctly interpreted in both lists.</p>
7914: </div>
7915:
1.67 hubertf 7916: <div class="sect2" lang="en">
1.27 rillig 7917: <div class="titlepage">
7918: <div>
7919: <div>
1.30 wiz 7920: <h3 class="title"><a name=
1.38 dillo 7921: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7922: an internal list into an external list</h3>
1.27 rillig 7923: </div>
7924: </div>
7925: </div>
7926: <pre class="programlisting">
1.51 rillig 7927: EXT_LIST= # empty
7928: .for i in ${INT_LIST}
7929: EXT_LIST+= ${i:Q}""
7930: .endfor
1.27 rillig 7931: </pre>
7932:
7933: <p>This code converts the internal list <code class=
7934: "varname">INT_LIST</code> into the external list
7935: <code class="varname">EXT_LIST</code>. As the elements
7936: of an internal list are unquoted they must be quoted
7937: here. The reason for appending <code class=
7938: "varname">""</code> is explained below.</p>
7939: </div>
1.1 grant 7940:
1.67 hubertf 7941: <div class="sect2" lang="en">
1.27 rillig 7942: <div class="titlepage">
1.1 grant 7943: <div>
1.27 rillig 7944: <div>
1.30 wiz 7945: <h3 class="title"><a name=
1.38 dillo 7946: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7947: variables to a shell command</h3>
1.27 rillig 7948: </div>
1.1 grant 7949: </div>
7950: </div>
1.27 rillig 7951: <pre class="programlisting">
1.51 rillig 7952: STRING= foo bar < > * `date` $$HOME ' "
7953: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7954:
1.51 rillig 7955: all:
7956: echo ${STRING} # 1
7957: echo "${STRING}" # 2
7958: echo "${STRING:Q}" # 3
7959: echo ${STRING:Q} # 4
7960: echo x${STRING:Q} | sed 1s,.,, # 5
7961: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7962: </pre>
7963:
7964: <p>Example 1 leads to a syntax error in the shell, as
7965: the characters are just copied.</p>
7966:
7967: <p>Example 2 leads to a syntax error too, and if you
7968: leave out the last " character from <code class=
7969: "varname">${STRING}</code>, <a href=
7970: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7971: <span class="citerefentry"><span class=
7972: "refentrytitle">date</span>(1)</span></a> will be
7973: executed. The <code class="varname">$HOME</code> shell
7974: variable would be evaluated, too.</p>
7975:
7976: <p>Example 3 outputs each space character preceded by a
7977: backslash (or not), depending on the implementation of
7978: the <a href=
7979: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7980: <span class="citerefentry"><span class=
7981: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7982:
1.27 rillig 7983: <p>Example 4 handles correctly every string that does
7984: not start with a dash. In that case, the result depends
7985: on the implementation of the <a href=
7986: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7987: <span class="citerefentry"><span class=
7988: "refentrytitle">echo</span>(1)</span></a> command. As
7989: long as you can guarantee that your input does not
1.47 reed 7990: start with a dash, this form is appropriate.</p>
1.1 grant 7991:
1.27 rillig 7992: <p>Example 5 handles even the case of a leading dash
7993: correctly.</p>
1.1 grant 7994:
1.27 rillig 7995: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7996: need to be quoted because the quoting has already been
1.27 rillig 7997: done when adding elements to the list.</p>
1.1 grant 7998:
1.27 rillig 7999: <p>As internal lists shall not be passed to the shell,
8000: there is no example for it.</p>
1.1 grant 8001: </div>
8002:
1.67 hubertf 8003: <div class="sect2" lang="en">
1.27 rillig 8004: <div class="titlepage">
1.1 grant 8005: <div>
1.27 rillig 8006: <div>
1.67 hubertf 8007: <h3 class="title"><a name=
1.38 dillo 8008: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 8009: guideline</h3>
8010: </div>
1.1 grant 8011: </div>
8012: </div>
8013:
1.27 rillig 8014: <p>There are many possible sources of wrongly quoted
8015: variables. This section lists some of the commonly
8016: known ones.</p>
1.1 grant 8017:
1.27 rillig 8018: <div class="itemizedlist">
8019: <ul type="disc">
8020: <li>
8021: <p>Whenever you use the value of a list, think
8022: about what happens to leading or trailing
8023: whitespace. If the list is a well-formed shell
1.47 reed 8024: expression, you can apply the <code class=
1.27 rillig 8025: "varname">:M*</code> modifier to strip leading
8026: and trailing whitespace from each word. The
8027: <code class="varname">:M</code> operator first
8028: splits its argument according to the rules of the
8029: shell, and then creates a new list consisting of
8030: all words that match the shell glob expression
8031: <code class="varname">*</code>, that is: all. One
8032: class of situations where this is needed is when
8033: adding a variable like <code class=
8034: "varname">CPPFLAGS</code> to <code class=
8035: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 8036: script invokes other configure scripts, it strips
1.27 rillig 8037: the leading and trailing whitespace from the
8038: variable and then passes it to the other
8039: configure scripts. But these configure scripts
8040: expect the (child) <code class=
8041: "varname">CPPFLAGS</code> variable to be the same
8042: as the parent <code class=
8043: "varname">CPPFLAGS</code>. That's why we better
8044: pass the <code class="varname">CPPFLAGS</code>
8045: value properly trimmed. And here is how we do
8046: it:</p>
8047: <pre class="programlisting">
1.51 rillig 8048: CPPFLAGS= # empty
8049: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
8050: CPPFLAGS+= ${MY_CPPFLAGS}
8051:
8052: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
8053:
8054: all:
8055: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
8056: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 8057: </pre>
8058: </li>
1.1 grant 8059:
1.27 rillig 8060: <li>
8061: <p>The example above contains one bug: The
8062: <code class="varname">${PREFIX}</code> is a
8063: properly quoted shell expression, but there is
8064: the C compiler after it, which also expects a
8065: properly quoted string (this time in C syntax).
8066: The version above is therefore only correct if
8067: <code class="varname">${PREFIX}</code> does not
8068: have embedded backslashes or double quotes. If
8069: you want to allow these, you have to add another
8070: layer of quoting to each variable that is used as
8071: a C string literal. You cannot use the
8072: <code class="varname">:Q</code> operator for it,
8073: as this operator only works for the shell.</p>
8074: </li>
1.1 grant 8075:
1.27 rillig 8076: <li>
1.47 reed 8077: <p>Whenever a variable can be empty, the
1.27 rillig 8078: <code class="varname">:Q</code> operator can have
8079: surprising results. Here are two completely
8080: different cases which can be solved with the same
8081: trick.</p>
8082: <pre class="programlisting">
1.51 rillig 8083: EMPTY= # empty
8084: empty_test:
8085: for i in a ${EMPTY:Q} c; do \
8086: echo "$$i"; \
8087: done
8088:
8089: for_test:
8090: .for i in a:\ a:\test.txt
8091: echo ${i:Q}
8092: echo "foo"
8093: .endfor
1.1 grant 8094: </pre>
8095:
1.27 rillig 8096: <p>The first example will only print two of the
8097: three lines we might have expected. This is
8098: because <code class="varname">${EMPTY:Q}</code>
8099: expands to the empty string, which the shell
8100: cannot see. The workaround is to write
8101: <code class="varname">${EMPTY:Q}""</code>. This
8102: pattern can be often found as <code class=
8103: "varname">${TEST} -z ${VAR:Q}</code> or as
8104: <code class="varname">${TEST} -f
8105: ${FNAME:Q}</code> (both of these are wrong).</p>
8106:
8107: <p>The second example will only print three lines
8108: instead of four. The first line looks like
8109: <code class="varname">a:\ echo foo</code>. This
8110: is because the backslash of the value
8111: <code class="varname">a:\</code> is interpreted
8112: as a line-continuation by <a href=
8113: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8114: <span class="citerefentry"><span class=
8115: "refentrytitle">make</span>(1)</span></a>, which
8116: makes the second line the arguments of the
8117: <a href=
8118: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
8119: <span class="citerefentry"><span class=
8120: "refentrytitle">echo</span>(1)</span></a> command
8121: from the first line. To avoid this, write
8122: <code class="varname">${i:Q}""</code>.</p>
8123: </li>
8124: </ul>
8125: </div>
1.1 grant 8126: </div>
8127:
1.67 hubertf 8128: <div class="sect2" lang="en">
1.27 rillig 8129: <div class="titlepage">
1.1 grant 8130: <div>
1.27 rillig 8131: <div>
1.30 wiz 8132: <h3 class="title"><a name=
1.38 dillo 8133: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 8134: for a bug in BSD Make</h3>
1.27 rillig 8135: </div>
1.1 grant 8136: </div>
8137: </div>
8138:
1.27 rillig 8139: <p>The pkgsrc bmake program does not handle the
8140: following assignment correctly. In case <code class=
8141: "varname">_othervar_</code> contains a ``-'' character,
8142: one of the closing braces is included in <code class=
8143: "varname">${VAR}</code> after this code executes.</p>
8144: <pre class="programlisting">
1.51 rillig 8145: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 8146: </pre>
8147:
1.27 rillig 8148: <p>For a more complex code snippet and a workaround,
8149: see the package <a xmlns=
8150: "http://www.w3.org/TR/xhtml1/transitional" href=
8151: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 8152: target="_top"><code xmlns="" class=
8153: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 8154: <code class="varname">bug1</code>.</p>
1.1 grant 8155: </div>
8156: </div>
8157: </div>
8158:
1.67 hubertf 8159: <div class="chapter" lang="en">
1.1 grant 8160: <div class="titlepage">
8161: <div>
8162: <div>
1.67 hubertf 8163: <h2 class="title"><a name=
1.38 dillo 8164: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 8165: </div>
8166: </div>
8167: </div>
8168:
8169: <div class="toc">
8170: <p><b>Table of Contents</b></p>
8171:
8172: <dl>
1.38 dillo 8173: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 8174: ID</a></span></dt>
8175:
1.30 wiz 8176: <dt><span class="sect1"><a href=
1.38 dillo 8177: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 8178: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8179: class="filename">PLIST</code>
1.14 xtraeme 8180: generation</a></span></dt>
1.1 grant 8181:
1.38 dillo 8182: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 8183: Tweaking output of <span><strong class="command">make
8184: print-PLIST</strong></span></a></span></dt>
1.1 grant 8185:
1.38 dillo 8186: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 8187: Variable substitution in PLIST</a></span></dt>
8188:
1.30 wiz 8189: <dt><span class="sect1"><a href=
1.48 dillo 8190: "#manpage-compression">10.5. Man page
8191: compression</a></span></dt>
1.1 grant 8192:
1.38 dillo 8193: <dt><span class="sect1"><a href=
8194: "#using-PLIST_SRC">10.6. Changing PLIST source with
8195: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 8196:
1.30 wiz 8197: <dt><span class="sect1"><a href=
1.47 reed 8198: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 8199: differing PLISTs</a></span></dt>
1.1 grant 8200:
1.38 dillo 8201: <dt><span class="sect1"><a href=
8202: "#faq.common-dirs">10.8. Sharing directories between
8203: packages</a></span></dt>
1.1 grant 8204: </dl>
8205: </div>
8206:
1.45 wiz 8207: <p>The <code xmlns=
8208: "http://www.w3.org/TR/xhtml1/transitional" class=
8209: "filename">PLIST</code> file contains a package's
8210: “<span class="quote">packing list</span>”, i.e.
8211: a list of files that belong to the package (relative to the
8212: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8213: class="filename">${PREFIX}</code> directory it's been
8214: installed in) plus some additional statements - see the
8215: <a href=
1.1 grant 8216: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
8217: <span class="citerefentry"><span class=
1.47 reed 8218: "refentrytitle">pkg_create</span>(1)</span></a> man page
8219: for a full list. This chapter addresses some issues that
8220: need attention when dealing with the <code xmlns=
1.45 wiz 8221: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8222: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 8223:
1.67 hubertf 8224: <div class="sect1" lang="en">
1.1 grant 8225: <div class="titlepage">
8226: <div>
8227: <div>
8228: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 8229: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 8230: </div>
8231: </div>
8232: </div>
8233:
8234: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 8235: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8236: class="filename">PLIST</code> file you write:</p>
1.1 grant 8237: <pre class="programlisting">
1.51 rillig 8238: @comment $NetBSD$
1.1 grant 8239: </pre>
8240: </div>
8241:
1.67 hubertf 8242: <div class="sect1" lang="en">
1.1 grant 8243: <div class="titlepage">
8244: <div>
8245: <div>
8246: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8247: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 8248: <code xmlns=
8249: "http://www.w3.org/TR/xhtml1/transitional" class=
8250: "filename">PLIST</code> generation</h2>
1.1 grant 8251: </div>
8252: </div>
8253: </div>
8254:
1.14 xtraeme 8255: <p>You can use the <span><strong class="command">make
8256: print-PLIST</strong></span> command to output a PLIST
8257: that matches any new files since the package was
8258: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 8259: "14.16. Other helpful targets">Section 14.16,
1.1 grant 8260: “Other helpful targets”</a> for more
8261: information on this target.</p>
8262: </div>
8263:
1.67 hubertf 8264: <div class="sect1" lang="en">
1.1 grant 8265: <div class="titlepage">
8266: <div>
8267: <div>
8268: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8269: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 8270: <span><strong class="command">make
8271: print-PLIST</strong></span></h2>
1.1 grant 8272: </div>
8273: </div>
8274: </div>
8275:
8276: <p>If you have used any of the *-dirs packages, as
8277: explained in <a href="#faq.common-dirs" title=
1.38 dillo 8278: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 8279: “Sharing directories between packages”</a>,
1.14 xtraeme 8280: you may have noticed that <span><strong class=
8281: "command">make print-PLIST</strong></span> outputs a set
8282: of <code class="varname">@comment</code>s instead of real
8283: <code class="varname">@dirrm</code> lines. You can also
8284: do this for specific directories and files, so that the
8285: results of that command are very close to reality. This
8286: helps <span class="emphasis"><em>a lot</em></span> during
8287: the update of packages.</p>
8288:
8289: <p>The <code class="varname">PRINT_PLIST_AWK</code>
8290: variable takes a set of AWK patterns and actions that are
8291: used to filter the output of print-PLIST. You can
8292: <span class="emphasis"><em>append</em></span> any chunk
8293: of AWK scripting you like to it, but be careful with
1.1 grant 8294: quoting.</p>
8295:
1.45 wiz 8296: <p>For example, to get all files inside the <code xmlns=
8297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8298: "filename">libdata/foo</code> directory removed from the
1.1 grant 8299: resulting PLIST:</p>
8300: <pre class="programlisting">
1.51 rillig 8301: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 8302: </pre>
8303:
1.14 xtraeme 8304: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 8305: lines referring to a specific (shared) directory
1.14 xtraeme 8306: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 8307: <pre class="programlisting">
1.51 rillig 8308: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 8309: </pre>
8310: </div>
8311:
1.67 hubertf 8312: <div class="sect1" lang="en">
1.1 grant 8313: <div class="titlepage">
8314: <div>
8315: <div>
8316: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8317: "plist.misc"></a>10.4. Variable substitution
8318: in PLIST</h2>
1.1 grant 8319: </div>
8320: </div>
8321: </div>
8322:
8323: <p>A number of variables are substituted automatically in
8324: PLISTs when a package is installed on a system. This
8325: includes the following variables:</p>
8326:
8327: <div class="variablelist">
8328: <dl>
1.14 xtraeme 8329: <dt><span class="term"><code class=
8330: "varname">${MACHINE_ARCH}</code>, <code class=
8331: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 8332:
8333: <dd>
8334: <p>Some packages like emacs and perl embed
8335: information about which architecture they were
8336: built on into the pathnames where they install
1.47 reed 8337: their files. To handle this case, PLIST will be
1.1 grant 8338: preprocessed before actually used, and the symbol
1.14 xtraeme 8339: “<span class="quote"><code class=
8340: "varname">${MACHINE_ARCH}</code></span>” will
8341: be replaced by what <span><strong class=
8342: "command">uname -p</strong></span> gives. The same
8343: is done if the string <code class=
8344: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
8345: PLIST somewhere - use this on packages that have
1.47 reed 8346: GNU autoconf-created configure scripts.</p>
1.1 grant 8347:
8348: <div class="note" style=
8349: "margin-left: 0.5in; margin-right: 0.5in;">
8350: <h3 class="title">Legacy note</h3>
8351:
8352: <p>There used to be a symbol “<span class=
1.14 xtraeme 8353: "quote"><code class=
8354: "varname">$ARCH</code></span>” that was
8355: replaced by the output of <span><strong class=
8356: "command">uname -m</strong></span>, but that's no
1.1 grant 8357: longer supported and has been removed.</p>
8358: </div>
8359: </dd>
8360:
1.14 xtraeme 8361: <dt><span class="term"><code class=
8362: "varname">${OPSYS}</code>, <code class=
8363: "varname">${LOWER_OPSYS}</code>, <code class=
8364: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 8365:
8366: <dd>
8367: <p>Some packages want to embed the OS name and
8368: version into some paths. To do this, use these
1.45 wiz 8369: variables in the <code xmlns=
8370: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8371: "filename">PLIST</code>:</p>
1.1 grant 8372:
8373: <div class="itemizedlist">
8374: <ul type="disc">
8375: <li>
1.14 xtraeme 8376: <p><code class="varname">${OPSYS}</code> -
8377: output of “<span class=
8378: "quote"><span><strong class="command">uname
8379: -s</strong></span></span>”</p>
1.1 grant 8380: </li>
8381:
8382: <li>
1.14 xtraeme 8383: <p><code class=
8384: "varname">${LOWER_OPSYS}</code> - lowercase
8385: common name (eg. “<span class=
8386: "quote">solaris</span>”)</p>
1.1 grant 8387: </li>
8388:
8389: <li>
1.14 xtraeme 8390: <p><code class="varname">${OS_VERSION}</code>
8391: - “<span class=
8392: "quote"><span><strong class="command">uname
8393: -r</strong></span></span>”</p>
1.1 grant 8394: </li>
8395: </ul>
8396: </div>
8397: </dd>
8398: </dl>
8399: </div>
8400:
8401: <p>For a complete list of values which are replaced by
1.45 wiz 8402: default, please look in <code xmlns=
8403: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8404: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 8405: "emphasis"><em>PLIST_SUBST</em></span>).</p>
8406:
8407: <p>If you want to change other variables not listed
8408: above, you can add variables and their expansions to this
1.14 xtraeme 8409: variable in the following way, similar to <code class=
8410: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 8411: "#components.optional" title=
1.38 dillo 8412: "8.5. Optional files">Section 8.5,
1.1 grant 8413: “Optional files”</a>):</p>
8414: <pre class="programlisting">
1.51 rillig 8415: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8416: </pre>
8417:
8418: <p>This replaces all occurrences of “<span class=
8419: "quote">${SOMEVAR}</span>” in the PLIST with
8420: “<span class="quote">somevalue</span>”.</p>
8421: </div>
8422:
1.67 hubertf 8423: <div class="sect1" lang="en">
1.1 grant 8424: <div class="titlepage">
8425: <div>
8426: <div>
8427: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8428: "manpage-compression"></a>10.5. Man page
8429: compression</h2>
1.1 grant 8430: </div>
8431: </div>
8432: </div>
8433:
1.47 reed 8434: <p>Man pages should be installed in compressed form if
1.45 wiz 8435: <code class="varname">MANZ</code> is set (in <code xmlns=
8436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8437: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8438: otherwise. To handle this in the <code xmlns=
8439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8440: "filename">PLIST</code> file, the suffix
8441: “<span class="quote">.gz</span>” is
1.47 reed 8442: appended/removed automatically for man pages according to
1.14 xtraeme 8443: <code class="varname">MANZ</code> and <code class=
8444: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8445: above for details. This modification of the <code xmlns=
8446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8447: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8448: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8449: class="filename">PLIST</code> itself.</p>
1.1 grant 8450: </div>
8451:
1.67 hubertf 8452: <div class="sect1" lang="en">
1.1 grant 8453: <div class="titlepage">
8454: <div>
8455: <div>
8456: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8457: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8458: source with <code class=
1.14 xtraeme 8459: "varname">PLIST_SRC</code></h2>
1.1 grant 8460: </div>
8461: </div>
8462: </div>
8463:
1.14 xtraeme 8464: <p>To use one or more files as source for the
1.45 wiz 8465: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8466: class="filename">PLIST</code> used in generating the
8467: binary package, set the variable <code class=
1.14 xtraeme 8468: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8469: The files are later concatenated using <a href=
8470: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8471: <span class="citerefentry"><span class=
8472: "refentrytitle">cat</span>(1)</span></a>, and order of
8473: things is important.</p>
1.1 grant 8474: </div>
8475:
1.67 hubertf 8476: <div class="sect1" lang="en">
1.1 grant 8477: <div class="titlepage">
8478: <div>
8479: <div>
8480: <h2 class="title" style="clear: both"><a name=
1.47 reed 8481: "platform-specific-plist"></a>10.7. Platform-specific
8482: and differing PLISTs</h2>
1.1 grant 8483: </div>
8484: </div>
8485: </div>
8486:
8487: <p>Some packages decide to install a different set of
8488: files based on the operating system being used. These
8489: differences can be automatically handled by using the
8490: following files:</p>
8491:
8492: <div class="itemizedlist">
8493: <ul type="disc">
8494: <li>
1.45 wiz 8495: <p><code xmlns=
8496: "http://www.w3.org/TR/xhtml1/transitional" class=
8497: "filename">PLIST.common</code></p>
1.1 grant 8498: </li>
8499:
8500: <li>
1.45 wiz 8501: <p><code xmlns=
8502: "http://www.w3.org/TR/xhtml1/transitional" class=
8503: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8504: </li>
8505:
8506: <li>
1.45 wiz 8507: <p><code xmlns=
8508: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8509: "filename">PLIST.${MACHINE_ARCH}</code></p>
8510: </li>
8511:
8512: <li>
1.45 wiz 8513: <p><code xmlns=
8514: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8515: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8516: </li>
8517:
8518: <li>
1.45 wiz 8519: <p><code xmlns=
8520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8521: "filename">PLIST.common_end</code></p>
1.1 grant 8522: </li>
8523: </ul>
8524: </div>
8525: </div>
8526:
1.67 hubertf 8527: <div class="sect1" lang="en">
1.1 grant 8528: <div class="titlepage">
8529: <div>
8530: <div>
8531: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8532: "faq.common-dirs"></a>10.8. Sharing
8533: directories between packages</h2>
1.1 grant 8534: </div>
8535: </div>
8536: </div>
8537:
8538: <p>A “<span class="quote">shared
8539: directory</span>” is a directory where multiple
8540: (and unrelated) packages install files. These directories
8541: are problematic because you have to add special tricks in
8542: the PLIST to conditionally remove them, or have some
8543: centralized package handle them.</p>
8544:
8545: <p>Within pkgsrc, you'll find both approaches. If a
8546: directory is shared by a few unrelated packages, it's
8547: often not worth to add an extra package to remove it.
8548: Therefore, one simply does:</p>
8549: <pre class="programlisting">
1.51 rillig 8550: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8551: </pre>
8552:
8553: <p>in the PLISTs of all affected packages, instead of the
8554: regular "@dirrm" line.</p>
8555:
8556: <p>However, if the directory is shared across many
8557: packages, two different solutions are available:</p>
8558:
8559: <div class="orderedlist">
8560: <ol type="1">
8561: <li>
8562: <p>If the packages have a common dependency, the
8563: directory can be removed in that. For example, see
8564: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8565: href=
8566: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8567: target="_top"><code xmlns="" class=
8568: "filename">textproc/scrollkeeper</code></a>, which
8569: removes the shared directory <code xmlns=
8570: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8571: "filename">share/omf</code>.</p>
1.1 grant 8572: </li>
8573:
8574: <li>
8575: <p>If the packages using the directory are not
8576: related at all (they have no common dependencies),
8577: a *-dirs package is used.</p>
8578: </li>
8579: </ol>
8580: </div>
8581:
8582: <p>From now on, we'll discuss the second solution. To get
8583: an idea of the *-dirs packages available, issue:</p>
8584: <pre class="programlisting">
1.51 rillig 8585: <code class="prompt">%</code> cd .../pkgsrc
8586: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8587: </pre>
8588:
8589: <p>Their use from other packages is very simple. The
1.14 xtraeme 8590: <code class="varname">USE_DIRS</code> variable takes a
8591: list of package names (without the “<span class=
1.1 grant 8592: "quote">-dirs</span>” part) together with the
8593: required version number (always pick the latest one when
1.34 wiz 8594: writing new packages).</p>
1.1 grant 8595:
8596: <p>For example, if a package installs files under
1.45 wiz 8597: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8598: class="filename">share/applications</code>, it should
8599: have the following line in it:</p>
1.1 grant 8600: <pre class="programlisting">
1.51 rillig 8601: USE_DIRS+= xdg-1.1
1.1 grant 8602: </pre>
8603:
1.14 xtraeme 8604: <p>After regenerating the PLIST using
8605: <span><strong class="command">make
8606: print-PLIST</strong></span>, you should get the right
8607: (commented out) lines.</p>
1.1 grant 8608:
1.47 reed 8609: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8610: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8611: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8612: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8613: part and pkgsrc (in particular, <code xmlns=
8614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8615: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8616: </div>
8617: </div>
8618:
1.67 hubertf 8619: <div class="chapter" lang="en">
1.1 grant 8620: <div class="titlepage">
8621: <div>
8622: <div>
1.67 hubertf 8623: <h2 class="title"><a name=
1.38 dillo 8624: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8625: methodology</h2>
8626: </div>
8627: </div>
8628: </div>
8629:
8630: <div class="toc">
8631: <p><b>Table of Contents</b></p>
8632:
8633: <dl>
1.30 wiz 8634: <dt><span class="sect1"><a href=
1.38 dillo 8635: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8636: to use buildlink3</a></span></dt>
1.1 grant 8637:
1.30 wiz 8638: <dt><span class="sect1"><a href=
1.45 wiz 8639: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8640: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8641: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8642:
8643: <dd>
8644: <dl>
1.25 rillig 8645: <dt><span class="sect2"><a href=
1.38 dillo 8646: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8647: buildlink3.mk file</a></span></dt>
1.1 grant 8648:
1.25 rillig 8649: <dt><span class="sect2"><a href=
1.38 dillo 8650: "#updating-buildlink-depends">11.2.2. Updating
1.72 rillig 8651: <code class=
8652: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 8653: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8654: <code xmlns=
8655: "http://www.w3.org/TR/xhtml1/transitional" class=
8656: "filename">buildlink3.mk</code>
1.1 grant 8657: files</a></span></dt>
8658: </dl>
8659: </dd>
8660:
1.30 wiz 8661: <dt><span class="sect1"><a href=
1.45 wiz 8662: "#writing-builtin.mk">11.3. Writing <code xmlns=
8663: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8664: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8665:
8666: <dd>
8667: <dl>
1.25 rillig 8668: <dt><span class="sect2"><a href=
1.38 dillo 8669: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8670: <code xmlns=
8671: "http://www.w3.org/TR/xhtml1/transitional" class=
8672: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8673:
1.25 rillig 8674: <dt><span class="sect2"><a href=
1.38 dillo 8675: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8676: preferences for native or pkgsrc
8677: software</a></span></dt>
1.1 grant 8678: </dl>
8679: </dd>
8680: </dl>
8681: </div>
8682:
8683: <p>Buildlink is a framework in pkgsrc that controls what
8684: headers and libraries are seen by a package's configure and
8685: build processes. This is implemented in a two step
8686: process:</p>
8687:
8688: <div class="orderedlist">
8689: <ol type="1">
8690: <li>
8691: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8692: into <code class="varname">BUILDLINK_DIR</code>,
8693: which by default is a subdirectory of <code class=
8694: "varname">WRKDIR</code>.</p>
1.1 grant 8695: </li>
8696:
8697: <li>
8698: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8699: the normal compiler tools that translate <code class=
8700: "option">-I${LOCALBASE}/include</code> and
8701: <code class="option">-L${LOCALBASE}/lib</code> into
8702: references to <code class=
8703: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8704: also make native compiler on some operating systems
8705: look like GCC, so that packages that expect GCC won't
8706: require modifications to build with those native
8707: compilers.</p>
1.1 grant 8708: </li>
8709: </ol>
8710: </div>
8711:
8712: <p>This normalizes the environment in which a package is
8713: built so that the package may be built consistently despite
8714: what other software may be installed. Please note that the
1.45 wiz 8715: normal system header and library paths, e.g. <code xmlns=
8716: "http://www.w3.org/TR/xhtml1/transitional" class=
8717: "filename">/usr/include</code>, <code xmlns=
8718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8719: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8720: buildlink3 is designed to insulate the package build from
8721: non-system-supplied software.</p>
8722:
1.67 hubertf 8723: <div class="sect1" lang="en">
1.1 grant 8724: <div class="titlepage">
8725: <div>
8726: <div>
8727: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8728: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8729: packages to use buildlink3</h2>
1.1 grant 8730: </div>
8731: </div>
8732: </div>
8733:
8734: <p>The process of converting packages to use the
8735: buildlink3 framework (“<span class=
8736: "quote">bl3ifying</span>”) is fairly
8737: straightforward. The things to keep in mind are:</p>
8738:
8739: <div class="orderedlist">
8740: <ol type="1">
8741: <li>
8742: <p>Ensure that the build always calls the wrapper
8743: scripts instead of the actual toolchain. Some
8744: packages are tricky, and the only way to know for
1.45 wiz 8745: sure is the check <code xmlns=
8746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8747: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8748: wrappers are being invoked.</p>
8749: </li>
8750:
8751: <li>
1.14 xtraeme 8752: <p>Don't override <code class=
8753: "varname">PREFIX</code> from within the package
8754: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8755: because the code to symlink files into <code xmlns=
8756: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8757: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8758: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8759: <em class=
8760: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8761: </li>
8762:
8763: <li>
8764: <p>Remember that <span class=
1.45 wiz 8765: "emphasis"><em>only</em></span> the <code xmlns=
8766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8767: "filename">buildlink3.mk</code> files that you list
1.1 grant 8768: in a package's Makefile are added as dependencies
8769: for that package.</p>
8770: </li>
8771: </ol>
8772: </div>
8773:
8774: <p>If a dependency on a particular package is required
8775: for its libraries and headers, then we replace:</p>
8776: <pre class="programlisting">
1.51 rillig 8777: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8778: </pre>
8779:
8780: <p>with</p>
8781: <pre class="programlisting">
1.51 rillig 8782: .include "../../category/foo/buildlink3.mk"
1.1 grant 8783: </pre>
8784:
1.47 reed 8785: <p>The buildlink3.mk files usually define the required
8786: dependencies. If you need a newer version of the
8787: dependency when using buildlink3.mk files, then you can
8788: define it in your Makefile; for example:</p>
8789: <pre class="programlisting">
1.72 rillig 8790: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
1.51 rillig 8791: .include "../../category/foo/buildlink3.mk"
1.47 reed 8792: </pre>
8793:
1.45 wiz 8794: <p>There are several <code xmlns=
8795: "http://www.w3.org/TR/xhtml1/transitional" class=
8796: "filename">buildlink3.mk</code> files in <code xmlns=
8797: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8798: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8799: issues:</p>
8800:
8801: <div class="itemizedlist">
8802: <ul type="disc">
8803: <li>
1.45 wiz 8804: <p><code xmlns=
8805: "http://www.w3.org/TR/xhtml1/transitional" class=
8806: "filename">bdb.buildlink3.mk</code> chooses either
8807: the native or a pkgsrc Berkeley DB implementation
8808: based on the values of <code class=
1.14 xtraeme 8809: "varname">BDB_ACCEPTED</code> and <code class=
8810: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8811: </li>
8812:
8813: <li>
1.45 wiz 8814: <p><code xmlns=
8815: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8816: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8817: system comes with neither Curses nor NCurses, this
8818: will take care to install the <a xmlns=
8819: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8820: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8821: target="_top"><code xmlns="" class=
8822: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8823: </li>
8824:
8825: <li>
1.45 wiz 8826: <p><code xmlns=
8827: "http://www.w3.org/TR/xhtml1/transitional" class=
8828: "filename">krb5.buildlink3.mk</code> uses the value
8829: of <code class="varname">KRB5_ACCEPTED</code> to
8830: choose between adding a dependency on Heimdal or
8831: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8832: implementation.</p>
8833: </li>
8834:
8835: <li>
1.45 wiz 8836: <p><code xmlns=
8837: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8838: "filename">motif.buildlink3.mk</code> checks for a
8839: system-provided Motif installation or adds a
8840: dependency on <a xmlns=
1.1 grant 8841: "http://www.w3.org/TR/xhtml1/transitional" href=
8842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8843: target="_top"><code xmlns="" class=
8844: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8845: "http://www.w3.org/TR/xhtml1/transitional" href=
8846: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8847: target="_top"><code xmlns="" class=
1.47 reed 8848: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8849: </li>
8850:
8851: <li>
1.45 wiz 8852: <p><code xmlns=
8853: "http://www.w3.org/TR/xhtml1/transitional" class=
1.71 wiz 8854: "filename">oss.buildlink3.mk</code> defines several
8855: variables that may be used by packages that use the
8856: Open Sound System (OSS) API.</p>
1.1 grant 8857: </li>
8858:
8859: <li>
1.45 wiz 8860: <p><code xmlns=
8861: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8862: "filename">pgsql.buildlink3.mk</code> will accept
8863: either Postgres 7.3 or 7.4, whichever is found
8864: installed. See the file for more information.</p>
1.1 grant 8865: </li>
8866:
8867: <li>
1.45 wiz 8868: <p><code xmlns=
8869: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8870: "filename">pthread.buildlink3.mk</code> uses the
8871: value of <code class="varname">PTHREAD_OPTS</code>
8872: and checks for native pthreads or adds a dependency
8873: on <a xmlns=
1.1 grant 8874: "http://www.w3.org/TR/xhtml1/transitional" href=
8875: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8876: target="_top"><code xmlns="" class=
1.47 reed 8877: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8878: </li>
8879:
8880: <li>
1.45 wiz 8881: <p><code xmlns=
8882: "http://www.w3.org/TR/xhtml1/transitional" class=
8883: "filename">xaw.buildlink3.mk</code> uses the value
8884: of <code class="varname">XAW_TYPE</code> to choose
8885: a particular Athena widgets library.</p>
1.1 grant 8886: </li>
8887: </ul>
8888: </div>
8889:
1.45 wiz 8890: <p>The comments in those <code xmlns=
8891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8892: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8893: complete description of how to use them properly.</p>
8894: </div>
8895:
1.67 hubertf 8896: <div class="sect1" lang="en">
1.1 grant 8897: <div class="titlepage">
8898: <div>
8899: <div>
8900: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8901: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8902: <code xmlns=
8903: "http://www.w3.org/TR/xhtml1/transitional" class=
8904: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8905: </div>
8906: </div>
8907: </div>
8908:
1.45 wiz 8909: <p>A package's <code xmlns=
8910: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8911: "filename">buildlink3.mk</code> file is included by
8912: Makefiles to indicate the need to compile and link
8913: against header files and libraries provided by the
1.45 wiz 8914: package. A <code xmlns=
8915: "http://www.w3.org/TR/xhtml1/transitional" class=
8916: "filename">buildlink3.mk</code> file should always
8917: provide enough information to add the correct type of
8918: dependency relationship and include any other
8919: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8920: class="filename">buildlink3.mk</code> files that it needs
8921: to find headers and libraries that it needs in turn.</p>
1.1 grant 8922:
1.45 wiz 8923: <p>To generate an initial <code xmlns=
8924: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8925: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8926: Rene Hexel's <a xmlns=
8927: "http://www.w3.org/TR/xhtml1/transitional" href=
8928: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8929: target="_top"><code xmlns="" class=
8930: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8931: highly recommended. For most packages, the following
8932: command will generate a good starting point for
1.45 wiz 8933: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8934: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8935: <pre class="screen">
1.14 xtraeme 8936: <code class="prompt">%</code> <strong class=
8937: "userinput"><code>cd pkgsrc/<em class=
8938: "replaceable"><code>category</code></em>/<em class=
8939: "replaceable"><code>pkgdir</code></em>
8940: <code class=
1.49 rillig 8941: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8942: </pre>
8943:
1.67 hubertf 8944: <div class="sect2" lang="en">
1.1 grant 8945: <div class="titlepage">
8946: <div>
8947: <div>
1.67 hubertf 8948: <h3 class="title"><a name=
8949: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8950: buildlink3.mk file</h3>
1.1 grant 8951: </div>
8952: </div>
8953: </div>
8954:
1.45 wiz 8955: <p>The following real-life example <code xmlns=
8956: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8957: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8958: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8959: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8960: <pre class="programlisting">
1.51 rillig 8961: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8962:
1.51 rillig 8963: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8964: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8965:
1.51 rillig 8966: .if !empty(BUILDLINK_DEPTH:M+)
8967: BUILDLINK_DEPENDS+= tiff
8968: .endif
1.1 grant 8969:
1.51 rillig 8970: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8971: BUILDLINK_PACKAGES+= tiff
1.1 grant 8972:
1.51 rillig 8973: .if !empty(TIFF_BUILDLINK3_MK:M+)
1.72 rillig 8974: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
1.51 rillig 8975: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8976: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8977:
1.51 rillig 8978: .include "../../devel/zlib/buildlink3.mk"
8979: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8980:
1.51 rillig 8981: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8982: </pre>
8983:
1.14 xtraeme 8984: <p>The header and footer manipulate <code class=
8985: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8986: across all <code xmlns=
8987: "http://www.w3.org/TR/xhtml1/transitional" class=
8988: "filename">buildlink3.mk</code> files and is used to
8989: track at what depth we are including <code xmlns=
8990: "http://www.w3.org/TR/xhtml1/transitional" class=
8991: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8992:
8993: <p>The first section controls if the dependency on
1.14 xtraeme 8994: <em class="replaceable"><code>pkg</code></em> is added.
8995: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8996: global list of packages for which dependencies are
8997: added by buildlink3.</p>
8998:
8999: <p>The second section advises pkgsrc that the
1.45 wiz 9000: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9001: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 9002: <em class="replaceable"><code>pkg</code></em> has been
9003: included at some point. <code class=
9004: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 9005: of packages for which <code xmlns=
9006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9007: "filename">buildlink3.mk</code> files have been
9008: included. It must <span class=
9009: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 9010: a <code xmlns=
9011: "http://www.w3.org/TR/xhtml1/transitional" class=
9012: "filename">buildlink3.mk</code> file.</p>
1.1 grant 9013:
9014: <p>The third section is protected from multiple
1.14 xtraeme 9015: inclusion and controls how the dependency on <em class=
9016: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 9017: important variables are set in the section:</p>
9018:
9019: <div class="itemizedlist">
9020: <ul type="disc">
9021: <li>
1.14 xtraeme 9022: <p><code class=
1.72 rillig 9023: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9024: "replaceable"><code>pkg</code></em></code> is the
9025: actual dependency recorded in the installed
9026: package; this should always be set using
9027: <span><strong class="command">+=</strong></span>
9028: to ensure that we're appending to any
9029: pre-existing list of values. This variable should
9030: be set to the first version of the package that
1.72 rillig 9031: had an API change.</p>
1.1 grant 9032: </li>
9033:
9034: <li>
1.14 xtraeme 9035: <p><code class=
9036: "varname">BUILDLINK_PKGSRCDIR.<em class=
9037: "replaceable"><code>pkg</code></em></code> is the
9038: location of the <em class=
9039: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 9040: directory.</p>
1.1 grant 9041: </li>
9042:
9043: <li>
1.14 xtraeme 9044: <p><code class=
9045: "varname">BUILDLINK_DEPMETHOD.<em class=
9046: "replaceable"><code>pkg</code></em></code> (not
9047: shown above) controls whether we use <code class=
9048: "varname">BUILD_DEPENDS</code> or <code class=
9049: "varname">DEPENDS</code> to add the dependency on
9050: <em class="replaceable"><code>pkg</code></em>.
9051: The build dependency is selected by setting
9052: <code class=
9053: "varname">BUILDLINK_DEPMETHOD.<em class=
9054: "replaceable"><code>pkg</code></em></code> to
1.1 grant 9055: “<span class="quote">build</span>”.
9056: By default, the full dependency is used.</p>
9057: </li>
9058:
9059: <li>
1.14 xtraeme 9060: <p><code class=
9061: "varname">BUILDLINK_INCDIRS.<em class=
9062: "replaceable"><code>pkg</code></em></code> and
9063: <code class=
1.67 hubertf 9064: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
9065: (not shown above) are lists of subdirectories of
9066: <code xmlns=
1.45 wiz 9067: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9068: "filename">${BUILDLINK_PREFIX.<em class=
9069: "replaceable"><code>pkg</code></em>}</code> to
9070: add to the header and library search paths. These
1.1 grant 9071: default to “<span class=
9072: "quote">include</span>” and
9073: “<span class="quote">lib</span>”
9074: respectively.</p>
9075: </li>
9076:
9077: <li>
1.14 xtraeme 9078: <p><code class=
9079: "varname">BUILDLINK_CPPFLAGS.<em class=
9080: "replaceable"><code>pkg</code></em></code> (not
9081: shown above) is the list of preprocessor flags to
9082: add to <code class="varname">CPPFLAGS</code>,
9083: which are passed on to the configure and build
9084: phases. The “<span class=
9085: "quote">-I</span>” option should be avoided
9086: and instead be handled using <code class=
9087: "varname">BUILDLINK_INCDIRS.<em class=
9088: "replaceable"><code>pkg</code></em></code> as
9089: above.</p>
1.1 grant 9090: </li>
9091: </ul>
9092: </div>
9093:
9094: <p>The following variables are all optionally defined
9095: within this second section (protected against multiple
9096: inclusion) and control which package files are
1.45 wiz 9097: symlinked into <code xmlns=
9098: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9099: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 9100: are transformed during the symlinking:</p>
9101:
9102: <div class="itemizedlist">
9103: <ul type="disc">
9104: <li>
1.14 xtraeme 9105: <p><code class=
9106: "varname">BUILDLINK_FILES.<em class=
9107: "replaceable"><code>pkg</code></em></code> (not
9108: shown above) is a shell glob pattern relative to
1.45 wiz 9109: <code xmlns=
9110: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9111: "filename">${BUILDLINK_PREFIX.<em class=
9112: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 9113: symlinked into <code xmlns=
9114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9115: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 9116: <code xmlns=
9117: "http://www.w3.org/TR/xhtml1/transitional" class=
9118: "filename">include/*.h</code>.</p>
1.1 grant 9119: </li>
9120:
9121: <li>
1.14 xtraeme 9122: <p><code class=
9123: "varname">BUILDLINK_FILES_CMD.<em class=
9124: "replaceable"><code>pkg</code></em></code> (not
9125: shown above) is a shell pipeline that outputs to
1.45 wiz 9126: stdout a list of files relative to <code xmlns=
9127: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9128: "filename">${BUILDLINK_PREFIX.<em class=
9129: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 9130: resulting files are to be symlinked into
1.45 wiz 9131: <code xmlns=
9132: "http://www.w3.org/TR/xhtml1/transitional" class=
9133: "filename">${BUILDLINK_DIR}</code>. By default,
9134: this takes the <code xmlns=
9135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9136: "filename">+CONTENTS</code> of a <em class=
9137: "replaceable"><code>pkg</code></em> and filters
9138: it through <code class=
9139: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
9140: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 9141: </li>
9142:
9143: <li>
1.14 xtraeme 9144: <p><code class=
9145: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9146: "replaceable"><code>pkg</code></em></code> (not
9147: shown above) is a filter command that filters
1.45 wiz 9148: <code xmlns=
9149: "http://www.w3.org/TR/xhtml1/transitional" class=
9150: "filename">+CONTENTS</code> input into a list of
9151: files relative to <code xmlns=
9152: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9153: "filename">${BUILDLINK_PREFIX.<em class=
9154: "replaceable"><code>pkg</code></em>}</code> on
9155: stdout. By default for overwrite packages,
9156: <code class=
9157: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
9158: "replaceable"><code>pkg</code></em></code>
1.45 wiz 9159: outputs the contents of the <code xmlns=
9160: "http://www.w3.org/TR/xhtml1/transitional" class=
9161: "filename">include</code> and <code xmlns=
9162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9163: "filename">lib</code> directories in the package
1.45 wiz 9164: <code xmlns=
9165: "http://www.w3.org/TR/xhtml1/transitional" class=
9166: "filename">+CONTENTS</code>, and for pkgviews
9167: packages, it outputs any libtool archives in
9168: <code xmlns=
9169: "http://www.w3.org/TR/xhtml1/transitional" class=
9170: "filename">lib</code> directories.</p>
1.1 grant 9171: </li>
9172:
9173: <li>
1.14 xtraeme 9174: <p><code class=
9175: "varname">BUILDLINK_TRANSFORM.<em class=
9176: "replaceable"><code>pkg</code></em></code> (not
9177: shown above) is a list of sed arguments used to
1.1 grant 9178: transform the name of the source filename into a
1.14 xtraeme 9179: destination filename, e.g. <span><strong class=
1.1 grant 9180: "command">-e
1.14 xtraeme 9181: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 9182: </li>
9183: </ul>
9184: </div>
9185:
1.45 wiz 9186: <p>The last section includes any <code xmlns=
9187: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9188: "filename">buildlink3.mk</code> needed for <em class=
9189: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 9190: dependencies. Including these <code xmlns=
9191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9192: "filename">buildlink3.mk</code> files means that the
9193: headers and libraries for these dependencies are also
1.45 wiz 9194: symlinked into <code xmlns=
9195: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9196: "filename">${BUILDLINK_DIR}</code> whenever the
9197: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 9198: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9199: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 9200: included.</p>
1.1 grant 9201: </div>
9202:
1.67 hubertf 9203: <div class="sect2" lang="en">
1.1 grant 9204: <div class="titlepage">
9205: <div>
9206: <div>
1.30 wiz 9207: <h3 class="title"><a name=
1.67 hubertf 9208: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 9209: <code class=
1.72 rillig 9210: "varname">BUILDLINK_API_DEPENDS.<em class=
9211: "replaceable"><code>pkg</code></em></code> in
9212: <code xmlns=
1.45 wiz 9213: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 9214: "filename">buildlink3.mk</code> files</h3>
1.1 grant 9215: </div>
9216: </div>
9217: </div>
9218:
1.72 rillig 9219: <p>The situation that requires increasing the
1.14 xtraeme 9220: dependency listed in <code class=
1.72 rillig 9221: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9222: "replaceable"><code>pkg</code></em></code> after a
1.72 rillig 9223: package update is when the API or interface to the
9224: header files change.</p>
1.1 grant 9225:
1.72 rillig 9226: <p>In this case, <code class=
9227: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9228: "replaceable"><code>pkg</code></em></code> should be
9229: adjusted to require at least the new package version.
9230: In some cases, the packages that depend on this new
9231: version may need their <code class=
9232: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 9233: have <code xmlns=
9234: "http://www.w3.org/TR/xhtml1/transitional" class=
9235: "filename">buildlink3.mk</code> files, their
1.72 rillig 9236: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
1.45 wiz 9237: "replaceable"><code>pkg</code></em></code> adjusted,
1.72 rillig 9238: too. This is needed so pkgsrc will require the correct
9239: package dependency and not settle for an older one when
9240: building the source.</p>
9241:
9242: <p><code class=
9243: "varname">BUILDLINK_ABI_DEPENDS.<em class=
9244: "replaceable"><code>pkg</code></em></code> should be
9245: increased when the binary interface or sonames (major
9246: number of the library version) of any installed shared
9247: libraries change. This is needed so that binary
9248: packages made using it will require the correct package
9249: dependency and not settle for an older one which will
9250: not contain the necessary shared libraries.</p>
9251:
9252: <p>See <a href="#dependencies" title=
9253: "16.1.4. Handling dependencies">Section 16.1.4,
9254: “Handling dependencies”</a> for more
9255: information about dependencies on other packages,
9256: including the <code class=
9257: "varname">BUILDLINK_ABI_DEPENDS</code> and <code class=
9258: "varname">ABI_DEPENDS</code> definitions.</p>
1.1 grant 9259:
9260: <p>Please take careful consideration before adjusting
1.72 rillig 9261: <code class="varname">BUILDLINK_API_DEPENDS.<em class=
9262: "replaceable"><code>pkg</code></em></code> or
9263: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class=
1.14 xtraeme 9264: "replaceable"><code>pkg</code></em></code> as we don't
9265: want to cause unneeded package deletions and rebuilds.
9266: In many cases, new versions of packages work just fine
1.72 rillig 9267: with older dependencies.</p>
9268:
9269: <p>Also it is not needed to set <code class=
9270: "varname">BUILDLINK_ABI_DEPENDS.<em class=
9271: "replaceable"><code>pkg</code></em></code> when it is
9272: identical to <code class=
9273: "varname">BUILDLINK_API_DEPENDS.<em class=
9274: "replaceable"><code>pkg</code></em></code>.</p>
1.1 grant 9275: </div>
9276: </div>
9277:
1.67 hubertf 9278: <div class="sect1" lang="en">
1.1 grant 9279: <div class="titlepage">
9280: <div>
9281: <div>
9282: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9283: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 9284: <code xmlns=
9285: "http://www.w3.org/TR/xhtml1/transitional" class=
9286: "filename">builtin.mk</code> files</h2>
1.1 grant 9287: </div>
9288: </div>
9289: </div>
9290:
9291: <p>Some packages in pkgsrc install headers and libraries
9292: that coincide with headers and libraries present in the
1.45 wiz 9293: base system. Aside from a <code xmlns=
9294: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9295: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 9296: should also include a <code xmlns=
9297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9298: "filename">builtin.mk</code> file that includes the
9299: necessary checks to decide whether using the built-in
9300: software or the pkgsrc software is appropriate.</p>
1.1 grant 9301:
9302: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 9303: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 9304:
9305: <div class="orderedlist">
9306: <ol type="1">
9307: <li>
1.14 xtraeme 9308: <p>It should set <code class=
9309: "varname">USE_BUILTIN.<em class=
9310: "replaceable"><code>pkg</code></em></code> to
9311: either “<span class="quote">yes</span>”
9312: or “<span class="quote">no</span>”
9313: after it is included.</p>
1.1 grant 9314: </li>
9315:
9316: <li>
9317: <p>It should <span class=
9318: "emphasis"><em>not</em></span> override any
1.14 xtraeme 9319: <code class="varname">USE_BUILTIN.<em class=
9320: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 9321: already set before the <code xmlns=
9322: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9323: "filename">builtin.mk</code> file is included.</p>
1.1 grant 9324: </li>
9325:
9326: <li>
9327: <p>It should be written to allow multiple
9328: inclusion. This is <span class=
9329: "emphasis"><em>very</em></span> important and takes
1.45 wiz 9330: careful attention to <code xmlns=
9331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9332: "filename">Makefile</code> coding.</p>
1.1 grant 9333: </li>
9334: </ol>
9335: </div>
9336:
1.67 hubertf 9337: <div class="sect2" lang="en">
1.1 grant 9338: <div class="titlepage">
9339: <div>
9340: <div>
1.67 hubertf 9341: <h3 class="title"><a name=
1.38 dillo 9342: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 9343: of a <code xmlns=
9344: "http://www.w3.org/TR/xhtml1/transitional" class=
9345: "filename">builtin.mk</code> file</h3>
1.1 grant 9346: </div>
9347: </div>
9348: </div>
9349:
9350: <p>The following is the recommended template for
9351: builtin.mk files:</p>
9352: <pre class="programlisting">
1.51 rillig 9353: .if !defined(IS_BUILTIN.foo)
9354: #
9355: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
9356: # genuinely exists in the system or not.
9357: #
9358: IS_BUILTIN.foo?= no
9359:
9360: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
9361: # version can be determined.
9362: #
9363: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
9364: BUILTIN_PKG.foo?= foo-1.0
9365: . endif
9366: .endif # IS_BUILTIN.foo
9367:
9368: .if !defined(USE_BUILTIN.foo)
9369: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
9370: . if defined(BUILTIN_PKG.foo)
1.72 rillig 9371: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
1.51 rillig 9372: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
9373: USE_BUILTIN.foo!= \
9374: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
9375: ${ECHO} "yes"; \
9376: else \
9377: ${ECHO} "no"; \
9378: fi
9379: . endif
9380: . endfor
9381: . endif
9382: .endif # USE_BUILTIN.foo
9383:
9384: CHECK_BUILTIN.foo?= no
9385: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
9386: #
9387: # Here we place code that depends on whether USE_BUILTIN.foo is set to
9388: # "yes" or "no".
9389: #
9390: .endif # CHECK_BUILTIN.foo
1.1 grant 9391: </pre>
9392:
1.14 xtraeme 9393: <p>The first section sets <code class=
9394: "varname">IS_BUILTIN.<em class=
9395: "replaceable"><code>pkg</code></em></code> depending on
9396: if <em class="replaceable"><code>pkg</code></em> really
9397: exists in the base system. This should not be a base
9398: system software with similar functionality to
9399: <em class="replaceable"><code>pkg</code></em>; it
9400: should only be “<span class=
9401: "quote">yes</span>” if the actual package is
9402: included as part of the base system. This variable is
1.45 wiz 9403: only used internally within the <code xmlns=
9404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9405: "filename">builtin.mk</code> file.</p>
9406:
9407: <p>The second section sets <code class=
9408: "varname">BUILTIN_PKG.<em class=
9409: "replaceable"><code>pkg</code></em></code> to the
9410: version of <em class=
9411: "replaceable"><code>pkg</code></em> in the base system
9412: if it exists (if <code class=
9413: "varname">IS_BUILTIN.<em class=
9414: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9415: “<span class="quote">yes</span>”). This
1.14 xtraeme 9416: variable is only used internally within the
1.45 wiz 9417: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9418: class="filename">builtin.mk</code> file.</p>
1.1 grant 9419:
1.14 xtraeme 9420: <p>The third section sets <code class=
9421: "varname">USE_BUILTIN.<em class=
9422: "replaceable"><code>pkg</code></em></code> and is
9423: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9424: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9425: class="filename">builtin.mk</code> files. The code in
9426: this section must make the determination whether the
9427: built-in software is adequate to satisfy the
9428: dependencies listed in <code class=
1.72 rillig 9429: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9430: "replaceable"><code>pkg</code></em></code>. This is
9431: typically done by comparing <code class=
9432: "varname">BUILTIN_PKG.<em class=
9433: "replaceable"><code>pkg</code></em></code> against each
9434: of the dependencies in <code class=
1.72 rillig 9435: "varname">BUILDLINK_API_DEPENDS.<em class=
1.14 xtraeme 9436: "replaceable"><code>pkg</code></em></code>.
9437: <code class="varname">USE_BUILTIN.<em class=
9438: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9439: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9440: value by the end of the <code xmlns=
9441: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9442: "filename">builtin.mk</code> file. Note that
9443: <code class="varname">USE_BUILTIN.<em class=
9444: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9445: “<span class="quote">yes</span>” even if
1.14 xtraeme 9446: <code class="varname">IS_BUILTIN.<em class=
9447: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9448: “<span class="quote">no</span>” because we
9449: may make the determination that the built-in version of
9450: the software is similar enough to be used as a
9451: replacement.</p>
9452:
1.14 xtraeme 9453: <p>The last section is guarded by <code class=
9454: "varname">CHECK_BUILTIN.<em class=
9455: "replaceable"><code>pkg</code></em></code>, and
9456: includes code that uses the value of <code class=
9457: "varname">USE_BUILTIN.<em class=
9458: "replaceable"><code>pkg</code></em></code> set in the
9459: previous section. This typically includes, e.g., adding
1.1 grant 9460: additional dependency restrictions and listing
1.45 wiz 9461: additional files to symlink into <code xmlns=
9462: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9463: "filename">${BUILDLINK_DIR}</code> (via <code class=
9464: "varname">BUILDLINK_FILES.<em class=
9465: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9466: </div>
9467:
1.67 hubertf 9468: <div class="sect2" lang="en">
1.1 grant 9469: <div class="titlepage">
9470: <div>
9471: <div>
1.30 wiz 9472: <h3 class="title"><a name=
1.38 dillo 9473: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9474: preferences for native or pkgsrc software</h3>
1.1 grant 9475: </div>
9476: </div>
9477: </div>
9478:
9479: <p>When building packages, it's possible to choose
9480: whether to set a global preference for using either the
9481: built-in (native) version or the pkgsrc version of
9482: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9483: setting <code class="varname">PREFER_PKGSRC</code> and
9484: <code class="varname">PREFER_NATIVE</code>. These
9485: variables take values of either “<span class=
1.1 grant 9486: "quote">yes</span>”, “<span class=
9487: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9488: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9489: to use the pkgsrc versions of software, while
9490: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9491: to use the built-in versions. Preferences are
9492: determined by the most specific instance of the package
9493: in either <code class="varname">PREFER_PKGSRC</code> or
9494: <code class="varname">PREFER_NATIVE</code>. If a
9495: package is specified in neither or in both variables,
9496: then <code class="varname">PREFER_PKGSRC</code> has
9497: precedence over <code class=
9498: "varname">PREFER_NATIVE</code>. For example, to require
9499: using pkgsrc versions of software for all but the most
9500: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9501: <pre class="programlisting">
1.51 rillig 9502: PREFER_PKGSRC= yes
9503: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9504: </pre>
9505:
9506: <p>A package <span class=
1.45 wiz 9507: "emphasis"><em>must</em></span> have a <code xmlns=
9508: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9509: "filename">builtin.mk</code> file to be listed in
9510: <code class="varname">PREFER_NATIVE</code>, otherwise
9511: it is simply ignored in that list.</p>
1.1 grant 9512: </div>
9513: </div>
9514: </div>
9515:
1.67 hubertf 9516: <div class="chapter" lang="en">
1.1 grant 9517: <div class="titlepage">
9518: <div>
9519: <div>
1.67 hubertf 9520: <h2 class="title"><a name=
1.38 dillo 9521: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9522: framework</h2>
1.1 grant 9523: </div>
9524: </div>
9525: </div>
9526:
9527: <div class="toc">
9528: <p><b>Table of Contents</b></p>
9529:
9530: <dl>
1.30 wiz 9531: <dt><span class="sect1"><a href=
1.38 dillo 9532: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9533: directories outside the installation
9534: prefix</a></span></dt>
9535:
9536: <dd>
9537: <dl>
9538: <dt><span class="sect2"><a href=
1.38 dillo 9539: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9540: manipulation</a></span></dt>
9541:
9542: <dt><span class="sect2"><a href=
1.38 dillo 9543: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9544: manipulation</a></span></dt>
9545: </dl>
9546: </dd>
9547:
1.38 dillo 9548: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9549: Configuration files</a></span></dt>
9550:
9551: <dd>
9552: <dl>
9553: <dt><span class="sect2"><a href=
1.38 dillo 9554: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9555: "varname">PKG_SYSCONFDIR</code> is
9556: set</a></span></dt>
9557:
9558: <dt><span class="sect2"><a href=
1.38 dillo 9559: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9560: software where configuration files
1.35 jmmv 9561: are</a></span></dt>
9562:
9563: <dt><span class="sect2"><a href=
1.38 dillo 9564: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9565: installations</a></span></dt>
9566:
9567: <dt><span class="sect2"><a href=
1.38 dillo 9568: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9569: configuration files</a></span></dt>
9570: </dl>
9571: </dd>
9572:
1.38 dillo 9573: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9574: System startup scripts</a></span></dt>
9575:
9576: <dd>
9577: <dl>
9578: <dt><span class="sect2"><a href=
1.38 dillo 9579: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9580: of system startup scripts</a></span></dt>
9581: </dl>
9582: </dd>
1.1 grant 9583:
1.30 wiz 9584: <dt><span class="sect1"><a href=
1.38 dillo 9585: "#users-and-groups">12.4. System users and
1.35 jmmv 9586: groups</a></span></dt>
9587:
1.38 dillo 9588: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9589: shells</a></span></dt>
9590:
9591: <dd>
9592: <dl>
9593: <dt><span class="sect2"><a href=
1.65 hubertf 9594: "#shells-disable">12.5.1. Disabling shell
9595: registration</a></span></dt>
9596: </dl>
9597: </dd>
9598:
9599: <dt><span class="sect1"><a href="#fonts">12.6.
9600: Fonts</a></span></dt>
9601:
9602: <dd>
9603: <dl>
9604: <dt><span class="sect2"><a href=
9605: "#fonts-disable">12.6.1. Disabling automatic update
9606: of the fonts databases</a></span></dt>
1.35 jmmv 9607: </dl>
9608: </dd>
1.1 grant 9609: </dl>
9610: </div>
9611:
1.35 jmmv 9612: <p>This chapter describes the framework known as
9613: <code class="literal">pkginstall</code>, whose key features
9614: are:</p>
9615:
9616: <div class="itemizedlist">
9617: <ul type="disc">
9618: <li>
9619: <p>Generic installation and manipulation of
9620: directories and files outside the pkgsrc-handled
9621: tree, <code class="varname">LOCALBASE</code>.</p>
9622: </li>
9623:
9624: <li>
9625: <p>Automatic handling of configuration files during
9626: installation, provided that packages are correctly
9627: designed.</p>
9628: </li>
9629:
9630: <li>
9631: <p>Generation and installation of system startup
9632: scripts.</p>
9633: </li>
9634:
9635: <li>
9636: <p>Registration of system users and groups.</p>
9637: </li>
9638:
9639: <li>
9640: <p>Registration of system shells.</p>
9641: </li>
1.65 hubertf 9642:
9643: <li>
9644: <p>Automatic updating of fonts databases.</p>
9645: </li>
1.35 jmmv 9646: </ul>
9647: </div>
9648:
9649: <p>The following sections inspect each of the above points
1.65 hubertf 9650: in detail.</p>
1.35 jmmv 9651:
9652: <p>You may be thinking that many of the things described
9653: here could be easily done with simple code in the package's
9654: post-installation target (<code class=
9655: "literal">post-install</code>). <span class=
9656: "emphasis"><em>This is incorrect</em></span>, as the code
9657: in them is only executed when building from source.
9658: Machines using binary packages could not benefit from it at
9659: all (as the code itself could be unavailable). Therefore,
9660: the only way to achieve any of the items described above is
9661: by means of the installation scripts, which are
9662: automatically generated by pkginstall.</p>
1.1 grant 9663:
1.67 hubertf 9664: <div class="sect1" lang="en">
1.1 grant 9665: <div class="titlepage">
9666: <div>
9667: <div>
9668: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9669: "files-and-dirs-outside-prefix"></a>12.1. Files
9670: and directories outside the installation
9671: prefix</h2>
1.1 grant 9672: </div>
9673: </div>
9674: </div>
9675:
1.45 wiz 9676: <p>As you already know, the <code xmlns=
9677: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9678: "filename">PLIST</code> file holds a list of files and
9679: directories that belong to a package. The names used in
1.45 wiz 9680: it are relative to the installation prefix (<code xmlns=
9681: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9682: "filename">${PREFIX}</code>), which means that it cannot
9683: register files outside this directory (absolute path
9684: names are not allowed). Despite this restriction, some
9685: packages need to install files outside this location;
1.45 wiz 9686: e.g., under <code xmlns=
9687: "http://www.w3.org/TR/xhtml1/transitional" class=
9688: "filename">${VARBASE}</code> or <code xmlns=
9689: "http://www.w3.org/TR/xhtml1/transitional" class=
9690: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9691:
9692: <p>The only way to achieve this is to create such files
9693: during installation time by using the installation
9694: scripts. These scripts can run arbitrary commands, so
9695: they have the potential to create and manage files
1.47 reed 9696: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9697: comes into play: it provides generic scripts to abstract
9698: the manipulation of such files and directories based on
1.45 wiz 9699: variables set in the package's <code xmlns=
9700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9701: "filename">Makefile</code>. The rest of this section
1.47 reed 9702: describes these variables.</p>
1.1 grant 9703:
1.67 hubertf 9704: <div class="sect2" lang="en">
1.35 jmmv 9705: <div class="titlepage">
1.1 grant 9706: <div>
1.35 jmmv 9707: <div>
1.67 hubertf 9708: <h3 class="title"><a name=
1.63 dillo 9709: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9710: manipulation</h3>
9711: </div>
1.1 grant 9712: </div>
9713: </div>
9714:
1.35 jmmv 9715: <p>The following variables can be set to request the
1.47 reed 9716: creation of directories anywhere in the file
9717: system:</p>
1.27 rillig 9718:
1.35 jmmv 9719: <div class="itemizedlist">
9720: <ul type="disc">
9721: <li>
9722: <p><code class="varname">MAKE_DIRS</code> and
9723: <code class="varname">OWN_DIRS</code> contain a
9724: list of directories that should be created and
9725: should attempt to be destroyed by the
9726: installation scripts. The difference between the
9727: two is that the latter prompts the administrator
9728: to remove any directories that may be left after
9729: deinstallation (because they were not empty),
9730: while the former does not.</p>
9731: </li>
1.1 grant 9732:
1.35 jmmv 9733: <li>
9734: <p><code class="varname">MAKE_DIRS_PERMS</code>
9735: and <code class="varname">OWN_DIRS_PERMS</code>
9736: contain a list of tuples describing which
9737: directories should be created and should attempt
9738: to be destroyed by the installation scripts. Each
9739: tuple holds the following values, separated by
9740: spaces: the directory name, its owner, its group
9741: and its numerical mode. For example:</p>
9742: <pre class="programlisting">
1.51 rillig 9743: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9744: </pre>
1.1 grant 9745:
1.35 jmmv 9746: <p>The difference between the two is exactly the
9747: same as their non-<code class=
9748: "varname">PERMS</code> counterparts.</p>
9749: </li>
9750: </ul>
9751: </div>
9752: </div>
9753:
1.67 hubertf 9754: <div class="sect2" lang="en">
1.35 jmmv 9755: <div class="titlepage">
9756: <div>
9757: <div>
1.67 hubertf 9758: <h3 class="title"><a name=
9759: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9760: manipulation</h3>
9761: </div>
9762: </div>
9763: </div>
9764:
9765: <p>Creating non-empty files outside the installation
1.45 wiz 9766: prefix is tricky because the <code xmlns=
9767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9768: "filename">PLIST</code> forces all files to be inside
9769: it. To overcome this problem, the only solution is to
9770: extract the file in the known place (i.e., inside the
9771: installation prefix) and copy it to the appropriate
9772: location during installation (done by the installation
9773: scripts generated by pkginstall). We will call the
9774: former the <span class="emphasis"><em>master
9775: file</em></span> in the following paragraphs, which
9776: describe the variables that can be used to
9777: automatically and consistently handle files outside the
9778: installation prefix:</p>
9779:
9780: <div class="itemizedlist">
9781: <ul type="disc">
9782: <li>
9783: <p><code class="varname">CONF_FILES</code> and
9784: <code class="varname">SUPPORT_FILES</code> are
9785: pairs of master and target files. During
9786: installation time, the master file is copied to
9787: the target one if and only if the latter does not
9788: exist. Upon deinstallation, the target file is
9789: removed provided that it was not modified by the
9790: installation.</p>
9791:
9792: <p>The difference between the two is that the
9793: latter prompts the administrator to remove any
9794: files that may be left after deinstallation
9795: (because they were not empty), while the former
9796: does not.</p>
9797: </li>
9798:
9799: <li>
9800: <p><code class="varname">CONF_FILES_PERMS</code>
9801: and <code class=
9802: "varname">SUPPORT_FILES_PERMS</code> contain
9803: tuples describing master files as well as their
9804: target locations. For each of them, it also
9805: specifies their owner, their group and their
9806: numeric permissions, in this order. For
9807: example:</p>
9808: <pre class="programlisting">
1.51 rillig 9809: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9810: </pre>
9811:
9812: <p>The difference between the two is exactly the
9813: same as their non-<code class=
9814: "varname">PERMS</code> counterparts.</p>
9815: </li>
9816: </ul>
9817: </div>
9818: </div>
9819: </div>
9820:
1.67 hubertf 9821: <div class="sect1" lang="en">
1.35 jmmv 9822: <div class="titlepage">
9823: <div>
9824: <div>
9825: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9826: "conf-files"></a>12.2. Configuration
9827: files</h2>
1.35 jmmv 9828: </div>
9829: </div>
9830: </div>
9831:
9832: <p>Configuration files are special in the sense that they
9833: are installed in their own specific directory,
9834: <code class="varname">PKG_SYSCONFDIR</code>, and need
9835: special treatment during installation (most of which is
9836: automated by pkginstall). The main concept you must bear
1.36 wiz 9837: in mind is that files marked as configuration files are
1.35 jmmv 9838: automatically copied to the right place (somewhere inside
9839: <code class="varname">PKG_SYSCONFDIR</code>) during
9840: installation <span class="emphasis"><em>if and only
9841: if</em></span> they didn't exist before. Similarly, they
9842: will not be removed if they have local modifications.
1.36 wiz 9843: This ensures that administrators never lose any custom
1.35 jmmv 9844: changes they may have made.</p>
9845:
1.67 hubertf 9846: <div class="sect2" lang="en">
1.35 jmmv 9847: <div class="titlepage">
9848: <div>
9849: <div>
1.67 hubertf 9850: <h3 class="title"><a name=
9851: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9852: <code class="varname">PKG_SYSCONFDIR</code> is
9853: set</h3>
9854: </div>
9855: </div>
9856: </div>
9857:
9858: <p>As said before, the <code class=
9859: "varname">PKG_SYSCONFDIR</code> variable specifies
9860: where configuration files shall be installed. Its
9861: contents are set based upon the following
9862: variables:</p>
9863:
9864: <div class="itemizedlist">
9865: <ul type="disc">
9866: <li>
9867: <p><code class="varname">PKG_SYSCONFBASE</code>:
9868: The configuration's root directory. Defaults to
1.45 wiz 9869: <code xmlns=
9870: "http://www.w3.org/TR/xhtml1/transitional" class=
9871: "filename">${PREFIX}/etc</code> although it may
9872: be overridden by the user to point to his
9873: preferred location (e.g., <code xmlns=
9874: "http://www.w3.org/TR/xhtml1/transitional" class=
9875: "filename">/etc</code>, <code xmlns=
9876: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9877: "filename">/etc/pkg</code>, etc.). Packages must
9878: not use it directly.</p>
9879: </li>
9880:
9881: <li>
9882: <p><code class=
9883: "varname">PKG_SYSCONFSUBDIR</code>: A
9884: subdirectory of <code class=
9885: "varname">PKG_SYSCONFBASE</code> under which the
9886: configuration files for the package being built
9887: shall be installed. The definition of this
9888: variable only makes sense in the package's
1.45 wiz 9889: <code xmlns=
9890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9891: "filename">Makefile</code> (i.e., it is not
9892: user-customizable).</p>
1.35 jmmv 9893:
9894: <p>As an example, consider the Apache package,
9895: <a xmlns=
9896: "http://www.w3.org/TR/xhtml1/transitional" href=
9897: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9898: target="_top"><code xmlns="" class=
9899: "filename">www/apache2</code></a>, which places
9900: its configuration files under the <code xmlns=
9901: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9902: "filename">httpd/</code> subdirectory of
9903: <code class="varname">PKG_SYSCONFBASE</code>.
9904: This should be set in the package Makefile.</p>
9905: </li>
9906:
9907: <li>
9908: <p><code class="varname">PKG_SYSCONFVAR</code>:
9909: Specifies the name of the variable that holds
9910: this package's configuration directory (if
9911: different from <code class=
9912: "varname">PKG_SYSCONFBASE</code>). It defaults to
9913: <code class="varname">PKGBASE</code>'s value, and
9914: is always prefixed with <code class=
9915: "literal">PKG_SYSCONFDIR</code>.</p>
9916: </li>
9917:
9918: <li>
9919: <p><code class=
9920: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9921: Holds the directory where the configuration files
9922: for the package identified by <code class=
9923: "varname">PKG_SYSCONFVAR</code>'s shall be
9924: placed.</p>
9925: </li>
9926: </ul>
9927: </div>
9928:
9929: <p>Based on the above variables, pkginstall determines
9930: the value of <code class=
9931: "varname">PKG_SYSCONFDIR</code>, which is the
9932: <span class="emphasis"><em>only</em></span> variable
9933: that can be used within a package to refer to its
9934: configuration directory. The algorithm used to set its
9935: value is basically the following:</p>
9936:
9937: <div class="orderedlist">
9938: <ol type="1">
9939: <li>
9940: <p>If <code class=
9941: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9942: is set, its value is used.</p>
9943: </li>
9944:
9945: <li>
9946: <p>If the previous variable is not defined but
9947: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9948: set in the package's <code xmlns=
9949: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9950: "filename">Makefile</code>, the resulting value
1.45 wiz 9951: is <code xmlns=
9952: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9953: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9954: </li>
9955:
9956: <li>
1.45 wiz 9957: <p>Otherwise, it is set to <code xmlns=
9958: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9959: "filename">${PKG_SYSCONFBASE}</code>.</p>
9960: </li>
9961: </ol>
9962: </div>
9963:
1.45 wiz 9964: <p>It is worth mentioning that <code xmlns=
9965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9966: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9967: added to <code xmlns=
9968: "http://www.w3.org/TR/xhtml1/transitional" class=
9969: "filename">OWN_DIRS</code>. See <a href=
9970: "#dirs-outside-prefix" title=
1.63 dillo 9971: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9972: “Directory manipulation”</a> what this
9973: means.</p>
9974: </div>
9975:
1.67 hubertf 9976: <div class="sect2" lang="en">
1.35 jmmv 9977: <div class="titlepage">
9978: <div>
9979: <div>
1.67 hubertf 9980: <h3 class="title"><a name=
1.63 dillo 9981: "conf-files-configure"></a>12.2.2. Telling
9982: the software where configuration files are</h3>
1.35 jmmv 9983: </div>
9984: </div>
9985: </div>
9986:
9987: <p>Given that pkgsrc (and users!) expect configuration
9988: files to be in a known place, you need to teach each
1.36 wiz 9989: package where it shall install its files. In some cases
1.35 jmmv 9990: you will have to patch the package Makefiles to achieve
9991: it. If you are lucky, though, it may be as easy as
9992: passing an extra flag to the configuration script; this
1.47 reed 9993: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9994: <pre class="programlisting">
1.51 rillig 9995: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9996: </pre>
9997:
9998: <p>Note that this specifies where the package has to
9999: <span class="emphasis"><em>look for</em></span> its
10000: configuration files, not where they will be originally
10001: installed (although the difference is never explicit,
10002: unfortunately).</p>
10003: </div>
10004:
1.67 hubertf 10005: <div class="sect2" lang="en">
1.35 jmmv 10006: <div class="titlepage">
10007: <div>
10008: <div>
1.67 hubertf 10009: <h3 class="title"><a name=
1.63 dillo 10010: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 10011: installations</h3>
10012: </div>
10013: </div>
10014: </div>
10015:
10016: <p>As said before, pkginstall automatically handles
10017: configuration files. This means that <span class=
10018: "strong"><strong>the packages themselves must not touch
1.45 wiz 10019: the contents of <code xmlns=
10020: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10021: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 10022: directly</strong></span>. Bad news is that many
10023: software installation scripts will, out of the box,
10024: mess with the contents of that directory. So what is
10025: the correct procedure to fix this issue?</p>
1.35 jmmv 10026:
10027: <p>You must teach the package (usually by manually
10028: patching it) to install any configuration files under
1.45 wiz 10029: the examples hierarchy, <code xmlns=
10030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10031: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 10032: the <code xmlns=
10033: "http://www.w3.org/TR/xhtml1/transitional" class=
10034: "filename">PLIST</code> registers them and the
10035: administrator always has the original copies
1.35 jmmv 10036: available.</p>
10037:
10038: <p>Once the required configuration files are in place
10039: (i.e., under the examples hierarchy), the pkginstall
10040: framework can use them as master copies during the
1.45 wiz 10041: package installation to update what is in <code xmlns=
10042: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10043: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
10044: the variables <code class="varname">CONF_FILES</code>
10045: and <code class="varname">CONF_FILES_PERMS</code> are
10046: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 10047: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 10048: “File manipulation”</a> for information
10049: about their syntax and their purpose. Here is an
10050: example, taken from the <a xmlns=
10051: "http://www.w3.org/TR/xhtml1/transitional" href=
10052: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 10053: target="_top"><code xmlns="" class=
10054: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 10055: <pre class="programlisting">
1.51 rillig 10056: EGDIR= ${PREFIX}/share/doc/mutt/samples
10057: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 10058: </pre>
10059:
10060: <p>Note that the <code class="varname">EGDIR</code>
10061: variable is specific to that package and has no meaning
10062: outside it.</p>
10063: </div>
10064:
1.67 hubertf 10065: <div class="sect2" lang="en">
1.35 jmmv 10066: <div class="titlepage">
10067: <div>
10068: <div>
1.67 hubertf 10069: <h3 class="title"><a name=
10070: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 10071: handling of configuration files</h3>
10072: </div>
10073: </div>
10074: </div>
10075:
10076: <p>The automatic copying of config files can be toggled
10077: by setting the environment variable <code class=
10078: "varname">PKG_CONFIG</code> prior to package
10079: installation.</p>
10080: </div>
10081: </div>
10082:
1.67 hubertf 10083: <div class="sect1" lang="en">
1.35 jmmv 10084: <div class="titlepage">
10085: <div>
10086: <div>
10087: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10088: "rcd-scripts"></a>12.3. System startup
10089: scripts</h2>
1.35 jmmv 10090: </div>
10091: </div>
10092: </div>
10093:
10094: <p>System startup scripts are special files because they
10095: must be installed in a place known by the underlying OS,
10096: usually outside the installation prefix. Therefore, the
10097: same rules described in <a href=
10098: "#files-and-dirs-outside-prefix" title=
1.38 dillo 10099: "12.1. Files and directories outside the installation prefix">
1.63 dillo 10100: Section 12.1, “Files and directories outside
10101: the installation prefix”</a> apply, and the same
1.35 jmmv 10102: solutions can be used. However, pkginstall provides a
1.36 wiz 10103: special mechanism to handle these files.</p>
1.35 jmmv 10104:
10105: <p>In order to provide system startup scripts, the
10106: package has to:</p>
10107:
10108: <div class="orderedlist">
10109: <ol type="1">
10110: <li>
1.45 wiz 10111: <p>Store the script inside <code xmlns=
10112: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10113: "filename">${FILESDIR}</code>, with the
10114: <code class="literal">.sh</code> suffix appended.
10115: Considering the <a xmlns=
10116: "http://www.w3.org/TR/xhtml1/transitional" href=
10117: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 10118: target="_top"><code xmlns="" class=
10119: "filename">print/cups</code></a> package as an
10120: example, it has a <code xmlns=
10121: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10122: "filename">cupsd.sh</code> in its files
10123: directory.</p>
10124: </li>
10125:
10126: <li>
10127: <p>Tell pkginstall to handle it, appending the name
10128: of the script, without its extension, to the
10129: <code class="varname">RCD_SCRIPTS</code> variable.
10130: Continuing the previous example:</p>
10131: <pre class="programlisting">
1.51 rillig 10132: RCD_SCRIPTS+= cupsd
1.35 jmmv 10133: </pre>
10134: </li>
10135: </ol>
10136: </div>
10137:
10138: <p>Once this is done, pkginstall will do the following
10139: steps for each script in an automated fashion:</p>
10140:
10141: <div class="orderedlist">
10142: <ol type="1">
10143: <li>
10144: <p>Process the file found in the files directory
10145: applying all the substitutions described in the
1.45 wiz 10146: <code xmlns=
10147: "http://www.w3.org/TR/xhtml1/transitional" class=
10148: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 10149: </li>
10150:
10151: <li>
10152: <p>Copy the script from the files directory to the
1.45 wiz 10153: examples hierarchy, <code xmlns=
10154: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10155: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 10156: Note that this master file must be explicitly
1.45 wiz 10157: registered in the <code xmlns=
10158: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10159: "filename">PLIST</code>.</p>
10160: </li>
10161:
10162: <li>
10163: <p>Add code to the installation scripts to copy the
10164: startup script from the examples hierarchy into the
10165: system-wide startup scripts directory.</p>
10166: </li>
10167: </ol>
10168: </div>
10169:
1.67 hubertf 10170: <div class="sect2" lang="en">
1.35 jmmv 10171: <div class="titlepage">
10172: <div>
10173: <div>
1.67 hubertf 10174: <h3 class="title"><a name=
1.63 dillo 10175: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 10176: handling of system startup scripts</h3>
10177: </div>
10178: </div>
10179: </div>
10180:
10181: <p>The automatic copying of config files can be toggled
10182: by setting the environment variable <code class=
10183: "varname">PKG_RCD_SCRIPTS</code> prior to package
10184: installation. Note that the scripts will be always
1.45 wiz 10185: copied inside the examples hierarchy, <code xmlns=
10186: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10187: "filename">${PREFIX}/share/examples/rc.d/</code>, no
10188: matter what the value of this variable is.</p>
10189: </div>
10190: </div>
10191:
1.67 hubertf 10192: <div class="sect1" lang="en">
1.35 jmmv 10193: <div class="titlepage">
10194: <div>
10195: <div>
10196: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10197: "users-and-groups"></a>12.4. System users and
10198: groups</h2>
1.35 jmmv 10199: </div>
10200: </div>
10201: </div>
10202:
10203: <p>If a package needs to create special users and/or
10204: groups during installation, it can do so by using the
10205: pkginstall framework.</p>
10206:
10207: <p>Users can be created by adding entries to the
10208: <code class="varname">PKG_USERS</code> variable. Each
1.72 rillig 10209: entry has the following syntax:</p>
1.35 jmmv 10210: <pre class="programlisting">
1.72 rillig 10211: user:group
1.35 jmmv 10212: </pre>
10213:
1.72 rillig 10214: <p>Further specification of user details may be done by
10215: setting per-user variables. <code class=
10216: "varname">PKG_UID.<em class=
10217: "replaceable"><code>user</code></em></code> is the
10218: numeric UID for the user. <code class=
10219: "varname">PKG_GECOS.<em class=
10220: "replaceable"><code>user</code></em></code> is the user's
10221: description or comment. <code class=
10222: "varname">PKG_HOME.<em class=
10223: "replaceable"><code>user</code></em></code> is the user's
10224: home directory, and defaults to <code xmlns=
10225: "http://www.w3.org/TR/xhtml1/transitional" class=
10226: "filename">/nonexistent</code> if not specified.
10227: <code class="varname">PKG_SHELL.<em class=
10228: "replaceable"><code>user</code></em></code> is the user's
10229: shell, and defaults to <code xmlns=
10230: "http://www.w3.org/TR/xhtml1/transitional" class=
10231: "filename">/sbinno/login</code> if not specified.</p>
10232:
10233: <p>Similarly, groups can be created by adding entries to
10234: the <code class="varname">PKG_GROUPS</code> variable,
10235: whose syntax is:</p>
1.35 jmmv 10236: <pre class="programlisting">
1.72 rillig 10237: group
1.35 jmmv 10238: </pre>
10239:
1.72 rillig 10240: <p>The numeric GID of the group may be set by defining
10241: <code class="varname">PKG_GID.<em class=
10242: "replaceable"><code>group</code></em></code>.</p>
10243:
10244: <p>If a package needs to create the users and groups at
10245: an earlier stage, then it can set <code class=
10246: "varname">USERGROUP_PHASE</code> to either <code class=
10247: "literal">configure</code> or <code class=
10248: "literal">build</code> to indicate the phase before which
10249: the users and groups are created. In this case, the
10250: numeric UIDs and GIDs of the created users and groups are
10251: automatically hardcoded into the final installation
10252: scripts.</p>
1.35 jmmv 10253: </div>
10254:
1.67 hubertf 10255: <div class="sect1" lang="en">
1.35 jmmv 10256: <div class="titlepage">
10257: <div>
10258: <div>
10259: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10260: "shells"></a>12.5. System shells</h2>
1.35 jmmv 10261: </div>
10262: </div>
10263: </div>
10264:
10265: <p>Packages that install system shells should register
1.45 wiz 10266: them in the shell database, <code xmlns=
10267: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10268: "filename">/etc/shells</code>, to make things easier to
10269: the administrator. This must be done from the
10270: installation scripts to keep binary packages working on
10271: any system. pkginstall provides an easy way to accomplish
10272: this task.</p>
10273:
10274: <p>When a package provides a shell interpreter, it has to
10275: set the <code class="varname">PKG_SHELL</code> variable
10276: to its absolute file name. This will add some hooks to
10277: the installation scripts to handle it. Consider the
10278: following example, taken from <a xmlns=
10279: "http://www.w3.org/TR/xhtml1/transitional" href=
10280: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 10281: target="_top"><code xmlns="" class=
10282: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 10283: <pre class="programlisting">
1.51 rillig 10284: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 10285: </pre>
10286:
1.67 hubertf 10287: <div class="sect2" lang="en">
1.35 jmmv 10288: <div class="titlepage">
10289: <div>
10290: <div>
1.67 hubertf 10291: <h3 class="title"><a name=
10292: "shells-disable"></a>12.5.1. Disabling shell
1.65 hubertf 10293: registration</h3>
1.35 jmmv 10294: </div>
10295: </div>
10296: </div>
10297:
10298: <p>The automatic registration of shell interpreters can
10299: be disabled by the administrator by setting the
1.45 wiz 10300: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10301: class="filename">PKG_REGISTER_SHELLS</code> environment
10302: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 10303: </div>
10304: </div>
1.65 hubertf 10305:
1.67 hubertf 10306: <div class="sect1" lang="en">
1.65 hubertf 10307: <div class="titlepage">
10308: <div>
10309: <div>
10310: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 10311: "fonts"></a>12.6. Fonts</h2>
1.65 hubertf 10312: </div>
10313: </div>
10314: </div>
10315:
10316: <p>Packages that install X11 fonts should update the
10317: database files that index the fonts within each fonts
10318: directory. This can easily be accomplished within the
10319: pkginstall framework.</p>
10320:
10321: <p>When a package installs X11 fonts, it must list the
10322: directories in which fonts are installed in the
10323: <code class="varname">FONTS_DIRS.<em class=
10324: "replaceable"><code>type</code></em></code> variables,
10325: where <em class="replaceable"><code>type</code></em> can
10326: be one of “<span class="quote">ttf</span>”,
10327: “<span class="quote">type1</span>” or
10328: “<span class="quote">x11</span>”. This will
10329: add hooks to the installation scripts to run the
10330: appropriate commands to update the fonts database files
10331: within each of those directories. For convenience, if the
10332: directory path is relative, it is taken to be relative to
10333: the package's installation prefix. Consider the following
10334: example, taken from <a xmlns=
10335: "http://www.w3.org/TR/xhtml1/transitional" href=
10336: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
10337: target="_top"><code xmlns="" class=
10338: "filename">fonts/dbz-ttf</code></a>:</p>
10339: <pre class="programlisting">
10340: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
10341: </pre>
10342:
1.67 hubertf 10343: <div class="sect2" lang="en">
1.65 hubertf 10344: <div class="titlepage">
10345: <div>
10346: <div>
1.67 hubertf 10347: <h3 class="title"><a name=
10348: "fonts-disable"></a>12.6.1. Disabling
10349: automatic update of the fonts databases</h3>
1.65 hubertf 10350: </div>
10351: </div>
10352: </div>
10353:
10354: <p>The automatic update of fonts databases can be
10355: disabled by the administrator by setting the
10356: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10357: class="filename">PKG_UPDATE_FONTS_DB</code> environment
10358: variable to <code class="literal">NO</code>.</p>
10359: </div>
10360: </div>
1.35 jmmv 10361: </div>
10362:
1.67 hubertf 10363: <div class="chapter" lang="en">
1.35 jmmv 10364: <div class="titlepage">
10365: <div>
10366: <div>
1.67 hubertf 10367: <h2 class="title"><a name=
1.38 dillo 10368: "options"></a>Chapter 13. Options
1.35 jmmv 10369: handling</h2>
10370: </div>
10371: </div>
10372: </div>
10373:
10374: <div class="toc">
10375: <p><b>Table of Contents</b></p>
10376:
10377: <dl>
10378: <dt><span class="sect1"><a href=
1.38 dillo 10379: "#global-default-options">13.1. Global default
1.35 jmmv 10380: options</a></span></dt>
10381:
10382: <dt><span class="sect1"><a href=
1.38 dillo 10383: "#converting-to-options">13.2. Converting packages to
1.45 wiz 10384: use <code xmlns=
10385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10386: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 10387:
10388: <dt><span class="sect1"><a href="#option-names">13.3.
10389: Option Names</a></span></dt>
1.35 jmmv 10390: </dl>
10391: </div>
10392:
10393: <p>Many packages have the ability to be built to support
1.45 wiz 10394: different sets of features. <code xmlns=
10395: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10396: "filename">bsd.options.mk</code> is a framework in pkgsrc
10397: that provides generic handling of those options that
10398: determine different ways in which the packages can be
10399: built. It's possible for the user to specify exactly which
10400: sets of options will be built into a package or to allow a
10401: set of global default options apply.</p>
10402:
1.67 hubertf 10403: <div class="sect1" lang="en">
1.35 jmmv 10404: <div class="titlepage">
10405: <div>
10406: <div>
10407: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10408: "global-default-options"></a>13.1. Global
1.35 jmmv 10409: default options</h2>
10410: </div>
10411: </div>
10412: </div>
10413:
10414: <p>Global default options are listed in <code class=
10415: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
10416: the options that should be built into every package if
10417: that option is supported. This variable should be set in
1.45 wiz 10418: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10419: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 10420: </div>
10421:
1.67 hubertf 10422: <div class="sect1" lang="en">
1.35 jmmv 10423: <div class="titlepage">
10424: <div>
10425: <div>
10426: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10427: "converting-to-options"></a>13.2. Converting
1.45 wiz 10428: packages to use <code xmlns=
10429: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10430: "filename">bsd.options.mk</code></h2>
10431: </div>
10432: </div>
10433: </div>
10434:
1.45 wiz 10435: <p>The following example shows how <code xmlns=
10436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10437: "filename">bsd.options.mk</code> should be used by the
10438: hypothetical ``wibble'' package, either in the package
1.45 wiz 10439: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10440: class="filename">Makefile</code>, or in a file, e.g.
10441: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10442: class="filename">options.mk</code>, that is included by
10443: the main package <code xmlns=
10444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10445: "filename">Makefile</code>.</p>
10446: <pre class="programlisting">
1.73 ! rillig 10447: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
! 10448: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
! 10449: PKG_OPTIONS_OPTIONAL_GROUPS= database
! 10450: PKG_OPTIONS_GROUP.database= mysql pgsql
! 10451: PKG_SUGGESTED_OPTIONS= wibble-foo
! 10452: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
! 10453: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
1.51 rillig 10454:
10455: .include "../../mk/bsd.prefs.mk"
10456:
10457: # this package was previously named wibble2
10458: .if defined(PKG_OPTIONS.wibble2)
1.73 ! rillig 10459: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.51 rillig 10460: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
1.73 ! rillig 10461: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR instead."
1.51 rillig 10462: .endif
10463:
10464: .include "../../mk/bsd.options.mk"
10465:
10466: # Package-specific option-handling
10467:
10468: ###
10469: ### FOO support
10470: ###
10471: .if !empty(PKG_OPTIONS:Mwibble-foo)
10472: CONFIGURE_ARGS+= --enable-foo
10473: .endif
10474:
10475: ###
10476: ### LDAP support
10477: ###
10478: .if !empty(PKG_OPTIONS:Mldap)
10479: . include "../../databases/openldap/buildlink3.mk"
10480: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10481: .endif
10482:
10483: ###
10484: ### database support
10485: ###
10486: .if !empty(PKG_OPTIONS:Mmysql)
10487: . include "../../mk/mysql.buildlink3.mk"
10488: .endif
10489: .if !empty(PKG_OPTIONS:Mpgsql)
10490: . include "../../mk/pgsql.buildlink3.mk"
10491: .endif
1.1 grant 10492: </pre>
10493:
1.28 rillig 10494: <p>The first section contains the information about which
10495: build options are supported by the package, and any
1.1 grant 10496: default options settings if needed.</p>
10497:
10498: <div class="orderedlist">
10499: <ol type="1">
10500: <li>
1.14 xtraeme 10501: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10502: the name of the <a href=
1.1 grant 10503: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10504: <span class="citerefentry"><span class=
1.27 rillig 10505: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10506: that the user can set to override the default
1.57 minskim 10507: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10508: "replaceable"><code>pkgbase</code></em>. Do not set
10509: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10510: "varname">PKGBASE</code> is set after <code class=
10511: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10512: </li>
10513:
10514: <li>
1.14 xtraeme 10515: <p><code class=
10516: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10517: build options supported by the package.</p>
10518: </li>
10519:
10520: <li>
10521: <p><code class=
10522: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10523: list of names of groups of mutually exclusive
10524: options. The options in each group are listed in
10525: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10526: "replaceable"><code>groupname</code></em></code>.
10527: The most specific setting of any option from the
10528: group takes precedence over all other options in
10529: the group. Options from the groups will be
10530: automatically added to <code class=
10531: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10532: </li>
10533:
10534: <li>
10535: <p><code class=
10536: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10537: like <code class=
10538: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10539: building the packages will fail if no option from
10540: the group is selected.</p>
1.1 grant 10541: </li>
10542:
10543: <li>
1.27 rillig 10544: <p><code class=
1.44 gdt 10545: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10546: list of names of sets of options. At least one
10547: option from each set must be selected. The options
10548: in each set are listed in <code class=
10549: "varname">PKG_OPTIONS_SET.<em class=
10550: "replaceable"><code>setname</code></em></code>.
10551: Options from the sets will be automatically added
10552: to <code class=
10553: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10554: the package will fail if no option from the set is
10555: selected.</p>
10556: </li>
10557:
10558: <li>
10559: <p><code class=
1.27 rillig 10560: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10561: build options which are enabled by default.</p>
10562: </li>
10563:
10564: <li>
1.37 dillo 10565: <p><code class=
10566: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10567: of “<span class="quote"><em class=
1.67 hubertf 10568: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10569: pairs that map legacy <code xmlns=
1.45 wiz 10570: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10571: "filename">/etc/mk.conf</code> variables to their
10572: option counterparts. Pairs should be added with
10573: “<span class="quote">+=</span>” to keep
10574: the listing of global legacy variables. A warning
10575: will be issued if the user uses a legacy
10576: variable.</p>
10577: </li>
1.1 grant 10578:
1.37 dillo 10579: <li>
10580: <p><code class=
10581: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10582: of “<span class="quote"><em class=
1.67 hubertf 10583: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10584: pairs that map options that have been renamed to
10585: their new counterparts. Pairs should be added with
1.37 dillo 10586: “<span class="quote">+=</span>” to keep
10587: the listing of global legacy options. A warning
10588: will be issued if the user uses a legacy
10589: option.</p>
10590: </li>
1.1 grant 10591:
1.37 dillo 10592: <li>
10593: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10594: is a list of options implied by deprecated
10595: variables used. This can be used for cases that
10596: neither <code class=
10597: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10598: <code class=
10599: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10600: handle, e. g. when <code class=
10601: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10602: </li>
10603:
10604: <li>
1.37 dillo 10605: <p><code class=
10606: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10607: a list of warnings about deprecated variables or
10608: options used, and what to use instead.</p>
1.1 grant 10609: </li>
1.28 rillig 10610: </ol>
1.1 grant 10611: </div>
10612:
1.37 dillo 10613: <p>A package should never modify <code class=
10614: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10615: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10616: These are strictly user-settable. To suggest a default
10617: set of options, use <code class=
10618: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10619:
1.42 dillo 10620: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10621: defined before including <code xmlns=
10622: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10623: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10624: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10625: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10626: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10627: are defined (as can happen with platform-specific options
1.42 dillo 10628: if none of them is supported on the current platform),
10629: <code class="varname">PKG_OPTIONS</code> is set to the
10630: empty list and the package is otherwise treated as not
10631: using the options framework.</p>
1.37 dillo 10632:
1.45 wiz 10633: <p>After the inclusion of <code xmlns=
10634: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10635: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10636: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10637: list of selected build options, properly filtered to
1.28 rillig 10638: remove unsupported and duplicate options.</p>
10639:
1.1 grant 10640: <p>The remaining sections contain the logic that is
1.37 dillo 10641: specific to each option. The correct way to check for an
10642: option is to check whether it is listed in <code class=
10643: "varname">PKG_OPTIONS</code>:</p>
10644: <pre class="programlisting">
1.51 rillig 10645: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10646: "replaceable"><code>option</code></em>)
10647: </pre>
1.48 dillo 10648: </div>
1.37 dillo 10649:
1.67 hubertf 10650: <div class="sect1" lang="en">
1.48 dillo 10651: <div class="titlepage">
10652: <div>
10653: <div>
10654: <h2 class="title" style="clear: both"><a name=
10655: "option-names"></a>13.3. Option Names</h2>
10656: </div>
10657: </div>
10658: </div>
10659:
10660: <p>Options that enable similar features in different
10661: packages (like optional support for a library) should use
10662: a common name in all packages that support it (like the
10663: name of the library). If another package already has an
10664: option with the same meaning, use the same name.</p>
10665:
10666: <p>Options that enable features specific to one package,
10667: where it's unlikely that another (unrelated) package has
10668: the same (or a similar) optional feature, should use a
10669: name prefixed with <code class="varname"><em class=
10670: "replaceable"><code>pkgname</code></em>-</code>.</p>
10671:
10672: <p>If a group of related packages share an optional
10673: feature specific to that group, prefix it with the name
10674: of the “<span class="quote">main</span>”
10675: package (e. g. <code class=
10676: "varname">djbware-errno-hack</code>).</p>
10677:
10678: <p>For new options, add a line to <code xmlns=
10679: "http://www.w3.org/TR/xhtml1/transitional" class=
10680: "filename">mk/defaults/options.description</code>. Lines
10681: have two fields, separated by tab. The first field is the
10682: option name, the second its description. The description
10683: should be a whole sentence (starting with an uppercase
10684: letter and ending with a period) that describes what
10685: enabling the option does. E. g. “<span class=
10686: "quote">Enable ispell support.</span>” The file is
10687: sorted by option names.</p>
1.1 grant 10688: </div>
10689: </div>
10690:
1.67 hubertf 10691: <div class="chapter" lang="en">
1.1 grant 10692: <div class="titlepage">
10693: <div>
10694: <div>
1.67 hubertf 10695: <h2 class="title"><a name=
1.38 dillo 10696: "build"></a>Chapter 14. The build
1.1 grant 10697: process</h2>
10698: </div>
10699: </div>
10700: </div>
10701:
10702: <div class="toc">
10703: <p><b>Table of Contents</b></p>
10704:
10705: <dl>
1.56 rillig 10706: <dt><span class="sect1"><a href="#build.intro">14.1.
10707: Introduction</a></span></dt>
10708:
10709: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10710: Program location</a></span></dt>
10711:
1.56 rillig 10712: <dt><span class="sect1"><a href=
10713: "#build.builddirs">14.3. Directories used during the
10714: build process</a></span></dt>
10715:
10716: <dt><span class="sect1"><a href="#build.running">14.4.
10717: Running a phase</a></span></dt>
10718:
10719: <dt><span class="sect1"><a href="#build.fetch">14.5.
10720: The <span class="emphasis"><em>fetch</em></span>
10721: phase</a></span></dt>
10722:
10723: <dt><span class="sect1"><a href="#build.checksum">14.6.
10724: The <span class="emphasis"><em>checksum</em></span>
10725: phase</a></span></dt>
10726:
10727: <dt><span class="sect1"><a href="#build.extract">14.7.
10728: The <span class="emphasis"><em>extract</em></span>
10729: phase</a></span></dt>
10730:
10731: <dt><span class="sect1"><a href="#build.patch">14.8.
10732: The <span class="emphasis"><em>patch</em></span>
10733: phase</a></span></dt>
10734:
10735: <dt><span class="sect1"><a href="#build.tools">14.9.
10736: The <span class="emphasis"><em>tools</em></span>
10737: phase</a></span></dt>
10738:
10739: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10740: The <span class="emphasis"><em>wrapper</em></span>
10741: phase</a></span></dt>
1.1 grant 10742:
10743: <dt><span class="sect1"><a href=
1.56 rillig 10744: "#build.configure">14.11. The <span class=
10745: "emphasis"><em>configure</em></span>
10746: phase</a></span></dt>
10747:
10748: <dt><span class="sect1"><a href="#build.build">14.12.
10749: The <span class="emphasis"><em>build</em></span>
10750: phase</a></span></dt>
10751:
10752: <dt><span class="sect1"><a href="#build.test">14.13.
10753: The <span class="emphasis"><em>test</em></span>
10754: phase</a></span></dt>
10755:
10756: <dt><span class="sect1"><a href="#build.install">14.14.
10757: The <span class="emphasis"><em>install</em></span>
10758: phase</a></span></dt>
10759:
10760: <dt><span class="sect1"><a href="#build.package">14.15.
10761: The <span class="emphasis"><em>package</em></span>
10762: phase</a></span></dt>
10763:
10764: <dt><span class="sect1"><a href=
10765: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10766: targets</a></span></dt>
10767: </dl>
10768: </div>
10769:
1.67 hubertf 10770: <div class="sect1" lang="en">
1.56 rillig 10771: <div class="titlepage">
10772: <div>
10773: <div>
10774: <h2 class="title" style="clear: both"><a name=
10775: "build.intro"></a>14.1. Introduction</h2>
10776: </div>
10777: </div>
10778: </div>
10779:
10780: <p>This chapter gives a detailed description on how a
10781: package is built. Building a package is separated into
10782: different <span class="emphasis"><em>phases</em></span>
10783: (for example <code class="varname">fetch</code>,
10784: <code class="varname">build</code>, <code class=
10785: "varname">install</code>), all of which are described in
10786: the following sections. Each phase is splitted into
10787: so-called <span class="emphasis"><em>stages</em></span>,
1.66 rillig 10788: which take the name of the containing phase, prefixed by
1.56 rillig 10789: one of <code class="varname">pre-</code>, <code class=
10790: "varname">do-</code> or <code class=
10791: "varname">post-</code>. (Examples are <code class=
10792: "varname">pre-configure</code>, <code class=
10793: "varname">post-build</code>.) Most of the actual work is
10794: done in the <code class="varname">do-*</code> stages.</p>
10795:
10796: <p>The basic steps for building a program are always the
10797: same. First the program's source (<span class=
10798: "emphasis"><em>distfile</em></span>) must be brought to
1.66 rillig 10799: the local system and then extracted. After any
10800: pkgsrc-specific patches to compile properly are applied,
10801: the software can be configured, then built (usually by
10802: compiling), and finally the generated binaries, etc. can
10803: be put into place on the system.</p>
1.56 rillig 10804: </div>
1.1 grant 10805:
1.67 hubertf 10806: <div class="sect1" lang="en">
1.1 grant 10807: <div class="titlepage">
10808: <div>
10809: <div>
10810: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10811: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10812: </div>
10813: </div>
10814: </div>
10815:
10816: <p>Before outlining the process performed by the NetBSD
10817: package system in the next section, here's a brief
10818: discussion on where programs are installed, and which
10819: variables influence this.</p>
10820:
1.14 xtraeme 10821: <p>The automatic variable <code class=
10822: "varname">PREFIX</code> indicates where all files of the
10823: final program shall be installed. It is usually set to
1.45 wiz 10824: <code class="varname">LOCALBASE</code> (<code xmlns=
10825: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10826: "filename">/usr/pkg</code>), or <code class=
10827: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10828: “<span class="quote">cross</span>” category.
1.14 xtraeme 10829: The value of <code class="varname">PREFIX</code> needs to
10830: be put into the various places in the program's source
10831: where paths to these files are encoded. See <a href=
1.1 grant 10832: "#components.patches" title=
1.38 dillo 10833: "8.3. patches/*">Section 8.3,
1.1 grant 10834: “patches/*”</a> and <a href="#fixes.libtool"
10835: title=
1.68 rillig 10836: "16.3.1. Shared libraries - libtool">Section 16.3.1,
1.1 grant 10837: “Shared libraries - libtool”</a> for more
10838: details.</p>
10839:
10840: <p>When choosing which of these variables to use, follow
10841: the following rules:</p>
10842:
10843: <div class="itemizedlist">
10844: <ul type="disc">
10845: <li>
1.14 xtraeme 10846: <p><code class="varname">PREFIX</code> always
10847: points to the location where the current pkg will
10848: be installed. When referring to a pkg's own
1.1 grant 10849: installation path, use “<span class=
10850: "quote">${PREFIX}</span>”.</p>
10851: </li>
10852:
10853: <li>
1.14 xtraeme 10854: <p><code class="varname">LOCALBASE</code> is where
10855: all non-X11 pkgs are installed. If you need to
1.1 grant 10856: construct a -I or -L argument to the compiler to
10857: find includes and libraries installed by another
10858: non-X11 pkg, use “<span class=
10859: "quote">${LOCALBASE}</span>”.</p>
10860: </li>
10861:
10862: <li>
1.14 xtraeme 10863: <p><code class="varname">X11BASE</code> is where
10864: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10865: installed. When looking for <span class=
10866: "emphasis"><em>standard</em></span> X11 includes
10867: (not those installed by a pkg), use
10868: “<span class=
10869: "quote">${X11BASE}</span>”.</p>
10870: </li>
10871:
10872: <li>
1.47 reed 10873: <p>X11-based packages are special in that they may
10874: be installed in either <code class=
1.14 xtraeme 10875: "varname">X11BASE</code> or <code class=
10876: "varname">LOCALBASE</code>.</p>
1.1 grant 10877:
10878: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10879: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10880: possible. Note that you will need to include
1.45 wiz 10881: <code xmlns=
10882: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10883: "filename">../../mk/x11.buildlink3.mk</code> in
10884: them to request the presence of X11 and to get the
10885: right compilation flags.</p>
1.1 grant 10886:
10887: <p>Even though, there are some packages that cannot
1.14 xtraeme 10888: be installed under <code class=
10889: "varname">LOCALBASE</code>: those that come with
1.1 grant 10890: app-defaults files. These packages are special and
1.14 xtraeme 10891: they must be placed under <code class=
10892: "varname">X11BASE</code>. To accomplish this, set
10893: either <code class="varname">USE_X11BASE</code> or
10894: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10895: package.</p>
10896:
1.34 wiz 10897: <p>Some notes: If you need to find includes or
1.14 xtraeme 10898: libraries installed by a pkg that has <code class=
10899: "varname">USE_IMAKE</code> or <code class=
10900: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10901: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10902: class="filename">Makefile</code>, you need to look
10903: in <span class="emphasis"><em>both</em></span>
10904: <code xmlns=
10905: "http://www.w3.org/TR/xhtml1/transitional" class=
10906: "filename">${X11BASE}</code> and <code xmlns=
10907: "http://www.w3.org/TR/xhtml1/transitional" class=
10908: "filename">${LOCALBASE}</code>. To force
10909: installation of all X11 packages in <code class=
10910: "varname">LOCALBASE</code>, the <a xmlns=
10911: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10912: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10913: target="_top"><code xmlns="" class=
10914: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10915: enabled by default.</p>
1.1 grant 10916: </li>
10917:
10918: <li>
1.14 xtraeme 10919: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10920: used to refer to the installed location of an X11
1.14 xtraeme 10921: package. <code class="varname">X11PREFIX</code>
10922: will be set to <code class="varname">X11BASE</code>
10923: if xpkgwedge is not installed, and to <code class=
10924: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10925: installed.</p>
10926: </li>
10927:
10928: <li>
10929: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10930: have some packages installed in <code class=
10931: "varname">X11BASE</code> and some in <code class=
10932: "varname">LOCALBASE</code>. To determine the prefix
10933: of an installed package, the <code class=
10934: "varname">EVAL_PREFIX</code> definition can be
10935: used. It takes pairs in the format
10936: “<span class=
1.1 grant 10937: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10938: the <a href=
10939: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10940: <span class="citerefentry"><span class=
10941: "refentrytitle">make</span>(1)</span></a> variable
10942: <code class="varname">DIRNAME</code> will be set to
10943: the prefix of the installed package
10944: <package>, or “<span class=
1.1 grant 10945: "quote">${X11PREFIX}</span>” if the package
10946: is not installed.</p>
10947:
10948: <p>This is best illustrated by example.</p>
10949:
1.45 wiz 10950: <p>The following lines are taken from <code xmlns=
10951: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10952: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10953: <pre class="programlisting">
1.51 rillig 10954: EVAL_PREFIX+= GTKDIR=gtk+
1.69 rillig 10955: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
10956: CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
10957: CONFIGURE_ARGS+= --enable-multibyte
1.1 grant 10958: </pre>
10959:
10960: <p>Specific defaults can be defined for the
1.14 xtraeme 10961: packages evaluated using <code class=
10962: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10963: of the form:</p>
10964: <pre class="programlisting">
1.51 rillig 10965: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10966: </pre>
10967:
1.14 xtraeme 10968: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10969: corresponds to the first definition in the
1.14 xtraeme 10970: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10971: </li>
10972:
10973: <li>
1.45 wiz 10974: <p>Within <code xmlns=
10975: "http://www.w3.org/TR/xhtml1/transitional" class=
10976: "filename">${PREFIX}</code>, packages should
10977: install files according to <a href=
1.24 wiz 10978: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10979: <span class="citerefentry"><span class=
10980: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10981: exception that manual pages go into <code xmlns=
10982: "http://www.w3.org/TR/xhtml1/transitional" class=
10983: "filename">${PREFIX}/man</code>, not <code xmlns=
10984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10985: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10986: </li>
10987: </ul>
10988: </div>
10989: </div>
10990:
1.67 hubertf 10991: <div class="sect1" lang="en">
1.1 grant 10992: <div class="titlepage">
10993: <div>
10994: <div>
10995: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10996: "build.builddirs"></a>14.3. Directories used
10997: during the build process</h2>
1.1 grant 10998: </div>
10999: </div>
11000: </div>
11001:
1.56 rillig 11002: <p>When building a package, a number of directories is
11003: used to store source files, temporary files,
11004: pkgsrc-internal files, and so on. These directories are
11005: explained here.</p>
11006:
11007: <p>Some of the directory variables contain relative
11008: pathnames. There are two common base directories for
11009: these relative directories: <code class=
11010: "varname">PKGSRCDIR/PKGPATH</code> is used for
11011: directories that are pkgsrc-specific. <code class=
11012: "varname">WRKSRC</code> is used for directories inside
1.66 rillig 11013: the package itself.</p>
1.1 grant 11014:
11015: <div class="variablelist">
11016: <dl>
1.56 rillig 11017: <dt><span class="term"><code class=
1.66 rillig 11018: "varname">PKGSRCDIR</code></span></dt>
1.56 rillig 11019:
11020: <dd>
11021: <p>This is an absolute pathname that points to the
11022: pkgsrc root directory. Generally, you don't need
11023: it.</p>
11024: </dd>
11025:
11026: <dt><span class="term"><code class=
1.66 rillig 11027: "varname">PKGPATH</code></span></dt>
1.1 grant 11028:
11029: <dd>
1.56 rillig 11030: <p>This is a pathname relative to <code class=
11031: "varname">PKGSRCDIR</code> that points to the
11032: current package.</p>
11033: </dd>
11034:
11035: <dt><span class="term"><code class=
1.66 rillig 11036: "varname">WRKDIR</code></span></dt>
1.56 rillig 11037:
11038: <dd>
11039: <p>This is an absolute pathname pointing to the
1.57 minskim 11040: directory where all work takes place. The distfiles
11041: are extraced to this directory. It also contains
11042: temporary directories and log files used by the
11043: various pkgsrc frameworks, like <span class=
11044: "emphasis"><em>buildlink</em></span> or the
11045: <span class=
1.56 rillig 11046: "emphasis"><em>wrappers</em></span>.</p>
11047: </dd>
11048:
11049: <dt><span class="term"><code class=
1.66 rillig 11050: "varname">WRKSRC</code></span></dt>
1.56 rillig 11051:
11052: <dd>
11053: <p>This is an absolute pathname pointing to the
11054: directory where the distfiles are extracted. It is
11055: usually a direct subdirectory of <code class=
11056: "varname">WRKDIR</code>, and often it's the only
1.66 rillig 11057: directory entry that isn't hidden. This variable
11058: may be changed by a package <code xmlns=
11059: "http://www.w3.org/TR/xhtml1/transitional" class=
11060: "filename">Makefile</code>.</p>
1.56 rillig 11061: </dd>
11062: </dl>
11063: </div>
11064: </div>
11065:
1.67 hubertf 11066: <div class="sect1" lang="en">
1.56 rillig 11067: <div class="titlepage">
11068: <div>
11069: <div>
11070: <h2 class="title" style="clear: both"><a name=
11071: "build.running"></a>14.4. Running a phase</h2>
11072: </div>
11073: </div>
11074: </div>
11075:
11076: <p>You can run a particular phase by typing
11077: <span><strong class="command">make phase</strong></span>,
11078: where <span class="emphasis"><em>phase</em></span> is the
11079: name of the phase. This will automatically run all phases
11080: that are required for this phase. The default phase is
11081: <code class="varname">build</code>, that is, when you run
11082: <span><strong class="command">make</strong></span>
11083: without parameters in a package directory, the package
11084: will be built, but not installed.</p>
11085: </div>
11086:
1.67 hubertf 11087: <div class="sect1" lang="en">
1.56 rillig 11088: <div class="titlepage">
11089: <div>
11090: <div>
11091: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11092: "build.fetch"></a>14.5. The <span class=
11093: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 11094: </div>
11095: </div>
11096: </div>
11097:
11098: <p>This will check if the file(s) given in the variables
11099: <code class="varname">DISTFILES</code> and <code class=
11100: "varname">PATCHFILES</code> (as defined in the package's
11101: Makefile) are present on the local system in <code xmlns=
11102: "http://www.w3.org/TR/xhtml1/transitional" class=
11103: "filename">/usr/pkgsrc/distfiles</code>. If they are not
11104: present, an attempt will be made to fetch them using
11105: commands of the form:</p>
11106: <pre class="programlisting">
1.51 rillig 11107: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 11108: </pre>
11109:
1.56 rillig 11110: <p>where ${site} varies through several possibilities in
11111: turn: first, <code class=
11112: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
11113: sites specified in either <code class=
1.72 rillig 11114: "varname">SITES.file</code> if defined, else <code class=
1.56 rillig 11115: "varname">MASTER_SITES</code> or <code class=
11116: "varname">PATCH_SITES</code>, as applies, then finally
11117: the value of <code class=
11118: "varname">MASTER_SITE_BACKUP</code>. The order of all
11119: except the first can be optionally sorted by the user,
11120: via setting either <code class=
11121: "varname">MASTER_SORT_AWK</code> or <code class=
11122: "varname">MASTER_SORT_REGEX</code>.</p>
11123: </div>
11124:
1.67 hubertf 11125: <div class="sect1" lang="en">
1.56 rillig 11126: <div class="titlepage">
11127: <div>
11128: <div>
11129: <h2 class="title" style="clear: both"><a name=
11130: "build.checksum"></a>14.6. The <span class=
11131: "emphasis"><em>checksum</em></span> phase</h2>
11132: </div>
11133: </div>
11134: </div>
11135:
11136: <p>After the distfile(s) are fetched, their checksum is
11137: generated and compared with the checksums stored in the
11138: distinfo file. If the checksums don't match, the build is
11139: aborted. This is to ensure the same distfile is used for
11140: building, and that the distfile wasn't changed, e.g. by
11141: some malign force, deliberately changed distfiles on the
11142: master distribution site or network lossage.</p>
11143: </div>
11144:
1.67 hubertf 11145: <div class="sect1" lang="en">
1.56 rillig 11146: <div class="titlepage">
11147: <div>
11148: <div>
11149: <h2 class="title" style="clear: both"><a name=
11150: "build.extract"></a>14.7. The <span class=
11151: "emphasis"><em>extract</em></span> phase</h2>
11152: </div>
11153: </div>
11154: </div>
11155:
11156: <p>When the distfiles are present on the local system,
1.69 rillig 11157: they need to be extracted, as they usually come in the
11158: form of some compressed archive format.</p>
11159:
11160: <p>By default, all <code class="varname">DISTFILES</code>
11161: are extracted. If you only need some of them, you can set
11162: the <code class="varname">EXTRACT_ONLY</code> variable to
11163: the list of those files.</p>
11164:
11165: <p>Extracting the files is usually done by a little
11166: program, <code xmlns=
11167: "http://www.w3.org/TR/xhtml1/transitional" class=
11168: "filename">mk/scripts/extract</code>, which already knows
11169: how to extract various archive formats, so most likely
11170: you will not need to change anything here. But if you
11171: need, the following variables may help you:</p>
11172:
11173: <div class="variablelist">
11174: <dl>
11175: <dt><span class="term"><code class=
11176: "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
11177:
11178: <dd>
11179: <p>Use these variables to override the default
11180: options for an extract command, which are defined
11181: in <code xmlns=
11182: "http://www.w3.org/TR/xhtml1/transitional" class=
11183: "filename">mk/scripts/extract</code>.</p>
11184: </dd>
1.1 grant 11185:
1.69 rillig 11186: <dt><span class="term"><code class=
11187: "varname">EXTRACT_USING</code></span></dt>
1.1 grant 11188:
1.69 rillig 11189: <dd>
11190: <p>This variable can be set to <code class=
11191: "literal">pax</code>, <code class=
11192: "literal">tar</code> or an absolute pathname
11193: pointing to the command with which tar archives
11194: should be extracted.</p>
11195: </dd>
11196: </dl>
11197: </div>
11198:
11199: <p>If the <code xmlns=
1.56 rillig 11200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.69 rillig 11201: "filename">extract</code> program doesn't serve your
11202: needs, you can also override the <code class=
11203: "varname">EXTRACT_CMD</code> variable, which holds the
11204: command used for extracting the files. This command is
11205: executed in the <code xmlns=
11206: "http://www.w3.org/TR/xhtml1/transitional" class=
11207: "filename">${WRKSRC}</code> directory. During execution
11208: of this command, the shell variable <code class=
11209: "varname">extract_file</code> holds the absolute pathname
11210: of the file that is going to be extracted.</p>
11211:
11212: <p>And if that still does not suffice, you can override
11213: the <code class="varname">do-extract</code> target in the
11214: package Makefile.</p>
1.56 rillig 11215: </div>
11216:
1.67 hubertf 11217: <div class="sect1" lang="en">
1.56 rillig 11218: <div class="titlepage">
11219: <div>
11220: <div>
11221: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11222: "build.patch"></a>14.8. The <span class=
11223: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 11224: </div>
11225: </div>
11226: </div>
11227:
11228: <p>After extraction, all the patches named by the
11229: <code class="varname">PATCHFILES</code>, those present in
11230: the patches subdirectory of the package as well as in
11231: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
11232: "http://www.w3.org/TR/xhtml1/transitional" class=
11233: "filename">/usr/local/patches/graphics/png</code>) are
11234: applied. Patchfiles ending in <code xmlns=
11235: "http://www.w3.org/TR/xhtml1/transitional" class=
11236: "filename">.Z</code> or <code xmlns=
11237: "http://www.w3.org/TR/xhtml1/transitional" class=
11238: "filename">.gz</code> are uncompressed before they are
11239: applied, files ending in <code xmlns=
11240: "http://www.w3.org/TR/xhtml1/transitional" class=
11241: "filename">.orig</code> or <code xmlns=
11242: "http://www.w3.org/TR/xhtml1/transitional" class=
11243: "filename">.rej</code> are ignored. Any special options
11244: to <a href=
11245: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11246: <span class="citerefentry"><span class=
11247: "refentrytitle">patch</span>(1)</span></a> can be handed
11248: in <code class="varname">PATCH_DIST_ARGS</code>. See
11249: <a href="#components.patches" title=
11250: "8.3. patches/*">Section 8.3,
11251: “patches/*”</a> for more details.</p>
11252:
11253: <p>By default <a href=
11254: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
11255: <span class="citerefentry"><span class=
11256: "refentrytitle">patch</span>(1)</span></a> is given
11257: special args to make it fail if the patches apply with
11258: some lines of fuzz. Please fix (regen) the patches so
11259: that they apply cleanly. The rationale behind this is
11260: that patches that don't apply cleanly may end up being
11261: applied in the wrong place, and cause severe harm
11262: there.</p>
11263: </div>
11264:
1.67 hubertf 11265: <div class="sect1" lang="en">
1.56 rillig 11266: <div class="titlepage">
11267: <div>
11268: <div>
11269: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11270: "build.tools"></a>14.9. The <span class=
11271: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 11272: </div>
11273: </div>
11274: </div>
11275:
1.68 rillig 11276: <p>This is covered in <a href="#tools" title=
11277: "Chapter 15. Tools needed for building or running">
11278: Chapter 15, <i>Tools needed for building or
11279: running</i></a>.</p>
1.56 rillig 11280: </div>
11281:
1.67 hubertf 11282: <div class="sect1" lang="en">
1.56 rillig 11283: <div class="titlepage">
11284: <div>
11285: <div>
11286: <h2 class="title" style="clear: both"><a name=
11287: "build.wrapper"></a>14.10. The <span class=
11288: "emphasis"><em>wrapper</em></span> phase</h2>
11289: </div>
11290: </div>
11291: </div>
11292:
1.72 rillig 11293: <p>This phase creates wrapper programs for the compilers
11294: and linkers. The following variables can be used to tweak
11295: the wrappers.</p>
11296:
11297: <div class="variablelist">
11298: <dl>
11299: <dt><span class="term"><code class=
11300: "varname">ECHO_WRAPPER_MSG</code></span></dt>
11301:
11302: <dd>
11303: <p>The command used to print progress messages.
11304: Does nothing by default. Set to <code class=
11305: "literal">${ECHO}</code> to see the progress
11306: messages.</p>
11307: </dd>
11308:
11309: <dt><span class="term"><code class=
11310: "varname">WRAPPER_DEBUG</code></span></dt>
11311:
11312: <dd>
11313: <p>This variable can be set to <code class=
11314: "literal">yes</code> (default) or <code class=
11315: "literal">no</code>, depending on whether you want
11316: additional information in the wrapper log file.</p>
11317: </dd>
11318:
11319: <dt><span class="term"><code class=
11320: "varname">WRAPPER_UPDATE_CACHE</code></span></dt>
11321:
11322: <dd>
11323: <p>This variable can be set to <code class=
11324: "literal">yes</code> or <code class=
11325: "literal">no</code>, depending on whether the
11326: wrapper should use its cache, which will improve
11327: the speed. The default value is <code class=
11328: "literal">yes</code>, but is forced to <code class=
11329: "literal">no</code> if the platform does not
11330: support it.</p>
11331: </dd>
11332:
11333: <dt><span class="term"><code class=
11334: "varname">WRAPPER_REORDER_CMDS</code></span></dt>
11335:
11336: <dd>
11337: <p>A list of reordering commands. A reordering
11338: command has the form <code class=
11339: "literal">reorder:l:<em class=
11340: "replaceable"><code>lib1</code></em>:<em class=
11341: "replaceable"><code>lib2</code></em></code>. It
11342: ensures that that <code class=
11343: "literal">-l<em class="replaceable"><code>lib1</code></em></code>
11344: occurs before <code class="literal">-l<em class=
11345: "replaceable"><code>lib2</code></em></code>.</p>
11346: </dd>
11347:
11348: <dt><span class="term"><code class=
11349: "varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
11350:
11351: <dd>
11352: <p>A list of transformation commands. [TODO:
11353: investigate further]</p>
11354: </dd>
11355: </dl>
11356: </div>
1.56 rillig 11357: </div>
11358:
1.67 hubertf 11359: <div class="sect1" lang="en">
1.56 rillig 11360: <div class="titlepage">
11361: <div>
11362: <div>
11363: <h2 class="title" style="clear: both"><a name=
11364: "build.configure"></a>14.11. The <span class=
11365: "emphasis"><em>configure</em></span> phase</h2>
11366: </div>
11367: </div>
11368: </div>
11369:
11370: <p>Most pieces of software need information on the header
11371: files, system calls, and library routines which are
11372: available on the platform they run on. The process of
11373: determining this information is known as configuration,
11374: and is usually automated. In most cases, a script is
11375: supplied with the distfiles, and its invocation results
11376: in generation of header files, Makefiles, etc.</p>
11377:
11378: <p>If the package contains a configure script, this can
11379: be invoked by setting <code class=
11380: "varname">HAS_CONFIGURE</code> to “<span class=
11381: "quote">yes</span>”. If the configure script is a
11382: GNU autoconf script, you should set <code class=
11383: "varname">GNU_CONFIGURE</code> to “<span class=
11384: "quote">yes</span>” instead. What happens in the
11385: <span class="emphasis"><em>configure</em></span> phase is
11386: roughly:</p>
11387: <pre class="programlisting">
11388: .for d in ${CONFIGURE_DIRS}
11389: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
11390: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
11391: .endfor
11392: </pre>
1.1 grant 11393:
1.56 rillig 11394: <p><code class="varname">CONFIGURE_DIRS</code> (default:
11395: “<span class="quote">.</span>”) is a list of
11396: pathnames relative to <code class=
11397: "varname">WRKSRC</code>. In each of these directories,
11398: the configure script is run with the environment
11399: <code class="varname">CONFIGURE_ENV</code> and arguments
11400: <code class="varname">CONFIGURE_ARGS</code>. The
11401: variables <code class="varname">CONFIGURE_ENV</code>,
11402: <code class="varname">CONFIGURE_SCRIPT</code> (default:
11403: “<span class="quote">./configure</span>”) and
11404: <code class="varname">CONFIGURE_ARGS</code> may all be
11405: changed by the package.</p>
1.1 grant 11406:
1.56 rillig 11407: <p>If the program uses an <code xmlns=
11408: "http://www.w3.org/TR/xhtml1/transitional" class=
11409: "filename">Imakefile</code> for configuration, the
11410: appropriate steps can be invoked by setting <code class=
11411: "varname">USE_IMAKE</code> to “<span class=
11412: "quote">yes</span>”. (If you only want the package
11413: installed in <code class="varname">${X11PREFIX}</code>
11414: but xmkmf not being run, set <code class=
11415: "varname">USE_X11BASE</code> instead.)</p>
11416: </div>
1.1 grant 11417:
1.67 hubertf 11418: <div class="sect1" lang="en">
1.56 rillig 11419: <div class="titlepage">
11420: <div>
11421: <div>
11422: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11423: "build.build"></a>14.12. The <span class=
11424: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 11425: </div>
11426: </div>
1.1 grant 11427: </div>
11428:
1.56 rillig 11429: <p>For building a package, a rough equivalent of the
11430: following code is executed.</p>
1.1 grant 11431: <pre class="programlisting">
1.56 rillig 11432: .for d in ${BUILD_DIRS}
11433: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11434: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
11435: -f ${MAKEFILE} ${BUILD_TARGET}
11436: .endfor
1.1 grant 11437: </pre>
1.56 rillig 11438:
11439: <p><code class="varname">BUILD_DIRS</code> (default:
11440: “<span class="quote">.</span>”) is a list of
11441: pathnames relative to <code class=
11442: "varname">WRKSRC</code>. In each of these directories,
11443: <code class="varname">MAKE_PROGRAM</code> is run with the
11444: environment <code class="varname">MAKE_ENV</code> and
11445: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
11446: The variables <code class="varname">MAKE_ENV</code>,
11447: <code class="varname">BUILD_MAKE_FLAGS</code>,
11448: <code class="varname">MAKEFILE</code> and <code class=
11449: "varname">BUILD_TARGET</code> may all be changed by the
11450: package.</p>
11451:
11452: <p>The default value of <code class=
11453: "varname">MAKE_PROGRAM</code> is “<span class=
11454: "quote">gmake</span>” if <code class=
11455: "varname">USE_TOOLS</code> contains “<span class=
11456: "quote">gmake</span>”, “<span class=
11457: "quote">make</span>” otherwise. The default value
11458: of <code class="varname">MAKEFILE</code> is
11459: “<span class="quote">Makefile</span>”, and
11460: <code class="varname">BUILD_TARGET</code> defaults to
11461: “<span class="quote">all</span>”.</p>
11462: </div>
11463:
1.67 hubertf 11464: <div class="sect1" lang="en">
1.56 rillig 11465: <div class="titlepage">
11466: <div>
11467: <div>
11468: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 11469: "build.test"></a>14.13. The <span class=
11470: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 11471: </div>
11472: </div>
11473: </div>
11474:
11475: <p>[TODO]</p>
11476: </div>
11477:
1.67 hubertf 11478: <div class="sect1" lang="en">
1.56 rillig 11479: <div class="titlepage">
11480: <div>
11481: <div>
11482: <h2 class="title" style="clear: both"><a name=
11483: "build.install"></a>14.14. The <span class=
11484: "emphasis"><em>install</em></span> phase</h2>
11485: </div>
11486: </div>
11487: </div>
11488:
11489: <p>Once the build stage has completed, the final step is
11490: to install the software in public directories, so users
1.68 rillig 11491: can access the programs and files.</p>
11492:
11493: <p>In the <span class="emphasis"><em>install</em></span>
11494: phase, a rough equivalent of the following code is
11495: executed. Additionally, before and after this code, much
11496: magic is performed to do consistency checks, registering
11497: the package, and so on.</p>
11498: <pre class="programlisting">
11499: .for d in ${INSTALL_DIRS}
11500: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
11501: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
11502: -f ${MAKEFILE} ${BUILD_TARGET}
11503: .endfor
11504: </pre>
11505:
11506: <p>The variable's meanings are analogous to the ones in
11507: the <span class="emphasis"><em>build</em></span> phase.
11508: <code class="varname">INSTALL_DIRS</code> defaults to
11509: <code class="varname">BUILD_DIRS</code>. <code class=
11510: "varname">INSTALL_TARGET</code> is “<span class=
11511: "quote">install</span>” by default, plus
11512: “<span class="quote">install.man</span>” if
11513: <code class="varname">USE_IMAKE</code> is defined.</p>
11514:
11515: <p>In the <span class="emphasis"><em>install</em></span>
11516: phase, the following variables are useful. They are all
11517: variations of the <a href=
11518: "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11519: <span class="citerefentry"><span class=
11520: "refentrytitle">install</span>(1)</span></a> command that
11521: have the owner, group and permissions preset.
11522: <code class="varname">INSTALL</code> is the plain install
11523: command. The specialized variants, together with their
11524: intended use, are:</p>
11525:
11526: <div class="variablelist">
11527: <dl>
11528: <dt><span class="term"><code class=
11529: "varname">INSTALL_PROGRAM_DIR</code></span></dt>
11530:
11531: <dd>
11532: <p>directories that contain binaries</p>
11533: </dd>
11534:
11535: <dt><span class="term"><code class=
11536: "varname">INSTALL_SCRIPT_DIR</code></span></dt>
11537:
11538: <dd>
11539: <p>directories that contain scripts</p>
11540: </dd>
11541:
11542: <dt><span class="term"><code class=
11543: "varname">INSTALL_LIB_DIR</code></span></dt>
11544:
11545: <dd>
11546: <p>directories that contain shared and static
11547: libraries</p>
11548: </dd>
11549:
11550: <dt><span class="term"><code class=
11551: "varname">INSTALL_DATA_DIR</code></span></dt>
11552:
11553: <dd>
11554: <p>directories that contain data files</p>
11555: </dd>
11556:
11557: <dt><span class="term"><code class=
11558: "varname">INSTALL_MAN_DIR</code></span></dt>
11559:
11560: <dd>
11561: <p>directories that contain man pages</p>
11562: </dd>
11563:
11564: <dt><span class="term"><code class=
11565: "varname">INSTALL_PROGRAM</code></span></dt>
11566:
11567: <dd>
11568: <p>binaries that can be stripped from debugging
11569: symbols</p>
11570: </dd>
11571:
11572: <dt><span class="term"><code class=
11573: "varname">INSTALL_SCRIPT</code></span></dt>
11574:
11575: <dd>
11576: <p>binaries that cannot be stripped</p>
11577: </dd>
11578:
11579: <dt><span class="term"><code class=
11580: "varname">INSTALL_GAME</code></span></dt>
11581:
11582: <dd>
11583: <p>game binaries</p>
11584: </dd>
11585:
11586: <dt><span class="term"><code class=
11587: "varname">INSTALL_LIB</code></span></dt>
11588:
11589: <dd>
11590: <p>shared and static libraries</p>
11591: </dd>
11592:
11593: <dt><span class="term"><code class=
11594: "varname">INSTALL_DATA</code></span></dt>
11595:
11596: <dd>
11597: <p>data files</p>
11598: </dd>
11599:
11600: <dt><span class="term"><code class=
11601: "varname">INSTALL_GAME_DATA</code></span></dt>
11602:
11603: <dd>
11604: <p>data files for games</p>
11605: </dd>
11606:
11607: <dt><span class="term"><code class=
11608: "varname">INSTALL_MAN</code></span></dt>
11609:
11610: <dd>
11611: <p>man pages</p>
11612: </dd>
11613: </dl>
11614: </div>
11615:
11616: <p>Some other variables are:</p>
11617:
11618: <div class="variablelist">
11619: <dl>
11620: <dt><span class="term"><code class=
11621: "varname">INSTALLATION_DIRS</code></span></dt>
11622:
11623: <dd>
11624: <p>A list of directories relative to <code class=
11625: "varname">PREFIX</code> that are created by pkgsrc
11626: at the beginning of the <span class=
11627: "emphasis"><em>install</em></span> phase. If this
11628: variable is set, <code class=
11629: "varname">NO_MTREE</code>=“<span class=
11630: "quote">yes</span>” is assumed, which means
11631: that the package claims to create all needed
11632: directories itself before installing files to it.
11633: Therefore this variable should only be set in
11634: <code xmlns=
11635: "http://www.w3.org/TR/xhtml1/transitional" class=
11636: "filename">Makefile</code>s that are under control
11637: of the package's author.</p>
11638: </dd>
11639: </dl>
11640: </div>
1.56 rillig 11641: </div>
11642:
1.67 hubertf 11643: <div class="sect1" lang="en">
1.56 rillig 11644: <div class="titlepage">
11645: <div>
11646: <div>
11647: <h2 class="title" style="clear: both"><a name=
11648: "build.package"></a>14.15. The <span class=
11649: "emphasis"><em>package</em></span> phase</h2>
11650: </div>
11651: </div>
11652: </div>
11653:
11654: <p>[TODO]</p>
1.1 grant 11655: </div>
11656:
1.67 hubertf 11657: <div class="sect1" lang="en">
1.1 grant 11658: <div class="titlepage">
11659: <div>
11660: <div>
11661: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11662: "build.helpful-targets"></a>14.16. Other
1.1 grant 11663: helpful targets</h2>
11664: </div>
11665: </div>
11666: </div>
11667:
11668: <div class="variablelist">
11669: <dl>
11670: <dt><span class="term">pre/post-*</span></dt>
11671:
11672: <dd>
11673: <p>For any of the main targets described in the
11674: previous section, two auxiliary targets exist with
11675: “<span class="quote">pre-</span>” and
11676: “<span class="quote">post-</span>” used
11677: as a prefix for the main target's name. These
11678: targets are invoked before and after the main
11679: target is called, allowing extra configuration or
11680: installation steps be performed from a package's
11681: Makefile, for example, which a program's configure
11682: script or install target omitted.</p>
11683: </dd>
11684:
11685: <dt><span class="term">do-*</span></dt>
11686:
11687: <dd>
11688: <p>Should one of the main targets do the wrong
11689: thing, and should there be no variable to fix this,
11690: you can redefine it with the do-* target. (Note
11691: that redefining the target itself instead of the
11692: do-* target is a bad idea, as the pre-* and post-*
11693: targets won't be called anymore, etc.) You will not
11694: usually need to do this.</p>
11695: </dd>
11696:
11697: <dt><span class="term">reinstall</span></dt>
11698:
11699: <dd>
1.14 xtraeme 11700: <p>If you did a <span><strong class="command">make
11701: install</strong></span> and you noticed some file
11702: was not installed properly, you can repeat the
1.1 grant 11703: installation with this target, which will ignore
11704: the “<span class="quote">already
11705: installed</span>” flag.</p>
11706: </dd>
11707:
11708: <dt><span class="term">deinstall</span></dt>
11709:
11710: <dd>
1.24 wiz 11711: <p>This target does a <a href=
11712: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11713: <span class="citerefentry"><span class=
11714: "refentrytitle">pkg_delete</span>(1)</span></a> in
11715: the current directory, effectively de-installing
11716: the package. The following variables can be used to
11717: tune the behaviour:</p>
1.1 grant 11718:
11719: <div class="variablelist">
11720: <dl>
1.14 xtraeme 11721: <dt><span class="term"><code class=
11722: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11723:
11724: <dd>
11725: <p>Add a "-v" to the <a href=
11726: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11727: <span class="citerefentry"><span class=
11728: "refentrytitle">pkg_delete</span>(1)</span></a>
11729: command.</p>
11730: </dd>
11731:
1.14 xtraeme 11732: <dt><span class="term"><code class=
11733: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11734:
11735: <dd>
11736: <p>Remove all packages that require (depend
11737: on) the given package. This can be used to
11738: remove any packages that may have been pulled
11739: in by a given package, e.g. if
1.14 xtraeme 11740: <span><strong class="command">make deinstall
11741: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11742: <code xmlns=
11743: "http://www.w3.org/TR/xhtml1/transitional"
11744: class="filename">pkgsrc/x11/kde</code>, this
11745: is likely to remove whole KDE. Works by
1.1 grant 11746: adding “<span class=
11747: "quote">-R</span>” to the <a href=
11748: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11749: <span class="citerefentry"><span class=
11750: "refentrytitle">pkg_delete</span>(1)</span></a>
11751: command line.</p>
11752: </dd>
11753: </dl>
11754: </div>
11755: </dd>
11756:
11757: <dt><span class="term">update</span></dt>
11758:
11759: <dd>
11760: <p>This target causes the current package to be
11761: updated to the latest version. The package and all
11762: depending packages first get de-installed, then
11763: current versions of the corresponding packages get
11764: compiled and installed. This is similar to manually
11765: noting which packages are currently installed, then
1.14 xtraeme 11766: performing a series of <span><strong class=
11767: "command">make deinstall</strong></span> and
11768: <span><strong class="command">make
11769: install</strong></span> (or whatever <code class=
11770: "varname">UPDATE_TARGET</code> is set to) for these
11771: packages.</p>
1.1 grant 11772:
11773: <p>You can use the “<span class=
11774: "quote">update</span>” target to resume
1.14 xtraeme 11775: package updating in case a previous
11776: <span><strong class="command">make
11777: update</strong></span> was interrupted for some
11778: reason. However, in this case, make sure you don't
11779: call <span><strong class="command">make
11780: clean</strong></span> or otherwise remove the list
11781: of dependent packages in <code class=
1.47 reed 11782: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11783: ability to automatically update the current package
11784: along with the dependent packages you have
11785: installed.</p>
11786:
1.14 xtraeme 11787: <p>Resuming an interrupted <span><strong class=
11788: "command">make update</strong></span> will only
11789: work as long as the package tree remains unchanged.
11790: If the source code for one of the packages to be
11791: updated has been changed, resuming
11792: <span><strong class="command">make
11793: update</strong></span> will most certainly
11794: fail!</p>
1.1 grant 11795:
11796: <p>The following variables can be used either on
1.45 wiz 11797: the command line or in <code xmlns=
11798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11799: "filename">/etc/mk.conf</code> to alter the
11800: behaviour of <span><strong class="command">make
11801: update</strong></span>:</p>
1.1 grant 11802:
11803: <div class="variablelist">
11804: <dl>
1.14 xtraeme 11805: <dt><span class="term"><code class=
11806: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11807:
11808: <dd>
11809: <p>Install target to recursively use for the
11810: updated package and the dependent packages.
1.14 xtraeme 11811: Defaults to <code class=
11812: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11813: “<span class=
11814: "quote">install</span>” otherwise for
1.14 xtraeme 11815: <span><strong class="command">make
11816: update</strong></span>. e.g.
11817: <span><strong class="command">make update
11818: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11819: </dd>
11820:
1.14 xtraeme 11821: <dt><span class="term"><code class=
11822: "varname">NOCLEAN</code></span></dt>
1.1 grant 11823:
11824: <dd>
11825: <p>Don't clean up after updating. Useful if
11826: you want to leave the work sources of the
11827: updated packages around for inspection or
11828: other purposes. Be sure you eventually clean
11829: up the source tree (see the
11830: “<span class=
11831: "quote">clean-update</span>” target
11832: below) or you may run into troubles with old
11833: source code still lying around on your next
1.14 xtraeme 11834: <span><strong class=
11835: "command">make</strong></span> or
11836: <span><strong class="command">make
11837: update</strong></span>.</p>
1.1 grant 11838: </dd>
11839:
1.14 xtraeme 11840: <dt><span class="term"><code class=
11841: "varname">REINSTALL</code></span></dt>
1.1 grant 11842:
11843: <dd>
11844: <p>Deinstall each package before installing
1.14 xtraeme 11845: (making <code class=
11846: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11847: necessary if the “<span class=
11848: "quote">clean-update</span>” target
11849: (see below) was called after interrupting a
1.14 xtraeme 11850: running <span><strong class="command">make
11851: update</strong></span>.</p>
1.1 grant 11852: </dd>
11853:
1.14 xtraeme 11854: <dt><span class="term"><code class=
11855: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11856:
11857: <dd>
11858: <p>Allows you to disable recursion and
11859: hardcode the target for packages. The default
11860: is “<span class=
11861: "quote">update</span>” for the update
11862: target, facilitating a recursive update of
1.14 xtraeme 11863: prerequisite packages. Only set <code class=
11864: "varname">DEPENDS_TARGET</code> if you want
11865: to disable recursive updates. Use
11866: <code class="varname">UPDATE_TARGET</code>
11867: instead to just set a specific target for
11868: each package to be installed during
11869: <span><strong class="command">make
11870: update</strong></span> (see above).</p>
1.1 grant 11871: </dd>
11872: </dl>
11873: </div>
11874: </dd>
11875:
11876: <dt><span class="term">clean-update</span></dt>
11877:
11878: <dd>
11879: <p>Clean the source tree for all packages that
1.14 xtraeme 11880: would get updated if <span><strong class=
11881: "command">make update</strong></span> was called
11882: from the current directory. This target should not
11883: be used if the current package (or any of its
11884: depending packages) have already been de-installed
11885: (e.g., after calling <span><strong class=
11886: "command">make update</strong></span>) or you may
11887: lose some packages you intended to update. As a
11888: rule of thumb: only use this target <span class=
11889: "emphasis"><em>before</em></span> the first time
11890: you run <span><strong class="command">make
11891: update</strong></span> and only if you have a dirty
11892: package tree (e.g., if you used <code class=
11893: "varname">NOCLEAN</code>).</p>
1.1 grant 11894:
1.47 reed 11895: <p>If you are unsure about whether your tree is
11896: clean, you can either perform a
1.14 xtraeme 11897: <span><strong class="command">make
1.47 reed 11898: clean</strong></span> at the top of the tree, or
11899: use the following sequence of commands from the
11900: directory of the package you want to update
11901: (<span class="emphasis"><em>before</em></span>
11902: running <span><strong class="command">make
1.14 xtraeme 11903: update</strong></span> for the first time,
11904: otherwise you lose all the packages you wanted to
11905: update!):</p>
1.1 grant 11906: <pre class="screen">
1.14 xtraeme 11907: <code class="prompt">#</code> <strong class=
11908: "userinput"><code>make clean-update</code></strong>
11909: <code class="prompt">#</code> <strong class=
11910: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11911: <code class="prompt">#</code> <strong class=
11912: "userinput"><code>make update</code></strong>
1.1 grant 11913: </pre>
11914:
11915: <p>The following variables can be used either on
1.45 wiz 11916: the command line or in <code xmlns=
11917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11918: "filename">/etc/mk.conf</code> to alter the
11919: behaviour of <span><strong class="command">make
11920: clean-update</strong></span>:</p>
1.1 grant 11921:
11922: <div class="variablelist">
11923: <dl>
1.14 xtraeme 11924: <dt><span class="term"><code class=
11925: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11926:
11927: <dd>
1.14 xtraeme 11928: <p>After <span><strong class="command">make
11929: clean</strong></span>, do not reconstruct the
11930: list of directories to update for this
11931: package. Only use this if
11932: <span><strong class="command">make
11933: update</strong></span> successfully installed
11934: all packages you wanted to update. Normally,
11935: this is done automatically on
11936: <span><strong class="command">make
11937: update</strong></span>, but may have been
11938: suppressed by the <code class=
11939: "varname">NOCLEAN</code> variable (see
1.1 grant 11940: above).</p>
11941: </dd>
11942: </dl>
11943: </div>
11944: </dd>
11945:
11946: <dt><span class="term">info</span></dt>
11947:
11948: <dd>
11949: <p>This target invokes <a href=
11950: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11951: <span class="citerefentry"><span class=
11952: "refentrytitle">pkg_info</span>(1)</span></a> for
11953: the current package. You can use this to check
11954: which version of a package is installed.</p>
11955: </dd>
11956:
11957: <dt><span class="term">readme</span></dt>
11958:
11959: <dd>
1.45 wiz 11960: <p>This target generates a <code xmlns=
11961: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11962: "filename">README.html</code> file, which can be
1.1 grant 11963: viewed using a browser such as <a xmlns=
11964: "http://www.w3.org/TR/xhtml1/transitional" href=
11965: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11966: target="_top"><code xmlns="" class=
11967: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11968: "http://www.w3.org/TR/xhtml1/transitional" href=
11969: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11970: target="_top"><code xmlns="" class=
11971: "filename">www/links</code></a>. The generated
11972: files contain references to any packages which are
11973: in the <code class="varname">PACKAGES</code>
11974: directory on the local host. The generated files
11975: can be made to refer to URLs based on <code class=
1.20 ben 11976: "varname">FTP_PKG_URL_HOST</code> and <code class=
11977: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11978: wanted to generate <code xmlns=
11979: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11980: "filename">README.html</code> files which pointed
11981: to binary packages on the local machine, in the
1.45 wiz 11982: directory <code xmlns=
11983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11984: "filename">/usr/packages</code>, set <code class=
11985: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11986: and <code class=
11987: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11988: <code class="varname">${PACKAGES}</code> directory
11989: and its subdirectories will be searched for all the
11990: binary packages.</p>
1.1 grant 11991: </dd>
11992:
11993: <dt><span class="term">readme-all</span></dt>
11994:
11995: <dd>
1.45 wiz 11996: <p>Use this target to create a file <code xmlns=
11997: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11998: "filename">README-all.html</code> which contains a
1.1 grant 11999: list of all packages currently available in the
12000: NetBSD Packages Collection, together with the
12001: category they belong to and a short description.
1.45 wiz 12002: This file is compiled from the <code xmlns=
12003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12004: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 12005: sure to run this <span class=
1.14 xtraeme 12006: "emphasis"><em>after</em></span> a
12007: <span><strong class="command">make
12008: readme</strong></span>.</p>
1.1 grant 12009: </dd>
12010:
12011: <dt><span class="term">cdrom-readme</span></dt>
12012:
12013: <dd>
12014: <p>This is very much the same as the
12015: “<span class="quote">readme</span>”
12016: target (see above), but is to be used when
12017: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 12018: This target also produces <code xmlns=
12019: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12020: "filename">README.html</code> files, and can be
12021: made to refer to URLs based on <code class=
12022: "varname">CDROM_PKG_URL_HOST</code> and
12023: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 12024: </dd>
12025:
12026: <dt><span class="term">show-distfiles</span></dt>
12027:
12028: <dd>
12029: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 12030: are needed to build the package. (<code class=
12031: "varname">DISTFILES</code> and <code class=
1.45 wiz 12032: "varname">PATCHFILES</code>, but not <code xmlns=
12033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12034: "filename">patches/*</code>)</p>
1.1 grant 12035: </dd>
12036:
12037: <dt><span class="term">show-downlevel</span></dt>
12038:
12039: <dd>
12040: <p>This target shows nothing if the package is not
12041: installed. If a version of this package is
12042: installed, but is not the version provided in this
12043: version of pkgsrc, then a warning message is
12044: displayed. This target can be used to show which of
12045: your installed packages are downlevel, and so the
12046: old versions can be deleted, and the current ones
12047: added.</p>
12048: </dd>
12049:
12050: <dt><span class="term">show-pkgsrc-dir</span></dt>
12051:
12052: <dd>
12053: <p>This target shows the directory in the pkgsrc
12054: hierarchy from which the package can be built and
12055: installed. This may not be the same directory as
12056: the one from which the package was installed. This
12057: target is intended to be used by people who may
12058: wish to upgrade many packages on a single host, and
12059: can be invoked from the top-level pkgsrc Makefile
12060: by using the “<span class=
12061: "quote">show-host-specific-pkgs</span>”
12062: target.</p>
12063: </dd>
12064:
12065: <dt><span class=
12066: "term">show-installed-depends</span></dt>
12067:
12068: <dd>
12069: <p>This target shows which installed packages match
1.14 xtraeme 12070: the current package's <code class=
12071: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 12072: dependencies are causing build problems.</p>
12073: </dd>
12074:
12075: <dt><span class="term">check-shlibs</span></dt>
12076:
12077: <dd>
12078: <p>After a package is installed, check all its
12079: binaries and (on ELF platforms) shared libraries to
12080: see if they find the shared libs they need. Run by
1.14 xtraeme 12081: default if <code class=
12082: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 12083: <code xmlns=
12084: "http://www.w3.org/TR/xhtml1/transitional" class=
12085: "filename">/etc/mk.conf</code>.</p>
1.1 grant 12086: </dd>
12087:
12088: <dt><span class="term">print-PLIST</span></dt>
12089:
12090: <dd>
12091: <p>After a “<span class="quote">make
12092: install</span>” from a new or upgraded pkg,
12093: this prints out an attempt to generate a new
1.45 wiz 12094: <code xmlns=
12095: "http://www.w3.org/TR/xhtml1/transitional" class=
12096: "filename">PLIST</code> from a <span><strong class=
12097: "command">find -newer
1.14 xtraeme 12098: work/.extract_done</strong></span>. An attempt is
12099: made to care for shared libs etc., but it is
1.1 grant 12100: <span class="emphasis"><em>strongly</em></span>
12101: recommended to review the result before putting it
1.45 wiz 12102: into <code xmlns=
12103: "http://www.w3.org/TR/xhtml1/transitional" class=
12104: "filename">PLIST</code>. On upgrades, it's useful
12105: to diff the output of this command against an
12106: already existing <code xmlns=
12107: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12108: "filename">PLIST</code> file.</p>
1.1 grant 12109:
1.24 wiz 12110: <p>If the package installs files via <a href=
12111: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12112: <span class="citerefentry"><span class=
12113: "refentrytitle">tar</span>(1)</span></a> or other
12114: methods that don't update file access times, be
12115: sure to add these files manually to your
1.45 wiz 12116: <code xmlns=
12117: "http://www.w3.org/TR/xhtml1/transitional" class=
12118: "filename">PLIST</code>, as the “<span class=
12119: "quote">find -newer</span>” command used by
12120: this target won't catch them!</p>
1.1 grant 12121:
12122: <p>See <a href="#print-PLIST" title=
1.38 dillo 12123: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 12124: “Tweaking output of <span><strong class=
12125: "command">make
12126: print-PLIST</strong></span>”</a> for more
12127: information on this target.</p>
1.1 grant 12128: </dd>
12129:
12130: <dt><span class="term">bulk-package</span></dt>
12131:
12132: <dd>
12133: <p>Used to do bulk builds. If an appropriate binary
12134: package already exists, no action is taken. If not,
12135: this target will compile, install and package it
1.47 reed 12136: (and its depends, if <code class=
1.14 xtraeme 12137: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 12138: <a href="#binary.configuration" title=
1.38 dillo 12139: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 12140: “Configuration”</a>). After creating
12141: the binary package, the sources, the just-installed
12142: package and its required packages are removed,
1.1 grant 12143: preserving free disk space.</p>
12144:
12145: <p><span class="emphasis"><em>Beware that this
12146: target may deinstall all packages installed on a
12147: system!</em></span></p>
12148: </dd>
12149:
12150: <dt><span class="term">bulk-install</span></dt>
12151:
12152: <dd>
12153: <p>Used during bulk-installs to install required
1.47 reed 12154: packages. If an up-to-date binary package is
1.1 grant 12155: available, it will be installed via <a href=
12156: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12157: <span class="citerefentry"><span class=
12158: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 12159: not, <span><strong class="command">make
12160: bulk-package</strong></span> will be executed, but
1.47 reed 12161: the installed binary won't be removed.</p>
1.1 grant 12162:
12163: <p>A binary package is considered
1.47 reed 12164: “<span class="quote">up-to-date</span>”
1.1 grant 12165: to be installed via <a href=
12166: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
12167: <span class="citerefentry"><span class=
12168: "refentrytitle">pkg_add</span>(1)</span></a>
12169: if:</p>
12170:
12171: <div class="itemizedlist">
12172: <ul type="disc">
12173: <li>
1.45 wiz 12174: <p>None of the package's files (<code xmlns=
12175: "http://www.w3.org/TR/xhtml1/transitional"
12176: class="filename">Makefile</code>, ...) were
1.14 xtraeme 12177: modified since it was built.</p>
1.1 grant 12178: </li>
12179:
12180: <li>
12181: <p>None of the package's required (binary)
12182: packages were modified since it was
12183: built.</p>
12184: </li>
12185: </ul>
12186: </div>
12187:
12188: <p><span class="emphasis"><em>Beware that this
12189: target may deinstall all packages installed on a
12190: system!</em></span></p>
12191: </dd>
12192: </dl>
12193: </div>
12194: </div>
12195: </div>
12196:
1.67 hubertf 12197: <div class="chapter" lang="en">
1.1 grant 12198: <div class="titlepage">
12199: <div>
12200: <div>
1.67 hubertf 12201: <h2 class="title"><a name=
1.68 rillig 12202: "tools"></a>Chapter 15. Tools needed for
12203: building or running</h2>
12204: </div>
12205: </div>
12206: </div>
12207:
12208: <div class="toc">
12209: <p><b>Table of Contents</b></p>
12210:
12211: <dl>
12212: <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
12213: Tools for pkgsrc builds</a></span></dt>
12214:
12215: <dt><span class="sect1"><a href="#package-tools">15.2.
12216: Tools needed by packages</a></span></dt>
12217:
12218: <dt><span class="sect1"><a href="#platform-tools">15.3.
12219: Tools provided by platforms</a></span></dt>
12220: </dl>
12221: </div>
12222:
12223: <p>The <code class="varname">USE_TOOLS</code> definition is
12224: used both internally by pkgsrc and also for individual
12225: packages to define what commands are needed for building a
12226: package (like <code class="varname">BUILD_DEPENDS</code>)
12227: or for later run-time of an installed packaged (such as
12228: <code class="varname">DEPENDS</code>). If the native system
12229: provides an adequate tool, then in many cases, a pkgsrc
12230: package will not be used.</p>
12231:
12232: <p>When building a package, the replacement tools are made
12233: available in a directory (as symlinks or wrapper scripts)
12234: that is early in the executable search path. Just like the
12235: buildlink system, this helps with consistent builds.</p>
12236:
12237: <p>A tool may be needed to help build a specific package.
12238: For example, perl, GNU make (gmake) or yacc may be
12239: needed.</p>
12240:
12241: <p>Also a tool may be needed, for example, because the
12242: native system's supplied tool may be inefficient for
12243: building a package with pkgsrc. For example, a package may
12244: need GNU awk, bison (instead of yacc) or a better sed.</p>
12245:
12246: <p>The tools used by a package can be listed by running
12247: <span><strong class="command">make
12248: show-tools</strong></span>.</p>
12249:
12250: <div class="sect1" lang="en">
12251: <div class="titlepage">
12252: <div>
12253: <div>
12254: <h2 class="title" style="clear: both"><a name=
12255: "pkgsrc-tools"></a>15.1. Tools for pkgsrc
12256: builds</h2>
12257: </div>
12258: </div>
12259: </div>
12260:
12261: <p>The default set of tools used by pkgsrc is defined in
12262: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12263: class="filename">bsd.pkg.mk</code>. This includes
12264: standard Unix tools, such as: <span><strong class=
12265: "command">cat</strong></span>, <span><strong class=
12266: "command">awk</strong></span>, <span><strong class=
12267: "command">chmod</strong></span>, <span><strong class=
12268: "command">test</strong></span>, and so on. These can be
12269: seen by running: <span><strong class="command">make
12270: show-var VARNAME=USE_TOOLS</strong></span>.</p>
12271:
12272: <p>If a package needs a specific program to build then
12273: the <code class="varname">USE_TOOLS</code> variable can
12274: be used to define the tools needed.</p>
12275: </div>
12276:
12277: <div class="sect1" lang="en">
12278: <div class="titlepage">
12279: <div>
12280: <div>
12281: <h2 class="title" style="clear: both"><a name=
12282: "package-tools"></a>15.2. Tools needed by
12283: packages</h2>
12284: </div>
12285: </div>
12286: </div>
12287:
12288: <p>In the following examples, the :pkgsrc means to use
12289: the pkgsrc version and not the native version for a build
12290: dependency. And the :run means that it is used for a
12291: run-time dependencies also (and becomes a DEPENDS). The
12292: default is a build dependency which can be set with
12293: :build. (So in this example, it is the same as
12294: gmake:build and pkg-config:build.)</p>
12295: <pre class="programlisting">
12296: USE_TOOLS+= mktemp:pkgsrc
12297: USE_TOOLS+= gmake perl:run pkg-config
12298: </pre>
12299:
12300: <p>When using the tools framework, a <code class=
12301: "varname">TOOLS_PATH.foo</code> variable is defined which
12302: contains the full path to the appropriate tool. For
12303: example, <code class="varname">TOOLS_PATH.bash</code>
12304: could be “<span class=
12305: "quote">/bin/bash</span>” on Linux systems.</p>
12306:
12307: <p>If you always need a pkgsrc version of the tool at
12308: run-time, then just use <code class=
12309: "varname">DEPENDS</code> instead.</p>
12310: </div>
12311:
12312: <div class="sect1" lang="en">
12313: <div class="titlepage">
12314: <div>
12315: <div>
12316: <h2 class="title" style="clear: both"><a name=
12317: "platform-tools"></a>15.3. Tools provided by
12318: platforms</h2>
12319: </div>
12320: </div>
12321: </div>
12322:
12323: <p>When improving or porting pkgsrc to a new platform,
12324: have a look at (or create) the corresponding platform
12325: specific make file fragment under <code xmlns=
12326: "http://www.w3.org/TR/xhtml1/transitional" class=
12327: "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
12328: defines the name of the common tools. For example:</p>
12329: <pre class="programlisting">
12330: .if exists(/usr/bin/bzcat)
12331: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
12332: .elif exists(/usr/bin/bzip2)
12333: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
12334: .endif
12335:
12336: TOOLS_PLATFORM.true?= true # shell builtin
12337: </pre>
12338: </div>
12339: </div>
12340:
12341: <div class="chapter" lang="en">
12342: <div class="titlepage">
12343: <div>
12344: <div>
12345: <h2 class="title"><a name=
12346: "fixes"></a>Chapter 16. Making your package
1.55 rillig 12347: work</h2>
1.1 grant 12348: </div>
12349: </div>
12350: </div>
12351:
12352: <div class="toc">
12353: <p><b>Table of Contents</b></p>
12354:
12355: <dl>
1.30 wiz 12356: <dt><span class="sect1"><a href=
1.68 rillig 12357: "#general-operation">16.1. General
1.30 wiz 12358: operation</a></span></dt>
1.1 grant 12359:
12360: <dd>
12361: <dl>
12362: <dt><span class="sect2"><a href=
1.68 rillig 12363: "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30 wiz 12364: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 12365:
12366: <dt><span class="sect2"><a href=
1.68 rillig 12367: "#where-to-install-documentation">16.1.2. Where to
1.31 wiz 12368: install documentation</a></span></dt>
12369:
12370: <dt><span class="sect2"><a href=
1.68 rillig 12371: "#restricted-packages">16.1.3. Restricted
1.1 grant 12372: packages</a></span></dt>
12373:
12374: <dt><span class="sect2"><a href=
1.68 rillig 12375: "#dependencies">16.1.4. Handling
1.1 grant 12376: dependencies</a></span></dt>
12377:
12378: <dt><span class="sect2"><a href=
1.68 rillig 12379: "#conflicts">16.1.5. Handling conflicts with other
1.1 grant 12380: packages</a></span></dt>
12381:
12382: <dt><span class="sect2"><a href=
1.68 rillig 12383: "#not-building-packages">16.1.6. Packages that
1.30 wiz 12384: cannot or should not be built</a></span></dt>
1.1 grant 12385:
12386: <dt><span class="sect2"><a href=
1.68 rillig 12387: "#undeletable-packages">16.1.7. Packages which
1.30 wiz 12388: should not be deleted, once
12389: installed</a></span></dt>
1.1 grant 12390:
12391: <dt><span class="sect2"><a href=
1.68 rillig 12392: "#security-handling">16.1.8. Handling packages with
1.1 grant 12393: security problems</a></span></dt>
12394:
12395: <dt><span class="sect2"><a href=
1.68 rillig 12396: "#compiler-bugs">16.1.9. How to handle compiler
1.1 grant 12397: bugs</a></span></dt>
12398:
12399: <dt><span class="sect2"><a href=
1.68 rillig 12400: "#bumping-pkgrevision">16.1.10. How to handle
1.30 wiz 12401: incrementing versions when fixing an existing
1.1 grant 12402: package</a></span></dt>
12403:
12404: <dt><span class="sect2"><a href=
1.68 rillig 12405: "#portability-of-packages">16.1.11. Portability of
1.1 grant 12406: packages</a></span></dt>
12407: </dl>
12408: </dd>
12409:
1.30 wiz 12410: <dt><span class="sect1"><a href=
1.68 rillig 12411: "#downloading-issues">16.2. Possible downloading
1.30 wiz 12412: issues</a></span></dt>
1.1 grant 12413:
12414: <dd>
12415: <dl>
12416: <dt><span class="sect2"><a href=
1.68 rillig 12417: "#no-plain-download">16.2.1. Packages whose
1.30 wiz 12418: distfiles aren't available for plain
1.1 grant 12419: downloading</a></span></dt>
12420:
12421: <dt><span class="sect2"><a href=
1.68 rillig 12422: "#modified-distfiles-same-name">16.2.2. How to
1.30 wiz 12423: handle modified distfiles with the 'old'
12424: name</a></span></dt>
1.1 grant 12425: </dl>
12426: </dd>
12427:
1.30 wiz 12428: <dt><span class="sect1"><a href=
1.68 rillig 12429: "#configuration-gotchas">16.3. Configuration
1.30 wiz 12430: gotchas</a></span></dt>
1.1 grant 12431:
12432: <dd>
12433: <dl>
12434: <dt><span class="sect2"><a href=
1.68 rillig 12435: "#fixes.libtool">16.3.1. Shared libraries -
1.1 grant 12436: libtool</a></span></dt>
12437:
12438: <dt><span class="sect2"><a href=
1.68 rillig 12439: "#using-libtool">16.3.2. Using libtool on GNU
1.30 wiz 12440: packages that already support
12441: libtool</a></span></dt>
1.1 grant 12442:
12443: <dt><span class="sect2"><a href=
1.68 rillig 12444: "#autoconf-automake">16.3.3. GNU
1.1 grant 12445: Autoconf/Automake</a></span></dt>
12446: </dl>
12447: </dd>
12448:
1.68 rillig 12449: <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55 rillig 12450: Building the package</a></span></dt>
1.1 grant 12451:
12452: <dd>
12453: <dl>
12454: <dt><span class="sect2"><a href=
1.68 rillig 12455: "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51 rillig 12456:
1.60 rillig 12457: <dt><span class="sect2"><a href=
1.68 rillig 12458: "#cpp-list-examples">16.4.2. Examples of CPP
1.60 rillig 12459: defines for some platforms</a></span></dt>
12460:
1.68 rillig 12461: <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51 rillig 12462: Getting a list of CPP defines</a></span></dt>
1.1 grant 12463: </dl>
12464: </dd>
12465:
1.30 wiz 12466: <dt><span class="sect1"><a href=
1.68 rillig 12467: "#package-specific-actions">16.5. Package specific
1.30 wiz 12468: actions</a></span></dt>
1.1 grant 12469:
12470: <dd>
12471: <dl>
12472: <dt><span class="sect2"><a href=
1.68 rillig 12473: "#user-interaction">16.5.1. User
1.2 hubertf 12474: interaction</a></span></dt>
1.1 grant 12475:
12476: <dt><span class="sect2"><a href=
1.68 rillig 12477: "#handling-licenses">16.5.2. Handling
1.1 grant 12478: licenses</a></span></dt>
12479:
12480: <dt><span class="sect2"><a href=
1.68 rillig 12481: "#installing-score-files">16.5.3. Installing score
1.1 grant 12482: files</a></span></dt>
12483:
12484: <dt><span class="sect2"><a href=
1.68 rillig 12485: "#perl-scripts">16.5.4. Packages containing perl
1.1 grant 12486: scripts</a></span></dt>
12487:
12488: <dt><span class="sect2"><a href=
1.68 rillig 12489: "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30 wiz 12490: paths to other interpreters</a></span></dt>
1.1 grant 12491:
12492: <dt><span class="sect2"><a href=
1.68 rillig 12493: "#perl-modules">16.5.6. Packages installing perl
1.1 grant 12494: modules</a></span></dt>
12495:
12496: <dt><span class="sect2"><a href=
1.68 rillig 12497: "#faq.info-files">16.5.7. Packages installing info
1.1 grant 12498: files</a></span></dt>
12499:
1.68 rillig 12500: <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57 minskim 12501: Packages installing man pages</a></span></dt>
12502:
1.1 grant 12503: <dt><span class="sect2"><a href=
1.68 rillig 12504: "#gconf2-data-files">16.5.9. Packages installing
1.30 wiz 12505: GConf2 data files</a></span></dt>
1.1 grant 12506:
12507: <dt><span class="sect2"><a href=
1.68 rillig 12508: "#scrollkeeper-data-files">16.5.10. Packages
1.30 wiz 12509: installing scrollkeeper data files</a></span></dt>
1.1 grant 12510:
12511: <dt><span class="sect2"><a href=
1.68 rillig 12512: "#x11-fonts">16.5.11. Packages installing X11
1.1 grant 12513: fonts</a></span></dt>
12514:
12515: <dt><span class="sect2"><a href=
1.68 rillig 12516: "#gtk2-modules">16.5.12. Packages installing GTK2
1.1 grant 12517: modules</a></span></dt>
12518:
12519: <dt><span class="sect2"><a href=
1.68 rillig 12520: "#sgml-xml-data">16.5.13. Packages installing SGML
1.30 wiz 12521: or XML data</a></span></dt>
1.1 grant 12522:
12523: <dt><span class="sect2"><a href=
1.68 rillig 12524: "#mime-database">16.5.14. Packages installing
1.1 grant 12525: extensions to the MIME database</a></span></dt>
12526:
12527: <dt><span class="sect2"><a href=
1.68 rillig 12528: "#intltool">16.5.15. Packages using
1.1 grant 12529: intltool</a></span></dt>
1.18 xtraeme 12530:
12531: <dt><span class="sect2"><a href=
1.68 rillig 12532: "#startup-scripts">16.5.16. Packages installing
1.30 wiz 12533: startup scripts</a></span></dt>
1.57 minskim 12534:
12535: <dt><span class="sect2"><a href=
1.68 rillig 12536: "#tex-packages">16.5.17. Packages installing TeX
1.57 minskim 12537: modules</a></span></dt>
1.1 grant 12538: </dl>
12539: </dd>
12540:
1.30 wiz 12541: <dt><span class="sect1"><a href=
1.68 rillig 12542: "#feedback-to-author">16.6. Feedback to the
1.30 wiz 12543: author</a></span></dt>
1.1 grant 12544: </dl>
12545: </div>
12546:
1.67 hubertf 12547: <div class="sect1" lang="en">
1.1 grant 12548: <div class="titlepage">
12549: <div>
12550: <div>
12551: <h2 class="title" style="clear: both"><a name=
1.68 rillig 12552: "general-operation"></a>16.1. General
1.1 grant 12553: operation</h2>
12554: </div>
12555: </div>
12556: </div>
12557:
1.67 hubertf 12558: <div class="sect2" lang="en">
1.1 grant 12559: <div class="titlepage">
12560: <div>
12561: <div>
1.30 wiz 12562: <h3 class="title"><a name=
1.68 rillig 12563: "pulling-vars-from-etc-mk.conf"></a>16.1.1. How
1.30 wiz 12564: to pull in variables from /etc/mk.conf</h3>
1.1 grant 12565: </div>
12566: </div>
12567: </div>
12568:
12569: <p>The problem with package-defined variables that can
1.14 xtraeme 12570: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 12571: or <code xmlns=
12572: "http://www.w3.org/TR/xhtml1/transitional" class=
12573: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 12574: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
12575: <span class="citerefentry"><span class=
12576: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 12577: variable as it is used, but evaluates preprocessor-like
1.1 grant 12578: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 12579: So, to use any variable (which may be set in
1.45 wiz 12580: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12581: class="filename">/etc/mk.conf</code>) in one of the
12582: .if* statements, the file <code xmlns=
12583: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12584: "filename">/etc/mk.conf</code> must be included before
1.1 grant 12585: that .if* statement.</p>
12586:
1.47 reed 12587: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 12588: including <code xmlns=
12589: "http://www.w3.org/TR/xhtml1/transitional" class=
12590: "filename">/etc/mk.conf</code>, should it exist, or
12591: <code class="varname">MAKECONF</code>, should it exist,
12592: include the <code xmlns=
12593: "http://www.w3.org/TR/xhtml1/transitional" class=
12594: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
12595: package Makefile before any preprocessor-like .if,
12596: .ifdef, or .ifndef statements:</p>
1.1 grant 12597: <pre class="programlisting">
1.51 rillig 12598: .include "../../mk/bsd.prefs.mk"
12599:
1.1 grant 12600: .if defined(USE_MENUS)
1.51 rillig 12601: # ...
1.1 grant 12602: .endif
12603: </pre>
12604:
1.14 xtraeme 12605: <p>If you wish to set the <code class=
1.45 wiz 12606: "varname">CFLAGS</code> variable in <code xmlns=
12607: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12608: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 12609: use:</p>
12610: <pre class="programlisting">
1.51 rillig 12611: CFLAGS+= -your -flags
1.1 grant 12612: </pre>
12613:
1.14 xtraeme 12614: <p>Using <code class="varname">CFLAGS=</code> (i.e.
12615: without the “<span class="quote">+</span>”)
12616: may lead to problems with packages that need to add
12617: their own flags. Also, you may want to take a look at
12618: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 12619: href=
12620: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 12621: target="_top"><code xmlns="" class=
12622: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 12623: interested in optimization for the current CPU.</p>
1.1 grant 12624: </div>
12625:
1.67 hubertf 12626: <div class="sect2" lang="en">
1.1 grant 12627: <div class="titlepage">
12628: <div>
12629: <div>
1.31 wiz 12630: <h3 class="title"><a name=
1.68 rillig 12631: "where-to-install-documentation"></a>16.1.2. Where
1.31 wiz 12632: to install documentation</h3>
12633: </div>
12634: </div>
12635: </div>
12636:
1.45 wiz 12637: <p>Documentation should be installed into <code xmlns=
12638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 12639: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 12640: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12641: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
12642: (the latter includes the version number of the
12643: package).</p>
1.31 wiz 12644: </div>
12645:
1.67 hubertf 12646: <div class="sect2" lang="en">
1.31 wiz 12647: <div class="titlepage">
12648: <div>
12649: <div>
1.67 hubertf 12650: <h3 class="title"><a name=
1.68 rillig 12651: "restricted-packages"></a>16.1.3. Restricted
1.1 grant 12652: packages</h3>
12653: </div>
12654: </div>
12655: </div>
12656:
12657: <p>Some licenses restrict how software may be
12658: re-distributed. In order to satisfy these restrictions,
12659: the package system defines five make variables that can
12660: be set to note these restrictions:</p>
12661:
12662: <div class="itemizedlist">
12663: <ul type="disc">
12664: <li>
1.14 xtraeme 12665: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 12666:
12667: <p>This variable should be set whenever a
12668: restriction exists (regardless of its kind). Set
12669: this variable to a string containing the reason
12670: for the restriction.</p>
12671: </li>
12672:
12673: <li>
1.14 xtraeme 12674: <p><code class=
12675: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 12676:
12677: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 12678: variable to <code class=
12679: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12680: package may not be included on a CD-ROM.</p>
12681: </li>
12682:
12683: <li>
1.14 xtraeme 12684: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 12685:
12686: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 12687: Set this variable to <code class=
12688: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 12689: package may not not be made available on the
12690: Internet.</p>
12691: </li>
12692:
12693: <li>
1.14 xtraeme 12694: <p><code class=
12695: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 12696:
12697: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 12698: this variable to <code class=
12699: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12700: of the source code or other distfile(s) is not
12701: allowed on CD-ROMs.</p>
12702: </li>
12703:
12704: <li>
1.14 xtraeme 12705: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 12706:
12707: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 12708: variable to <code class=
12709: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 12710: of the source code or other distfile(s) via the
12711: Internet is not allowed.</p>
12712: </li>
12713: </ul>
12714: </div>
12715:
1.14 xtraeme 12716: <p>Please note that the use of <code class=
12717: "varname">NO_PACKAGE</code>, <code class=
12718: "varname">IGNORE</code>, <code class=
12719: "varname">NO_CDROM</code>, or other generic make
1.1 grant 12720: variables to denote restrictions is deprecated, because
12721: they unconditionally prevent users from generating
12722: binary packages!</p>
12723: </div>
12724:
1.67 hubertf 12725: <div class="sect2" lang="en">
1.1 grant 12726: <div class="titlepage">
12727: <div>
12728: <div>
1.67 hubertf 12729: <h3 class="title"><a name=
1.68 rillig 12730: "dependencies"></a>16.1.4. Handling
1.1 grant 12731: dependencies</h3>
12732: </div>
12733: </div>
12734: </div>
12735:
12736: <p>Your package may depend on some other package being
12737: present - and there are various ways of expressing this
1.14 xtraeme 12738: dependency. pkgsrc supports the <code class=
12739: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 12740: "varname">DEPENDS</code> definitions, the <code class=
12741: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 12742: dependencies via <code xmlns=
12743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12744: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 12745: way to handle dependencies, and which uses the
12746: variables named above. See <a href="#buildlink" title=
1.38 dillo 12747: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 12748: <i>Buildlink methodology</i></a> for more
12749: information.</p>
12750:
12751: <p>The basic difference between the two variables is as
1.14 xtraeme 12752: follows: The <code class="varname">DEPENDS</code>
1.1 grant 12753: definition registers that pre-requisite in the binary
12754: package so it will be pulled in when the binary package
1.14 xtraeme 12755: is later installed, whilst the <code class=
12756: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 12757: marking a dependency that is only needed for building
12758: the package.</p>
12759:
12760: <p>This means that if you only need a package present
12761: whilst you are building, it should be noted as a
1.14 xtraeme 12762: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 12763:
1.14 xtraeme 12764: <p>The format for a <code class=
12765: "varname">BUILD_DEPENDS</code> and a <code class=
12766: "varname">DEPENDS</code> definition is:</p>
1.1 grant 12767: <pre class="programlisting">
1.51 rillig 12768: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 12769: </pre>
12770:
12771: <p>Please note that the “<span class=
12772: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 12773: any of the wildcard version numbers recognized by
1.1 grant 12774: <a href=
12775: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
12776: <span class="citerefentry"><span class=
12777: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12778:
12779: <div class="orderedlist">
12780: <ol type="1">
12781: <li>
12782: <p>If your package needs another package's
12783: binaries or libraries to build or run, and if
1.45 wiz 12784: that package has a <code xmlns=
12785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12786: "filename">buildlink3.mk</code> file available,
12787: use it:</p>
1.1 grant 12788: <pre class="programlisting">
12789: .include "../../graphics/jpeg/buildlink3.mk"
12790: </pre>
12791: </li>
12792:
12793: <li>
12794: <p>If your package needs to use another package
1.45 wiz 12795: to build itself and there is no <code xmlns=
12796: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12797: "filename">buildlink3.mk</code> file available,
12798: use the <code class=
12799: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12800: <pre class="programlisting">
1.51 rillig 12801: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12802: </pre>
12803: </li>
12804:
12805: <li>
12806: <p>If your package needs a library with which to
1.45 wiz 12807: link and again there is no <code xmlns=
12808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12809: "filename">buildlink3.mk</code> file available,
12810: this is specified using the <code class=
1.71 wiz 12811: "varname">DEPENDS</code> definition. For
12812: example:</p>
1.1 grant 12813: <pre class="programlisting">
1.51 rillig 12814: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12815: </pre>
12816:
12817: <p>You can also use wildcards in package
12818: dependences:</p>
12819: <pre class="programlisting">
1.51 rillig 12820: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12821: </pre>
12822:
12823: <p>Note that such wildcard dependencies are
12824: retained when creating binary packages. The
12825: dependency is checked when installing the binary
12826: package and any package which matches the pattern
12827: will be used. Wildcard dependencies should be
12828: used with care.</p>
12829:
12830: <p>The “<span class=
12831: "quote">-[0-9]*</span>” should be used
12832: instead of “<span class=
12833: "quote">-*</span>” to avoid potentially
12834: ambiguous matches such as “<span class=
12835: "quote">tk-postgresql</span>” matching a
12836: “<span class="quote">tk-*</span>”
1.14 xtraeme 12837: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12838:
12839: <p>Wildcards can also be used to specify that a
12840: package will only build against a certain minimum
12841: version of a pre-requisite:</p>
12842: <pre class="programlisting">
1.51 rillig 12843: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12844: </pre>
12845:
12846: <p>This means that the package will build against
12847: version 3.5.4 of the tiff library or newer. Such
12848: a dependency may be warranted if, for example,
12849: the API of the library has changed with version
12850: 3.5.4 and a package would not compile against an
12851: earlier version of tiff.</p>
12852:
12853: <p>Please note that such dependencies should only
12854: be updated if a package requires a newer
12855: pre-requisite, but not to denote recommendations
1.72 rillig 12856: such as ABI changes that do not prevent a package
12857: from building correctly. Such recommendations can
12858: be expressed using <code class=
12859: "varname">ABI_DEPENDS</code>:</p>
1.1 grant 12860: <pre class="programlisting">
1.72 rillig 12861: ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12862: </pre>
12863:
1.14 xtraeme 12864: <p>In addition to the above <code class=
12865: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12866: while a package will build against
12867: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12868: recommended. <code class=
1.72 rillig 12869: "varname">ABI_DEPENDS</code> entries will be
1.14 xtraeme 12870: turned into dependencies unless explicitly
12871: ignored (in which case a warning will be
1.36 wiz 12872: printed).</p>
12873:
1.72 rillig 12874: <p>To ignore these ABI dependency recommendations
12875: and just use the required <code class=
1.36 wiz 12876: "varname">DEPENDS</code>, set <code class=
1.72 rillig 12877: "varname">USE_ABI_DEPENDS=NO</code>. This may
1.36 wiz 12878: make it easier and faster to update packages
12879: built using pkgsrc, since older compatible
12880: dependencies can continue to be used. This is
12881: useful for people who watch their rebuilds very
12882: carefully; it is not very good as a
12883: general-purpose hammer. If you use it, you need
12884: to be mindful of possible ABI changes, including
12885: those from the underlying OS.</p>
12886:
12887: <p>Packages that are built with recommendations
12888: ignored may not be uploaded to ftp.NetBSD.org by
12889: developers and should not be used across
12890: different systems that may have different
12891: versions of binary packages installed.</p>
1.1 grant 12892:
12893: <p>For security fixes, please update the package
1.72 rillig 12894: vulnerabilities file. See <a href=
12895: "#security-handling" title=
1.68 rillig 12896: "16.1.8. Handling packages with security problems">
12897: Section 16.1.8, “Handling packages
1.67 hubertf 12898: with security problems”</a> for more
1.1 grant 12899: information.</p>
12900: </li>
12901:
12902: <li>
12903: <p>If your package needs some executable to be
1.17 sketch 12904: able to run correctly and if there's no
1.45 wiz 12905: <code xmlns=
12906: "http://www.w3.org/TR/xhtml1/transitional" class=
12907: "filename">buildlink3.mk</code> file, this is
12908: specified using the <code class=
1.14 xtraeme 12909: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12910: "http://www.w3.org/TR/xhtml1/transitional" href=
12911: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12912: target="_top"><code xmlns="" class=
12913: "filename">print/lyx</code></a> package needs to
12914: be able to execute the latex binary from the
12915: teTeX package when it runs, and that is
12916: specified:</p>
1.1 grant 12917: <pre class="programlisting">
1.51 rillig 12918: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12919: </pre>
12920:
12921: <p>The comment about wildcard dependencies from
12922: previous paragraph applies here, too.</p>
12923: </li>
12924: </ol>
12925: </div>
12926:
12927: <p>If your package needs files from another package to
1.71 wiz 12928: build, add the relevant distribution files to
12929: <code class="varname">DISTFILES</code>, so they will be
12930: extracted automatically. See the <a xmlns=
1.1 grant 12931: "http://www.w3.org/TR/xhtml1/transitional" href=
1.71 wiz 12932: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript/README.html"
1.45 wiz 12933: target="_top"><code xmlns="" class=
1.71 wiz 12934: "filename">print/ghostscript</code></a> package for an
12935: example. (It relies on the jpeg sources being present
12936: in source form during the build.)</p>
1.1 grant 12937:
1.14 xtraeme 12938: <p>Please also note the <code class=
12939: "varname">BUILD_USES_MSGFMT</code> and <code class=
12940: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12941: which are provided as convenience definitions. The
1.24 wiz 12942: former works out whether <a href=
12943: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12944: <span class="citerefentry"><span class=
12945: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12946: the base system, and, if it isn't, installs the
12947: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12948: href=
1.1 grant 12949: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12950: target="_top"><code xmlns="" class=
12951: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12952: adds a build dependency on either an installed version
12953: of an older gettext package, or if it isn't, installs
12954: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12955: href=
12956: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12957: target="_top"><code xmlns="" class=
12958: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12959: </div>
12960:
1.67 hubertf 12961: <div class="sect2" lang="en">
1.1 grant 12962: <div class="titlepage">
12963: <div>
12964: <div>
1.67 hubertf 12965: <h3 class="title"><a name=
1.68 rillig 12966: "conflicts"></a>16.1.5. Handling conflicts
1.1 grant 12967: with other packages</h3>
12968: </div>
12969: </div>
12970: </div>
12971:
12972: <p>Your package may conflict with other packages a user
12973: might already have installed on his system, e.g. if
12974: your package installs the same set of files like
12975: another package in our pkgsrc tree.</p>
12976:
1.14 xtraeme 12977: <p>In this case you can set <code class=
1.47 reed 12978: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12979: packages (including version string) your package
12980: conflicts with.</p>
12981:
1.47 reed 12982: <p>For example, <a xmlns=
1.1 grant 12983: "http://www.w3.org/TR/xhtml1/transitional" href=
12984: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12985: target="_top"><code xmlns="" class=
12986: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12987: "http://www.w3.org/TR/xhtml1/transitional" href=
12988: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12989: target="_top"><code xmlns="" class=
1.47 reed 12990: "filename">x11/Xaw-Xpm</code></a> install the same
12991: shared library, thus you set in <code xmlns=
1.45 wiz 12992: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12993: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12994: <pre class="programlisting">
1.51 rillig 12995: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12996: </pre>
12997:
1.45 wiz 12998: <p>and in <code xmlns=
12999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13000: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 13001: <pre class="programlisting">
1.51 rillig 13002: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 13003: </pre>
13004:
13005: <p>Packages will automatically conflict with other
13006: packages with the name prefix and a different version
13007: string. “<span class=
13008: "quote">Xaw3d-1.5</span>” e.g. will automatically
13009: conflict with the older version “<span class=
13010: "quote">Xaw3d-1.3</span>”.</p>
13011: </div>
13012:
1.67 hubertf 13013: <div class="sect2" lang="en">
1.1 grant 13014: <div class="titlepage">
13015: <div>
13016: <div>
1.67 hubertf 13017: <h3 class="title"><a name=
1.68 rillig 13018: "not-building-packages"></a>16.1.6. Packages
1.30 wiz 13019: that cannot or should not be built</h3>
1.1 grant 13020: </div>
13021: </div>
13022: </div>
13023:
13024: <p>There are several reasons why a package might be
13025: instructed to not build under certain circumstances. If
13026: the package builds and runs on most platforms, the
1.14 xtraeme 13027: exceptions should be noted with <code class=
13028: "varname">NOT_FOR_PLATFORM</code>. If the package
13029: builds and runs on a small handful of platforms, set
13030: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 13031: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
13032: <code class="varname">NOT_FOR_PLATFORM</code> are OS
13033: triples (OS-version-platform) that can use glob-style
13034: wildcards.</p>
13035:
13036: <p>If the package should be skipped (for example,
13037: because it provides functionality already provided by
13038: the system), set <code class=
1.14 xtraeme 13039: "varname">PKG_SKIP_REASON</code> to a descriptive
13040: message. If the package should fail because some
13041: preconditions are not met, set <code class=
13042: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 13043: message.</p>
13044: </div>
13045:
1.67 hubertf 13046: <div class="sect2" lang="en">
1.1 grant 13047: <div class="titlepage">
13048: <div>
13049: <div>
1.67 hubertf 13050: <h3 class="title"><a name=
1.68 rillig 13051: "undeletable-packages"></a>16.1.7. Packages
1.30 wiz 13052: which should not be deleted, once installed</h3>
1.1 grant 13053: </div>
13054: </div>
13055: </div>
13056:
13057: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 13058: has been installed, the <code class=
13059: "varname">PKG_PRESERVE</code> definition should be set
13060: in the package Makefile. This will be carried into any
1.1 grant 13061: binary package that is made from this pkgsrc entry. A
13062: “<span class="quote">preserved</span>”
13063: package will not be deleted using <a href=
13064: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
13065: <span class="citerefentry"><span class=
13066: "refentrytitle">pkg_delete</span>(1)</span></a> unless
13067: the “<span class="quote">-f</span>” option
13068: is used.</p>
13069: </div>
13070:
1.67 hubertf 13071: <div class="sect2" lang="en">
1.1 grant 13072: <div class="titlepage">
13073: <div>
13074: <div>
1.67 hubertf 13075: <h3 class="title"><a name=
1.68 rillig 13076: "security-handling"></a>16.1.8. Handling
1.1 grant 13077: packages with security problems</h3>
13078: </div>
13079: </div>
13080: </div>
13081:
13082: <p>When a vulnerability is found, this should be noted
1.45 wiz 13083: in <code xmlns=
13084: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13085: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 13086: and after committing that file, use
13087: <span><strong class="command">make
13088: upload</strong></span> in the same directory to update
13089: the file on ftp.NetBSD.org.</p>
13090:
13091: <p>After fixing the vulnerability by a patch, its
13092: <code class="varname">PKGREVISION</code> should be
13093: increased (this is of course not necessary if the
13094: problem is fixed by using a newer release of the
1.72 rillig 13095: software).</p>
1.1 grant 13096:
13097: <p>Also, if the fix should be applied to the stable
13098: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 13099:
13100: <p>Binary packages already on ftp.NetBSD.org will be
13101: handled semi-automatically by a weekly cron job.</p>
1.1 grant 13102: </div>
13103:
1.67 hubertf 13104: <div class="sect2" lang="en">
1.1 grant 13105: <div class="titlepage">
13106: <div>
13107: <div>
1.67 hubertf 13108: <h3 class="title"><a name=
1.68 rillig 13109: "compiler-bugs"></a>16.1.9. How to handle
1.1 grant 13110: compiler bugs</h3>
13111: </div>
13112: </div>
13113: </div>
13114:
13115: <p>Some source files trigger bugs in the compiler,
13116: based on combinations of compiler version and
13117: architecture and almost always relation to optimisation
13118: being enabled. Common symptoms are gcc internal errors
13119: or never finishing compiling a file.</p>
13120:
1.47 reed 13121: <p>Typically, a workaround involves testing the
1.14 xtraeme 13122: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 13123: version, disabling optimisation for that
1.14 xtraeme 13124: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 13125: combination, and documenting it in <code xmlns=
13126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13127: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 13128: number of examples!</p>
13129: </div>
13130:
1.67 hubertf 13131: <div class="sect2" lang="en">
1.1 grant 13132: <div class="titlepage">
13133: <div>
13134: <div>
1.67 hubertf 13135: <h3 class="title"><a name=
1.68 rillig 13136: "bumping-pkgrevision"></a>16.1.10. How to
1.30 wiz 13137: handle incrementing versions when fixing an
13138: existing package</h3>
1.1 grant 13139: </div>
13140: </div>
13141: </div>
13142:
13143: <p>When making fixes to an existing package it can be
1.14 xtraeme 13144: useful to change the version number in <code class=
13145: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 13146: future versions by the original author, a
13147: “<span class="quote">nb1</span>”,
13148: “<span class="quote">nb2</span>”, ...
13149: suffix can be used on package versions by setting
1.14 xtraeme 13150: <code class="varname">PKGREVISION=1</code> (2, ...).
13151: The “<span class="quote">nb</span>” is
13152: treated like a “<span class=
13153: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 13154: <pre class="programlisting">
1.51 rillig 13155: DISTNAME= foo-17.42
13156: PKGREVISION= 9
1.1 grant 13157: </pre>
13158:
1.14 xtraeme 13159: <p>will result in a <code class=
13160: "varname">PKGNAME</code> of “<span class=
1.1 grant 13161: "quote">foo-17.42nb9</span>”.</p>
13162:
13163: <p>When a new release of the package is released, the
1.14 xtraeme 13164: <code class="varname">PKGREVISION</code> should be
1.47 reed 13165: removed, e.g. on a new minor release of the above
1.14 xtraeme 13166: package, things should be like:</p>
1.1 grant 13167: <pre class="programlisting">
1.51 rillig 13168: DISTNAME= foo-17.43
1.1 grant 13169: </pre>
13170: </div>
13171:
1.67 hubertf 13172: <div class="sect2" lang="en">
1.1 grant 13173: <div class="titlepage">
13174: <div>
13175: <div>
1.30 wiz 13176: <h3 class="title"><a name=
1.68 rillig 13177: "portability-of-packages"></a>16.1.11. Portability
1.30 wiz 13178: of packages</h3>
1.1 grant 13179: </div>
13180: </div>
13181: </div>
13182:
13183: <p>One appealing feature of pkgsrc is that it runs on
13184: many different platforms. As a result, it is important
13185: to ensure, where possible, that packages in pkgsrc are
13186: portable. There are some particular details you should
13187: pay attention to while working on pkgsrc.</p>
13188:
1.67 hubertf 13189: <div class="sect3" lang="en">
1.1 grant 13190: <div class="titlepage">
13191: <div>
13192: <div>
1.67 hubertf 13193: <h4 class="title"><a name=
1.68 rillig 13194: "install-scripts"></a>16.1.11.1. ${INSTALL},
1.1 grant 13195: ${INSTALL_DATA_DIR}, ...</h4>
13196: </div>
13197: </div>
13198: </div>
13199:
1.14 xtraeme 13200: <p>The BSD-compatible <span><strong class=
13201: "command">install</strong></span> supplied with some
1.1 grant 13202: operating systems will not perform more than one
13203: operation at a time. As such, you should call
13204: “<span class="quote">${INSTALL}</span>”,
13205: etc. like this:</p>
13206: <pre class="programlisting">
1.51 rillig 13207: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
13208: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 13209: </pre>
13210: </div>
13211: </div>
13212: </div>
13213:
1.67 hubertf 13214: <div class="sect1" lang="en">
1.1 grant 13215: <div class="titlepage">
13216: <div>
13217: <div>
13218: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13219: "downloading-issues"></a>16.2. Possible
1.1 grant 13220: downloading issues</h2>
13221: </div>
13222: </div>
13223: </div>
13224:
1.67 hubertf 13225: <div class="sect2" lang="en">
1.1 grant 13226: <div class="titlepage">
13227: <div>
13228: <div>
1.67 hubertf 13229: <h3 class="title"><a name=
1.68 rillig 13230: "no-plain-download"></a>16.2.1. Packages
1.30 wiz 13231: whose distfiles aren't available for plain
1.1 grant 13232: downloading</h3>
13233: </div>
13234: </div>
13235: </div>
13236:
13237: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 13238: set <code class="varname">DYNAMIC_MASTER_SITES</code>
13239: and a <span><strong class="command">make
1.45 wiz 13240: fetch</strong></span> will call <code xmlns=
13241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13242: "filename">files/getsite.sh</code> with the name of
13243: each file to download as an argument, expecting it to
13244: output the URL of the directory from which to download
13245: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
13246: href=
1.1 grant 13247: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 13248: target="_top"><code xmlns="" class=
13249: "filename">graphics/ns-cult3d</code></a> is an example
13250: of this usage.</p>
1.1 grant 13251:
13252: <p>If the download can't be automated, because the user
13253: must submit personal information to apply for a
13254: password, or must pay for the source, or whatever, you
1.14 xtraeme 13255: can set <code class="varname">_FETCH_MESSAGE</code> to
13256: a macro which displays a message explaining the
13257: situation. <code class="varname">_FETCH_MESSAGE</code>
13258: must be executable shell commands, not just a message.
13259: (Generally, it executes <code class=
1.71 wiz 13260: "varname">${ECHO}</code>). See one of the following
13261: packages for an example: <a xmlns=
1.20 ben 13262: "http://www.w3.org/TR/xhtml1/transitional" href=
13263: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 13264: target="_top"><code xmlns="" class=
13265: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 13266: "http://www.w3.org/TR/xhtml1/transitional" href=
13267: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 13268: target="_top"><code xmlns="" class=
1.71 wiz 13269: "filename">sysutils/storage-manager</code></a>.</p>
1.1 grant 13270: </div>
13271:
1.67 hubertf 13272: <div class="sect2" lang="en">
1.1 grant 13273: <div class="titlepage">
13274: <div>
13275: <div>
1.30 wiz 13276: <h3 class="title"><a name=
1.68 rillig 13277: "modified-distfiles-same-name"></a>16.2.2. How
1.30 wiz 13278: to handle modified distfiles with the 'old'
13279: name</h3>
1.1 grant 13280: </div>
13281: </div>
13282: </div>
13283:
13284: <p>Sometimes authors of a software package make some
13285: modifications after the software was released, and they
13286: put up a new distfile without changing the package's
13287: version number. If a package is already in pkgsrc at
1.32 wiz 13288: that time, the checksum will no longer match. The
13289: contents of the new distfile should be compared against
13290: the old one before changing anything, to make sure the
13291: distfile was really updated on purpose, and that no
13292: trojan horse or so crept in. Then, the correct way to
13293: work around this is to set <code class=
13294: "varname">DIST_SUBDIR</code> to a unique directory
13295: name, usually based on <code class=
13296: "varname">PKGNAME_NOREV</code>. In case this happens
13297: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 13298: used (thus including the <code xmlns=
13299: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13300: "filename">nbX</code> suffix) or a date stamp can be
13301: appended, like <code class=
13302: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 13303: forget regenerating the <code xmlns=
13304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 13305: "filename">distinfo</code> file after that, since it
13306: contains the <code class="varname">DIST_SUBDIR</code>
13307: path in the filenames. Furthermore, a mail to the
13308: package's authors seems appropriate telling them that
13309: changing distfiles after releases without changing the
13310: file names is not good practice.</p>
1.1 grant 13311: </div>
13312: </div>
13313:
1.67 hubertf 13314: <div class="sect1" lang="en">
1.1 grant 13315: <div class="titlepage">
13316: <div>
13317: <div>
13318: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13319: "configuration-gotchas"></a>16.3. Configuration
1.1 grant 13320: gotchas</h2>
13321: </div>
13322: </div>
13323: </div>
13324:
1.67 hubertf 13325: <div class="sect2" lang="en">
1.1 grant 13326: <div class="titlepage">
13327: <div>
13328: <div>
1.67 hubertf 13329: <h3 class="title"><a name=
1.68 rillig 13330: "fixes.libtool"></a>16.3.1. Shared libraries
1.1 grant 13331: - libtool</h3>
13332: </div>
13333: </div>
13334: </div>
13335:
13336: <p>pkgsrc supports many different machines, with
13337: different object formats like a.out and ELF, and
13338: varying abilities to do shared library and dynamic
13339: loading at all. To accompany this, varying commands and
13340: options have to be passed to the compiler, linker, etc.
13341: to get the Right Thing, which can be pretty annoying
13342: especially if you don't have all the machines at your
13343: hand to test things. The <a xmlns=
13344: "http://www.w3.org/TR/xhtml1/transitional" href=
13345: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 13346: target="_top"><code xmlns="" class=
13347: "filename">devel/libtool</code></a> pkg can help here,
13348: as it just “<span class=
13349: "quote">knows</span>” how to build both static
13350: and dynamic libraries from a set of source files, thus
1.47 reed 13351: being platform-independent.</p>
1.1 grant 13352:
13353: <p>Here's how to use libtool in a pkg in seven simple
13354: steps:</p>
13355:
13356: <div class="orderedlist">
13357: <ol type="1">
13358: <li>
1.14 xtraeme 13359: <p>Add <code class=
13360: "varname">USE_LIBTOOL=yes</code> to the package
13361: Makefile.</p>
1.1 grant 13362: </li>
13363:
13364: <li>
13365: <p>For library objects, use “<span class=
13366: "quote">${LIBTOOL} --mode=compile
13367: ${CC}</span>” in place of
13368: “<span class="quote">${CC}</span>”.
13369: You could even add it to the definition of
1.14 xtraeme 13370: <code class="varname">CC</code>, if only
13371: libraries are being built in a given Makefile.
13372: This one command will build both PIC and non-PIC
13373: library objects, so you need not have separate
13374: shared and non-shared library rules.</p>
1.1 grant 13375: </li>
13376:
13377: <li>
13378: <p>For the linking of the library, remove any
13379: “<span class="quote">ar</span>”,
13380: “<span class="quote">ranlib</span>”,
13381: and “<span class="quote">ld
13382: -Bshareable</span>” commands, and instead
13383: use:</p>
13384: <pre class="programlisting">
1.51 rillig 13385: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
13386: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 13387: </pre>
13388:
13389: <p>Note that the library is changed to have a
1.45 wiz 13390: <code xmlns=
13391: "http://www.w3.org/TR/xhtml1/transitional" class=
13392: "filename">.la</code> extension, and the objects
13393: are changed to have a <code xmlns=
13394: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13395: "filename">.lo</code> extension. Change
13396: <code class="varname">OBJS</code> as necessary.
13397: This automatically creates all of the
1.45 wiz 13398: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13399: class="filename">.a</code>, <code xmlns=
13400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13401: "filename">.so.major.minor</code>, and ELF
13402: symlinks (if necessary) in the build directory.
13403: Be sure to include “<span class=
1.1 grant 13404: "quote">-version-info</span>”, especially
13405: when major and minor are zero, as libtool will
13406: otherwise strip off the shared library
13407: version.</p>
13408:
13409: <p>From the libtool manual:</p>
13410: <pre class="programlisting">
1.51 rillig 13411: So, libtool library versions are described by three integers:
1.1 grant 13412:
1.51 rillig 13413: CURRENT
13414: The most recent interface number that this library implements.
1.1 grant 13415:
1.51 rillig 13416: REVISION
13417: The implementation number of the CURRENT interface.
1.1 grant 13418:
1.51 rillig 13419: AGE
13420: The difference between the newest and oldest interfaces that
13421: this library implements. In other words, the library implements
13422: all the interface numbers in the range from number `CURRENT -
13423: AGE' to `CURRENT'.
1.68 rillig 13424:
1.51 rillig 13425: If two libraries have identical CURRENT and AGE numbers, then the
13426: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 13427: </pre>
13428:
13429: <p>The “<span class=
13430: "quote">-release</span>” option will
13431: produce different results for a.out and ELF
13432: (excluding symlinks) in only one case. An ELF
13433: library of the form “<span class=
13434: "quote">libfoo-release.so.<span class=
13435: "emphasis"><em>x</em></span>.<span class=
13436: "emphasis"><em>y</em></span></span>” will
13437: have a symlink of “<span class=
13438: "quote">libfoo.so.<span class=
13439: "emphasis"><em>x</em></span>.<span class=
13440: "emphasis"><em>y</em></span></span>” on an
13441: a.out platform. This is handled
13442: automatically.</p>
13443:
13444: <p>The “<span class="quote">-rpath
13445: argument</span>” is the install directory
13446: of the library being built.</p>
13447:
1.45 wiz 13448: <p>In the <code xmlns=
13449: "http://www.w3.org/TR/xhtml1/transitional" class=
13450: "filename">PLIST</code>, include only the
13451: <code xmlns=
13452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 13453: "filename">.la</code> file, the other files will
13454: be added automatically.</p>
1.1 grant 13455: </li>
13456:
13457: <li>
1.45 wiz 13458: <p>When linking shared object (<code xmlns=
13459: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13460: "filename">.so</code>) files, i.e. files that are
1.24 wiz 13461: loaded via <a href=
13462: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
13463: <span class="citerefentry"><span class=
13464: "refentrytitle">dlopen</span>(3)</span></a>, NOT
13465: shared libraries, use “<span class=
13466: "quote">-module -avoid-version</span>” to
13467: prevent them getting version tacked on.</p>
1.1 grant 13468:
1.45 wiz 13469: <p>The <code xmlns=
13470: "http://www.w3.org/TR/xhtml1/transitional" class=
13471: "filename">PLIST</code> file gets the
13472: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13473: class="filename">foo.so</code> entry.</p>
1.1 grant 13474: </li>
13475:
13476: <li>
13477: <p>When linking programs that depend on these
13478: libraries <span class=
13479: "emphasis"><em>before</em></span> they are
13480: installed, preface the <a href=
13481: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
13482: <span class="citerefentry"><span class=
13483: "refentrytitle">cc</span>(1)</span></a> or
13484: <a href=
13485: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
13486: <span class="citerefentry"><span class=
13487: "refentrytitle">ld</span>(1)</span></a> line with
13488: “<span class="quote">${LIBTOOL}
13489: --mode=link</span>”, and it will find the
13490: correct libraries (static or shared), but please
13491: be aware that libtool will not allow you to
13492: specify a relative path in -L (such as
13493: “<span class=
13494: "quote">-L../somelib</span>”), because it
13495: expects you to change that argument to be the
1.45 wiz 13496: <code xmlns=
13497: "http://www.w3.org/TR/xhtml1/transitional" class=
13498: "filename">.la</code> file. e.g.</p>
1.1 grant 13499: <pre class="programlisting">
1.51 rillig 13500: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 13501: </pre>
13502:
13503: <p>should be changed to:</p>
13504: <pre class="programlisting">
1.51 rillig 13505: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 13506: "replaceable"><code>someprog</code></em> <em class=
13507: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 13508: </pre>
13509:
13510: <p>and it will do the right thing with the
13511: libraries.</p>
13512: </li>
13513:
13514: <li>
13515: <p>When installing libraries, preface the
13516: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
13517: <span class="citerefentry"><span class=
13518: "refentrytitle">install</span>(1)</span></a> or
13519: <a href=
13520: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
13521: <span class="citerefentry"><span class=
13522: "refentrytitle">cp</span>(1)</span></a> command
13523: with “<span class="quote">${LIBTOOL}
13524: --mode=install</span>”, and change the
1.45 wiz 13525: library name to <code xmlns=
13526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13527: "filename">.la</code>. e.g.</p>
1.1 grant 13528: <pre class="programlisting">
1.51 rillig 13529: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 13530: </pre>
13531:
1.45 wiz 13532: <p>This will install the static <code xmlns=
13533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13534: "filename">.a</code>, shared library, any needed
1.1 grant 13535: symlinks, and run <a href=
13536: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
13537: <span class="citerefentry"><span class=
13538: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
13539: </li>
13540:
13541: <li>
1.45 wiz 13542: <p>In your <code xmlns=
13543: "http://www.w3.org/TR/xhtml1/transitional" class=
13544: "filename">PLIST</code>, include only the
13545: <code xmlns=
13546: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 13547: "filename">.la</code> file (this is a change from
13548: previous behaviour).</p>
1.1 grant 13549: </li>
13550: </ol>
13551: </div>
13552: </div>
13553:
1.67 hubertf 13554: <div class="sect2" lang="en">
1.1 grant 13555: <div class="titlepage">
13556: <div>
13557: <div>
1.67 hubertf 13558: <h3 class="title"><a name=
1.68 rillig 13559: "using-libtool"></a>16.3.2. Using libtool on
1.30 wiz 13560: GNU packages that already support libtool</h3>
1.1 grant 13561: </div>
13562: </div>
13563: </div>
13564:
1.14 xtraeme 13565: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
13566: the package Makefile. This will override the package's
13567: own libtool in most cases. For older libtool using
1.1 grant 13568: packages, libtool is made by ltconfig script during the
13569: do-configure step; you can check the libtool script
1.14 xtraeme 13570: location by doing <span><strong class="command">make
13571: configure; find work*/ -name
13572: libtool</strong></span>.</p>
13573:
13574: <p><code class="varname">LIBTOOL_OVERRIDE</code>
13575: specifies which libtool scripts, relative to
13576: <code class="varname">WRKSRC</code>, to override. By
13577: default, it is set to “<span class=
13578: "quote">libtool */libtool */*/libtool</span>”. If
13579: this does not match the location of the package's
13580: libtool script(s), set it as appropriate.</p>
1.13 hubertf 13581:
1.45 wiz 13582: <p>If you do not need <code xmlns=
13583: "http://www.w3.org/TR/xhtml1/transitional" class=
13584: "filename">*.a</code> static libraries built and
13585: installed, then use <code class=
13586: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 13587:
1.47 reed 13588: <p>If your package makes use of the
13589: platform-independent library for loading dynamic shared
13590: objects, that comes with libtool (libltdl), you should
13591: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 13592:
13593: <p>Some packages use libtool incorrectly so that the
13594: package may not work or build in some circumstances.
13595: Some of the more common errors are:</p>
13596:
13597: <div class="itemizedlist">
13598: <ul type="disc">
13599: <li>
13600: <p>The inclusion of a shared object (-module) as
13601: a dependent library in an executable or library.
13602: This in itself isn't a problem if one of two
13603: things has been done:</p>
13604:
13605: <div class="orderedlist">
13606: <ol type="1">
13607: <li>
13608: <p>The shared object is named correctly,
1.45 wiz 13609: i.e. <code xmlns=
13610: "http://www.w3.org/TR/xhtml1/transitional"
13611: class="filename">libfoo.la</code>, not
13612: <code xmlns=
13613: "http://www.w3.org/TR/xhtml1/transitional"
13614: class="filename">foo.la</code></p>
1.1 grant 13615: </li>
13616:
13617: <li>
13618: <p>The -dlopen option is used when linking
13619: an executable.</p>
13620: </li>
13621: </ol>
13622: </div>
13623: </li>
13624:
13625: <li>
13626: <p>The use of libltdl without the correct calls
13627: to initialisation routines. The function
13628: lt_dlinit() should be called and the macro
1.14 xtraeme 13629: <code class=
13630: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 13631: included in executables.</p>
13632: </li>
13633: </ul>
13634: </div>
13635: </div>
13636:
1.67 hubertf 13637: <div class="sect2" lang="en">
1.1 grant 13638: <div class="titlepage">
13639: <div>
13640: <div>
1.67 hubertf 13641: <h3 class="title"><a name=
1.68 rillig 13642: "autoconf-automake"></a>16.3.3. GNU
1.1 grant 13643: Autoconf/Automake</h3>
13644: </div>
13645: </div>
13646: </div>
13647:
13648: <p>If a package needs GNU autoconf or automake to be
13649: executed to regenerate the configure script and
13650: Makefile.in makefile templates, then they should be
1.35 jmmv 13651: executed in a pre-configure target.</p>
1.1 grant 13652:
13653: <p>For packages that need only autoconf:</p>
13654: <pre class="programlisting">
1.51 rillig 13655: AUTOCONF_REQD= 2.50 # if default version is not good enough
13656: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
13657: ...
1.1 grant 13658:
1.51 rillig 13659: pre-configure:
13660: cd ${WRKSRC}; autoconf
1.1 grant 13661:
1.51 rillig 13662: ...
1.1 grant 13663: </pre>
13664:
13665: <p>and for packages that need automake and
13666: autoconf:</p>
13667: <pre class="programlisting">
1.51 rillig 13668: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
13669: USE_TOOLS+= automake # use "automake14" for automake-1.4
13670: ...
1.1 grant 13671:
1.51 rillig 13672: pre-configure:
13673: cd ${WRKSRC}; \
13674: aclocal; autoheader; \
13675: automake -a --foreign -i; autoconf
13676:
13677: ...
1.1 grant 13678: </pre>
13679:
13680: <p>Packages which use GNU Automake will almost
1.35 jmmv 13681: certainly require GNU Make.</p>
1.1 grant 13682:
13683: <p>There are times when the configure process makes
13684: additional changes to the generated files, which then
13685: causes the build process to try to re-execute the
13686: automake sequence. This is prevented by touching
13687: various files in the configure stage. If this causes
1.14 xtraeme 13688: problems with your package you can set <code class=
13689: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 13690: Makefile.</p>
13691: </div>
13692: </div>
13693:
1.67 hubertf 13694: <div class="sect1" lang="en">
1.1 grant 13695: <div class="titlepage">
13696: <div>
13697: <div>
13698: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13699: "fixes-build"></a>16.4. Building the
1.55 rillig 13700: package</h2>
1.1 grant 13701: </div>
13702: </div>
13703: </div>
13704:
1.67 hubertf 13705: <div class="sect2" lang="en">
1.1 grant 13706: <div class="titlepage">
13707: <div>
13708: <div>
1.67 hubertf 13709: <h3 class="title"><a name=
1.68 rillig 13710: "cpp-defines"></a>16.4.1. CPP defines</h3>
1.1 grant 13711: </div>
13712: </div>
13713: </div>
13714:
1.55 rillig 13715: <p>Sometimes you need to compile different code
13716: depending on the target platform. The C preprocessor
13717: has a set of predefined macros that can be queried by
13718: using <code class="varname">#ifdef FOO</code> or
13719: <code class="varname">#if defined(FOO)</code>. Among
13720: these macros are usually ones that describe the target
13721: CPU and operating system. Depending of which of the
13722: macros are defined, you can write code that uses
1.61 rillig 13723: features unique to a specific platform. Generally you
13724: should rather use the GNU autotools (automake,
13725: autoconf, etc.) to check for specific features (like
13726: the existence of a header file, a function or a
13727: library), but sometimes this is not possible or
13728: desired.</p>
13729:
13730: <p>In that case you can use the predefined macros below
13731: to configure your code to the platform it runs on.
13732: Almost every operating system, hardware architecture
13733: and compiler has its own macro. For example, if the
13734: macros <code class="varname">__GNUC__</code>,
13735: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13736: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13737: that you are using NetBSD on an i386 compatible CPU,
13738: and your compiler is GCC.</p>
1.55 rillig 13739:
1.67 hubertf 13740: <div class="sect3" lang="en">
1.55 rillig 13741: <div class="titlepage">
13742: <div>
13743: <div>
13744: <h4 class="title"><a name=
1.68 rillig 13745: "fixes-build-cpp-opsys"></a>16.4.1.1. CPP
1.55 rillig 13746: defines for operating systems</h4>
13747: </div>
13748: </div>
13749: </div>
13750:
13751: <p>To distinguish between 4.4 BSD-derived systems and
13752: the rest of the world, you should use the following
13753: code.</p>
13754: <pre class="programlisting">
1.51 rillig 13755: #include <sys/param.h>
1.55 rillig 13756: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13757: /* BSD-specific code goes here */
1.55 rillig 13758: #else
1.60 rillig 13759: /* non-BSD-specific code goes here */
1.55 rillig 13760: #endif
1.1 grant 13761: </pre>
13762:
1.55 rillig 13763: <p>If this distinction is not fine enough, you can
13764: also use the following defines.</p>
13765: <pre class="programlisting">
13766: FreeBSD __FreeBSD__
1.56 rillig 13767: DragonFly __DragonFly__
1.57 minskim 13768: Interix __INTERIX
1.55 rillig 13769: Linux linux, __linux, __linux__
13770: NetBSD __NetBSD__
13771: OpenBSD __OpenBSD__
1.60 rillig 13772: Solaris sun, __sun
1.1 grant 13773: </pre>
1.55 rillig 13774: </div>
1.1 grant 13775:
1.67 hubertf 13776: <div class="sect3" lang="en">
1.55 rillig 13777: <div class="titlepage">
13778: <div>
13779: <div>
1.67 hubertf 13780: <h4 class="title"><a name=
1.68 rillig 13781: "fixes-build-cpp-cpu"></a>16.4.1.2. CPP
1.55 rillig 13782: defines for CPUs</h4>
13783: </div>
13784: </div>
13785: </div>
13786: <pre class="programlisting">
13787: i386 i386, __i386, __i386__
13788: MIPS __mips
13789: SPARC sparc, __sparc
13790: </pre>
13791: </div>
13792:
1.67 hubertf 13793: <div class="sect3" lang="en">
1.55 rillig 13794: <div class="titlepage">
13795: <div>
13796: <div>
13797: <h4 class="title"><a name=
1.68 rillig 13798: "fixes-build-cpp-compiler"></a>16.4.1.3. CPP
1.55 rillig 13799: defines for compilers</h4>
13800: </div>
13801: </div>
13802: </div>
13803: <pre class="programlisting">
13804: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13805: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13806: </pre>
13807: </div>
1.1 grant 13808: </div>
1.51 rillig 13809:
1.67 hubertf 13810: <div class="sect2" lang="en">
1.51 rillig 13811: <div class="titlepage">
13812: <div>
13813: <div>
1.67 hubertf 13814: <h3 class="title"><a name=
1.68 rillig 13815: "cpp-list-examples"></a>16.4.2. Examples of
1.60 rillig 13816: CPP defines for some platforms</h3>
13817: </div>
13818: </div>
13819: </div>
13820:
13821: <p>The list of the CPP identification macros for
13822: hardware and operating system may depend on the
13823: compiler that is used. The following list contains some
13824: examples that may help you to choose the right ones.
13825: For example, if you want to conditionally compile code
13826: on Solaris, don't use <code class=
13827: "varname">__sun__</code>, as the SunPro compiler does
13828: not define it. Use <code class="varname">__sun</code>
13829: instead.</p>
13830:
13831: <div class="variablelist">
13832: <dl>
1.61 rillig 13833: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13834: i386</span></dt>
13835:
13836: <dd>
1.62 rillig 13837: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13838: __linux, __linux__, __unix, __unix__, i386,
13839: linux, unix.</p>
13840: </dd>
13841:
13842: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13843: i386</span></dt>
13844:
13845: <dd>
1.62 rillig 13846: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13847: i386.</p>
13848: </dd>
13849:
13850: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13851: i386</span></dt>
1.60 rillig 13852:
13853: <dd>
1.62 rillig 13854: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13855: i386.</p>
1.60 rillig 13856: </dd>
13857:
13858: <dt><span class="term">GCC 4 + Solaris 8 +
13859: SPARC</span></dt>
13860:
13861: <dd>
13862: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
13863: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
13864: unix.</p>
13865: </dd>
1.61 rillig 13866:
13867: <dt><span class="term">SunPro 5.7 + Solaris 8 +
13868: SPARC</span></dt>
13869:
13870: <dd>
13871: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
13872: unix.</p>
13873: </dd>
1.60 rillig 13874: </dl>
13875: </div>
13876: </div>
13877:
1.67 hubertf 13878: <div class="sect2" lang="en">
1.60 rillig 13879: <div class="titlepage">
13880: <div>
13881: <div>
1.67 hubertf 13882: <h3 class="title"><a name=
1.68 rillig 13883: "cpp-list"></a>16.4.3. Getting a list of CPP
1.51 rillig 13884: defines</h3>
13885: </div>
13886: </div>
13887: </div>
13888:
1.60 rillig 13889: <p>If your system uses the GNU C Compiler, you can get
13890: a list of symbols that are defined by default, e.g. to
13891: identify the platform, with the following command:</p>
1.51 rillig 13892: <pre class="programlisting">
13893: gcc -E -dM - < /dev/null
13894: </pre>
1.60 rillig 13895:
13896: <p>On other systems you may get the list by using the
13897: system's syscall trace utility (ktrace, truss, strace)
13898: to have a look which arguments are passed to the actual
13899: compiler.</p>
1.51 rillig 13900: </div>
1.1 grant 13901: </div>
13902:
1.67 hubertf 13903: <div class="sect1" lang="en">
1.1 grant 13904: <div class="titlepage">
13905: <div>
13906: <div>
13907: <h2 class="title" style="clear: both"><a name=
1.68 rillig 13908: "package-specific-actions"></a>16.5. Package
1.1 grant 13909: specific actions</h2>
13910: </div>
13911: </div>
13912: </div>
13913:
1.67 hubertf 13914: <div class="sect2" lang="en">
1.1 grant 13915: <div class="titlepage">
13916: <div>
13917: <div>
1.67 hubertf 13918: <h3 class="title"><a name=
1.68 rillig 13919: "user-interaction"></a>16.5.1. User
1.2 hubertf 13920: interaction</h3>
1.1 grant 13921: </div>
13922: </div>
13923: </div>
13924:
13925: <p>Occasionally, packages require interaction from the
13926: user, and this can be in a number of ways:</p>
13927:
13928: <div class="itemizedlist">
13929: <ul type="disc">
13930: <li>
13931: <p>help in fetching the distfiles</p>
13932: </li>
13933:
13934: <li>
13935: <p>help to configure the package before it is
13936: built</p>
13937: </li>
13938:
13939: <li>
13940: <p>help during the build process</p>
13941: </li>
13942:
13943: <li>
13944: <p>help during the installation of a package</p>
13945: </li>
13946: </ul>
13947: </div>
13948:
1.14 xtraeme 13949: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13950: definition is provided to notify the pkgsrc mechanism
13951: of an interactive stage which will be needed, and this
1.45 wiz 13952: should be set in the package's <code xmlns=
13953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13954: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13955: <pre class="programlisting">
1.51 rillig 13956: INTERACTIVE_STAGE= build
1.1 grant 13957: </pre>
13958:
13959: <p>Multiple interactive stages can be specified:</p>
13960: <pre class="programlisting">
1.51 rillig 13961: INTERACTIVE_STAGE= configure install
1.1 grant 13962: </pre>
13963: </div>
13964:
1.67 hubertf 13965: <div class="sect2" lang="en">
1.1 grant 13966: <div class="titlepage">
13967: <div>
13968: <div>
1.67 hubertf 13969: <h3 class="title"><a name=
1.68 rillig 13970: "handling-licenses"></a>16.5.2. Handling
1.1 grant 13971: licenses</h3>
13972: </div>
13973: </div>
13974: </div>
13975:
1.44 gdt 13976: <p>A package may be covered by a license which the user
13977: has or has not agreed to accept. For these cases,
13978: pkgsrc contains a mechanism to note that a package is
13979: covered by a particular license, and the package cannot
13980: be built unless the user has accepted the license.
13981: (Installation of binary packages are not currently
13982: subject to this mechanism.) Packages with licenses that
13983: are either Open Source according to the Open Source
13984: Initiative or Free according to the Free Software
13985: Foundation will not be marked with a license tag.
13986: Packages with licenses that have not been determined to
13987: meet either definition will be marked with a license
13988: tag referring to the license. This will prevent
13989: building unless pkgsrc is informed that the license is
13990: acceptable, and enables displaying the license.</p>
13991:
13992: <p>The license tag mechanism is intended to address
13993: copyright-related issues surrounding building,
13994: installing and using a package, and not to address
13995: redistribution issues (see <code class=
13996: "varname">RESTRICTED</code> and <code class=
13997: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13998: above definition of licenses for which tags are not
13999: needed implies that packages with redistribution
14000: restrictions should have tags.</p>
14001:
14002: <p>Denoting that a package is covered by a particular
1.45 wiz 14003: license is done by placing the license in <code xmlns=
14004: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 14005: "filename">pkgsrc/licenses</code> and setting the
14006: <code class="varname">LICENSE</code> variable to a
14007: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 14008: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 14009: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 14010: target="_top"><code xmlns="" class=
14011: "filename">graphics/xv</code></a>:</p>
1.1 grant 14012: <pre class="programlisting">
1.51 rillig 14013: LICENSE= xv-license
1.1 grant 14014: </pre>
14015:
14016: <p>When trying to build, the user will get a notice
1.44 gdt 14017: that the package is covered by a license which has not
14018: been accepted:</p>
1.1 grant 14019: <pre class="programlisting">
1.51 rillig 14020: <code class="prompt">%</code> <strong class=
1.14 xtraeme 14021: "userinput"><code>make</code></strong>
1.51 rillig 14022: ===> xv-3.10anb9 has an unacceptable license: xv-license.
14023: ===> To view the license, enter "/usr/bin/make show-license".
14024: ===> To indicate acceptance, add this line to your /etc/mk.conf:
14025: ===> ACCEPTABLE_LICENSES+=xv-license
14026: *** Error code 1
1.1 grant 14027: </pre>
14028:
1.14 xtraeme 14029: <p>The license can be viewed with <span><strong class=
14030: "command">make show-license</strong></span>, and if it
14031: is considered appropriate, the line printed above can
1.45 wiz 14032: be added to <code xmlns=
14033: "http://www.w3.org/TR/xhtml1/transitional" class=
14034: "filename">/etc/mk.conf</code> to indicate acceptance
14035: of the particular license:</p>
1.1 grant 14036: <pre class="programlisting">
1.51 rillig 14037: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 14038: </pre>
14039:
14040: <p>When adding a package with a new license, the
1.45 wiz 14041: license text should be added to <code xmlns=
14042: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14043: "filename">pkgsrc/licenses</code> for displaying. A
14044: list of known licenses can be seen in this directory as
14045: well as by looking at the list of (commented out)
14046: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 14047: variable settings in <code xmlns=
14048: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14049: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 14050:
1.44 gdt 14051: <p>The use of <code class=
14052: "varname">LICENSE=shareware</code>, <code class=
14053: "varname">LICENSE=no-commercial-use</code>, and similar
14054: language is deprecated because it does not crisply
14055: refer to a particular license text. Another problem
14056: with such usage is that it does not enable a user to
14057: denote acceptance of the license for a single package
14058: without accepting the same license text for another
14059: package. In particular, this can be inappropriate when
14060: e.g. one accepts a particular license to indicate to
14061: pkgsrc that a fee has been paid.</p>
1.1 grant 14062: </div>
14063:
1.67 hubertf 14064: <div class="sect2" lang="en">
1.1 grant 14065: <div class="titlepage">
14066: <div>
14067: <div>
1.30 wiz 14068: <h3 class="title"><a name=
1.68 rillig 14069: "installing-score-files"></a>16.5.3. Installing
1.30 wiz 14070: score files</h3>
1.1 grant 14071: </div>
14072: </div>
14073: </div>
14074:
14075: <p>Certain packages, most of them in the games
14076: category, install a score file that allows all users on
14077: the system to record their highscores. In order for
14078: this to work, the binaries need to be installed setgid
14079: and the score files owned by the appropriate group
14080: and/or owner (traditionally the "games" user/group).
14081: The following variables, documented in more detail in
1.45 wiz 14082: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14083: class="filename">mk/defaults/mk.conf</code>, control
14084: this behaviour: <code class=
1.14 xtraeme 14085: "varname">SETGIDGAME</code>, <code class=
14086: "varname">GAMEDATAMODE</code>, <code class=
14087: "varname">GAMEGRP</code>, <code class=
14088: "varname">GAMEMODE</code>, <code class=
14089: "varname">GAMEOWN</code>.</p>
1.1 grant 14090:
14091: <p>Note that per default, setgid installation of games
1.14 xtraeme 14092: is disabled; setting <code class=
14093: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 14094: variables accordingly.</p>
14095:
14096: <p>A package should therefor never hard code file
1.14 xtraeme 14097: ownership or access permissions but rely on
14098: <code class="varname">INSTALL_GAME</code> and
14099: <code class="varname">INSTALL_GAME_DATA</code> to set
14100: these correctly.</p>
1.1 grant 14101: </div>
14102:
1.67 hubertf 14103: <div class="sect2" lang="en">
1.1 grant 14104: <div class="titlepage">
14105: <div>
14106: <div>
1.67 hubertf 14107: <h3 class="title"><a name=
1.68 rillig 14108: "perl-scripts"></a>16.5.4. Packages
1.30 wiz 14109: containing perl scripts</h3>
1.1 grant 14110: </div>
14111: </div>
14112: </div>
14113:
14114: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 14115: set <code class="varname">REPLACE_PERL</code> to ensure
14116: that the proper interpreter path is set. <code class=
14117: "varname">REPLACE_PERL</code> should contain a list of
14118: scripts, relative to <code class=
14119: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 14120: </div>
14121:
1.67 hubertf 14122: <div class="sect2" lang="en">
1.1 grant 14123: <div class="titlepage">
14124: <div>
14125: <div>
1.67 hubertf 14126: <h3 class="title"><a name=
1.68 rillig 14127: "hardcoded-paths"></a>16.5.5. Packages with
1.1 grant 14128: hardcoded paths to other interpreters</h3>
14129: </div>
14130: </div>
14131: </div>
14132:
14133: <p>Your package may also contain scripts with hardcoded
14134: paths to other interpreters besides (or as well as)
14135: perl. To correct the full pathname to the script
14136: interpreter, you need to set the following definitions
1.45 wiz 14137: in your <code xmlns=
14138: "http://www.w3.org/TR/xhtml1/transitional" class=
14139: "filename">Makefile</code> (we shall use
14140: <span><strong class="command">tclsh</strong></span> in
14141: this example):</p>
1.1 grant 14142: <pre class="programlisting">
1.51 rillig 14143: REPLACE_INTERPRETER+= tcl
1.71 wiz 14144: REPLACE.tcl.old= .*/bin/tclsh
14145: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
14146: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
1.51 rillig 14147: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 14148: </pre>
1.71 wiz 14149:
14150: <div class="note" style=
14151: "margin-left: 0.5in; margin-right: 0.5in;">
14152: <h3 class="title">Note</h3>
14153:
14154: <p>Before March 2006, these variables were called
14155: <code class="varname">_REPLACE.*</code> and
14156: <code class="varname">_REPLACE_FILES.*</code>.</p>
14157: </div>
1.1 grant 14158: </div>
14159:
1.67 hubertf 14160: <div class="sect2" lang="en">
1.1 grant 14161: <div class="titlepage">
14162: <div>
14163: <div>
1.67 hubertf 14164: <h3 class="title"><a name=
1.68 rillig 14165: "perl-modules"></a>16.5.6. Packages
1.30 wiz 14166: installing perl modules</h3>
1.1 grant 14167: </div>
14168: </div>
14169: </div>
14170:
14171: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 14172: include the Makefile fragment <code xmlns=
14173: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14174: "filename">../../lang/perl5/module.mk</code>. It
14175: provides a <span><strong class=
14176: "command">do-configure</strong></span> target for the
14177: standard perl configuration for such modules as well as
14178: various hooks to tune this configuration. See comments
14179: in this file for details.</p>
1.1 grant 14180:
14181: <p>Perl5 modules will install into different places
14182: depending on the version of perl used during the build
14183: process. To address this, pkgsrc will append lines to
1.45 wiz 14184: the <code xmlns=
14185: "http://www.w3.org/TR/xhtml1/transitional" class=
14186: "filename">PLIST</code> corresponding to the files
14187: listed in the installed <code xmlns=
14188: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14189: "filename">.packlist</code> file generated by most
14190: perl5 modules. This is invoked by defining <code class=
14191: "varname">PERL5_PACKLIST</code> to a space-separated
14192: list of paths to packlist files, e.g.:</p>
1.1 grant 14193: <pre class="programlisting">
1.51 rillig 14194: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 14195: </pre>
14196:
1.14 xtraeme 14197: <p>The variables <code class=
14198: "varname">PERL5_SITELIB</code>, <code class=
14199: "varname">PERL5_SITEARCH</code>, and <code class=
14200: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 14201: locations in which perl5 modules may be installed, and
14202: may be used by perl5 packages that don't have a
14203: packlist. These three variables are also substituted
1.45 wiz 14204: for in the <code xmlns=
14205: "http://www.w3.org/TR/xhtml1/transitional" class=
14206: "filename">PLIST</code>.</p>
1.1 grant 14207: </div>
14208:
1.67 hubertf 14209: <div class="sect2" lang="en">
1.1 grant 14210: <div class="titlepage">
14211: <div>
14212: <div>
1.67 hubertf 14213: <h3 class="title"><a name=
1.68 rillig 14214: "faq.info-files"></a>16.5.7. Packages
1.1 grant 14215: installing info files</h3>
14216: </div>
14217: </div>
14218: </div>
14219:
14220: <p>Some packages install info files or use the
14221: “<span class="quote">makeinfo</span>” or
14222: “<span class="quote">install-info</span>”
1.72 rillig 14223: commands. <code class="varname">INFO_FILES</code>
14224: should be defined in the package Makefile so that
14225: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14226: class="filename">INSTALL</code> and <code xmlns=
1.45 wiz 14227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14228: "filename">DEINSTALL</code> scripts will be generated
14229: to handle registration of the info files in the Info
1.1 grant 14230: directory file. The “<span class=
14231: "quote">install-info</span>” command used for the
14232: info files registration is either provided by the
14233: system, or by a special purpose package automatically
14234: added as dependency if needed.</p>
14235:
1.72 rillig 14236: <p><code class="varname">PKGINFODIR</code> is the
14237: directory under <code xmlns=
14238: "http://www.w3.org/TR/xhtml1/transitional" class=
14239: "filename">${PREFIX}</code> where info files are
14240: primarily located. <code class=
14241: "varname">PKGINFODIR</code> defaults to
14242: “<span class="quote">info</span>” and can
14243: be overridden by the user.</p>
14244:
14245: <p>The info files for the package should be listed in
14246: the package <code xmlns=
14247: "http://www.w3.org/TR/xhtml1/transitional" class=
14248: "filename">PLIST</code>; however any split info files
14249: need not be listed.</p>
14250:
1.1 grant 14251: <p>A package which needs the “<span class=
14252: "quote">makeinfo</span>” command at build time
1.72 rillig 14253: must add “<span class=
14254: "quote">makeinfo</span>” to <code class=
14255: "varname">USE_TOOLS</code> in its Makefile. If a
1.1 grant 14256: minimum version of the “<span class=
14257: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 14258: should be noted with the <code class=
14259: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 14260: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14261: class="filename">Makefile</code>. By default, a minimum
14262: version of 3.12 is required. If the system does not
14263: provide a <span><strong class=
1.14 xtraeme 14264: "command">makeinfo</strong></span> command or if it
14265: does not match the required minimum, a build dependency
14266: on the <a xmlns=
14267: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 14268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 14269: target="_top"><code xmlns="" class=
14270: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 14271: added automatically.</p>
1.1 grant 14272:
14273: <p>The build and installation process of the software
14274: provided by the package should not use the
1.14 xtraeme 14275: <span><strong class=
14276: "command">install-info</strong></span> command as the
14277: registration of info files is the task of the package
1.45 wiz 14278: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14279: class="filename">INSTALL</code> script, and it must use
14280: the appropriate <span><strong class=
1.14 xtraeme 14281: "command">makeinfo</strong></span> command.</p>
1.1 grant 14282:
1.47 reed 14283: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 14284: creates overriding scripts for the <span><strong class=
14285: "command">install-info</strong></span> and
14286: <span><strong class="command">makeinfo</strong></span>
14287: commands in a directory listed early in <code class=
14288: "varname">PATH</code>.</p>
1.1 grant 14289:
1.14 xtraeme 14290: <p>The script overriding <span><strong class=
14291: "command">install-info</strong></span> has no effect
14292: except the logging of a message. The script overriding
14293: <span><strong class="command">makeinfo</strong></span>
14294: logs a message and according to the value of
1.72 rillig 14295: <code class="varname">TEXINFO_REQD</code> either runs
1.14 xtraeme 14296: the appropriate <span><strong class=
14297: "command">makeinfo</strong></span> command or exit on
14298: error.</p>
1.1 grant 14299: </div>
14300:
1.67 hubertf 14301: <div class="sect2" lang="en">
1.57 minskim 14302: <div class="titlepage">
14303: <div>
14304: <div>
1.67 hubertf 14305: <h3 class="title"><a name=
1.68 rillig 14306: "manpages"></a>16.5.8. Packages installing
1.57 minskim 14307: man pages</h3>
14308: </div>
14309: </div>
14310: </div>
14311:
14312: <p>Many packages install manual pages. The man pages
14313: are installed under <code class=
14314: "varname">${PREFIX}/${PKGMANDIR}</code> which is
14315: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14316: class="filename">/usr/pkg/man</code> by default.
14317: <code class="varname">PKGMANDIR</code> defaults to
14318: “<span class="quote">man</span>”. For
14319: example, you can set <code class=
14320: "varname">PKGMANDIR</code> to “<span class=
14321: "quote">share/man</span>” to have man pages
14322: install under <code xmlns=
14323: "http://www.w3.org/TR/xhtml1/transitional" class=
14324: "filename">/usr/pkg/share/man/</code> by default.</p>
14325:
14326: <div class="note" style=
14327: "margin-left: 0.5in; margin-right: 0.5in;">
14328: <h3 class="title">Note</h3>
14329:
14330: <p>The support for a custom <code class=
14331: "varname">PKGMANDIR</code> is not complete.</p>
14332: </div>
14333:
14334: <p>The <code xmlns=
14335: "http://www.w3.org/TR/xhtml1/transitional" class=
14336: "filename">PLIST</code> files can just use <code xmlns=
14337: "http://www.w3.org/TR/xhtml1/transitional" class=
14338: "filename">man/</code> as the top level directory for
14339: the man page file entries and the pkgsrc framework will
14340: convert as needed.</p>
14341:
14342: <p>Packages that are configured with <code class=
14343: "varname">GNU_CONFIGURE</code> set as
14344: “<span class="quote">yes</span>”, by
14345: default will use the <code xmlns=
14346: "http://www.w3.org/TR/xhtml1/transitional" class=
14347: "filename">./configure</code> --mandir switch to set
14348: where the man pages should be installed. The path is
14349: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
14350: defaults to <code class=
14351: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
14352:
14353: <p>Packages that use <code class=
14354: "varname">GNU_CONFIGURE</code> but do not use --mandir,
14355: can set <code class=
14356: "varname">CONFIGURE_HAS_MANDIR</code> to
14357: “<span class="quote">no</span>”. Or if the
14358: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14359: class="filename">./configure</code> script uses a
14360: non-standard use of --mandir, you can set <code class=
14361: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
14362:
14363: <p>See <a href="#manpage-compression" title=
14364: "10.5. Man page compression">Section 10.5,
14365: “Man page compression”</a> for information
14366: on installation of compressed manual pages.</p>
14367: </div>
14368:
1.67 hubertf 14369: <div class="sect2" lang="en">
1.1 grant 14370: <div class="titlepage">
14371: <div>
14372: <div>
1.67 hubertf 14373: <h3 class="title"><a name=
1.68 rillig 14374: "gconf2-data-files"></a>16.5.9. Packages
1.30 wiz 14375: installing GConf2 data files</h3>
1.1 grant 14376: </div>
14377: </div>
14378: </div>
14379:
1.45 wiz 14380: <p>If a package installs <code xmlns=
14381: "http://www.w3.org/TR/xhtml1/transitional" class=
14382: "filename">.schemas</code> or <code xmlns=
14383: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14384: "filename">.entries</code> files, used by GConf2, you
1.1 grant 14385: need to take some extra steps to make sure they get
14386: registered in the database:</p>
14387:
14388: <div class="orderedlist">
14389: <ol type="1">
14390: <li>
1.45 wiz 14391: <p>Include <code xmlns=
14392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14393: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 14394: instead of its <code xmlns=
14395: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14396: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14397: care of rebuilding the GConf2 database at
14398: installation and deinstallation time, and tells
14399: the package where to install GConf2 data files
14400: using some standard configure arguments. It also
14401: disallows any access to the database directly
14402: from the package.</p>
14403: </li>
14404:
14405: <li>
14406: <p>Ensure that the package installs its
1.45 wiz 14407: <code xmlns=
14408: "http://www.w3.org/TR/xhtml1/transitional" class=
14409: "filename">.schemas</code> files under
14410: <code xmlns=
14411: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14412: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 14413: If they get installed under <code xmlns=
14414: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14415: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 14416: manually patch the package.</p>
14417: </li>
14418:
14419: <li>
14420: <p>Check the PLIST and remove any entries under
14421: the etc/gconf directory, as they will be handled
14422: automatically. See <a href="#faq.conf" title=
1.38 dillo 14423: "7.14. How do I change the location of configuration files?">
14424: Section 7.14, “How do I change the
1.35 jmmv 14425: location of configuration files?”</a> for
14426: more information.</p>
1.1 grant 14427: </li>
14428:
14429: <li>
1.14 xtraeme 14430: <p>Define the <code class=
14431: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 14432: <code xmlns=
14433: "http://www.w3.org/TR/xhtml1/transitional" class=
14434: "filename">Makefile</code> with a list of all
14435: <code xmlns=
14436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14437: "filename">.schemas</code> files installed by the
14438: package, if any. Names must not contain any
14439: directories in them.</p>
1.1 grant 14440: </li>
14441:
14442: <li>
1.14 xtraeme 14443: <p>Define the <code class=
14444: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 14445: <code xmlns=
14446: "http://www.w3.org/TR/xhtml1/transitional" class=
14447: "filename">Makefile</code> with a list of all
14448: <code xmlns=
14449: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14450: "filename">.entries</code> files installed by the
14451: package, if any. Names must not contain any
14452: directories in them.</p>
1.1 grant 14453: </li>
14454: </ol>
14455: </div>
14456: </div>
14457:
1.67 hubertf 14458: <div class="sect2" lang="en">
1.1 grant 14459: <div class="titlepage">
14460: <div>
14461: <div>
1.30 wiz 14462: <h3 class="title"><a name=
1.68 rillig 14463: "scrollkeeper-data-files"></a>16.5.10. Packages
1.30 wiz 14464: installing scrollkeeper data files</h3>
1.1 grant 14465: </div>
14466: </div>
14467: </div>
14468:
1.45 wiz 14469: <p>If a package installs <code xmlns=
14470: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14471: "filename">.omf</code> files, used by scrollkeeper, you
14472: need to take some extra steps to make sure they get
14473: registered in the database:</p>
1.1 grant 14474:
14475: <div class="orderedlist">
14476: <ol type="1">
14477: <li>
1.45 wiz 14478: <p>Include <code xmlns=
14479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14480: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 14481: instead of its <code xmlns=
14482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14483: "filename">buildlink3.mk</code> file. This takes
1.1 grant 14484: care of rebuilding the scrollkeeper database at
14485: installation and deinstallation time, and
14486: disallows any access to it directly from the
14487: package.</p>
14488: </li>
14489:
14490: <li>
14491: <p>Check the PLIST and remove any entries under
1.45 wiz 14492: the <code xmlns=
14493: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14494: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 14495: as they will be handled automatically.</p>
14496: </li>
14497:
14498: <li>
1.45 wiz 14499: <p>Remove the <code xmlns=
14500: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14501: "filename">share/omf</code> directory from the
14502: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 14503: </li>
14504: </ol>
14505: </div>
14506: </div>
14507:
1.67 hubertf 14508: <div class="sect2" lang="en">
1.1 grant 14509: <div class="titlepage">
14510: <div>
14511: <div>
1.67 hubertf 14512: <h3 class="title"><a name=
1.68 rillig 14513: "x11-fonts"></a>16.5.11. Packages installing
1.1 grant 14514: X11 fonts</h3>
14515: </div>
14516: </div>
14517: </div>
14518:
14519: <p>If a package installs font files, you will need to
14520: rebuild the fonts database in the directory where they
14521: get installed at installation and deinstallation time.
1.65 hubertf 14522: This can be automatically done by using the pkginstall
14523: framework.</p>
1.1 grant 14524:
1.65 hubertf 14525: <p>You can list the directories where fonts are
14526: installed in the <code class=
14527: "varname">FONTS_DIRS.<em class=
14528: "replaceable"><code>type</code></em></code> variables,
14529: where <em class="replaceable"><code>type</code></em>
14530: can be one of “<span class=
14531: "quote">ttf</span>”, “<span class=
14532: "quote">type1</span>” or “<span class=
14533: "quote">x11</span>”. Also make sure that the
14534: database file <code xmlns=
1.45 wiz 14535: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14536: "filename">fonts.dir</code> is not listed in the
1.1 grant 14537: PLIST.</p>
14538:
14539: <p>Note that you should not create new directories for
14540: fonts; instead use the standard ones to avoid that the
14541: user needs to manually configure his X server to find
14542: them.</p>
14543: </div>
14544:
1.67 hubertf 14545: <div class="sect2" lang="en">
1.1 grant 14546: <div class="titlepage">
14547: <div>
14548: <div>
1.67 hubertf 14549: <h3 class="title"><a name=
1.68 rillig 14550: "gtk2-modules"></a>16.5.12. Packages
1.30 wiz 14551: installing GTK2 modules</h3>
1.1 grant 14552: </div>
14553: </div>
14554: </div>
14555:
1.47 reed 14556: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 14557: need to take some extra steps to get them registered in
14558: the GTK2 database properly:</p>
14559:
14560: <div class="orderedlist">
14561: <ol type="1">
14562: <li>
1.45 wiz 14563: <p>Include <code xmlns=
14564: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14565: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 14566: instead of its <code xmlns=
14567: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14568: "filename">buildlink3.mk</code> file. This takes
14569: care of rebuilding the database at installation
14570: and deinstallation time.</p>
1.1 grant 14571: </li>
14572:
14573: <li>
1.14 xtraeme 14574: <p>Set <code class=
14575: "varname">GTK2_IMMODULES=YES</code> if your
14576: package installs GTK2 immodules.</p>
1.1 grant 14577: </li>
14578:
14579: <li>
1.14 xtraeme 14580: <p>Set <code class=
14581: "varname">GTK2_LOADERS=YES</code> if your package
14582: installs GTK2 loaders.</p>
1.1 grant 14583: </li>
14584:
14585: <li>
1.47 reed 14586: <p>Patch the package to not touch any of the GTK2
1.1 grant 14587: databases directly. These are:</p>
14588:
14589: <div class="itemizedlist">
14590: <ul type="disc">
14591: <li>
1.45 wiz 14592: <p><code xmlns=
14593: "http://www.w3.org/TR/xhtml1/transitional"
14594: class=
1.14 xtraeme 14595: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 14596: </li>
14597:
14598: <li>
1.45 wiz 14599: <p><code xmlns=
14600: "http://www.w3.org/TR/xhtml1/transitional"
14601: class=
1.14 xtraeme 14602: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 14603: </li>
14604: </ul>
14605: </div>
14606: </li>
14607:
14608: <li>
14609: <p>Check the PLIST and remove any entries under
1.45 wiz 14610: the <code xmlns=
14611: "http://www.w3.org/TR/xhtml1/transitional" class=
14612: "filename">libdata/gtk-2.0</code> directory, as
14613: they will be handled automatically.</p>
1.1 grant 14614: </li>
14615: </ol>
14616: </div>
14617: </div>
14618:
1.67 hubertf 14619: <div class="sect2" lang="en">
1.1 grant 14620: <div class="titlepage">
14621: <div>
14622: <div>
1.67 hubertf 14623: <h3 class="title"><a name=
1.68 rillig 14624: "sgml-xml-data"></a>16.5.13. Packages
1.30 wiz 14625: installing SGML or XML data</h3>
1.1 grant 14626: </div>
14627: </div>
14628: </div>
14629:
14630: <p>If a package installs SGML or XML data files that
14631: need to be registered in system-wide catalogs (like
14632: DTDs, sub-catalogs, etc.), you need to take some extra
14633: steps:</p>
14634:
14635: <div class="orderedlist">
14636: <ol type="1">
14637: <li>
1.45 wiz 14638: <p>Include <code xmlns=
14639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14640: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 14641: in your <code xmlns=
14642: "http://www.w3.org/TR/xhtml1/transitional" class=
14643: "filename">Makefile</code>, which takes care of
14644: registering those files in system-wide catalogs
14645: at installation and deinstallation time.</p>
1.1 grant 14646: </li>
14647:
14648: <li>
1.14 xtraeme 14649: <p>Set <code class="varname">SGML_CATALOGS</code>
14650: to the full path of any SGML catalogs installed
14651: by the package.</p>
1.1 grant 14652: </li>
14653:
14654: <li>
1.14 xtraeme 14655: <p>Set <code class="varname">XML_CATALOGS</code>
14656: to the full path of any XML catalogs installed by
1.1 grant 14657: the package.</p>
14658: </li>
14659:
14660: <li>
1.14 xtraeme 14661: <p>Set <code class="varname">SGML_ENTRIES</code>
14662: to individual entries to be added to the SGML
1.1 grant 14663: catalog. These come in groups of three strings;
14664: see xmlcatmgr(1) for more information
14665: (specifically, arguments recognized by the 'add'
14666: action). Note that you will normally not use this
14667: variable.</p>
14668: </li>
14669:
14670: <li>
1.14 xtraeme 14671: <p>Set <code class="varname">XML_ENTRIES</code>
14672: to individual entries to be added to the XML
1.1 grant 14673: catalog. These come in groups of three strings;
14674: see xmlcatmgr(1) for more information
14675: (specifically, arguments recognized by the 'add'
14676: action). Note that you will normally not use this
14677: variable.</p>
14678: </li>
14679: </ol>
14680: </div>
14681: </div>
14682:
1.67 hubertf 14683: <div class="sect2" lang="en">
1.1 grant 14684: <div class="titlepage">
14685: <div>
14686: <div>
1.67 hubertf 14687: <h3 class="title"><a name=
1.68 rillig 14688: "mime-database"></a>16.5.14. Packages
1.30 wiz 14689: installing extensions to the MIME database</h3>
1.1 grant 14690: </div>
14691: </div>
14692: </div>
14693:
14694: <p>If a package provides extensions to the MIME
1.45 wiz 14695: database by installing <code xmlns=
14696: "http://www.w3.org/TR/xhtml1/transitional" class=
14697: "filename">.xml</code> files inside <code xmlns=
14698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14699: "filename">${PREFIX}/share/mime/packages</code>, you
14700: need to take some extra steps to ensure that the
14701: database is kept consistent with respect to these new
14702: files:</p>
1.1 grant 14703:
14704: <div class="orderedlist">
14705: <ol type="1">
14706: <li>
1.45 wiz 14707: <p>Include <code xmlns=
14708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14709: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 14710: (avoid using the <code xmlns=
14711: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14712: "filename">buildlink3.mk</code> file from this
14713: same directory, which is reserved for inclusion
1.45 wiz 14714: from other <code xmlns=
14715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14716: "filename">buildlink3.mk</code> files). It takes
14717: care of rebuilding the MIME database at
14718: installation and deinstallation time, and
14719: disallows any access to it directly from the
1.1 grant 14720: package.</p>
14721: </li>
14722:
14723: <li>
14724: <p>Check the PLIST and remove any entries under
1.45 wiz 14725: the <code xmlns=
14726: "http://www.w3.org/TR/xhtml1/transitional" class=
14727: "filename">share/mime</code> directory,
14728: <span class="emphasis"><em>except</em></span> for
14729: files saved under <code xmlns=
14730: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14731: "filename">share/mime/packages</code>. The former
1.1 grant 14732: are handled automatically by the
1.47 reed 14733: update-mime-database program, but the latter are
1.1 grant 14734: package-dependent and must be removed by the
14735: package that installed them in the first
14736: place.</p>
14737: </li>
14738:
14739: <li>
1.45 wiz 14740: <p>Remove any <code xmlns=
14741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14742: "filename">share/mime/*</code> directories from
14743: the PLIST. They will be handled by the
1.1 grant 14744: shared-mime-info package.</p>
14745: </li>
14746: </ol>
14747: </div>
14748: </div>
14749:
1.67 hubertf 14750: <div class="sect2" lang="en">
1.1 grant 14751: <div class="titlepage">
14752: <div>
14753: <div>
1.67 hubertf 14754: <h3 class="title"><a name=
1.68 rillig 14755: "intltool"></a>16.5.15. Packages using
1.1 grant 14756: intltool</h3>
14757: </div>
14758: </div>
14759: </div>
14760:
14761: <p>If a package uses intltool during its build, include
1.45 wiz 14762: the <code xmlns=
14763: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14764: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14765: file, which forces it to use the intltool package
14766: provided by pkgsrc, instead of the one bundled with the
14767: distribution file.</p>
14768:
14769: <p>This tracks intltool's build-time dependencies and
14770: uses the latest available version; this way, the
14771: package benefits of any bug fixes that may have
14772: appeared since it was released.</p>
14773: </div>
1.18 xtraeme 14774:
1.67 hubertf 14775: <div class="sect2" lang="en">
1.18 xtraeme 14776: <div class="titlepage">
14777: <div>
14778: <div>
1.67 hubertf 14779: <h3 class="title"><a name=
1.68 rillig 14780: "startup-scripts"></a>16.5.16. Packages
1.30 wiz 14781: installing startup scripts</h3>
1.18 xtraeme 14782: </div>
14783: </div>
14784: </div>
14785:
14786: <p>If a package contains a rc.d script, it won't be
14787: copied into the startup directory by default, but you
14788: can enable it, by adding the option <code class=
1.45 wiz 14789: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14791: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14792: the scripts into <code xmlns=
14793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14794: "filename">/etc/rc.d</code> when a package is
14795: installed, and it will automatically remove the scripts
14796: when the package is deinstalled.</p>
14797: </div>
1.57 minskim 14798:
1.67 hubertf 14799: <div class="sect2" lang="en">
1.57 minskim 14800: <div class="titlepage">
14801: <div>
14802: <div>
1.67 hubertf 14803: <h3 class="title"><a name=
1.68 rillig 14804: "tex-packages"></a>16.5.17. Packages
1.57 minskim 14805: installing TeX modules</h3>
14806: </div>
14807: </div>
14808: </div>
14809:
14810: <p>If a package installs TeX packages into the texmf
14811: tree, the <code xmlns=
14812: "http://www.w3.org/TR/xhtml1/transitional" class=
14813: "filename">ls-R</code> database of the tree needs to be
14814: updated.</p>
14815:
14816: <div class="note" style=
14817: "margin-left: 0.5in; margin-right: 0.5in;">
14818: <h3 class="title">Note</h3>
14819:
14820: <p>Except the main TeX packages such as teTeX-texmf,
14821: packages should install files into <code class=
14822: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14823: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14824: </div>
14825:
14826: <div class="orderedlist">
14827: <ol type="1">
14828: <li>
14829: <p>Include <code xmlns=
14830: "http://www.w3.org/TR/xhtml1/transitional" class=
14831: "filename">../../print/teTeX/module.mk</code>
14832: instead of <code xmlns=
14833: "http://www.w3.org/TR/xhtml1/transitional" class=
14834: "filename">../../mk/tex.buildlink3.mk</code>.
14835: This takes care of rebuilding the <code xmlns=
14836: "http://www.w3.org/TR/xhtml1/transitional" class=
14837: "filename">ls-R</code> database at installation
14838: and deinstallation time.</p>
14839: </li>
14840:
14841: <li>
14842: <p>If your package installs files into a texmf
14843: tree other than the one at <code class=
14844: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14845: <code class="varname">TEXMFDIRS</code> to the
14846: list of all texmf trees that need database
14847: update.</p>
1.64 kim 14848:
14849: <p>If your package also installs font map files
14850: that need to be registered using
14851: <span><strong class=
14852: "command">updmap</strong></span>, set
14853: <code class="varname">TEX_FONTMAPS</code> to the
14854: list of all such font map files. Then
14855: <span><strong class=
14856: "command">updmap</strong></span> will be run
14857: automatically at installation/deinstallation to
14858: enable/disable font map files for TeX output
14859: drivers.</p>
1.57 minskim 14860: </li>
14861:
14862: <li>
14863: <p>Make sure that none of <code xmlns=
14864: "http://www.w3.org/TR/xhtml1/transitional" class=
14865: "filename">ls-R</code> databases are included in
14866: <code xmlns=
14867: "http://www.w3.org/TR/xhtml1/transitional" class=
14868: "filename">PLIST</code>, as they will be removed
14869: only by the teTeX-bin package.</p>
14870: </li>
14871: </ol>
14872: </div>
14873: </div>
1.1 grant 14874: </div>
14875:
1.67 hubertf 14876: <div class="sect1" lang="en">
1.1 grant 14877: <div class="titlepage">
14878: <div>
14879: <div>
14880: <h2 class="title" style="clear: both"><a name=
1.68 rillig 14881: "feedback-to-author"></a>16.6. Feedback to the
1.30 wiz 14882: author</h2>
1.1 grant 14883: </div>
14884: </div>
14885: </div>
14886:
14887: <p>If you have found any bugs in the package you make
14888: available, if you had to do special steps to make it run
14889: under NetBSD or if you enhanced the software in various
14890: other ways, be sure to report these changes back to the
14891: original author of the program! With that kind of
14892: support, the next release of the program can incorporate
14893: these fixes, and people not using the NetBSD packages
14894: system can win from your efforts.</p>
14895:
14896: <p>Support the idea of free software!</p>
14897: </div>
14898: </div>
14899:
1.67 hubertf 14900: <div class="chapter" lang="en">
1.1 grant 14901: <div class="titlepage">
14902: <div>
14903: <div>
1.67 hubertf 14904: <h2 class="title"><a name=
1.68 rillig 14905: "debug"></a>Chapter 17. Debugging</h2>
1.1 grant 14906: </div>
14907: </div>
14908: </div>
14909:
14910: <p>To check out all the gotchas when building a package,
14911: here are the steps that I do in order to get a package
14912: working. Please note this is basically the same as what was
14913: explained in the previous sections, only with some
14914: debugging aids.</p>
14915:
14916: <div class="itemizedlist">
14917: <ul type="disc">
14918: <li>
1.14 xtraeme 14919: <p>Be sure to set <code class=
1.45 wiz 14920: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14921: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14922: "filename">/etc/mk.conf</code></p>
1.1 grant 14923: </li>
14924:
14925: <li>
14926: <p>Install <a xmlns=
14927: "http://www.w3.org/TR/xhtml1/transitional" href=
14928: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14929: target="_top"><code xmlns="" class=
14930: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14931: directory for a new package, change into it, then run
14932: <span><strong class=
14933: "command">url2pkg</strong></span>:</p>
1.1 grant 14934: <pre class="screen">
1.14 xtraeme 14935: <code class="prompt">%</code> <strong class=
14936: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14937: "replaceable"><code>category</code></em>/<em class=
14938: "replaceable"><code>examplepkg</code></em></code></strong>
14939: <code class="prompt">%</code> <strong class=
14940: "userinput"><code>cd /usr/pkgsrc/<em class=
14941: "replaceable"><code>category</code></em>/<em class=
14942: "replaceable"><code>examplepkg</code></em></code></strong>
14943: <code class="prompt">%</code> <strong class=
14944: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14945: </pre>
14946: </li>
14947:
14948: <li>
1.45 wiz 14949: <p>Edit the <code xmlns=
14950: "http://www.w3.org/TR/xhtml1/transitional" class=
14951: "filename">Makefile</code> as requested.</p>
1.1 grant 14952: </li>
14953:
14954: <li>
1.45 wiz 14955: <p>Fill in the <code xmlns=
14956: "http://www.w3.org/TR/xhtml1/transitional" class=
14957: "filename">DESCR</code> file</p>
1.1 grant 14958: </li>
14959:
14960: <li>
1.14 xtraeme 14961: <p>Run <span><strong class="command">make
14962: configure</strong></span></p>
1.1 grant 14963: </li>
14964:
14965: <li>
14966: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14967: and the configure step to the package's <code xmlns=
14968: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14969: "filename">Makefile</code>.</p>
1.1 grant 14970: </li>
14971:
14972: <li>
14973: <p>Make the package compile, doing multiple rounds
14974: of</p>
14975: <pre class="screen">
1.14 xtraeme 14976: <code class="prompt">%</code> <strong class=
14977: "userinput"><code>make</code></strong>
14978: <code class="prompt">%</code> <strong class=
14979: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14980: <code class="prompt">%</code> <strong class=
14981: "userinput"><code>mkpatches</code></strong>
14982: <code class="prompt">%</code> <strong class=
14983: "userinput"><code>patchdiff</code></strong>
14984: <code class="prompt">%</code> <strong class=
14985: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14986: <code class="prompt">%</code> <strong class=
14987: "userinput"><code>make mps</code></strong>
14988: <code class="prompt">%</code> <strong class=
14989: "userinput"><code>make clean</code></strong>
1.1 grant 14990: </pre>
14991:
14992: <p>Doing as non-root user will ensure that no files
14993: are modified that shouldn't be, especially during the
1.14 xtraeme 14994: build phase. <span><strong class=
14995: "command">mkpatches</strong></span>,
14996: <span><strong class=
14997: "command">patchdiff</strong></span> and
14998: <span><strong class="command">pkgvi</strong></span>
14999: are from the <a xmlns=
1.1 grant 15000: "http://www.w3.org/TR/xhtml1/transitional" href=
15001: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 15002: target="_top"><code xmlns="" class=
15003: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 15004: </li>
15005:
15006: <li>
1.45 wiz 15007: <p>Look at the <code xmlns=
15008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15009: "filename">Makefile</code>, fix if necessary; see
15010: <a href="#components.Makefile" title=
1.38 dillo 15011: "8.1. Makefile">Section 8.1,
1.45 wiz 15012: “<code xmlns=
15013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15014: "filename">Makefile</code>”</a>.</p>
1.1 grant 15015: </li>
15016:
15017: <li>
1.45 wiz 15018: <p>Generate a <code xmlns=
15019: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15020: "filename">PLIST</code>:</p>
1.1 grant 15021: <pre class="screen">
1.14 xtraeme 15022: <code class="prompt">#</code> <strong class=
15023: "userinput"><code>make install</code></strong>
15024: <code class="prompt">#</code> <strong class=
15025: "userinput"><code>make print-PLIST >PLIST</code></strong>
15026: <code class="prompt">#</code> <strong class=
15027: "userinput"><code>make deinstall</code></strong>
15028: <code class="prompt">#</code> <strong class=
15029: "userinput"><code>make install</code></strong>
15030: <code class="prompt">#</code> <strong class=
15031: "userinput"><code>make deinstall</code></strong>
1.1 grant 15032: </pre>
15033:
1.45 wiz 15034: <p>You usually need to be <code xmlns=
15035: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15036: "username">root</code> to do this. Look if there are
1.1 grant 15037: any files left:</p>
15038: <pre class="screen">
1.14 xtraeme 15039: <code class="prompt">#</code> <strong class=
15040: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15041: </pre>
15042:
15043: <p>If this reveals any files that are missing in
1.45 wiz 15044: <code xmlns=
15045: "http://www.w3.org/TR/xhtml1/transitional" class=
15046: "filename">PLIST</code>, add them.</p>
1.1 grant 15047: </li>
15048:
15049: <li>
1.45 wiz 15050: <p>Now that the <code xmlns=
15051: "http://www.w3.org/TR/xhtml1/transitional" class=
15052: "filename">PLIST</code> is OK, install the package
15053: again and make a binary package:</p>
1.1 grant 15054: <pre class="screen">
1.14 xtraeme 15055: <code class="prompt">#</code> <strong class=
15056: "userinput"><code>make reinstall</code></strong>
15057: <code class="prompt">#</code> <strong class=
15058: "userinput"><code>make package</code></strong>
1.1 grant 15059: </pre>
15060: </li>
15061:
15062: <li>
15063: <p>Delete the installed package:</p>
15064: <pre class="screen">
1.14 xtraeme 15065: <code class="prompt">#</code> <strong class=
15066: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 15067: </pre>
15068: </li>
15069:
15070: <li>
1.14 xtraeme 15071: <p>Repeat the above <span><strong class=
15072: "command">make print-PLIST</strong></span> command,
15073: which shouldn't find anything now:</p>
1.1 grant 15074: <pre class="screen">
1.14 xtraeme 15075: <code class="prompt">#</code> <strong class=
15076: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 15077: </pre>
15078: </li>
15079:
15080: <li>
15081: <p>Reinstall the binary package:</p>
15082: <pre class="screen">
1.14 xtraeme 15083: <code class="prompt">#</code> <strong class=
15084: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 15085: </pre>
15086: </li>
15087:
15088: <li>
15089: <p>Play with it. Make sure everything works.</p>
15090: </li>
15091:
15092: <li>
1.14 xtraeme 15093: <p>Run <span><strong class=
15094: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 15095: "http://www.w3.org/TR/xhtml1/transitional" href=
15096: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 15097: target="_top"><code xmlns="" class=
15098: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 15099: problems it reports:</p>
1.1 grant 15100: <pre class="screen">
1.14 xtraeme 15101: <code class="prompt">#</code> <strong class=
15102: "userinput"><code>pkglint</code></strong>
1.1 grant 15103: </pre>
15104: </li>
15105:
15106: <li>
15107: <p>Submit (or commit, if you have cvs access); see
15108: <a href="#submit" title=
1.68 rillig 15109: "Chapter 18. Submitting and Committing">Chapter 18,
1.1 grant 15110: <i>Submitting and Committing</i></a>.</p>
15111: </li>
15112: </ul>
15113: </div>
15114: </div>
15115:
1.67 hubertf 15116: <div class="chapter" lang="en">
1.1 grant 15117: <div class="titlepage">
15118: <div>
15119: <div>
1.67 hubertf 15120: <h2 class="title"><a name=
1.68 rillig 15121: "submit"></a>Chapter 18. Submitting and
1.1 grant 15122: Committing</h2>
15123: </div>
15124: </div>
15125: </div>
15126:
15127: <div class="toc">
15128: <p><b>Table of Contents</b></p>
15129:
15130: <dl>
1.30 wiz 15131: <dt><span class="sect1"><a href=
1.68 rillig 15132: "#submitting-your-package">18.1. Submitting your
1.30 wiz 15133: packages</a></span></dt>
1.1 grant 15134:
1.30 wiz 15135: <dt><span class="sect1"><a href=
1.68 rillig 15136: "#general-notes-for-changes">18.2. General notes when
1.41 wiz 15137: adding, updating, or removing packages</a></span></dt>
15138:
15139: <dt><span class="sect1"><a href=
1.68 rillig 15140: "#committing-importing">18.3. Committing: Importing a
1.30 wiz 15141: package into CVS</a></span></dt>
1.1 grant 15142:
1.30 wiz 15143: <dt><span class="sect1"><a href=
1.68 rillig 15144: "#updating-package">18.4. Updating a package to a newer
1.30 wiz 15145: version</a></span></dt>
1.1 grant 15146:
1.68 rillig 15147: <dt><span class="sect1"><a href="#moving-package">18.5.
1.2 hubertf 15148: Moving a package in pkgsrc</a></span></dt>
1.1 grant 15149: </dl>
15150: </div>
15151:
1.67 hubertf 15152: <div class="sect1" lang="en">
1.1 grant 15153: <div class="titlepage">
15154: <div>
15155: <div>
15156: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15157: "submitting-your-package"></a>18.1. Submitting
1.30 wiz 15158: your packages</h2>
1.1 grant 15159: </div>
15160: </div>
15161: </div>
15162:
15163: <p>You have to separate between binary and
15164: “<span class="quote">normal</span>” (source)
15165: packages here:</p>
15166:
15167: <div class="itemizedlist">
15168: <ul type="disc">
15169: <li>
15170: <p>precompiled binary packages</p>
15171:
15172: <p>Our policy is that we accept binaries only from
15173: pkgsrc developers to guarantee that the packages
15174: don't contain any trojan horses etc. This is not to
1.13 hubertf 15175: annoy anyone but rather to protect our users!
1.1 grant 15176: You're still free to put up your home-made binary
1.13 hubertf 15177: packages and tell the world where to get them.
15178: NetBSD developers doing bulk builds and wanting to
15179: upload them please see <a href="#bulk-upload"
1.38 dillo 15180: title="6.3.8. Uploading results of a bulk build">
15181: Section 6.3.8, “Uploading results of a
1.13 hubertf 15182: bulk build”</a>.</p>
1.1 grant 15183: </li>
15184:
15185: <li>
15186: <p>packages</p>
15187:
15188: <p>First, check that your package is complete,
15189: compiles and runs well; see <a href="#debug" title=
1.68 rillig 15190: "Chapter 17. Debugging">Chapter 17,
1.1 grant 15191: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 15192: Next, generate an uuencoded gzipped <a href=
15193: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
15194: <span class="citerefentry"><span class=
15195: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 15196: preferably with all files in a single directory.
1.14 xtraeme 15197: Finally, <span><strong class=
15198: "command">send-pr</strong></span> with category
1.1 grant 15199: “<span class="quote">pkg</span>”, a
15200: synopsis which includes the package name and
15201: version number, a short description of your package
15202: (contents of the COMMENT variable or DESCR file are
15203: OK) and attach the archive to your PR.</p>
15204:
15205: <p>If you want to submit several packages, please
15206: send a separate PR for each one, it's easier for us
15207: to track things that way.</p>
15208:
15209: <p>Alternatively, you can also import new packages
15210: into pkgsrc-wip (“<span class="quote">pkgsrc
15211: work-in-progress</span>”); see the homepage
15212: at <a href="http://pkgsrc-wip.sourceforge.net/"
15213: target=
15214: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
15215: details.</p>
15216: </li>
15217: </ul>
15218: </div>
15219: </div>
15220:
1.67 hubertf 15221: <div class="sect1" lang="en">
1.1 grant 15222: <div class="titlepage">
15223: <div>
15224: <div>
15225: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15226: "general-notes-for-changes"></a>18.2. General
1.41 wiz 15227: notes when adding, updating, or removing
15228: packages</h2>
15229: </div>
15230: </div>
15231: </div>
15232:
15233: <p>Please note all package additions, updates, moves, and
1.45 wiz 15234: removals in <code xmlns=
15235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15236: "filename">pkgsrc/doc/CHANGES</code>. It's very important
15237: to keep this file up to date and conforming to the
15238: existing format, because it will be used by scripts to
15239: automatically update pages on <a href=
15240: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 15241: and other sites. Additionally, check the <code xmlns=
15242: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15243: "filename">pkgsrc/doc/TODO</code> file and remove the
15244: entry for the package you updated or removed, in case it
15245: was mentioned there.</p>
15246:
1.71 wiz 15247: <p>When the <code class="varname">PKGREVISION</code> of a
15248: package is bumped, the change should appear in
15249: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15250: class="filename">pkgsrc/doc/CHANGES</code> if it is
15251: security related or otherwise relevant. Mass bumps that
15252: result from a dependency being updated should not be
15253: mentioned. In all other cases it's the developer's
15254: decision.</p>
15255:
1.41 wiz 15256: <p>There is a make target that helps in creating proper
1.45 wiz 15257: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15258: class="filename">CHANGES</code> entries:
1.41 wiz 15259: <span><strong class="command">make
15260: changes-entry</strong></span>. It uses the optional
15261: <code class="varname">CTYPE</code> and <code class=
15262: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 15263: usage is to first make sure that your <code xmlns=
15264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15265: "filename">CHANGES</code> file is up-to-date (to avoid
15266: having to resolve conflicts later-on) and then to
15267: <span><strong class="command">cd</strong></span> to the
15268: package directory. For package updates,
15269: <span><strong class="command">make
15270: changes-entry</strong></span> is enough. For new
15271: packages, or package moves or removals, set the
15272: <code class="varname">CTYPE</code> variable on the
15273: command line to "Added", "Moved", or "Removed". You can
15274: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 15275: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
15276: class="filename">/etc/mk.conf</code> if your local login
15277: name is not the same as your NetBSD login name. Don't
15278: forget to commit the changes to <code xmlns=
15279: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 15280: "filename">pkgsrc/doc/CHANGES</code>!</p>
15281: </div>
15282:
1.67 hubertf 15283: <div class="sect1" lang="en">
1.41 wiz 15284: <div class="titlepage">
15285: <div>
15286: <div>
15287: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15288: "committing-importing"></a>18.3. Committing:
1.30 wiz 15289: Importing a package into CVS</h2>
1.1 grant 15290: </div>
15291: </div>
15292: </div>
15293:
15294: <p>This section is only of interest for pkgsrc developers
15295: with write access to the pkgsrc repository. Please
15296: remember that cvs imports files relative to the current
15297: working directory, and that the pathname that you give
1.14 xtraeme 15298: the <span><strong class="command">cvs
15299: import</strong></span> command is so that it knows where
15300: to place the files in the repository. Newly created
15301: packages should be imported with a vendor tag of
15302: “<span class="quote">TNF</span>” and a
15303: release tag of “<span class=
15304: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 15305: <pre class="programlisting">
1.51 rillig 15306: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
15307: <code class=
15308: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 15309: </pre>
15310:
15311: <p>Remember to move the directory from which you imported
15312: out of the way, or cvs will complain the next time you
15313: “<span class="quote">cvs update</span>” your
15314: source tree. Also don't forget to add the new package to
1.45 wiz 15315: the category's <code xmlns=
15316: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15317: "filename">Makefile</code>.</p>
1.1 grant 15318:
15319: <p>The commit message of the initial import should
1.45 wiz 15320: include part of the <code xmlns=
15321: "http://www.w3.org/TR/xhtml1/transitional" class=
15322: "filename">DESCR</code> file, so people reading the
15323: mailing lists know what the package is/does.</p>
1.1 grant 15324:
15325: <p>For new packages, “<span class="quote">cvs
15326: import</span>” is preferred to “<span class=
15327: "quote">cvs add</span>” because the former gets
15328: everything with a single command, and provides a
15329: consistent tag.</p>
15330: </div>
15331:
1.67 hubertf 15332: <div class="sect1" lang="en">
1.1 grant 15333: <div class="titlepage">
15334: <div>
15335: <div>
15336: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15337: "updating-package"></a>18.4. Updating a
1.30 wiz 15338: package to a newer version</h2>
1.1 grant 15339: </div>
15340: </div>
15341: </div>
15342:
15343: <p>Please always put a concise, appropriate and relevant
15344: summary of the changes between old and new versions into
15345: the commit log when updating a package. There are various
15346: reasons for this:</p>
15347:
15348: <div class="itemizedlist">
15349: <ul type="disc">
15350: <li>
15351: <p>A URL is volatile, and can change over time. It
15352: may go away completely or its information may be
15353: overwritten by newer information.</p>
15354: </li>
15355:
15356: <li>
15357: <p>Having the change information between old and
15358: new versions in our CVS repository is very useful
15359: for people who use either cvs or anoncvs.</p>
15360: </li>
15361:
15362: <li>
15363: <p>Having the change information between old and
15364: new versions in our CVS repository is very useful
15365: for people who read the pkgsrc-changes mailing
15366: list, so that they can make tactical decisions
15367: about when to upgrade the package.</p>
15368: </li>
15369: </ul>
15370: </div>
15371:
1.18 xtraeme 15372: <p>Please also recognize that, just because a new version
1.1 grant 15373: of a package has been released, it should not
15374: automatically be upgraded in the CVS repository. We
15375: prefer to be conservative in the packages that are
15376: included in pkgsrc - development or beta packages are not
15377: really the best thing for most places in which pkgsrc is
15378: used. Please use your judgement about what should go into
15379: pkgsrc, and bear in mind that stability is to be
15380: preferred above new and possibly untested features.</p>
15381: </div>
15382:
1.67 hubertf 15383: <div class="sect1" lang="en">
1.1 grant 15384: <div class="titlepage">
15385: <div>
15386: <div>
15387: <h2 class="title" style="clear: both"><a name=
1.68 rillig 15388: "moving-package"></a>18.5. Moving a package in
1.30 wiz 15389: pkgsrc</h2>
1.1 grant 15390: </div>
15391: </div>
15392: </div>
15393:
15394: <div class="orderedlist">
15395: <ol type="1">
15396: <li>
15397: <p>Make a copy of the directory somewhere else.</p>
15398: </li>
15399:
15400: <li>
15401: <p>Remove all CVS dirs.</p>
15402:
15403: <p>Alternatively to the first two steps you can
15404: also do:</p>
15405: <pre class="screen">
1.14 xtraeme 15406: <code class="prompt">%</code> <strong class=
15407: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 15408: </pre>
15409:
15410: <p>and use that for further work.</p>
15411: </li>
15412:
15413: <li>
1.14 xtraeme 15414: <p>Fix <code class="varname">CATEGORIES</code> and
15415: any <code class="varname">DEPENDS</code> paths that
15416: just did “<span class=
1.1 grant 15417: "quote">../package</span>” instead of
15418: “<span class=
15419: "quote">../../category/package</span>”.</p>
15420: </li>
15421:
15422: <li>
1.14 xtraeme 15423: <p><span><strong class="command">cvs
15424: import</strong></span> the modified package in the
15425: new place.</p>
1.1 grant 15426: </li>
15427:
15428: <li>
15429: <p>Check if any package depends on it:</p>
15430: <pre class="screen">
1.14 xtraeme 15431: <code class="prompt">%</code> <strong class=
15432: "userinput"><code>cd /usr/pkgsrc</code></strong>
15433: <code class="prompt">%</code> <strong class=
15434: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 15435: </pre>
15436: </li>
15437:
15438: <li>
15439: <p>Fix paths in packages from step 5 to point to
15440: new location.</p>
15441: </li>
15442:
15443: <li>
1.14 xtraeme 15444: <p><span><strong class="command">cvs rm
15445: (-f)</strong></span> the package at the old
15446: location.</p>
1.1 grant 15447: </li>
15448:
15449: <li>
1.45 wiz 15450: <p>Remove from <code xmlns=
15451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15452: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 15453: </li>
15454:
15455: <li>
1.45 wiz 15456: <p>Add to <code xmlns=
15457: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15458: "filename">newcategory/Makefile</code>.</p>
1.1 grant 15459: </li>
15460:
15461: <li>
15462: <p>Commit the changed and removed files:</p>
15463: <pre class="screen">
1.14 xtraeme 15464: <code class="prompt">%</code> <strong class=
15465: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 15466: </pre>
15467:
15468: <p>(and any packages from step 5, of course).</p>
15469: </li>
15470: </ol>
15471: </div>
15472: </div>
15473: </div>
1.69 rillig 15474:
15475: <div class="chapter" lang="en">
15476: <div class="titlepage">
15477: <div>
15478: <div>
15479: <h2 class="title"><a name=
1.72 rillig 15480: "devfaq"></a>Chapter 19. Frequently Asked
15481: Questions</h2>
15482: </div>
15483: </div>
15484: </div>
15485:
15486: <p>This section contains the answers to questions that may
15487: arise when you are writing a package. If you don't find
15488: your question answered here, first have a look in the other
15489: chapters, and if you still don't have the answer, ask on
15490: the <code class="literal">pkgsrc-users</code> mailing
15491: list.</p>
15492:
15493: <div class="qandaset">
15494: <dl>
1.73 ! rillig 15495: <dt>19.1. <a href="#id2654342">What is the difference
1.72 rillig 15496: between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?</a></dt>
15497:
1.73 ! rillig 15498: <dt>19.2. <a href="#id2654378">What is the difference
1.72 rillig 15499: between MAKE, GMAKE and MAKE_PROGRAM?</a></dt>
15500:
1.73 ! rillig 15501: <dt>19.3. <a href="#id2654417">What is the difference
1.72 rillig 15502: between CC, PKG_CC and PKGSRC_COMPILER?</a></dt>
15503:
1.73 ! rillig 15504: <dt>19.4. <a href="#id2654454">What is the difference
1.72 rillig 15505: between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
15506: BUILDLINK_LIBS?</a></dt>
15507:
1.73 ! rillig 15508: <dt>19.5. <a href="#id2654472">Why does make show-var
1.72 rillig 15509: VARNAME=BUILDLINK_PREFIX.foo say it's empty?</a></dt>
15510: </dl>
15511:
15512: <table border="0" summary="Q and A Set">
15513: <col align="left" width="1%" />
15514:
15515: <tbody>
15516: <tr class="question">
15517: <td align="left" valign="top"><a name=
1.73 ! rillig 15518: "id2654342"></a><a name=
! 15519: "id2654343"></a><b>19.1.</b></td>
1.72 rillig 15520:
15521: <td align="left" valign="top">
15522: <p>What is the difference between <code class=
15523: "varname">MAKEFLAGS</code>, <code class=
15524: "varname">.MAKEFLAGS</code> and <code class=
15525: "varname">MAKE_FLAGS</code>?</p>
15526: </td>
15527: </tr>
15528:
15529: <tr class="answer">
15530: <td align="left" valign="top"></td>
15531:
15532: <td align="left" valign="top">
15533: <p><code class="varname">MAKEFLAGS</code> are the
15534: flags passed to the pkgsrc-internal invocations
15535: of <a href=
15536: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
15537: <span class="citerefentry"><span class=
15538: "refentrytitle">make</span>(1)</span></a>, while
15539: <code class="varname">MAKE_FLAGS</code> are the
15540: flags that are passed to the <code class=
15541: "varname">MAKE_PROGRAM</code> when building the
15542: package. [FIXME: What is .MAKEFLAGS for?]</p>
15543: </td>
15544: </tr>
15545:
15546: <tr class="question">
15547: <td align="left" valign="top"><a name=
1.73 ! rillig 15548: "id2654378"></a><a name=
! 15549: "id2654379"></a><b>19.2.</b></td>
1.72 rillig 15550:
15551: <td align="left" valign="top">
15552: <p>What is the difference between <code class=
15553: "varname">MAKE</code>, <code class=
15554: "varname">GMAKE</code> and <code class=
15555: "varname">MAKE_PROGRAM</code>?</p>
15556: </td>
15557: </tr>
15558:
15559: <tr class="answer">
15560: <td align="left" valign="top"></td>
15561:
15562: <td align="left" valign="top">
15563: <p><code class="varname">MAKE</code> is the path
15564: to the <a href=
15565: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
15566: <span class="citerefentry"><span class=
15567: "refentrytitle">make</span>(1)</span></a> program
15568: that is used in the pkgsrc infrastructure.
15569: <code class="varname">GMAKE</code> is the path to
15570: GNU Make, but you need to say <code class=
15571: "varname">USE_TOOLS+=gmake</code> to use that.
15572: <code class="varname">MAKE_PROGRAM</code> is the
15573: path to the Make program that is used for
15574: building the package.</p>
15575: </td>
15576: </tr>
15577:
15578: <tr class="question">
15579: <td align="left" valign="top"><a name=
1.73 ! rillig 15580: "id2654417"></a><a name=
! 15581: "id2654418"></a><b>19.3.</b></td>
1.72 rillig 15582:
15583: <td align="left" valign="top">
15584: <p>What is the difference between <code class=
15585: "varname">CC</code>, <code class=
15586: "varname">PKG_CC</code> and <code class=
15587: "varname">PKGSRC_COMPILER</code>?</p>
15588: </td>
15589: </tr>
15590:
15591: <tr class="answer">
15592: <td align="left" valign="top"></td>
15593:
15594: <td align="left" valign="top">
15595: <p><code class="varname">CC</code> is the path to
15596: the real C compiler, which can be configured by
15597: the pkgsrc user. <code class=
15598: "varname">PKG_CC</code> is the path to the
15599: compiler wrapper. <code class=
15600: "varname">PKGSRC_COMPILER</code> is <span class=
15601: "emphasis"><em>not</em></span> a path to a
15602: compiler, but the type of compiler that should be
15603: used. See <code xmlns=
15604: "http://www.w3.org/TR/xhtml1/transitional" class=
15605: "filename">mk/compiler.mk</code> for more
15606: information about the latter variable.</p>
15607: </td>
15608: </tr>
15609:
15610: <tr class="question">
15611: <td align="left" valign="top"><a name=
1.73 ! rillig 15612: "id2654454"></a><a name=
! 15613: "id2654455"></a><b>19.4.</b></td>
1.72 rillig 15614:
15615: <td align="left" valign="top">
15616: <p>What is the difference between <code class=
15617: "varname">BUILDLINK_LDFLAGS</code>, <code class=
15618: "varname">BUILDLINK_LDADD</code> and <code class=
15619: "varname">BUILDLINK_LIBS</code>?</p>
15620: </td>
15621: </tr>
15622:
15623: <tr class="answer">
15624: <td align="left" valign="top"></td>
15625:
15626: <td align="left" valign="top">
15627: <p>[FIXME]</p>
15628: </td>
15629: </tr>
15630:
15631: <tr class="question">
15632: <td align="left" valign="top"><a name=
1.73 ! rillig 15633: "id2654472"></a><a name=
! 15634: "id2654473"></a><b>19.5.</b></td>
1.72 rillig 15635:
15636: <td align="left" valign="top">
15637: <p>Why does <span><strong class="command">make
15638: show-var VARNAME=BUILDLINK_PREFIX.<em class=
15639: "replaceable"><code>foo</code></em></strong></span>
15640: say it's empty?</p>
15641: </td>
15642: </tr>
15643:
15644: <tr class="answer">
15645: <td align="left" valign="top"></td>
15646:
15647: <td align="left" valign="top">
15648: <p>For optimization reasons, some variables are
15649: only available in the “<span class=
15650: "quote">wrapper</span>” phase and later. To
15651: “<span class="quote">simulate</span>”
15652: the wrapper phase, append <span><strong class=
15653: "command">PKG_PHASE=wrapper</strong></span> to
15654: the above command.</p>
15655: </td>
15656: </tr>
15657: </tbody>
15658: </table>
15659: </div>
15660: </div>
15661: </div>
15662:
15663: <div class="part" lang="en">
15664: <div class="titlepage">
15665: <div>
15666: <div>
15667: <h1 class="title"><a name=
15668: "infrastructure"></a>Part III. The pkgsrc
1.73 ! rillig 15669: infrastructure internals</h1>
1.72 rillig 15670: </div>
15671: </div>
15672: </div>
15673:
1.73 ! rillig 15674: <div class="partintro" lang="en">
! 15675: <p>This part of the guide deals with everything from the
! 15676: infrastructure that is behind the interfaces described in
! 15677: the developer's guide. A casual package maintainer should
! 15678: not need anything from this part.</p>
! 15679:
! 15680: <div class="toc">
! 15681: <p><b>Table of Contents</b></p>
! 15682:
! 15683: <dl>
! 15684: <dt><span class="chapter"><a href="#infr.design">20.
! 15685: Design of the pkgsrc infrastructure</a></span></dt>
! 15686:
! 15687: <dd>
! 15688: <dl>
! 15689: <dt><span class="sect1"><a href="#infr.var">20.1.
! 15690: Variable evaluation</a></span></dt>
! 15691:
! 15692: <dd>
! 15693: <dl>
! 15694: <dt><span class="sect2"><a href=
! 15695: "#infr.var.load">20.1.1. At load
! 15696: time</a></span></dt>
! 15697:
! 15698: <dt><span class="sect2"><a href=
! 15699: "#infr.var.run">20.1.2. At
! 15700: runtime</a></span></dt>
! 15701: </dl>
! 15702: </dd>
! 15703:
! 15704: <dt><span class="sect1"><a href=
! 15705: "#infr.design.intf">20.2. Designing interfaces for
! 15706: Makefile fragments</a></span></dt>
! 15707:
! 15708: <dd>
! 15709: <dl>
! 15710: <dt><span class="sect2"><a href=
! 15711: "#infr.design.intf.proc">20.2.1. Procedures
! 15712: with parameters</a></span></dt>
! 15713:
! 15714: <dt><span class="sect2"><a href=
! 15715: "#infr.design.intf.action">20.2.2. Actions
! 15716: taken on behalf of parameters</a></span></dt>
! 15717: </dl>
! 15718: </dd>
! 15719: </dl>
! 15720: </dd>
! 15721:
! 15722: <dt><span class="chapter"><a href="#regression">21.
! 15723: Regression tests</a></span></dt>
! 15724:
! 15725: <dd>
! 15726: <dl>
! 15727: <dt><span class="sect1"><a href=
! 15728: "#regression.descr">21.1. The regression tests
! 15729: framework</a></span></dt>
! 15730:
! 15731: <dt><span class="sect1"><a href=
! 15732: "#regression.run">21.2. Running the regression
! 15733: tests</a></span></dt>
! 15734:
! 15735: <dt><span class="sect1"><a href=
! 15736: "#regression.new">21.3. Adding a new regression
! 15737: test</a></span></dt>
! 15738:
! 15739: <dd>
! 15740: <dl>
! 15741: <dt><span class="sect2"><a href=
! 15742: "#regression.fun.override">21.3.1. Overridable
! 15743: functions</a></span></dt>
! 15744:
! 15745: <dt><span class="sect2"><a href=
! 15746: "#regression.fun.helper">21.3.2. Helper
! 15747: functions</a></span></dt>
! 15748: </dl>
! 15749: </dd>
! 15750: </dl>
! 15751: </dd>
! 15752:
! 15753: <dt><span class="chapter"><a href="#porting">22.
! 15754: Porting pkgsrc</a></span></dt>
! 15755:
! 15756: <dd>
! 15757: <dl>
! 15758: <dt><span class="sect1"><a href=
! 15759: "#porting.opsys">22.1. Porting pkgsrc to a new
! 15760: operating system</a></span></dt>
! 15761:
! 15762: <dt><span class="sect1"><a href=
! 15763: "#porting.compiler">22.2. Adding support for a new
! 15764: compiler</a></span></dt>
! 15765: </dl>
! 15766: </dd>
! 15767: </dl>
! 15768: </div>
! 15769: </div>
! 15770:
! 15771: <div class="chapter" lang="en">
! 15772: <div class="titlepage">
! 15773: <div>
! 15774: <div>
! 15775: <h2 class="title"><a name=
! 15776: "infr.design"></a>Chapter 20. Design of the
! 15777: pkgsrc infrastructure</h2>
! 15778: </div>
! 15779: </div>
! 15780: </div>
! 15781:
! 15782: <div class="toc">
! 15783: <p><b>Table of Contents</b></p>
! 15784:
! 15785: <dl>
! 15786: <dt><span class="sect1"><a href="#infr.var">20.1.
! 15787: Variable evaluation</a></span></dt>
! 15788:
! 15789: <dd>
! 15790: <dl>
! 15791: <dt><span class="sect2"><a href=
! 15792: "#infr.var.load">20.1.1. At load
! 15793: time</a></span></dt>
! 15794:
! 15795: <dt><span class="sect2"><a href=
! 15796: "#infr.var.run">20.1.2. At runtime</a></span></dt>
! 15797: </dl>
! 15798: </dd>
! 15799:
! 15800: <dt><span class="sect1"><a href=
! 15801: "#infr.design.intf">20.2. Designing interfaces for
! 15802: Makefile fragments</a></span></dt>
! 15803:
! 15804: <dd>
! 15805: <dl>
! 15806: <dt><span class="sect2"><a href=
! 15807: "#infr.design.intf.proc">20.2.1. Procedures with
! 15808: parameters</a></span></dt>
! 15809:
! 15810: <dt><span class="sect2"><a href=
! 15811: "#infr.design.intf.action">20.2.2. Actions taken on
! 15812: behalf of parameters</a></span></dt>
! 15813: </dl>
! 15814: </dd>
! 15815: </dl>
! 15816: </div>
! 15817:
! 15818: <p>The pkgsrc infrastructure consists of many small
! 15819: Makefile fragments. Each such fragment needs a properly
! 15820: specified interface. This chapter explains how such an
! 15821: interface looks like.</p>
! 15822:
! 15823: <div class="sect1" lang="en">
! 15824: <div class="titlepage">
! 15825: <div>
! 15826: <div>
! 15827: <h2 class="title" style="clear: both"><a name=
! 15828: "infr.var"></a>20.1. Variable evaluation</h2>
! 15829: </div>
! 15830: </div>
! 15831: </div>
! 15832:
! 15833: <div class="sect2" lang="en">
! 15834: <div class="titlepage">
! 15835: <div>
! 15836: <div>
! 15837: <h3 class="title"><a name=
! 15838: "infr.var.load"></a>20.1.1. At load
! 15839: time</h3>
! 15840: </div>
! 15841: </div>
! 15842: </div>
! 15843:
! 15844: <p>Variable evaluation takes place either at load time
! 15845: or at runtime, depending on the context in which they
! 15846: occur. The contexts where variables are evaluated at
! 15847: load time are:</p>
! 15848:
! 15849: <div class="itemizedlist">
! 15850: <ul type="disc">
! 15851: <li>
! 15852: <p>The right hand side of the <code class=
! 15853: "literal">:=</code> and <code class=
! 15854: "literal">!=</code> operators,</p>
! 15855: </li>
! 15856:
! 15857: <li>
! 15858: <p>Make directives like <code class=
! 15859: "literal">.if</code> or <code class=
! 15860: "literal">.for</code>,</p>
! 15861: </li>
! 15862:
! 15863: <li>
! 15864: <p>Dependency lines.</p>
! 15865: </li>
! 15866: </ul>
! 15867: </div>
! 15868:
! 15869: <p>A special exception are references to the iteration
! 15870: variables of <code class="literal">.for</code> loops,
! 15871: which are expanded inline, no matter in which context
! 15872: they appear.</p>
! 15873:
! 15874: <p>As the values of variables may change during load
! 15875: time, care must be taken not to evaluate them by
! 15876: accident. Typical examples for variables that should
! 15877: not be evaluated at load time are <code class=
! 15878: "varname">DEPENDS</code> and <code class=
! 15879: "varname">CONFIGURE_ARGS</code>. To make the effect
! 15880: more clear, here is an example:</p>
! 15881: <pre class="programlisting">
! 15882: CONFIGURE_ARGS= # none
! 15883: CFLAGS= -O
! 15884: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
! 15885:
! 15886: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
! 15887:
! 15888: CFLAGS+= -Wall
! 15889:
! 15890: </pre>
! 15891:
! 15892: <p>This code shows how the use of the <code class=
! 15893: "literal">:=</code> operator can quickly lead to
! 15894: unexpected results. The first paragraph is fairly
! 15895: common code. The second paragraph evaluates the
! 15896: <code class="varname">CONFIGURE_ARGS</code> variable,
! 15897: which results in <code class=
! 15898: "literal">CFLAGS=-O</code>. In the third paragraph, the
! 15899: <code class="literal">-Wall</code> is appended to the
! 15900: <code class="varname">CFLAGS</code>, but this addition
! 15901: will not appear in <code class=
! 15902: "varname">CONFIGURE_ARGS</code>. In actual code, the
! 15903: three paragraphs from above typically occur in
! 15904: completely unrelated files.</p>
! 15905: </div>
1.72 rillig 15906:
1.73 ! rillig 15907: <div class="sect2" lang="en">
! 15908: <div class="titlepage">
! 15909: <div>
! 15910: <div>
! 15911: <h3 class="title"><a name=
! 15912: "infr.var.run"></a>20.1.2. At runtime</h3>
! 15913: </div>
! 15914: </div>
! 15915: </div>
1.72 rillig 15916:
1.73 ! rillig 15917: <p>After all the files have been loaded, the values of
! 15918: the variables cannot be changed anymore. Variables that
! 15919: are used in the shell commands are expanded at this
! 15920: point.</p>
! 15921: </div>
! 15922: </div>
1.72 rillig 15923:
1.73 ! rillig 15924: <div class="sect1" lang="en">
! 15925: <div class="titlepage">
! 15926: <div>
! 15927: <div>
! 15928: <h2 class="title" style="clear: both"><a name=
! 15929: "infr.design.intf"></a>20.2. Designing
! 15930: interfaces for Makefile fragments</h2>
! 15931: </div>
! 15932: </div>
! 15933: </div>
1.72 rillig 15934:
1.73 ! rillig 15935: <p>Most of the <code xmlns=
! 15936: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15937: "filename">.mk</code> files fall into one of the
! 15938: following classes. Cases where a file falls into more
! 15939: than one class should be avoided as it often leads to
! 15940: subtle bugs.</p>
1.72 rillig 15941:
1.73 ! rillig 15942: <div class="sect2" lang="en">
! 15943: <div class="titlepage">
! 15944: <div>
! 15945: <div>
! 15946: <h3 class="title"><a name=
! 15947: "infr.design.intf.proc"></a>20.2.1. Procedures
! 15948: with parameters</h3>
! 15949: </div>
! 15950: </div>
! 15951: </div>
1.72 rillig 15952:
1.73 ! rillig 15953: <p>In a traditional imperative programming language
! 15954: some of the <code xmlns=
! 15955: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15956: "filename">.mk</code> files could be described as
! 15957: procedures. They take some input parameters
! 15958: and—after inclusion—provide a result in
! 15959: output parameters. Since all variables in <code xmlns=
! 15960: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15961: "filename">Makefile</code>s have global scope care must
! 15962: be taken not to use parameter names that have already
! 15963: another meaning. For example, <code class=
! 15964: "varname">PKGNAME</code> is a bad choice for a
! 15965: parameter name.</p>
! 15966:
! 15967: <p>Procedures are completely evaluated at preprocessing
! 15968: time. That is, when calling a procedure all input
! 15969: parameters must be completely resolvable. For example,
! 15970: <code class="varname">CONFIGURE_ARGS</code> should
! 15971: never be an input parameter since it is very likely
! 15972: that further text will be added after calling the
! 15973: procedure, which would effectively apply the procedure
! 15974: to only a part of the variable. Also, references to
! 15975: other variables wit will be modified after calling the
! 15976: procedure.</p>
! 15977:
! 15978: <p>A procedure can declare its output parameters either
! 15979: as suitable for use in preprocessing directives or as
! 15980: only available at runtime. The latter alternative is
! 15981: for variables that contain references to other runtime
! 15982: variables.</p>
! 15983:
! 15984: <p>Procedures shall be written such that it is possible
! 15985: to call the procedure more than once. That is, the file
! 15986: must not contain multiple-inclusion guards.</p>
! 15987:
! 15988: <p>Examples for procedures are <code xmlns=
! 15989: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15990: "filename">mk/bsd.options.mk</code> and <code xmlns=
! 15991: "http://www.w3.org/TR/xhtml1/transitional" class=
! 15992: "filename">mk/buildlink3/bsd.builtin.mk</code>. To
! 15993: express that the parameters are evaluated at load time,
! 15994: they should be assigned using the <code class=
! 15995: "literal">:=</code> operator, which should be used only
! 15996: for this purpose.</p>
! 15997: </div>
1.72 rillig 15998:
1.73 ! rillig 15999: <div class="sect2" lang="en">
! 16000: <div class="titlepage">
! 16001: <div>
! 16002: <div>
! 16003: <h3 class="title"><a name=
! 16004: "infr.design.intf.action"></a>20.2.2. Actions
! 16005: taken on behalf of parameters</h3>
! 16006: </div>
! 16007: </div>
! 16008: </div>
1.72 rillig 16009:
1.73 ! rillig 16010: <p>Action files take some input parameters and may
! 16011: define runtime variables. They shall not define
! 16012: loadtime variables. There are action files that are
! 16013: included implicitly by the pkgsrc infrastructure, while
! 16014: other must be included explicitly.</p>
1.72 rillig 16015:
1.73 ! rillig 16016: <p>An example for action files is <code xmlns=
! 16017: "http://www.w3.org/TR/xhtml1/transitional" class=
! 16018: "filename">mk/subst.mk</code>.</p>
! 16019: </div>
! 16020: </div>
1.72 rillig 16021: </div>
16022:
16023: <div class="chapter" lang="en">
16024: <div class="titlepage">
16025: <div>
16026: <div>
16027: <h2 class="title"><a name=
1.73 ! rillig 16028: "regression"></a>Chapter 21. Regression
1.72 rillig 16029: tests</h2>
16030: </div>
16031: </div>
16032: </div>
16033:
16034: <div class="toc">
16035: <p><b>Table of Contents</b></p>
16036:
16037: <dl>
16038: <dt><span class="sect1"><a href=
1.73 ! rillig 16039: "#regression.descr">21.1. The regression tests
1.72 rillig 16040: framework</a></span></dt>
16041:
1.73 ! rillig 16042: <dt><span class="sect1"><a href="#regression.run">21.2.
1.72 rillig 16043: Running the regression tests</a></span></dt>
16044:
1.73 ! rillig 16045: <dt><span class="sect1"><a href="#regression.new">21.3.
1.72 rillig 16046: Adding a new regression test</a></span></dt>
16047:
16048: <dd>
16049: <dl>
16050: <dt><span class="sect2"><a href=
1.73 ! rillig 16051: "#regression.fun.override">21.3.1. Overridable
1.72 rillig 16052: functions</a></span></dt>
16053:
16054: <dt><span class="sect2"><a href=
1.73 ! rillig 16055: "#regression.fun.helper">21.3.2. Helper
1.72 rillig 16056: functions</a></span></dt>
16057: </dl>
16058: </dd>
16059: </dl>
16060: </div>
16061:
16062: <p>The pkgsrc infrastructure consists of a large codebase,
16063: and there are many corners where every little bit of a file
16064: is well thought out, making pkgsrc likely to fail as soon
16065: as anything is changed near those parts. To prevent most
16066: changes from breaking anything, a suite of regression tests
16067: should go along with every important part of the pkgsrc
16068: infrastructure. This chapter describes how regression tests
16069: work in pkgsrc and how you can add new tests.</p>
16070:
16071: <div class="sect1" lang="en">
16072: <div class="titlepage">
16073: <div>
16074: <div>
16075: <h2 class="title" style="clear: both"><a name=
1.73 ! rillig 16076: "regression.descr"></a>21.1. The regression
1.72 rillig 16077: tests framework</h2>
16078: </div>
16079: </div>
16080: </div>
16081: </div>
16082:
16083: <div class="sect1" lang="en">
16084: <div class="titlepage">
16085: <div>
16086: <div>
16087: <h2 class="title" style="clear: both"><a name=
1.73 ! rillig 16088: "regression.run"></a>21.2. Running the
1.72 rillig 16089: regression tests</h2>
16090: </div>
16091: </div>
16092: </div>
16093:
16094: <p>You first need to install the <a xmlns=
16095: "http://www.w3.org/TR/xhtml1/transitional" href=
16096: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_regress/README.html"
16097: target="_top"><code xmlns="" class=
16098: "filename">pkgtools/pkg_regress</code></a> package, which
16099: provides the <span><strong class=
16100: "command">pkg_regress</strong></span> command. Then you
16101: can simply run that command, which will run all tests in
16102: the <code xmlns=
16103: "http://www.w3.org/TR/xhtml1/transitional" class=
16104: "filename">regress</code> category.</p>
16105: </div>
16106:
16107: <div class="sect1" lang="en">
16108: <div class="titlepage">
16109: <div>
16110: <div>
16111: <h2 class="title" style="clear: both"><a name=
1.73 ! rillig 16112: "regression.new"></a>21.3. Adding a new
1.72 rillig 16113: regression test</h2>
16114: </div>
16115: </div>
16116: </div>
16117:
16118: <p>Every directory in the <code xmlns=
16119: "http://www.w3.org/TR/xhtml1/transitional" class=
16120: "filename">regress</code> category that contains a file
16121: called <code xmlns=
16122: "http://www.w3.org/TR/xhtml1/transitional" class=
16123: "filename">spec</code> is considered a regression test.
16124: This file is a shell program that is included by the
16125: <span><strong class="command">pkg_regress</strong></span>
16126: command. The following functions can be overridden to
16127: suit your needs.</p>
16128:
16129: <div class="sect2" lang="en">
16130: <div class="titlepage">
16131: <div>
16132: <div>
16133: <h3 class="title"><a name=
1.73 ! rillig 16134: "regression.fun.override"></a>21.3.1. Overridable
1.72 rillig 16135: functions</h3>
16136: </div>
16137: </div>
16138: </div>
16139:
16140: <p>These functions do not take any parameters. They are
16141: all called in “<span class="quote">set
16142: -e</span>” mode, so you should be careful to
16143: check the exitcodes of any commands you run in the
16144: test.</p>
16145:
16146: <div class="variablelist">
16147: <dl>
16148: <dt><span class="term"><code class=
16149: "varname">do_setup()</code></span></dt>
16150:
16151: <dd>
16152: <p>This function prepares the environment for the
16153: test. By default it does nothing.</p>
16154: </dd>
16155:
16156: <dt><span class="term"><code class=
16157: "varname">do_test()</code></span></dt>
16158:
16159: <dd>
16160: <p>This function runs the actual test. By
16161: default, it calls <code class=
16162: "varname">TEST_MAKE</code> with the arguments
16163: <code class="varname">MAKEARGS_TEST</code> and
16164: writes its output including error messages into
16165: the file <code class=
16166: "varname">TEST_OUTFILE</code>.</p>
16167: </dd>
16168:
16169: <dt><span class="term"><code class=
16170: "varname">check_result()</code></span></dt>
16171:
16172: <dd>
16173: <p>This function is run after the test and is
16174: typically used to compare the actual output from
16175: the one that is expected. It can make use of the
16176: various helper functions from the next
16177: section.</p>
16178: </dd>
16179:
16180: <dt><span class="term"><code class=
16181: "varname">do_cleanup()</code></span></dt>
16182:
16183: <dd>
16184: <p>This function cleans everything up after the
16185: test has been run. By default it does
16186: nothing.</p>
16187: </dd>
16188: </dl>
16189: </div>
16190: </div>
16191:
16192: <div class="sect2" lang="en">
16193: <div class="titlepage">
16194: <div>
16195: <div>
16196: <h3 class="title"><a name=
1.73 ! rillig 16197: "regression.fun.helper"></a>21.3.2. Helper
1.72 rillig 16198: functions</h3>
16199: </div>
16200: </div>
16201: </div>
16202:
16203: <div class="variablelist">
16204: <dl>
16205: <dt><span class="term"><code class=
16206: "varname">exit_status(expected)</code></span></dt>
16207:
16208: <dd>
16209: <p>This function compares the exitcode of the
16210: <span><strong class=
16211: "command">do_test()</strong></span> function with
16212: its first parameter. If they differ, the test
16213: will fail.</p>
16214: </dd>
16215:
16216: <dt><span class="term"><code class=
16217: "varname">output_require(regex...)</code></span></dt>
16218:
16219: <dd>
16220: <p>This function checks for each of its
16221: parameters if the output from
16222: <span><strong class="command">do_test()</strong></span>
16223: matches the extended regular expression. If it
16224: does not, the test will fail.</p>
16225: </dd>
16226:
16227: <dt><span class="term"><code class=
16228: "varname">output_prohibit(regex...)</code></span></dt>
16229:
16230: <dd>
16231: <p>This function checks for each of its
16232: parameters if the output from
16233: <span><strong class="command">do_test()</strong></span>
16234: does <span class="emphasis"><em>not</em></span>
16235: match the extended regular expression. If any of
16236: the regular expressions matches, the test will
16237: fail.</p>
16238: </dd>
16239: </dl>
16240: </div>
16241: </div>
16242: </div>
16243: </div>
16244:
16245: <div class="chapter" lang="en">
16246: <div class="titlepage">
16247: <div>
16248: <div>
16249: <h2 class="title"><a name=
1.73 ! rillig 16250: "porting"></a>Chapter 22. Porting
1.69 rillig 16251: pkgsrc</h2>
16252: </div>
16253: </div>
16254: </div>
16255:
16256: <div class="toc">
16257: <p><b>Table of Contents</b></p>
16258:
16259: <dl>
1.73 ! rillig 16260: <dt><span class="sect1"><a href="#porting.opsys">22.1.
1.69 rillig 16261: Porting pkgsrc to a new operating
16262: system</a></span></dt>
16263:
16264: <dt><span class="sect1"><a href=
1.73 ! rillig 16265: "#porting.compiler">22.2. Adding support for a new
1.69 rillig 16266: compiler</a></span></dt>
16267: </dl>
16268: </div>
16269:
16270: <p>The pkgsrc system has already been ported to many
16271: operating systems, hardware architectures and compilers.
16272: This chapter explains the necessary steps to make pkgsrc
16273: even more portable.</p>
16274:
16275: <div class="sect1" lang="en">
16276: <div class="titlepage">
16277: <div>
16278: <div>
16279: <h2 class="title" style="clear: both"><a name=
1.73 ! rillig 16280: "porting.opsys"></a>22.1. Porting pkgsrc to a
1.69 rillig 16281: new operating system</h2>
16282: </div>
16283: </div>
16284: </div>
16285:
16286: <p>To port pkgsrc to a new operating system (called
16287: <code class="literal">MyOS</code> in this example), you
16288: need to touch the following files:</p>
16289:
16290: <div class="variablelist">
16291: <dl>
16292: <dt><span class="term"><code xmlns=
16293: "http://www.w3.org/TR/xhtml1/transitional" class=
16294: "filename">bootstrap/mods/mk/<em class=
16295: "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
16296:
16297: <dd>
16298: <p>This file contains some basic definitions, for
16299: example the name of the C compiler.</p>
16300: </dd>
16301:
16302: <dt><span class="term"><code xmlns=
16303: "http://www.w3.org/TR/xhtml1/transitional" class=
16304: "filename">mk/bsd.prefs.mk</code></span></dt>
16305:
16306: <dd>
16307: <p>Insert code that defines the variables
16308: <code class="varname">OPSYS</code>, <code class=
16309: "varname">OS_VERSION</code>, <code class=
16310: "varname">LOWER_OS_VERSION</code>, <code class=
16311: "varname">LOWER_VENDOR</code>, <code class=
16312: "varname">MACHINE_ARCH</code>, <code class=
16313: "varname">OBJECT_FMT</code>, <code class=
16314: "varname">APPEND_ELF</code>, and the other
16315: variables that appear in this file.</p>
16316: </dd>
16317:
16318: <dt><span class="term"><code xmlns=
16319: "http://www.w3.org/TR/xhtml1/transitional" class=
16320: "filename">mk/platform/MyOS.mk</code></span></dt>
16321:
16322: <dd>
16323: <p>This file contains the platform-specific
16324: definitions that are used by pkgsrc. Start by
16325: copying one of the other files and edit it to your
16326: needs.</p>
16327: </dd>
16328:
16329: <dt><span class="term"><code xmlns=
16330: "http://www.w3.org/TR/xhtml1/transitional" class=
16331: "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
16332:
16333: <dd>
16334: <p>This file contains a list of directories,
16335: together with their permission bits and ownership.
16336: These directories will be created automatically
16337: with every package that does not explicitly set
16338: <code class="varname">NO_MTREE</code>. There have
16339: been some discussions about whether this file is
16340: needed at all, but with no result.</p>
16341: </dd>
16342:
16343: <dt><span class="term"><code xmlns=
16344: "http://www.w3.org/TR/xhtml1/transitional" class=
16345: "filename">mk/platform/MyOS.x11.dist</code></span></dt>
16346:
16347: <dd>
16348: <p>Just copy one of the pre-existing x11.dist files
16349: to your <code xmlns=
16350: "http://www.w3.org/TR/xhtml1/transitional" class=
16351: "filename"><em class=
16352: "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
16353: </dd>
16354:
16355: <dt><span class="term"><code xmlns=
16356: "http://www.w3.org/TR/xhtml1/transitional" class=
16357: "filename">mk/tools/bootstrap.mk</code></span></dt>
16358:
16359: <dd>
16360: <p>On some operating systems, the tools that are
16361: provided with the base system are not good enough
16362: for pkgsrc. For example, there are many versions of
16363: <a href=
16364: "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
16365: <span class="citerefentry"><span class=
16366: "refentrytitle">sed</span>(1)</span></a> that have
16367: a narrow limit on the line length they can process.
16368: Therefore pkgsrc brings its own tools, which can be
16369: enabled here.</p>
16370: </dd>
16371:
16372: <dt><span class="term"><code xmlns=
16373: "http://www.w3.org/TR/xhtml1/transitional" class=
16374: "filename">mk/tools/<em class=
16375: "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
16376:
16377: <dd>
16378: <p>This file defines the paths to all the tools
16379: that are needed by one or the other package in
16380: pkgsrc, as well as by pkgsrc itself. Find out where
16381: these tools are on your platform and add them.</p>
16382: </dd>
16383: </dl>
16384: </div>
16385:
16386: <p>Now, you should be able to build some basic packages,
16387: like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
16388: href=
16389: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
16390: target="_top"><code xmlns="" class=
16391: "filename">lang/perl5</code></a>, <a xmlns=
16392: "http://www.w3.org/TR/xhtml1/transitional" href=
16393: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
16394: target="_top"><code xmlns="" class=
16395: "filename">shells/bash</code></a>.</p>
16396: </div>
16397:
16398: <div class="sect1" lang="en">
16399: <div class="titlepage">
16400: <div>
16401: <div>
16402: <h2 class="title" style="clear: both"><a name=
1.73 ! rillig 16403: "porting.compiler"></a>22.2. Adding support
1.69 rillig 16404: for a new compiler</h2>
16405: </div>
16406: </div>
16407: </div>
16408:
16409: <p>TODO</p>
16410: </div>
16411: </div>
1.1 grant 16412: </div>
16413:
1.67 hubertf 16414: <div class="appendix" lang="en">
1.1 grant 16415: <div class="titlepage">
16416: <div>
16417: <div>
1.67 hubertf 16418: <h2 class="title"><a name=
1.46 gdt 16419: "examples"></a>Appendix A. A simple example
1.1 grant 16420: package: bison</h2>
16421: </div>
16422: </div>
16423: </div>
16424:
16425: <div class="toc">
16426: <p><b>Table of Contents</b></p>
16427:
16428: <dl>
1.46 gdt 16429: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 16430: files</a></span></dt>
16431:
16432: <dd>
16433: <dl>
1.30 wiz 16434: <dt><span class="sect2"><a href=
1.46 gdt 16435: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 16436:
1.30 wiz 16437: <dt><span class="sect2"><a href=
1.46 gdt 16438: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 16439:
1.30 wiz 16440: <dt><span class="sect2"><a href=
1.46 gdt 16441: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 16442:
1.30 wiz 16443: <dt><span class="sect2"><a href=
1.46 gdt 16444: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 16445: package with <span><strong class=
1.14 xtraeme 16446: "command">pkglint</strong></span></a></span></dt>
1.1 grant 16447: </dl>
16448: </dd>
16449:
1.46 gdt 16450: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 16451: Steps for building, installing, packaging</a></span></dt>
1.1 grant 16452: </dl>
16453: </div>
16454:
16455: <p>We checked to find a piece of software that wasn't in the
16456: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 16457: would want to have <span><strong class=
16458: "command">bison</strong></span> when Berkeley
16459: <span><strong class="command">yacc</strong></span> is already
16460: present in the tree is beyond us, but it's useful for the
16461: purposes of this exercise.</p>
1.1 grant 16462:
1.67 hubertf 16463: <div class="sect1" lang="en">
1.1 grant 16464: <div class="titlepage">
16465: <div>
16466: <div>
16467: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16468: "example-files"></a>A.1. files</h2>
1.1 grant 16469: </div>
16470: </div>
16471: </div>
16472:
1.67 hubertf 16473: <div class="sect2" lang="en">
1.1 grant 16474: <div class="titlepage">
16475: <div>
16476: <div>
1.67 hubertf 16477: <h3 class="title"><a name=
1.46 gdt 16478: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 16479: </div>
16480: </div>
16481: </div>
16482: <pre class="programlisting">
1.51 rillig 16483: # $NetBSD$
16484: #
1.1 grant 16485:
1.51 rillig 16486: DISTNAME= bison-1.25
16487: CATEGORIES= devel
16488: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 16489:
1.51 rillig 16490: MAINTAINER= thorpej@NetBSD.org
16491: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
16492: COMMENT= GNU yacc clone
1.1 grant 16493:
1.51 rillig 16494: GNU_CONFIGURE= yes
16495: INFO_FILES= bison.info
1.1 grant 16496:
1.51 rillig 16497: .include "../../mk/bsd.pkg.mk"
1.1 grant 16498: </pre>
16499: </div>
16500:
1.67 hubertf 16501: <div class="sect2" lang="en">
1.1 grant 16502: <div class="titlepage">
16503: <div>
16504: <div>
1.67 hubertf 16505: <h3 class="title"><a name=
1.46 gdt 16506: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 16507: </div>
16508: </div>
16509: </div>
16510: <pre class="programlisting">
1.51 rillig 16511: GNU version of yacc. Can make re-entrant parsers, and numerous other
16512: improvements. Why you would want this when Berkeley <a href=
1.1 grant 16513: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51 rillig 16514: of the NetBSD source tree is beyond me.
1.1 grant 16515: </pre>
16516: </div>
16517:
1.67 hubertf 16518: <div class="sect2" lang="en">
1.1 grant 16519: <div class="titlepage">
16520: <div>
16521: <div>
1.67 hubertf 16522: <h3 class="title"><a name=
1.46 gdt 16523: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 16524: </div>
16525: </div>
16526: </div>
16527: <pre class="programlisting">
1.51 rillig 16528: @comment $NetBSD$
16529: bin/bison
16530: man/man1/bison.1.gz
16531: share/bison.simple
16532: share/bison.hairy
1.1 grant 16533: </pre>
16534: </div>
16535:
1.67 hubertf 16536: <div class="sect2" lang="en">
1.1 grant 16537: <div class="titlepage">
16538: <div>
16539: <div>
1.30 wiz 16540: <h3 class="title"><a name=
1.46 gdt 16541: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 16542: a package with <span><strong class=
1.14 xtraeme 16543: "command">pkglint</strong></span></h3>
1.1 grant 16544: </div>
16545: </div>
16546: </div>
16547:
16548: <p>The NetBSD package system comes with <a xmlns=
16549: "http://www.w3.org/TR/xhtml1/transitional" href=
16550: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 16551: target="_top"><code xmlns="" class=
16552: "filename">pkgtools/pkglint</code></a> which helps to
16553: check the contents of these files. After installation it
16554: is quite easy to use, just change to the directory of the
1.20 ben 16555: package you wish to examine and execute
16556: <span><strong class=
16557: "command">pkglint</strong></span>:</p>
1.1 grant 16558: <pre class="screen">
1.14 xtraeme 16559: <code class="prompt">$</code> <strong class=
16560: "userinput"><code>pkglint</code></strong>
1.1 grant 16561: looks fine.
16562: </pre>
16563:
16564: <p>Depending on the supplied command line arguments (see
1.60 rillig 16565: pkglint(1)), more checks will be performed. Use e.g.
16566: <span><strong class="command">pkglint -Call
16567: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 16568: </div>
16569: </div>
16570:
1.67 hubertf 16571: <div class="sect1" lang="en">
1.1 grant 16572: <div class="titlepage">
16573: <div>
16574: <div>
16575: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16576: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 16577: installing, packaging</h2>
1.1 grant 16578: </div>
16579: </div>
16580: </div>
16581:
16582: <p>Create the directory where the package lives, plus any
16583: auxiliary directories:</p>
16584: <pre class="screen">
1.14 xtraeme 16585: <code class="prompt">#</code> <strong class=
16586: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
16587: <code class="prompt">#</code> <strong class=
16588: "userinput"><code>mkdir bison</code></strong>
16589: <code class="prompt">#</code> <strong class=
16590: "userinput"><code>cd bison</code></strong>
16591: <code class="prompt">#</code> <strong class=
16592: "userinput"><code>mkdir patches</code></strong>
1.1 grant 16593: </pre>
16594:
1.45 wiz 16595: <p>Create <code xmlns=
16596: "http://www.w3.org/TR/xhtml1/transitional" class=
16597: "filename">Makefile</code>, <code xmlns=
16598: "http://www.w3.org/TR/xhtml1/transitional" class=
16599: "filename">DESCR</code> and <code xmlns=
16600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16601: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 16602: "Chapter 8. Package components - files, directories and contents">
1.67 hubertf 16603: Chapter 8, <i>Package components - files, directories
16604: and contents</i></a>) then continue with fetching the
1.1 grant 16605: distfile:</p>
16606: <pre class="screen">
1.14 xtraeme 16607: <code class="prompt">#</code> <strong class=
16608: "userinput"><code>make fetch</code></strong>
1.1 grant 16609: >> bison-1.25.tar.gz doesn't seem to exist on this system.
16610: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
16611: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16612: ftp: Error retrieving file: 500 Internal error
16613:
16614: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
16615: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16616: ftp: Error retrieving file: 500 Internal error
16617:
16618: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
16619: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
16620: Successfully retrieved file.
16621: </pre>
16622:
1.45 wiz 16623: <p>Generate the checksum of the distfile into <code xmlns=
16624: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 16625: "filename">distinfo</code>:</p>
1.1 grant 16626: <pre class="screen">
1.14 xtraeme 16627: <code class="prompt">#</code> <strong class=
16628: "userinput"><code>make makesum</code></strong>
1.1 grant 16629: </pre>
16630:
16631: <p>Now compile:</p>
16632: <pre class="screen">
1.14 xtraeme 16633: <code class="prompt">#</code> <strong class=
16634: "userinput"><code>make</code></strong>
1.1 grant 16635: >> Checksum OK for bison-1.25.tar.gz.
16636: ===> Extracting for bison-1.25
16637: ===> Patching for bison-1.25
16638: ===> Ignoring empty patch directory
16639: ===> Configuring for bison-1.25
16640: creating cache ./config.cache
16641: checking for gcc... cc
16642: checking whether we are using GNU C... yes
16643: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
16644: checking how to run the C preprocessor... cc -E
16645: checking for minix/config.h... no
16646: checking for POSIXized ISC... no
16647: checking whether cross-compiling... no
16648: checking for ANSI C header files... yes
16649: checking for string.h... yes
16650: checking for stdlib.h... yes
16651: checking for memory.h... yes
16652: checking for working const... yes
16653: checking for working alloca.h... no
16654: checking for alloca... yes
16655: checking for strerror... yes
16656: updating cache ./config.cache
16657: creating ./config.status
16658: creating Makefile
16659: ===> Building for bison-1.25
16660: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
16661: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
16662: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
16663: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
16664: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
1.68 rillig 16665: cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c
1.1 grant 16666: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
16667: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
16668: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
16669: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
16670: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
16671: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
16672: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
16673: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
16674: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c
16675: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c
16676: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c
16677: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c
16678: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c
16679: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c
16680: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c
16681: cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o
16682: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
16683: rm -f bison.s1
16684: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
16685: </pre>
16686:
16687: <p>Everything seems OK, so install the files:</p>
16688: <pre class="screen">
1.14 xtraeme 16689: <code class="prompt">#</code> <strong class=
16690: "userinput"><code>make install</code></strong>
1.1 grant 16691: >> Checksum OK for bison-1.25.tar.gz.
16692: ===> Installing for bison-1.25
16693: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
16694: rm -f /usr/pkg/bin/bison
16695: cd /usr/pkg/share; rm -f bison.simple bison.hairy
16696: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
16697: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
16698: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
16699: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
16700: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
16701: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
16702: ===> Registering installation for bison-1.25
16703: </pre>
16704:
16705: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 16706: remove it with <span><strong class="command">pkg_delete
16707: bison</strong></span>. Should you decide that you want a
16708: binary package, do this now:</p>
1.1 grant 16709: <pre class="screen">
1.14 xtraeme 16710: <code class="prompt">#</code> <strong class=
16711: "userinput"><code>make package</code></strong>
1.1 grant 16712: >> Checksum OK for bison-1.25.tar.gz.
16713: ===> Building package for bison-1.25
16714: Creating package bison-1.25.tgz
16715: Registering depends:.
16716: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
16717: </pre>
16718:
16719: <p>Now that you don't need the source and object files any
16720: more, clean up:</p>
16721: <pre class="screen">
1.14 xtraeme 16722: <code class="prompt">#</code> <strong class=
16723: "userinput"><code>make clean</code></strong>
1.1 grant 16724: ===> Cleaning for bison-1.25
16725: </pre>
16726: </div>
16727: </div>
16728:
1.67 hubertf 16729: <div class="appendix" lang="en">
1.1 grant 16730: <div class="titlepage">
16731: <div>
16732: <div>
1.67 hubertf 16733: <h2 class="title"><a name=
1.46 gdt 16734: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 16735: </div>
16736: </div>
16737: </div>
16738:
16739: <div class="toc">
16740: <p><b>Table of Contents</b></p>
16741:
16742: <dl>
1.46 gdt 16743: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 16744: Building figlet</a></span></dt>
16745:
1.46 gdt 16746: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 16747: Packaging figlet</a></span></dt>
16748: </dl>
16749: </div>
16750:
1.67 hubertf 16751: <div class="sect1" lang="en">
1.1 grant 16752: <div class="titlepage">
16753: <div>
16754: <div>
16755: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16756: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 16757: </div>
16758: </div>
16759: </div>
16760: <pre class="screen">
1.14 xtraeme 16761: <code class="prompt">#</code> <strong class=
16762: "userinput"><code>make</code></strong>
1.1 grant 16763: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16764: => figlet221.tar.gz doesn't seem to exist on this system.
16765: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
16766: => [172219 bytes]
16767: Connected to ftp.plig.net.
16768: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
16769: 331 Guest login ok, send your complete e-mail address as password.
16770: 230-You are user #5 of 500 simultaneous users allowed.
16771: 230-
1.68 rillig 16772: 230- ___ _ _ _
16773: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
1.1 grant 16774: 230- | _| _| . |_| . | | | . |_| . | _| . |
16775: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
16776: 230- |_| |_| |___| |___|
16777: 230-
16778: 230-** Welcome to ftp.plig.org **
16779: 230-
16780: 230-Please note that all transfers from this FTP site are logged. If you
16781: 230-do not like this, please disconnect now.
16782: 230-
16783: 230-This arhive is available via
16784: 230-
16785: 230-HTTP: http://ftp.plig.org/
16786: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
16787: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
16788: 230-
16789: 230-Please email comments, bug reports and requests for packages to be
1.68 rillig 16790: 230-mirrored to ftp-admin@plig.org.
1.1 grant 16791: 230-
16792: 230-
16793: 230 Logged in anonymously.
16794: Remote system type is UNIX.
16795: Using binary mode to transfer files.
16796: 200 Type okay.
16797: 250 "/pub" is new cwd.
16798: 250-"/pub/figlet" is new cwd.
16799: 250-
16800: 250-Welcome to the figlet archive at ftp.figlet.org
1.68 rillig 16801: 250-
1.1 grant 16802: 250- ftp://ftp.figlet.org/pub/figlet/
16803: 250-
16804: 250-The official FIGlet web page is:
16805: 250- http://www.figlet.org/
16806: 250-
16807: 250-If you have questions, please mailto:info@figlet.org. If you want to
16808: 250-contribute a font or something else, you can email us.
1.68 rillig 16809: 250
1.1 grant 16810: 250 "/pub/figlet/program" is new cwd.
16811: 250 "/pub/figlet/program/unix" is new cwd.
16812: local: figlet221.tar.gz remote: figlet221.tar.gz
16813: 502 Unimplemented command.
16814: 227 Entering Passive Mode (195,40,6,41,246,104)
16815: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
16816: 38% |************** | 65800 64.16 KB/s 00:01 ETA
16817: 226 Transfer completed.
16818: 172219 bytes received in 00:02 (75.99 KB/s)
16819: 221 Goodbye.
16820: => Checksum OK for figlet221.tar.gz.
16821: ===> Extracting for figlet-2.2.1nb2
16822: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
16823: ===> Patching for figlet-2.2.1nb2
16824: ===> Applying pkgsrc patches for figlet-2.2.1nb2
16825: ===> Overriding tools for figlet-2.2.1nb2
16826: ===> Creating toolchain wrappers for figlet-2.2.1nb2
16827: ===> Configuring for figlet-2.2.1nb2
16828: ===> Building for figlet-2.2.1nb2
16829: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
16830: chmod a+x figlet
16831: gcc -O2 -o chkfont chkfont.c
16832: => Unwrapping files-to-be-installed.
1.14 xtraeme 16833: <code class="prompt">#</code>
16834: <code class="prompt">#</code> <strong class=
16835: "userinput"><code>make install</code></strong>
1.1 grant 16836: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16837: ===> Installing for figlet-2.2.1nb2
16838: install -d -o root -g wheel -m 755 /usr/pkg/bin
16839: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
16840: mkdir -p /usr/pkg/share/figlet
16841: cp figlet /usr/pkg/bin
16842: cp chkfont /usr/pkg/bin
16843: chmod 555 figlist showfigfonts
16844: cp figlist /usr/pkg/bin
16845: cp showfigfonts /usr/pkg/bin
16846: cp fonts/*.flf /usr/pkg/share/figlet
16847: cp fonts/*.flc /usr/pkg/share/figlet
16848: cp figlet.6 /usr/pkg/man/man6
16849: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 16850: <code class="prompt">#</code>
1.1 grant 16851: </pre>
16852: </div>
16853:
1.67 hubertf 16854: <div class="sect1" lang="en">
1.1 grant 16855: <div class="titlepage">
16856: <div>
16857: <div>
16858: <h2 class="title" style="clear: both"><a name=
1.46 gdt 16859: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 16860: </div>
16861: </div>
16862: </div>
16863: <pre class="screen">
1.14 xtraeme 16864: <code class="prompt">#</code> <strong class=
16865: "userinput"><code>make package</code></strong>
1.1 grant 16866: ===> Checking for vulnerabilities in figlet-2.2.1nb2
16867: ===> Packaging figlet-2.2.1nb2
16868: ===> Building binary package for figlet-2.2.1nb2
16869: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
16870: Using SrcDir value of /usr/pkg
1.68 rillig 16871: Registering depends:.
1.14 xtraeme 16872: <code class="prompt">#</code>
1.1 grant 16873: </pre>
16874: </div>
16875: </div>
16876:
1.67 hubertf 16877: <div class="appendix" lang="en">
1.1 grant 16878: <div class="titlepage">
16879: <div>
16880: <div>
1.67 hubertf 16881: <h2 class="title"><a name=
1.46 gdt 16882: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 16883: FTP server's package archive</h2>
16884: </div>
16885: </div>
16886: </div>
16887:
16888: <p>Layout for precompiled binary packages on
16889: ftp.NetBSD.org:</p>
16890: <pre class="programlisting">
1.51 rillig 16891: /pub/NetBSD/packages/
16892: distfiles/
1.1 grant 16893:
1.51 rillig 16894: # Unpacked pkgsrc trees
16895: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
16896: pkgsrc-2003Q4 -> N/A
16897: pkgsrc-2004Q1/pkgsrc
16898:
16899: # pkgsrc archives
16900: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
16901: pkgsrc-2003Q4.tar.gz -> N/A
16902: pkgsrc-2004Q1.tar.gz -> N/A
16903:
16904: # Per pkgsrc-release/OS-release/arch package archives
16905: pkgsrc-2003Q4/
16906: NetBSD-1.6.2/
16907: i386/
16908: All/
16909: archivers/
16910: foo -> ../All/foo
16911: ...
16912: pkgsrc-2004Q1/
16913: NetBSD-1.6.2/
16914: i386/
16915: All/
16916: ...
16917: NetBSD-2.0/
16918: i386/
16919: All/
16920: ...
16921: SunOS-5.9/
16922: sparc/
16923: All/
16924: ...
16925: x86/
16926: All/
16927: ...
16928:
16929: # Per os-release package archive convenience links
16930: NetBSD-1.6.2 -> 1.6.2
16931: 1.6.2/
16932: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
16933: m68k/
16934: All/
16935: archivers/
16936: foo -> ../All/foo
16937: ...
16938: amiga -> m68k
16939: atari -> m68k
16940: ...
16941:
16942: 2.0 -> NetBSD-2.0 # backward compat, historic
16943: NetBSD-2.0/
16944: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
16945: SunOS-5.9/
16946: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
16947: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 16948: </pre>
16949:
16950: <p>To create:</p>
16951:
16952: <div class="orderedlist">
16953: <ol type="1">
16954: <li>
16955: <p>Run bulk build, see <a href="#bulkbuild" title=
1.67 hubertf 16956: "6.3. Doing a bulk build of all packages">Section 6.3,
16957: “Doing a bulk build of all
1.1 grant 16958: packages”</a></p>
16959: </li>
16960:
16961: <li>
16962: <p>Upload /usr/pkgsrc/packages to</p>
16963: <pre class="programlisting">
16964: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 16965: pkgsrc-2004Q4/\ # pkgsrc-branch
16966: `uname -s`-`uname -r`/\ # OS & version
16967: `uname -p` # architecture
1.1 grant 16968: </pre>
16969: </li>
16970:
16971: <li>
1.14 xtraeme 16972: <p>If necessary, create a symlink <span><strong class=
16973: "command">ln -s `uname -m` `uname -p`</strong></span>
16974: (amiga -> m68k, ...)</p>
1.1 grant 16975: </li>
16976: </ol>
16977: </div>
16978: </div>
1.2 hubertf 16979:
1.67 hubertf 16980: <div class="appendix" lang="en">
1.2 hubertf 16981: <div class="titlepage">
16982: <div>
16983: <div>
1.67 hubertf 16984: <h2 class="title"><a name=
1.46 gdt 16985: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 16986: for the pkgsrc guide</h2>
16987: </div>
16988: </div>
16989: </div>
16990:
16991: <div class="toc">
16992: <p><b>Table of Contents</b></p>
16993:
16994: <dl>
1.46 gdt 16995: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 16996: Targets</a></span></dt>
16997:
1.46 gdt 16998: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 16999: Procedure</a></span></dt>
17000: </dl>
17001: </div>
17002:
17003: <p>This section contains information on editing the pkgsrc
17004: guide itself.</p>
17005:
1.67 hubertf 17006: <div class="sect1" lang="en">
1.2 hubertf 17007: <div class="titlepage">
17008: <div>
17009: <div>
17010: <h2 class="title" style="clear: both"><a name=
1.67 hubertf 17011: "targets"></a>D.1. Targets</h2>
1.2 hubertf 17012: </div>
17013: </div>
17014: </div>
17015:
1.45 wiz 17016: <p>The pkgsrc guide's source code is stored in <code xmlns=
17017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17018: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 17019: are created from it:</p>
17020:
17021: <div class="itemizedlist">
17022: <ul type="disc">
17023: <li>
1.45 wiz 17024: <p><code xmlns=
17025: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 17026: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 17027: </li>
17028:
17029: <li>
1.45 wiz 17030: <p><code xmlns=
17031: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17032: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 17033: </li>
17034:
17035: <li>
1.45 wiz 17036: <p><code xmlns=
17037: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17038: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 17039: the documentation on the NetBSD website will be built
17040: from pkgsrc and kept up to date on the web server
17041: itself. This means you <span class=
17042: "emphasis"><em>must</em></span> make sure that your
17043: changes haven't broken the build!</p>
17044: </li>
1.6 hubertf 17045:
17046: <li>
1.45 wiz 17047: <p><code xmlns=
17048: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17049: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 17050: PDF version of the pkgsrc guide.</p>
17051: </li>
17052:
17053: <li>
1.45 wiz 17054: <p><code xmlns=
17055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17056: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 17057: PostScript version of the pkgsrc guide.</p>
17058: </li>
1.2 hubertf 17059: </ul>
17060: </div>
17061: </div>
17062:
1.67 hubertf 17063: <div class="sect1" lang="en">
1.2 hubertf 17064: <div class="titlepage">
17065: <div>
17066: <div>
17067: <h2 class="title" style="clear: both"><a name=
1.46 gdt 17068: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 17069: </div>
17070: </div>
17071: </div>
17072:
17073: <p>The procedure to edit the pkgsrc guide is:</p>
17074:
17075: <div class="itemizedlist">
17076: <ul type="disc">
17077: <li>
1.6 hubertf 17078: <p>Make sure you have the packages needed to
17079: re-generate the pkgsrc guide (and other XML-based
17080: NetBSD documentation) installed. These are
1.11 ben 17081: “<span class="quote">netbsd-doc</span>”
1.47 reed 17082: for creating the ASCII and HTML versions, and
1.6 hubertf 17083: “<span class=
1.47 reed 17084: "quote">netbsd-doc-print</span>” for the
17085: PostScript and PDF versions. You will need both
1.6 hubertf 17086: packages installed, to make sure documentation is
17087: consistent across all formats. The packages can be
1.45 wiz 17088: found in <code xmlns=
17089: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17090: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 17091: <code xmlns=
17092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17093: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 17094: </li>
17095:
17096: <li>
1.45 wiz 17097: <p>Edit the XML file(s) in <code xmlns=
17098: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17099: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 17100: </li>
17101:
17102: <li>
1.14 xtraeme 17103: <p>Run <span><strong class="command">make extract
17104: && make do-lint</strong></span> in
1.45 wiz 17105: <code xmlns=
17106: "http://www.w3.org/TR/xhtml1/transitional" class=
17107: "filename">pkgsrc/doc/guide</code> to check the XML
17108: syntax, and fix it if needed.</p>
1.4 hubertf 17109: </li>
17110:
17111: <li>
1.14 xtraeme 17112: <p>Run <span><strong class=
1.45 wiz 17113: "command">make</strong></span> in <code xmlns=
17114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17115: "filename">pkgsrc/doc/guide</code> to build the HTML
17116: and ASCII version.</p>
1.2 hubertf 17117: </li>
17118:
17119: <li>
1.14 xtraeme 17120: <p>If all is well, run <span><strong class=
17121: "command">make install-doc</strong></span> to put the
1.45 wiz 17122: generated files into <code xmlns=
17123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 17124: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 17125: </li>
17126:
17127: <li>
1.14 xtraeme 17128: <p><span><strong class="command">cvs commit
17129: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 17130: </li>
17131:
17132: <li>
1.14 xtraeme 17133: <p><span><strong class="command">cvs commit -m
17134: re-generate
17135: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 17136: </li>
1.4 hubertf 17137:
17138: <li>
17139: <p>Until the webserver on www.NetBSD.org is really
17140: updated automatically to pick up changes to the
1.14 xtraeme 17141: pkgsrc guide automatically, also run
1.18 xtraeme 17142: <span><strong class="command">make install-htdocs
1.14 xtraeme 17143: HTDOCSDIR=../../../htdocs</strong></span> (or
17144: similar, adjust <code class=
17145: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 17146: </li>
17147:
17148: <li>
1.14 xtraeme 17149: <p><span><strong class="command">cvs commit
17150: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 17151: </li>
1.2 hubertf 17152: </ul>
17153: </div>
17154: </div>
17155: </div>
1.1 grant 17156: </div>
17157: </body>
17158: </html>
CVSweb <webmaster@jp.NetBSD.org>