Annotation of pkgsrc/doc/pkgsrc.html, revision 1.46
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.20 ben 4: "HTML Tidy for NetBSD (vers 1st August 2004), 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">
18: <div class="book" lang="en" xml:lang="en">
19: <div class="titlepage">
20: <div>
21: <div>
1.30 wiz 22: <h1 class="title"><a name="the-pkgsrc-guide" id=
23: "the-pkgsrc-guide"></a>The 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>
64: <p class="copyright">Copyright © 1994-2004 The
65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.39 dillo 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.9
70: 2005/06/08 13:59:30 dillo 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>
91: <dt><span class="chapter"><a href="#introduction">1.
92: Introduction</a></span></dt>
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
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
142: "#platform-specific-notes">3.2. Platform specific
143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
1.38 dillo 224: <dt><span class="chapter"><a href="#configuring">5.
225: Configuring pkgsrc</a></span></dt>
226:
227: <dd>
228: <dl>
229: <dt><span class="sect1"><a href=
1.45 wiz 230: "#general-configuration">5.1. General
231: configuration</a></span></dt>
232:
233: <dt><span class="sect1"><a href=
234: "#variables-affecting-build">5.2. Variables
235: affecting the build process</a></span></dt>
236:
237: <dt><span class="sect1"><a href=
238: "#developer-advanced-settings">5.3.
239: Developer/advanced settings</a></span></dt>
240:
241: <dt><span class="sect1"><a href=
242: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 243: Options</a></span></dt>
1.38 dillo 244: </dl>
245: </dd>
246:
247: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 248: binary packages</a></span></dt>
249:
250: <dd>
251: <dl>
1.30 wiz 252: <dt><span class="sect1"><a href=
1.38 dillo 253: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 254: single binary package</a></span></dt>
1.1 grant 255:
1.30 wiz 256: <dt><span class="sect1"><a href=
1.38 dillo 257: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 258: Settings for creation of binary
259: packages</a></span></dt>
260:
1.38 dillo 261: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 262: Doing a bulk build of all packages</a></span></dt>
263:
264: <dd>
265: <dl>
266: <dt><span class="sect2"><a href=
1.38 dillo 267: "#binary.configuration">6.3.1.
1.1 grant 268: Configuration</a></span></dt>
269:
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#other-environmental-considerations">6.3.2.
1.30 wiz 272: Other environmental
1.1 grant 273: considerations</a></span></dt>
274:
275: <dt><span class="sect2"><a href=
1.38 dillo 276: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 277:
278: <dt><span class="sect2"><a href=
1.38 dillo 279: "#what-it-does">6.3.4. What it
1.1 grant 280: does</a></span></dt>
281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 284: requirements</a></span></dt>
285:
286: <dt><span class="sect2"><a href=
1.38 dillo 287: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 288: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 289:
290: <dt><span class="sect2"><a href=
1.38 dillo 291: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 292: partial set of packages</a></span></dt>
1.13 hubertf 293:
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 296: bulk build</a></span></dt>
1.1 grant 297: </dl>
298: </dd>
299:
1.30 wiz 300: <dt><span class="sect1"><a href=
1.38 dillo 301: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 302: packages collection</a></span></dt>
1.1 grant 303:
304: <dd>
305: <dl>
306: <dt><span class="sect2"><a href=
1.38 dillo 307: "#cdpack-example">6.4.1. Example of
1.1 grant 308: cdpack</a></span></dt>
309: </dl>
310: </dd>
311: </dl>
312: </dd>
313:
1.38 dillo 314: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 315: Asked Questions</a></span></dt>
316:
317: <dd>
318: <dl>
1.30 wiz 319: <dt><span class="sect1"><a href=
1.38 dillo 320: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 321: lists for pkg-related discussion?</a></span></dt>
1.1 grant 322:
1.30 wiz 323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 325: documentation?</a></span></dt>
1.1 grant 326:
1.5 hubertf 327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 329: management (pkgtools)</a></span></dt>
1.1 grant 330:
1.30 wiz 331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 333: non-root</a></span></dt>
334:
335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 337: when fetching distfiles?</a></span></dt>
338:
339: <dt><span class="sect1"><a href=
1.38 dillo 340: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 341: XFree86 from pkgsrc?</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.38 dillo 344: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 345: X.org from pkgsrc?</a></span></dt>
1.1 grant 346:
1.30 wiz 347: <dt><span class="sect1"><a href=
1.38 dillo 348: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 349: from behind a firewall</a></span></dt>
1.1 grant 350:
1.38 dillo 351: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 352: How do I tell <span><strong class="command">make
353: fetch</strong></span> to do passive
1.1 grant 354: FTP?</a></span></dt>
355:
1.30 wiz 356: <dt><span class="sect1"><a href=
1.38 dillo 357: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 358: distfiles at once</a></span></dt>
1.1 grant 359:
1.30 wiz 360: <dt><span class="sect1"><a href=
1.38 dillo 361: "#tmac.andoc-missing">7.11. What does
1.30 wiz 362: “<span class="quote">Don't know how to make
363: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 364: mean?</a></span></dt>
1.13 hubertf 365:
1.30 wiz 366: <dt><span class="sect1"><a href=
1.38 dillo 367: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 368: “<span class="quote">Could not find
1.14 xtraeme 369: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 370:
1.30 wiz 371: <dt><span class="sect1"><a href=
1.38 dillo 372: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 373: pkgsrc</a></span></dt>
1.1 grant 374:
1.38 dillo 375: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 376: How do I change the location of configuration
377: files?</a></span></dt>
1.1 grant 378:
379: <dt><span class="sect1"><a href=
1.38 dillo 380: "#audit-packages">7.15. Automated security
1.1 grant 381: checks</a></span></dt>
382: </dl>
383: </dd>
384: </dl>
385: </dd>
386:
1.46 ! gdt 387: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 388: pkgsrc developer's guide</a></span></dt>
389:
390: <dd>
391: <dl>
1.38 dillo 392: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 393: Package components - files, directories and
394: contents</a></span></dt>
395:
396: <dd>
397: <dl>
398: <dt><span class="sect1"><a href=
1.45 wiz 399: "#components.Makefile">8.1. <code xmlns=
400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 401: "filename">Makefile</code></a></span></dt>
402:
403: <dt><span class="sect1"><a href=
1.45 wiz 404: "#components.distinfo">8.2. <code xmlns=
405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 406: "filename">distinfo</code></a></span></dt>
407:
408: <dt><span class="sect1"><a href=
1.38 dillo 409: "#components.patches">8.3.
1.27 rillig 410: patches/*</a></span></dt>
411:
1.30 wiz 412: <dt><span class="sect1"><a href=
1.38 dillo 413: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 414: files</a></span></dt>
1.27 rillig 415:
416: <dt><span class="sect1"><a href=
1.38 dillo 417: "#components.optional">8.5. Optional
1.27 rillig 418: files</a></span></dt>
419:
1.38 dillo 420: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 421: <code xmlns=
422: "http://www.w3.org/TR/xhtml1/transitional" class=
423: "filename">work*</code></a></span></dt>
1.27 rillig 424:
1.38 dillo 425: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 426: <code xmlns=
427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 428: "filename">files/*</code></a></span></dt>
429: </dl>
430: </dd>
431:
1.38 dillo 432: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 433: Programming in <code xmlns=
434: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 435: "filename">Makefile</code>s</a></span></dt>
436:
437: <dd>
438: <dl>
439: <dt><span class="sect1"><a href=
1.45 wiz 440: "#makefile.variables">9.1. <code xmlns=
441: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 442: "filename">Makefile</code>
443: variables</a></span></dt>
444:
1.27 rillig 445: <dd>
446: <dl>
447: <dt><span class="sect2"><a href=
1.38 dillo 448: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 449: conventions</a></span></dt>
450: </dl>
451: </dd>
452:
1.25 rillig 453: <dt><span class="sect1"><a href=
1.38 dillo 454: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 455:
456: <dd>
457: <dl>
458: <dt><span class="sect2"><a href=
1.38 dillo 459: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 460: list</a></span></dt>
461:
462: <dt><span class="sect2"><a href=
1.38 dillo 463: "#converting-internal-to-external">9.2.2.
1.30 wiz 464: Converting an internal list into an external
465: list</a></span></dt>
1.25 rillig 466:
467: <dt><span class="sect2"><a href=
1.38 dillo 468: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 469: variables to a shell command</a></span></dt>
1.27 rillig 470:
471: <dt><span class="sect2"><a href=
1.38 dillo 472: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 473: guideline</a></span></dt>
474:
475: <dt><span class="sect2"><a href=
1.38 dillo 476: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 477: for a bug in BSD Make</a></span></dt>
1.25 rillig 478: </dl>
479: </dd>
480: </dl>
481: </dd>
482:
1.38 dillo 483: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 484: issues</a></span></dt>
485:
486: <dd>
487: <dl>
1.38 dillo 488: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 489: ID</a></span></dt>
1.1 grant 490:
1.30 wiz 491: <dt><span class="sect1"><a href=
1.38 dillo 492: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 493: <code xmlns=
494: "http://www.w3.org/TR/xhtml1/transitional" class=
495: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 496:
1.38 dillo 497: <dt><span class="sect1"><a href=
498: "#print-PLIST">10.3. Tweaking output of
499: <span><strong class="command">make
1.14 xtraeme 500: print-PLIST</strong></span></a></span></dt>
1.1 grant 501:
1.38 dillo 502: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 503: Variable substitution in PLIST</a></span></dt>
504:
1.30 wiz 505: <dt><span class="sect1"><a href=
1.38 dillo 506: "#manpage-compression">10.5.
1.1 grant 507: Manpage-compression</a></span></dt>
508:
1.30 wiz 509: <dt><span class="sect1"><a href=
1.38 dillo 510: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 511: <code class=
1.14 xtraeme 512: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 513:
1.30 wiz 514: <dt><span class="sect1"><a href=
1.38 dillo 515: "#platform-specific-plist">10.7. Platform specific
1.30 wiz 516: and differing PLISTs</a></span></dt>
1.1 grant 517:
518: <dt><span class="sect1"><a href=
1.38 dillo 519: "#faq.common-dirs">10.8. Sharing directories
520: between packages</a></span></dt>
1.1 grant 521: </dl>
522: </dd>
523:
1.38 dillo 524: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 525: Buildlink methodology</a></span></dt>
526:
527: <dd>
528: <dl>
1.30 wiz 529: <dt><span class="sect1"><a href=
1.38 dillo 530: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 531: packages to use buildlink3</a></span></dt>
1.1 grant 532:
1.30 wiz 533: <dt><span class="sect1"><a href=
1.38 dillo 534: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 535: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
536: class="filename">buildlink3.mk</code>
1.14 xtraeme 537: files</a></span></dt>
1.1 grant 538:
539: <dd>
540: <dl>
541: <dt><span class="sect2"><a href=
1.38 dillo 542: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 543: buildlink3.mk file</a></span></dt>
1.1 grant 544:
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 547: <code class=
1.14 xtraeme 548: "varname">BUILDLINK_DEPENDS.<em class=
549: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 550: <code xmlns=
551: "http://www.w3.org/TR/xhtml1/transitional"
552: class="filename">buildlink3.mk</code>
1.1 grant 553: files</a></span></dt>
554: </dl>
555: </dd>
556:
1.30 wiz 557: <dt><span class="sect1"><a href=
1.45 wiz 558: "#writing-builtin.mk">11.3. Writing <code xmlns=
559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 560: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 561:
562: <dd>
563: <dl>
564: <dt><span class="sect2"><a href=
1.38 dillo 565: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 566: <code xmlns=
567: "http://www.w3.org/TR/xhtml1/transitional"
568: class="filename">builtin.mk</code>
1.1 grant 569: file</a></span></dt>
570:
571: <dt><span class="sect2"><a href=
1.38 dillo 572: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 573: preferences for native or pkgsrc
574: software</a></span></dt>
1.1 grant 575: </dl>
576: </dd>
577: </dl>
578: </dd>
579:
1.38 dillo 580: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 581: pkginstall framework</a></span></dt>
582:
583: <dd>
584: <dl>
585: <dt><span class="sect1"><a href=
1.38 dillo 586: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 587: directories outside the installation
588: prefix</a></span></dt>
589:
590: <dd>
591: <dl>
592: <dt><span class="sect2"><a href=
1.38 dillo 593: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 594: manipulation</a></span></dt>
595:
596: <dt><span class="sect2"><a href=
1.38 dillo 597: "#files-outside-prefix">12.1.2. File
1.35 jmmv 598: manipulation</a></span></dt>
599: </dl>
600: </dd>
601:
1.38 dillo 602: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 603: Configuration files</a></span></dt>
604:
605: <dd>
606: <dl>
607: <dt><span class="sect2"><a href=
1.38 dillo 608: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 609: <code class="varname">PKG_SYSCONFDIR</code> is
610: set</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.38 dillo 613: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 614: software were configuration files
615: are</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.38 dillo 618: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 619: installations</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.38 dillo 622: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 623: handling of configuration files</a></span></dt>
624: </dl>
625: </dd>
626:
627: <dt><span class="sect1"><a href=
1.38 dillo 628: "#rcd-scripts">12.3. System startup
1.35 jmmv 629: scripts</a></span></dt>
630:
631: <dd>
632: <dl>
633: <dt><span class="sect2"><a href=
1.38 dillo 634: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 635: handling of system startup
636: scripts</a></span></dt>
637: </dl>
638: </dd>
639:
640: <dt><span class="sect1"><a href=
1.38 dillo 641: "#users-and-groups">12.4. System users and
1.35 jmmv 642: groups</a></span></dt>
643:
1.38 dillo 644: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 645: System shells</a></span></dt>
646:
647: <dd>
648: <dl>
649: <dt><span class="sect2"><a href=
1.38 dillo 650: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 651: configuration files</a></span></dt>
652: </dl>
653: </dd>
654: </dl>
655: </dd>
656:
1.38 dillo 657: <dt><span class="chapter"><a href="#options">13.
1.1 grant 658: Options handling</a></span></dt>
659:
660: <dd>
661: <dl>
1.30 wiz 662: <dt><span class="sect1"><a href=
1.38 dillo 663: "#global-default-options">13.1. Global default
1.30 wiz 664: options</a></span></dt>
1.1 grant 665:
1.30 wiz 666: <dt><span class="sect1"><a href=
1.38 dillo 667: "#converting-to-options">13.2. Converting packages
1.45 wiz 668: to use <code xmlns=
669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 670: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 671: </dl>
672: </dd>
673:
1.38 dillo 674: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 675: build process</a></span></dt>
676:
677: <dd>
678: <dl>
679: <dt><span class="sect1"><a href=
1.38 dillo 680: "#build.prefix">14.1. Program
1.1 grant 681: location</a></span></dt>
682:
1.30 wiz 683: <dt><span class="sect1"><a href=
1.38 dillo 684: "#main-targets">14.2. Main targets</a></span></dt>
1.1 grant 685:
686: <dt><span class="sect1"><a href=
1.38 dillo 687: "#build.helpful-targets">14.3. Other helpful
1.1 grant 688: targets</a></span></dt>
689: </dl>
690: </dd>
691:
1.38 dillo 692: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 693: fixes for packages</a></span></dt>
694:
695: <dd>
696: <dl>
1.30 wiz 697: <dt><span class="sect1"><a href=
1.38 dillo 698: "#general-operation">15.1. General
1.30 wiz 699: operation</a></span></dt>
1.1 grant 700:
701: <dd>
702: <dl>
703: <dt><span class="sect2"><a href=
1.38 dillo 704: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 705: pull in variables from
706: /etc/mk.conf</a></span></dt>
1.1 grant 707:
708: <dt><span class="sect2"><a href=
1.38 dillo 709: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 710: to install documentation</a></span></dt>
711:
712: <dt><span class="sect2"><a href=
1.38 dillo 713: "#restricted-packages">15.1.3. Restricted
1.1 grant 714: packages</a></span></dt>
715:
716: <dt><span class="sect2"><a href=
1.38 dillo 717: "#dependencies">15.1.4. Handling
1.1 grant 718: dependencies</a></span></dt>
719:
720: <dt><span class="sect2"><a href=
1.38 dillo 721: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 722: other packages</a></span></dt>
723:
724: <dt><span class="sect2"><a href=
1.38 dillo 725: "#not-building-packages">15.1.6. Packages that
1.30 wiz 726: cannot or should not be built</a></span></dt>
1.1 grant 727:
728: <dt><span class="sect2"><a href=
1.38 dillo 729: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 730: should not be deleted, once
731: installed</a></span></dt>
1.1 grant 732:
733: <dt><span class="sect2"><a href=
1.38 dillo 734: "#security-handling">15.1.8. Handling packages
1.1 grant 735: with security problems</a></span></dt>
736:
737: <dt><span class="sect2"><a href=
1.38 dillo 738: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 739: bugs</a></span></dt>
740:
741: <dt><span class="sect2"><a href=
1.38 dillo 742: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 743: incrementing versions when fixing an existing
1.1 grant 744: package</a></span></dt>
745:
746: <dt><span class="sect2"><a href=
1.38 dillo 747: "#portability-of-packages">15.1.11. Portability
1.30 wiz 748: of packages</a></span></dt>
1.1 grant 749: </dl>
750: </dd>
751:
1.30 wiz 752: <dt><span class="sect1"><a href=
1.38 dillo 753: "#downloading-issues">15.2. Possible downloading
1.30 wiz 754: issues</a></span></dt>
1.1 grant 755:
756: <dd>
757: <dl>
758: <dt><span class="sect2"><a href=
1.38 dillo 759: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 760: distfiles aren't available for plain
1.1 grant 761: downloading</a></span></dt>
762:
763: <dt><span class="sect2"><a href=
1.38 dillo 764: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 765: handle modified distfiles with the 'old'
766: name</a></span></dt>
1.1 grant 767: </dl>
768: </dd>
769:
1.30 wiz 770: <dt><span class="sect1"><a href=
1.38 dillo 771: "#configuration-gotchas">15.3. Configuration
1.30 wiz 772: gotchas</a></span></dt>
1.1 grant 773:
774: <dd>
775: <dl>
776: <dt><span class="sect2"><a href=
1.38 dillo 777: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 778: libtool</a></span></dt>
779:
780: <dt><span class="sect2"><a href=
1.38 dillo 781: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 782: packages that already support
783: libtool</a></span></dt>
784:
785: <dt><span class="sect2"><a href=
1.38 dillo 786: "#autoconf-automake">15.3.3. GNU
1.1 grant 787: Autoconf/Automake</a></span></dt>
788: </dl>
789: </dd>
790:
1.30 wiz 791: <dt><span class="sect1"><a href=
1.38 dillo 792: "#building-considerations">15.4. Building
1.30 wiz 793: considerations</a></span></dt>
1.1 grant 794:
795: <dd>
796: <dl>
797: <dt><span class="sect2"><a href=
1.38 dillo 798: "#cpp-defines">15.4.1. CPP
1.1 grant 799: defines</a></span></dt>
800: </dl>
801: </dd>
802:
1.30 wiz 803: <dt><span class="sect1"><a href=
1.38 dillo 804: "#package-specific-actions">15.5. Package specific
1.30 wiz 805: actions</a></span></dt>
1.1 grant 806:
807: <dd>
808: <dl>
809: <dt><span class="sect2"><a href=
1.38 dillo 810: "#user-interaction">15.5.1. User
1.2 hubertf 811: interaction</a></span></dt>
1.1 grant 812:
813: <dt><span class="sect2"><a href=
1.38 dillo 814: "#handling-licenses">15.5.2. Handling
1.1 grant 815: licenses</a></span></dt>
816:
817: <dt><span class="sect2"><a href=
1.38 dillo 818: "#installing-score-files">15.5.3. Installing
1.30 wiz 819: score files</a></span></dt>
1.1 grant 820:
821: <dt><span class="sect2"><a href=
1.38 dillo 822: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 823: perl scripts</a></span></dt>
1.1 grant 824:
825: <dt><span class="sect2"><a href=
1.38 dillo 826: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 827: hardcoded paths to other
828: interpreters</a></span></dt>
1.1 grant 829:
830: <dt><span class="sect2"><a href=
1.38 dillo 831: "#perl-modules">15.5.6. Packages installing
1.30 wiz 832: perl modules</a></span></dt>
1.1 grant 833:
834: <dt><span class="sect2"><a href=
1.38 dillo 835: "#faq.info-files">15.5.7. Packages installing
1.1 grant 836: info files</a></span></dt>
837:
838: <dt><span class="sect2"><a href=
1.38 dillo 839: "#gconf2-data-files">15.5.8. Packages
1.30 wiz 840: installing GConf2 data files</a></span></dt>
1.1 grant 841:
842: <dt><span class="sect2"><a href=
1.38 dillo 843: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 844: installing scrollkeeper data
845: files</a></span></dt>
1.1 grant 846:
847: <dt><span class="sect2"><a href=
1.38 dillo 848: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 849: fonts</a></span></dt>
850:
851: <dt><span class="sect2"><a href=
1.38 dillo 852: "#gtk2-modules">15.5.11. Packages installing
1.30 wiz 853: GTK2 modules</a></span></dt>
1.1 grant 854:
855: <dt><span class="sect2"><a href=
1.38 dillo 856: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 857: SGML or XML data</a></span></dt>
1.1 grant 858:
859: <dt><span class="sect2"><a href=
1.38 dillo 860: "#mime-database">15.5.13. Packages installing
1.1 grant 861: extensions to the MIME database</a></span></dt>
862:
863: <dt><span class="sect2"><a href=
1.38 dillo 864: "#intltool">15.5.14. Packages using
1.1 grant 865: intltool</a></span></dt>
1.18 xtraeme 866:
867: <dt><span class="sect2"><a href=
1.38 dillo 868: "#startup-scripts">15.5.15. Packages installing
1.18 xtraeme 869: startup scripts</a></span></dt>
1.1 grant 870: </dl>
871: </dd>
872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.38 dillo 874: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 875: author</a></span></dt>
1.1 grant 876: </dl>
877: </dd>
878:
1.38 dillo 879: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 880: Debugging</a></span></dt>
881:
1.38 dillo 882: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 883: Submitting and Committing</a></span></dt>
884:
885: <dd>
886: <dl>
1.30 wiz 887: <dt><span class="sect1"><a href=
1.38 dillo 888: "#submitting-your-package">17.1. Submitting your
1.30 wiz 889: packages</a></span></dt>
1.1 grant 890:
1.30 wiz 891: <dt><span class="sect1"><a href=
1.41 wiz 892: "#general-notes-for-changes">17.2. General notes
893: when adding, updating, or removing
894: packages</a></span></dt>
895:
896: <dt><span class="sect1"><a href=
897: "#committing-importing">17.3. Committing: Importing
1.30 wiz 898: a package into CVS</a></span></dt>
1.1 grant 899:
1.30 wiz 900: <dt><span class="sect1"><a href=
1.41 wiz 901: "#updating-package">17.4. Updating a package to a
1.30 wiz 902: newer version</a></span></dt>
1.1 grant 903:
1.30 wiz 904: <dt><span class="sect1"><a href=
1.41 wiz 905: "#moving-package">17.5. Moving a package in
1.30 wiz 906: pkgsrc</a></span></dt>
1.1 grant 907: </dl>
908: </dd>
909: </dl>
910: </dd>
911:
1.46 ! gdt 912: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 913: example package: bison</a></span></dt>
914:
915: <dd>
916: <dl>
1.46 ! gdt 917: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 918: files</a></span></dt>
919:
920: <dd>
921: <dl>
1.30 wiz 922: <dt><span class="sect2"><a href=
1.46 ! gdt 923: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 924:
1.30 wiz 925: <dt><span class="sect2"><a href=
1.46 ! gdt 926: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 927:
1.30 wiz 928: <dt><span class="sect2"><a href=
1.46 ! gdt 929: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 930:
1.30 wiz 931: <dt><span class="sect2"><a href=
1.46 ! gdt 932: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 933: package with <span><strong class=
1.14 xtraeme 934: "command">pkglint</strong></span></a></span></dt>
1.1 grant 935: </dl>
936: </dd>
937:
1.46 ! gdt 938: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 939: Steps for building, installing,
940: packaging</a></span></dt>
1.1 grant 941: </dl>
942: </dd>
943:
1.46 ! gdt 944: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 945: logs</a></span></dt>
946:
947: <dd>
948: <dl>
1.46 ! gdt 949: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 950: Building figlet</a></span></dt>
951:
1.46 ! gdt 952: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 953: Packaging figlet</a></span></dt>
954: </dl>
955: </dd>
956:
1.46 ! gdt 957: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 958: of the FTP server's package archive</a></span></dt>
1.2 hubertf 959:
1.46 ! gdt 960: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 961: guidelines for the pkgsrc guide</a></span></dt>
962:
963: <dd>
964: <dl>
1.46 ! gdt 965: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 966: Targets</a></span></dt>
967:
1.46 ! gdt 968: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 969: Procedure</a></span></dt>
970: </dl>
971: </dd>
1.1 grant 972: </dl>
973: </div>
974:
975: <div class="chapter" lang="en" xml:lang="en">
976: <div class="titlepage">
977: <div>
978: <div>
979: <h2 class="title"><a name="introduction" id=
980: "introduction"></a>Chapter 1. Introduction</h2>
981: </div>
982: </div>
983: </div>
984:
985: <div class="toc">
986: <p><b>Table of Contents</b></p>
987:
988: <dl>
1.30 wiz 989: <dt><span class="sect1"><a href=
990: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 991:
992: <dt><span class="sect1"><a href="#overview">1.2.
993: Overview</a></span></dt>
994:
995: <dt><span class="sect1"><a href="#terminology">1.3.
996: Terminology</a></span></dt>
997:
998: <dt><span class="sect1"><a href="#typography">1.4.
999: Typography</a></span></dt>
1000: </dl>
1001: </div>
1002:
1003: <div class="sect1" lang="en" xml:lang="en">
1004: <div class="titlepage">
1005: <div>
1006: <div>
1007: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1008: "introduction-section" id=
1009: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1010: </div>
1011: </div>
1012: </div>
1013:
1014: <p>There is a lot of software freely available for Unix
1015: based systems, which usually runs on NetBSD and other
1016: Unix-flavoured systems, too, sometimes with some
1017: modifications. The NetBSD Packages Collection (pkgsrc)
1018: incorporates any such changes necessary to make that
1019: software run, and makes the installation (and
1020: de-installation) of the software package easy by means of a
1021: single command.</p>
1022:
1023: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1024: the <span><strong class="command">pkg_*</strong></span>
1025: tools so that installation and de-installation, printing of
1026: an inventory of all installed packages and retrieval of
1027: one-line comments or more verbose descriptions are all
1028: simple.</p>
1.1 grant 1029:
1030: <p>pkgsrc currently contains several thousand packages,
1031: including:</p>
1032:
1033: <div class="itemizedlist">
1034: <ul type="disc">
1035: <li>
1036: <p><a xmlns=
1037: "http://www.w3.org/TR/xhtml1/transitional" href=
1038: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1039: target="_top"><code xmlns="" class=
1040: "filename">www/apache</code></a> - The Apache web
1.20 ben 1041: server</p>
1.1 grant 1042: </li>
1043:
1044: <li>
1045: <p><a xmlns=
1046: "http://www.w3.org/TR/xhtml1/transitional" href=
1047: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1048: target="_top"><code xmlns="" class=
1049: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1050: browser</p>
1.1 grant 1051: </li>
1052:
1053: <li>
1054: <p><a xmlns=
1055: "http://www.w3.org/TR/xhtml1/transitional" href=
1056: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1057: target="_top"><code xmlns="" class=
1058: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1059: Desktop Environment</p>
1.1 grant 1060: </li>
1061:
1062: <li>
1063: <p><a xmlns=
1064: "http://www.w3.org/TR/xhtml1/transitional" href=
1065: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1066: target="_top"><code xmlns="" class=
1067: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1068: Environment</p>
1.1 grant 1069: </li>
1070: </ul>
1071: </div>
1072:
1073: <p>...just to name a few.</p>
1074:
1075: <p>pkgsrc has built-in support for handling varying
1076: dependencies, such as pthreads and X11, and extended
1077: features such as IPv6 support on a range of platforms.</p>
1078:
1079: <p>pkgsrc was derived from FreeBSD's ports system, and
1080: initially developed for NetBSD only. Since then, pkgsrc has
1081: grown a lot, and now supports the following platforms:</p>
1082:
1083: <div class="itemizedlist">
1084: <ul type="disc">
1085: <li>
1086: <p><a href="http://developer.apple.com/darwin/"
1087: target="_top">Darwin</a> (<a href=
1088: "http://www.apple.com/macosx/" target="_top">Mac OS
1089: X</a>)</p>
1090: </li>
1091:
1092: <li>
1.3 hubertf 1093: <p><a href="http://www.DragonFlyBSD.org/" target=
1094: "_top">DragonFlyBSD</a></p>
1095: </li>
1096:
1097: <li>
1.1 grant 1098: <p><a href="http://www.FreeBSD.org/" target=
1099: "_top">FreeBSD</a></p>
1100: </li>
1101:
1102: <li>
1.3 hubertf 1103: <p>Microsoft Windows, via <a href=
1104: "http://www.microsoft.com/windows/sfu/" target=
1105: "_top">Interix</a></p>
1.1 grant 1106: </li>
1107:
1108: <li>
1109: <p><a href="http://www.sgi.com/software/irix6.5/"
1110: target="_top">IRIX</a></p>
1111: </li>
1112:
1113: <li>
1114: <p><a href="http://www.linux.org/" target=
1115: "_top">Linux</a></p>
1116: </li>
1117:
1118: <li>
1119: <p><a href="http://www.NetBSD.org/" target=
1120: "_top">NetBSD</a> (of course)</p>
1121: </li>
1122:
1123: <li>
1.17 sketch 1124: <p><a href="http://h30097.www3.hp.com/" target=
1125: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1126: </li>
1127:
1128: <li>
1.1 grant 1129: <p><a href="http://www.openbsd.org/" target=
1130: "_top">OpenBSD</a></p>
1131: </li>
1132:
1133: <li>
1134: <p><a href="http://www.sun.com/solaris/" target=
1135: "_top">Solaris</a></p>
1136: </li>
1137: </ul>
1138: </div>
1139: </div>
1140:
1141: <div class="sect1" lang="en" xml:lang="en">
1142: <div class="titlepage">
1143: <div>
1144: <div>
1145: <h2 class="title" style="clear: both"><a name=
1146: "overview" id="overview"></a>1.2. Overview</h2>
1147: </div>
1148: </div>
1149: </div>
1150:
1151: <p>This document is divided into two parts. The first,
1152: <a href="#users-guide" title=
1.46 ! gdt 1153: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1154: user's guide</a>, describes how one can use one of the
1155: packages in the Package Collection, either by installing a
1156: precompiled binary package, or by building one's own copy
1157: using the NetBSD package system. The second part, <a href=
1.1 grant 1158: "#developers-guide" title=
1.46 ! gdt 1159: "Part II. The pkgsrc developer's guide">The
! 1160: pkgsrc developer's guide</a>, explains how to prepare a
! 1161: package so it can be easily built by other NetBSD users
! 1162: without knowing about the package's building details.</p>
1.1 grant 1163:
1164: <p>This document is available in various formats:</p>
1165:
1166: <div class="itemizedlist">
1167: <ul type="disc">
1168: <li>
1169: <p><a href="index.html" target="_top">HTML</a></p>
1170: </li>
1171:
1172: <li>
1173: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1174: </li>
1175:
1176: <li>
1177: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1178: </li>
1179:
1180: <li>
1181: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1182: </li>
1183: </ul>
1184: </div>
1185: </div>
1186:
1187: <div class="sect1" lang="en" xml:lang="en">
1188: <div class="titlepage">
1189: <div>
1190: <div>
1191: <h2 class="title" style="clear: both"><a name=
1192: "terminology" id=
1193: "terminology"></a>1.3. Terminology</h2>
1194: </div>
1195: </div>
1196: </div>
1197:
1198: <p>There has been a lot of talk about “<span class=
1199: "quote">ports</span>”, “<span class=
1200: "quote">packages</span>”, etc. so far. Here is a
1201: description of all the terminology used within this
1202: document.</p>
1203:
1204: <div class="variablelist">
1205: <dl>
1206: <dt><span class="term">Package</span></dt>
1207:
1208: <dd>
1209: <p>A set of files and building instructions that
1210: describe what's necessary to build a certain piece of
1211: software using pkgsrc. Packages are traditionally
1.45 wiz 1212: stored under <code xmlns=
1213: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1214: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1215: </dd>
1216:
1217: <dt><span class="term">The NetBSD package
1218: system</span></dt>
1219:
1220: <dd>
1221: <p>This is the former name of “<span class=
1222: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1223: NetBSD operating system and can be bootstrapped to
1224: run on non-NetBSD operating systems as well. It
1225: handles building (compiling), installing, and
1226: removing of packages.</p>
1.1 grant 1227: </dd>
1228:
1229: <dt><span class="term">Distfile</span></dt>
1230:
1231: <dd>
1232: <p>This term describes the file or files that are
1233: provided by the author of the piece of software to
1234: distribute his work. All the changes necessary to
1235: build on NetBSD are reflected in the corresponding
1236: package. Usually the distfile is in the form of a
1237: compressed tar-archive, but other types are possible,
1.45 wiz 1238: too. Distfiles are usually stored below <code xmlns=
1239: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1240: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1241: </dd>
1242:
1243: <dt><span class="term">Port</span></dt>
1244:
1245: <dd>
1246: <p>This is the term used by FreeBSD and OpenBSD
1247: people for what we call a package. In NetBSD
1248: terminology, “<span class=
1249: "quote">port</span>” refers to a different
1250: architecture.</p>
1251: </dd>
1252:
1253: <dt><span class="term">Precompiled/binary
1254: package</span></dt>
1255:
1256: <dd>
1257: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1258: distfile and stuffed together in a single
1.45 wiz 1259: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1260: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1261: installed on machines of the same machine
1262: architecture without the need to recompile. Packages
1.45 wiz 1263: are usually generated in <code xmlns=
1264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1265: "filename">/usr/pkgsrc/packages</code>; there is also
1266: an archive on <a href=
1.1 grant 1267: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1268: "_top">ftp.NetBSD.org</a>.</p>
1269:
1270: <p>Sometimes, this is referred to by the term
1271: “<span class="quote">package</span>” too,
1272: especially in the context of precompiled
1273: packages.</p>
1274: </dd>
1275:
1276: <dt><span class="term">Program</span></dt>
1277:
1278: <dd>
1279: <p>The piece of software to be installed which will
1280: be constructed from all the files in the Distfile by
1281: the actions defined in the corresponding package.</p>
1282: </dd>
1283: </dl>
1284: </div>
1285: </div>
1286:
1287: <div class="sect1" lang="en" xml:lang="en">
1288: <div class="titlepage">
1289: <div>
1290: <div>
1291: <h2 class="title" style="clear: both"><a name=
1292: "typography" id=
1293: "typography"></a>1.4. Typography</h2>
1294: </div>
1295: </div>
1296: </div>
1297:
1298: <p>When giving examples for commands, shell prompts are
1299: used to show if the command should/can be issued as root,
1300: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1301: privileges are sufficient. We use a <code class=
1302: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1303: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1304: assuming they use the C-shell or tcsh.</p>
1.1 grant 1305: </div>
1306: </div>
1307:
1308: <div class="part" lang="en" xml:lang="en">
1309: <div class="titlepage">
1310: <div>
1311: <div>
1312: <h1 class="title"><a name="users-guide" id=
1.46 ! gdt 1313: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1314: </div>
1315: </div>
1316: </div>
1317:
1318: <div class="toc">
1319: <p><b>Table of Contents</b></p>
1320:
1321: <dl>
1322: <dt><span class="chapter"><a href="#getting">2. Where to
1323: get pkgsrc</a></span></dt>
1324:
1325: <dd>
1326: <dl>
1.30 wiz 1327: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1328: As tar file</a></span></dt>
1.1 grant 1329:
1.30 wiz 1330: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1331: SUP</a></span></dt>
1332:
1.30 wiz 1333: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1334: CVS</a></span></dt>
1335: </dl>
1336: </dd>
1337:
1338: <dt><span class="chapter"><a href="#platforms">3. Using
1339: pkgsrc on systems other than NetBSD</a></span></dt>
1340:
1341: <dd>
1342: <dl>
1.30 wiz 1343: <dt><span class="sect1"><a href=
1344: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1345: pkgsrc</a></span></dt>
1.1 grant 1346:
1.30 wiz 1347: <dt><span class="sect1"><a href=
1348: "#platform-specific-notes">3.2. Platform specific
1349: notes</a></span></dt>
1.1 grant 1350:
1351: <dd>
1352: <dl>
1.30 wiz 1353: <dt><span class="sect2"><a href="#darwin">3.2.1.
1354: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1355:
1.30 wiz 1356: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1357: FreeBSD</a></span></dt>
1.22 tv 1358:
1.30 wiz 1359: <dt><span class="sect2"><a href="#interix">3.2.3.
1360: Interix</a></span></dt>
1.1 grant 1361:
1.30 wiz 1362: <dt><span class="sect2"><a href="#irix">3.2.4.
1363: IRIX</a></span></dt>
1.1 grant 1364:
1.30 wiz 1365: <dt><span class="sect2"><a href="#linux">3.2.5.
1366: Linux</a></span></dt>
1.1 grant 1367:
1.30 wiz 1368: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1369: OpenBSD</a></span></dt>
1.1 grant 1370:
1.30 wiz 1371: <dt><span class="sect2"><a href="#solaris">3.2.7.
1372: Solaris</a></span></dt>
1.1 grant 1373: </dl>
1374: </dd>
1375: </dl>
1376: </dd>
1377:
1378: <dt><span class="chapter"><a href="#using">4. Using
1379: pkgsrc</a></span></dt>
1380:
1381: <dd>
1382: <dl>
1383: <dt><span class="sect1"><a href=
1384: "#getting-started">4.1. Working with binary
1385: packages</a></span></dt>
1386:
1387: <dd>
1388: <dl>
1389: <dt><span class="sect2"><a href=
1.30 wiz 1390: "#where-to-get-binary-packages">4.1.1. Where to
1391: get binary packages</a></span></dt>
1.1 grant 1392:
1393: <dt><span class="sect2"><a href=
1.30 wiz 1394: "#how-to-use-binary-packages">4.1.2. How to use
1395: binary packages</a></span></dt>
1.1 grant 1396:
1397: <dt><span class="sect2"><a href=
1.30 wiz 1398: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1399: warning</a></span></dt>
1400: </dl>
1401: </dd>
1402:
1.30 wiz 1403: <dt><span class="sect1"><a href=
1404: "#building-packages-from-source">4.2. Building
1405: packages from source</a></span></dt>
1.1 grant 1406:
1407: <dd>
1408: <dl>
1409: <dt><span class="sect2"><a href=
1.30 wiz 1410: "#requirements">4.2.1.
1411: Requirements</a></span></dt>
1.1 grant 1412:
1413: <dt><span class="sect2"><a href=
1.30 wiz 1414: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1415: distfiles</a></span></dt>
1416:
1417: <dt><span class="sect2"><a href=
1.30 wiz 1418: "#how-to-build-and-install">4.2.3. How to build
1419: and install</a></span></dt>
1.1 grant 1420:
1421: <dt><span class="sect2"><a href=
1.30 wiz 1422: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1423: compiler</a></span></dt>
1424: </dl>
1425: </dd>
1426: </dl>
1427: </dd>
1428:
1.38 dillo 1429: <dt><span class="chapter"><a href="#configuring">5.
1430: Configuring pkgsrc</a></span></dt>
1431:
1432: <dd>
1433: <dl>
1434: <dt><span class="sect1"><a href=
1.45 wiz 1435: "#general-configuration">5.1. General
1436: configuration</a></span></dt>
1437:
1438: <dt><span class="sect1"><a href=
1439: "#variables-affecting-build">5.2. Variables affecting
1440: the build process</a></span></dt>
1441:
1442: <dt><span class="sect1"><a href=
1443: "#developer-advanced-settings">5.3.
1444: Developer/advanced settings</a></span></dt>
1445:
1446: <dt><span class="sect1"><a href=
1447: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1448: Options</a></span></dt>
1.38 dillo 1449: </dl>
1450: </dd>
1451:
1452: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1453: binary packages</a></span></dt>
1454:
1455: <dd>
1456: <dl>
1.30 wiz 1457: <dt><span class="sect1"><a href=
1.38 dillo 1458: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1459: single binary package</a></span></dt>
1.1 grant 1460:
1.30 wiz 1461: <dt><span class="sect1"><a href=
1.38 dillo 1462: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1463: Settings for creation of binary
1464: packages</a></span></dt>
1465:
1.38 dillo 1466: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1467: Doing a bulk build of all packages</a></span></dt>
1468:
1469: <dd>
1470: <dl>
1471: <dt><span class="sect2"><a href=
1.38 dillo 1472: "#binary.configuration">6.3.1.
1.1 grant 1473: Configuration</a></span></dt>
1474:
1475: <dt><span class="sect2"><a href=
1.38 dillo 1476: "#other-environmental-considerations">6.3.2.
1.30 wiz 1477: Other environmental
1.1 grant 1478: considerations</a></span></dt>
1479:
1480: <dt><span class="sect2"><a href=
1.38 dillo 1481: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1482:
1483: <dt><span class="sect2"><a href=
1.38 dillo 1484: "#what-it-does">6.3.4. What it
1.30 wiz 1485: does</a></span></dt>
1.1 grant 1486:
1487: <dt><span class="sect2"><a href=
1.38 dillo 1488: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1489: requirements</a></span></dt>
1490:
1491: <dt><span class="sect2"><a href=
1.38 dillo 1492: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 1493: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1494:
1495: <dt><span class="sect2"><a href=
1.38 dillo 1496: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1497: partial set of packages</a></span></dt>
1.13 hubertf 1498:
1499: <dt><span class="sect2"><a href=
1.38 dillo 1500: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1501: build</a></span></dt>
1.1 grant 1502: </dl>
1503: </dd>
1504:
1.30 wiz 1505: <dt><span class="sect1"><a href=
1.38 dillo 1506: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1507: packages collection</a></span></dt>
1.1 grant 1508:
1509: <dd>
1510: <dl>
1511: <dt><span class="sect2"><a href=
1.38 dillo 1512: "#cdpack-example">6.4.1. Example of
1.1 grant 1513: cdpack</a></span></dt>
1514: </dl>
1515: </dd>
1516: </dl>
1517: </dd>
1518:
1.38 dillo 1519: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1520: Asked Questions</a></span></dt>
1521:
1522: <dd>
1523: <dl>
1.30 wiz 1524: <dt><span class="sect1"><a href=
1.38 dillo 1525: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1526: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1527:
1.38 dillo 1528: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1529: Where's the pkgviews documentation?</a></span></dt>
1530:
1.38 dillo 1531: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1532: Utilities for package management
1533: (pkgtools)</a></span></dt>
1534:
1.30 wiz 1535: <dt><span class="sect1"><a href=
1.38 dillo 1536: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1537: non-root</a></span></dt>
1.1 grant 1538:
1.30 wiz 1539: <dt><span class="sect1"><a href=
1.38 dillo 1540: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1541: fetching distfiles?</a></span></dt>
1.14 xtraeme 1542:
1.30 wiz 1543: <dt><span class="sect1"><a href=
1.38 dillo 1544: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1545: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1546:
1.30 wiz 1547: <dt><span class="sect1"><a href=
1.38 dillo 1548: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1549: from pkgsrc?</a></span></dt>
1.1 grant 1550:
1.30 wiz 1551: <dt><span class="sect1"><a href=
1.38 dillo 1552: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1553: behind a firewall</a></span></dt>
1.1 grant 1554:
1.38 dillo 1555: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1556: How do I tell <span><strong class="command">make
1.14 xtraeme 1557: fetch</strong></span> to do passive
1.1 grant 1558: FTP?</a></span></dt>
1559:
1.30 wiz 1560: <dt><span class="sect1"><a href=
1.38 dillo 1561: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1562: distfiles at once</a></span></dt>
1.1 grant 1563:
1.30 wiz 1564: <dt><span class="sect1"><a href=
1.38 dillo 1565: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1566: “<span class="quote">Don't know how to make
1567: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1568: mean?</a></span></dt>
1.13 hubertf 1569:
1.30 wiz 1570: <dt><span class="sect1"><a href=
1.38 dillo 1571: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1572: “<span class="quote">Could not find
1.14 xtraeme 1573: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1574:
1.30 wiz 1575: <dt><span class="sect1"><a href=
1.38 dillo 1576: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1577: pkgsrc</a></span></dt>
1.1 grant 1578:
1.38 dillo 1579: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1580: do I change the location of configuration
1581: files?</a></span></dt>
1.1 grant 1582:
1583: <dt><span class="sect1"><a href=
1.38 dillo 1584: "#audit-packages">7.15. Automated security
1.1 grant 1585: checks</a></span></dt>
1586: </dl>
1587: </dd>
1588: </dl>
1589: </div>
1590:
1591: <div class="chapter" lang="en" xml:lang="en">
1592: <div class="titlepage">
1593: <div>
1594: <div>
1595: <h2 class="title"><a name="getting" id=
1596: "getting"></a>Chapter 2. Where to get
1597: pkgsrc</h2>
1598: </div>
1599: </div>
1600: </div>
1601:
1602: <div class="toc">
1603: <p><b>Table of Contents</b></p>
1604:
1605: <dl>
1.30 wiz 1606: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1607: tar file</a></span></dt>
1608:
1.30 wiz 1609: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1610: SUP</a></span></dt>
1611:
1.30 wiz 1612: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1613: CVS</a></span></dt>
1614: </dl>
1615: </div>
1616:
1617: <p>There are three ways to get pkgsrc. Either as a tar
1618: file, via SUP, or via CVS. All three ways are described
1619: here.</p>
1620:
1621: <div class="sect1" lang="en" xml:lang="en">
1622: <div class="titlepage">
1623: <div>
1624: <div>
1625: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1626: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1627: file</h2>
1628: </div>
1629: </div>
1630: </div>
1631:
1632: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1633: file from <a href=
1.11 ben 1634: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1635: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1636: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1637: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1638: </div>
1639:
1640: <div class="sect1" lang="en" xml:lang="en">
1641: <div class="titlepage">
1642: <div>
1643: <div>
1644: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1645: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1646: </div>
1647: </div>
1648: </div>
1649:
1650: <p>As an alternative to the tar file, you can get pkgsrc
1651: via the Software Update Protocol, SUP. To do so, make
1652: sure your supfile has a line</p>
1653: <pre class="programlisting">
1654: release=pkgsrc
1655: </pre>
1656:
1.45 wiz 1657: <p>in it, see the examples in <code xmlns=
1658: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1659: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1660: the <code xmlns=
1661: "http://www.w3.org/TR/xhtml1/transitional" class=
1662: "filename">/usr/pkgsrc</code> directory exists. Then,
1663: simply run <span><strong class="command">sup -v
1664: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1665: </div>
1666:
1667: <div class="sect1" lang="en" xml:lang="en">
1668: <div class="titlepage">
1669: <div>
1670: <div>
1671: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1672: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1673: </div>
1674: </div>
1675: </div>
1676:
1677: <p>To get pkgsrc via CVS, make sure you have
1678: “<span class="quote">cvs</span>” installed.
1.27 rillig 1679: To do an initial (full) checkout of pkgsrc, do the
1680: following steps:</p>
1.1 grant 1681: <pre class="screen">
1.14 xtraeme 1682: <code class="prompt">%</code> <strong class=
1683: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1684: <code class="prompt">%</code> <strong class=
1685: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1686: <code class="prompt">%</code> <strong class=
1687: "userinput"><code>cd /usr</code></strong>
1688: <code class="prompt">%</code> <strong class=
1689: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1690: </pre>
1691:
1.45 wiz 1692: <p>This will create the <code xmlns=
1693: "http://www.w3.org/TR/xhtml1/transitional" class=
1694: "filename">pkgsrc</code> directory in your <code xmlns=
1695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1696: "filename">/usr</code>, and all the package source will
1.45 wiz 1697: be stored under <code xmlns=
1698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1699: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1700: initial checkout, make sure you have <code class=
1701: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1702: <pre class="screen">
1.14 xtraeme 1703: <code class="prompt">%</code> <strong class=
1704: "userinput"><code>cd /usr/pkgsrc</code></strong>
1705: <code class="prompt">%</code> <strong class=
1706: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1707: </pre>
1708:
1709: <p>Please also note that it is possible to have multiple
1710: copies of the pkgsrc hierarchy in use at any one time -
1711: all work is done relatively within the pkgsrc tree.</p>
1712: </div>
1713: </div>
1714:
1715: <div class="chapter" lang="en" xml:lang="en">
1716: <div class="titlepage">
1717: <div>
1718: <div>
1719: <h2 class="title"><a name="platforms" id=
1720: "platforms"></a>Chapter 3. Using pkgsrc on
1721: systems other than NetBSD</h2>
1722: </div>
1723: </div>
1724: </div>
1725:
1726: <div class="toc">
1727: <p><b>Table of Contents</b></p>
1728:
1729: <dl>
1.30 wiz 1730: <dt><span class="sect1"><a href=
1731: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1732: pkgsrc</a></span></dt>
1.1 grant 1733:
1.30 wiz 1734: <dt><span class="sect1"><a href=
1735: "#platform-specific-notes">3.2. Platform specific
1736: notes</a></span></dt>
1.1 grant 1737:
1738: <dd>
1739: <dl>
1.30 wiz 1740: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1741: Darwin (Mac OS X)</a></span></dt>
1742:
1.30 wiz 1743: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1744: FreeBSD</a></span></dt>
1745:
1.30 wiz 1746: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1747: Interix</a></span></dt>
1748:
1.30 wiz 1749: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1750: IRIX</a></span></dt>
1751:
1.30 wiz 1752: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1753: Linux</a></span></dt>
1754:
1.30 wiz 1755: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1756: OpenBSD</a></span></dt>
1757:
1.30 wiz 1758: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1759: Solaris</a></span></dt>
1760: </dl>
1761: </dd>
1762: </dl>
1763: </div>
1764:
1765: <div class="sect1" lang="en" xml:lang="en">
1766: <div class="titlepage">
1767: <div>
1768: <div>
1769: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1770: "bootstrapping-pkgsrc" id=
1771: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1772: pkgsrc</h2>
1.1 grant 1773: </div>
1774: </div>
1775: </div>
1776:
1.27 rillig 1777: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1778: bootstrap kit to build the required tools to use pkgsrc
1779: on your platform. Besides support for native NetBSD,
1780: pkgsrc and the bootstrap kit have support for the
1781: following operating systems:</p>
1782:
1783: <div class="itemizedlist">
1784: <ul type="disc">
1785: <li>
1786: <p>Darwin (Mac OS X)</p>
1787: </li>
1788:
1789: <li>
1.16 grant 1790: <p>DragonFlyBSD</p>
1791: </li>
1792:
1793: <li>
1.1 grant 1794: <p>FreeBSD</p>
1795: </li>
1796:
1797: <li>
1798: <p>Interix (Windows 2000, XP, 2003)</p>
1799: </li>
1800:
1801: <li>
1802: <p>IRIX</p>
1803: </li>
1804:
1805: <li>
1806: <p>Linux</p>
1807: </li>
1808:
1809: <li>
1810: <p>OpenBSD</p>
1811: </li>
1812:
1813: <li>
1814: <p>Solaris</p>
1815: </li>
1.16 grant 1816:
1817: <li>
1818: <p>Tru64 (Digital UNIX/OSF1)</p>
1819: </li>
1.1 grant 1820: </ul>
1821: </div>
1822:
1823: <p>Support for other platforms is under development.</p>
1824:
1825: <p>Installing the bootstrap kit should be as simple
1826: as:</p>
1827: <pre class="screen">
1.14 xtraeme 1828: <code class="prompt">#</code> <strong class=
1829: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1830: <code class="prompt">#</code> <strong class=
1831: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1832: <code class="prompt">#</code> <strong class=
1833: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1834: </pre>
1835:
1836: <p>See <a href="#getting" title=
1837: "Chapter 2. Where to get pkgsrc">Chapter 2,
1838: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1839: pkgsrc before bootstrapping. The given
1840: <span><strong class="command">bootstrap</strong></span>
1.45 wiz 1841: command will use the defaults of <code xmlns=
1842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1843: "filename">/usr/pkg</code> for the <span class=
1844: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1845: installed in, and <code xmlns=
1846: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1847: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1848: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1849: However, these can also be set using command-line
1.27 rillig 1850: arguments.</p>
1.1 grant 1851:
1852: <p>Binary packages for the pkgsrc tools and an initial
1853: set of packages is available for supported platforms. An
1854: up-to-date list of these can be found on <a href=
1855: "http://www.pkgsrc.org/" target=
1856: "_top">www.pkgsrc.org</a>.</p>
1857: </div>
1858:
1859: <div class="sect1" lang="en" xml:lang="en">
1860: <div class="titlepage">
1861: <div>
1862: <div>
1863: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1864: "platform-specific-notes" id=
1865: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1866: specific notes</h2>
1867: </div>
1868: </div>
1869: </div>
1870:
1871: <p>Here are some platform-specific notes you should be
1872: aware of.</p>
1873:
1874: <div class="sect2" lang="en" xml:lang="en">
1875: <div class="titlepage">
1876: <div>
1877: <div>
1.30 wiz 1878: <h3 class="title"><a name="darwin" id=
1879: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1880: </div>
1881: </div>
1882: </div>
1883:
1884: <p>Darwin 5.x and 6.x are supported. There are two
1885: methods of using pkgsrc on Mac OS X, by using a
1886: <a href="#platform.osx-image" title=
1887: "3.2.1.1. Using a disk image">disk image</a>, or a
1888: <a href="#platform.osx-ufs" title=
1889: "3.2.1.2. Using a UFS partition">UFS
1890: partition</a>.</p>
1891:
1892: <p>Before you start, you will need to download and
1893: install the Mac OS X Developer Tools from Apple's
1894: Developer Connection. See <a href=
1895: "http://developer.apple.com/macosx/" target=
1896: "_top">http://developer.apple.com/macosx/</a> for
1897: details. Also, make sure you install X11 for Mac OS X
1898: and the X11 SDK from <a href=
1899: "http://www.apple.com/macosx/x11/download/" target=
1900: "_top">http://www.apple.com/macosx/x11/download/</a> if
1901: you intend to build packages that use the X11 Window
1902: System.</p>
1903:
1904: <p>If you already have a UFS partition, or have a spare
1905: partition that you can format as UFS, it is recommended
1906: to use that instead of the disk image. It'll be
1907: somewhat faster and will mount automatically at boot
1908: time, where you must manually mount a disk image.</p>
1909:
1910: <div class="note" style=
1911: "margin-left: 0.5in; margin-right: 0.5in;">
1912: <h3 class="title">Note</h3>
1913:
1914: <p>You cannot use a HFS+ file system for pkgsrc,
1915: because pkgsrc currently requires the filesystem to
1916: be case-sensitive, and HFS+ is not.</p>
1917: </div>
1918:
1919: <div class="sect3" lang="en" xml:lang="en">
1920: <div class="titlepage">
1921: <div>
1922: <div>
1923: <h4 class="title"><a name="platform.osx-image"
1924: id="platform.osx-image"></a>3.2.1.1. Using
1925: a disk image</h4>
1926: </div>
1927: </div>
1928: </div>
1929:
1930: <p>Create the disk image:</p>
1931: <pre class="screen">
1.14 xtraeme 1932: <code class="prompt">#</code> <strong class=
1933: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1934: <code class="prompt">#</code> <strong class=
1935: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1936: <code class="prompt">#</code> <strong class=
1937: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1938: <code class="prompt">#</code> <strong class=
1939: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1940: </pre>
1941:
1942: <p>That's it!</p>
1943: </div>
1944:
1945: <div class="sect3" lang="en" xml:lang="en">
1946: <div class="titlepage">
1947: <div>
1948: <div>
1949: <h4 class="title"><a name="platform.osx-ufs"
1950: id="platform.osx-ufs"></a>3.2.1.2. Using a
1951: UFS partition</h4>
1952: </div>
1953: </div>
1954: </div>
1955:
1.45 wiz 1956: <p>By default, <code xmlns=
1957: "http://www.w3.org/TR/xhtml1/transitional" class=
1958: "filename">/usr</code> will be on your root file
1959: system, normally HFS+. It is possible to use the
1960: default <span class="emphasis"><em>prefix</em></span>
1961: of <code xmlns=
1962: "http://www.w3.org/TR/xhtml1/transitional" class=
1963: "filename">/usr/pkg</code> by symlinking <code xmlns=
1964: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1965: "filename">/usr/pkg</code> to a directory on a UFS
1966: file system. Obviously, another symlink is required
1967: if you want to place the package database directory
1968: outside the <span class=
1969: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1970: <pre class="screen">
1.14 xtraeme 1971: <code class="prompt">#</code> <strong class=
1.22 tv 1972: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1973: </pre>
1974:
1975: <p>If you created your partitions at the time of
1976: installing Mac OS X and formatted the target
1977: partition as UFS, it should automatically mount on
1.45 wiz 1978: <code xmlns=
1979: "http://www.w3.org/TR/xhtml1/transitional" class=
1980: "filename">/Volumes/<volume name></code> when
1981: the machine boots. If you are (re)formatting a
1982: partition as UFS, you need to ensure that the
1983: partition map correctly reflects “<span class=
1984: "quote">Apple_UFS</span>” and not
1985: “<span class=
1.1 grant 1986: "quote">Apple_HFS</span>”.</p>
1987:
1988: <p>The problem is that none of the disk tools will
1989: let you touch a disk that is booted from. You can
1990: unmount the partition, but even if you newfs it, the
1991: partition type will be incorrect and the automounter
1992: won't mount it. It can be mounted manually, but it
1993: won't appear in Finder.</p>
1994:
1995: <p>You'll need to boot off of the OS X Installation
1996: (User) CD. When the Installation program starts, go
1997: up to the menu and select Disk Utility. Now, you will
1998: be able to select the partition you want to be UFS,
1999: and Format it Apple UFS. Quit the Disk Utility, quit
2000: the installer which will reboot your machine. The new
2001: UFS file system will appear in Finder.</p>
2002:
2003: <p>Be aware that the permissions on the new file
2004: system will be writable by root only.</p>
2005:
2006: <p>This note is as of 10.2 (Jaguar) and applies to
2007: earlier versions. Hopefully Apple will fix Disk
2008: Utility in 10.3 (Panther).</p>
2009: </div>
2010: </div>
2011:
2012: <div class="sect2" lang="en" xml:lang="en">
2013: <div class="titlepage">
2014: <div>
2015: <div>
1.30 wiz 2016: <h3 class="title"><a name="freebsd" id=
2017: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2018: </div>
2019: </div>
2020: </div>
2021:
2022: <p>FreeBSD 4.7 and 5.0 have been tested and are
2023: supported, other versions may work.</p>
2024:
2025: <p>Care should be taken so that the tools that this kit
2026: installs do not conflict with the FreeBSD userland
2027: tools. There are several steps:</p>
2028:
2029: <div class="orderedlist">
2030: <ol type="1">
2031: <li>
2032: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2033: <code xmlns=
2034: "http://www.w3.org/TR/xhtml1/transitional" class=
2035: "filename">/var/db/pkg</code>. It is therefore
2036: recommended that you choose a different location
2037: (e.g. <code xmlns=
2038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2039: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2040: --pkgdbdir option to the bootstrap script.</p>
2041: </li>
2042:
2043: <li>
2044: <p>If you do not intend to use the FreeBSD ports
2045: tools, it's probably a good idea to move them out
2046: of the way to avoid confusion, e.g.</p>
2047: <pre class="screen">
1.14 xtraeme 2048: <code class="prompt">#</code> <strong class=
2049: "userinput"><code>cd /usr/sbin</code></strong>
2050: <code class="prompt">#</code> <strong class=
2051: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2052: <code class="prompt">#</code> <strong class=
2053: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2054: <code class="prompt">#</code> <strong class=
2055: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2056: <code class="prompt">#</code> <strong class=
2057: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2058: </pre>
2059: </li>
2060:
2061: <li>
1.45 wiz 2062: <p>An example <code xmlns=
2063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2064: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2065: placed in <code xmlns=
2066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2067: "filename">/etc/mk.conf.example</code> file when
2068: you use the bootstrap script.</p>
1.1 grant 2069: </li>
2070: </ol>
2071: </div>
2072: </div>
2073:
2074: <div class="sect2" lang="en" xml:lang="en">
2075: <div class="titlepage">
2076: <div>
2077: <div>
1.30 wiz 2078: <h3 class="title"><a name="interix" id=
2079: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2080: </div>
2081: </div>
2082: </div>
2083:
2084: <p>Interix is a POSIX compatible subsystem for the
2085: Windows NT kernel, providing a Unix-like environment
2086: with a tighter kernel integration than available with
2087: Cygwin. It is part of the Windows Services for Unix
2088: package, available for free for any licensed copy of
1.22 tv 2089: Windows 2000, XP (not including XP Home), or 2003. SFU
2090: can be downloaded from <a href=
2091: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2092: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2093:
2094: <p>Services for Unix 3.5, current as of this writing,
2095: has been tested. 3.0 or 3.1 may work, but are not
2096: officially supported. (The main difference in 3.0/3.1
2097: is lack of pthreads.)</p>
2098:
2099: <div class="sect3" lang="en" xml:lang="en">
2100: <div class="titlepage">
2101: <div>
2102: <div>
2103: <h4 class="title"><a name=
2104: "platform.interix-sfu-install" id=
2105: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2106: installing Interix/SFU</h4>
1.1 grant 2107: </div>
2108: </div>
2109: </div>
2110:
2111: <p>At an absolute minimum, the following packages
2112: must be installed from the Windows Services for Unix
2113: 3.5 distribution in order to use pkgsrc:</p>
2114:
2115: <div class="itemizedlist">
2116: <ul type="disc">
2117: <li>
2118: <p>Utilities -> Base Utilities</p>
2119: </li>
2120:
2121: <li>
2122: <p>Interix GNU Components -> (all)</p>
2123: </li>
2124:
2125: <li>
2126: <p>Remote Connectivity</p>
2127: </li>
2128:
2129: <li>
2130: <p>Interix SDK</p>
2131: </li>
2132: </ul>
2133: </div>
2134:
2135: <p>When using pkgsrc on Interix, DO NOT install the
2136: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2137: without shared module support, installed to
2138: /usr/local, and will only cause confusion. Instead,
2139: install Perl 5.8 from pkgsrc (or from a binary
2140: package).</p>
2141:
2142: <p>The Remote Connectivity subcomponent "Windows
2143: Remote Shell Service" does not need to be installed,
2144: but Remote Connectivity itself should be installed in
2145: order to have a working inetd.</p>
2146:
2147: <p>Finally, during installation you may be asked
2148: whether to enable setuid behavior for Interix
2149: programs, and whether to make pathnames default to
2150: case-sensitive. Setuid should be enabled, and
2151: case-sensitivity MUST be enabled. (Without
2152: case-sensitivity, a large number of packages
2153: including perl will not build.)</p>
2154: </div>
2155:
2156: <div class="sect3" lang="en" xml:lang="en">
2157: <div class="titlepage">
2158: <div>
2159: <div>
2160: <h4 class="title"><a name=
2161: "platform.interix-sfu-postinstall" id=
2162: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2163: to do if Interix/SFU is already installed</h4>
2164: </div>
2165: </div>
2166: </div>
2167:
2168: <p>If SFU is already installed and you wish to alter
2169: these settings to work with pkgsrc, note the
2170: following things.</p>
2171:
2172: <div class="itemizedlist">
2173: <ul type="disc">
2174: <li>
2175: <p>To uninstall UNIX Perl, use Add/Remove
2176: Programs, select Microsoft Windows Services for
2177: UNIX, then click Change. In the installer,
2178: choose Add or Remove, then uncheck
2179: Utilities->UNIX Perl.</p>
2180: </li>
2181:
2182: <li>
2183: <p>To enable case-sensitivity for the
2184: filesystem, run REGEDIT.EXE, and change the
2185: following registry key:</p>
2186:
2187: <p>
2188: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2189: Manager\kernel</p>
2190:
2191: <p>Set the DWORD value "obcaseinsensitive" to
2192: 0; then reboot.</p>
2193: </li>
2194:
2195: <li>
2196: <p>To enable setuid binaries (optional), run
2197: REGEDIT.EXE, and change the following registry
2198: key:</p>
2199:
2200: <p>
2201: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2202: for UNIX</p>
2203:
2204: <p>Set the DWORD value "EnableSetuidBinaries"
2205: to 1; then reboot.</p>
2206: </li>
2207: </ul>
2208: </div>
2209: </div>
2210:
2211: <div class="sect3" lang="en" xml:lang="en">
2212: <div class="titlepage">
2213: <div>
2214: <div>
2215: <h4 class="title"><a name=
2216: "platform.interix-notes" id=
2217: "platform.interix-notes"></a>3.2.3.3. Important
2218: notes for using pkgsrc</h4>
2219: </div>
2220: </div>
2221: </div>
2222:
2223: <p>The package imanager (either the pkgsrc "su" user,
2224: or the user running "pkg_add") must be a member of
2225: the local Administrators group. Such a user must also
2226: be used to run the bootstrap. This is slightly
2227: relaxed from the normal pkgsrc requirement of
2228: "root".</p>
2229:
2230: <p>The package manager should use a umask of 002.
2231: "make install" will automatically complain if this is
2232: not the case. This ensures that directories written
2233: in /var/db/pkg are Administrators-group
2234: writeable.</p>
2235:
2236: <p>The popular Interix binary packages from
2237: http://www.interopsystems.com/ use an older version
2238: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2239: used in conjunction with pkgsrc. If you choose to use
2240: them at the same time as the pkgsrc packages, ensure
2241: that you use the proper pkg_* tools for each type of
2242: binary package.</p>
1.22 tv 2243:
2244: <p>The TERM setting used for DOS-type console windows
2245: (including those invoked by the csh and ksh startup
2246: shortcuts) is "interix". Most systems don't have a
2247: termcap/terminfo entry for it, but the following
2248: .termcap entry provides adequate emulation in most
2249: cases:</p>
2250: <pre class="programlisting">
2251: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2252: </pre>
1.1 grant 2253: </div>
2254: </div>
2255:
2256: <div class="sect2" lang="en" xml:lang="en">
2257: <div class="titlepage">
2258: <div>
2259: <div>
1.30 wiz 2260: <h3 class="title"><a name="irix" id=
2261: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2262: </div>
2263: </div>
2264: </div>
2265:
2266: <p>You will need a working C compiler, either gcc or
2267: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2268: the <code class="varname">CC</code> environment
2269: variable according to your preference. If you do not
2270: have a license for the MIPSpro compiler suite, you can
1.1 grant 2271: download a gcc tardist file from <a href=
2272: "http://freeware.sgi.com/" target=
2273: "_top">http://freeware.sgi.com/</a>.</p>
2274:
2275: <p>Please note that you will need IRIX 6.5.17 or
2276: higher, as this is the earliest version of IRIX
1.24 wiz 2277: providing support for <a href=
2278: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2279: <span class="citerefentry"><span class=
2280: "refentrytitle">if_indextoname</span>(3)</span></a>,
2281: <a href=
2282: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2283: <span class="citerefentry"><span class=
2284: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2285: etc.</p>
1.1 grant 2286:
1.27 rillig 2287: <p>At this point in time, pkgsrc only supports one ABI
2288: at a time. That is, you can not switch between the old
2289: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2290: you start out using "abi=n32", that's what all your
2291: packages will be built with.</p>
1.1 grant 2292:
2293: <p>Therefore, please make sure that you have no
1.14 xtraeme 2294: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2295: environment or the <code xmlns=
2296: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2297: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2298: that you do not try to link n32 object files with lib64
1.45 wiz 2299: or vice versa. Check your <code xmlns=
2300: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2301: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2302:
2303: <p>If you have the actual pkgsrc tree mounted via NFS
2304: from a different host, please make sure to set
1.14 xtraeme 2305: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2306: directory, as it appears that IRIX linker occasionally
2307: runs into issues when trying to link over a network
2308: mounted filesystem.</p>
2309:
2310: <p>The bootstrapping process should set all the right
2311: options for programs such as imake(1), but you may want
2312: to set some options depending on your local setup.
1.45 wiz 2313: Please see <code xmlns=
2314: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2315: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2316: course, your compiler's man pages for details.</p>
1.22 tv 2317:
2318: <p>If you are using SGI's MIPSPro compiler, please
2319: set</p>
2320: <pre class="programlisting">
2321: PKGSRC_COMPILER=mipspro
2322: </pre>
2323:
1.45 wiz 2324: <p>in <code xmlns=
2325: "http://www.w3.org/TR/xhtml1/transitional" class=
2326: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2327: assume you are using gcc and may end up passing invalid
2328: flags to the compiler. Note that bootstrap should
2329: create an appropriate <code xmlns=
2330: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2331: "filename">mk.conf.example</code> by default.</p>
2332:
2333: <p>If you have both the MIPSPro compiler chain
2334: installed as well as gcc, but want to make sure that
2335: MIPRPro is used, please set your <code class=
2336: "varname">PATH</code> to <span class=
2337: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2338: gcc (often <code xmlns=
2339: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2340: "filename">/usr/freeware/bin</code>), and (important)
2341: pass the '--preserve-path' flag.</p>
1.1 grant 2342: </div>
2343:
2344: <div class="sect2" lang="en" xml:lang="en">
2345: <div class="titlepage">
2346: <div>
2347: <div>
1.30 wiz 2348: <h3 class="title"><a name="linux" id=
2349: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2350: </div>
2351: </div>
2352: </div>
2353:
2354: <p>Some versions of Linux (for example Debian
2355: GNU/Linux) need either libtermcap or libcurses
2356: (libncurses). Installing the distributions
2357: libncurses-dev package (or equivalent) should fix the
2358: problem.</p>
2359:
2360: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2361: and icc (Intel C++ Compiler). gcc is the default. icc
2362: 8.0 and 8.1 on i386 have been tested.</p>
2363:
2364: <p>To bootstrap using icc, assuming the default icc
2365: installation directory:</p>
2366: <pre class="programlisting">
2367: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2368: ac_cv___attribute__=yes ./bootstrap
2369: </pre>
2370:
2371: <div class="note" style=
2372: "margin-left: 0.5in; margin-right: 0.5in;">
2373: <h3 class="title">Note</h3>
2374:
2375: <p>icc 8.1 needs the `-i-static' argument instead of
2376: -static-libcxa.</p>
2377: </div>
2378:
2379: <p>icc supports __attribute__, but the GNU configure
2380: test uses a nested function, which icc does not
2381: support. #undef'ing __attribute__ has the unfortunate
2382: side-effect of breaking many of the Linux header files,
2383: which cannot be compiled properly without
2384: __attribute__. The test must be overridden so that
2385: __attribute__ is assumed supported by the compiler.</p>
2386:
2387: <p>After bootstrapping, you should set <code class=
1.45 wiz 2388: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2389: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2390: "filename">/etc/mk.conf</code>:</p>
2391: <pre class="programlisting">
2392: PKGSRC_COMPILER=icc
2393: </pre>
2394:
2395: <p>The default installation directory for icc is
1.45 wiz 2396: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2397: class="filename">/opt/intel_cc_80</code>, which is also
2398: the pkgsrc default. If you have installed it into a
2399: different directory, set <code class=
2400: "varname">ICCBASE</code> in <code xmlns=
2401: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2402: "filename">/etc/mk.conf</code>:</p>
2403: <pre class="programlisting">
2404: ICCBASE=/opt/icc
2405: </pre>
2406:
2407: <p>pkgsrc uses the static linking method of the runtime
2408: libraries provided by icc, so binaries can be run on
2409: other systems which do not have the shared libraries
2410: installed.</p>
2411:
2412: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2413: the <a href=
2414: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2415: <span class="citerefentry"><span class=
2416: "refentrytitle">ld</span>(1)</span></a> command run
2417: when linking a C++ shared library and records it,
2418: throwing away the -Bstatic and -Bdynamic options
2419: interspersed between the libraries. This means that
2420: libtool-linked C++ shared libraries will have a runtime
2421: dependency on the icc libraries until this is fixed in
2422: libtool.</p>
1.22 tv 2423: </div>
2424:
2425: <div class="sect2" lang="en" xml:lang="en">
2426: <div class="titlepage">
2427: <div>
2428: <div>
1.30 wiz 2429: <h3 class="title"><a name="openbsd" id=
2430: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2431: </div>
2432: </div>
2433: </div>
2434:
2435: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2436:
2437: <p>Care should be taken so that the tools that this kit
2438: installs do not conflict with the OpenBSD userland
2439: tools. There are several steps:</p>
2440:
2441: <div class="orderedlist">
2442: <ol type="1">
2443: <li>
2444: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2445: <code xmlns=
2446: "http://www.w3.org/TR/xhtml1/transitional" class=
2447: "filename">/var/db/pkg</code>. It is therefore
2448: recommended that you choose a different location
2449: (e.g. <code xmlns=
2450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2451: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2452: --pkgdbdir option to the bootstrap script.</p>
2453: </li>
2454:
2455: <li>
2456: <p>If you do not intend to use the OpenBSD ports
2457: tools, it's probably a good idea to move them out
2458: of the way to avoid confusion, e.g.</p>
2459: <pre class="screen">
1.14 xtraeme 2460: <code class="prompt">#</code> <strong class=
2461: "userinput"><code>cd /usr/sbin</code></strong>
2462: <code class="prompt">#</code> <strong class=
2463: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2464: <code class="prompt">#</code> <strong class=
2465: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2466: <code class="prompt">#</code> <strong class=
2467: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2468: <code class="prompt">#</code> <strong class=
2469: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2470: </pre>
2471: </li>
2472:
2473: <li>
1.45 wiz 2474: <p>An example <code xmlns=
2475: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2476: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2477: placed in <code xmlns=
2478: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2479: "filename">/etc/mk.conf.example</code> file when
2480: you use the bootstrap script. OpenBSD's make
1.45 wiz 2481: program uses <code xmlns=
2482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2483: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2484: work around this by enclosing all the pkgsrc
2485: specific parts of the file with:</p>
2486: <pre class="programlisting">
2487: .ifdef BSD_PKG_MK
1.11 ben 2488: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2489: .else
2490: # OpenBSD stuff
2491: .endif
2492: </pre>
2493: </li>
2494: </ol>
2495: </div>
2496: </div>
2497:
2498: <div class="sect2" lang="en" xml:lang="en">
2499: <div class="titlepage">
2500: <div>
2501: <div>
1.30 wiz 2502: <h3 class="title"><a name="solaris" id=
2503: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2504: </div>
2505: </div>
2506: </div>
2507:
2508: <p>Solaris 2.6 through 9 are supported on both x86 and
2509: sparc. You will need a working C compiler. Both gcc
2510: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2511:
2512: <p>The following packages are required on Solaris 8 for
2513: the bootstrap process and to build packages.</p>
2514:
2515: <div class="itemizedlist">
2516: <ul type="disc">
2517: <li>
2518: <p>SUNWsprot</p>
2519: </li>
2520:
2521: <li>
2522: <p>SUNWarc</p>
2523: </li>
2524:
2525: <li>
2526: <p>SUNWbtool</p>
2527: </li>
2528:
2529: <li>
2530: <p>SUNWtoo</p>
2531: </li>
2532:
2533: <li>
2534: <p>SUNWlibm</p>
2535: </li>
2536: </ul>
2537: </div>
2538:
2539: <p>Please note the use of GNU binutils on Solaris is
2540: <span class="emphasis"><em>not</em></span>
2541: supported.</p>
2542:
2543: <div class="sect3" lang="en" xml:lang="en">
2544: <div class="titlepage">
2545: <div>
2546: <div>
1.30 wiz 2547: <h4 class="title"><a name="solaris-gcc-note"
2548: id="solaris-gcc-note"></a>3.2.7.1. If you
2549: are using gcc</h4>
1.1 grant 2550: </div>
2551: </div>
2552: </div>
2553:
2554: <p>It makes life much simpler if you only use the
2555: same gcc consistently for building all packages.</p>
2556:
2557: <p>It is recommended that an external gcc be used
2558: only for bootstrapping, then either build gcc from
2559: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2560: href=
2561: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2562: target="_top"><code xmlns="" class=
2563: "filename">lang/gcc</code></a> or install a binary
2564: gcc package, then remove gcc used during
1.20 ben 2565: bootstrapping.</p>
1.1 grant 2566:
2567: <p>Binary packages of gcc can be found through
2568: <a href=
2569: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2570: target=
2571: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2572: </div>
2573:
2574: <div class="sect3" lang="en" xml:lang="en">
2575: <div class="titlepage">
2576: <div>
2577: <div>
1.30 wiz 2578: <h4 class="title"><a name=
2579: "solaris-sun-workshop-note" id=
2580: "solaris-sun-workshop-note"></a>3.2.7.2. If
2581: you are using Sun WorkShop</h4>
1.1 grant 2582: </div>
2583: </div>
2584: </div>
2585:
2586: <p>You will need at least the following packages
2587: installed (from WorkShop 5.0)</p>
2588:
2589: <div class="itemizedlist">
2590: <ul type="disc">
2591: <li>
2592: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2593: </li>
2594:
2595: <li>
2596: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2597: </li>
2598:
2599: <li>
2600: <p>SPROild - Sun WorkShop Incremental
2601: Linker</p>
2602: </li>
2603:
2604: <li>
2605: <p>SPROlang - Sun WorkShop Compilers common
2606: components</p>
2607: </li>
2608: </ul>
2609: </div>
2610:
1.14 xtraeme 2611: <p>You should set <code class="varname">CC</code>,
2612: <code class="varname">CXX</code> and optionally,
1.45 wiz 2613: <code class="varname">CPP</code> in <code xmlns=
2614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2615: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2616: <pre class="programlisting">
1.27 rillig 2617: CC= cc
1.1 grant 2618: CXX= CC
2619: CPP= /usr/ccs/lib/cpp
2620: </pre>
2621:
2622: <p>You may also want to build 64-bit binaries,
2623: eg.</p>
2624: <pre class="programlisting">
2625: CFLAGS= -xtarget=ultra -xarch=v9
2626: </pre>
2627:
2628: <p>Whichever compiler you use, please ensure the
2629: compiler tools and your $prefix are in your
1.14 xtraeme 2630: <code class="varname">PATH</code>. This includes
1.45 wiz 2631: <code xmlns=
2632: "http://www.w3.org/TR/xhtml1/transitional" class=
2633: "filename">/usr/ccs/{bin,lib}</code> and eg.
2634: <code xmlns=
2635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2636: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2637: </div>
2638: </div>
2639: </div>
2640: </div>
2641:
2642: <div class="chapter" lang="en" xml:lang="en">
2643: <div class="titlepage">
2644: <div>
2645: <div>
2646: <h2 class="title"><a name="using" id=
2647: "using"></a>Chapter 4. Using pkgsrc</h2>
2648: </div>
2649: </div>
2650: </div>
2651:
2652: <div class="toc">
2653: <p><b>Table of Contents</b></p>
2654:
2655: <dl>
2656: <dt><span class="sect1"><a href="#getting-started">4.1.
2657: Working with binary packages</a></span></dt>
2658:
2659: <dd>
2660: <dl>
1.30 wiz 2661: <dt><span class="sect2"><a href=
2662: "#where-to-get-binary-packages">4.1.1. Where to get
2663: binary packages</a></span></dt>
1.1 grant 2664:
1.30 wiz 2665: <dt><span class="sect2"><a href=
2666: "#how-to-use-binary-packages">4.1.2. How to use
2667: binary packages</a></span></dt>
1.1 grant 2668:
1.30 wiz 2669: <dt><span class="sect2"><a href=
2670: "#a-word-of-warning">4.1.3. A word of
2671: warning</a></span></dt>
1.1 grant 2672: </dl>
2673: </dd>
2674:
1.30 wiz 2675: <dt><span class="sect1"><a href=
2676: "#building-packages-from-source">4.2. Building packages
2677: from source</a></span></dt>
1.1 grant 2678:
2679: <dd>
2680: <dl>
1.30 wiz 2681: <dt><span class="sect2"><a href=
2682: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2683:
1.30 wiz 2684: <dt><span class="sect2"><a href=
2685: "#fetching-distfiles">4.2.2. Fetching
2686: distfiles</a></span></dt>
1.1 grant 2687:
1.30 wiz 2688: <dt><span class="sect2"><a href=
2689: "#how-to-build-and-install">4.2.3. How to build and
2690: install</a></span></dt>
1.1 grant 2691:
1.30 wiz 2692: <dt><span class="sect2"><a href=
2693: "#selecting-the-compiler">4.2.4. Selecting the
2694: compiler</a></span></dt>
1.1 grant 2695: </dl>
2696: </dd>
2697: </dl>
2698: </div>
2699:
2700: <div class="sect1" lang="en" xml:lang="en">
2701: <div class="titlepage">
2702: <div>
2703: <div>
2704: <h2 class="title" style="clear: both"><a name=
2705: "getting-started" id=
2706: "getting-started"></a>4.1. Working with binary
2707: packages</h2>
2708: </div>
2709: </div>
2710: </div>
2711:
2712: <p>This section describes how to find, retrieve and
2713: install a precompiled binary package that someone else
2714: already prepared for your type of machine.</p>
2715:
2716: <div class="sect2" lang="en" xml:lang="en">
2717: <div class="titlepage">
2718: <div>
2719: <div>
1.30 wiz 2720: <h3 class="title"><a name=
2721: "where-to-get-binary-packages" id=
2722: "where-to-get-binary-packages"></a>4.1.1. Where
2723: to get binary packages</h3>
1.1 grant 2724: </div>
2725: </div>
2726: </div>
2727:
2728: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2729: and its mirrors in the directory <code xmlns=
2730: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2731: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2732: for anonymous FTP access. <code class=
2733: "varname">OSVERSION</code> is the NetBSD version
2734: (<span><strong class="command">uname
2735: -r</strong></span>), <code class="varname">ARCH</code>
2736: is the architecture (<span><strong class=
2737: "command">uname -p</strong></span>). In that directory,
2738: there is a subdirectory for each category plus a
1.45 wiz 2739: subdirectory <code xmlns=
2740: "http://www.w3.org/TR/xhtml1/transitional" class=
2741: "filename">All</code> which includes the actual
2742: binaries in <code xmlns=
2743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2744: "filename">.tgz</code> files. The category
2745: subdirectories use symbolic links to those files (this
1.45 wiz 2746: is the same directory layout as in <code xmlns=
2747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2748: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2749:
2750: <p>This same directory layout applies for CDROM
2751: distributions, only that the directory may be rooted
1.45 wiz 2752: somewhere else, probably somewhere below <code xmlns=
2753: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2754: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2755: documentation for the exact location.</p>
2756: </div>
2757:
2758: <div class="sect2" lang="en" xml:lang="en">
2759: <div class="titlepage">
2760: <div>
2761: <div>
1.30 wiz 2762: <h3 class="title"><a name=
2763: "how-to-use-binary-packages" id=
2764: "how-to-use-binary-packages"></a>4.1.2. How
2765: to use binary packages</h3>
1.1 grant 2766: </div>
2767: </div>
2768: </div>
2769:
2770: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2771: to your hard disk, you can install them with the
1.27 rillig 2772: following command (be sure to <span><strong class=
1.14 xtraeme 2773: "command">su</strong></span> to root first):</p>
1.1 grant 2774: <pre class="screen">
1.14 xtraeme 2775: <code class="prompt">#</code> <strong class=
2776: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2777: </pre>
2778:
2779: <p>If you have FTP access and you don't want to
2780: download the packages via FTP prior to installation,
1.14 xtraeme 2781: you can do this automatically by giving
2782: <span><strong class="command">pkg_add</strong></span>
2783: an FTP URL:</p>
1.1 grant 2784: <pre class="screen">
1.14 xtraeme 2785: <code class="prompt">#</code> <strong class=
1.27 rillig 2786: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2787: </pre>
2788:
1.27 rillig 2789: <p>Note that any prerequisite packages needed to run
2790: the package in question will be installed, too,
1.1 grant 2791: assuming they are present where you install from.</p>
2792:
1.23 wiz 2793: <p>To save some typing, you can set the <code class=
2794: "varname">PKG_PATH</code> environment variable to a
2795: semicolon separated list of paths (including remote
2796: URLs); trailing slashes are not allowed.</p>
2797:
1.45 wiz 2798: <p>Additionally to the <code xmlns=
2799: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 2800: "filename">All</code> directory there exists a
1.45 wiz 2801: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2802: class="filename">vulnerable</code> directory to which
2803: binary packages with known vulnerabilities are moved,
2804: since removing them could cause missing dependencies.
2805: To use these packages, add the <code xmlns=
2806: "http://www.w3.org/TR/xhtml1/transitional" class=
2807: "filename">vulnerable</code> directory to your
2808: <code class="varname">PKG_PATH</code>. However, you
2809: should run <a xmlns=
1.23 wiz 2810: "http://www.w3.org/TR/xhtml1/transitional" href=
2811: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 2812: target="_top"><code xmlns="" class=
2813: "filename">security/audit-packages</code></a>
2814: regularly, and especially after installing new
2815: packages, and verify that the vulnerabilities are
2816: acceptable for your configuration. An example
2817: <code class="varname">PKG_PATH</code> would be:
2818: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2819: class=
1.27 rillig 2820: "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 2821: Please note that semicolon (';') is a shell
2822: meta-character, so you'll probably have to quote
2823: it.</p>
2824:
1.1 grant 2825: <p>After you've installed packages, be sure to have
1.45 wiz 2826: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2827: class="filename">/usr/pkg/bin</code> and <code xmlns=
2828: "http://www.w3.org/TR/xhtml1/transitional" class=
2829: "filename">/usr/pkg/sbin</code> in your <code class=
2830: "varname">PATH</code> so you can actually start the
2831: just installed program.</p>
1.1 grant 2832: </div>
2833:
2834: <div class="sect2" lang="en" xml:lang="en">
2835: <div class="titlepage">
2836: <div>
2837: <div>
1.30 wiz 2838: <h3 class="title"><a name="a-word-of-warning" id=
2839: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2840: warning</h3>
2841: </div>
2842: </div>
2843: </div>
2844:
2845: <p>Please pay very careful attention to the warnings
2846: expressed in the <a href=
2847: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2848: <span class="citerefentry"><span class=
2849: "refentrytitle">pkg_add</span>(1)</span></a> manual
2850: page about the inherent dangers of installing binary
2851: packages which you did not create yourself, and the
2852: security holes that can be introduced onto your system
2853: by indiscriminate adding of such files.</p>
2854: </div>
2855: </div>
2856:
2857: <div class="sect1" lang="en" xml:lang="en">
2858: <div class="titlepage">
2859: <div>
2860: <div>
2861: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2862: "building-packages-from-source" id=
2863: "building-packages-from-source"></a>4.2. Building
1.1 grant 2864: packages from source</h2>
2865: </div>
2866: </div>
2867: </div>
2868:
2869: <p>This assumes that the package is already in pkgsrc. If
2870: it is not, see <a href="#developers-guide" title=
1.46 ! gdt 2871: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2872: “The pkgsrc developer's guide”</a> for
2873: instructions how to create your own packages.</p>
1.1 grant 2874:
2875: <div class="sect2" lang="en" xml:lang="en">
2876: <div class="titlepage">
2877: <div>
2878: <div>
1.30 wiz 2879: <h3 class="title"><a name="requirements" id=
2880: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2881: </div>
2882: </div>
2883: </div>
2884:
2885: <p>To build packages from source on a NetBSD system the
2886: “<span class="quote">comp</span>” and the
2887: “<span class="quote">text</span>”
2888: distribution sets must be installed. If you want to
2889: build X11 related packages the “<span class=
2890: "quote">xbase</span>” and “<span class=
2891: "quote">xcomp</span>” distribution sets are
2892: required, too.</p>
2893: </div>
2894:
2895: <div class="sect2" lang="en" xml:lang="en">
2896: <div class="titlepage">
2897: <div>
2898: <div>
1.30 wiz 2899: <h3 class="title"><a name="fetching-distfiles"
2900: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2901: distfiles</h3>
2902: </div>
2903: </div>
2904: </div>
2905:
1.27 rillig 2906: <p>The first step for building a package is downloading
2907: the distfiles (i.e. the unmodified source). If they
2908: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2909: automatically.</p>
2910:
2911: <p>You can overwrite some of the major distribution
2912: sites to fit to sites that are close to your own. Have
1.45 wiz 2913: a look at <code xmlns=
2914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2915: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2916: some examples — in particular, look for the
1.14 xtraeme 2917: <code class="varname">MASTER_SORT</code>, <code class=
2918: "varname">MASTER_SORT_REGEX</code> and <code class=
2919: "varname">INET_COUNTRY</code> definitions. This may
2920: save some of your bandwidth and time.</p>
1.1 grant 2921:
2922: <p>You can change these settings either in your shell's
2923: environment, or, if you want to keep the settings, by
1.45 wiz 2924: editing the <code xmlns=
2925: "http://www.w3.org/TR/xhtml1/transitional" class=
2926: "filename">/etc/mk.conf</code> file, and adding the
2927: definitions there.</p>
1.1 grant 2928:
2929: <p>If you don't have a permanent Internet connection
2930: and you want to know which files to download,
1.14 xtraeme 2931: <span><strong class="command">make
2932: fetch-list</strong></span> will tell you what you'll
1.45 wiz 2933: need. Put these distfiles into <code xmlns=
2934: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2935: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2936: </div>
2937:
2938: <div class="sect2" lang="en" xml:lang="en">
2939: <div class="titlepage">
2940: <div>
2941: <div>
1.30 wiz 2942: <h3 class="title"><a name=
2943: "how-to-build-and-install" id=
2944: "how-to-build-and-install"></a>4.2.3. How to
2945: build and install</h3>
1.1 grant 2946: </div>
2947: </div>
2948: </div>
2949:
2950: <p>Assuming that the distfile has been fetched (see
2951: previous section), become root and change into the
1.14 xtraeme 2952: relevant directory and running <span><strong class=
2953: "command">make</strong></span>. For example, type</p>
1.1 grant 2954: <pre class="screen">
1.14 xtraeme 2955: <code class="prompt">%</code> <strong class=
2956: "userinput"><code>cd misc/figlet</code></strong>
2957: <code class="prompt">%</code> <strong class=
2958: "userinput"><code>make</code></strong>
1.1 grant 2959: </pre>
2960:
2961: <p>at the shell prompt to build the various components
2962: of the package, and</p>
2963: <pre class="screen">
1.14 xtraeme 2964: <code class="prompt">#</code> <strong class=
2965: "userinput"><code>make install</code></strong>
1.1 grant 2966: </pre>
2967:
2968: <p>to install the various components into the correct
2969: places on your system. Installing the package on your
2970: system requires you to be root. However, pkgsrc has a
2971: <span class="emphasis"><em>just-in-time-su</em></span>
2972: feature, which allows you to only become root for the
2973: actual installation step</p>
2974:
2975: <p>Taking the figlet utility as an example, we can
2976: install it on our system by building as shown in
2977: <a href="#logs" title=
1.46 ! gdt 2978: "Appendix B. Build logs">Appendix B, <i>Build
1.1 grant 2979: logs</i></a>.</p>
2980:
2981: <p>The program is installed under the default root of
1.45 wiz 2982: the packages tree - <code xmlns=
2983: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2984: "filename">/usr/pkg</code>. Should this not conform to
2985: your tastes, set the <code class=
2986: "varname">LOCALBASE</code> variable in your
1.1 grant 2987: environment, and it will use that value as the root of
1.45 wiz 2988: your packages tree. So, to use <code xmlns=
2989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2990: "filename">/usr/local</code>, set <code class=
2991: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2992: environment. Please note that you should use a
2993: directory which is dedicated to packages and not shared
1.14 xtraeme 2994: with other programs (ie, do not try and use
2995: <code class="varname">LOCALBASE=/usr</code>). Also, you
2996: should not try to add any of your own files or
1.45 wiz 2997: directories (such as <code xmlns=
2998: "http://www.w3.org/TR/xhtml1/transitional" class=
2999: "filename">src/</code>, <code xmlns=
3000: "http://www.w3.org/TR/xhtml1/transitional" class=
3001: "filename">obj/</code>, or <code xmlns=
3002: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3003: "filename">pkgsrc/</code>) below the <code class=
3004: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3005: possible conflicts between programs and other files
3006: installed by the package system and whatever else may
3007: have been installed there.</p>
3008:
1.45 wiz 3009: <p>Some packages look in <code xmlns=
3010: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3011: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3012: configuration options at build time. Have a look at
1.45 wiz 3013: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3014: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3015: get an overview of what will be set there by default.
1.14 xtraeme 3016: Environment variables such as <code class=
1.45 wiz 3017: "varname">LOCALBASE</code> can be set in <code xmlns=
3018: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3019: "filename">/etc/mk.conf</code> to save having to
3020: remember to set them each time you want to use
3021: pkgsrc.</p>
1.1 grant 3022:
3023: <p>Occasionally, people want to “<span class=
3024: "quote">look under the covers</span>” to see what
3025: is going on when a package is building or being
3026: installed. This may be for debugging purposes, or out
3027: of simple curiosity. A number of utility values have
3028: been added to help with this.</p>
3029:
3030: <div class="orderedlist">
3031: <ol type="1">
3032: <li>
3033: <p>If you invoke the <a href=
3034: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3035: <span class="citerefentry"><span class=
3036: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3037: with <code class=
3038: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3039: amount of information will be displayed. For
3040: example,</p>
1.1 grant 3041: <pre class="screen">
1.14 xtraeme 3042: <strong class=
3043: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3044: </pre>
3045:
3046: <p>will show all the commands that are invoked,
3047: up to and including the “<span class=
3048: "quote">patch</span>” stage.</p>
3049: </li>
3050:
3051: <li>
3052: <p>If you want to know the value of a certain
1.22 tv 3053: <a href=
3054: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3055: <span class="citerefentry"><span class=
3056: "refentrytitle">make</span>(1)</span></a>
3057: definition, then the <code class=
1.14 xtraeme 3058: "varname">VARNAME</code> definition should be
3059: used, in conjunction with the show-var target.
3060: e.g. to show the expansion of the <a href=
1.1 grant 3061: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3062: <span class="citerefentry"><span class=
3063: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3064: variable <code class=
1.22 tv 3065: "varname">LOCALBASE</code>:</p>
1.1 grant 3066: <pre class="screen">
1.14 xtraeme 3067: <code class="prompt">%</code> <strong class=
3068: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3069: /usr/pkg
1.14 xtraeme 3070: <code class="prompt">%</code>
1.1 grant 3071:
3072: </pre>
3073: </li>
3074: </ol>
3075: </div>
3076:
3077: <p>If you want to install a binary package that you've
3078: either created yourself (see next section), that you
3079: put into pkgsrc/packages manually or that is located on
1.8 wiz 3080: a remote FTP server, you can use the "bin-install"
1.1 grant 3081: target. This target will install a binary package - if
3082: available - via <a href=
3083: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3084: <span class="citerefentry"><span class=
3085: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3086: <span><strong class="command">make
3087: package</strong></span>. The list of remote FTP sites
3088: searched is kept in the variable <code class=
3089: "varname">BINPKG_SITES</code>, which defaults to
3090: ftp.NetBSD.org. Any flags that should be added to
3091: <a href=
1.1 grant 3092: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3093: <span class="citerefentry"><span class=
3094: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3095: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3096: See <code xmlns=
3097: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3098: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3099: details.</p>
1.1 grant 3100:
3101: <p>A final word of warning: If you setup a system that
1.14 xtraeme 3102: has a non-standard setting for <code class=
3103: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3104: any packages are installed, as you can not use several
3105: directories for the same purpose. Doing so will result
3106: in pkgsrc not being able to properly detect your
3107: installed packages, and fail miserably. Note also that
3108: precompiled binary packages are usually built with the
1.14 xtraeme 3109: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3110: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3111: class="filename">/usr/pkg</code>, and that you should
3112: <span class="emphasis"><em>not</em></span> install any
3113: if you use a non-standard <code class=
1.14 xtraeme 3114: "varname">LOCALBASE</code>.</p>
1.1 grant 3115: </div>
3116:
3117: <div class="sect2" lang="en" xml:lang="en">
3118: <div class="titlepage">
3119: <div>
3120: <div>
1.30 wiz 3121: <h3 class="title"><a name=
3122: "selecting-the-compiler" id=
3123: "selecting-the-compiler"></a>4.2.4. Selecting
3124: the compiler</h3>
1.1 grant 3125: </div>
3126: </div>
3127: </div>
3128:
3129: <p>By default, pkgsrc will use GCC to build packages.
3130: This may be overridden by setting the following
3131: variables in /etc/mk.conf:</p>
3132:
3133: <div class="variablelist">
3134: <dl>
1.14 xtraeme 3135: <dt><span class="term"><code class=
3136: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3137:
3138: <dd>
3139: <p>This is a list of values specifying the chain
3140: of compilers to invoke when building packages.
3141: Valid values are:</p>
3142:
3143: <div class="itemizedlist">
3144: <ul type="disc">
3145: <li>
1.14 xtraeme 3146: <p><code class="varname">distcc</code>:
1.1 grant 3147: distributed C/C++ (chainable)</p>
3148: </li>
3149:
3150: <li>
1.14 xtraeme 3151: <p><code class="varname">ccache</code>:
1.1 grant 3152: compiler cache (chainable)</p>
3153: </li>
3154:
3155: <li>
1.14 xtraeme 3156: <p><code class="varname">gcc</code>: GNU
3157: C/C++ Compiler</p>
1.1 grant 3158: </li>
3159:
3160: <li>
1.14 xtraeme 3161: <p><code class="varname">mipspro</code>:
1.1 grant 3162: Silicon Graphics, Inc. MIPSpro
3163: (n32/n64)</p>
3164: </li>
3165:
3166: <li>
1.14 xtraeme 3167: <p><code class="varname">mipspro</code>:
1.1 grant 3168: Silicon Graphics, Inc. MIPSpro (o32)</p>
3169: </li>
3170:
3171: <li>
1.14 xtraeme 3172: <p><code class="varname">sunpro</code>:
1.1 grant 3173: Microsystems, Inc. WorkShip/Forte/Sun ONE
3174: Studio</p>
3175: </li>
3176: </ul>
3177: </div>
3178:
3179: <p>The default is “<span class=
1.14 xtraeme 3180: "quote"><code class=
3181: "varname">gcc</code></span>”. You can use
3182: <code class="varname">ccache</code> and/or
3183: <code class="varname">distcc</code> with an
3184: appropriate <code class=
3185: "varname">PKGSRC_COMPILER</code> setting, e.g.
3186: “<span class="quote"><code class=
3187: "varname">ccache gcc</code></span>”. This
1.1 grant 3188: variable should always be terminated with a value
3189: for a real compiler.</p>
3190: </dd>
3191:
1.14 xtraeme 3192: <dt><span class="term"><code class=
3193: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3194:
3195: <dd>
3196: <p>This specifies the minimum version of GCC to
3197: use when building packages. If the system GCC
3198: doesn't satisfy this requirement, then pkgsrc
3199: will build and install one of the GCC packages to
3200: use instead.</p>
3201: </dd>
3202: </dl>
3203: </div>
3204: </div>
3205: </div>
3206: </div>
3207:
3208: <div class="chapter" lang="en" xml:lang="en">
3209: <div class="titlepage">
3210: <div>
3211: <div>
1.38 dillo 3212: <h2 class="title"><a name="configuring" id=
3213: "configuring"></a>Chapter 5. Configuring
3214: pkgsrc</h2>
3215: </div>
3216: </div>
3217: </div>
3218:
3219: <div class="toc">
3220: <p><b>Table of Contents</b></p>
3221:
3222: <dl>
3223: <dt><span class="sect1"><a href=
1.45 wiz 3224: "#general-configuration">5.1. General
3225: configuration</a></span></dt>
3226:
3227: <dt><span class="sect1"><a href=
3228: "#variables-affecting-build">5.2. Variables affecting
3229: the build process</a></span></dt>
3230:
3231: <dt><span class="sect1"><a href=
3232: "#developer-advanced-settings">5.3. Developer/advanced
3233: settings</a></span></dt>
3234:
3235: <dt><span class="sect1"><a href=
3236: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3237: Options</a></span></dt>
1.38 dillo 3238: </dl>
3239: </div>
3240:
3241: <div class="sect1" lang="en" xml:lang="en">
3242: <div class="titlepage">
3243: <div>
3244: <div>
3245: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3246: "general-configuration" id=
3247: "general-configuration"></a>5.1. General
3248: configuration</h2>
3249: </div>
3250: </div>
3251: </div>
3252:
3253: <p>In this section you can find some variables that apply
3254: all pkgsrc packages. The preferred method of setting them
3255: is by setting them in <code xmlns=
3256: "http://www.w3.org/TR/xhtml1/transitional" class=
3257: "filename">/etc/mk.conf</code>.</p>
3258:
3259: <div class="itemizedlist">
3260: <ul type="disc">
3261: <li>
3262: <p><code class="varname">LOCALBASE</code>: Where
3263: packages will be installed. The default is
3264: <code xmlns=
3265: "http://www.w3.org/TR/xhtml1/transitional" class=
3266: "filename">/usr/pkg</code>. Do not mix binary
3267: packages with different <code class=
3268: "varname">LOCALBASE</code>s!</p>
3269: </li>
3270:
3271: <li>
3272: <p><code class="varname">CROSSBASE</code>: Where
3273: “<span class="quote">cross</span>”
3274: category packages will be installed. The default is
3275: <code xmlns=
3276: "http://www.w3.org/TR/xhtml1/transitional" class=
3277: "filename">${LOCALBASE}/cross</code>.</p>
3278: </li>
3279:
3280: <li>
3281: <p><code class="varname">X11BASE</code>: Where X11
3282: is installed on the system. The default is
3283: <code xmlns=
3284: "http://www.w3.org/TR/xhtml1/transitional" class=
3285: "filename">/usr/X11R6</code>.</p>
3286: </li>
3287:
3288: <li>
3289: <p><code class="varname">DISTDIR</code>: Where to
3290: store the downloaded copies of the original source
3291: distributions used for building pkgsrc packages.
3292: The default is <code xmlns=
3293: "http://www.w3.org/TR/xhtml1/transitional" class=
3294: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3295: </li>
3296:
3297: <li>
3298: <p><code class=
3299: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3300: override the packages' <code class=
3301: "varname">MASTER_SITES</code> with this value.</p>
3302: </li>
3303:
3304: <li>
3305: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3306: Backup location(s) for distribution files and patch
3307: files if not found locally or in <code xmlns=
3308: "http://www.w3.org/TR/xhtml1/transitional" class=
3309: "filename">${MASTER_SITES}</code> or <code xmlns=
3310: "http://www.w3.org/TR/xhtml1/transitional" class=
3311: "filename">${PATCH_SITES}</code> respectively. The
3312: defaults are <code xmlns=
3313: "http://www.w3.org/TR/xhtml1/transitional" class=
3314: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3315: and <code xmlns=
3316: "http://www.w3.org/TR/xhtml1/transitional" class=
3317: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3318: </li>
3319:
3320: <li>
3321: <p><code class="varname">BINPKG_SITES</code>: List
3322: of sites carrying binary pkgs.</p>
3323: </li>
3324: </ul>
3325: </div>
3326: </div>
3327:
3328: <div class="sect1" lang="en" xml:lang="en">
3329: <div class="titlepage">
3330: <div>
3331: <div>
3332: <h2 class="title" style="clear: both"><a name=
3333: "variables-affecting-build" id=
3334: "variables-affecting-build"></a>5.2. Variables
3335: affecting the build process</h2>
3336: </div>
3337: </div>
3338: </div>
3339:
3340: <p>XXX</p>
3341:
3342: <div class="itemizedlist">
3343: <ul type="disc">
3344: <li>
3345: <p><code class="varname">PACKAGES</code>: The top
3346: level directory for the binary packages. The
3347: default is <code xmlns=
3348: "http://www.w3.org/TR/xhtml1/transitional" class=
3349: "filename">${PKGSRCDIR}/packages</code>.</p>
3350: </li>
3351:
3352: <li>
3353: <p><code class="varname">WRKOBJDIR</code>: The top
3354: level directory where, if defined, the separate
3355: working directories will get created, and
3356: symbolically linked to from <code xmlns=
3357: "http://www.w3.org/TR/xhtml1/transitional" class=
3358: "filename">${WRKDIR}</code> (see below). This is
3359: useful for building packages on several
3360: architectures, then <code xmlns=
3361: "http://www.w3.org/TR/xhtml1/transitional" class=
3362: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3363: while <code xmlns=
3364: "http://www.w3.org/TR/xhtml1/transitional" class=
3365: "filename">${WRKOBJDIR}</code> is local to every
3366: architecture. (It should be noted that <code class=
3367: "varname">PKGSRCDIR</code> should not be set by the
3368: user — it is an internal definition which
3369: refers to the root of the pkgsrc tree. It is
3370: possible to have many pkgsrc tree instances.)</p>
3371: </li>
3372:
3373: <li>
3374: <p><code class="varname">LOCALPATCHES</code>:
3375: Directory for local patches that aren't part of
3376: pkgsrc. See <a href="#components.patches" title=
3377: "8.3. patches/*">Section 8.3,
3378: “patches/*”</a> for more information.
3379: <em class="replaceable"><code>rel</code></em> and
3380: <em class="replaceable"><code>arch</code></em> are
3381: replaced with OS release (“<span class=
3382: "quote">2.0</span>”, etc.) and architecture
3383: (“<span class="quote">mipsel</span>”,
3384: etc.).</p>
3385: </li>
3386:
3387: <li>
3388: <p><code class="varname">PKGMAKECONF</code>:
3389: Location of the <code xmlns=
3390: "http://www.w3.org/TR/xhtml1/transitional" class=
3391: "filename">mk.conf</code> file used by a package's
3392: BSD-style Makefile. If this is not set,
3393: <code class="varname">MAKECONF</code> is set to
3394: <code xmlns=
3395: "http://www.w3.org/TR/xhtml1/transitional" class=
3396: "filename">/dev/null</code> to avoid picking up
3397: settings used by builds in <code xmlns=
3398: "http://www.w3.org/TR/xhtml1/transitional" class=
3399: "filename">/usr/src</code>.</p>
3400: </li>
3401: </ul>
3402: </div>
3403: </div>
3404:
3405: <div class="sect1" lang="en" xml:lang="en">
3406: <div class="titlepage">
3407: <div>
3408: <div>
3409: <h2 class="title" style="clear: both"><a name=
3410: "developer-advanced-settings" id=
3411: "developer-advanced-settings"></a>5.3. Developer/advanced
3412: settings</h2>
3413: </div>
3414: </div>
3415: </div>
3416:
3417: <p>XXX</p>
3418:
3419: <div class="itemizedlist">
3420: <ul type="disc">
3421: <li>
3422: <p><code class="varname">PKG_DEVELOPER</code>: Run
3423: some sanity checks that package developers
3424: want:</p>
3425:
3426: <div class="itemizedlist">
3427: <ul type="circle">
3428: <li>
3429: <p>make sure patches apply with zero fuzz</p>
3430: </li>
3431:
3432: <li>
3433: <p>run check-shlibs to see that all binaries
3434: will find their shared libs.</p>
3435: </li>
3436: </ul>
3437: </div>
3438: </li>
3439:
3440: <li>
3441: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3442: The level of debugging output which is displayed
3443: whilst making and installing the package. The
3444: default value for this is 0, which will not display
3445: the commands as they are executed (normal, default,
3446: quiet operation); the value 1 will display all
3447: shell commands before their invocation, and the
3448: value 2 will display both the shell commands before
3449: their invocation, and their actual execution
3450: progress with <span><strong class="command">set
3451: -x</strong></span> will be displayed.</p>
3452: </li>
3453: </ul>
3454: </div>
3455: </div>
3456:
3457: <div class="sect1" lang="en" xml:lang="en">
3458: <div class="titlepage">
3459: <div>
3460: <div>
3461: <h2 class="title" style="clear: both"><a name=
3462: "selecting-build-options" id=
3463: "selecting-build-options"></a>5.4. Selecting
3464: Build Options</h2>
1.38 dillo 3465: </div>
3466: </div>
3467: </div>
3468:
3469: <p>Some packages have build time options, usually to
3470: select between different dependencies, enable optional
3471: support for big dependencies or enable experimental
3472: features.</p>
3473:
3474: <p>To see which options, if any, a package supports, and
3475: which options are mutually exclusive, run
3476: <span><strong class="command">make
3477: show-options</strong></span>, for example:</p>
3478: <pre class="programlisting">
1.44 gdt 3479: The following options are supported by this package:
3480: ssl Enable SSL support.
3481: Exactly one of the following gecko options is required:
3482: firefox Use firefox as gecko rendering engine.
3483: mozilla Use mozilla as gecko rendering engine.
3484: At most one of the following database options may be selected:
3485: mysql Enable support for MySQL database.
3486: pgsql Enable support for PostgreSQL database.
1.38 dillo 3487:
1.44 gdt 3488: These options are enabled by default: firefox
3489: These options are currently enabled: mozilla ssl
3490:
1.38 dillo 3491: </pre>
3492:
1.45 wiz 3493: <p>The following variables can be defined in <code xmlns=
3494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3495: "filename">/etc/mk.conf</code> to select which options to
3496: enable for a package: <code class=
3497: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3498: to select or disable options for all packages that
3499: support them, and <code class=
3500: "varname">PKG_OPTIONS.<em class=
3501: "replaceable"><code>pkgbase</code></em></code>, which can
3502: be used to select or disable options specifically for
3503: package <em class=
3504: "replaceable"><code>pkgbase</code></em>. Options listed
3505: in these variables are selected, options preceded by
3506: “<span class="quote">-</span>” are
3507: disabled.</p>
3508:
1.39 dillo 3509: <p>The following settings are consulted in the order
3510: given, and the last setting that selects or disables an
3511: option is used:</p>
1.38 dillo 3512:
3513: <div class="orderedlist">
3514: <ol type="1">
3515: <li>
3516: <p>the default options as suggested by the package
3517: maintainer</p>
3518: </li>
3519:
3520: <li>
3521: <p>the options implied by the settings of legacy
3522: variables (see below)</p>
3523: </li>
3524:
3525: <li>
3526: <p><code class=
3527: "varname">PKG_DEFAULT_OPTIONS</code></p>
3528: </li>
3529:
3530: <li>
3531: <p><code class="varname">PKG_OPTIONS.<em class=
3532: "replaceable"><code>pkgbase</code></em></code></p>
3533: </li>
3534: </ol>
3535: </div>
3536:
3537: <p>For groups of mutually exclusive options, the last
3538: option selected is used, all others are automatically
3539: disabled. If an option of the group is explicitly
3540: disabled, the previously selected option, if any, is
3541: used. It is an error if no option from a required group
3542: of options is selected, and building the package will
3543: fail.</p>
3544:
3545: <p>Before the options framework was introduced, build
3546: options were selected by setting a variable in
1.45 wiz 3547: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3548: class="filename">/etc/mk.conf</code> for each option. To
3549: ease transition to the options framework for the user,
3550: these legacy variables are converted to the appropriate
3551: options setting automatically. A warning is issued to
3552: prompt the user to update <code xmlns=
3553: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3554: "filename">/etc/mk.conf</code> to use the options
3555: framework directly. Support for these legacy variables
3556: will be removed eventually.</p>
3557: </div>
3558: </div>
3559:
3560: <div class="chapter" lang="en" xml:lang="en">
3561: <div class="titlepage">
3562: <div>
3563: <div>
1.1 grant 3564: <h2 class="title"><a name="binary" id=
1.38 dillo 3565: "binary"></a>Chapter 6. Creating binary
1.1 grant 3566: packages</h2>
3567: </div>
3568: </div>
3569: </div>
3570:
3571: <div class="toc">
3572: <p><b>Table of Contents</b></p>
3573:
3574: <dl>
1.30 wiz 3575: <dt><span class="sect1"><a href=
1.38 dillo 3576: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3577: single binary package</a></span></dt>
1.1 grant 3578:
1.30 wiz 3579: <dt><span class="sect1"><a href=
1.38 dillo 3580: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3581: Settings for creation of binary
3582: packages</a></span></dt>
3583:
1.38 dillo 3584: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3585: a bulk build of all packages</a></span></dt>
3586:
3587: <dd>
3588: <dl>
3589: <dt><span class="sect2"><a href=
1.38 dillo 3590: "#binary.configuration">6.3.1.
1.1 grant 3591: Configuration</a></span></dt>
3592:
1.30 wiz 3593: <dt><span class="sect2"><a href=
1.38 dillo 3594: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3595: environmental considerations</a></span></dt>
1.1 grant 3596:
1.38 dillo 3597: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3598: Operation</a></span></dt>
3599:
1.30 wiz 3600: <dt><span class="sect2"><a href=
1.38 dillo 3601: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3602:
1.30 wiz 3603: <dt><span class="sect2"><a href=
1.38 dillo 3604: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3605: requirements</a></span></dt>
1.1 grant 3606:
1.30 wiz 3607: <dt><span class="sect2"><a href=
1.38 dillo 3608: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.30 wiz 3609: for chroot'ed builds</a></span></dt>
1.1 grant 3610:
1.30 wiz 3611: <dt><span class="sect2"><a href=
1.38 dillo 3612: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3613: set of packages</a></span></dt>
1.13 hubertf 3614:
3615: <dt><span class="sect2"><a href=
1.38 dillo 3616: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3617: build</a></span></dt>
1.1 grant 3618: </dl>
3619: </dd>
3620:
1.38 dillo 3621: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3622: Creating a multiple CD-ROM packages
3623: collection</a></span></dt>
3624:
3625: <dd>
3626: <dl>
1.30 wiz 3627: <dt><span class="sect2"><a href=
1.38 dillo 3628: "#cdpack-example">6.4.1. Example of
1.30 wiz 3629: cdpack</a></span></dt>
1.1 grant 3630: </dl>
3631: </dd>
3632: </dl>
3633: </div>
3634:
3635: <div class="sect1" lang="en" xml:lang="en">
3636: <div class="titlepage">
3637: <div>
3638: <div>
3639: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3640: "building-a-single-binary-package" id=
1.38 dillo 3641: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3642: a single binary package</h2>
1.1 grant 3643: </div>
3644: </div>
3645: </div>
3646:
3647: <p>Once you have built and installed a package, you can
3648: create a <span class="emphasis"><em>binary
3649: package</em></span> which can be installed on another
3650: system with <a href=
3651: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3652: <span class="citerefentry"><span class=
3653: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3654: having to build the same package on a group of hosts and
3655: wasting CPU time. It also provides a simple means for
3656: others to install your package, should you distribute
3657: it.</p>
3658:
3659: <p>To create a binary package, change into the
1.14 xtraeme 3660: appropriate directory in pkgsrc, and run
3661: <span><strong class="command">make
3662: package</strong></span>:</p>
1.1 grant 3663: <pre class="screen">
1.14 xtraeme 3664: <code class="prompt">#</code> <strong class=
3665: "userinput"><code>cd misc/figlet</code></strong>
3666: <code class="prompt">#</code> <strong class=
3667: "userinput"><code>make package</code></strong>
1.1 grant 3668: </pre>
3669:
3670: <p>This will build and install your package (if not
3671: already done), and then build a binary package from what
1.14 xtraeme 3672: was installed. You can then use the <span><strong class=
3673: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3674: Binary packages are created by default in <code xmlns=
3675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3676: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3677: gzipped tar file. See <a href="#logs.package" title=
1.46 ! gdt 3678: "B.2. Packaging figlet">Section B.2,
1.1 grant 3679: “Packaging figlet”</a> for a continuation of
3680: the above <a xmlns=
3681: "http://www.w3.org/TR/xhtml1/transitional" href=
3682: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3683: target="_top"><code xmlns="" class=
3684: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3685:
3686: <p>See <a href="#submit" title=
1.38 dillo 3687: "Chapter 17. Submitting and Committing">Chapter
3688: 17, <i>Submitting and Committing</i></a> for information
1.1 grant 3689: on how to submit such a binary package.</p>
3690: </div>
3691:
3692: <div class="sect1" lang="en" xml:lang="en">
3693: <div class="titlepage">
3694: <div>
3695: <div>
3696: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3697: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3698: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3699: for creation of binary packages</h2>
3700: </div>
3701: </div>
3702: </div>
3703:
3704: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3705: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3706: “Other helpful targets”</a>.</p>
3707: </div>
3708:
3709: <div class="sect1" lang="en" xml:lang="en">
3710: <div class="titlepage">
3711: <div>
3712: <div>
3713: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3714: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
1.1 grant 3715: bulk build of all packages</h2>
3716: </div>
3717: </div>
3718: </div>
3719:
3720: <p>If you want to get a full set of precompiled binary
3721: packages, this section describes how to get them. Beware
3722: that the bulk build will remove all currently installed
1.23 wiz 3723: packages from your system! Having an FTP server
3724: configured either on the machine doing the bulk builds or
3725: on a nearby NFS server can help to make the packages
3726: available to everyone. See <a href=
1.1 grant 3727: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3728: <span class="citerefentry"><span class=
3729: "refentrytitle">ftpd</span>(8)</span></a> for more
3730: information. If you use a remote NFS server's storage, be
3731: sure to not actually compile on NFS storage, as this
3732: slows things down a lot.</p>
3733:
3734: <div class="sect2" lang="en" xml:lang="en">
3735: <div class="titlepage">
3736: <div>
3737: <div>
3738: <h3 class="title"><a name="binary.configuration"
3739: id=
1.38 dillo 3740: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3741: </div>
3742: </div>
3743: </div>
3744:
3745: <div class="sect3" lang="en" xml:lang="en">
3746: <div class="titlepage">
3747: <div>
3748: <div>
3749: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3750: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3751: </div>
3752: </div>
3753: </div>
3754:
1.45 wiz 3755: <p>You may want to set variables in <code xmlns=
3756: "http://www.w3.org/TR/xhtml1/transitional" class=
3757: "filename">/etc/mk.conf</code>. Look at <code xmlns=
3758: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3759: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3760: details of the default settings. You will want to
1.14 xtraeme 3761: ensure that <code class=
3762: "varname">ACCEPTABLE_LICENSES</code> meet your local
3763: policy. As used in this example, <code class=
3764: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3765: "emphasis"><em>all</em></span> licenses.</p>
3766: <pre class="programlisting">
3767: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3768: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3769: BSDSRCDIR= /usr/src
3770: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3771: OBJHOSTNAME?= yes # use work.`hostname`
3772: FAILOVER_FETCH= yes # insist on the correct checksum
3773: PKG_DEVELOPER?= yes
3774: _ACCEPTABLE= yes
3775: </pre>
3776: </div>
3777:
3778: <div class="sect3" lang="en" xml:lang="en">
3779: <div class="titlepage">
3780: <div>
3781: <div>
1.30 wiz 3782: <h4 class="title"><a name="build.conf" id=
1.45 wiz 3783: "build.conf"></a>6.3.1.2. <code xmlns=
3784: "http://www.w3.org/TR/xhtml1/transitional"
3785: class="filename">build.conf</code></h4>
1.1 grant 3786: </div>
3787: </div>
3788: </div>
3789:
1.45 wiz 3790: <p>In <code xmlns=
3791: "http://www.w3.org/TR/xhtml1/transitional" class=
3792: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
3793: "http://www.w3.org/TR/xhtml1/transitional" class=
3794: "filename">build.conf-example</code> to <code xmlns=
3795: "http://www.w3.org/TR/xhtml1/transitional" class=
3796: "filename">build.conf</code> and edit it, following
3797: the comments in that file. This is the config file
3798: that determines where log files are generated after
3799: the build, where to mail the build report to, where
3800: your pkgsrc tree is located and the user to which
3801: user to <a href=
1.1 grant 3802: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3803: <span class="citerefentry"><span class=
1.23 wiz 3804: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3805: <span><strong class="command">cvs
3806: update</strong></span>.</p>
1.1 grant 3807: </div>
3808:
3809: <div class="sect3" lang="en" xml:lang="en">
3810: <div class="titlepage">
3811: <div>
3812: <div>
1.30 wiz 3813: <h4 class="title"><a name="pre-build.local" id=
1.45 wiz 3814: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3815: class="filename">pre-build.local</code></h4>
1.1 grant 3816: </div>
3817: </div>
3818: </div>
3819:
3820: <p>It is possible to configure the bulk build to
3821: perform certain site specific tasks at the end of the
1.45 wiz 3822: pre-build stage. If the file <code xmlns=
3823: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3824: "filename">pre-build.local</code> exists in
1.45 wiz 3825: <code xmlns=
3826: "http://www.w3.org/TR/xhtml1/transitional" class=
3827: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
3828: executed (as a <a href=
1.24 wiz 3829: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3830: <span class="citerefentry"><span class=
3831: "refentrytitle">sh</span>(1)</span></a> script) at
3832: the end of the usual pre-build stage. An example use
1.45 wiz 3833: of <code xmlns=
3834: "http://www.w3.org/TR/xhtml1/transitional" class=
3835: "filename">pre-build.local</code> is to have the
3836: line:</p>
1.1 grant 3837: <pre class="screen">
1.14 xtraeme 3838: <code class="prompt">#</code> <strong class=
3839: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3840: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3841: </pre>
3842:
3843: <p>to prevent the system from trying to build a
3844: particular package which requires nearly 3 GB of disk
3845: space.</p>
3846: </div>
3847: </div>
3848:
3849: <div class="sect2" lang="en" xml:lang="en">
3850: <div class="titlepage">
3851: <div>
3852: <div>
1.30 wiz 3853: <h3 class="title"><a name=
3854: "other-environmental-considerations" id=
1.38 dillo 3855: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 3856: environmental considerations</h3>
1.1 grant 3857: </div>
3858: </div>
3859: </div>
3860:
1.45 wiz 3861: <p>As <code xmlns=
3862: "http://www.w3.org/TR/xhtml1/transitional" class=
3863: "filename">/usr/pkg</code> will be completely deleted
3864: at the start of bulk builds, make sure your login shell
3865: is placed somewhere else. Either drop it into
3866: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3867: class="filename">/usr/local/bin</code> (and adjust your
3868: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 3869: <a href=
1.1 grant 3870: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3871: <span class="citerefentry"><span class=
3872: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 3873: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3874: class="filename">/etc/rc.local</code>, so you can login
3875: after a reboot (remember that your current process
3876: won't die if the package is removed, you just can't
3877: start any new instances of the shell any more). Also,
3878: if you use NetBSD earlier than 1.5, or you still want
3879: to use the pkgsrc version of ssh for some reason, be
3880: sure to install ssh before starting it from
3881: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3882: class="filename">rc.local</code>:</p>
1.1 grant 3883: <pre class="programlisting">
3884: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3885: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3886: /usr/pkg/etc/rc.d/sshd
3887: fi
3888: </pre>
3889:
3890: <p>Not doing so will result in you being not able to
3891: log in via ssh after the bulk build is finished or if
3892: the machine gets rebooted or crashes. You have been
3893: warned! :)</p>
3894: </div>
3895:
3896: <div class="sect2" lang="en" xml:lang="en">
3897: <div class="titlepage">
3898: <div>
3899: <div>
1.30 wiz 3900: <h3 class="title"><a name="operation" id=
1.38 dillo 3901: "operation"></a>6.3.3. Operation</h3>
1.1 grant 3902: </div>
3903: </div>
3904: </div>
3905:
3906: <p>Make sure you don't need any of the packages still
3907: installed.</p>
3908:
3909: <div class="warning" style=
3910: "margin-left: 0.5in; margin-right: 0.5in;">
3911: <h3 class="title">Warning</h3>
3912:
3913: <p>During the bulk build, <span class=
3914: "emphasis"><em>all packages will be
3915: removed!</em></span></p>
3916: </div>
3917:
3918: <p>Be sure to remove all other things that might
3919: interfere with builds, like some libs installed in
1.45 wiz 3920: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3921: class="filename">/usr/local</code>, etc. then become
3922: root and type:</p>
1.1 grant 3923: <pre class="screen">
1.14 xtraeme 3924: <code class="prompt">#</code> <strong class=
3925: "userinput"><code>cd /usr/pkgsrc</code></strong>
3926: <code class="prompt">#</code> <strong class=
3927: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3928: </pre>
3929:
3930: <p>If for some reason your last build didn't complete
3931: (power failure, system panic, ...), you can continue it
3932: by running:</p>
3933: <pre class="screen">
1.14 xtraeme 3934: <code class="prompt">#</code> <strong class=
3935: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3936: </pre>
3937:
3938: <p>At the end of the bulk build, you will get a summary
3939: via mail, and find build logs in the directory
1.14 xtraeme 3940: specified by <code class="varname">FTP</code> in the
1.45 wiz 3941: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3942: class="filename">build.conf</code> file.</p>
1.1 grant 3943: </div>
3944:
3945: <div class="sect2" lang="en" xml:lang="en">
3946: <div class="titlepage">
3947: <div>
3948: <div>
1.30 wiz 3949: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 3950: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 3951: </div>
3952: </div>
3953: </div>
3954:
3955: <p>The bulk builds consist of three steps:</p>
3956:
3957: <div class="variablelist">
3958: <dl>
3959: <dt><span class="term">1. pre-build</span></dt>
3960:
3961: <dd>
3962: <p>The script updates your pkgsrc tree via
3963: (anon)cvs, then cleans out any broken distfiles,
3964: and removes all packages installed.</p>
3965: </dd>
3966:
3967: <dt><span class="term">2. the bulk
3968: build</span></dt>
3969:
3970: <dd>
3971: <p>This is basically “<span class=
3972: "quote">make bulk-package</span>” with an
3973: optimised order in which packages will be built.
3974: Packages that don't require other packages will
3975: be built first, and packages with many
3976: dependencies will be built later.</p>
3977: </dd>
3978:
3979: <dt><span class="term">3. post-build</span></dt>
3980:
3981: <dd>
3982: <p>Generates a report that's placed in the
1.45 wiz 3983: directory specified in the <code xmlns=
3984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3985: "filename">build.conf</code> file named
1.45 wiz 3986: <code xmlns=
3987: "http://www.w3.org/TR/xhtml1/transitional" class=
3988: "filename">broken.html</code>, a short version of
3989: that report will also be mailed to the build's
3990: admin.</p>
1.1 grant 3991: </dd>
3992: </dl>
3993: </div>
3994:
3995: <p>During the build, a list of broken packages will be
1.45 wiz 3996: compiled in <code xmlns=
3997: "http://www.w3.org/TR/xhtml1/transitional" class=
3998: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
3999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4000: "filename">.../.broken.${MACHINE}</code> if
4001: <code class="varname">OBJMACHINE</code> is set),
4002: individual build logs of broken builds can be found in
4003: the package's directory. These files are used by the
4004: bulk-targets to mark broken builds to not waste time
4005: trying to rebuild them, and they can be used to debug
4006: these broken package builds later.</p>
1.1 grant 4007: </div>
4008:
4009: <div class="sect2" lang="en" xml:lang="en">
4010: <div class="titlepage">
4011: <div>
4012: <div>
1.30 wiz 4013: <h3 class="title"><a name=
4014: "disk-space-requirements" id=
1.38 dillo 4015: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4016: space requirements</h3>
1.1 grant 4017: </div>
4018: </div>
4019: </div>
4020:
4021: <p>Currently, roughly the following requirements are
4022: valid for NetBSD 2.0/i386:</p>
4023:
4024: <div class="itemizedlist">
4025: <ul type="disc">
4026: <li>
4027: <p>10 GB - distfiles (NFS ok)</p>
4028: </li>
4029:
4030: <li>
4031: <p>8 GB - full set of all binaries (NFS ok)</p>
4032: </li>
4033:
4034: <li>
4035: <p>5 GB - temp space for compiling (local disk
4036: recommended)</p>
4037: </li>
4038: </ul>
4039: </div>
4040:
4041: <p>Note that all pkgs will be de-installed as soon as
4042: they are turned into a binary package, and that sources
4043: are removed, so there is no excessively huge demand to
4044: disk space. Afterwards, if the package is needed again,
4045: it will be installed via <a href=
4046: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4047: <span class="citerefentry"><span class=
4048: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4049: building again, so there are no cycles wasted by
4050: recompiling.</p>
4051: </div>
4052:
4053: <div class="sect2" lang="en" xml:lang="en">
4054: <div class="titlepage">
4055: <div>
4056: <div>
1.30 wiz 4057: <h3 class="title"><a name="setting-up-a-sandbox"
1.38 dillo 4058: id="setting-up-a-sandbox"></a>6.3.6. Setting
1.30 wiz 4059: up a sandbox for chroot'ed builds</h3>
1.1 grant 4060: </div>
4061: </div>
4062: </div>
4063:
1.12 agc 4064: <p>If you don't want all the packages nuked from a
4065: machine (rendering it useless for anything but pkg
1.23 wiz 4066: compiling), there is the possibility of doing the
4067: package bulk build inside a chroot environment.</p>
1.12 agc 4068:
4069: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4070: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4071: class="filename">/usr/sandbox</code>. This can be done
4072: by using null mounts, or manually.</p>
1.12 agc 4073:
1.45 wiz 4074: <p>There is a shell script called <code xmlns=
4075: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4076: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4077: set up the sandbox environment using null mounts. It
1.45 wiz 4078: will also create a script called <code xmlns=
4079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4080: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4081: environment, which will allow the null mounts to be
1.14 xtraeme 4082: activated using the <span><strong class=
4083: "command">sandbox mount</strong></span> command and
4084: deactivated using the <span><strong class=
4085: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4086:
4087: <p>To set up a sandbox environment by hand, after
4088: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4089: doing a <span><strong class="command">make distribution
1.45 wiz 4090: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4092: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4093: items are present and properly configured:</p>
1.1 grant 4094:
4095: <div class="procedure">
4096: <ol type="1">
4097: <li>
4098: <p>Kernel</p>
4099: <pre class="screen">
1.14 xtraeme 4100: <code class="prompt">#</code> <strong class=
4101: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4102: </pre>
4103: </li>
4104:
4105: <li>
1.45 wiz 4106: <p><code xmlns=
4107: "http://www.w3.org/TR/xhtml1/transitional" class=
4108: "filename">/dev/*</code></p>
1.1 grant 4109: <pre class="screen">
1.14 xtraeme 4110: <code class="prompt">#</code> <strong class=
4111: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4112: </pre>
4113: </li>
4114:
4115: <li>
1.45 wiz 4116: <p><code xmlns=
4117: "http://www.w3.org/TR/xhtml1/transitional" class=
4118: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4119: "http://www.w3.org/TR/xhtml1/transitional" href=
4120: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4121: target="_top"><code xmlns="" class=
4122: "filename">security/smtpd</code></a> and
4123: mail):</p>
1.1 grant 4124: <pre class="screen">
1.14 xtraeme 4125: <code class="prompt">#</code> <strong class=
4126: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4127: </pre>
4128: </li>
4129:
4130: <li>
4131: <p>Working(!) mail config (hostname,
4132: sendmail.cf):</p>
4133: <pre class="screen">
1.14 xtraeme 4134: <code class="prompt">#</code> <strong class=
4135: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4136: </pre>
4137: </li>
4138:
4139: <li>
1.45 wiz 4140: <p><code xmlns=
4141: "http://www.w3.org/TR/xhtml1/transitional" class=
4142: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4143: "http://www.w3.org/TR/xhtml1/transitional" href=
4144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4145: target="_top"><code xmlns="" class=
4146: "filename">security/smtpd</code></a>):</p>
1.1 grant 4147: <pre class="screen">
1.14 xtraeme 4148: <code class="prompt">#</code> <strong class=
4149: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4150: </pre>
4151: </li>
4152:
4153: <li>
1.45 wiz 4154: <p><code xmlns=
4155: "http://www.w3.org/TR/xhtml1/transitional" class=
4156: "filename">/usr/src</code> (system sources, for
4157: <a xmlns=
1.1 grant 4158: "http://www.w3.org/TR/xhtml1/transitional" href=
4159: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4160: target="_top"><code xmlns="" class=
4161: "filename">sysutils/aperture</code></a>,
4162: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4163: href=
1.20 ben 4164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4165: target="_top"><code xmlns="" class=
4166: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4167: <pre class="screen">
1.14 xtraeme 4168: <code class="prompt">#</code> <strong class=
4169: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4170: <code class="prompt">#</code> <strong class=
1.23 wiz 4171: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4172: </pre>
4173: </li>
4174:
4175: <li>
1.45 wiz 4176: <p>Create <code xmlns=
4177: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4178: "filename">/var/db/pkg</code> (not part of
4179: default install):</p>
1.1 grant 4180: <pre class="screen">
1.14 xtraeme 4181: <code class="prompt">#</code> <strong class=
4182: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4183: </pre>
4184: </li>
4185:
4186: <li>
1.45 wiz 4187: <p>Create <code xmlns=
4188: "http://www.w3.org/TR/xhtml1/transitional" class=
4189: "filename">/usr/pkg</code> (not part of default
4190: install):</p>
1.1 grant 4191: <pre class="screen">
1.14 xtraeme 4192: <code class="prompt">#</code> <strong class=
4193: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4194: </pre>
4195: </li>
4196:
4197: <li>
1.45 wiz 4198: <p>Checkout pkgsrc via cvs into <code xmlns=
4199: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4200: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4201: <pre class="screen">
1.14 xtraeme 4202: <code class="prompt">#</code> <strong class=
4203: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4204: <code class="prompt">#</code> <strong class=
4205: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4206: </pre>
4207:
4208: <p>Do not mount/link this to the copy of your
4209: pkgsrc tree you do development in, as this will
4210: likely cause problems!</p>
4211: </li>
4212:
4213: <li>
1.45 wiz 4214: <p>Make <code xmlns=
4215: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4216: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4217: and <code xmlns=
4218: "http://www.w3.org/TR/xhtml1/transitional" class=
4219: "filename">.../distfiles</code> point somewhere
4220: appropriate. NFS- and/or nullfs-mounts may come
4221: in handy!</p>
1.1 grant 4222: </li>
4223:
4224: <li>
1.45 wiz 4225: <p>Edit <code xmlns=
4226: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4227: "filename">/etc/mk.conf</code>, see <a href=
4228: "#binary.mk.conf" title=
1.38 dillo 4229: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4230: “/etc/mk.conf”</a>.</p>
4231: </li>
4232:
4233: <li>
1.45 wiz 4234: <p>Adjust <code xmlns=
4235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4236: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4237: needs.</p>
4238: </li>
4239:
4240: <li>
1.14 xtraeme 4241: <p>If you have set <code class=
1.45 wiz 4242: "varname">CVS_USER</code> in <code xmlns=
4243: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4244: "filename">build.conf</code>, make sure that
4245: account exists and can do a <span><strong class=
4246: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4247: properly!</p>
4248: </li>
4249: </ol>
4250: </div>
4251:
4252: <p>When the chroot sandbox is setup, you can start the
4253: build with the following steps:</p>
4254: <pre class="screen">
1.14 xtraeme 4255: <code class="prompt">#</code> <strong class=
4256: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4257: <code class="prompt">#</code> <strong class=
4258: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4259: </pre>
4260:
4261: <p>This will just jump inside the sandbox and start
4262: building. At the end of the build, mail will be sent
4263: with the results of the build. Created binary pkgs will
1.45 wiz 4264: be in <code xmlns=
4265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4266: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4267: (wherever that points/mounts to/from).</p>
4268: </div>
4269:
4270: <div class="sect2" lang="en" xml:lang="en">
4271: <div class="titlepage">
4272: <div>
4273: <div>
1.30 wiz 4274: <h3 class="title"><a name=
4275: "building-a-partial-set" id=
1.38 dillo 4276: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4277: a partial set of packages</h3>
1.1 grant 4278: </div>
4279: </div>
4280: </div>
4281:
4282: <p>In addition to building a complete set of all
1.45 wiz 4283: packages in pkgsrc, the <code xmlns=
4284: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4285: "filename">pkgsrc/mk/bulk/build</code> script may be
4286: used to build a subset of the packages contained in
4287: pkgsrc. By setting defining <code class=
1.45 wiz 4288: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4289: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4290: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4291:
4292: <div class="itemizedlist">
4293: <ul type="disc">
4294: <li>
4295: <p>SITE_SPECIFIC_PKGS</p>
4296: </li>
4297:
4298: <li>
4299: <p>HOST_SPECIFIC_PKGS</p>
4300: </li>
4301:
4302: <li>
4303: <p>GROUP_SPECIFIC_PKGS</p>
4304: </li>
4305:
4306: <li>
4307: <p>USER_SPECIFIC_PKGS</p>
4308: </li>
4309: </ul>
4310: </div>
4311:
4312: <p>will define the set of packages which should be
4313: built. The bulk build code will also include any
4314: packages which are needed as dependencies for the
4315: explicitly listed packages.</p>
4316:
4317: <p>One use of this is to do a bulk build with
1.14 xtraeme 4318: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4319: sandbox periodically to have a complete set of the
4320: binary packages needed for your site available without
4321: the overhead of building extra packages that are not
4322: needed.</p>
4323: </div>
1.13 hubertf 4324:
4325: <div class="sect2" lang="en" xml:lang="en">
4326: <div class="titlepage">
4327: <div>
4328: <div>
4329: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4330: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4331: of a bulk build</h3>
4332: </div>
4333: </div>
4334: </div>
4335:
4336: <p>This section describes how pkgsrc developers can
4337: upload binary pkgs built by bulk builds to
4338: ftp.NetBSD.org.</p>
4339:
1.17 sketch 4340: <p>If you would like to automatically create checksum
4341: files for the binary packages you intend to upload,
4342: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4343: in your <code xmlns=
4344: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4345: "filename">mk/bulk/build.conf</code>.</p>
4346:
4347: <p>If you would like to PGP sign the checksum files
4348: (highly recommended!), remember to set <code class=
4349: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4350: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4351: class="filename">mk/bulk/build.conf</code>. This will
4352: prompt you for your GPG password to sign the files
1.17 sketch 4353: before uploading everything.</p>
4354:
4355: <p>Then, make sure that you have <code class=
1.14 xtraeme 4356: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4357: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4358: class="filename">mk/bulk/build.conf</code> file, i.e.
4359: adjust it to something like one of the following:</p>
1.13 hubertf 4360: <pre class="screen">
4361: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4362: </pre>
4363:
1.23 wiz 4364: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 4365: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4366: ftp.NetBSD.org is different from <code class=
4367: "varname">CVS_USER</code>, write your login directly
4368: into the variable, e.g. my local account is "feyrer",
4369: but for my login "hubertf", I use:</p>
1.13 hubertf 4370: <pre class="screen">
4371: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4372: </pre>
4373:
1.45 wiz 4374: <p>A separate <code xmlns=
4375: "http://www.w3.org/TR/xhtml1/transitional" class=
4376: "filename">upload</code> directory is used here to
4377: allow "closing" the directory during upload. To do so,
4378: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4379: <pre class="screen">
1.14 xtraeme 4380: nbftp% <strong class=
4381: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4382: </pre>
4383:
1.45 wiz 4384: <p>Please note that <code xmlns=
4385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4386: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4387: appropriate for packages for the NetBSD operating
4388: system. Binary packages for other operating systems
1.45 wiz 4389: should go into <code xmlns=
4390: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4391: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4392:
4393: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 4394: needs to be set up. This example shows how to setup
1.13 hubertf 4395: temporary keys for the root account <span class=
4396: "emphasis"><em>inside the sandbox</em></span> (assuming
4397: that no keys should be present there usually):</p>
4398: <pre class="screen">
1.14 xtraeme 4399: <code class="prompt">#</code> <strong class=
4400: "userinput"><code>chroot /usr/sandbox</code></strong>
4401: chroot-<code class="prompt">#</code> <strong class=
4402: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4403: chroot-<code class="prompt">#</code> <strong class=
4404: "userinput"><code>ssh-keygen -t dsa</code></strong>
4405: chroot-<code class="prompt">#</code> <strong class=
4406: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4407: </pre>
4408:
1.45 wiz 4409: <p>Now take the output of <code xmlns=
4410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4411: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4412: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4413: class="filename">~/.ssh/authorized_keys</code> file on
4414: ftp.NetBSD.org. You can remove the key after the upload
4415: is done!</p>
1.13 hubertf 4416:
4417: <p>Next, test if your ssh connection really works:</p>
4418: <pre class="screen">
1.14 xtraeme 4419: chroot-<code class="prompt">#</code> <strong class=
4420: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4421: </pre>
4422:
4423: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4424:
4425: <p>Now after all this works, you can exit the sandbox
4426: and start the upload:</p>
4427: <pre class="screen">
1.14 xtraeme 4428: chroot-<code class="prompt">#</code> <strong class=
4429: "userinput"><code>exit</code></strong>
4430: <code class="prompt">#</code> <strong class=
4431: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4432: <code class="prompt">#</code> <strong class=
4433: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4434: </pre>
4435:
4436: <p>The upload process may take quite some time. Use
1.24 wiz 4437: <a href=
4438: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4439: <span class="citerefentry"><span class=
4440: "refentrytitle">ls</span>(1)</span></a> or <a href=
4441: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4442: <span class="citerefentry"><span class=
4443: "refentrytitle">du</span>(1)</span></a> on the FTP
4444: server to monitor progress of the upload. The upload
4445: script will take care of not uploading restricted
4446: packages and putting vulnerable packages into the
1.45 wiz 4447: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4448: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4449:
4450: <p>After the upload has ended, first thing is to revoke
4451: ssh access:</p>
4452: <pre class="screen">
1.14 xtraeme 4453: nbftp% <strong class=
4454: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4455: Gdd:x!
4456: </pre>
4457:
4458: <p>Use whatever is needed to remove the key you've
4459: entered before! Last, move the uploaded packages out of
1.45 wiz 4460: the <code xmlns=
4461: "http://www.w3.org/TR/xhtml1/transitional" class=
4462: "filename">upload</code> directory to have them
4463: accessible to everyone:</p>
1.13 hubertf 4464: <pre class="screen">
1.14 xtraeme 4465: nbftp% <strong class=
4466: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4467: nbftp% <strong class=
4468: "userinput"><code>mv upload/* .</code></strong>
4469: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4470: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4471: </pre>
4472: </div>
1.1 grant 4473: </div>
4474:
4475: <div class="sect1" lang="en" xml:lang="en">
4476: <div class="titlepage">
4477: <div>
4478: <div>
4479: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4480: "creating-cdroms" id=
1.38 dillo 4481: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4482: CD-ROM packages collection</h2>
1.1 grant 4483: </div>
4484: </div>
4485: </div>
4486:
4487: <p>After your pkgsrc bulk-build has completed, you may
4488: wish to create a CD-ROM set of the resulting binary
4489: packages to assist in installing packages on other
4490: machines. The <a xmlns=
4491: "http://www.w3.org/TR/xhtml1/transitional" href=
4492: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4493: target="_top"><code xmlns="" class=
4494: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4495: simple tool for creating the ISO 9660 images.
4496: <span><strong class="command">cdpack</strong></span>
4497: arranges the packages on the CD-ROMs in a way that keeps
4498: all the dependencies for given package on the same CD as
4499: that package.</p>
1.1 grant 4500:
4501: <div class="sect2" lang="en" xml:lang="en">
4502: <div class="titlepage">
4503: <div>
4504: <div>
1.30 wiz 4505: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4506: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4507: cdpack</h3>
4508: </div>
4509: </div>
4510: </div>
4511:
4512: <p>Complete documentation for cdpack is found in the
4513: cdpack(1) manpage. The following short example assumes
1.45 wiz 4514: that the binary packages are left in <code xmlns=
4515: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4516: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4517: sufficient disk space exists in <code xmlns=
4518: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4519: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4520: <pre class="screen">
1.14 xtraeme 4521: <code class="prompt">#</code> <strong class=
4522: "userinput"><code>mkdir /u2/images</code></strong>
4523: <code class="prompt">#</code> <strong class=
4524: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4525: <code class="prompt">#</code> <strong class=
4526: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4527: </pre>
4528:
4529: <p>If you wish to include a common set of files
1.45 wiz 4530: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4531: class="filename">COPYRIGHT</code>, <code xmlns=
4532: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4533: "filename">README</code>, etc.) on each CD in the
1.1 grant 4534: collection, then you need to create a directory which
4535: contains these files. e.g.</p>
4536: <pre class="screen">
1.14 xtraeme 4537: <code class="prompt">#</code> <strong class=
4538: "userinput"><code>mkdir /tmp/common</code></strong>
4539: <code class="prompt">#</code> <strong class=
4540: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4541: <code class="prompt">#</code> <strong class=
4542: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4543: <code class="prompt">#</code> <strong class=
4544: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4545: <code class="prompt">#</code> <strong class=
4546: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4547: <code class="prompt">#</code> <strong class=
4548: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4549: <code class="prompt">#</code> <strong class=
4550: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4551: </pre>
4552:
4553: <p>Now create the images:</p>
4554: <pre class="screen">
1.14 xtraeme 4555: <code class="prompt">#</code> <strong class=
4556: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4557: </pre>
4558:
1.45 wiz 4559: <p>Each image will contain <code xmlns=
4560: "http://www.w3.org/TR/xhtml1/transitional" class=
4561: "filename">README</code>, <code xmlns=
4562: "http://www.w3.org/TR/xhtml1/transitional" class=
4563: "filename">COPYING</code>, and <code xmlns=
4564: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4565: "filename">bin/myscript</code> in their root
1.1 grant 4566: directories.</p>
4567: </div>
4568: </div>
4569: </div>
4570:
4571: <div class="chapter" lang="en" xml:lang="en">
4572: <div class="titlepage">
4573: <div>
4574: <div>
4575: <h2 class="title"><a name="faq" id=
1.38 dillo 4576: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4577: Questions</h2>
4578: </div>
4579: </div>
4580: </div>
4581:
4582: <div class="toc">
4583: <p><b>Table of Contents</b></p>
4584:
4585: <dl>
1.30 wiz 4586: <dt><span class="sect1"><a href=
1.38 dillo 4587: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4588: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4589:
1.38 dillo 4590: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4591: Where's the pkgviews documentation?</a></span></dt>
4592:
1.38 dillo 4593: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4594: Utilities for package management
4595: (pkgtools)</a></span></dt>
4596:
1.38 dillo 4597: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4598: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4599:
1.30 wiz 4600: <dt><span class="sect1"><a href=
1.38 dillo 4601: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4602: fetching distfiles?</a></span></dt>
1.14 xtraeme 4603:
1.30 wiz 4604: <dt><span class="sect1"><a href=
1.38 dillo 4605: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4606: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4607:
1.30 wiz 4608: <dt><span class="sect1"><a href=
1.38 dillo 4609: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4610: from pkgsrc?</a></span></dt>
1.1 grant 4611:
1.30 wiz 4612: <dt><span class="sect1"><a href=
1.38 dillo 4613: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4614: behind a firewall</a></span></dt>
1.1 grant 4615:
1.38 dillo 4616: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4617: do I tell <span><strong class="command">make
4618: fetch</strong></span> to do passive
4619: FTP?</a></span></dt>
1.1 grant 4620:
1.30 wiz 4621: <dt><span class="sect1"><a href=
1.38 dillo 4622: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4623: distfiles at once</a></span></dt>
1.1 grant 4624:
1.30 wiz 4625: <dt><span class="sect1"><a href=
1.38 dillo 4626: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4627: “<span class="quote">Don't know how to make
1.14 xtraeme 4628: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4629: mean?</a></span></dt>
4630:
1.30 wiz 4631: <dt><span class="sect1"><a href=
1.38 dillo 4632: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4633: “<span class="quote">Could not find
1.14 xtraeme 4634: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4635:
1.30 wiz 4636: <dt><span class="sect1"><a href=
1.38 dillo 4637: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4638: pkgsrc</a></span></dt>
1.1 grant 4639:
1.38 dillo 4640: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4641: do I change the location of configuration
4642: files?</a></span></dt>
1.1 grant 4643:
1.38 dillo 4644: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4645: Automated security checks</a></span></dt>
4646: </dl>
4647: </div>
4648:
4649: <p>This section contains hints, tips & tricks on
4650: special things in pkgsrc that we didn't find a better place
4651: for in the previous chapters, and it contains items for
4652: both pkgsrc users and developers.</p>
4653:
4654: <div class="sect1" lang="en" xml:lang="en">
4655: <div class="titlepage">
4656: <div>
4657: <div>
4658: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4659: "mailing-list-pointers" id=
1.38 dillo 4660: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4661: mailing lists for pkg-related discussion?</h2>
1.1 grant 4662: </div>
4663: </div>
4664: </div>
4665:
1.18 xtraeme 4666: <p>The following mailing lists may be of interest to
4667: pkgsrc users:</p>
4668:
4669: <div class="itemizedlist">
4670: <ul type="disc">
4671: <li>
4672: <p><a href=
4673: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4674: target="_top">pkgsrc-bugs</a>: A list where problem
4675: reports related to pkgsrc are sent and
4676: discussed.</p>
1.18 xtraeme 4677: </li>
4678:
4679: <li>
4680: <p><a href=
4681: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4682: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4683: results of pkgsrc bulk builds are sent and
1.34 wiz 4684: discussed.</p>
1.18 xtraeme 4685: </li>
4686:
4687: <li>
4688: <p><a href=
4689: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4690: target="_top">pkgsrc-changes</a>: A list where all
4691: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4692: </li>
4693:
4694: <li>
4695: <p><a href=
4696: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4697: target="_top">tech-pkg</a>: A general discussion
4698: list for all things related to pkgsrc.</p>
1.18 xtraeme 4699: </li>
4700: </ul>
4701: </div>
4702:
4703: <p>To subscribe, do:</p>
1.1 grant 4704: <pre class="programlisting">
1.18 xtraeme 4705: <code class="prompt">%</code> echo subscribe <em class=
4706: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4707: </pre>
4708:
1.18 xtraeme 4709: <p>Archives for all these mailing lists are available
4710: from <a href="http://mail-index.NetBSD.org/" target=
4711: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4712: </div>
4713:
4714: <div class="sect1" lang="en" xml:lang="en">
4715: <div class="titlepage">
4716: <div>
4717: <div>
4718: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4719: "pkgviews-docs" id=
1.38 dillo 4720: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4721: documentation?</h2>
1.1 grant 4722: </div>
4723: </div>
4724: </div>
4725:
4726: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4727: find a pkgviews User's guide in <code xmlns=
4728: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4729: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4730: </div>
4731:
4732: <div class="sect1" lang="en" xml:lang="en">
4733: <div class="titlepage">
4734: <div>
4735: <div>
4736: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4737: "faq-pkgtools" id=
1.38 dillo 4738: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4739: management (pkgtools)</h2>
1.1 grant 4740: </div>
4741: </div>
4742: </div>
4743:
1.45 wiz 4744: <p>The <code xmlns=
4745: "http://www.w3.org/TR/xhtml1/transitional" class=
4746: "filename">pkgsrc/pkgtools</code> directory pkgtools
4747: contains a number of useful utilities for both users and
4748: developers of pkgsrc. This section attempts only to make
4749: the reader aware of the utilities and when they might be
4750: useful, and not to duplicate the documentation that comes
4751: with each package.</p>
1.1 grant 4752:
4753: <p>Utilities used by pkgsrc (automatically installed when
4754: needed):</p>
4755:
4756: <div class="itemizedlist">
4757: <ul type="disc">
4758: <li>
4759: <p><a xmlns=
4760: "http://www.w3.org/TR/xhtml1/transitional" href=
4761: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 4762: target="_top"><code xmlns="" class=
4763: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4764: for use by buildlink.</p>
1.1 grant 4765: </li>
4766: </ul>
4767: </div>
4768:
4769: <p>OS tool augmentation (automatically installed when
4770: needed):</p>
4771:
4772: <div class="itemizedlist">
4773: <ul type="disc">
4774: <li>
4775: <p><a xmlns=
4776: "http://www.w3.org/TR/xhtml1/transitional" href=
4777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 4778: target="_top"><code xmlns="" class=
4779: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 4780: various kinds of checksums (including SHA1).</p>
1.1 grant 4781: </li>
4782:
4783: <li>
4784: <p><a xmlns=
4785: "http://www.w3.org/TR/xhtml1/transitional" href=
4786: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 4787: target="_top"><code xmlns="" class=
4788: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 4789: Compatibility library for pkgsrc tools.</p>
1.1 grant 4790: </li>
4791:
4792: <li>
4793: <p><a xmlns=
4794: "http://www.w3.org/TR/xhtml1/transitional" href=
4795: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 4796: target="_top"><code xmlns="" class=
4797: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 4798: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4799: </li>
4800:
4801: <li>
4802: <p><a xmlns=
4803: "http://www.w3.org/TR/xhtml1/transitional" href=
4804: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 4805: target="_top"><code xmlns="" class=
4806: "filename">pkgtools/pkg_install</code></a>:
4807: Up-to-date replacement for <code xmlns=
4808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 4809: "filename">/usr/sbin/pkg_install</code>, or for use
4810: on operating systems where pkg_install is not
4811: present.</p>
1.1 grant 4812: </li>
4813: </ul>
4814: </div>
4815:
4816: <p>Utilities used by pkgsrc (not automatically
4817: installed):</p>
4818:
4819: <div class="itemizedlist">
4820: <ul type="disc">
4821: <li>
4822: <p><a xmlns=
4823: "http://www.w3.org/TR/xhtml1/transitional" href=
4824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 4825: target="_top"><code xmlns="" class=
4826: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 4827: binary package from an already-installed package.
1.34 wiz 4828: Used by <span><strong class="command">make
4829: replace</strong></span> to save the old
4830: package.</p>
1.1 grant 4831: </li>
4832:
4833: <li>
4834: <p><a xmlns=
4835: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4836: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 4837: target="_top"><code xmlns="" class=
4838: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 4839: functionality to pkgsrc, allowing it to fetch
4840: distfiles from multiple locations. It currently
4841: supports the following methods: multiple CD-ROMs
4842: and network FTP/HTTP connections.</p>
1.5 hubertf 4843: </li>
4844:
4845: <li>
4846: <p><a xmlns=
4847: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4848: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 4849: target="_top"><code xmlns="" class=
4850: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 4851: packages someplace else (enabled by default).</p>
1.1 grant 4852: </li>
1.5 hubertf 4853:
4854: <li>
4855: <p><a xmlns=
4856: "http://www.w3.org/TR/xhtml1/transitional" href=
4857: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 4858: target="_top"><code xmlns="" class=
4859: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 4860: best compiler flags to optimise code for your
1.20 ben 4861: current CPU and compiler.</p>
1.5 hubertf 4862: </li>
1.1 grant 4863: </ul>
4864: </div>
4865:
4866: <p>Utilities for keeping track of installed packages,
4867: being up to date, etc:</p>
4868:
4869: <div class="itemizedlist">
4870: <ul type="disc">
4871: <li>
4872: <p><a xmlns=
4873: "http://www.w3.org/TR/xhtml1/transitional" href=
4874: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 4875: target="_top"><code xmlns="" class=
4876: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 4877: packages whose installed versions do not match the
1.34 wiz 4878: latest pkgsrc entries.</p>
1.1 grant 4879: </li>
4880:
4881: <li>
4882: <p><a xmlns=
4883: "http://www.w3.org/TR/xhtml1/transitional" href=
4884: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 4885: target="_top"><code xmlns="" class=
4886: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 4887: dependency graphs of packages, to aid in choosing a
1.34 wiz 4888: strategy for updating.</p>
1.1 grant 4889: </li>
4890:
4891: <li>
4892: <p><a xmlns=
4893: "http://www.w3.org/TR/xhtml1/transitional" href=
4894: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 4895: target="_top"><code xmlns="" class=
4896: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 4897: graphs from the output of <a xmlns=
4898: "http://www.w3.org/TR/xhtml1/transitional" href=
4899: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 4900: target="_top"><code xmlns="" class=
4901: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 4902: graphviz).</p>
1.1 grant 4903: </li>
4904:
4905: <li>
4906: <p><a xmlns=
4907: "http://www.w3.org/TR/xhtml1/transitional" href=
4908: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 4909: target="_top"><code xmlns="" class=
4910: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 4911: pkglint(1) program checks a pkgsrc entry for
4912: errors, lintpkgsrc(1) does various checks on the
4913: complete pkgsrc system.</p>
1.1 grant 4914: </li>
4915:
4916: <li>
4917: <p><a xmlns=
4918: "http://www.w3.org/TR/xhtml1/transitional" href=
4919: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 4920: target="_top"><code xmlns="" class=
4921: "filename">pkgtools/pkgsurvey</code></a>: Report
4922: what packages you have installed.</p>
1.1 grant 4923: </li>
4924: </ul>
4925: </div>
4926:
4927: <p>Utilities for people maintaining or creating
4928: individual packages:</p>
4929:
4930: <div class="itemizedlist">
4931: <ul type="disc">
4932: <li>
4933: <p><a xmlns=
4934: "http://www.w3.org/TR/xhtml1/transitional" href=
4935: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 4936: target="_top"><code xmlns="" class=
4937: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 4938: making and maintaining patches for a package
1.34 wiz 4939: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4940: </li>
4941:
4942: <li>
4943: <p><a xmlns=
4944: "http://www.w3.org/TR/xhtml1/transitional" href=
4945: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 4946: target="_top"><code xmlns="" class=
4947: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 4948: "http://www.w3.org/TR/xhtml1/transitional" href=
4949: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 4950: target="_top"><code xmlns="" class=
4951: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 4952: converting to pkgsrc.</p>
1.1 grant 4953: </li>
4954:
4955: <li>
4956: <p><a xmlns=
4957: "http://www.w3.org/TR/xhtml1/transitional" href=
4958: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 4959: target="_top"><code xmlns="" class=
4960: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 4961: pkgsrc to a Solaris package.</p>
1.1 grant 4962: </li>
4963: </ul>
4964: </div>
4965:
4966: <p>Utilities for people maintaining pkgsrc (or more
4967: obscure pkg utilities)</p>
4968:
4969: <div class="itemizedlist">
4970: <ul type="disc">
4971: <li>
4972: <p><a xmlns=
4973: "http://www.w3.org/TR/xhtml1/transitional" href=
4974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.45 wiz 4975: target="_top"><code xmlns="" class=
4976: "filename">pkgtools/pkgconflict</code></a>: Find
1.20 ben 4977: packages that conflict but aren't marked as
1.34 wiz 4978: such.</p>
1.1 grant 4979: </li>
4980:
4981: <li>
4982: <p><a xmlns=
4983: "http://www.w3.org/TR/xhtml1/transitional" href=
4984: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 4985: target="_top"><code xmlns="" class=
4986: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 4987: packages in a chrooted area.</p>
1.1 grant 4988: </li>
4989:
4990: <li>
4991: <p><a xmlns=
4992: "http://www.w3.org/TR/xhtml1/transitional" href=
4993: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 4994: target="_top"><code xmlns="" class=
4995: "filename">pkgtools/libkver</code></a>: Spoof
4996: kernel version for chrooted cross builds.</p>
1.1 grant 4997: </li>
4998: </ul>
4999: </div>
5000: </div>
5001:
5002: <div class="sect1" lang="en" xml:lang="en">
5003: <div class="titlepage">
5004: <div>
5005: <div>
5006: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5007: "non-root-pkgsrc" id=
1.38 dillo 5008: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5009: as non-root</h2>
1.1 grant 5010: </div>
5011: </div>
5012: </div>
5013:
5014: <p>If you want to use pkgsrc as non-root user, you can
5015: set some variables to make pkgsrc work under these
1.33 jmmv 5016: conditions. At the very least, you need to set
5017: <code class="varname">UNPRIVILEGED</code> to
5018: “<span class="quote">yes</span>”; this will
5019: turn on unprivileged mode and set multiple related
5020: variables to allow installation of packages as
5021: non-root.</p>
5022:
5023: <p>In case the defaults are not enough, you may want to
5024: tune some other variables used. For example, if the
5025: automatic user/group detection leads to incorrect values
5026: (or not the ones you would like to use), you can change
5027: them by setting <code class=
5028: "varname">UNPRIVILEGED_USER</code> and <code class=
5029: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5030:
5031: <p>As regards bootstrapping, please note that the
5032: <span><strong class="command">bootstrap</strong></span>
5033: script will ease non-root configuration when given the
5034: “<span class=
5035: "quote">--ignore-user-check</span>” flag, as it
5036: will choose and use multiple default directories under
1.45 wiz 5037: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5038: class="filename">~/pkg</code> as the installation
1.33 jmmv 5039: targets. These directories can be overriden by the
5040: “<span class="quote">--prefix</span>” flag
5041: provided by the script, as well as some others that allow
5042: finer tuning of the tree layout.</p>
1.14 xtraeme 5043: </div>
5044:
5045: <div class="sect1" lang="en" xml:lang="en">
5046: <div class="titlepage">
5047: <div>
5048: <div>
5049: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5050: "resume-transfers" id=
1.38 dillo 5051: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5052: transfers when fetching distfiles?</h2>
1.14 xtraeme 5053: </div>
5054: </div>
5055: </div>
5056:
1.15 xtraeme 5057: <p>By default resuming transfers in pkgsrc is disabled,
5058: but you can enable this feature by adding the option
5059: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5060: into <code xmlns=
5061: "http://www.w3.org/TR/xhtml1/transitional" class=
5062: "filename">/etc/mk.conf</code>. If, during a fetch step,
5063: an incomplete distfile is found, pkgsrc will try to
5064: resume it.</p>
1.15 xtraeme 5065:
5066: <p>You can also use a different program than the default
1.24 wiz 5067: <a href=
5068: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5069: <span class="citerefentry"><span class=
5070: "refentrytitle">ftp</span>(1)</span></a> by changing the
5071: <code class="varname">FETCH_CMD</code> variable. Don't
5072: forget to set <code class=
5073: "varname">FETCH_RESUME_ARGS</code> and <code class=
5074: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5075: default values.</p>
1.14 xtraeme 5076:
1.45 wiz 5077: <p>For example, if you want to use <code xmlns=
5078: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5079: "filename">wget</code> to resume downloads, you'll have
5080: to use something like:</p>
5081: <pre class="programlisting">
1.34 wiz 5082: FETCH_CMD=wget
5083: FETCH_BEFORE_ARGS=--passive-ftp
5084: FETCH_RESUME_ARGS=-c
5085: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 5086: </pre>
1.1 grant 5087: </div>
5088:
5089: <div class="sect1" lang="en" xml:lang="en">
5090: <div class="titlepage">
5091: <div>
5092: <div>
5093: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5094: "XFree86-from-pkgsrc" id=
1.38 dillo 5095: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5096: install/use XFree86 from pkgsrc?</h2>
5097: </div>
5098: </div>
5099: </div>
5100:
5101: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5102: system's own X11 (<code xmlns=
5103: "http://www.w3.org/TR/xhtml1/transitional" class=
5104: "filename">/usr/X11R6</code>, <code xmlns=
5105: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5106: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5107: add the following line into <code xmlns=
5108: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5109: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5110: <pre class="programlisting">
1.34 wiz 5111: X11_TYPE=XFree86
1.1 grant 5112: </pre>
5113: </div>
5114:
5115: <div class="sect1" lang="en" xml:lang="en">
5116: <div class="titlepage">
5117: <div>
5118: <div>
5119: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5120: "x.org-from-pkgsrc" id=
1.38 dillo 5121: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5122: install/use X.org from pkgsrc?</h2>
5123: </div>
5124: </div>
5125: </div>
5126:
5127: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5128: system's own X11 (<code xmlns=
5129: "http://www.w3.org/TR/xhtml1/transitional" class=
5130: "filename">/usr/X11R6</code>, <code xmlns=
5131: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5132: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5133: the following line into <code xmlns=
5134: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5135: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5136: <pre class="programlisting">
1.34 wiz 5137: X11_TYPE=xorg
1.1 grant 5138: </pre>
5139: </div>
5140:
5141: <div class="sect1" lang="en" xml:lang="en">
5142: <div class="titlepage">
5143: <div>
5144: <div>
5145: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5146: "fetch-behind-firewall" id=
1.38 dillo 5147: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5148: files from behind a firewall</h2>
1.1 grant 5149: </div>
5150: </div>
5151: </div>
5152:
5153: <p>If you are sitting behind a firewall which does not
5154: allow direct connections to Internet hosts (i.e.
5155: non-NAT), you may specify the relevant proxy hosts. This
5156: is done using an environment variable in the form of a
5157: URL e.g. in Amdahl, the machine “<span class=
5158: "quote">orpheus.amdahl.com</span>” is one of the
5159: firewalls, and it uses port 80 as the proxy port number.
5160: So the proxy environment variables are:</p>
5161: <pre class="programlisting">
1.34 wiz 5162: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 5163: http_proxy=http://orpheus.amdahl.com:80/
5164: </pre>
5165: </div>
5166:
5167: <div class="sect1" lang="en" xml:lang="en">
5168: <div class="titlepage">
5169: <div>
5170: <div>
5171: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5172: "passive-ftp" id="passive-ftp"></a>7.9. How do
1.30 wiz 5173: I tell <span><strong class="command">make
1.14 xtraeme 5174: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5175: </div>
5176: </div>
5177: </div>
5178:
5179: <p>This depends on which utility is used to retrieve
1.45 wiz 5180: distfiles. From <code xmlns=
5181: "http://www.w3.org/TR/xhtml1/transitional" class=
5182: "filename">bsd.pkg.mk</code>, <code class=
5183: "varname">FETCH_CMD</code> is assigned the first
5184: available command from the following list:</p>
1.34 wiz 5185:
5186: <div class="itemizedlist">
5187: <ul type="disc">
5188: <li>
1.45 wiz 5189: <p><code xmlns=
5190: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5191: "filename">${LOCALBASE}/bin/ftp</code></p>
5192: </li>
5193:
5194: <li>
1.45 wiz 5195: <p><code xmlns=
5196: "http://www.w3.org/TR/xhtml1/transitional" class=
5197: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5198: </li>
5199: </ul>
5200: </div>
1.1 grant 5201:
5202: <p>On a default NetBSD installation, this will be
1.45 wiz 5203: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5204: class="filename">/usr/bin/ftp</code>, which automatically
5205: tries passive connections first, and falls back to active
5206: connections if the server refuses to do passive. For the
5207: other tools, add the following to your <code xmlns=
5208: "http://www.w3.org/TR/xhtml1/transitional" class=
5209: "filename">/etc/mk.conf</code> file: <code class=
5210: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5211:
1.45 wiz 5212: <p>Having that option present will prevent <code xmlns=
5213: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5214: "filename">/usr/bin/ftp</code> from falling back to
5215: active transfers.</p>
1.1 grant 5216: </div>
5217:
5218: <div class="sect1" lang="en" xml:lang="en">
5219: <div class="titlepage">
5220: <div>
5221: <div>
5222: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5223: "fetching-all-distfiles" id=
1.38 dillo 5224: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5225: fetch all distfiles at once</h2>
5226: </div>
5227: </div>
5228: </div>
5229:
5230: <p>You would like to download all the distfiles in a
5231: single batch from work or university, where you can't run
1.14 xtraeme 5232: a <span><strong class="command">make
5233: fetch</strong></span>. There is an archive of distfiles
5234: on <a href=
1.1 grant 5235: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5236: target="_top">ftp.NetBSD.org</a>, but downloading the
5237: entire directory may not be appropriate.</p>
5238:
1.14 xtraeme 5239: <p>The answer here is to do a <span><strong class=
1.45 wiz 5240: "command">make fetch-list</strong></span> in <code xmlns=
5241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5242: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 5243: subdirectories, carry the resulting list to your machine
1.23 wiz 5244: at work/school and use it there. If you don't have a
1.24 wiz 5245: NetBSD-compatible <a href=
5246: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5247: <span class="citerefentry"><span class=
5248: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5249: at work, don't forget to set <code class=
5250: "varname">FETCH_CMD</code> to something that fetches a
5251: URL:</p>
1.1 grant 5252:
5253: <p>At home:</p>
5254: <pre class="screen">
1.14 xtraeme 5255: <code class="prompt">%</code> <strong class=
5256: "userinput"><code>cd /usr/pkgsrc</code></strong>
5257: <code class="prompt">%</code> <strong class=
5258: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5259: <code class="prompt">%</code> <strong class=
5260: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5261: </pre>
5262:
5263: <p>At work:</p>
5264: <pre class="screen">
1.14 xtraeme 5265: <code class="prompt">%</code> <strong class=
5266: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5267: </pre>
5268:
1.45 wiz 5269: <p>then tar up <code xmlns=
5270: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5271: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5272:
5273: <p>If you have a machine running NetBSD, and you want to
5274: get <span class="emphasis"><em>all</em></span> distfiles
5275: (even ones that aren't for your machine architecture),
5276: you can do so by using the above-mentioned
1.14 xtraeme 5277: <span><strong class="command">make
5278: fetch-list</strong></span> approach, or fetch the
5279: distfiles directly by running:</p>
1.1 grant 5280: <pre class="screen">
1.14 xtraeme 5281: <code class="prompt">%</code> <strong class=
5282: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5283: </pre>
5284:
1.14 xtraeme 5285: <p>If you even decide to ignore <code class=
5286: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5287: can get everything by running:</p>
1.1 grant 5288: <pre class="screen">
1.14 xtraeme 5289: <code class="prompt">%</code> <strong class=
5290: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5291: </pre>
5292: </div>
5293:
5294: <div class="sect1" lang="en" xml:lang="en">
5295: <div class="titlepage">
5296: <div>
5297: <div>
5298: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5299: "tmac.andoc-missing" id=
1.38 dillo 5300: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5301: “<span class="quote">Don't know how to make
5302: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5303: </div>
5304: </div>
5305: </div>
5306:
5307: <p>When compiling the <a xmlns=
5308: "http://www.w3.org/TR/xhtml1/transitional" href=
5309: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5310: target="_top"><code xmlns="" class=
5311: "filename">pkgtools/pkg_install</code></a> package, you
5312: get the error from make that it doesn't know how to make
5313: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5314: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5315: indicates that you don't have installed the
1.23 wiz 5316: “<span class="quote">text</span>” set (nroff,
5317: ...) from the NetBSD base distribution on your machine.
5318: It is recommended to do that to format manpages.</p>
1.1 grant 5319:
5320: <p>In the case of the <a xmlns=
5321: "http://www.w3.org/TR/xhtml1/transitional" href=
5322: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5323: target="_top"><code xmlns="" class=
5324: "filename">pkgtools/pkg_install</code></a> package, you
5325: can get away with setting <code class=
1.20 ben 5326: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5327: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5328: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5329: </div>
5330:
5331: <div class="sect1" lang="en" xml:lang="en">
5332: <div class="titlepage">
5333: <div>
5334: <div>
5335: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5336: "bsd.own.mk-missing" id=
1.38 dillo 5337: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5338: “<span class="quote">Could not find
5339: bsd.own.mk</span>” mean?</h2>
5340: </div>
5341: </div>
5342: </div>
5343:
1.45 wiz 5344: <p>You didn't install the compiler set, <code xmlns=
5345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5346: "filename">comp.tgz</code>, when you installed your
5347: NetBSD machine. Please get it and install it, by
1.45 wiz 5348: extracting it in <code xmlns=
5349: "http://www.w3.org/TR/xhtml1/transitional" class=
5350: "filename">/</code>:</p>
1.1 grant 5351: <pre class="screen">
1.14 xtraeme 5352: <code class="prompt">#</code> <strong class=
5353: "userinput"><code>cd /</code></strong>
5354: <code class="prompt">#</code> <strong class=
5355: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5356: </pre>
5357:
1.45 wiz 5358: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5359: class="filename">comp.tgz</code> is part of every NetBSD
5360: release. Get the one that corresponds to your release
5361: (determine via <span><strong class="command">uname
5362: -r</strong></span>).</p>
1.1 grant 5363: </div>
5364:
5365: <div class="sect1" lang="en" xml:lang="en">
5366: <div class="titlepage">
5367: <div>
5368: <div>
5369: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5370: "using-sudo-with-pkgsrc" id=
1.38 dillo 5371: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5372: 'sudo' with pkgsrc</h2>
5373: </div>
5374: </div>
5375: </div>
5376:
5377: <p>When installing packages as non-root user and using
1.24 wiz 5378: the just-in-time <a href=
5379: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5380: <span class="citerefentry"><span class=
5381: "refentrytitle">su</span>(1)</span></a> feature of
5382: pkgsrc, it can become annoying to type in the root
5383: password for each required package installed. To avoid
5384: this, the sudo package can be used, which does password
5385: caching over a limited time. To use it, install sudo
5386: (either as binary package or from <a xmlns=
5387: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5388: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5389: target="_top"><code xmlns="" class=
5390: "filename">security/sudo</code></a>) and then put the
5391: following into your <code xmlns=
5392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5393: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5394: <pre class="programlisting">
1.34 wiz 5395: .if exists(${LOCALBASE}/bin/sudo)
5396: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
5397: .endif
1.1 grant 5398: </pre>
5399: </div>
5400:
5401: <div class="sect1" lang="en" xml:lang="en">
5402: <div class="titlepage">
5403: <div>
5404: <div>
5405: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5406: "faq.conf" id="faq.conf"></a>7.14. How do I
1.35 jmmv 5407: change the location of configuration files?</h2>
1.1 grant 5408: </div>
5409: </div>
5410: </div>
5411:
1.35 jmmv 5412: <p>As the system administrator, you can choose where
5413: configuration files are installed. The default settings
1.45 wiz 5414: make all these files go into <code xmlns=
5415: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5416: "filename">${PREFIX}/etc</code> or some of its
5417: subdirectories; this may be suboptimal depending on your
5418: expectations (e.g., a read-only, NFS-exported
5419: <code class="varname">PREFIX</code> with a need of
5420: per-machine configuration of the provided packages).</p>
5421:
5422: <p>In order to change the defaults, you can modify the
5423: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5424: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5425: class="filename">/etc/mk.conf</code>) to point to your
5426: preferred configuration directory; some common examples
5427: include <code xmlns=
5428: "http://www.w3.org/TR/xhtml1/transitional" class=
5429: "filename">/etc</code> or <code xmlns=
5430: "http://www.w3.org/TR/xhtml1/transitional" class=
5431: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5432:
5433: <p>Furthermore, you can change this value on a
5434: per-package basis by setting the <code class=
5435: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5436: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5437: value usually matches the name of the package you would
5438: like to modify, that is, the contents of <code class=
5439: "varname">PKGBASE</code>.</p>
1.1 grant 5440:
1.35 jmmv 5441: <p>Note that, after changing these settings, you must
5442: rebuild and reinstall any affected packages.</p>
1.1 grant 5443: </div>
5444:
5445: <div class="sect1" lang="en" xml:lang="en">
5446: <div class="titlepage">
5447: <div>
5448: <div>
5449: <h2 class="title" style="clear: both"><a name=
5450: "audit-packages" id=
1.38 dillo 5451: "audit-packages"></a>7.15. Automated security
1.1 grant 5452: checks</h2>
5453: </div>
5454: </div>
5455: </div>
5456:
5457: <p>Please be aware that there can often be bugs in
5458: third-party software, and some of these bugs can leave a
5459: machine vulnerable to exploitation by attackers. In an
5460: effort to lessen the exposure, the NetBSD packages team
5461: maintains a database of known-exploits to packages which
5462: have at one time been included in pkgsrc. The database
5463: can be downloaded automatically, and a security audit of
5464: all packages installed on a system can take place. To do
5465: this, install the <a xmlns=
5466: "http://www.w3.org/TR/xhtml1/transitional" href=
5467: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5468: target="_top"><code xmlns="" class=
5469: "filename">security/audit-packages</code></a> package. It
1.20 ben 5470: has two components:</p>
1.1 grant 5471:
5472: <div class="orderedlist">
5473: <ol type="1">
5474: <li>
1.34 wiz 5475: <p><span><strong class=
5476: "command">download-vulnerability-list</strong></span>,
1.1 grant 5477: an easy way to download a list of the security
5478: vulnerabilities information. This list is kept up
5479: to date by the NetBSD security officer and the
5480: NetBSD packages team, and is distributed from the
5481: NetBSD ftp server:</p>
5482:
5483: <p><a href=
5484: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5485: target=
5486: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5487: </li>
5488:
5489: <li>
1.34 wiz 5490: <p><span><strong class=
5491: "command">audit-packages</strong></span>, an easy
5492: way to audit the current machine, checking each
1.1 grant 5493: vulnerability which is known. If a vulnerable
5494: package is installed, it will be shown by output to
5495: stdout, including a description of the type of
5496: vulnerability, and a URL containing more
5497: information.</p>
5498: </li>
5499: </ol>
5500: </div>
5501:
1.23 wiz 5502: <p>Use of the <a xmlns=
5503: "http://www.w3.org/TR/xhtml1/transitional" href=
5504: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5505: target="_top"><code xmlns="" class=
5506: "filename">security/audit-packages</code></a> package is
1.23 wiz 5507: strongly recommended! After “<span class=
5508: "quote">audit-packages</span>” is installed, please
5509: read the package's message, which you can get by running
5510: <strong class="userinput"><code>pkg_info -D
5511: audit-package</code></strong>.</p>
1.1 grant 5512: </div>
5513: </div>
5514: </div>
5515:
5516: <div class="part" lang="en" xml:lang="en">
5517: <div class="titlepage">
5518: <div>
5519: <div>
5520: <h1 class="title"><a name="developers-guide" id=
1.46 ! gdt 5521: "developers-guide"></a>The pkgsrc developer's
! 5522: guide</h1>
1.1 grant 5523: </div>
5524: </div>
5525: </div>
5526:
5527: <div class="toc">
5528: <p><b>Table of Contents</b></p>
5529:
5530: <dl>
1.38 dillo 5531: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5532: Package components - files, directories and
5533: contents</a></span></dt>
5534:
5535: <dd>
5536: <dl>
5537: <dt><span class="sect1"><a href=
1.45 wiz 5538: "#components.Makefile">8.1. <code xmlns=
5539: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5540: "filename">Makefile</code></a></span></dt>
5541:
5542: <dt><span class="sect1"><a href=
1.45 wiz 5543: "#components.distinfo">8.2. <code xmlns=
5544: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5545: "filename">distinfo</code></a></span></dt>
5546:
5547: <dt><span class="sect1"><a href=
1.38 dillo 5548: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5549:
1.30 wiz 5550: <dt><span class="sect1"><a href=
1.38 dillo 5551: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5552: files</a></span></dt>
1.27 rillig 5553:
5554: <dt><span class="sect1"><a href=
1.38 dillo 5555: "#components.optional">8.5. Optional
1.27 rillig 5556: files</a></span></dt>
5557:
1.38 dillo 5558: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5559: <code xmlns=
5560: "http://www.w3.org/TR/xhtml1/transitional" class=
5561: "filename">work*</code></a></span></dt>
1.27 rillig 5562:
1.38 dillo 5563: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5564: <code xmlns=
5565: "http://www.w3.org/TR/xhtml1/transitional" class=
5566: "filename">files/*</code></a></span></dt>
1.27 rillig 5567: </dl>
5568: </dd>
5569:
1.38 dillo 5570: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5571: Programming in <code xmlns=
5572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5573: "filename">Makefile</code>s</a></span></dt>
5574:
5575: <dd>
5576: <dl>
5577: <dt><span class="sect1"><a href=
1.45 wiz 5578: "#makefile.variables">9.1. <code xmlns=
5579: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5580: "filename">Makefile</code> variables</a></span></dt>
5581:
1.27 rillig 5582: <dd>
5583: <dl>
5584: <dt><span class="sect2"><a href=
1.38 dillo 5585: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5586: conventions</a></span></dt>
5587: </dl>
5588: </dd>
5589:
1.38 dillo 5590: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5591: Code snippets</a></span></dt>
5592:
5593: <dd>
5594: <dl>
5595: <dt><span class="sect2"><a href=
1.38 dillo 5596: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5597: list</a></span></dt>
5598:
5599: <dt><span class="sect2"><a href=
1.38 dillo 5600: "#converting-internal-to-external">9.2.2.
1.30 wiz 5601: Converting an internal list into an external
5602: list</a></span></dt>
1.25 rillig 5603:
5604: <dt><span class="sect2"><a href=
1.38 dillo 5605: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5606: variables to a shell command</a></span></dt>
1.27 rillig 5607:
5608: <dt><span class="sect2"><a href=
1.38 dillo 5609: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5610: guideline</a></span></dt>
5611:
5612: <dt><span class="sect2"><a href=
1.38 dillo 5613: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5614: a bug in BSD Make</a></span></dt>
1.25 rillig 5615: </dl>
5616: </dd>
5617: </dl>
5618: </dd>
5619:
1.38 dillo 5620: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5621: issues</a></span></dt>
5622:
5623: <dd>
5624: <dl>
1.38 dillo 5625: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5626: ID</a></span></dt>
5627:
1.30 wiz 5628: <dt><span class="sect1"><a href=
1.38 dillo 5629: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5630: <code xmlns=
5631: "http://www.w3.org/TR/xhtml1/transitional" class=
5632: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5633:
1.38 dillo 5634: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5635: Tweaking output of <span><strong class="command">make
5636: print-PLIST</strong></span></a></span></dt>
1.1 grant 5637:
1.38 dillo 5638: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5639: Variable substitution in PLIST</a></span></dt>
5640:
1.30 wiz 5641: <dt><span class="sect1"><a href=
1.38 dillo 5642: "#manpage-compression">10.5.
1.1 grant 5643: Manpage-compression</a></span></dt>
5644:
1.30 wiz 5645: <dt><span class="sect1"><a href=
1.38 dillo 5646: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5647: <code class=
1.14 xtraeme 5648: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5649:
1.30 wiz 5650: <dt><span class="sect1"><a href=
1.38 dillo 5651: "#platform-specific-plist">10.7. Platform specific
5652: and differing PLISTs</a></span></dt>
1.1 grant 5653:
5654: <dt><span class="sect1"><a href=
1.38 dillo 5655: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5656: packages</a></span></dt>
5657: </dl>
5658: </dd>
5659:
1.38 dillo 5660: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5661: Buildlink methodology</a></span></dt>
5662:
5663: <dd>
5664: <dl>
1.30 wiz 5665: <dt><span class="sect1"><a href=
1.38 dillo 5666: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5667: to use buildlink3</a></span></dt>
1.1 grant 5668:
1.30 wiz 5669: <dt><span class="sect1"><a href=
1.45 wiz 5670: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5671: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5672: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5673:
5674: <dd>
5675: <dl>
5676: <dt><span class="sect2"><a href=
1.38 dillo 5677: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5678: buildlink3.mk file</a></span></dt>
1.1 grant 5679:
5680: <dt><span class="sect2"><a href=
1.38 dillo 5681: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5682: <code class=
5683: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 wiz 5684: <code>pkg</code></em></code> in <code xmlns=
5685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5686: "filename">buildlink3.mk</code>
1.1 grant 5687: files</a></span></dt>
5688: </dl>
5689: </dd>
5690:
1.30 wiz 5691: <dt><span class="sect1"><a href=
1.45 wiz 5692: "#writing-builtin.mk">11.3. Writing <code xmlns=
5693: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5694: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5695:
5696: <dd>
5697: <dl>
5698: <dt><span class="sect2"><a href=
1.38 dillo 5699: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5700: <code xmlns=
5701: "http://www.w3.org/TR/xhtml1/transitional" class=
5702: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5703:
5704: <dt><span class="sect2"><a href=
1.38 dillo 5705: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5706: preferences for native or pkgsrc
5707: software</a></span></dt>
1.1 grant 5708: </dl>
5709: </dd>
5710: </dl>
5711: </dd>
5712:
1.38 dillo 5713: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5714: pkginstall framework</a></span></dt>
5715:
5716: <dd>
5717: <dl>
5718: <dt><span class="sect1"><a href=
1.38 dillo 5719: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5720: directories outside the installation
5721: prefix</a></span></dt>
5722:
5723: <dd>
5724: <dl>
5725: <dt><span class="sect2"><a href=
1.38 dillo 5726: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5727: manipulation</a></span></dt>
5728:
5729: <dt><span class="sect2"><a href=
1.38 dillo 5730: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5731: manipulation</a></span></dt>
5732: </dl>
5733: </dd>
5734:
1.38 dillo 5735: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5736: Configuration files</a></span></dt>
5737:
5738: <dd>
5739: <dl>
5740: <dt><span class="sect2"><a href=
1.38 dillo 5741: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5742: "varname">PKG_SYSCONFDIR</code> is
5743: set</a></span></dt>
5744:
5745: <dt><span class="sect2"><a href=
1.38 dillo 5746: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 5747: software were configuration files
5748: are</a></span></dt>
5749:
5750: <dt><span class="sect2"><a href=
1.38 dillo 5751: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5752: installations</a></span></dt>
5753:
5754: <dt><span class="sect2"><a href=
1.38 dillo 5755: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5756: of configuration files</a></span></dt>
5757: </dl>
5758: </dd>
5759:
1.38 dillo 5760: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5761: System startup scripts</a></span></dt>
5762:
5763: <dd>
5764: <dl>
5765: <dt><span class="sect2"><a href=
1.38 dillo 5766: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5767: of system startup scripts</a></span></dt>
5768: </dl>
5769: </dd>
5770:
5771: <dt><span class="sect1"><a href=
1.38 dillo 5772: "#users-and-groups">12.4. System users and
1.35 jmmv 5773: groups</a></span></dt>
5774:
1.38 dillo 5775: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5776: System shells</a></span></dt>
5777:
5778: <dd>
5779: <dl>
5780: <dt><span class="sect2"><a href=
1.38 dillo 5781: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5782: configuration files</a></span></dt>
5783: </dl>
5784: </dd>
5785: </dl>
5786: </dd>
5787:
1.38 dillo 5788: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5789: handling</a></span></dt>
5790:
5791: <dd>
5792: <dl>
1.30 wiz 5793: <dt><span class="sect1"><a href=
1.38 dillo 5794: "#global-default-options">13.1. Global default
1.30 wiz 5795: options</a></span></dt>
1.1 grant 5796:
1.30 wiz 5797: <dt><span class="sect1"><a href=
1.38 dillo 5798: "#converting-to-options">13.2. Converting packages to
1.45 wiz 5799: use <code xmlns=
5800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5801: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5802: </dl>
5803: </dd>
5804:
1.38 dillo 5805: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5806: process</a></span></dt>
5807:
5808: <dd>
5809: <dl>
1.38 dillo 5810: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5811: Program location</a></span></dt>
5812:
1.38 dillo 5813: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5814: Main targets</a></span></dt>
5815:
5816: <dt><span class="sect1"><a href=
1.38 dillo 5817: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5818: targets</a></span></dt>
5819: </dl>
5820: </dd>
5821:
1.38 dillo 5822: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5823: fixes for packages</a></span></dt>
5824:
5825: <dd>
5826: <dl>
1.30 wiz 5827: <dt><span class="sect1"><a href=
1.38 dillo 5828: "#general-operation">15.1. General
1.30 wiz 5829: operation</a></span></dt>
1.1 grant 5830:
5831: <dd>
5832: <dl>
5833: <dt><span class="sect2"><a href=
1.38 dillo 5834: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5835: pull in variables from
5836: /etc/mk.conf</a></span></dt>
1.1 grant 5837:
5838: <dt><span class="sect2"><a href=
1.38 dillo 5839: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5840: to install documentation</a></span></dt>
5841:
5842: <dt><span class="sect2"><a href=
1.38 dillo 5843: "#restricted-packages">15.1.3. Restricted
1.1 grant 5844: packages</a></span></dt>
5845:
5846: <dt><span class="sect2"><a href=
1.38 dillo 5847: "#dependencies">15.1.4. Handling
1.1 grant 5848: dependencies</a></span></dt>
5849:
5850: <dt><span class="sect2"><a href=
1.38 dillo 5851: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5852: other packages</a></span></dt>
5853:
5854: <dt><span class="sect2"><a href=
1.38 dillo 5855: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5856: cannot or should not be built</a></span></dt>
1.1 grant 5857:
5858: <dt><span class="sect2"><a href=
1.38 dillo 5859: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 5860: should not be deleted, once
5861: installed</a></span></dt>
1.1 grant 5862:
5863: <dt><span class="sect2"><a href=
1.38 dillo 5864: "#security-handling">15.1.8. Handling packages
1.1 grant 5865: with security problems</a></span></dt>
5866:
5867: <dt><span class="sect2"><a href=
1.38 dillo 5868: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 5869: bugs</a></span></dt>
5870:
5871: <dt><span class="sect2"><a href=
1.38 dillo 5872: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 5873: incrementing versions when fixing an existing
1.1 grant 5874: package</a></span></dt>
5875:
5876: <dt><span class="sect2"><a href=
1.38 dillo 5877: "#portability-of-packages">15.1.11. Portability
1.30 wiz 5878: of packages</a></span></dt>
1.1 grant 5879: </dl>
5880: </dd>
5881:
1.30 wiz 5882: <dt><span class="sect1"><a href=
1.38 dillo 5883: "#downloading-issues">15.2. Possible downloading
1.30 wiz 5884: issues</a></span></dt>
1.1 grant 5885:
5886: <dd>
5887: <dl>
5888: <dt><span class="sect2"><a href=
1.38 dillo 5889: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 5890: distfiles aren't available for plain
1.1 grant 5891: downloading</a></span></dt>
5892:
5893: <dt><span class="sect2"><a href=
1.38 dillo 5894: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 5895: handle modified distfiles with the 'old'
5896: name</a></span></dt>
1.1 grant 5897: </dl>
5898: </dd>
5899:
1.30 wiz 5900: <dt><span class="sect1"><a href=
1.38 dillo 5901: "#configuration-gotchas">15.3. Configuration
1.30 wiz 5902: gotchas</a></span></dt>
1.1 grant 5903:
5904: <dd>
5905: <dl>
5906: <dt><span class="sect2"><a href=
1.38 dillo 5907: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 5908: libtool</a></span></dt>
5909:
5910: <dt><span class="sect2"><a href=
1.38 dillo 5911: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 5912: packages that already support
5913: libtool</a></span></dt>
5914:
5915: <dt><span class="sect2"><a href=
1.38 dillo 5916: "#autoconf-automake">15.3.3. GNU
1.1 grant 5917: Autoconf/Automake</a></span></dt>
5918: </dl>
5919: </dd>
5920:
1.30 wiz 5921: <dt><span class="sect1"><a href=
1.38 dillo 5922: "#building-considerations">15.4. Building
1.30 wiz 5923: considerations</a></span></dt>
1.1 grant 5924:
5925: <dd>
5926: <dl>
5927: <dt><span class="sect2"><a href=
1.38 dillo 5928: "#cpp-defines">15.4.1. CPP
1.30 wiz 5929: defines</a></span></dt>
1.1 grant 5930: </dl>
5931: </dd>
5932:
1.30 wiz 5933: <dt><span class="sect1"><a href=
1.38 dillo 5934: "#package-specific-actions">15.5. Package specific
1.30 wiz 5935: actions</a></span></dt>
1.1 grant 5936:
5937: <dd>
5938: <dl>
5939: <dt><span class="sect2"><a href=
1.38 dillo 5940: "#user-interaction">15.5.1. User
1.2 hubertf 5941: interaction</a></span></dt>
1.1 grant 5942:
5943: <dt><span class="sect2"><a href=
1.38 dillo 5944: "#handling-licenses">15.5.2. Handling
1.1 grant 5945: licenses</a></span></dt>
5946:
5947: <dt><span class="sect2"><a href=
1.38 dillo 5948: "#installing-score-files">15.5.3. Installing
1.30 wiz 5949: score files</a></span></dt>
1.1 grant 5950:
5951: <dt><span class="sect2"><a href=
1.38 dillo 5952: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 5953: scripts</a></span></dt>
5954:
5955: <dt><span class="sect2"><a href=
1.38 dillo 5956: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 5957: hardcoded paths to other
5958: interpreters</a></span></dt>
1.1 grant 5959:
5960: <dt><span class="sect2"><a href=
1.38 dillo 5961: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 5962: modules</a></span></dt>
5963:
5964: <dt><span class="sect2"><a href=
1.38 dillo 5965: "#faq.info-files">15.5.7. Packages installing
1.1 grant 5966: info files</a></span></dt>
5967:
5968: <dt><span class="sect2"><a href=
1.38 dillo 5969: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 5970: GConf2 data files</a></span></dt>
1.1 grant 5971:
5972: <dt><span class="sect2"><a href=
1.38 dillo 5973: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 5974: installing scrollkeeper data
5975: files</a></span></dt>
1.1 grant 5976:
5977: <dt><span class="sect2"><a href=
1.38 dillo 5978: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 5979: fonts</a></span></dt>
5980:
5981: <dt><span class="sect2"><a href=
1.38 dillo 5982: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 5983: modules</a></span></dt>
5984:
5985: <dt><span class="sect2"><a href=
1.38 dillo 5986: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 5987: SGML or XML data</a></span></dt>
1.1 grant 5988:
5989: <dt><span class="sect2"><a href=
1.38 dillo 5990: "#mime-database">15.5.13. Packages installing
1.1 grant 5991: extensions to the MIME database</a></span></dt>
5992:
5993: <dt><span class="sect2"><a href=
1.38 dillo 5994: "#intltool">15.5.14. Packages using
1.1 grant 5995: intltool</a></span></dt>
1.18 xtraeme 5996:
5997: <dt><span class="sect2"><a href=
1.38 dillo 5998: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 5999: startup scripts</a></span></dt>
1.1 grant 6000: </dl>
6001: </dd>
6002:
1.30 wiz 6003: <dt><span class="sect1"><a href=
1.38 dillo 6004: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6005: author</a></span></dt>
1.1 grant 6006: </dl>
6007: </dd>
6008:
1.38 dillo 6009: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6010: Debugging</a></span></dt>
6011:
1.38 dillo 6012: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6013: Submitting and Committing</a></span></dt>
6014:
6015: <dd>
6016: <dl>
1.30 wiz 6017: <dt><span class="sect1"><a href=
1.38 dillo 6018: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6019: packages</a></span></dt>
1.1 grant 6020:
1.30 wiz 6021: <dt><span class="sect1"><a href=
1.41 wiz 6022: "#general-notes-for-changes">17.2. General notes when
6023: adding, updating, or removing
6024: packages</a></span></dt>
6025:
6026: <dt><span class="sect1"><a href=
6027: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6028: package into CVS</a></span></dt>
1.1 grant 6029:
1.30 wiz 6030: <dt><span class="sect1"><a href=
1.41 wiz 6031: "#updating-package">17.4. Updating a package to a
1.30 wiz 6032: newer version</a></span></dt>
1.1 grant 6033:
1.30 wiz 6034: <dt><span class="sect1"><a href=
1.41 wiz 6035: "#moving-package">17.5. Moving a package in
1.30 wiz 6036: pkgsrc</a></span></dt>
1.1 grant 6037: </dl>
6038: </dd>
6039: </dl>
6040: </div>
6041:
6042: <div class="chapter" lang="en" xml:lang="en">
6043: <div class="titlepage">
6044: <div>
6045: <div>
1.27 rillig 6046: <h2 class="title"><a name="components" id=
1.38 dillo 6047: "components"></a>Chapter 8. Package
1.27 rillig 6048: components - files, directories and contents</h2>
1.25 rillig 6049: </div>
6050: </div>
6051: </div>
6052:
6053: <div class="toc">
6054: <p><b>Table of Contents</b></p>
6055:
6056: <dl>
6057: <dt><span class="sect1"><a href=
1.45 wiz 6058: "#components.Makefile">8.1. <code xmlns=
6059: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6060: "filename">Makefile</code></a></span></dt>
6061:
6062: <dt><span class="sect1"><a href=
1.45 wiz 6063: "#components.distinfo">8.2. <code xmlns=
6064: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6065: "filename">distinfo</code></a></span></dt>
6066:
6067: <dt><span class="sect1"><a href=
1.38 dillo 6068: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6069:
1.30 wiz 6070: <dt><span class="sect1"><a href=
1.38 dillo 6071: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6072: files</a></span></dt>
1.25 rillig 6073:
1.27 rillig 6074: <dt><span class="sect1"><a href=
1.38 dillo 6075: "#components.optional">8.5. Optional
1.27 rillig 6076: files</a></span></dt>
1.25 rillig 6077:
1.38 dillo 6078: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6079: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6080: class="filename">work*</code></a></span></dt>
1.25 rillig 6081:
1.38 dillo 6082: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6083: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6084: class="filename">files/*</code></a></span></dt>
1.25 rillig 6085: </dl>
6086: </div>
6087:
1.27 rillig 6088: <p>Whenever you're preparing a package, there are a number
6089: of files involved which are described in the following
6090: sections.</p>
1.25 rillig 6091:
6092: <div class="sect1" lang="en" xml:lang="en">
6093: <div class="titlepage">
6094: <div>
6095: <div>
6096: <h2 class="title" style="clear: both"><a name=
1.27 rillig 6097: "components.Makefile" id=
1.45 wiz 6098: "components.Makefile"></a>8.1. <code xmlns=
6099: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6100: "filename">Makefile</code></h2>
1.25 rillig 6101: </div>
6102: </div>
6103: </div>
6104:
1.27 rillig 6105: <p>Building, installation and creation of a binary
1.45 wiz 6106: package are all controlled by the package's <code xmlns=
6107: "http://www.w3.org/TR/xhtml1/transitional" class=
6108: "filename">Makefile</code>. The <code xmlns=
6109: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6110: "filename">Makefile</code> describes various things about
6111: a package, for example from where to get it, how to
6112: configure, build, and install it.</p>
6113:
1.45 wiz 6114: <p>A package <code xmlns=
6115: "http://www.w3.org/TR/xhtml1/transitional" class=
6116: "filename">Makefile</code> contains several sections that
6117: describe the package.</p>
1.25 rillig 6118:
1.27 rillig 6119: <p>In the first section there are the following
6120: variables, which should appear exactly in the order given
6121: here.</p>
1.25 rillig 6122:
6123: <div class="itemizedlist">
6124: <ul type="disc">
6125: <li>
1.27 rillig 6126: <p><code class="varname">DISTNAME</code> is the
6127: basename of the distribution file to be downloaded
6128: from the package's website.</p>
6129: </li>
6130:
6131: <li>
6132: <p><code class="varname">PKGNAME</code> is the name
6133: of the package, as used by pkgsrc. You only need to
6134: provide it if it differs from DISTNAME. Usually it
6135: is the directory name together with the version
6136: number. It must match the regular expression
6137: <code class=
6138: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6139: that is, it starts with a letter or digit, and
6140: contains only letters, digits, dashes, underscores,
6141: dots and plus signs.</p>
1.25 rillig 6142: </li>
6143:
6144: <li>
1.27 rillig 6145: <p><code class="varname">CATEGORIES</code> is a
6146: list of categories which the package fits in. You
6147: can choose any of the top-level directories of
6148: pkgsrc for it.</p>
1.45 wiz 6149:
6150: <p>Currently the following values are available for
6151: <code class="varname">CATEGORIES</code>. If more
6152: than one is used, they need to be separated by
6153: spaces:</p>
6154: <pre class="programlisting">
6155: archivers cross geography meta-pkgs security
6156: audio databases graphics misc shells
6157: benchmarks devel ham multimedia sysutils
6158: biology editors inputmethod net textproc
6159: cad emulators lang news time
6160: chat finance mail parallel wm
6161: comms fonts math pkgtools www
6162: converters games mbone print x11
6163: </pre>
1.25 rillig 6164: </li>
6165:
6166: <li>
1.27 rillig 6167: <p><code class="varname">MASTER_SITES</code> is a
6168: list of URLs where the distribution files can be
6169: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6170:
6171: <p>The <code class="varname">MASTER_SITES</code>
6172: may make use of the following predefined sites:</p>
6173: <pre class="programlisting">
6174: ${MASTER_SITE_APACHE}
6175: ${MASTER_SITE_BACKUP}
6176: ${MASTER_SITE_CYGWIN}
6177: ${MASTER_SITE_DEBIAN}
6178: ${MASTER_SITE_FREEBSD}
6179: ${MASTER_SITE_FREEBSD_LOCAL}
6180: ${MASTER_SITE_GNOME}
6181: ${MASTER_SITE_GNU}
6182: ${MASTER_SITE_GNUSTEP}
6183: ${MASTER_SITE_IFARCHIVE}
6184: ${MASTER_SITE_MOZILLA}
6185: ${MASTER_SITE_OPENOFFICE}
6186: ${MASTER_SITE_PERL_CPAN}
6187: ${MASTER_SITE_R_CRAN}
6188: ${MASTER_SITE_SOURCEFORGE}
6189: ${MASTER_SITE_SUNSITE}
6190: ${MASTER_SITE_SUSE}
6191: ${MASTER_SITE_TEX_CTAN}
6192: ${MASTER_SITE_XCONTRIB}
6193: ${MASTER_SITE_XEMACS}
6194:
6195: </pre>
6196:
6197: <p>If one of these predefined sites is chosen, you
6198: may want to specify a subdirectory of that site.
6199: Since these macros may expand to more than one
6200: actual site, you <span class=
6201: "emphasis"><em>must</em></span> use the following
6202: construct to specify a subdirectory:</p>
6203: <pre class="programlisting">
6204: ${MASTER_SITE_GNU:=subdirectory/name/}
6205: ${MASTER_SITE_SOURCEFORGE:=project_name/}
6206: </pre>
6207:
6208: <p>Note the trailing slash after the subdirectory
6209: name.</p>
6210:
6211: <p>If the package has multiple <code class=
6212: "varname">DISTFILES</code> or multiple <code class=
6213: "varname">PATCHFILES</code> from different sites,
6214: set <code class="varname">SITES_foo</code> to a
6215: list of URI's where file “<span class=
6216: "quote">foo</span>” may be found.
6217: “<span class="quote">foo</span>”
6218: includes the suffix, e.g.</p>
6219: <pre class="programlisting">
6220: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6221: DISTFILES+= foo-file.tar.gz
6222: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6223: http://www.somewhereelse.com/mirror/somehow/
6224: </pre>
6225: </li>
6226:
6227: <li>
6228: <p><code class="varname">DISTFILES</code>: Name(s)
6229: of archive file(s) containing distribution. The
6230: default is <code xmlns=
6231: "http://www.w3.org/TR/xhtml1/transitional" class=
6232: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6233: Should only be set if you have more than one
6234: distfile.</p>
6235:
6236: <p>Note that the normal default setting of
6237: <code class="varname">DISTFILES</code> must be made
6238: explicit if you want to add to it (rather than
6239: replace it), as you usually would.</p>
6240: </li>
6241:
6242: <li>
6243: <p><code class="varname">EXTRACT_SUFX</code>:
6244: Suffix of the distribution file, will be appended
6245: to <code class="varname">DISTNAME</code>. Defaults
6246: to <code xmlns=
6247: "http://www.w3.org/TR/xhtml1/transitional" class=
6248: "filename">.tar.gz</code>.</p>
6249: </li>
6250: </ul>
6251: </div>
6252:
6253: <p>The second section contains information about
6254: separately downloaded patches, if any.</p>
6255:
6256: <div class="itemizedlist">
6257: <ul type="disc">
6258: <li>
6259: <p><code class="varname">PATCHFILES</code> Name(s)
6260: of additional files that contain distribution
6261: patches. There is no default. pkgsrc will look for
6262: them at <code class="varname">PATCH_SITES</code>.
6263: They will automatically be uncompressed before
6264: patching if the names end with <code xmlns=
6265: "http://www.w3.org/TR/xhtml1/transitional" class=
6266: "filename">.gz</code> or <code xmlns=
6267: "http://www.w3.org/TR/xhtml1/transitional" class=
6268: "filename">.Z</code>.</p>
6269: </li>
6270:
6271: <li>
6272: <p><code class="varname">PATCH_SITES</code>:
6273: Primary location(s) for distribution patch files
6274: (see <code class="varname">PATCHFILES</code> below)
6275: if not found locally.</p>
1.25 rillig 6276: </li>
6277: </ul>
6278: </div>
6279:
1.45 wiz 6280: <p>The third section contains the following
1.27 rillig 6281: variables.</p>
1.25 rillig 6282:
1.27 rillig 6283: <div class="itemizedlist">
6284: <ul type="disc">
6285: <li>
6286: <p><code class="varname">MAINTAINER</code> is the
1.45 wiz 6287: email address of the contact person for this
6288: package. The person who feels responsible for this
6289: package, and who is most likely to look at problems
6290: or questions regarding this package which have been
6291: reported with <a href=
6292: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6293: <span class="citerefentry"><span class=
6294: "refentrytitle">send-pr</span>(1)</span></a>. The
6295: right person to contact before making major changes
6296: to the package. When packaging a new program, set
6297: <code class="varname">MAINTAINER</code> to
6298: yourself. If you really can't maintain the package
6299: for future updates, set it to <code class=
6300: "email"><<a href=
6301: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6302: </li>
1.25 rillig 6303:
1.27 rillig 6304: <li>
6305: <p><code class="varname">HOMEPAGE</code> is a URL
6306: where users can find more information about the
1.23 wiz 6307: package.</p>
6308: </li>
1.1 grant 6309:
1.23 wiz 6310: <li>
6311: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6312: one-line description of the package (should not
6313: include the package name).</p>
1.23 wiz 6314: </li>
6315: </ul>
6316: </div>
1.1 grant 6317:
1.45 wiz 6318: <p>Other variables that affect the build:</p>
1.1 grant 6319:
1.45 wiz 6320: <div class="itemizedlist">
6321: <ul type="disc">
6322: <li>
6323: <p><code class="varname">WRKSRC</code>: The
6324: subdirectory of <code xmlns=
6325: "http://www.w3.org/TR/xhtml1/transitional" class=
6326: "filename">${WRKDIR}</code> to which the
6327: distribution actually unpacks. The default is
6328: <code xmlns=
6329: "http://www.w3.org/TR/xhtml1/transitional" class=
6330: "filename">${WRKDIR}/${DISTNAME}</code>. The value
6331: of <code class="varname">WRKSRC</code> should be
6332: set explicitly if the package does not follow
6333: standard conventions and include the package's name
6334: as a subdirectory.</p>
6335: </li>
6336: </ul>
1.1 grant 6337: </div>
6338:
6339: <p>Please pay attention to the following gotchas:</p>
6340:
6341: <div class="itemizedlist">
6342: <ul type="disc">
6343: <li>
1.14 xtraeme 6344: <p>Add <code class="varname">MANCOMPRESSED</code>
6345: if manpages are installed in compressed form by the
1.45 wiz 6346: package; see comment in <code xmlns=
6347: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6348: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6349: </li>
6350:
6351: <li>
1.45 wiz 6352: <p>Replace <code xmlns=
6353: "http://www.w3.org/TR/xhtml1/transitional" class=
6354: "filename">/usr/local</code> with
6355: “<span class="quote">${PREFIX}</span>”
6356: in all files (see patches, below).</p>
1.1 grant 6357: </li>
6358:
6359: <li>
6360: <p>If the package installs any info files, see
6361: <a href="#faq.info-files" title=
1.45 wiz 6362: "15.5.7. Packages installing info files">Section 15.5.7,
6363: “Packages installing info
1.1 grant 6364: files”</a>.</p>
6365: </li>
6366: </ul>
6367: </div>
6368: </div>
6369:
6370: <div class="sect1" lang="en" xml:lang="en">
6371: <div class="titlepage">
6372: <div>
6373: <div>
6374: <h2 class="title" style="clear: both"><a name=
6375: "components.distinfo" id=
1.45 wiz 6376: "components.distinfo"></a>8.2. <code xmlns=
6377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6378: "filename">distinfo</code></h2>
1.1 grant 6379: </div>
6380: </div>
6381: </div>
6382:
6383: <p>Most important, the mandatory message digest, or
6384: checksum, of all the distfiles needed for the package to
6385: compile, confirming they match the original file
6386: distributed by the author. This ensures that the distfile
6387: retrieved from the Internet has not been corrupted during
6388: transfer or altered by a malign force to introduce a
1.14 xtraeme 6389: security hole. It is generated using the
6390: <span><strong class="command">make
6391: makesum</strong></span> command. The digest algorithm
6392: used was, at one stage, md5, but that was felt lacking
6393: compared to sha1, and so sha1 is now the default
1.1 grant 6394: algorithm. The distfile size is also generated and stored
6395: in new distinfo files. The <a xmlns=
6396: "http://www.w3.org/TR/xhtml1/transitional" href=
6397: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 6398: target="_top"><code xmlns="" class=
6399: "filename">pkgtools/digest</code></a> utility calculates
1.20 ben 6400: all of the digests in the distinfo file, and it provides
6401: various different algorithms. At the current time, the
6402: algorithms provided are: <span class=
6403: "emphasis"><em>md5</em></span>, <span class=
6404: "emphasis"><em>rmd160</em></span>, <span class=
6405: "emphasis"><em>sha1</em></span>, <span class=
6406: "emphasis"><em>sha256</em></span>, <span class=
6407: "emphasis"><em>sha384</em></span> and <span class=
6408: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 6409:
6410: <p>Some packages have different sets of distfiles on a
6411: per architecture basis, for example <a xmlns=
6412: "http://www.w3.org/TR/xhtml1/transitional" href=
6413: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6414: target="_top"><code xmlns="" class=
6415: "filename">www/navigator</code></a>). These are kept in
6416: the same distinfo file and care should be taken when
1.20 ben 6417: upgrading such a package to ensure distfile information
6418: is not lost.</p>
1.1 grant 6419:
6420: <p>The message digest/checksum for all the official
1.45 wiz 6421: patches found in the <code xmlns=
6422: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6423: "filename">patches/</code> directory (see <a href=
6424: "#components.patches" title=
1.38 dillo 6425: "8.3. patches/*">Section 8.3,
1.1 grant 6426: “patches/*”</a>) for the package is also
1.45 wiz 6427: stored in the <code xmlns=
6428: "http://www.w3.org/TR/xhtml1/transitional" class=
6429: "filename">distinfo</code> file. This is a message
6430: digest/checksum of all lines in the patch file except the
6431: NetBSD RCS Id. This file is generated by invoking
6432: <span><strong class="command">make
1.14 xtraeme 6433: makepatchsum</strong></span> (or <span><strong class=
6434: "command">make mps</strong></span> if you're in a
6435: hurry).</p>
1.1 grant 6436: </div>
6437:
6438: <div class="sect1" lang="en" xml:lang="en">
6439: <div class="titlepage">
6440: <div>
6441: <div>
6442: <h2 class="title" style="clear: both"><a name=
6443: "components.patches" id=
1.38 dillo 6444: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6445: </div>
6446: </div>
6447: </div>
6448:
6449: <p>This directory contains files that are used by the
6450: <a href=
6451: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6452: <span class="citerefentry"><span class=
6453: "refentrytitle">patch</span>(1)</span></a> command to
6454: modify the sources as distributed in the distribution
6455: file into a form that will compile and run perfectly on
6456: NetBSD. The files are applied successively in alphabetic
6457: order (as returned by a shell “<span class=
6458: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6459: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6460: class="filename">patch-aa</code> is applied before
6461: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6462: class="filename">patch-ab</code>, etc.</p>
6463:
6464: <p>The <code xmlns=
6465: "http://www.w3.org/TR/xhtml1/transitional" class=
6466: "filename">patch-*</code> files should be in
6467: <span><strong class="command">diff -bu</strong></span>
6468: format, and apply without a fuzz to avoid problems. (To
6469: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6470: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6471: not put changes for more than one file into a single
6472: patch-file, as this will make future modifications more
6473: difficult.</p>
6474:
6475: <p>Similar, a file should be patched at most once, not
6476: several times by several different patches. If a file
6477: needs several patches, they should be combined into one
6478: file.</p>
6479:
6480: <p>One important thing to mention is to pay attention
6481: that no RCS IDs get stored in the patch files, as these
6482: will cause problems when later checked into the NetBSD
1.14 xtraeme 6483: CVS tree. Use the <span><strong class=
6484: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6485: "http://www.w3.org/TR/xhtml1/transitional" href=
6486: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6487: target="_top"><code xmlns="" class=
6488: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6489: these problems.</p>
1.1 grant 6490:
6491: <p>For even more automation, we recommend using
1.14 xtraeme 6492: <span><strong class="command">mkpatches</strong></span>
6493: from the same package to make a whole set of patches. You
6494: just have to backup files before you edit them to
1.45 wiz 6495: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6496: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6497: <span><strong class="command">cp -p filename
6498: filename.orig</strong></span> or, easier, by using
6499: <span><strong class="command">pkgvi</strong></span> again
6500: from the same package. If you upgrade a package this way,
6501: you can easily compare the new set of patches with the
6502: previously existing one with <span><strong class=
6503: "command">patchdiff</strong></span>.</p>
1.1 grant 6504:
6505: <p>When you have finished a package, remember to generate
6506: the checksums for the patch files by using the
1.14 xtraeme 6507: <span><strong class="command">make
6508: makepatchsum</strong></span> command, see <a href=
6509: "#components.distinfo" title=
1.38 dillo 6510: "8.2. distinfo">Section 8.2,
1.45 wiz 6511: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6512: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6513:
1.46 ! gdt 6514: <p>When adding a patch that corrects a problem in the
! 6515: distfile (rather than e.g. enforcing pkgsrc's view of
! 6516: where man pages should go), send the patch as a bug
! 6517: report to the maintainer. This benefits non-pkgsrc users
! 6518: of the package, and usually enables removing the patch in
! 6519: future version.</p>
! 6520:
1.1 grant 6521: <p>Patch files that are distributed by the author or
1.14 xtraeme 6522: other maintainers can be listed in <code class=
6523: "varname">$PATCHFILES</code>.</p>
1.1 grant 6524:
6525: <p>If it is desired to store any patches that should not
6526: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6527: pkgsrc tree in the <code xmlns=
6528: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6529: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6530: tree there is expected to have the same
6531: “<span class="quote">category/package</span>”
6532: structure as pkgsrc, and patches are expected to be
1.45 wiz 6533: stored inside these dirs (also known as <code xmlns=
6534: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6535: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
1.45 wiz 6536: you want to keep a private patch for <code xmlns=
6537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6538: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6539: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6540: class=
1.14 xtraeme 6541: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6542: files in the named directory are expected to be patch
1.1 grant 6543: files, and <span class="emphasis"><em>they are applied
6544: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6545: </div>
6546:
6547: <div class="sect1" lang="en" xml:lang="en">
6548: <div class="titlepage">
6549: <div>
6550: <div>
6551: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6552: "other-mandatory-files" id=
1.38 dillo 6553: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6554: mandatory files</h2>
6555: </div>
6556: </div>
6557: </div>
6558:
6559: <div class="variablelist">
6560: <dl>
1.45 wiz 6561: <dt><span class="term"><code xmlns=
6562: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6563: "filename">DESCR</code></span></dt>
6564:
6565: <dd>
6566: <p>A multi-line description of the piece of
6567: software. This should include any credits where
6568: they are due. Please bear in mind that others do
6569: not share your sense of humour (or spelling
6570: idiosyncrasies), and that others will read
6571: everything that you write here.</p>
6572: </dd>
6573:
1.45 wiz 6574: <dt><span class="term"><code xmlns=
6575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6576: "filename">PLIST</code></span></dt>
6577:
6578: <dd>
6579: <p>This file governs the files that are installed
6580: on your system: all the binaries, manual pages,
6581: etc. There are other directives which may be
6582: entered in this file, to control the creation and
6583: deletion of directories, and the location of
6584: inserted files. See <a href="#plist" title=
1.38 dillo 6585: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6586: <i>PLIST issues</i></a> for more information.</p>
6587: </dd>
6588: </dl>
6589: </div>
6590: </div>
6591:
6592: <div class="sect1" lang="en" xml:lang="en">
6593: <div class="titlepage">
6594: <div>
6595: <div>
6596: <h2 class="title" style="clear: both"><a name=
6597: "components.optional" id=
1.38 dillo 6598: "components.optional"></a>8.5. Optional
1.27 rillig 6599: files</h2>
6600: </div>
6601: </div>
6602: </div>
6603:
6604: <div class="variablelist">
6605: <dl>
1.45 wiz 6606: <dt><span class="term"><code xmlns=
6607: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6608: "filename">INSTALL</code></span></dt>
6609:
6610: <dd>
6611: <p>This shell script is invoked twice by <a href=
6612: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6613: <span class="citerefentry"><span class=
6614: "refentrytitle">pkg_add</span>(1)</span></a>. First
6615: time after package extraction and before files are
6616: moved in place, the second time after the files to
6617: install are moved in place. This can be used to do
6618: any custom procedures not possible with @exec
1.45 wiz 6619: commands in <code xmlns=
6620: "http://www.w3.org/TR/xhtml1/transitional" class=
6621: "filename">PLIST</code>. See <a href=
1.27 rillig 6622: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6623: <span class="citerefentry"><span class=
6624: "refentrytitle">pkg_add</span>(1)</span></a> and
6625: <a href=
6626: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6627: <span class="citerefentry"><span class=
6628: "refentrytitle">pkg_create</span>(1)</span></a> for
6629: more information.</p>
6630: </dd>
6631:
1.45 wiz 6632: <dt><span class="term"><code xmlns=
6633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6634: "filename">DEINSTALL</code></span></dt>
6635:
6636: <dd>
6637: <p>This script is executed before and after any
6638: files are removed. It is this script's
6639: responsibility to clean up any additional messy
6640: details around the package's installation, since
6641: all pkg_delete knows is how to delete the files
6642: created in the original distribution. See <a href=
6643: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6644: <span class="citerefentry"><span class=
6645: "refentrytitle">pkg_delete</span>(1)</span></a> and
6646: <a href=
6647: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6648: <span class="citerefentry"><span class=
6649: "refentrytitle">pkg_create</span>(1)</span></a> for
6650: more information.</p>
6651: </dd>
6652:
1.45 wiz 6653: <dt><span class="term"><code xmlns=
6654: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6655: "filename">MESSAGE</code></span></dt>
6656:
6657: <dd>
6658: <p>Display this file after installation of the
6659: package. Useful for things like legal notices on
6660: almost-free software and hints for updating config
6661: files after installing modules for apache, PHP etc.
6662: Please note that you can modify variables in it
6663: easily by using <code class=
6664: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 6665: <code xmlns=
6666: "http://www.w3.org/TR/xhtml1/transitional" class=
6667: "filename">Makefile</code>:</p>
1.27 rillig 6668: <pre class="programlisting">
6669: MESSAGE_SUBST+= SOMEVAR="somevalue"
6670: </pre>
6671:
6672: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 6673: "quote">somevalue</span>” in <code xmlns=
6674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6675: "filename">MESSAGE</code>.</p>
6676: </dd>
6677: </dl>
6678: </div>
6679: </div>
6680:
6681: <div class="sect1" lang="en" xml:lang="en">
6682: <div class="titlepage">
6683: <div>
6684: <div>
6685: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6686: "work-dir" id="work-dir"></a>8.6. <code xmlns=
6687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6688: "filename">work*</code></h2>
6689: </div>
6690: </div>
6691: </div>
6692:
6693: <p>When you type <span><strong class=
6694: "command">make</strong></span> the distribution files are
1.45 wiz 6695: unpacked into the directory denoted by <code class=
6696: "varname">WRKDIR</code>. It can be removed by running
6697: <span><strong class="command">make clean</strong></span>.
6698: Besides the sources, this directory is also used to keep
6699: various timestamp files. The directory gets <span class=
6700: "emphasis"><em>removed completely</em></span> on clean.
6701: The default is <code xmlns=
6702: "http://www.w3.org/TR/xhtml1/transitional" class=
6703: "filename">${.CURDIR}/work</code> or <code xmlns=
6704: "http://www.w3.org/TR/xhtml1/transitional" class=
6705: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
6706: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 6707:
6708: <p>If a package doesn't create a subdirectory for itself
6709: (like GNU software does, for instance), but extracts
6710: itself in the current directory, you should set
6711: <code class="varname">WRKSRC</code> accordingly, e.g.
6712: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6713: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.45 wiz 6714: target="_top"><code xmlns="" class=
6715: "filename">editors/sam</code></a> again, but the quick
1.27 rillig 6716: answer is:</p>
6717: <pre class="programlisting">
6718: WRKSRC= ${WRKDIR}
6719: </pre>
6720:
1.45 wiz 6721: <p>If a package doesn't create a subdir with the name of
6722: <code class="varname">DISTNAME</code> but some different
6723: name, set <code class="varname">WRKSRC</code> to point to
6724: the proper name in <code xmlns=
6725: "http://www.w3.org/TR/xhtml1/transitional" class=
6726: "filename">${WRKDIR}</code>. See <a xmlns=
6727: "http://www.w3.org/TR/xhtml1/transitional" href=
1.27 rillig 6728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.45 wiz 6729: target="_top"><code xmlns="" class=
6730: "filename">lang/tcl</code></a> and <a xmlns=
1.27 rillig 6731: "http://www.w3.org/TR/xhtml1/transitional" href=
6732: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
1.45 wiz 6733: target="_top"><code xmlns="" class=
6734: "filename">x11/tk</code></a> for examples, and here is
1.27 rillig 6735: another one:</p>
6736: <pre class="programlisting">
6737: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6738: </pre>
6739:
6740: <p>The name of the working directory created by pkgsrc is
1.45 wiz 6741: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6742: class="filename">work</code> by default. If the same
6743: pkgsrc tree should be used on several different
1.27 rillig 6744: platforms, the variable <code class=
6745: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
6746: attach the platform to the directory name, e.g.
1.45 wiz 6747: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6748: class="filename">work.i386</code> or <code xmlns=
6749: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6750: "filename">work.sparc</code>.</p>
6751: </div>
6752:
6753: <div class="sect1" lang="en" xml:lang="en">
6754: <div class="titlepage">
6755: <div>
6756: <div>
6757: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6758: "files-dir" id=
1.45 wiz 6759: "files-dir"></a>8.7. <code xmlns=
6760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6761: "filename">files/*</code></h2>
6762: </div>
6763: </div>
6764: </div>
6765:
6766: <p>If you have any files that you wish to be placed in
6767: the package prior to configuration or building, you could
6768: place these files here and use a “<span class=
6769: "quote">${CP}</span>” command in the
6770: “<span class="quote">pre-configure</span>”
6771: target to achieve this. Alternatively, you could simply
1.45 wiz 6772: diff the file against <code xmlns=
6773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6774: "filename">/dev/null</code> and use the patch mechanism
6775: to manage the creation of this file.</p>
6776: </div>
6777: </div>
6778:
6779: <div class="chapter" lang="en" xml:lang="en">
6780: <div class="titlepage">
6781: <div>
6782: <div>
6783: <h2 class="title"><a name="makefile" id=
1.38 dillo 6784: "makefile"></a>Chapter 9. Programming in
1.45 wiz 6785: <code xmlns=
6786: "http://www.w3.org/TR/xhtml1/transitional" class=
6787: "filename">Makefile</code>s</h2>
1.27 rillig 6788: </div>
6789: </div>
6790: </div>
6791:
6792: <div class="toc">
6793: <p><b>Table of Contents</b></p>
6794:
6795: <dl>
6796: <dt><span class="sect1"><a href=
1.45 wiz 6797: "#makefile.variables">9.1. <code xmlns=
6798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6799: "filename">Makefile</code> variables</a></span></dt>
6800:
6801: <dd>
6802: <dl>
6803: <dt><span class="sect2"><a href=
1.38 dillo 6804: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6805: conventions</a></span></dt>
6806: </dl>
6807: </dd>
6808:
1.38 dillo 6809: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6810: Code snippets</a></span></dt>
6811:
6812: <dd>
6813: <dl>
1.30 wiz 6814: <dt><span class="sect2"><a href=
1.38 dillo 6815: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6816: list</a></span></dt>
1.27 rillig 6817:
1.30 wiz 6818: <dt><span class="sect2"><a href=
1.38 dillo 6819: "#converting-internal-to-external">9.2.2.
1.27 rillig 6820: Converting an internal list into an external
6821: list</a></span></dt>
6822:
1.30 wiz 6823: <dt><span class="sect2"><a href=
1.38 dillo 6824: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6825: variables to a shell command</a></span></dt>
1.27 rillig 6826:
1.30 wiz 6827: <dt><span class="sect2"><a href=
1.38 dillo 6828: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6829: guideline</a></span></dt>
1.27 rillig 6830:
1.30 wiz 6831: <dt><span class="sect2"><a href=
1.38 dillo 6832: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6833: bug in BSD Make</a></span></dt>
1.27 rillig 6834: </dl>
6835: </dd>
6836: </dl>
6837: </div>
6838:
1.45 wiz 6839: <p>Pkgsrc consists of many <code xmlns=
6840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6841: "filename">Makefile</code> fragments, each of which forms a
6842: well-defined part of the pkgsrc system. Using the <a href=
6843: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6844: <span class="citerefentry"><span class=
6845: "refentrytitle">make</span>(1)</span></a> system as a
6846: programming language for a big system like pkgsrc requires
6847: some discipline to keep the code correct and
6848: understandable.</p>
6849:
1.45 wiz 6850: <p>The basic ingredients for <code xmlns=
6851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6852: "filename">Makefile</code> programming are variables (which
6853: are actually macros) and shell commands. Among these shell
6854: commands may even be more complex ones like <a href=
6855: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6856: <span class="citerefentry"><span class=
6857: "refentrytitle">awk</span>(1)</span></a> programs. To make
6858: sure that every shell command runs as intended it is
6859: necessary to quote all variables correctly when they are
6860: used.</p>
6861:
6862: <p>This chapter describes some patterns, that appear quite
1.45 wiz 6863: often in <code xmlns=
6864: "http://www.w3.org/TR/xhtml1/transitional" class=
6865: "filename">Makefile</code>s, including the pitfalls that
6866: come along with them.</p>
1.27 rillig 6867:
6868: <div class="sect1" lang="en" xml:lang="en">
6869: <div class="titlepage">
6870: <div>
6871: <div>
6872: <h2 class="title" style="clear: both"><a name=
6873: "makefile.variables" id=
1.45 wiz 6874: "makefile.variables"></a>9.1. <code xmlns=
6875: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6876: "filename">Makefile</code> variables</h2>
6877: </div>
6878: </div>
6879: </div>
6880:
1.45 wiz 6881: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6882: class="filename">Makefile</code> variables contain
6883: strings that can be processed using the five operators
6884: ``='', ``+='', ``?='', ``:='', and ``!='', which are
6885: described in the <a href=
1.27 rillig 6886: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6887: <span class="citerefentry"><span class=
6888: "refentrytitle">make</span>(1)</span></a> man page.</p>
6889:
1.45 wiz 6890: <p>When a variable's value is parsed from a <code xmlns=
6891: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6892: "filename">Makefile</code>, the hash character ``#'' and
6893: the backslash character ``\'' are handled specially. If a
6894: backslash is followed by a newline, any whitespace
6895: immediately in front of the backslash, the backslash, the
6896: newline, and any whitespace immediately behind the
6897: newline are replaced with a single space. A backspace
6898: character and an immediately following hash character are
6899: replaced with a single hash character. Otherwise the
6900: backslash is passed as is. In a variable assignment, any
6901: hash character that is not preceded by a backslash starts
6902: a comment that continues upto the end of the logical
6903: line.</p>
6904:
6905: <p><span class="emphasis"><em>Note:</em></span> Because
6906: of this parsing algorithm the only way to create a
6907: variable consisting of a single backslash is using the
6908: ``!='' operator, for example: <code class=
6909: "varname">BACKSLASH!=echo "\\"</code>.</p>
6910:
6911: <p>So far for defining variables. The other thing you can
6912: do with variables is evaluating them. A variable is
6913: evaluated when it is part of the right side of the ``:=''
6914: or the ``!='' operator, or directly before executing a
6915: shell command which the variable is part of. In all other
6916: cases <a href=
6917: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6918: <span class="citerefentry"><span class=
6919: "refentrytitle">make</span>(1)</span></a> performs lazy
6920: evaluation, that is, variables are not evaluated until
6921: there's no other way. The ``modifiers'' mentioned in the
6922: man page also evaluate the variable.</p>
6923:
6924: <p>Some of the modifiers split the string into words and
6925: then operate on the words, others operate on the string
6926: as a whole. When a string is splitted into words, it is
6927: splitted as you would expect it from <a href=
6928: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6929: <span class="citerefentry"><span class=
6930: "refentrytitle">sh</span>(1)</span></a>.</p>
6931:
6932: <p>No rule without exception—the
6933: <span><strong class="command">.for</strong></span> loop
6934: does not follow the shell quoting rules but splits at
6935: sequences of whitespace.</p>
6936:
6937: <p>There are several types of variables that should be
6938: handled differently. Strings and two types of lists.</p>
6939:
6940: <div class="itemizedlist">
6941: <ul type="disc">
6942: <li>
6943: <p><span class="emphasis"><em>Strings</em></span>
6944: can contain arbitrary characters. Nevertheless you
6945: should restrict yourself to only using printable
6946: characters. Examples are <code class=
6947: "varname">PREFIX</code> and <code class=
6948: "varname">COMMENT</code>.</p>
6949: </li>
6950:
6951: <li>
6952: <p><span class="emphasis"><em>Internal
6953: lists</em></span> are lists that are never exported
6954: to any shell command. Their elements are separated
6955: by whitespace. Therefore the elements themselves
6956: cannot have embedded whitespace. Any other
6957: characters are allowed. Internal lists can be used
6958: in <span><strong class=
6959: "command">.for</strong></span> loops. Examples are
6960: <code class="varname">DEPENDS</code> and
6961: <code class="varname">BUILD_DEPENDS</code>.</p>
6962: </li>
6963:
6964: <li>
6965: <p><span class="emphasis"><em>External
6966: lists</em></span> are lists that may be exported to
6967: a shell command. Their elements can contain any
6968: characters, including whitespace. That's why they
6969: cannot be used in <span><strong class=
6970: "command">.for</strong></span> loops. Examples are
6971: <code class="varname">DISTFILES</code> and
6972: <code class="varname">MASTER_SITES</code>.</p>
6973: </li>
6974: </ul>
6975: </div>
6976:
6977: <div class="sect2" lang="en" xml:lang="en">
6978: <div class="titlepage">
6979: <div>
6980: <div>
6981: <h3 class="title"><a name=
6982: "makefile.variables.names" id=
1.38 dillo 6983: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 6984: conventions</h3>
6985: </div>
6986: </div>
6987: </div>
6988:
6989: <div class="itemizedlist">
6990: <ul type="disc">
6991: <li>
6992: <p>All variable names starting with an underscore
6993: are reserved for use by the pkgsrc
6994: infrastructure. They shall not be used by package
1.45 wiz 6995: <code xmlns=
6996: "http://www.w3.org/TR/xhtml1/transitional" class=
6997: "filename">Makefile</code>s.</p>
1.27 rillig 6998: </li>
6999:
7000: <li>
7001: <p>In <span><strong class=
7002: "command">.for</strong></span> loops you should
7003: use lowercase variable names for the iteration
7004: variables.</p>
7005: </li>
7006:
7007: <li>
7008: <p>All list variables should have a ``plural''
7009: name, e.g. <code class=
7010: "varname">PKG_OPTIONS</code> or <code class=
7011: "varname">DISTFILES</code>.</p>
7012: </li>
7013: </ul>
7014: </div>
7015: </div>
7016: </div>
7017:
7018: <div class="sect1" lang="en" xml:lang="en">
7019: <div class="titlepage">
7020: <div>
7021: <div>
7022: <h2 class="title" style="clear: both"><a name=
7023: "makefile.code" id=
1.38 dillo 7024: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7025: </div>
7026: </div>
7027: </div>
7028:
7029: <p>This section presents you with some code snippets you
7030: should use in your own code. If you don't find anything
7031: appropriate here, you should test your code and add it
7032: here.</p>
7033:
7034: <div class="sect2" lang="en" xml:lang="en">
7035: <div class="titlepage">
7036: <div>
7037: <div>
1.30 wiz 7038: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7039: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7040: a list</h3>
1.27 rillig 7041: </div>
7042: </div>
7043: </div>
7044: <pre class="programlisting">
7045: STRING= foo * bar `date`
7046: INT_LIST= # empty
7047: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7048: EXT_LIST= # empty
7049: ANOTHER_EXT_LIST= a=b c=d
7050:
7051: INT_LIST+= ${STRING} # 1
7052: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7053: EXT_LIST+= ${STRING:Q} # 3
7054: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
7055:
7056: </pre>
7057:
7058: <p>When you add a string to an external list (example
7059: 3), it must be quoted. In all other cases, you must not
7060: add a quoting level. You must not merge internal and
7061: external lists, unless you are sure that all entries
7062: are correctly interpreted in both lists.</p>
7063: </div>
7064:
7065: <div class="sect2" lang="en" xml:lang="en">
7066: <div class="titlepage">
7067: <div>
7068: <div>
1.30 wiz 7069: <h3 class="title"><a name=
7070: "converting-internal-to-external" id=
1.38 dillo 7071: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7072: an internal list into an external list</h3>
1.27 rillig 7073: </div>
7074: </div>
7075: </div>
7076: <pre class="programlisting">
7077: EXT_LIST= # empty
7078: .for i in ${INT_LIST}
7079: EXT_LIST+= ${i:Q}""
7080: .endfor
7081:
7082: </pre>
7083:
7084: <p>This code converts the internal list <code class=
7085: "varname">INT_LIST</code> into the external list
7086: <code class="varname">EXT_LIST</code>. As the elements
7087: of an internal list are unquoted they must be quoted
7088: here. The reason for appending <code class=
7089: "varname">""</code> is explained below.</p>
7090: </div>
1.1 grant 7091:
1.27 rillig 7092: <div class="sect2" lang="en" xml:lang="en">
7093: <div class="titlepage">
1.1 grant 7094: <div>
1.27 rillig 7095: <div>
1.30 wiz 7096: <h3 class="title"><a name=
7097: "passing-variable-to-shell" id=
1.38 dillo 7098: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7099: variables to a shell command</h3>
1.27 rillig 7100: </div>
1.1 grant 7101: </div>
7102: </div>
1.27 rillig 7103: <pre class="programlisting">
7104: STRING= foo bar < > * `date` $$HOME ' "
7105: EXT_LIST= string=${STRING:Q} x=second\ item
7106:
7107: all:
7108: echo ${STRING} # 1
7109: echo "${STRING}" # 2
7110: echo "${STRING:Q}" # 3
7111: echo ${STRING:Q} # 4
7112: echo x${STRING:Q} | sed 1s,.,, # 5
7113: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
7114:
7115: </pre>
7116:
7117: <p>Example 1 leads to a syntax error in the shell, as
7118: the characters are just copied.</p>
7119:
7120: <p>Example 2 leads to a syntax error too, and if you
7121: leave out the last " character from <code class=
7122: "varname">${STRING}</code>, <a href=
7123: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7124: <span class="citerefentry"><span class=
7125: "refentrytitle">date</span>(1)</span></a> will be
7126: executed. The <code class="varname">$HOME</code> shell
7127: variable would be evaluated, too.</p>
7128:
7129: <p>Example 3 outputs each space character preceded by a
7130: backslash (or not), depending on the implementation of
7131: the <a href=
7132: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7133: <span class="citerefentry"><span class=
7134: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7135:
1.27 rillig 7136: <p>Example 4 handles correctly every string that does
7137: not start with a dash. In that case, the result depends
7138: on the implementation of the <a href=
7139: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7140: <span class="citerefentry"><span class=
7141: "refentrytitle">echo</span>(1)</span></a> command. As
7142: long as you can guarantee that your input does not
7143: start with a dash this form is appropriate.</p>
1.1 grant 7144:
1.27 rillig 7145: <p>Example 5 handles even the case of a leading dash
7146: correctly.</p>
1.1 grant 7147:
1.27 rillig 7148: <p>The <code class="varname">EXT_LIST</code> does not
7149: need to be quoted because the quoting has already be
7150: done when adding elements to the list.</p>
1.1 grant 7151:
1.27 rillig 7152: <p>As internal lists shall not be passed to the shell,
7153: there is no example for it.</p>
1.1 grant 7154: </div>
7155:
1.27 rillig 7156: <div class="sect2" lang="en" xml:lang="en">
7157: <div class="titlepage">
1.1 grant 7158: <div>
1.27 rillig 7159: <div>
1.30 wiz 7160: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7161: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7162: guideline</h3>
7163: </div>
1.1 grant 7164: </div>
7165: </div>
7166:
1.27 rillig 7167: <p>There are many possible sources of wrongly quoted
7168: variables. This section lists some of the commonly
7169: known ones.</p>
1.1 grant 7170:
1.27 rillig 7171: <div class="itemizedlist">
7172: <ul type="disc">
7173: <li>
7174: <p>Whenever you use the value of a list, think
7175: about what happens to leading or trailing
7176: whitespace. If the list is a well-formed shell
7177: expression you can apply the <code class=
7178: "varname">:M*</code> modifier to strip leading
7179: and trailing whitespace from each word. The
7180: <code class="varname">:M</code> operator first
7181: splits its argument according to the rules of the
7182: shell, and then creates a new list consisting of
7183: all words that match the shell glob expression
7184: <code class="varname">*</code>, that is: all. One
7185: class of situations where this is needed is when
7186: adding a variable like <code class=
7187: "varname">CPPFLAGS</code> to <code class=
7188: "varname">CONFIGURE_ARGS</code>. If the configure
7189: script invokes other configure scripts it strips
7190: the leading and trailing whitespace from the
7191: variable and then passes it to the other
7192: configure scripts. But these configure scripts
7193: expect the (child) <code class=
7194: "varname">CPPFLAGS</code> variable to be the same
7195: as the parent <code class=
7196: "varname">CPPFLAGS</code>. That's why we better
7197: pass the <code class="varname">CPPFLAGS</code>
7198: value properly trimmed. And here is how we do
7199: it:</p>
7200: <pre class="programlisting">
7201: CPPFLAGS= # empty
7202: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7203: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 7204:
1.27 rillig 7205: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 7206:
1.27 rillig 7207: all:
7208: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7209: echo x${CONFIGURE_ARGS}x # properly trimmed
7210:
7211: </pre>
7212: </li>
1.1 grant 7213:
1.27 rillig 7214: <li>
7215: <p>The example above contains one bug: The
7216: <code class="varname">${PREFIX}</code> is a
7217: properly quoted shell expression, but there is
7218: the C compiler after it, which also expects a
7219: properly quoted string (this time in C syntax).
7220: The version above is therefore only correct if
7221: <code class="varname">${PREFIX}</code> does not
7222: have embedded backslashes or double quotes. If
7223: you want to allow these, you have to add another
7224: layer of quoting to each variable that is used as
7225: a C string literal. You cannot use the
7226: <code class="varname">:Q</code> operator for it,
7227: as this operator only works for the shell.</p>
7228: </li>
1.1 grant 7229:
1.27 rillig 7230: <li>
7231: <p>Whenever a variable can be empty the
7232: <code class="varname">:Q</code> operator can have
7233: surprising results. Here are two completely
7234: different cases which can be solved with the same
7235: trick.</p>
7236: <pre class="programlisting">
7237: EMPTY= # empty
7238: empty_test:
7239: for i in a ${EMPTY:Q} c; do \
7240: echo "$$i"; \
7241: done
7242:
7243: for_test:
7244: .for i in a:\ a:\test.txt
7245: echo ${i:Q}
7246: echo "foo"
7247: .endfor
7248:
1.1 grant 7249: </pre>
7250:
1.27 rillig 7251: <p>The first example will only print two of the
7252: three lines we might have expected. This is
7253: because <code class="varname">${EMPTY:Q}</code>
7254: expands to the empty string, which the shell
7255: cannot see. The workaround is to write
7256: <code class="varname">${EMPTY:Q}""</code>. This
7257: pattern can be often found as <code class=
7258: "varname">${TEST} -z ${VAR:Q}</code> or as
7259: <code class="varname">${TEST} -f
7260: ${FNAME:Q}</code> (both of these are wrong).</p>
7261:
7262: <p>The second example will only print three lines
7263: instead of four. The first line looks like
7264: <code class="varname">a:\ echo foo</code>. This
7265: is because the backslash of the value
7266: <code class="varname">a:\</code> is interpreted
7267: as a line-continuation by <a href=
7268: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7269: <span class="citerefentry"><span class=
7270: "refentrytitle">make</span>(1)</span></a>, which
7271: makes the second line the arguments of the
7272: <a href=
7273: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7274: <span class="citerefentry"><span class=
7275: "refentrytitle">echo</span>(1)</span></a> command
7276: from the first line. To avoid this, write
7277: <code class="varname">${i:Q}""</code>.</p>
7278: </li>
7279: </ul>
7280: </div>
1.1 grant 7281: </div>
7282:
1.27 rillig 7283: <div class="sect2" lang="en" xml:lang="en">
7284: <div class="titlepage">
1.1 grant 7285: <div>
1.27 rillig 7286: <div>
1.30 wiz 7287: <h3 class="title"><a name=
7288: "bsd-make-bug-workaround" id=
1.38 dillo 7289: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7290: for a bug in BSD Make</h3>
1.27 rillig 7291: </div>
1.1 grant 7292: </div>
7293: </div>
7294:
1.27 rillig 7295: <p>The pkgsrc bmake program does not handle the
7296: following assignment correctly. In case <code class=
7297: "varname">_othervar_</code> contains a ``-'' character,
7298: one of the closing braces is included in <code class=
7299: "varname">${VAR}</code> after this code executes.</p>
7300: <pre class="programlisting">
7301: VAR:= ${VAR:N${_othervar_:C/-//}}
7302:
1.1 grant 7303: </pre>
7304:
1.27 rillig 7305: <p>For a more complex code snippet and a workaround,
7306: see the package <a xmlns=
7307: "http://www.w3.org/TR/xhtml1/transitional" href=
7308: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7309: target="_top"><code xmlns="" class=
7310: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7311: <code class="varname">bug1</code>.</p>
1.1 grant 7312: </div>
7313: </div>
7314: </div>
7315:
7316: <div class="chapter" lang="en" xml:lang="en">
7317: <div class="titlepage">
7318: <div>
7319: <div>
7320: <h2 class="title"><a name="plist" id=
1.38 dillo 7321: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7322: </div>
7323: </div>
7324: </div>
7325:
7326: <div class="toc">
7327: <p><b>Table of Contents</b></p>
7328:
7329: <dl>
1.38 dillo 7330: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7331: ID</a></span></dt>
7332:
1.30 wiz 7333: <dt><span class="sect1"><a href=
1.38 dillo 7334: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7335: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7336: class="filename">PLIST</code>
1.14 xtraeme 7337: generation</a></span></dt>
1.1 grant 7338:
1.38 dillo 7339: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7340: Tweaking output of <span><strong class="command">make
7341: print-PLIST</strong></span></a></span></dt>
1.1 grant 7342:
1.38 dillo 7343: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7344: Variable substitution in PLIST</a></span></dt>
7345:
1.30 wiz 7346: <dt><span class="sect1"><a href=
1.38 dillo 7347: "#manpage-compression">10.5.
1.1 grant 7348: Manpage-compression</a></span></dt>
7349:
1.38 dillo 7350: <dt><span class="sect1"><a href=
7351: "#using-PLIST_SRC">10.6. Changing PLIST source with
7352: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7353:
1.30 wiz 7354: <dt><span class="sect1"><a href=
1.38 dillo 7355: "#platform-specific-plist">10.7. Platform specific and
1.30 wiz 7356: differing PLISTs</a></span></dt>
1.1 grant 7357:
1.38 dillo 7358: <dt><span class="sect1"><a href=
7359: "#faq.common-dirs">10.8. Sharing directories between
7360: packages</a></span></dt>
1.1 grant 7361: </dl>
7362: </div>
7363:
1.45 wiz 7364: <p>The <code xmlns=
7365: "http://www.w3.org/TR/xhtml1/transitional" class=
7366: "filename">PLIST</code> file contains a package's
7367: “<span class="quote">packing list</span>”, i.e.
7368: a list of files that belong to the package (relative to the
7369: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7370: class="filename">${PREFIX}</code> directory it's been
7371: installed in) plus some additional statements - see the
7372: <a href=
1.1 grant 7373: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7374: <span class="citerefentry"><span class=
7375: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
7376: a full list. This chapter addresses some issues that need
1.45 wiz 7377: attention when dealing with the <code xmlns=
7378: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7379: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7380:
7381: <div class="sect1" lang="en" xml:lang="en">
7382: <div class="titlepage">
7383: <div>
7384: <div>
7385: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7386: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7387: </div>
7388: </div>
7389: </div>
7390:
7391: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7392: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7393: class="filename">PLIST</code> file you write:</p>
1.1 grant 7394: <pre class="programlisting">
1.17 sketch 7395: @comment $NetBSD$
1.1 grant 7396: </pre>
7397: </div>
7398:
7399: <div class="sect1" lang="en" xml:lang="en">
7400: <div class="titlepage">
7401: <div>
7402: <div>
7403: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7404: "automatic-plist-generation" id=
1.38 dillo 7405: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7406: <code xmlns=
7407: "http://www.w3.org/TR/xhtml1/transitional" class=
7408: "filename">PLIST</code> generation</h2>
1.1 grant 7409: </div>
7410: </div>
7411: </div>
7412:
1.14 xtraeme 7413: <p>You can use the <span><strong class="command">make
7414: print-PLIST</strong></span> command to output a PLIST
7415: that matches any new files since the package was
7416: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 7417: "14.3. Other helpful targets">Section 14.3,
1.1 grant 7418: “Other helpful targets”</a> for more
7419: information on this target.</p>
7420: </div>
7421:
7422: <div class="sect1" lang="en" xml:lang="en">
7423: <div class="titlepage">
7424: <div>
7425: <div>
7426: <h2 class="title" style="clear: both"><a name=
7427: "print-PLIST" id=
1.38 dillo 7428: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7429: <span><strong class="command">make
7430: print-PLIST</strong></span></h2>
1.1 grant 7431: </div>
7432: </div>
7433: </div>
7434:
7435: <p>If you have used any of the *-dirs packages, as
7436: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7437: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7438: “Sharing directories between packages”</a>,
1.14 xtraeme 7439: you may have noticed that <span><strong class=
7440: "command">make print-PLIST</strong></span> outputs a set
7441: of <code class="varname">@comment</code>s instead of real
7442: <code class="varname">@dirrm</code> lines. You can also
7443: do this for specific directories and files, so that the
7444: results of that command are very close to reality. This
7445: helps <span class="emphasis"><em>a lot</em></span> during
7446: the update of packages.</p>
7447:
7448: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7449: variable takes a set of AWK patterns and actions that are
7450: used to filter the output of print-PLIST. You can
7451: <span class="emphasis"><em>append</em></span> any chunk
7452: of AWK scripting you like to it, but be careful with
1.1 grant 7453: quoting.</p>
7454:
1.45 wiz 7455: <p>For example, to get all files inside the <code xmlns=
7456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7457: "filename">libdata/foo</code> directory removed from the
1.1 grant 7458: resulting PLIST:</p>
7459: <pre class="programlisting">
7460: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
7461:
7462: </pre>
7463:
1.14 xtraeme 7464: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7465: lines referring to a specific (shared) directory
1.14 xtraeme 7466: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7467: <pre class="programlisting">
7468: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
7469:
7470: </pre>
7471: </div>
7472:
7473: <div class="sect1" lang="en" xml:lang="en">
7474: <div class="titlepage">
7475: <div>
7476: <div>
7477: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7478: "plist.misc" id=
7479: "plist.misc"></a>10.4. Variable substitution
7480: in PLIST</h2>
1.1 grant 7481: </div>
7482: </div>
7483: </div>
7484:
7485: <p>A number of variables are substituted automatically in
7486: PLISTs when a package is installed on a system. This
7487: includes the following variables:</p>
7488:
7489: <div class="variablelist">
7490: <dl>
1.14 xtraeme 7491: <dt><span class="term"><code class=
7492: "varname">${MACHINE_ARCH}</code>, <code class=
7493: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7494:
7495: <dd>
7496: <p>Some packages like emacs and perl embed
7497: information about which architecture they were
7498: built on into the pathnames where they install
7499: their file. To handle this case, PLIST will be
7500: preprocessed before actually used, and the symbol
1.14 xtraeme 7501: “<span class="quote"><code class=
7502: "varname">${MACHINE_ARCH}</code></span>” will
7503: be replaced by what <span><strong class=
7504: "command">uname -p</strong></span> gives. The same
7505: is done if the string <code class=
7506: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7507: PLIST somewhere - use this on packages that have
7508: GNU autoconf created configure scripts.</p>
1.1 grant 7509:
7510: <div class="note" style=
7511: "margin-left: 0.5in; margin-right: 0.5in;">
7512: <h3 class="title">Legacy note</h3>
7513:
7514: <p>There used to be a symbol “<span class=
1.14 xtraeme 7515: "quote"><code class=
7516: "varname">$ARCH</code></span>” that was
7517: replaced by the output of <span><strong class=
7518: "command">uname -m</strong></span>, but that's no
1.1 grant 7519: longer supported and has been removed.</p>
7520: </div>
7521: </dd>
7522:
1.14 xtraeme 7523: <dt><span class="term"><code class=
7524: "varname">${OPSYS}</code>, <code class=
7525: "varname">${LOWER_OPSYS}</code>, <code class=
7526: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7527:
7528: <dd>
7529: <p>Some packages want to embed the OS name and
7530: version into some paths. To do this, use these
1.45 wiz 7531: variables in the <code xmlns=
7532: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7533: "filename">PLIST</code>:</p>
1.1 grant 7534:
7535: <div class="itemizedlist">
7536: <ul type="disc">
7537: <li>
1.14 xtraeme 7538: <p><code class="varname">${OPSYS}</code> -
7539: output of “<span class=
7540: "quote"><span><strong class="command">uname
7541: -s</strong></span></span>”</p>
1.1 grant 7542: </li>
7543:
7544: <li>
1.14 xtraeme 7545: <p><code class=
7546: "varname">${LOWER_OPSYS}</code> - lowercase
7547: common name (eg. “<span class=
7548: "quote">solaris</span>”)</p>
1.1 grant 7549: </li>
7550:
7551: <li>
1.14 xtraeme 7552: <p><code class="varname">${OS_VERSION}</code>
7553: - “<span class=
7554: "quote"><span><strong class="command">uname
7555: -r</strong></span></span>”</p>
1.1 grant 7556: </li>
7557: </ul>
7558: </div>
7559: </dd>
7560:
1.14 xtraeme 7561: <dt><span class="term"><code class=
7562: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7563:
7564: <dd>
7565: <p>Packages that install locale files should list
7566: them in the PLIST as “<span class=
7567: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7568: instead of “<span class=
7569: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7570: This properly handles the fact that different
7571: operating systems expect locale files to be either
1.45 wiz 7572: in <code xmlns=
7573: "http://www.w3.org/TR/xhtml1/transitional" class=
7574: "filename">share</code> or <code xmlns=
7575: "http://www.w3.org/TR/xhtml1/transitional" class=
7576: "filename">lib</code> by default.</p>
1.1 grant 7577: </dd>
7578: </dl>
7579: </div>
7580:
7581: <p>For a complete list of values which are replaced by
1.45 wiz 7582: default, please look in <code xmlns=
7583: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7584: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7585: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7586:
7587: <p>If you want to change other variables not listed
7588: above, you can add variables and their expansions to this
1.14 xtraeme 7589: variable in the following way, similar to <code class=
7590: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7591: "#components.optional" title=
1.38 dillo 7592: "8.5. Optional files">Section 8.5,
1.1 grant 7593: “Optional files”</a>):</p>
7594: <pre class="programlisting">
7595: PLIST_SUBST+= SOMEVAR="somevalue"
7596: </pre>
7597:
7598: <p>This replaces all occurrences of “<span class=
7599: "quote">${SOMEVAR}</span>” in the PLIST with
7600: “<span class="quote">somevalue</span>”.</p>
7601: </div>
7602:
7603: <div class="sect1" lang="en" xml:lang="en">
7604: <div class="titlepage">
7605: <div>
7606: <div>
7607: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7608: "manpage-compression" id=
1.38 dillo 7609: "manpage-compression"></a>10.5. Manpage-compression</h2>
1.1 grant 7610: </div>
7611: </div>
7612: </div>
7613:
7614: <p>Manpages should be installed in compressed form if
1.45 wiz 7615: <code class="varname">MANZ</code> is set (in <code xmlns=
7616: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7617: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7618: otherwise. To handle this in the <code xmlns=
7619: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7620: "filename">PLIST</code> file, the suffix
7621: “<span class="quote">.gz</span>” is
7622: appended/removed automatically for manpages according to
7623: <code class="varname">MANZ</code> and <code class=
7624: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7625: above for details. This modification of the <code xmlns=
7626: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7627: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7628: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7629: class="filename">PLIST</code> itself.</p>
1.1 grant 7630: </div>
7631:
7632: <div class="sect1" lang="en" xml:lang="en">
7633: <div class="titlepage">
7634: <div>
7635: <div>
7636: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7637: "using-PLIST_SRC" id=
1.38 dillo 7638: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7639: source with <code class=
1.14 xtraeme 7640: "varname">PLIST_SRC</code></h2>
1.1 grant 7641: </div>
7642: </div>
7643: </div>
7644:
1.14 xtraeme 7645: <p>To use one or more files as source for the
1.45 wiz 7646: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7647: class="filename">PLIST</code> used in generating the
7648: binary package, set the variable <code class=
1.14 xtraeme 7649: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7650: The files are later concatenated using <a href=
7651: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7652: <span class="citerefentry"><span class=
7653: "refentrytitle">cat</span>(1)</span></a>, and order of
7654: things is important.</p>
1.1 grant 7655: </div>
7656:
7657: <div class="sect1" lang="en" xml:lang="en">
7658: <div class="titlepage">
7659: <div>
7660: <div>
7661: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7662: "platform-specific-plist" id=
1.38 dillo 7663: "platform-specific-plist"></a>10.7. Platform
1.1 grant 7664: specific and differing PLISTs</h2>
7665: </div>
7666: </div>
7667: </div>
7668:
7669: <p>Some packages decide to install a different set of
7670: files based on the operating system being used. These
7671: differences can be automatically handled by using the
7672: following files:</p>
7673:
7674: <div class="itemizedlist">
7675: <ul type="disc">
7676: <li>
1.45 wiz 7677: <p><code xmlns=
7678: "http://www.w3.org/TR/xhtml1/transitional" class=
7679: "filename">PLIST.common</code></p>
1.1 grant 7680: </li>
7681:
7682: <li>
1.45 wiz 7683: <p><code xmlns=
7684: "http://www.w3.org/TR/xhtml1/transitional" class=
7685: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7686: </li>
7687:
7688: <li>
1.45 wiz 7689: <p><code xmlns=
7690: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7691: "filename">PLIST.${MACHINE_ARCH}</code></p>
7692: </li>
7693:
7694: <li>
1.45 wiz 7695: <p><code xmlns=
7696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7697: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7698: </li>
7699:
7700: <li>
1.45 wiz 7701: <p><code xmlns=
7702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7703: "filename">PLIST.common_end</code></p>
1.1 grant 7704: </li>
7705: </ul>
7706: </div>
7707: </div>
7708:
7709: <div class="sect1" lang="en" xml:lang="en">
7710: <div class="titlepage">
7711: <div>
7712: <div>
7713: <h2 class="title" style="clear: both"><a name=
7714: "faq.common-dirs" id=
1.38 dillo 7715: "faq.common-dirs"></a>10.8. Sharing
7716: directories between packages</h2>
1.1 grant 7717: </div>
7718: </div>
7719: </div>
7720:
7721: <p>A “<span class="quote">shared
7722: directory</span>” is a directory where multiple
7723: (and unrelated) packages install files. These directories
7724: are problematic because you have to add special tricks in
7725: the PLIST to conditionally remove them, or have some
7726: centralized package handle them.</p>
7727:
7728: <p>Within pkgsrc, you'll find both approaches. If a
7729: directory is shared by a few unrelated packages, it's
7730: often not worth to add an extra package to remove it.
7731: Therefore, one simply does:</p>
7732: <pre class="programlisting">
7733: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
7734:
7735: </pre>
7736:
7737: <p>in the PLISTs of all affected packages, instead of the
7738: regular "@dirrm" line.</p>
7739:
7740: <p>However, if the directory is shared across many
7741: packages, two different solutions are available:</p>
7742:
7743: <div class="orderedlist">
7744: <ol type="1">
7745: <li>
7746: <p>If the packages have a common dependency, the
7747: directory can be removed in that. For example, see
7748: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7749: href=
7750: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 7751: target="_top"><code xmlns="" class=
7752: "filename">textproc/scrollkeeper</code></a>, which
7753: removes the shared directory <code xmlns=
7754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7755: "filename">share/omf</code>.</p>
1.1 grant 7756: </li>
7757:
7758: <li>
7759: <p>If the packages using the directory are not
7760: related at all (they have no common dependencies),
7761: a *-dirs package is used.</p>
7762: </li>
7763: </ol>
7764: </div>
7765:
7766: <p>From now on, we'll discuss the second solution. To get
7767: an idea of the *-dirs packages available, issue:</p>
7768: <pre class="programlisting">
1.14 xtraeme 7769: <code class="prompt">%</code> cd .../pkgsrc
7770: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7771:
7772: </pre>
7773:
7774: <p>Their use from other packages is very simple. The
1.14 xtraeme 7775: <code class="varname">USE_DIRS</code> variable takes a
7776: list of package names (without the “<span class=
1.1 grant 7777: "quote">-dirs</span>” part) together with the
7778: required version number (always pick the latest one when
1.34 wiz 7779: writing new packages).</p>
1.1 grant 7780:
7781: <p>For example, if a package installs files under
1.45 wiz 7782: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7783: class="filename">share/applications</code>, it should
7784: have the following line in it:</p>
1.1 grant 7785: <pre class="programlisting">
7786: USE_DIRS+= xdg-1.1
7787:
7788: </pre>
7789:
1.14 xtraeme 7790: <p>After regenerating the PLIST using
7791: <span><strong class="command">make
7792: print-PLIST</strong></span>, you should get the right
7793: (commented out) lines.</p>
1.1 grant 7794:
1.45 wiz 7795: <p>Note that, even if your package is using <code xmlns=
7796: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7797: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7798: *-x11-dirs packages. Just specify the name without that
1.45 wiz 7799: part and pkgsrc (in particular, <code xmlns=
7800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7801: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7802: </div>
7803: </div>
7804:
7805: <div class="chapter" lang="en" xml:lang="en">
7806: <div class="titlepage">
7807: <div>
7808: <div>
7809: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7810: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7811: methodology</h2>
7812: </div>
7813: </div>
7814: </div>
7815:
7816: <div class="toc">
7817: <p><b>Table of Contents</b></p>
7818:
7819: <dl>
1.30 wiz 7820: <dt><span class="sect1"><a href=
1.38 dillo 7821: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7822: to use buildlink3</a></span></dt>
1.1 grant 7823:
1.30 wiz 7824: <dt><span class="sect1"><a href=
1.45 wiz 7825: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
7826: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7827: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7828:
7829: <dd>
7830: <dl>
1.25 rillig 7831: <dt><span class="sect2"><a href=
1.38 dillo 7832: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7833: buildlink3.mk file</a></span></dt>
1.1 grant 7834:
1.25 rillig 7835: <dt><span class="sect2"><a href=
1.38 dillo 7836: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7837: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7838: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 7839: <code xmlns=
7840: "http://www.w3.org/TR/xhtml1/transitional" class=
7841: "filename">buildlink3.mk</code>
1.1 grant 7842: files</a></span></dt>
7843: </dl>
7844: </dd>
7845:
1.30 wiz 7846: <dt><span class="sect1"><a href=
1.45 wiz 7847: "#writing-builtin.mk">11.3. Writing <code xmlns=
7848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7849: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7850:
7851: <dd>
7852: <dl>
1.25 rillig 7853: <dt><span class="sect2"><a href=
1.38 dillo 7854: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 7855: <code xmlns=
7856: "http://www.w3.org/TR/xhtml1/transitional" class=
7857: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 7858:
1.25 rillig 7859: <dt><span class="sect2"><a href=
1.38 dillo 7860: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7861: preferences for native or pkgsrc
7862: software</a></span></dt>
1.1 grant 7863: </dl>
7864: </dd>
7865: </dl>
7866: </div>
7867:
7868: <p>Buildlink is a framework in pkgsrc that controls what
7869: headers and libraries are seen by a package's configure and
7870: build processes. This is implemented in a two step
7871: process:</p>
7872:
7873: <div class="orderedlist">
7874: <ol type="1">
7875: <li>
7876: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7877: into <code class="varname">BUILDLINK_DIR</code>,
7878: which by default is a subdirectory of <code class=
7879: "varname">WRKDIR</code>.</p>
1.1 grant 7880: </li>
7881:
7882: <li>
7883: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7884: the normal compiler tools that translate <code class=
7885: "option">-I${LOCALBASE}/include</code> and
7886: <code class="option">-L${LOCALBASE}/lib</code> into
7887: references to <code class=
7888: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7889: also make native compiler on some operating systems
7890: look like GCC, so that packages that expect GCC won't
7891: require modifications to build with those native
7892: compilers.</p>
1.1 grant 7893: </li>
7894: </ol>
7895: </div>
7896:
7897: <p>This normalizes the environment in which a package is
7898: built so that the package may be built consistently despite
7899: what other software may be installed. Please note that the
1.45 wiz 7900: normal system header and library paths, e.g. <code xmlns=
7901: "http://www.w3.org/TR/xhtml1/transitional" class=
7902: "filename">/usr/include</code>, <code xmlns=
7903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7904: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7905: buildlink3 is designed to insulate the package build from
7906: non-system-supplied software.</p>
7907:
7908: <div class="sect1" lang="en" xml:lang="en">
7909: <div class="titlepage">
7910: <div>
7911: <div>
7912: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7913: "converting-to-buildlink3" id=
1.38 dillo 7914: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 7915: packages to use buildlink3</h2>
1.1 grant 7916: </div>
7917: </div>
7918: </div>
7919:
7920: <p>The process of converting packages to use the
7921: buildlink3 framework (“<span class=
7922: "quote">bl3ifying</span>”) is fairly
7923: straightforward. The things to keep in mind are:</p>
7924:
7925: <div class="orderedlist">
7926: <ol type="1">
7927: <li>
7928: <p>Ensure that the build always calls the wrapper
7929: scripts instead of the actual toolchain. Some
7930: packages are tricky, and the only way to know for
1.45 wiz 7931: sure is the check <code xmlns=
7932: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7933: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7934: wrappers are being invoked.</p>
7935: </li>
7936:
7937: <li>
1.14 xtraeme 7938: <p>Don't override <code class=
7939: "varname">PREFIX</code> from within the package
7940: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 7941: because the code to symlink files into <code xmlns=
7942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7943: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7944: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7945: <em class=
7946: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7947: </li>
7948:
7949: <li>
7950: <p>Remember that <span class=
1.45 wiz 7951: "emphasis"><em>only</em></span> the <code xmlns=
7952: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7953: "filename">buildlink3.mk</code> files that you list
1.1 grant 7954: in a package's Makefile are added as dependencies
7955: for that package.</p>
7956: </li>
7957: </ol>
7958: </div>
7959:
7960: <p>If a dependency on a particular package is required
7961: for its libraries and headers, then we replace:</p>
7962: <pre class="programlisting">
1.27 rillig 7963: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7964: </pre>
7965:
7966: <p>with</p>
7967: <pre class="programlisting">
7968: .include "../../category/foo/buildlink3.mk"
7969: </pre>
7970:
1.45 wiz 7971: <p>There are several <code xmlns=
7972: "http://www.w3.org/TR/xhtml1/transitional" class=
7973: "filename">buildlink3.mk</code> files in <code xmlns=
7974: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7975: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7976: issues:</p>
7977:
7978: <div class="itemizedlist">
7979: <ul type="disc">
7980: <li>
1.45 wiz 7981: <p><code xmlns=
7982: "http://www.w3.org/TR/xhtml1/transitional" class=
7983: "filename">bdb.buildlink3.mk</code> chooses either
7984: the native or a pkgsrc Berkeley DB implementation
7985: based on the values of <code class=
1.14 xtraeme 7986: "varname">BDB_ACCEPTED</code> and <code class=
7987: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7988: </li>
7989:
7990: <li>
1.45 wiz 7991: <p><code xmlns=
7992: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7993: "filename">curses.buildlink3.mk</code> If the
7994: system comes with neither Curses nor NCurses, this
7995: will take care to install the <a xmlns=
7996: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7997: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 7998: target="_top"><code xmlns="" class=
7999: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8000: </li>
8001:
8002: <li>
1.45 wiz 8003: <p><code xmlns=
8004: "http://www.w3.org/TR/xhtml1/transitional" class=
8005: "filename">krb5.buildlink3.mk</code> uses the value
8006: of <code class="varname">KRB5_ACCEPTED</code> to
8007: choose between adding a dependency on Heimdal or
8008: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8009: implementation.</p>
8010: </li>
8011:
8012: <li>
1.45 wiz 8013: <p><code xmlns=
8014: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8015: "filename">motif.buildlink3.mk</code> checks for a
8016: system-provided Motif installation or adds a
8017: dependency on <a xmlns=
1.1 grant 8018: "http://www.w3.org/TR/xhtml1/transitional" href=
8019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8020: target="_top"><code xmlns="" class=
8021: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8022: "http://www.w3.org/TR/xhtml1/transitional" href=
8023: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8024: target="_top"><code xmlns="" class=
8025: "filename">x11/openmotif</code></a>;</p>
1.1 grant 8026: </li>
8027:
8028: <li>
1.45 wiz 8029: <p><code xmlns=
8030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8031: "filename">ossaudio.buildlink3.mk</code> defines
8032: several variables that may be used by packages that
8033: use the Open Sound System (OSS) API;</p>
1.1 grant 8034: </li>
8035:
8036: <li>
1.45 wiz 8037: <p><code xmlns=
8038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8039: "filename">pgsql.buildlink3.mk</code> will accept
8040: either Postgres 7.3 or 7.4, whichever is found
8041: installed. See the file for more information.</p>
1.1 grant 8042: </li>
8043:
8044: <li>
1.45 wiz 8045: <p><code xmlns=
8046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8047: "filename">pthread.buildlink3.mk</code> uses the
8048: value of <code class="varname">PTHREAD_OPTS</code>
8049: and checks for native pthreads or adds a dependency
8050: on <a xmlns=
1.1 grant 8051: "http://www.w3.org/TR/xhtml1/transitional" href=
8052: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8053: target="_top"><code xmlns="" class=
8054: "filename">devel/pth</code></a> as needed;</p>
1.1 grant 8055: </li>
8056:
8057: <li>
1.45 wiz 8058: <p><code xmlns=
8059: "http://www.w3.org/TR/xhtml1/transitional" class=
8060: "filename">xaw.buildlink3.mk</code> uses the value
8061: of <code class="varname">XAW_TYPE</code> to choose
8062: a particular Athena widgets library.</p>
1.1 grant 8063: </li>
8064: </ul>
8065: </div>
8066:
1.45 wiz 8067: <p>The comments in those <code xmlns=
8068: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8069: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8070: complete description of how to use them properly.</p>
8071: </div>
8072:
8073: <div class="sect1" lang="en" xml:lang="en">
8074: <div class="titlepage">
8075: <div>
8076: <div>
8077: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8078: "creating-buildlink3.mk" id=
1.38 dillo 8079: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8080: <code xmlns=
8081: "http://www.w3.org/TR/xhtml1/transitional" class=
8082: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8083: </div>
8084: </div>
8085: </div>
8086:
1.45 wiz 8087: <p>A package's <code xmlns=
8088: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8089: "filename">buildlink3.mk</code> file is included by
8090: Makefiles to indicate the need to compile and link
8091: against header files and libraries provided by the
1.45 wiz 8092: package. A <code xmlns=
8093: "http://www.w3.org/TR/xhtml1/transitional" class=
8094: "filename">buildlink3.mk</code> file should always
8095: provide enough information to add the correct type of
8096: dependency relationship and include any other
8097: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8098: class="filename">buildlink3.mk</code> files that it needs
8099: to find headers and libraries that it needs in turn.</p>
1.1 grant 8100:
1.45 wiz 8101: <p>To generate an initial <code xmlns=
8102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8103: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8104: Rene Hexel's <a xmlns=
8105: "http://www.w3.org/TR/xhtml1/transitional" href=
8106: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8107: target="_top"><code xmlns="" class=
8108: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8109: highly recommended. For most packages, the following
8110: command will generate a good starting point for
1.45 wiz 8111: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8112: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8113: <pre class="screen">
1.14 xtraeme 8114: <code class="prompt">%</code> <strong class=
8115: "userinput"><code>cd pkgsrc/<em class=
8116: "replaceable"><code>category</code></em>/<em class=
8117: "replaceable"><code>pkgdir</code></em>
8118: <code class=
8119: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 8120: </pre>
8121:
8122: <div class="sect2" lang="en" xml:lang="en">
8123: <div class="titlepage">
8124: <div>
8125: <div>
1.30 wiz 8126: <h3 class="title"><a name="anatomy-of-bl3" id=
1.38 dillo 8127: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8128: buildlink3.mk file</h3>
1.1 grant 8129: </div>
8130: </div>
8131: </div>
8132:
1.45 wiz 8133: <p>The following real-life example <code xmlns=
8134: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8135: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8136: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8137: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8138: <pre class="programlisting">
1.17 sketch 8139: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8140:
8141: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8142: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
8143:
8144: .if !empty(BUILDLINK_DEPTH:M+)
8145: BUILDLINK_DEPENDS+= tiff
8146: .endif
8147:
8148: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8149: BUILDLINK_PACKAGES+= tiff
8150:
8151: .if !empty(TIFF_BUILDLINK3_MK:M+)
8152: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8153: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8154: .endif # TIFF_BUILDLINK3_MK
8155:
8156: .include "../../devel/zlib/buildlink3.mk"
8157: .include "../../graphics/jpeg/buildlink3.mk"
8158:
8159: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
8160: </pre>
8161:
1.14 xtraeme 8162: <p>The header and footer manipulate <code class=
8163: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8164: across all <code xmlns=
8165: "http://www.w3.org/TR/xhtml1/transitional" class=
8166: "filename">buildlink3.mk</code> files and is used to
8167: track at what depth we are including <code xmlns=
8168: "http://www.w3.org/TR/xhtml1/transitional" class=
8169: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8170:
8171: <p>The first section controls if the dependency on
1.14 xtraeme 8172: <em class="replaceable"><code>pkg</code></em> is added.
8173: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8174: global list of packages for which dependencies are
8175: added by buildlink3.</p>
8176:
8177: <p>The second section advises pkgsrc that the
1.45 wiz 8178: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8179: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8180: <em class="replaceable"><code>pkg</code></em> has been
8181: included at some point. <code class=
8182: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8183: of packages for which <code xmlns=
8184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8185: "filename">buildlink3.mk</code> files have been
8186: included. It must <span class=
8187: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8188: a <code xmlns=
8189: "http://www.w3.org/TR/xhtml1/transitional" class=
8190: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8191:
8192: <p>The third section is protected from multiple
1.14 xtraeme 8193: inclusion and controls how the dependency on <em class=
8194: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8195: important variables are set in the section:</p>
8196:
8197: <div class="itemizedlist">
8198: <ul type="disc">
8199: <li>
1.14 xtraeme 8200: <p><code class=
8201: "varname">BUILDLINK_DEPENDS.<em class=
8202: "replaceable"><code>pkg</code></em></code> is the
8203: actual dependency recorded in the installed
8204: package; this should always be set using
8205: <span><strong class="command">+=</strong></span>
8206: to ensure that we're appending to any
8207: pre-existing list of values. This variable should
8208: be set to the first version of the package that
8209: had the last change in the major number of a
8210: shared library or that had a major API
8211: change.</p>
1.1 grant 8212: </li>
8213:
8214: <li>
1.14 xtraeme 8215: <p><code class=
8216: "varname">BUILDLINK_PKGSRCDIR.<em class=
8217: "replaceable"><code>pkg</code></em></code> is the
8218: location of the <em class=
8219: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 8220: directory;</p>
8221: </li>
8222:
8223: <li>
1.14 xtraeme 8224: <p><code class=
8225: "varname">BUILDLINK_DEPMETHOD.<em class=
8226: "replaceable"><code>pkg</code></em></code> (not
8227: shown above) controls whether we use <code class=
8228: "varname">BUILD_DEPENDS</code> or <code class=
8229: "varname">DEPENDS</code> to add the dependency on
8230: <em class="replaceable"><code>pkg</code></em>.
8231: The build dependency is selected by setting
8232: <code class=
8233: "varname">BUILDLINK_DEPMETHOD.<em class=
8234: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8235: “<span class="quote">build</span>”.
8236: By default, the full dependency is used.</p>
8237: </li>
8238:
8239: <li>
1.14 xtraeme 8240: <p><code class=
8241: "varname">BUILDLINK_INCDIRS.<em class=
8242: "replaceable"><code>pkg</code></em></code> and
8243: <code class=
8244: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
8245: <code>pkg</code></em></code> (not shown above)
1.45 wiz 8246: are lists of subdirectories of <code xmlns=
8247: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8248: "filename">${BUILDLINK_PREFIX.<em class=
8249: "replaceable"><code>pkg</code></em>}</code> to
8250: add to the header and library search paths. These
1.1 grant 8251: default to “<span class=
8252: "quote">include</span>” and
8253: “<span class="quote">lib</span>”
8254: respectively.</p>
8255: </li>
8256:
8257: <li>
1.14 xtraeme 8258: <p><code class=
8259: "varname">BUILDLINK_CPPFLAGS.<em class=
8260: "replaceable"><code>pkg</code></em></code> (not
8261: shown above) is the list of preprocessor flags to
8262: add to <code class="varname">CPPFLAGS</code>,
8263: which are passed on to the configure and build
8264: phases. The “<span class=
8265: "quote">-I</span>” option should be avoided
8266: and instead be handled using <code class=
8267: "varname">BUILDLINK_INCDIRS.<em class=
8268: "replaceable"><code>pkg</code></em></code> as
8269: above.</p>
1.1 grant 8270: </li>
8271: </ul>
8272: </div>
8273:
8274: <p>The following variables are all optionally defined
8275: within this second section (protected against multiple
8276: inclusion) and control which package files are
1.45 wiz 8277: symlinked into <code xmlns=
8278: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8279: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8280: are transformed during the symlinking:</p>
8281:
8282: <div class="itemizedlist">
8283: <ul type="disc">
8284: <li>
1.14 xtraeme 8285: <p><code class=
8286: "varname">BUILDLINK_FILES.<em class=
8287: "replaceable"><code>pkg</code></em></code> (not
8288: shown above) is a shell glob pattern relative to
1.45 wiz 8289: <code xmlns=
8290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8291: "filename">${BUILDLINK_PREFIX.<em class=
8292: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8293: symlinked into <code xmlns=
8294: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8295: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8296: <code xmlns=
8297: "http://www.w3.org/TR/xhtml1/transitional" class=
8298: "filename">include/*.h</code>.</p>
1.1 grant 8299: </li>
8300:
8301: <li>
1.14 xtraeme 8302: <p><code class=
8303: "varname">BUILDLINK_FILES_CMD.<em class=
8304: "replaceable"><code>pkg</code></em></code> (not
8305: shown above) is a shell pipeline that outputs to
1.45 wiz 8306: stdout a list of files relative to <code xmlns=
8307: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8308: "filename">${BUILDLINK_PREFIX.<em class=
8309: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8310: resulting files are to be symlinked into
1.45 wiz 8311: <code xmlns=
8312: "http://www.w3.org/TR/xhtml1/transitional" class=
8313: "filename">${BUILDLINK_DIR}</code>. By default,
8314: this takes the <code xmlns=
8315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8316: "filename">+CONTENTS</code> of a <em class=
8317: "replaceable"><code>pkg</code></em> and filters
8318: it through <code class=
8319: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8320: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8321: </li>
8322:
8323: <li>
1.14 xtraeme 8324: <p><code class=
8325: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8326: "replaceable"><code>pkg</code></em></code> (not
8327: shown above) is a filter command that filters
1.45 wiz 8328: <code xmlns=
8329: "http://www.w3.org/TR/xhtml1/transitional" class=
8330: "filename">+CONTENTS</code> input into a list of
8331: files relative to <code xmlns=
8332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8333: "filename">${BUILDLINK_PREFIX.<em class=
8334: "replaceable"><code>pkg</code></em>}</code> on
8335: stdout. By default for overwrite packages,
8336: <code class=
8337: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8338: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8339: outputs the contents of the <code xmlns=
8340: "http://www.w3.org/TR/xhtml1/transitional" class=
8341: "filename">include</code> and <code xmlns=
8342: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8343: "filename">lib</code> directories in the package
1.45 wiz 8344: <code xmlns=
8345: "http://www.w3.org/TR/xhtml1/transitional" class=
8346: "filename">+CONTENTS</code>, and for pkgviews
8347: packages, it outputs any libtool archives in
8348: <code xmlns=
8349: "http://www.w3.org/TR/xhtml1/transitional" class=
8350: "filename">lib</code> directories.</p>
1.1 grant 8351: </li>
8352:
8353: <li>
1.14 xtraeme 8354: <p><code class=
8355: "varname">BUILDLINK_TRANSFORM.<em class=
8356: "replaceable"><code>pkg</code></em></code> (not
8357: shown above) is a list of sed arguments used to
1.1 grant 8358: transform the name of the source filename into a
1.14 xtraeme 8359: destination filename, e.g. <span><strong class=
1.1 grant 8360: "command">-e
1.14 xtraeme 8361: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8362: </li>
8363: </ul>
8364: </div>
8365:
1.45 wiz 8366: <p>The last section includes any <code xmlns=
8367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8368: "filename">buildlink3.mk</code> needed for <em class=
8369: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8370: dependencies. Including these <code xmlns=
8371: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8372: "filename">buildlink3.mk</code> files means that the
8373: headers and libraries for these dependencies are also
1.45 wiz 8374: symlinked into <code xmlns=
8375: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8376: "filename">${BUILDLINK_DIR}</code> whenever the
8377: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8378: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8379: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8380: included.</p>
1.1 grant 8381: </div>
8382:
8383: <div class="sect2" lang="en" xml:lang="en">
8384: <div class="titlepage">
8385: <div>
8386: <div>
1.30 wiz 8387: <h3 class="title"><a name=
8388: "updating-buildlink-depends" id=
1.38 dillo 8389: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8390: <code class=
8391: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 wiz 8392: <code>pkg</code></em></code> in <code xmlns=
8393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8394: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8395: </div>
8396: </div>
8397: </div>
8398:
8399: <p>There are two situations that require increasing the
1.14 xtraeme 8400: dependency listed in <code class=
8401: "varname">BUILDLINK_DEPENDS.<em class=
8402: "replaceable"><code>pkg</code></em></code> after a
8403: package update:</p>
1.1 grant 8404:
8405: <div class="orderedlist">
8406: <ol type="1">
8407: <li>
8408: <p>if the sonames (major number of the library
8409: version) of any installed shared libraries
8410: change;</p>
8411: </li>
8412:
8413: <li>
8414: <p>if the API or interface to the header files
8415: change.</p>
8416: </li>
8417: </ol>
8418: </div>
8419:
1.14 xtraeme 8420: <p>In these cases, <code class=
8421: "varname">BUILDLINK_DEPENDS.<em class=
8422: "replaceable"><code>pkg</code></em></code> should be
8423: adjusted to require at least the new package version.
8424: In some cases, the packages that depend on this new
8425: version may need their <code class=
8426: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8427: have <code xmlns=
8428: "http://www.w3.org/TR/xhtml1/transitional" class=
8429: "filename">buildlink3.mk</code> files, their
8430: <code class="varname">BUILDLINK_DEPENDS.<em class=
8431: "replaceable"><code>pkg</code></em></code> adjusted,
8432: too. This is needed so that binary packages made using
8433: it will require the correct package dependency and not
8434: settle for an older one which will not contain the
8435: necessary shared libraries.</p>
1.1 grant 8436:
8437: <p>Please take careful consideration before adjusting
1.14 xtraeme 8438: <code class="varname">BUILDLINK_DEPENDS.<em class=
8439: "replaceable"><code>pkg</code></em></code> as we don't
8440: want to cause unneeded package deletions and rebuilds.
8441: In many cases, new versions of packages work just fine
8442: with older dependencies. See <a href="#dependencies"
1.38 dillo 8443: title="15.1.4. Handling dependencies">Section
8444: 15.1.4, “Handling dependencies”</a> for
1.36 wiz 8445: more information about dependencies on other packages,
1.25 rillig 8446: including the <code class=
8447: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8448: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8449: </div>
8450: </div>
8451:
8452: <div class="sect1" lang="en" xml:lang="en">
8453: <div class="titlepage">
8454: <div>
8455: <div>
8456: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8457: "writing-builtin.mk" id=
1.38 dillo 8458: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8459: <code xmlns=
8460: "http://www.w3.org/TR/xhtml1/transitional" class=
8461: "filename">builtin.mk</code> files</h2>
1.1 grant 8462: </div>
8463: </div>
8464: </div>
8465:
8466: <p>Some packages in pkgsrc install headers and libraries
8467: that coincide with headers and libraries present in the
1.45 wiz 8468: base system. Aside from a <code xmlns=
8469: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8470: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8471: should also include a <code xmlns=
8472: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8473: "filename">builtin.mk</code> file that includes the
8474: necessary checks to decide whether using the built-in
8475: software or the pkgsrc software is appropriate.</p>
1.1 grant 8476:
8477: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8478: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8479:
8480: <div class="orderedlist">
8481: <ol type="1">
8482: <li>
1.14 xtraeme 8483: <p>It should set <code class=
8484: "varname">USE_BUILTIN.<em class=
8485: "replaceable"><code>pkg</code></em></code> to
8486: either “<span class="quote">yes</span>”
8487: or “<span class="quote">no</span>”
8488: after it is included.</p>
1.1 grant 8489: </li>
8490:
8491: <li>
8492: <p>It should <span class=
8493: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8494: <code class="varname">USE_BUILTIN.<em class=
8495: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8496: already set before the <code xmlns=
8497: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8498: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8499: </li>
8500:
8501: <li>
8502: <p>It should be written to allow multiple
8503: inclusion. This is <span class=
8504: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8505: careful attention to <code xmlns=
8506: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8507: "filename">Makefile</code> coding.</p>
1.1 grant 8508: </li>
8509: </ol>
8510: </div>
8511:
8512: <div class="sect2" lang="en" xml:lang="en">
8513: <div class="titlepage">
8514: <div>
8515: <div>
1.30 wiz 8516: <h3 class="title"><a name="anatomy-of-builtin.mk"
8517: id=
1.38 dillo 8518: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8519: of a <code xmlns=
8520: "http://www.w3.org/TR/xhtml1/transitional" class=
8521: "filename">builtin.mk</code> file</h3>
1.1 grant 8522: </div>
8523: </div>
8524: </div>
8525:
8526: <p>The following is the recommended template for
8527: builtin.mk files:</p>
8528: <pre class="programlisting">
8529: .if !defined(IS_BUILTIN.foo)
8530: #
8531: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8532: # genuinely exists in the system or not.
8533: #
8534: IS_BUILTIN.foo?= no
8535:
8536: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8537: # version can be determined.
8538: #
8539: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8540: BUILTIN_PKG.foo?= foo-1.0
8541: . endif
8542: .endif # IS_BUILTIN.foo
8543:
8544: .if !defined(USE_BUILTIN.foo)
8545: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8546: . if defined(BUILTIN_PKG.foo)
8547: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8548: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8549: USE_BUILTIN.foo!= \
8550: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8551: ${ECHO} "yes"; \
8552: else \
8553: ${ECHO} "no"; \
8554: fi
8555: . endif
8556: . endfor
8557: . endif
8558: .endif # USE_BUILTIN.foo
8559:
8560: CHECK_BUILTIN.foo?= no
8561: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8562: #
8563: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8564: # "yes" or "no".
8565: #
8566: .endif # CHECK_BUILTIN.foo
8567:
8568: </pre>
8569:
1.14 xtraeme 8570: <p>The first section sets <code class=
8571: "varname">IS_BUILTIN.<em class=
8572: "replaceable"><code>pkg</code></em></code> depending on
8573: if <em class="replaceable"><code>pkg</code></em> really
8574: exists in the base system. This should not be a base
8575: system software with similar functionality to
8576: <em class="replaceable"><code>pkg</code></em>; it
8577: should only be “<span class=
8578: "quote">yes</span>” if the actual package is
8579: included as part of the base system. This variable is
1.45 wiz 8580: only used internally within the <code xmlns=
8581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8582: "filename">builtin.mk</code> file.</p>
8583:
8584: <p>The second section sets <code class=
8585: "varname">BUILTIN_PKG.<em class=
8586: "replaceable"><code>pkg</code></em></code> to the
8587: version of <em class=
8588: "replaceable"><code>pkg</code></em> in the base system
8589: if it exists (if <code class=
8590: "varname">IS_BUILTIN.<em class=
8591: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8592: “<span class="quote">yes</span>”). This
1.14 xtraeme 8593: variable is only used internally within the
1.45 wiz 8594: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8595: class="filename">builtin.mk</code> file.</p>
1.1 grant 8596:
1.14 xtraeme 8597: <p>The third section sets <code class=
8598: "varname">USE_BUILTIN.<em class=
8599: "replaceable"><code>pkg</code></em></code> and is
8600: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8601: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8602: class="filename">builtin.mk</code> files. The code in
8603: this section must make the determination whether the
8604: built-in software is adequate to satisfy the
8605: dependencies listed in <code class=
1.14 xtraeme 8606: "varname">BUILDLINK_DEPENDS.<em class=
8607: "replaceable"><code>pkg</code></em></code>. This is
8608: typically done by comparing <code class=
8609: "varname">BUILTIN_PKG.<em class=
8610: "replaceable"><code>pkg</code></em></code> against each
8611: of the dependencies in <code class=
8612: "varname">BUILDLINK_DEPENDS.<em class=
8613: "replaceable"><code>pkg</code></em></code>.
8614: <code class="varname">USE_BUILTIN.<em class=
8615: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8616: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8617: value by the end of the <code xmlns=
8618: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8619: "filename">builtin.mk</code> file. Note that
8620: <code class="varname">USE_BUILTIN.<em class=
8621: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8622: “<span class="quote">yes</span>” even if
1.14 xtraeme 8623: <code class="varname">IS_BUILTIN.<em class=
8624: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8625: “<span class="quote">no</span>” because we
8626: may make the determination that the built-in version of
8627: the software is similar enough to be used as a
8628: replacement.</p>
8629:
1.14 xtraeme 8630: <p>The last section is guarded by <code class=
8631: "varname">CHECK_BUILTIN.<em class=
8632: "replaceable"><code>pkg</code></em></code>, and
8633: includes code that uses the value of <code class=
8634: "varname">USE_BUILTIN.<em class=
8635: "replaceable"><code>pkg</code></em></code> set in the
8636: previous section. This typically includes, e.g., adding
1.1 grant 8637: additional dependency restrictions and listing
1.45 wiz 8638: additional files to symlink into <code xmlns=
8639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8640: "filename">${BUILDLINK_DIR}</code> (via <code class=
8641: "varname">BUILDLINK_FILES.<em class=
8642: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8643: </div>
8644:
8645: <div class="sect2" lang="en" xml:lang="en">
8646: <div class="titlepage">
8647: <div>
8648: <div>
1.30 wiz 8649: <h3 class="title"><a name=
8650: "native-or-pkgsrc-preference" id=
1.38 dillo 8651: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8652: preferences for native or pkgsrc software</h3>
1.1 grant 8653: </div>
8654: </div>
8655: </div>
8656:
8657: <p>When building packages, it's possible to choose
8658: whether to set a global preference for using either the
8659: built-in (native) version or the pkgsrc version of
8660: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8661: setting <code class="varname">PREFER_PKGSRC</code> and
8662: <code class="varname">PREFER_NATIVE</code>. These
8663: variables take values of either “<span class=
1.1 grant 8664: "quote">yes</span>”, “<span class=
8665: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8666: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8667: to use the pkgsrc versions of software, while
8668: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8669: to use the built-in versions. Preferences are
8670: determined by the most specific instance of the package
8671: in either <code class="varname">PREFER_PKGSRC</code> or
8672: <code class="varname">PREFER_NATIVE</code>. If a
8673: package is specified in neither or in both variables,
8674: then <code class="varname">PREFER_PKGSRC</code> has
8675: precedence over <code class=
8676: "varname">PREFER_NATIVE</code>. For example, to require
8677: using pkgsrc versions of software for all but the most
8678: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8679: <pre class="programlisting">
8680: PREFER_PKGSRC= yes
8681: PREFER_NATIVE= getopt skey tcp_wrappers
8682:
8683: </pre>
8684:
8685: <p>A package <span class=
1.45 wiz 8686: "emphasis"><em>must</em></span> have a <code xmlns=
8687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8688: "filename">builtin.mk</code> file to be listed in
8689: <code class="varname">PREFER_NATIVE</code>, otherwise
8690: it is simply ignored in that list.</p>
1.1 grant 8691: </div>
8692: </div>
8693: </div>
8694:
8695: <div class="chapter" lang="en" xml:lang="en">
8696: <div class="titlepage">
8697: <div>
8698: <div>
1.35 jmmv 8699: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 8700: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8701: framework</h2>
1.1 grant 8702: </div>
8703: </div>
8704: </div>
8705:
8706: <div class="toc">
8707: <p><b>Table of Contents</b></p>
8708:
8709: <dl>
1.30 wiz 8710: <dt><span class="sect1"><a href=
1.38 dillo 8711: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8712: directories outside the installation
8713: prefix</a></span></dt>
8714:
8715: <dd>
8716: <dl>
8717: <dt><span class="sect2"><a href=
1.38 dillo 8718: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8719: manipulation</a></span></dt>
8720:
8721: <dt><span class="sect2"><a href=
1.38 dillo 8722: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8723: manipulation</a></span></dt>
8724: </dl>
8725: </dd>
8726:
1.38 dillo 8727: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8728: Configuration files</a></span></dt>
8729:
8730: <dd>
8731: <dl>
8732: <dt><span class="sect2"><a href=
1.38 dillo 8733: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8734: "varname">PKG_SYSCONFDIR</code> is
8735: set</a></span></dt>
8736:
8737: <dt><span class="sect2"><a href=
1.38 dillo 8738: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 8739: software were configuration files
8740: are</a></span></dt>
8741:
8742: <dt><span class="sect2"><a href=
1.38 dillo 8743: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8744: installations</a></span></dt>
8745:
8746: <dt><span class="sect2"><a href=
1.38 dillo 8747: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8748: configuration files</a></span></dt>
8749: </dl>
8750: </dd>
8751:
1.38 dillo 8752: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8753: System startup scripts</a></span></dt>
8754:
8755: <dd>
8756: <dl>
8757: <dt><span class="sect2"><a href=
1.38 dillo 8758: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8759: of system startup scripts</a></span></dt>
8760: </dl>
8761: </dd>
1.1 grant 8762:
1.30 wiz 8763: <dt><span class="sect1"><a href=
1.38 dillo 8764: "#users-and-groups">12.4. System users and
1.35 jmmv 8765: groups</a></span></dt>
8766:
1.38 dillo 8767: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8768: shells</a></span></dt>
8769:
8770: <dd>
8771: <dl>
8772: <dt><span class="sect2"><a href=
1.38 dillo 8773: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8774: configuration files</a></span></dt>
8775: </dl>
8776: </dd>
1.1 grant 8777: </dl>
8778: </div>
8779:
1.35 jmmv 8780: <p>This chapter describes the framework known as
8781: <code class="literal">pkginstall</code>, whose key features
8782: are:</p>
8783:
8784: <div class="itemizedlist">
8785: <ul type="disc">
8786: <li>
8787: <p>Generic installation and manipulation of
8788: directories and files outside the pkgsrc-handled
8789: tree, <code class="varname">LOCALBASE</code>.</p>
8790: </li>
8791:
8792: <li>
8793: <p>Automatic handling of configuration files during
8794: installation, provided that packages are correctly
8795: designed.</p>
8796: </li>
8797:
8798: <li>
8799: <p>Generation and installation of system startup
8800: scripts.</p>
8801: </li>
8802:
8803: <li>
8804: <p>Registration of system users and groups.</p>
8805: </li>
8806:
8807: <li>
8808: <p>Registration of system shells.</p>
8809: </li>
8810: </ul>
8811: </div>
8812:
8813: <p>The following sections inspect each of the above points
8814: in detail. Note that, in order to use any of the described
8815: functionalities, you must add the following to your
1.45 wiz 8816: package's <code xmlns=
8817: "http://www.w3.org/TR/xhtml1/transitional" class=
8818: "filename">Makefile</code>:</p>
1.35 jmmv 8819: <pre class="programlisting">
8820: USE_PKGINSTALL=YES
8821: </pre>
8822:
8823: <p>You may be thinking that many of the things described
8824: here could be easily done with simple code in the package's
8825: post-installation target (<code class=
8826: "literal">post-install</code>). <span class=
8827: "emphasis"><em>This is incorrect</em></span>, as the code
8828: in them is only executed when building from source.
8829: Machines using binary packages could not benefit from it at
8830: all (as the code itself could be unavailable). Therefore,
8831: the only way to achieve any of the items described above is
8832: by means of the installation scripts, which are
8833: automatically generated by pkginstall.</p>
1.1 grant 8834:
8835: <div class="sect1" lang="en" xml:lang="en">
8836: <div class="titlepage">
8837: <div>
8838: <div>
8839: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 8840: "files-and-dirs-outside-prefix" id=
1.38 dillo 8841: "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35 jmmv 8842: directories outside the installation prefix</h2>
1.1 grant 8843: </div>
8844: </div>
8845: </div>
8846:
1.45 wiz 8847: <p>As you already know, the <code xmlns=
8848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8849: "filename">PLIST</code> file holds a list of files and
8850: directories that belong to a package. The names used in
1.45 wiz 8851: it are relative to the installation prefix (<code xmlns=
8852: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8853: "filename">${PREFIX}</code>), which means that it cannot
8854: register files outside this directory (absolute path
8855: names are not allowed). Despite this restriction, some
8856: packages need to install files outside this location;
1.45 wiz 8857: e.g., under <code xmlns=
8858: "http://www.w3.org/TR/xhtml1/transitional" class=
8859: "filename">${VARBASE}</code> or <code xmlns=
8860: "http://www.w3.org/TR/xhtml1/transitional" class=
8861: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 8862:
8863: <p>The only way to achieve this is to create such files
8864: during installation time by using the installation
8865: scripts. These scripts can run arbitrary commands, so
8866: they have the potential to create and manage files
8867: anywhere in the filesystem. Here is where pkginstall
8868: comes into play: it provides generic scripts to abstract
8869: the manipulation of such files and directories based on
1.45 wiz 8870: variables set in the package's <code xmlns=
8871: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8872: "filename">Makefile</code>. The rest of this section
8873: describes which these variables are.</p>
1.1 grant 8874:
1.35 jmmv 8875: <div class="sect2" lang="en" xml:lang="en">
8876: <div class="titlepage">
1.1 grant 8877: <div>
1.35 jmmv 8878: <div>
8879: <h3 class="title"><a name="dirs-outside-prefix"
1.38 dillo 8880: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8881: manipulation</h3>
8882: </div>
1.1 grant 8883: </div>
8884: </div>
8885:
1.35 jmmv 8886: <p>The following variables can be set to request the
8887: creation of directories anywhere in the filesystem:</p>
1.27 rillig 8888:
1.35 jmmv 8889: <div class="itemizedlist">
8890: <ul type="disc">
8891: <li>
8892: <p><code class="varname">MAKE_DIRS</code> and
8893: <code class="varname">OWN_DIRS</code> contain a
8894: list of directories that should be created and
8895: should attempt to be destroyed by the
8896: installation scripts. The difference between the
8897: two is that the latter prompts the administrator
8898: to remove any directories that may be left after
8899: deinstallation (because they were not empty),
8900: while the former does not.</p>
8901: </li>
1.1 grant 8902:
1.35 jmmv 8903: <li>
8904: <p><code class="varname">MAKE_DIRS_PERMS</code>
8905: and <code class="varname">OWN_DIRS_PERMS</code>
8906: contain a list of tuples describing which
8907: directories should be created and should attempt
8908: to be destroyed by the installation scripts. Each
8909: tuple holds the following values, separated by
8910: spaces: the directory name, its owner, its group
8911: and its numerical mode. For example:</p>
8912: <pre class="programlisting">
8913: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8914: </pre>
1.1 grant 8915:
1.35 jmmv 8916: <p>The difference between the two is exactly the
8917: same as their non-<code class=
8918: "varname">PERMS</code> counterparts.</p>
8919: </li>
8920: </ul>
8921: </div>
8922: </div>
8923:
8924: <div class="sect2" lang="en" xml:lang="en">
8925: <div class="titlepage">
8926: <div>
8927: <div>
8928: <h3 class="title"><a name="files-outside-prefix"
1.38 dillo 8929: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 8930: manipulation</h3>
8931: </div>
8932: </div>
8933: </div>
8934:
8935: <p>Creating non-empty files outside the installation
1.45 wiz 8936: prefix is tricky because the <code xmlns=
8937: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8938: "filename">PLIST</code> forces all files to be inside
8939: it. To overcome this problem, the only solution is to
8940: extract the file in the known place (i.e., inside the
8941: installation prefix) and copy it to the appropriate
8942: location during installation (done by the installation
8943: scripts generated by pkginstall). We will call the
8944: former the <span class="emphasis"><em>master
8945: file</em></span> in the following paragraphs, which
8946: describe the variables that can be used to
8947: automatically and consistently handle files outside the
8948: installation prefix:</p>
8949:
8950: <div class="itemizedlist">
8951: <ul type="disc">
8952: <li>
8953: <p><code class="varname">CONF_FILES</code> and
8954: <code class="varname">SUPPORT_FILES</code> are
8955: pairs of master and target files. During
8956: installation time, the master file is copied to
8957: the target one if and only if the latter does not
8958: exist. Upon deinstallation, the target file is
8959: removed provided that it was not modified by the
8960: installation.</p>
8961:
8962: <p>The difference between the two is that the
8963: latter prompts the administrator to remove any
8964: files that may be left after deinstallation
8965: (because they were not empty), while the former
8966: does not.</p>
8967: </li>
8968:
8969: <li>
8970: <p><code class="varname">CONF_FILES_PERMS</code>
8971: and <code class=
8972: "varname">SUPPORT_FILES_PERMS</code> contain
8973: tuples describing master files as well as their
8974: target locations. For each of them, it also
8975: specifies their owner, their group and their
8976: numeric permissions, in this order. For
8977: example:</p>
8978: <pre class="programlisting">
8979: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
8980: </pre>
8981:
8982: <p>The difference between the two is exactly the
8983: same as their non-<code class=
8984: "varname">PERMS</code> counterparts.</p>
8985: </li>
8986: </ul>
8987: </div>
8988: </div>
8989: </div>
8990:
8991: <div class="sect1" lang="en" xml:lang="en">
8992: <div class="titlepage">
8993: <div>
8994: <div>
8995: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8996: "conf-files" id="conf-files"></a>12.2.
1.35 jmmv 8997: Configuration files</h2>
8998: </div>
8999: </div>
9000: </div>
9001:
9002: <p>Configuration files are special in the sense that they
9003: are installed in their own specific directory,
9004: <code class="varname">PKG_SYSCONFDIR</code>, and need
9005: special treatment during installation (most of which is
9006: automated by pkginstall). The main concept you must bear
1.36 wiz 9007: in mind is that files marked as configuration files are
1.35 jmmv 9008: automatically copied to the right place (somewhere inside
9009: <code class="varname">PKG_SYSCONFDIR</code>) during
9010: installation <span class="emphasis"><em>if and only
9011: if</em></span> they didn't exist before. Similarly, they
9012: will not be removed if they have local modifications.
1.36 wiz 9013: This ensures that administrators never lose any custom
1.35 jmmv 9014: changes they may have made.</p>
9015:
9016: <div class="sect2" lang="en" xml:lang="en">
9017: <div class="titlepage">
9018: <div>
9019: <div>
9020: <h3 class="title"><a name="conf-files-sysconfdir"
1.38 dillo 9021: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9022: <code class="varname">PKG_SYSCONFDIR</code> is
9023: set</h3>
9024: </div>
9025: </div>
9026: </div>
9027:
9028: <p>As said before, the <code class=
9029: "varname">PKG_SYSCONFDIR</code> variable specifies
9030: where configuration files shall be installed. Its
9031: contents are set based upon the following
9032: variables:</p>
9033:
9034: <div class="itemizedlist">
9035: <ul type="disc">
9036: <li>
9037: <p><code class="varname">PKG_SYSCONFBASE</code>:
9038: The configuration's root directory. Defaults to
1.45 wiz 9039: <code xmlns=
9040: "http://www.w3.org/TR/xhtml1/transitional" class=
9041: "filename">${PREFIX}/etc</code> although it may
9042: be overridden by the user to point to his
9043: preferred location (e.g., <code xmlns=
9044: "http://www.w3.org/TR/xhtml1/transitional" class=
9045: "filename">/etc</code>, <code xmlns=
9046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9047: "filename">/etc/pkg</code>, etc.). Packages must
9048: not use it directly.</p>
9049: </li>
9050:
9051: <li>
9052: <p><code class=
9053: "varname">PKG_SYSCONFSUBDIR</code>: A
9054: subdirectory of <code class=
9055: "varname">PKG_SYSCONFBASE</code> under which the
9056: configuration files for the package being built
9057: shall be installed. The definition of this
9058: variable only makes sense in the package's
1.45 wiz 9059: <code xmlns=
9060: "http://www.w3.org/TR/xhtml1/transitional" class=
9061: "filename">Makefile</code> (i.e., it is not user
9062: customizable).</p>
1.35 jmmv 9063:
9064: <p>As an example, consider the Apache package,
9065: <a xmlns=
9066: "http://www.w3.org/TR/xhtml1/transitional" href=
9067: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9068: target="_top"><code xmlns="" class=
9069: "filename">www/apache2</code></a>, which places
9070: its configuration files under the <code xmlns=
9071: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9072: "filename">httpd/</code> subdirectory of
9073: <code class="varname">PKG_SYSCONFBASE</code>.
9074: This should be set in the package Makefile.</p>
9075: </li>
9076:
9077: <li>
9078: <p><code class="varname">PKG_SYSCONFVAR</code>:
9079: Specifies the name of the variable that holds
9080: this package's configuration directory (if
9081: different from <code class=
9082: "varname">PKG_SYSCONFBASE</code>). It defaults to
9083: <code class="varname">PKGBASE</code>'s value, and
9084: is always prefixed with <code class=
9085: "literal">PKG_SYSCONFDIR</code>.</p>
9086: </li>
9087:
9088: <li>
9089: <p><code class=
9090: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9091: Holds the directory where the configuration files
9092: for the package identified by <code class=
9093: "varname">PKG_SYSCONFVAR</code>'s shall be
9094: placed.</p>
9095: </li>
9096: </ul>
9097: </div>
9098:
9099: <p>Based on the above variables, pkginstall determines
9100: the value of <code class=
9101: "varname">PKG_SYSCONFDIR</code>, which is the
9102: <span class="emphasis"><em>only</em></span> variable
9103: that can be used within a package to refer to its
9104: configuration directory. The algorithm used to set its
9105: value is basically the following:</p>
9106:
9107: <div class="orderedlist">
9108: <ol type="1">
9109: <li>
9110: <p>If <code class=
9111: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9112: is set, its value is used.</p>
9113: </li>
9114:
9115: <li>
9116: <p>If the previous variable is not defined but
9117: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9118: set in the package's <code xmlns=
9119: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9120: "filename">Makefile</code>, the resulting value
1.45 wiz 9121: is <code xmlns=
9122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9123: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9124: </li>
9125:
9126: <li>
1.45 wiz 9127: <p>Otherwise, it is set to <code xmlns=
9128: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9129: "filename">${PKG_SYSCONFBASE}</code>.</p>
9130: </li>
9131: </ol>
9132: </div>
9133:
1.45 wiz 9134: <p>It is worth mentioning that <code xmlns=
9135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9136: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9137: added to <code xmlns=
9138: "http://www.w3.org/TR/xhtml1/transitional" class=
9139: "filename">OWN_DIRS</code>. See <a href=
9140: "#dirs-outside-prefix" title=
1.38 dillo 9141: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9142: “Directory manipulation”</a> what this
9143: means.</p>
9144: </div>
9145:
9146: <div class="sect2" lang="en" xml:lang="en">
9147: <div class="titlepage">
9148: <div>
9149: <div>
9150: <h3 class="title"><a name="conf-files-configure"
1.38 dillo 9151: id="conf-files-configure"></a>12.2.2. Telling the
1.35 jmmv 9152: software were configuration files are</h3>
9153: </div>
9154: </div>
9155: </div>
9156:
9157: <p>Given that pkgsrc (and users!) expect configuration
9158: files to be in a known place, you need to teach each
1.36 wiz 9159: package where it shall install its files. In some cases
1.35 jmmv 9160: you will have to patch the package Makefiles to achieve
9161: it. If you are lucky, though, it may be as easy as
9162: passing an extra flag to the configuration script; this
9163: is the case of GNU Autoconf generated files:</p>
9164: <pre class="programlisting">
9165: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
9166: </pre>
9167:
9168: <p>Note that this specifies where the package has to
9169: <span class="emphasis"><em>look for</em></span> its
9170: configuration files, not where they will be originally
9171: installed (although the difference is never explicit,
9172: unfortunately).</p>
9173: </div>
9174:
9175: <div class="sect2" lang="en" xml:lang="en">
9176: <div class="titlepage">
9177: <div>
9178: <div>
9179: <h3 class="title"><a name="conf-files-patching"
1.38 dillo 9180: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9181: installations</h3>
9182: </div>
9183: </div>
9184: </div>
9185:
9186: <p>As said before, pkginstall automatically handles
9187: configuration files. This means that <span class=
9188: "strong"><strong>the packages themselves must not touch
1.45 wiz 9189: the contents of <code xmlns=
9190: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9191: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9192: directly</strong></span>. Bad news is that many
9193: software installation scripts will, out of the box,
9194: mess with the contents of that directory. So what is
9195: the correct procedure to fix this issue?</p>
1.35 jmmv 9196:
9197: <p>You must teach the package (usually by manually
9198: patching it) to install any configuration files under
1.45 wiz 9199: the examples hierarchy, <code xmlns=
9200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9201: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9202: the <code xmlns=
9203: "http://www.w3.org/TR/xhtml1/transitional" class=
9204: "filename">PLIST</code> registers them and the
9205: administrator always has the original copies
1.35 jmmv 9206: available.</p>
9207:
9208: <p>Once the required configuration files are in place
9209: (i.e., under the examples hierarchy), the pkginstall
9210: framework can use them as master copies during the
1.45 wiz 9211: package installation to update what is in <code xmlns=
9212: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9213: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9214: the variables <code class="varname">CONF_FILES</code>
9215: and <code class="varname">CONF_FILES_PERMS</code> are
9216: used. Check out <a href="#files-outside-prefix" title=
1.38 dillo 9217: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9218: “File manipulation”</a> for information
9219: about their syntax and their purpose. Here is an
9220: example, taken from the <a xmlns=
9221: "http://www.w3.org/TR/xhtml1/transitional" href=
9222: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9223: target="_top"><code xmlns="" class=
9224: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9225: <pre class="programlisting">
9226: EGDIR= ${PREFIX}/share/doc/mutt/samples
9227: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
9228: </pre>
9229:
9230: <p>Note that the <code class="varname">EGDIR</code>
9231: variable is specific to that package and has no meaning
9232: outside it.</p>
9233: </div>
9234:
9235: <div class="sect2" lang="en" xml:lang="en">
9236: <div class="titlepage">
9237: <div>
9238: <div>
9239: <h3 class="title"><a name="conf-files-disable"
1.38 dillo 9240: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9241: handling of configuration files</h3>
9242: </div>
9243: </div>
9244: </div>
9245:
9246: <p>The automatic copying of config files can be toggled
9247: by setting the environment variable <code class=
9248: "varname">PKG_CONFIG</code> prior to package
9249: installation.</p>
9250: </div>
9251: </div>
9252:
9253: <div class="sect1" lang="en" xml:lang="en">
9254: <div class="titlepage">
9255: <div>
9256: <div>
9257: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9258: "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35 jmmv 9259: startup scripts</h2>
9260: </div>
9261: </div>
9262: </div>
9263:
9264: <p>System startup scripts are special files because they
9265: must be installed in a place known by the underlying OS,
9266: usually outside the installation prefix. Therefore, the
9267: same rules described in <a href=
9268: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9269: "12.1. Files and directories outside the installation prefix">
9270: Section 12.1, “Files and directories outside the
1.35 jmmv 9271: installation prefix”</a> apply, and the same
9272: solutions can be used. However, pkginstall provides a
1.36 wiz 9273: special mechanism to handle these files.</p>
1.35 jmmv 9274:
9275: <p>In order to provide system startup scripts, the
9276: package has to:</p>
9277:
9278: <div class="orderedlist">
9279: <ol type="1">
9280: <li>
1.45 wiz 9281: <p>Store the script inside <code xmlns=
9282: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9283: "filename">${FILESDIR}</code>, with the
9284: <code class="literal">.sh</code> suffix appended.
9285: Considering the <a xmlns=
9286: "http://www.w3.org/TR/xhtml1/transitional" href=
9287: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9288: target="_top"><code xmlns="" class=
9289: "filename">print/cups</code></a> package as an
9290: example, it has a <code xmlns=
9291: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9292: "filename">cupsd.sh</code> in its files
9293: directory.</p>
9294: </li>
9295:
9296: <li>
9297: <p>Tell pkginstall to handle it, appending the name
9298: of the script, without its extension, to the
9299: <code class="varname">RCD_SCRIPTS</code> variable.
9300: Continuing the previous example:</p>
9301: <pre class="programlisting">
9302: RCD_SCRIPTS+= cupsd
9303: </pre>
9304: </li>
9305: </ol>
9306: </div>
9307:
9308: <p>Once this is done, pkginstall will do the following
9309: steps for each script in an automated fashion:</p>
9310:
9311: <div class="orderedlist">
9312: <ol type="1">
9313: <li>
9314: <p>Process the file found in the files directory
9315: applying all the substitutions described in the
1.45 wiz 9316: <code xmlns=
9317: "http://www.w3.org/TR/xhtml1/transitional" class=
9318: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9319: </li>
9320:
9321: <li>
9322: <p>Copy the script from the files directory to the
1.45 wiz 9323: examples hierarchy, <code xmlns=
9324: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9325: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9326: Note that this master file must be explicitly
1.45 wiz 9327: registered in the <code xmlns=
9328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9329: "filename">PLIST</code>.</p>
9330: </li>
9331:
9332: <li>
9333: <p>Add code to the installation scripts to copy the
9334: startup script from the examples hierarchy into the
9335: system-wide startup scripts directory.</p>
9336: </li>
9337: </ol>
9338: </div>
9339:
9340: <div class="sect2" lang="en" xml:lang="en">
9341: <div class="titlepage">
9342: <div>
9343: <div>
9344: <h3 class="title"><a name="rcd-scripts-disable"
1.38 dillo 9345: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9346: handling of system startup scripts</h3>
9347: </div>
9348: </div>
9349: </div>
9350:
9351: <p>The automatic copying of config files can be toggled
9352: by setting the environment variable <code class=
9353: "varname">PKG_RCD_SCRIPTS</code> prior to package
9354: installation. Note that the scripts will be always
1.45 wiz 9355: copied inside the examples hierarchy, <code xmlns=
9356: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9357: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9358: matter what the value of this variable is.</p>
9359: </div>
9360: </div>
9361:
9362: <div class="sect1" lang="en" xml:lang="en">
9363: <div class="titlepage">
9364: <div>
9365: <div>
9366: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9367: "users-and-groups" id="users-and-groups"></a>12.4.
1.35 jmmv 9368: System users and groups</h2>
9369: </div>
9370: </div>
9371: </div>
9372:
9373: <p>If a package needs to create special users and/or
9374: groups during installation, it can do so by using the
9375: pkginstall framework.</p>
9376:
9377: <p>Users can be created by adding entries to the
9378: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9379: entry has the following syntax, which mimics <code xmlns=
9380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9381: "filename">/etc/passwd</code>:</p>
9382: <pre class="programlisting">
9383: user:group[:[userid][:[descr][:[home][:shell]]]]
9384: </pre>
9385:
9386: <p>Only the user and group are required; everything else
9387: is optional, but the colons must be in the right places
9388: when specifying optional bits. By default, a new user
1.45 wiz 9389: will have home directory <code xmlns=
9390: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9391: "filename">/nonexistent</code>, and login shell
1.45 wiz 9392: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9393: class="filename">/sbin/nologin</code> unless they are
9394: specified as part of the user element. Note that if the
9395: description contains spaces, then spaces should be double
9396: backslash-escaped, as in:</p>
1.35 jmmv 9397: <pre class="programlisting">
9398: foo:foogrp::The\\ Foomister
9399: </pre>
9400:
9401: <p>Similarly, groups can be created using the
9402: <code class="varname">PKG_GROUPS</code> variable, whose
9403: syntax is:</p>
9404: <pre class="programlisting">
9405: group[:groupid]
9406: </pre>
9407:
9408: <p>As before, only the group name is required; the
9409: numeric identifier is optional.</p>
9410: </div>
9411:
9412: <div class="sect1" lang="en" xml:lang="en">
9413: <div class="titlepage">
9414: <div>
9415: <div>
9416: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9417: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9418: </div>
9419: </div>
9420: </div>
9421:
9422: <p>Packages that install system shells should register
1.45 wiz 9423: them in the shell database, <code xmlns=
9424: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9425: "filename">/etc/shells</code>, to make things easier to
9426: the administrator. This must be done from the
9427: installation scripts to keep binary packages working on
9428: any system. pkginstall provides an easy way to accomplish
9429: this task.</p>
9430:
9431: <p>When a package provides a shell interpreter, it has to
9432: set the <code class="varname">PKG_SHELL</code> variable
9433: to its absolute file name. This will add some hooks to
9434: the installation scripts to handle it. Consider the
9435: following example, taken from <a xmlns=
9436: "http://www.w3.org/TR/xhtml1/transitional" href=
9437: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9438: target="_top"><code xmlns="" class=
9439: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9440: <pre class="programlisting">
9441: USE_PKGINSTALL= YES
9442: PKG_SHELL= ${PREFIX}/bin/zsh
9443: </pre>
9444:
9445: <div class="sect2" lang="en" xml:lang="en">
9446: <div class="titlepage">
9447: <div>
9448: <div>
9449: <h3 class="title"><a name="shells-disable" id=
1.38 dillo 9450: "shells-disable"></a>12.5.1. Disabling handling
1.35 jmmv 9451: of configuration files</h3>
9452: </div>
9453: </div>
9454: </div>
9455:
9456: <p>The automatic registration of shell interpreters can
9457: be disabled by the administrator by setting the
1.45 wiz 9458: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9459: class="filename">PKG_REGISTER_SHELLS</code> environment
9460: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9461: </div>
9462: </div>
9463: </div>
9464:
9465: <div class="chapter" lang="en" xml:lang="en">
9466: <div class="titlepage">
9467: <div>
9468: <div>
9469: <h2 class="title"><a name="options" id=
1.38 dillo 9470: "options"></a>Chapter 13. Options
1.35 jmmv 9471: handling</h2>
9472: </div>
9473: </div>
9474: </div>
9475:
9476: <div class="toc">
9477: <p><b>Table of Contents</b></p>
9478:
9479: <dl>
9480: <dt><span class="sect1"><a href=
1.38 dillo 9481: "#global-default-options">13.1. Global default
1.35 jmmv 9482: options</a></span></dt>
9483:
9484: <dt><span class="sect1"><a href=
1.38 dillo 9485: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9486: use <code xmlns=
9487: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9488: "filename">bsd.options.mk</code></a></span></dt>
9489: </dl>
9490: </div>
9491:
9492: <p>Many packages have the ability to be built to support
1.45 wiz 9493: different sets of features. <code xmlns=
9494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9495: "filename">bsd.options.mk</code> is a framework in pkgsrc
9496: that provides generic handling of those options that
9497: determine different ways in which the packages can be
9498: built. It's possible for the user to specify exactly which
9499: sets of options will be built into a package or to allow a
9500: set of global default options apply.</p>
9501:
9502: <div class="sect1" lang="en" xml:lang="en">
9503: <div class="titlepage">
9504: <div>
9505: <div>
9506: <h2 class="title" style="clear: both"><a name=
9507: "global-default-options" id=
1.38 dillo 9508: "global-default-options"></a>13.1. Global
1.35 jmmv 9509: default options</h2>
9510: </div>
9511: </div>
9512: </div>
9513:
9514: <p>Global default options are listed in <code class=
9515: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9516: the options that should be built into every package if
9517: that option is supported. This variable should be set in
1.45 wiz 9518: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9519: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9520: </div>
9521:
9522: <div class="sect1" lang="en" xml:lang="en">
9523: <div class="titlepage">
9524: <div>
9525: <div>
9526: <h2 class="title" style="clear: both"><a name=
9527: "converting-to-options" id=
1.38 dillo 9528: "converting-to-options"></a>13.2. Converting
1.45 wiz 9529: packages to use <code xmlns=
9530: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9531: "filename">bsd.options.mk</code></h2>
9532: </div>
9533: </div>
9534: </div>
9535:
1.45 wiz 9536: <p>The following example shows how <code xmlns=
9537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9538: "filename">bsd.options.mk</code> should be used by the
9539: hypothetical ``wibble'' package, either in the package
1.45 wiz 9540: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9541: class="filename">Makefile</code>, or in a file, e.g.
9542: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9543: class="filename">options.mk</code>, that is included by
9544: the main package <code xmlns=
9545: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9546: "filename">Makefile</code>.</p>
9547: <pre class="programlisting">
1.37 dillo 9548: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9549: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9550: PKG_OPTIONAL_GROUPS= database
9551: PKG_GROUP.database= mysql pgsql
9552: PKG_SUGGESTED_OPTIONS= wibble-foo
9553: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9554: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9555:
9556: .include "../../mk/bsd.prefs.mk"
9557:
9558: # this package was previously named wibble2
9559: .if defined(PKG_OPTIONS.wibble2)
9560: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.40 dillo 9561: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37 dillo 9562: .endif
1.35 jmmv 9563:
9564: .include "../../mk/bsd.options.mk"
9565:
9566: # Package-specific option-handling
9567:
9568: ###
1.37 dillo 9569: ### FOO support
9570: ###
9571: .if !empty(PKG_OPTIONS:Mwibble-foo)
9572: CONFIGURE_ARGS+= --enable-foo
9573: .endif
9574:
9575: ###
1.35 jmmv 9576: ### LDAP support
9577: ###
9578: .if !empty(PKG_OPTIONS:Mldap)
9579: . include "../../databases/openldap/buildlink3.mk"
1.37 dillo 9580: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35 jmmv 9581: .endif
1.1 grant 9582:
9583: ###
1.37 dillo 9584: ### database support
1.1 grant 9585: ###
1.37 dillo 9586: .if !empty(PKG_OPTIONS:Mmysql)
9587: . include "../../mk/mysql.buildlink3.mk"
9588: .endif
9589: .if !empty(PKG_OPTIONS:Mpgsql)
9590: . include "../../mk/pgsql.buildlink3.mk"
1.1 grant 9591: .endif
9592: </pre>
9593:
1.28 rillig 9594: <p>The first section contains the information about which
9595: build options are supported by the package, and any
1.1 grant 9596: default options settings if needed.</p>
9597:
9598: <div class="orderedlist">
9599: <ol type="1">
9600: <li>
1.14 xtraeme 9601: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9602: the name of the <a href=
1.1 grant 9603: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9604: <span class="citerefentry"><span class=
1.27 rillig 9605: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9606: that the user can set to override the default
9607: options. It should be set to “<span class=
9608: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9609: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9610: </li>
9611:
9612: <li>
1.14 xtraeme 9613: <p><code class=
9614: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9615: build options supported by the package.</p>
9616: </li>
9617:
9618: <li>
9619: <p><code class=
9620: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9621: list of names of groups of mutually exclusive
9622: options. The options in each group are listed in
9623: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9624: "replaceable"><code>groupname</code></em></code>.
9625: The most specific setting of any option from the
9626: group takes precedence over all other options in
9627: the group. Options from the groups will be
9628: automatically added to <code class=
9629: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9630: </li>
9631:
9632: <li>
9633: <p><code class=
9634: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9635: like <code class=
9636: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9637: building the packages will fail if no option from
9638: the group is selected.</p>
1.1 grant 9639: </li>
9640:
9641: <li>
1.27 rillig 9642: <p><code class=
1.44 gdt 9643: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9644: list of names of sets of options. At least one
9645: option from each set must be selected. The options
9646: in each set are listed in <code class=
9647: "varname">PKG_OPTIONS_SET.<em class=
9648: "replaceable"><code>setname</code></em></code>.
9649: Options from the sets will be automatically added
9650: to <code class=
9651: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9652: the package will fail if no option from the set is
9653: selected.</p>
9654: </li>
9655:
9656: <li>
9657: <p><code class=
1.27 rillig 9658: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9659: build options which are enabled by default.</p>
9660: </li>
9661:
9662: <li>
1.37 dillo 9663: <p><code class=
9664: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9665: of “<span class="quote"><em class=
9666: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
9667: <code>option</code></em></span>” pairs that
1.45 wiz 9668: map legacy <code xmlns=
9669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9670: "filename">/etc/mk.conf</code> variables to their
9671: option counterparts. Pairs should be added with
9672: “<span class="quote">+=</span>” to keep
9673: the listing of global legacy variables. A warning
9674: will be issued if the user uses a legacy
9675: variable.</p>
9676: </li>
1.1 grant 9677:
1.37 dillo 9678: <li>
9679: <p><code class=
9680: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9681: of “<span class="quote"><em class=
9682: "replaceable"><code>old-option</code></em>:<em class="replaceable">
9683: <code>new-option</code></em></span>” pairs
9684: that map options that have been renamed to their
9685: new counterparts. Pairs should be added with
9686: “<span class="quote">+=</span>” to keep
9687: the listing of global legacy options. A warning
9688: will be issued if the user uses a legacy
9689: option.</p>
9690: </li>
1.1 grant 9691:
1.37 dillo 9692: <li>
9693: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9694: is a list of options implied by deprecated
9695: variables used. This can be used for cases that
9696: neither <code class=
9697: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9698: <code class=
9699: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9700: handle, e. g. when <code class=
9701: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9702: </li>
9703:
9704: <li>
1.37 dillo 9705: <p><code class=
9706: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9707: a list of warnings about deprecated variables or
9708: options used, and what to use instead.</p>
1.1 grant 9709: </li>
1.28 rillig 9710: </ol>
1.1 grant 9711: </div>
9712:
1.37 dillo 9713: <p>A package should never modify <code class=
9714: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9715: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9716: These are strictly user-settable. To suggest a default
9717: set of options, use <code class=
9718: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9719:
1.42 dillo 9720: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 9721: defined before including <code xmlns=
9722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9723: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9724: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9725: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9726: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.42 dillo 9727: are defined (as can happen with platform specific options
9728: if none of them is supported on the current platform),
9729: <code class="varname">PKG_OPTIONS</code> is set to the
9730: empty list and the package is otherwise treated as not
9731: using the options framework.</p>
1.37 dillo 9732:
1.45 wiz 9733: <p>After the inclusion of <code xmlns=
9734: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9735: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9736: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9737: list of selected build options, properly filtered to
1.28 rillig 9738: remove unsupported and duplicate options.</p>
9739:
1.1 grant 9740: <p>The remaining sections contain the logic that is
1.37 dillo 9741: specific to each option. The correct way to check for an
9742: option is to check whether it is listed in <code class=
9743: "varname">PKG_OPTIONS</code>:</p>
9744: <pre class="programlisting">
9745: .if !empty(PKG_OPTIONS:M<em class=
9746: "replaceable"><code>option</code></em>)
9747: </pre>
9748:
9749: <p>If another package already has an option with the same
9750: meaning, use the same name. For options applicable to
9751: multiple packages (like enabling support for a library),
9752: use short option names (like the name of the library).
9753: For options specific to this package, prefix the name
9754: with <code class="varname"><em class=
9755: "replaceable"><code>pkgname</code></em>-</code>. Document
1.45 wiz 9756: the option and its meaning in <code xmlns=
9757: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9758: "filename">mk/defaults/options.description</code>.</p>
1.1 grant 9759: </div>
9760: </div>
9761:
9762: <div class="chapter" lang="en" xml:lang="en">
9763: <div class="titlepage">
9764: <div>
9765: <div>
9766: <h2 class="title"><a name="build" id=
1.38 dillo 9767: "build"></a>Chapter 14. The build
1.1 grant 9768: process</h2>
9769: </div>
9770: </div>
9771: </div>
9772:
9773: <div class="toc">
9774: <p><b>Table of Contents</b></p>
9775:
9776: <dl>
1.38 dillo 9777: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 9778: Program location</a></span></dt>
9779:
1.38 dillo 9780: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 9781: Main targets</a></span></dt>
1.1 grant 9782:
9783: <dt><span class="sect1"><a href=
1.38 dillo 9784: "#build.helpful-targets">14.3. Other helpful
1.1 grant 9785: targets</a></span></dt>
9786: </dl>
9787: </div>
9788:
9789: <p>The basic steps for building a program are always the
9790: same. First the program's source (<span class=
9791: "emphasis"><em>distfile</em></span>) must be brought to the
9792: local system and then extracted. After any patches to
9793: compile properly on NetBSD are applied, the software can be
9794: configured, then built (usually by compiling), and finally
9795: the generated binaries, etc. can be put into place on the
9796: system. These are exactly the steps performed by the NetBSD
9797: package system, which is implemented as a series of targets
1.45 wiz 9798: in a central Makefile, <code xmlns=
9799: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9800: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 9801:
9802: <div class="sect1" lang="en" xml:lang="en">
9803: <div class="titlepage">
9804: <div>
9805: <div>
9806: <h2 class="title" style="clear: both"><a name=
9807: "build.prefix" id=
1.38 dillo 9808: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9809: </div>
9810: </div>
9811: </div>
9812:
9813: <p>Before outlining the process performed by the NetBSD
9814: package system in the next section, here's a brief
9815: discussion on where programs are installed, and which
9816: variables influence this.</p>
9817:
1.14 xtraeme 9818: <p>The automatic variable <code class=
9819: "varname">PREFIX</code> indicates where all files of the
9820: final program shall be installed. It is usually set to
1.45 wiz 9821: <code class="varname">LOCALBASE</code> (<code xmlns=
9822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9823: "filename">/usr/pkg</code>), or <code class=
9824: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9825: “<span class="quote">cross</span>” category.
1.14 xtraeme 9826: The value of <code class="varname">PREFIX</code> needs to
9827: be put into the various places in the program's source
9828: where paths to these files are encoded. See <a href=
1.1 grant 9829: "#components.patches" title=
1.38 dillo 9830: "8.3. patches/*">Section 8.3,
1.1 grant 9831: “patches/*”</a> and <a href="#fixes.libtool"
9832: title=
1.38 dillo 9833: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9834: “Shared libraries - libtool”</a> for more
9835: details.</p>
9836:
9837: <p>When choosing which of these variables to use, follow
9838: the following rules:</p>
9839:
9840: <div class="itemizedlist">
9841: <ul type="disc">
9842: <li>
1.14 xtraeme 9843: <p><code class="varname">PREFIX</code> always
9844: points to the location where the current pkg will
9845: be installed. When referring to a pkg's own
1.1 grant 9846: installation path, use “<span class=
9847: "quote">${PREFIX}</span>”.</p>
9848: </li>
9849:
9850: <li>
1.14 xtraeme 9851: <p><code class="varname">LOCALBASE</code> is where
9852: all non-X11 pkgs are installed. If you need to
1.1 grant 9853: construct a -I or -L argument to the compiler to
9854: find includes and libraries installed by another
9855: non-X11 pkg, use “<span class=
9856: "quote">${LOCALBASE}</span>”.</p>
9857: </li>
9858:
9859: <li>
1.14 xtraeme 9860: <p><code class="varname">X11BASE</code> is where
9861: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9862: installed. When looking for <span class=
9863: "emphasis"><em>standard</em></span> X11 includes
9864: (not those installed by a pkg), use
9865: “<span class=
9866: "quote">${X11BASE}</span>”.</p>
9867: </li>
9868:
9869: <li>
9870: <p>X11 based are special in that they may be
1.14 xtraeme 9871: installed in either <code class=
9872: "varname">X11BASE</code> or <code class=
9873: "varname">LOCALBASE</code>.</p>
1.1 grant 9874:
9875: <p>Usually, X11 packages should be installed under
1.14 xtraeme 9876: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 9877: possible. Note that you will need to include
1.45 wiz 9878: <code xmlns=
9879: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 9880: "filename">../../mk/x11.buildlink3.mk</code> in
9881: them to request the presence of X11 and to get the
9882: right compilation flags.</p>
1.1 grant 9883:
9884: <p>Even though, there are some packages that cannot
1.14 xtraeme 9885: be installed under <code class=
9886: "varname">LOCALBASE</code>: those that come with
1.1 grant 9887: app-defaults files. These packages are special and
1.14 xtraeme 9888: they must be placed under <code class=
9889: "varname">X11BASE</code>. To accomplish this, set
9890: either <code class="varname">USE_X11BASE</code> or
9891: <code class="varname">USE_IMAKE</code> in your
1.1 grant 9892: package.</p>
9893:
1.34 wiz 9894: <p>Some notes: If you need to find includes or
1.14 xtraeme 9895: libraries installed by a pkg that has <code class=
9896: "varname">USE_IMAKE</code> or <code class=
9897: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 9898: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9899: class="filename">Makefile</code>, you need to look
9900: in <span class="emphasis"><em>both</em></span>
9901: <code xmlns=
9902: "http://www.w3.org/TR/xhtml1/transitional" class=
9903: "filename">${X11BASE}</code> and <code xmlns=
9904: "http://www.w3.org/TR/xhtml1/transitional" class=
9905: "filename">${LOCALBASE}</code>. To force
9906: installation of all X11 packages in <code class=
9907: "varname">LOCALBASE</code>, the <a xmlns=
9908: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 9910: target="_top"><code xmlns="" class=
9911: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 9912: enabled by default.</p>
1.1 grant 9913: </li>
9914:
9915: <li>
1.14 xtraeme 9916: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 9917: used to refer to the installed location of an X11
1.14 xtraeme 9918: package. <code class="varname">X11PREFIX</code>
9919: will be set to <code class="varname">X11BASE</code>
9920: if xpkgwedge is not installed, and to <code class=
9921: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 9922: installed.</p>
9923: </li>
9924:
9925: <li>
9926: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 9927: have some packages installed in <code class=
9928: "varname">X11BASE</code> and some in <code class=
9929: "varname">LOCALBASE</code>. To determine the prefix
9930: of an installed package, the <code class=
9931: "varname">EVAL_PREFIX</code> definition can be
9932: used. It takes pairs in the format
9933: “<span class=
1.1 grant 9934: "quote">DIRNAME=<package></span>”, and
1.24 wiz 9935: the <a href=
9936: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9937: <span class="citerefentry"><span class=
9938: "refentrytitle">make</span>(1)</span></a> variable
9939: <code class="varname">DIRNAME</code> will be set to
9940: the prefix of the installed package
9941: <package>, or “<span class=
1.1 grant 9942: "quote">${X11PREFIX}</span>” if the package
9943: is not installed.</p>
9944:
9945: <p>This is best illustrated by example.</p>
9946:
1.45 wiz 9947: <p>The following lines are taken from <code xmlns=
9948: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9949: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 9950: <pre class="programlisting">
1.14 xtraeme 9951: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 9952: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
9953: --with-gtk-prefix="${GTKDIR}" \
9954: --enable-multibyte
9955: </pre>
9956:
9957: <p>Specific defaults can be defined for the
1.14 xtraeme 9958: packages evaluated using <code class=
9959: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 9960: of the form:</p>
9961: <pre class="programlisting">
9962: GTKDIR_DEFAULT= ${LOCALBASE}
9963: </pre>
9964:
1.14 xtraeme 9965: <p>where <code class="varname">GTKDIR</code>
1.1 grant 9966: corresponds to the first definition in the
1.14 xtraeme 9967: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 9968: </li>
9969:
9970: <li>
1.45 wiz 9971: <p>Within <code xmlns=
9972: "http://www.w3.org/TR/xhtml1/transitional" class=
9973: "filename">${PREFIX}</code>, packages should
9974: install files according to <a href=
1.24 wiz 9975: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
9976: <span class="citerefentry"><span class=
9977: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 9978: exception that manual pages go into <code xmlns=
9979: "http://www.w3.org/TR/xhtml1/transitional" class=
9980: "filename">${PREFIX}/man</code>, not <code xmlns=
9981: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9982: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 9983: </li>
9984: </ul>
9985: </div>
9986: </div>
9987:
9988: <div class="sect1" lang="en" xml:lang="en">
9989: <div class="titlepage">
9990: <div>
9991: <div>
9992: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9993: "main-targets" id=
1.38 dillo 9994: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 9995: </div>
9996: </div>
9997: </div>
9998:
9999: <p>The main targets used during the build process defined
1.45 wiz 10000: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10001: class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 10002:
10003: <div class="variablelist">
10004: <dl>
10005: <dt><span class="term">fetch</span></dt>
10006:
10007: <dd>
10008: <p>This will check if the file(s) given in the
1.14 xtraeme 10009: variables <code class="varname">DISTFILES</code>
10010: and <code class="varname">PATCHFILES</code> (as
10011: defined in the package's Makefile) are present on
1.45 wiz 10012: the local system in <code xmlns=
10013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10014: "filename">/usr/pkgsrc/distfiles</code>. If they
10015: are not present, an attempt will be made to fetch
10016: them using commands of the form:</p>
1.1 grant 10017: <pre class="programlisting">
10018: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
10019: </pre>
10020:
10021: <p>where ${site} varies through several
1.14 xtraeme 10022: possibilities in turn: first, <code class=
10023: "varname">MASTER_SITE_OVERRIDE</code> is tried,
10024: then the sites specified in either <code class=
10025: "varname">SITES_file</code> if defined, else
10026: <code class="varname">MASTER_SITES</code> or
10027: <code class="varname">PATCH_SITES</code>, as
10028: applies, then finally the value of <code class=
10029: "varname">MASTER_SITE_BACKUP</code>. The order of
10030: all except the first can be optionally sorted by
10031: the user, via setting either <code class=
10032: "varname">MASTER_SORT_AWK</code> or <code class=
10033: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 10034: </dd>
10035:
10036: <dt><span class="term">checksum</span></dt>
10037:
10038: <dd>
10039: <p>After the distfile(s) are fetched, their
10040: checksum is generated and compared with the
10041: checksums stored in the distinfo file. If the
10042: checksums don't match, the build is aborted. This
10043: is to ensure the same distfile is used for
10044: building, and that the distfile wasn't changed,
10045: e.g. by some malign force, deliberately changed
10046: distfiles on the master distribution site or
10047: network lossage.</p>
10048: </dd>
10049:
10050: <dt><span class="term">extract</span></dt>
10051:
10052: <dd>
10053: <p>When the distfiles are present on the local
10054: system, they need to be extracted, as they are
10055: usually in the form of some compressed archive
1.45 wiz 10056: format, most commonly <code xmlns=
10057: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10058: "filename">.tar.gz</code>.</p>
1.1 grant 10059:
10060: <p>If only some of the distfiles need to be
10061: uncompressed, the files to be uncompressed should
1.14 xtraeme 10062: be put into <code class=
10063: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10064:
1.45 wiz 10065: <p>If the distfiles are not in <code xmlns=
10066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10067: "filename">.tar.gz</code> format, they can be
10068: extracted by setting either <code class=
10069: "varname">EXTRACT_SUFX</code>, or <code class=
10070: "varname">EXTRACT_CMD</code>, <code class=
10071: "varname">EXTRACT_BEFORE_ARGS</code> and
10072: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
10073: the former case, pkgsrc knows how to extract a
1.45 wiz 10074: number of suffixes (<code xmlns=
10075: "http://www.w3.org/TR/xhtml1/transitional" class=
10076: "filename">.tar.gz</code>, <code xmlns=
10077: "http://www.w3.org/TR/xhtml1/transitional" class=
10078: "filename">.tgz</code>, <code xmlns=
10079: "http://www.w3.org/TR/xhtml1/transitional" class=
10080: "filename">.tar.gz2</code>, <code xmlns=
10081: "http://www.w3.org/TR/xhtml1/transitional" class=
10082: "filename">.tbz</code>, <code xmlns=
10083: "http://www.w3.org/TR/xhtml1/transitional" class=
10084: "filename">.tar.Z</code>, <code xmlns=
10085: "http://www.w3.org/TR/xhtml1/transitional" class=
10086: "filename">.tar</code>, <code xmlns=
10087: "http://www.w3.org/TR/xhtml1/transitional" class=
10088: "filename">.shar.gz</code>, <code xmlns=
10089: "http://www.w3.org/TR/xhtml1/transitional" class=
10090: "filename">.shar.bz2</code>, <code xmlns=
10091: "http://www.w3.org/TR/xhtml1/transitional" class=
10092: "filename">.shar.Z</code>, <code xmlns=
10093: "http://www.w3.org/TR/xhtml1/transitional" class=
10094: "filename">.shar</code>, <code xmlns=
10095: "http://www.w3.org/TR/xhtml1/transitional" class=
10096: "filename">.Z</code>, <code xmlns=
10097: "http://www.w3.org/TR/xhtml1/transitional" class=
10098: "filename">.bz2</code> and <code xmlns=
10099: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10100: "filename">.gz</code>; see the definition of the
10101: various <code class="varname">DECOMPRESS_CMD</code>
1.45 wiz 10102: variables <code xmlns=
10103: "http://www.w3.org/TR/xhtml1/transitional" class=
10104: "filename">bsd.pkg.mk</code> for a complete list).
10105: Here's an example on how to use the other variables
10106: for a program that comes with a compressed shell
10107: archive whose name ends in <code xmlns=
10108: "http://www.w3.org/TR/xhtml1/transitional" class=
10109: "filename">.msg.gz</code>:</p>
1.1 grant 10110: <pre class="programlisting">
10111: EXTRACT_SUFX= .msg.gz
10112: EXTRACT_CMD= zcat
10113: EXTRACT_BEFORE_ARGS=
10114: EXTRACT_AFTER_ARGS= |sh
10115: </pre>
10116: </dd>
10117:
10118: <dt><span class="term">patch</span></dt>
10119:
10120: <dd>
10121: <p>After extraction, all the patches named by the
1.14 xtraeme 10122: <code class="varname">PATCHFILES</code>, those
10123: present in the patches subdirectory of the package
10124: as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45 wiz 10125: <code xmlns=
10126: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10127: "filename">/usr/local/patches/graphics/png</code>)
1.45 wiz 10128: are applied. Patchfiles ending in <code xmlns=
10129: "http://www.w3.org/TR/xhtml1/transitional" class=
10130: "filename">.Z</code> or <code xmlns=
10131: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10132: "filename">.gz</code> are uncompressed before they
1.45 wiz 10133: are applied, files ending in <code xmlns=
10134: "http://www.w3.org/TR/xhtml1/transitional" class=
10135: "filename">.orig</code> or <code xmlns=
10136: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10137: "filename">.rej</code> are ignored. Any special
1.24 wiz 10138: options to <a href=
10139: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10140: <span class="citerefentry"><span class=
10141: "refentrytitle">patch</span>(1)</span></a> can be
10142: handed in <code class=
1.14 xtraeme 10143: "varname">PATCH_DIST_ARGS</code>. See <a href=
10144: "#components.patches" title=
1.38 dillo 10145: "8.3. patches/*">Section 8.3,
1.1 grant 10146: “patches/*”</a> for more details.</p>
10147:
1.24 wiz 10148: <p>By default <a href=
10149: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10150: <span class="citerefentry"><span class=
10151: "refentrytitle">patch</span>(1)</span></a> is given
10152: special args to make it fail if the patches apply
10153: with some lines of fuzz. Please fix (regen) the
10154: patches so that they apply cleanly. The rationale
10155: behind this is that patches that don't apply
10156: cleanly may end up being applied in the wrong
10157: place, and cause severe harm there.</p>
1.1 grant 10158: </dd>
10159:
10160: <dt><span class="term">configure</span></dt>
10161:
10162: <dd>
10163: <p>Most pieces of software need information on the
10164: header files, system calls, and library routines
10165: which are available in NetBSD. This is the process
10166: known as configuration, and is usually automated.
10167: In most cases, a script is supplied with the
10168: source, and its invocation results in generation of
10169: header files, Makefiles, etc.</p>
10170:
10171: <p>If the program's distfile contains its own
10172: configure script, this can be invoked by setting
1.14 xtraeme 10173: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 10174: configure script is a GNU autoconf script,
1.14 xtraeme 10175: <code class="varname">GNU_CONFIGURE</code> should
10176: be specified instead. In either case, any arguments
10177: to the configure script can be specified in the
10178: <code class="varname">CONFIGURE_ARGS</code>
10179: variable, and the configure script's name can be
10180: set in <code class=
10181: "varname">CONFIGURE_SCRIPT</code> if it differs
10182: from the default “<span class=
1.1 grant 10183: "quote">configure</span>”. Here's an example
10184: from the <a xmlns=
10185: "http://www.w3.org/TR/xhtml1/transitional" href=
10186: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45 wiz 10187: target="_top"><code xmlns="" class=
10188: "filename">sysutils/top</code></a> package:</p>
1.1 grant 10189: <pre class="programlisting">
10190: HAS_CONFIGURE= yes
10191: CONFIGURE_SCRIPT= Configure
10192: CONFIGURE_ARGS+= netbsd13
10193: </pre>
10194:
10195: <p>If the program uses an Imakefile for
10196: configuration, the appropriate steps can be invoked
1.14 xtraeme 10197: by setting <code class="varname">USE_IMAKE</code>
10198: to “<span class="quote">YES</span>”.
10199: (If you only want the package installed in
10200: <code class="varname">$X11PREFIX</code> but xmkmf
10201: not being run, set <code class=
10202: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 10203: </dd>
10204:
10205: <dt><span class="term">build</span></dt>
10206:
10207: <dd>
10208: <p>Once configuration has taken place, the software
1.14 xtraeme 10209: will be built by invoking <code class=
10210: "varname">$MAKE_PROGRAM</code> on <code class=
10211: "varname">$MAKEFILE</code> with <code class=
10212: "varname">$BUILD_TARGET</code> as the target to
10213: build. The default <code class=
10214: "varname">MAKE_PROGRAM</code> is
10215: “<span class="quote">gmake</span>” if
1.29 rillig 10216: <code class="varname">USE_TOOLS</code> contains
10217: “<span class="quote">gmake</span>”,
1.1 grant 10218: “<span class="quote">make</span>”
1.14 xtraeme 10219: otherwise. <code class="varname">MAKEFILE</code> is
10220: set to “<span class=
1.1 grant 10221: "quote">Makefile</span>” by default, and
1.14 xtraeme 10222: <code class="varname">BUILD_TARGET</code> defaults
10223: to “<span class="quote">all</span>”.
10224: Any of these variables can be set in the package's
1.1 grant 10225: Makefile to change the default build process.</p>
10226: </dd>
10227:
10228: <dt><span class="term">install</span></dt>
10229:
10230: <dd>
10231: <p>Once the build stage has completed, the final
10232: step is to install the software in public
10233: directories, so users can access the programs and
1.14 xtraeme 10234: files. As in the build-target, <code class=
10235: "varname">$MAKE_PROGRAM</code> is invoked on
10236: <code class="varname">$MAKEFILE</code> here, but
10237: with the <code class=
10238: "varname">$INSTALL_TARGET</code> instead, the
10239: latter defaulting to “<span class=
10240: "quote">install</span>” (plus
10241: “<span class=
10242: "quote">install.man</span>”, if <code class=
10243: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 10244: </dd>
10245: </dl>
10246: </div>
10247:
10248: <p>If no target is specified, the default is
10249: “<span class="quote">build</span>”. If a
10250: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 10251: e.g. <span><strong class="command">make
10252: build</strong></span> will also perform the equivalent
10253: of:</p>
1.1 grant 10254: <pre class="programlisting">
10255: make fetch
10256: make checksum
10257: make extract
10258: make patch
10259: make configure
10260: make build
10261: </pre>
10262: </div>
10263:
10264: <div class="sect1" lang="en" xml:lang="en">
10265: <div class="titlepage">
10266: <div>
10267: <div>
10268: <h2 class="title" style="clear: both"><a name=
10269: "build.helpful-targets" id=
1.38 dillo 10270: "build.helpful-targets"></a>14.3. Other
1.1 grant 10271: helpful targets</h2>
10272: </div>
10273: </div>
10274: </div>
10275:
10276: <div class="variablelist">
10277: <dl>
10278: <dt><span class="term">pre/post-*</span></dt>
10279:
10280: <dd>
10281: <p>For any of the main targets described in the
10282: previous section, two auxiliary targets exist with
10283: “<span class="quote">pre-</span>” and
10284: “<span class="quote">post-</span>” used
10285: as a prefix for the main target's name. These
10286: targets are invoked before and after the main
10287: target is called, allowing extra configuration or
10288: installation steps be performed from a package's
10289: Makefile, for example, which a program's configure
10290: script or install target omitted.</p>
10291: </dd>
10292:
10293: <dt><span class="term">do-*</span></dt>
10294:
10295: <dd>
10296: <p>Should one of the main targets do the wrong
10297: thing, and should there be no variable to fix this,
10298: you can redefine it with the do-* target. (Note
10299: that redefining the target itself instead of the
10300: do-* target is a bad idea, as the pre-* and post-*
10301: targets won't be called anymore, etc.) You will not
10302: usually need to do this.</p>
10303: </dd>
10304:
10305: <dt><span class="term">reinstall</span></dt>
10306:
10307: <dd>
1.14 xtraeme 10308: <p>If you did a <span><strong class="command">make
10309: install</strong></span> and you noticed some file
10310: was not installed properly, you can repeat the
1.1 grant 10311: installation with this target, which will ignore
10312: the “<span class="quote">already
10313: installed</span>” flag.</p>
10314: </dd>
10315:
10316: <dt><span class="term">deinstall</span></dt>
10317:
10318: <dd>
1.24 wiz 10319: <p>This target does a <a href=
10320: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10321: <span class="citerefentry"><span class=
10322: "refentrytitle">pkg_delete</span>(1)</span></a> in
10323: the current directory, effectively de-installing
10324: the package. The following variables can be used to
10325: tune the behaviour:</p>
1.1 grant 10326:
10327: <div class="variablelist">
10328: <dl>
1.14 xtraeme 10329: <dt><span class="term"><code class=
10330: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10331:
10332: <dd>
10333: <p>Add a "-v" to the <a href=
10334: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10335: <span class="citerefentry"><span class=
10336: "refentrytitle">pkg_delete</span>(1)</span></a>
10337: command.</p>
10338: </dd>
10339:
1.14 xtraeme 10340: <dt><span class="term"><code class=
10341: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10342:
10343: <dd>
10344: <p>Remove all packages that require (depend
10345: on) the given package. This can be used to
10346: remove any packages that may have been pulled
10347: in by a given package, e.g. if
1.14 xtraeme 10348: <span><strong class="command">make deinstall
10349: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10350: <code xmlns=
10351: "http://www.w3.org/TR/xhtml1/transitional"
10352: class="filename">pkgsrc/x11/kde</code>, this
10353: is likely to remove whole KDE. Works by
1.1 grant 10354: adding “<span class=
10355: "quote">-R</span>” to the <a href=
10356: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10357: <span class="citerefentry"><span class=
10358: "refentrytitle">pkg_delete</span>(1)</span></a>
10359: command line.</p>
10360: </dd>
10361: </dl>
10362: </div>
10363: </dd>
10364:
10365: <dt><span class="term">update</span></dt>
10366:
10367: <dd>
10368: <p>This target causes the current package to be
10369: updated to the latest version. The package and all
10370: depending packages first get de-installed, then
10371: current versions of the corresponding packages get
10372: compiled and installed. This is similar to manually
10373: noting which packages are currently installed, then
1.14 xtraeme 10374: performing a series of <span><strong class=
10375: "command">make deinstall</strong></span> and
10376: <span><strong class="command">make
10377: install</strong></span> (or whatever <code class=
10378: "varname">UPDATE_TARGET</code> is set to) for these
10379: packages.</p>
1.1 grant 10380:
10381: <p>You can use the “<span class=
10382: "quote">update</span>” target to resume
1.14 xtraeme 10383: package updating in case a previous
10384: <span><strong class="command">make
10385: update</strong></span> was interrupted for some
10386: reason. However, in this case, make sure you don't
10387: call <span><strong class="command">make
10388: clean</strong></span> or otherwise remove the list
10389: of dependent packages in <code class=
10390: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 10391: ability to automatically update the current package
10392: along with the dependent packages you have
10393: installed.</p>
10394:
1.14 xtraeme 10395: <p>Resuming an interrupted <span><strong class=
10396: "command">make update</strong></span> will only
10397: work as long as the package tree remains unchanged.
10398: If the source code for one of the packages to be
10399: updated has been changed, resuming
10400: <span><strong class="command">make
10401: update</strong></span> will most certainly
10402: fail!</p>
1.1 grant 10403:
10404: <p>The following variables can be used either on
1.45 wiz 10405: the command line or in <code xmlns=
10406: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10407: "filename">/etc/mk.conf</code> to alter the
10408: behaviour of <span><strong class="command">make
10409: update</strong></span>:</p>
1.1 grant 10410:
10411: <div class="variablelist">
10412: <dl>
1.14 xtraeme 10413: <dt><span class="term"><code class=
10414: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10415:
10416: <dd>
10417: <p>Install target to recursively use for the
10418: updated package and the dependent packages.
1.14 xtraeme 10419: Defaults to <code class=
10420: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10421: “<span class=
10422: "quote">install</span>” otherwise for
1.14 xtraeme 10423: <span><strong class="command">make
10424: update</strong></span>. e.g.
10425: <span><strong class="command">make update
10426: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10427: </dd>
10428:
1.14 xtraeme 10429: <dt><span class="term"><code class=
10430: "varname">NOCLEAN</code></span></dt>
1.1 grant 10431:
10432: <dd>
10433: <p>Don't clean up after updating. Useful if
10434: you want to leave the work sources of the
10435: updated packages around for inspection or
10436: other purposes. Be sure you eventually clean
10437: up the source tree (see the
10438: “<span class=
10439: "quote">clean-update</span>” target
10440: below) or you may run into troubles with old
10441: source code still lying around on your next
1.14 xtraeme 10442: <span><strong class=
10443: "command">make</strong></span> or
10444: <span><strong class="command">make
10445: update</strong></span>.</p>
1.1 grant 10446: </dd>
10447:
1.14 xtraeme 10448: <dt><span class="term"><code class=
10449: "varname">REINSTALL</code></span></dt>
1.1 grant 10450:
10451: <dd>
10452: <p>Deinstall each package before installing
1.14 xtraeme 10453: (making <code class=
10454: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10455: necessary if the “<span class=
10456: "quote">clean-update</span>” target
10457: (see below) was called after interrupting a
1.14 xtraeme 10458: running <span><strong class="command">make
10459: update</strong></span>.</p>
1.1 grant 10460: </dd>
10461:
1.14 xtraeme 10462: <dt><span class="term"><code class=
10463: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10464:
10465: <dd>
10466: <p>Allows you to disable recursion and
10467: hardcode the target for packages. The default
10468: is “<span class=
10469: "quote">update</span>” for the update
10470: target, facilitating a recursive update of
1.14 xtraeme 10471: prerequisite packages. Only set <code class=
10472: "varname">DEPENDS_TARGET</code> if you want
10473: to disable recursive updates. Use
10474: <code class="varname">UPDATE_TARGET</code>
10475: instead to just set a specific target for
10476: each package to be installed during
10477: <span><strong class="command">make
10478: update</strong></span> (see above).</p>
1.1 grant 10479: </dd>
10480: </dl>
10481: </div>
10482: </dd>
10483:
10484: <dt><span class="term">clean-update</span></dt>
10485:
10486: <dd>
10487: <p>Clean the source tree for all packages that
1.14 xtraeme 10488: would get updated if <span><strong class=
10489: "command">make update</strong></span> was called
10490: from the current directory. This target should not
10491: be used if the current package (or any of its
10492: depending packages) have already been de-installed
10493: (e.g., after calling <span><strong class=
10494: "command">make update</strong></span>) or you may
10495: lose some packages you intended to update. As a
10496: rule of thumb: only use this target <span class=
10497: "emphasis"><em>before</em></span> the first time
10498: you run <span><strong class="command">make
10499: update</strong></span> and only if you have a dirty
10500: package tree (e.g., if you used <code class=
10501: "varname">NOCLEAN</code>).</p>
1.1 grant 10502:
10503: <p>If you unsure about whether your tree is clean
1.14 xtraeme 10504: you can either perform a <span><strong class=
10505: "command">make clean</strong></span> at the top of
10506: the tree, or use the following sequence of commands
1.1 grant 10507: from the directory of the package you want to
10508: update (<span class=
10509: "emphasis"><em>before</em></span> running
1.14 xtraeme 10510: <span><strong class="command">make
10511: update</strong></span> for the first time,
10512: otherwise you lose all the packages you wanted to
10513: update!):</p>
1.1 grant 10514: <pre class="screen">
1.14 xtraeme 10515: <code class="prompt">#</code> <strong class=
10516: "userinput"><code>make clean-update</code></strong>
10517: <code class="prompt">#</code> <strong class=
10518: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
10519: <code class="prompt">#</code> <strong class=
10520: "userinput"><code>make update</code></strong>
1.1 grant 10521: </pre>
10522:
10523: <p>The following variables can be used either on
1.45 wiz 10524: the command line or in <code xmlns=
10525: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10526: "filename">/etc/mk.conf</code> to alter the
10527: behaviour of <span><strong class="command">make
10528: clean-update</strong></span>:</p>
1.1 grant 10529:
10530: <div class="variablelist">
10531: <dl>
1.14 xtraeme 10532: <dt><span class="term"><code class=
10533: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 10534:
10535: <dd>
1.14 xtraeme 10536: <p>After <span><strong class="command">make
10537: clean</strong></span>, do not reconstruct the
10538: list of directories to update for this
10539: package. Only use this if
10540: <span><strong class="command">make
10541: update</strong></span> successfully installed
10542: all packages you wanted to update. Normally,
10543: this is done automatically on
10544: <span><strong class="command">make
10545: update</strong></span>, but may have been
10546: suppressed by the <code class=
10547: "varname">NOCLEAN</code> variable (see
1.1 grant 10548: above).</p>
10549: </dd>
10550: </dl>
10551: </div>
10552: </dd>
10553:
10554: <dt><span class="term">info</span></dt>
10555:
10556: <dd>
10557: <p>This target invokes <a href=
10558: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10559: <span class="citerefentry"><span class=
10560: "refentrytitle">pkg_info</span>(1)</span></a> for
10561: the current package. You can use this to check
10562: which version of a package is installed.</p>
10563: </dd>
10564:
10565: <dt><span class="term">readme</span></dt>
10566:
10567: <dd>
1.45 wiz 10568: <p>This target generates a <code xmlns=
10569: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10570: "filename">README.html</code> file, which can be
1.1 grant 10571: viewed using a browser such as <a xmlns=
10572: "http://www.w3.org/TR/xhtml1/transitional" href=
10573: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 10574: target="_top"><code xmlns="" class=
10575: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 10576: "http://www.w3.org/TR/xhtml1/transitional" href=
10577: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 10578: target="_top"><code xmlns="" class=
10579: "filename">www/links</code></a>. The generated
10580: files contain references to any packages which are
10581: in the <code class="varname">PACKAGES</code>
10582: directory on the local host. The generated files
10583: can be made to refer to URLs based on <code class=
1.20 ben 10584: "varname">FTP_PKG_URL_HOST</code> and <code class=
10585: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 10586: wanted to generate <code xmlns=
10587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10588: "filename">README.html</code> files which pointed
10589: to binary packages on the local machine, in the
1.45 wiz 10590: directory <code xmlns=
10591: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10592: "filename">/usr/packages</code>, set <code class=
10593: "varname">FTP_PKG_URL_HOST=file://localhost</code>
10594: and <code class=
10595: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
10596: <code class="varname">${PACKAGES}</code> directory
10597: and its subdirectories will be searched for all the
10598: binary packages.</p>
1.1 grant 10599: </dd>
10600:
10601: <dt><span class="term">readme-all</span></dt>
10602:
10603: <dd>
1.45 wiz 10604: <p>Use this target to create a file <code xmlns=
10605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10606: "filename">README-all.html</code> which contains a
1.1 grant 10607: list of all packages currently available in the
10608: NetBSD Packages Collection, together with the
10609: category they belong to and a short description.
1.45 wiz 10610: This file is compiled from the <code xmlns=
10611: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10612: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 10613: sure to run this <span class=
1.14 xtraeme 10614: "emphasis"><em>after</em></span> a
10615: <span><strong class="command">make
10616: readme</strong></span>.</p>
1.1 grant 10617: </dd>
10618:
10619: <dt><span class="term">cdrom-readme</span></dt>
10620:
10621: <dd>
10622: <p>This is very much the same as the
10623: “<span class="quote">readme</span>”
10624: target (see above), but is to be used when
10625: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 10626: This target also produces <code xmlns=
10627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10628: "filename">README.html</code> files, and can be
10629: made to refer to URLs based on <code class=
10630: "varname">CDROM_PKG_URL_HOST</code> and
10631: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 10632: </dd>
10633:
10634: <dt><span class="term">show-distfiles</span></dt>
10635:
10636: <dd>
10637: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 10638: are needed to build the package. (<code class=
10639: "varname">DISTFILES</code> and <code class=
1.45 wiz 10640: "varname">PATCHFILES</code>, but not <code xmlns=
10641: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10642: "filename">patches/*</code>)</p>
1.1 grant 10643: </dd>
10644:
10645: <dt><span class="term">show-downlevel</span></dt>
10646:
10647: <dd>
10648: <p>This target shows nothing if the package is not
10649: installed. If a version of this package is
10650: installed, but is not the version provided in this
10651: version of pkgsrc, then a warning message is
10652: displayed. This target can be used to show which of
10653: your installed packages are downlevel, and so the
10654: old versions can be deleted, and the current ones
10655: added.</p>
10656: </dd>
10657:
10658: <dt><span class="term">show-pkgsrc-dir</span></dt>
10659:
10660: <dd>
10661: <p>This target shows the directory in the pkgsrc
10662: hierarchy from which the package can be built and
10663: installed. This may not be the same directory as
10664: the one from which the package was installed. This
10665: target is intended to be used by people who may
10666: wish to upgrade many packages on a single host, and
10667: can be invoked from the top-level pkgsrc Makefile
10668: by using the “<span class=
10669: "quote">show-host-specific-pkgs</span>”
10670: target.</p>
10671: </dd>
10672:
10673: <dt><span class=
10674: "term">show-installed-depends</span></dt>
10675:
10676: <dd>
10677: <p>This target shows which installed packages match
1.14 xtraeme 10678: the current package's <code class=
10679: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 10680: dependencies are causing build problems.</p>
10681: </dd>
10682:
10683: <dt><span class="term">check-shlibs</span></dt>
10684:
10685: <dd>
10686: <p>After a package is installed, check all its
10687: binaries and (on ELF platforms) shared libraries to
10688: see if they find the shared libs they need. Run by
1.14 xtraeme 10689: default if <code class=
10690: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 10691: <code xmlns=
10692: "http://www.w3.org/TR/xhtml1/transitional" class=
10693: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10694: </dd>
10695:
10696: <dt><span class="term">print-PLIST</span></dt>
10697:
10698: <dd>
10699: <p>After a “<span class="quote">make
10700: install</span>” from a new or upgraded pkg,
10701: this prints out an attempt to generate a new
1.45 wiz 10702: <code xmlns=
10703: "http://www.w3.org/TR/xhtml1/transitional" class=
10704: "filename">PLIST</code> from a <span><strong class=
10705: "command">find -newer
1.14 xtraeme 10706: work/.extract_done</strong></span>. An attempt is
10707: made to care for shared libs etc., but it is
1.1 grant 10708: <span class="emphasis"><em>strongly</em></span>
10709: recommended to review the result before putting it
1.45 wiz 10710: into <code xmlns=
10711: "http://www.w3.org/TR/xhtml1/transitional" class=
10712: "filename">PLIST</code>. On upgrades, it's useful
10713: to diff the output of this command against an
10714: already existing <code xmlns=
10715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10716: "filename">PLIST</code> file.</p>
1.1 grant 10717:
1.24 wiz 10718: <p>If the package installs files via <a href=
10719: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
10720: <span class="citerefentry"><span class=
10721: "refentrytitle">tar</span>(1)</span></a> or other
10722: methods that don't update file access times, be
10723: sure to add these files manually to your
1.45 wiz 10724: <code xmlns=
10725: "http://www.w3.org/TR/xhtml1/transitional" class=
10726: "filename">PLIST</code>, as the “<span class=
10727: "quote">find -newer</span>” command used by
10728: this target won't catch them!</p>
1.1 grant 10729:
10730: <p>See <a href="#print-PLIST" title=
1.38 dillo 10731: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 10732: “Tweaking output of <span><strong class=
10733: "command">make
10734: print-PLIST</strong></span>”</a> for more
10735: information on this target.</p>
1.1 grant 10736: </dd>
10737:
10738: <dt><span class="term">bulk-package</span></dt>
10739:
10740: <dd>
10741: <p>Used to do bulk builds. If an appropriate binary
10742: package already exists, no action is taken. If not,
10743: this target will compile, install and package it
1.14 xtraeme 10744: (and it's depends, if <code class=
10745: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 10746: <a href="#binary.configuration" title=
1.38 dillo 10747: "6.3.1. Configuration">Section 6.3.1,
1.1 grant 10748: “Configuration”</a>. After creating the
10749: binary package, the sources, the just-installed
10750: package and it's required packages are removed,
10751: preserving free disk space.</p>
10752:
10753: <p><span class="emphasis"><em>Beware that this
10754: target may deinstall all packages installed on a
10755: system!</em></span></p>
10756: </dd>
10757:
10758: <dt><span class="term">bulk-install</span></dt>
10759:
10760: <dd>
10761: <p>Used during bulk-installs to install required
10762: packages. If an upto-date binary package is
10763: available, it will be installed via <a href=
10764: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10765: <span class="citerefentry"><span class=
10766: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 10767: not, <span><strong class="command">make
10768: bulk-package</strong></span> will be executed, but
10769: the installed binary not be removed.</p>
1.1 grant 10770:
10771: <p>A binary package is considered
10772: “<span class="quote">upto-date</span>”
10773: to be installed via <a href=
10774: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10775: <span class="citerefentry"><span class=
10776: "refentrytitle">pkg_add</span>(1)</span></a>
10777: if:</p>
10778:
10779: <div class="itemizedlist">
10780: <ul type="disc">
10781: <li>
1.45 wiz 10782: <p>None of the package's files (<code xmlns=
10783: "http://www.w3.org/TR/xhtml1/transitional"
10784: class="filename">Makefile</code>, ...) were
1.14 xtraeme 10785: modified since it was built.</p>
1.1 grant 10786: </li>
10787:
10788: <li>
10789: <p>None of the package's required (binary)
10790: packages were modified since it was
10791: built.</p>
10792: </li>
10793: </ul>
10794: </div>
10795:
10796: <p><span class="emphasis"><em>Beware that this
10797: target may deinstall all packages installed on a
10798: system!</em></span></p>
10799: </dd>
10800: </dl>
10801: </div>
10802: </div>
10803: </div>
10804:
10805: <div class="chapter" lang="en" xml:lang="en">
10806: <div class="titlepage">
10807: <div>
10808: <div>
10809: <h2 class="title"><a name="fixes" id=
1.38 dillo 10810: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 10811: packages</h2>
10812: </div>
10813: </div>
10814: </div>
10815:
10816: <div class="toc">
10817: <p><b>Table of Contents</b></p>
10818:
10819: <dl>
1.30 wiz 10820: <dt><span class="sect1"><a href=
1.38 dillo 10821: "#general-operation">15.1. General
1.30 wiz 10822: operation</a></span></dt>
1.1 grant 10823:
10824: <dd>
10825: <dl>
10826: <dt><span class="sect2"><a href=
1.38 dillo 10827: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 10828: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 10829:
10830: <dt><span class="sect2"><a href=
1.38 dillo 10831: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 10832: install documentation</a></span></dt>
10833:
10834: <dt><span class="sect2"><a href=
1.38 dillo 10835: "#restricted-packages">15.1.3. Restricted
1.1 grant 10836: packages</a></span></dt>
10837:
10838: <dt><span class="sect2"><a href=
1.38 dillo 10839: "#dependencies">15.1.4. Handling
1.1 grant 10840: dependencies</a></span></dt>
10841:
10842: <dt><span class="sect2"><a href=
1.38 dillo 10843: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 10844: packages</a></span></dt>
10845:
10846: <dt><span class="sect2"><a href=
1.38 dillo 10847: "#not-building-packages">15.1.6. Packages that
1.30 wiz 10848: cannot or should not be built</a></span></dt>
1.1 grant 10849:
10850: <dt><span class="sect2"><a href=
1.38 dillo 10851: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 10852: should not be deleted, once
10853: installed</a></span></dt>
1.1 grant 10854:
10855: <dt><span class="sect2"><a href=
1.38 dillo 10856: "#security-handling">15.1.8. Handling packages with
1.1 grant 10857: security problems</a></span></dt>
10858:
10859: <dt><span class="sect2"><a href=
1.38 dillo 10860: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 10861: bugs</a></span></dt>
10862:
10863: <dt><span class="sect2"><a href=
1.38 dillo 10864: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10865: incrementing versions when fixing an existing
1.1 grant 10866: package</a></span></dt>
10867:
10868: <dt><span class="sect2"><a href=
1.38 dillo 10869: "#portability-of-packages">15.1.11. Portability of
1.1 grant 10870: packages</a></span></dt>
10871: </dl>
10872: </dd>
10873:
1.30 wiz 10874: <dt><span class="sect1"><a href=
1.38 dillo 10875: "#downloading-issues">15.2. Possible downloading
1.30 wiz 10876: issues</a></span></dt>
1.1 grant 10877:
10878: <dd>
10879: <dl>
10880: <dt><span class="sect2"><a href=
1.38 dillo 10881: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 10882: distfiles aren't available for plain
1.1 grant 10883: downloading</a></span></dt>
10884:
10885: <dt><span class="sect2"><a href=
1.38 dillo 10886: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 10887: handle modified distfiles with the 'old'
10888: name</a></span></dt>
1.1 grant 10889: </dl>
10890: </dd>
10891:
1.30 wiz 10892: <dt><span class="sect1"><a href=
1.38 dillo 10893: "#configuration-gotchas">15.3. Configuration
1.30 wiz 10894: gotchas</a></span></dt>
1.1 grant 10895:
10896: <dd>
10897: <dl>
10898: <dt><span class="sect2"><a href=
1.38 dillo 10899: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 10900: libtool</a></span></dt>
10901:
10902: <dt><span class="sect2"><a href=
1.38 dillo 10903: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 10904: packages that already support
10905: libtool</a></span></dt>
1.1 grant 10906:
10907: <dt><span class="sect2"><a href=
1.38 dillo 10908: "#autoconf-automake">15.3.3. GNU
1.1 grant 10909: Autoconf/Automake</a></span></dt>
10910: </dl>
10911: </dd>
10912:
1.30 wiz 10913: <dt><span class="sect1"><a href=
1.38 dillo 10914: "#building-considerations">15.4. Building
1.30 wiz 10915: considerations</a></span></dt>
1.1 grant 10916:
10917: <dd>
10918: <dl>
10919: <dt><span class="sect2"><a href=
1.38 dillo 10920: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1 grant 10921: </dl>
10922: </dd>
10923:
1.30 wiz 10924: <dt><span class="sect1"><a href=
1.38 dillo 10925: "#package-specific-actions">15.5. Package specific
1.30 wiz 10926: actions</a></span></dt>
1.1 grant 10927:
10928: <dd>
10929: <dl>
10930: <dt><span class="sect2"><a href=
1.38 dillo 10931: "#user-interaction">15.5.1. User
1.2 hubertf 10932: interaction</a></span></dt>
1.1 grant 10933:
10934: <dt><span class="sect2"><a href=
1.38 dillo 10935: "#handling-licenses">15.5.2. Handling
1.1 grant 10936: licenses</a></span></dt>
10937:
10938: <dt><span class="sect2"><a href=
1.38 dillo 10939: "#installing-score-files">15.5.3. Installing score
1.1 grant 10940: files</a></span></dt>
10941:
10942: <dt><span class="sect2"><a href=
1.38 dillo 10943: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 10944: scripts</a></span></dt>
10945:
10946: <dt><span class="sect2"><a href=
1.38 dillo 10947: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 10948: paths to other interpreters</a></span></dt>
1.1 grant 10949:
10950: <dt><span class="sect2"><a href=
1.38 dillo 10951: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 10952: modules</a></span></dt>
10953:
10954: <dt><span class="sect2"><a href=
1.38 dillo 10955: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 10956: files</a></span></dt>
10957:
10958: <dt><span class="sect2"><a href=
1.38 dillo 10959: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 10960: GConf2 data files</a></span></dt>
1.1 grant 10961:
10962: <dt><span class="sect2"><a href=
1.38 dillo 10963: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 10964: installing scrollkeeper data files</a></span></dt>
1.1 grant 10965:
10966: <dt><span class="sect2"><a href=
1.38 dillo 10967: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 10968: fonts</a></span></dt>
10969:
10970: <dt><span class="sect2"><a href=
1.38 dillo 10971: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 10972: modules</a></span></dt>
10973:
10974: <dt><span class="sect2"><a href=
1.38 dillo 10975: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 10976: or XML data</a></span></dt>
1.1 grant 10977:
10978: <dt><span class="sect2"><a href=
1.38 dillo 10979: "#mime-database">15.5.13. Packages installing
1.1 grant 10980: extensions to the MIME database</a></span></dt>
10981:
10982: <dt><span class="sect2"><a href=
1.38 dillo 10983: "#intltool">15.5.14. Packages using
1.1 grant 10984: intltool</a></span></dt>
1.18 xtraeme 10985:
10986: <dt><span class="sect2"><a href=
1.38 dillo 10987: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 10988: startup scripts</a></span></dt>
1.1 grant 10989: </dl>
10990: </dd>
10991:
1.30 wiz 10992: <dt><span class="sect1"><a href=
1.38 dillo 10993: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 10994: author</a></span></dt>
1.1 grant 10995: </dl>
10996: </div>
10997:
10998: <div class="sect1" lang="en" xml:lang="en">
10999: <div class="titlepage">
11000: <div>
11001: <div>
11002: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11003: "general-operation" id=
1.38 dillo 11004: "general-operation"></a>15.1. General
1.1 grant 11005: operation</h2>
11006: </div>
11007: </div>
11008: </div>
11009:
11010: <div class="sect2" lang="en" xml:lang="en">
11011: <div class="titlepage">
11012: <div>
11013: <div>
1.30 wiz 11014: <h3 class="title"><a name=
11015: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11016: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11017: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11018: </div>
11019: </div>
11020: </div>
11021:
11022: <p>The problem with package-defined variables that can
1.14 xtraeme 11023: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11024: or <code xmlns=
11025: "http://www.w3.org/TR/xhtml1/transitional" class=
11026: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11027: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11028: <span class="citerefentry"><span class=
11029: "refentrytitle">make</span>(1)</span></a> expands a
11030: variable as it is used, but evaluates preprocessor like
11031: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11032: So, to use any variable (which may be set in
1.45 wiz 11033: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11034: class="filename">/etc/mk.conf</code>) in one of the
11035: .if* statements, the file <code xmlns=
11036: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11037: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11038: that .if* statement.</p>
11039:
11040: <p>Rather than have a number of ad-hoc ways of
1.45 wiz 11041: including <code xmlns=
11042: "http://www.w3.org/TR/xhtml1/transitional" class=
11043: "filename">/etc/mk.conf</code>, should it exist, or
11044: <code class="varname">MAKECONF</code>, should it exist,
11045: include the <code xmlns=
11046: "http://www.w3.org/TR/xhtml1/transitional" class=
11047: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11048: package Makefile before any preprocessor-like .if,
11049: .ifdef, or .ifndef statements:</p>
1.1 grant 11050: <pre class="programlisting">
11051: .include "../../mk/bsd.prefs.mk"
11052:
11053: .if defined(USE_MENUS)
11054: ...
11055: .endif
11056: </pre>
11057:
1.14 xtraeme 11058: <p>If you wish to set the <code class=
1.45 wiz 11059: "varname">CFLAGS</code> variable in <code xmlns=
11060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11061: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 11062: use:</p>
11063: <pre class="programlisting">
11064: CFLAGS+= -your -flags
11065: </pre>
11066:
1.14 xtraeme 11067: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11068: without the “<span class="quote">+</span>”)
11069: may lead to problems with packages that need to add
11070: their own flags. Also, you may want to take a look at
11071: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11072: href=
11073: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11074: target="_top"><code xmlns="" class=
11075: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11076: interested in optimization for the current CPU.</p>
1.1 grant 11077: </div>
11078:
11079: <div class="sect2" lang="en" xml:lang="en">
11080: <div class="titlepage">
11081: <div>
11082: <div>
1.31 wiz 11083: <h3 class="title"><a name=
11084: "where-to-install-documentation" id=
1.38 dillo 11085: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11086: to install documentation</h3>
11087: </div>
11088: </div>
11089: </div>
11090:
1.45 wiz 11091: <p>Documentation should be installed into <code xmlns=
11092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11093: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11094: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11095: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11096: (the latter includes the version number of the
11097: package).</p>
1.31 wiz 11098: </div>
11099:
11100: <div class="sect2" lang="en" xml:lang="en">
11101: <div class="titlepage">
11102: <div>
11103: <div>
1.30 wiz 11104: <h3 class="title"><a name="restricted-packages"
11105: id=
1.38 dillo 11106: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11107: packages</h3>
11108: </div>
11109: </div>
11110: </div>
11111:
11112: <p>Some licenses restrict how software may be
11113: re-distributed. In order to satisfy these restrictions,
11114: the package system defines five make variables that can
11115: be set to note these restrictions:</p>
11116:
11117: <div class="itemizedlist">
11118: <ul type="disc">
11119: <li>
1.14 xtraeme 11120: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11121:
11122: <p>This variable should be set whenever a
11123: restriction exists (regardless of its kind). Set
11124: this variable to a string containing the reason
11125: for the restriction.</p>
11126: </li>
11127:
11128: <li>
1.14 xtraeme 11129: <p><code class=
11130: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11131:
11132: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11133: variable to <code class=
11134: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11135: package may not be included on a CD-ROM.</p>
11136: </li>
11137:
11138: <li>
1.14 xtraeme 11139: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11140:
11141: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11142: Set this variable to <code class=
11143: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11144: package may not not be made available on the
11145: Internet.</p>
11146: </li>
11147:
11148: <li>
1.14 xtraeme 11149: <p><code class=
11150: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11151:
11152: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11153: this variable to <code class=
11154: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11155: of the source code or other distfile(s) is not
11156: allowed on CD-ROMs.</p>
11157: </li>
11158:
11159: <li>
1.14 xtraeme 11160: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11161:
11162: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11163: variable to <code class=
11164: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11165: of the source code or other distfile(s) via the
11166: Internet is not allowed.</p>
11167: </li>
11168: </ul>
11169: </div>
11170:
1.14 xtraeme 11171: <p>Please note that the use of <code class=
11172: "varname">NO_PACKAGE</code>, <code class=
11173: "varname">IGNORE</code>, <code class=
11174: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11175: variables to denote restrictions is deprecated, because
11176: they unconditionally prevent users from generating
11177: binary packages!</p>
11178: </div>
11179:
11180: <div class="sect2" lang="en" xml:lang="en">
11181: <div class="titlepage">
11182: <div>
11183: <div>
11184: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11185: "dependencies"></a>15.1.4. Handling
1.1 grant 11186: dependencies</h3>
11187: </div>
11188: </div>
11189: </div>
11190:
11191: <p>Your package may depend on some other package being
11192: present - and there are various ways of expressing this
1.14 xtraeme 11193: dependency. pkgsrc supports the <code class=
11194: "varname">BUILD_DEPENDS</code> and <code class=
11195: "varname">DEPENDS</code> definitions, as well as
1.45 wiz 11196: dependencies via <code xmlns=
11197: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11198: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11199: way to handle dependencies, and which uses the
11200: variables named above. See <a href="#buildlink" title=
1.38 dillo 11201: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11202: <i>Buildlink methodology</i></a> for more
11203: information.</p>
11204:
11205: <p>The basic difference between the two variables is as
1.14 xtraeme 11206: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11207: definition registers that pre-requisite in the binary
11208: package so it will be pulled in when the binary package
1.14 xtraeme 11209: is later installed, whilst the <code class=
11210: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11211: marking a dependency that is only needed for building
11212: the package.</p>
11213:
11214: <p>This means that if you only need a package present
11215: whilst you are building, it should be noted as a
1.14 xtraeme 11216: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11217:
1.14 xtraeme 11218: <p>The format for a <code class=
11219: "varname">BUILD_DEPENDS</code> and a <code class=
11220: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11221: <pre class="programlisting">
11222: <pre-req-package-name>:../../<category>/<pre-req-package>
11223: </pre>
11224:
11225: <p>Please note that the “<span class=
11226: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11227: any of the wildcard version numbers recognized by
1.1 grant 11228: <a href=
11229: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11230: <span class="citerefentry"><span class=
11231: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11232:
11233: <div class="orderedlist">
11234: <ol type="1">
11235: <li>
11236: <p>If your package needs another package's
11237: binaries or libraries to build or run, and if
1.45 wiz 11238: that package has a <code xmlns=
11239: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11240: "filename">buildlink3.mk</code> file available,
11241: use it:</p>
1.1 grant 11242: <pre class="programlisting">
11243: .include "../../graphics/jpeg/buildlink3.mk"
11244:
11245: </pre>
11246: </li>
11247:
11248: <li>
11249: <p>If your package needs to use another package
1.45 wiz 11250: to build itself and there is no <code xmlns=
11251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11252: "filename">buildlink3.mk</code> file available,
11253: use the <code class=
11254: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11255: <pre class="programlisting">
11256: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
11257: </pre>
11258: </li>
11259:
11260: <li>
11261: <p>If your package needs a library with which to
1.45 wiz 11262: link and again there is no <code xmlns=
11263: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11264: "filename">buildlink3.mk</code> file available,
11265: this is specified using the <code class=
11266: "varname">DEPENDS</code> definition. An example
11267: of this is the <a xmlns=
1.1 grant 11268: "http://www.w3.org/TR/xhtml1/transitional" href=
11269: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11270: target="_top"><code xmlns="" class=
11271: "filename">print/lyx</code></a> package, which
11272: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11273: <pre class="programlisting">
11274: DEPENDS+= xpm-3.4j:../../graphics/xpm
11275: </pre>
11276:
11277: <p>You can also use wildcards in package
11278: dependences:</p>
11279: <pre class="programlisting">
11280: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
11281: </pre>
11282:
11283: <p>Note that such wildcard dependencies are
11284: retained when creating binary packages. The
11285: dependency is checked when installing the binary
11286: package and any package which matches the pattern
11287: will be used. Wildcard dependencies should be
11288: used with care.</p>
11289:
11290: <p>The “<span class=
11291: "quote">-[0-9]*</span>” should be used
11292: instead of “<span class=
11293: "quote">-*</span>” to avoid potentially
11294: ambiguous matches such as “<span class=
11295: "quote">tk-postgresql</span>” matching a
11296: “<span class="quote">tk-*</span>”
1.14 xtraeme 11297: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11298:
11299: <p>Wildcards can also be used to specify that a
11300: package will only build against a certain minimum
11301: version of a pre-requisite:</p>
11302: <pre class="programlisting">
11303: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
11304: </pre>
11305:
11306: <p>This means that the package will build against
11307: version 3.5.4 of the tiff library or newer. Such
11308: a dependency may be warranted if, for example,
11309: the API of the library has changed with version
11310: 3.5.4 and a package would not compile against an
11311: earlier version of tiff.</p>
11312:
11313: <p>Please note that such dependencies should only
11314: be updated if a package requires a newer
11315: pre-requisite, but not to denote recommendations
11316: such as security updates or ABI changes that do
11317: not prevent a package from building correctly.
11318: Such recommendations can be expressed using
1.14 xtraeme 11319: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11320: <pre class="programlisting">
11321: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
11322: </pre>
11323:
1.14 xtraeme 11324: <p>In addition to the above <code class=
11325: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11326: while a package will build against
11327: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11328: recommended. <code class=
11329: "varname">RECOMMENDED</code> entries will be
11330: turned into dependencies unless explicitly
11331: ignored (in which case a warning will be
1.36 wiz 11332: printed).</p>
11333:
11334: <p>To ignore these dependency recommendations and
11335: just use the required <code class=
11336: "varname">DEPENDS</code>, set <code class=
11337: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11338: make it easier and faster to update packages
11339: built using pkgsrc, since older compatible
11340: dependencies can continue to be used. This is
11341: useful for people who watch their rebuilds very
11342: carefully; it is not very good as a
11343: general-purpose hammer. If you use it, you need
11344: to be mindful of possible ABI changes, including
11345: those from the underlying OS.</p>
11346:
11347: <p>Packages that are built with recommendations
11348: ignored may not be uploaded to ftp.NetBSD.org by
11349: developers and should not be used across
11350: different systems that may have different
11351: versions of binary packages installed.</p>
1.1 grant 11352:
11353: <p>For security fixes, please update the package
11354: vulnerabilities file as well as setting
1.14 xtraeme 11355: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11356: <a href="#security-handling" title=
1.38 dillo 11357: "15.1.8. Handling packages with security problems">
11358: Section 15.1.8, “Handling packages with
1.1 grant 11359: security problems”</a> for more
11360: information.</p>
11361: </li>
11362:
11363: <li>
11364: <p>If your package needs some executable to be
1.17 sketch 11365: able to run correctly and if there's no
1.45 wiz 11366: <code xmlns=
11367: "http://www.w3.org/TR/xhtml1/transitional" class=
11368: "filename">buildlink3.mk</code> file, this is
11369: specified using the <code class=
1.14 xtraeme 11370: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11371: "http://www.w3.org/TR/xhtml1/transitional" href=
11372: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11373: target="_top"><code xmlns="" class=
11374: "filename">print/lyx</code></a> package needs to
11375: be able to execute the latex binary from the
11376: teTeX package when it runs, and that is
11377: specified:</p>
1.1 grant 11378: <pre class="programlisting">
11379: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
11380: </pre>
11381:
11382: <p>The comment about wildcard dependencies from
11383: previous paragraph applies here, too.</p>
11384: </li>
11385: </ol>
11386: </div>
11387:
11388: <p>If your package needs files from another package to
11389: build, see the first part of the “<span class=
11390: "quote">do-configure</span>” target <a xmlns=
11391: "http://www.w3.org/TR/xhtml1/transitional" href=
11392: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11393: target="_top"><code xmlns="" class=
11394: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11395: relies on the jpeg sources being present in source form
11396: during the build):</p>
1.1 grant 11397: <pre class="programlisting">
11398: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11399: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
11400: fi
11401: </pre>
11402:
11403: <p>If you build any other packages that way, please
11404: make sure the working files are deleted too when this
11405: package's working files are cleaned up. The easiest way
11406: to do so is by adding a pre-clean target:</p>
11407: <pre class="programlisting">
11408: pre-clean:
11409: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
11410: </pre>
11411:
1.14 xtraeme 11412: <p>Please also note the <code class=
11413: "varname">BUILD_USES_MSGFMT</code> and <code class=
11414: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11415: which are provided as convenience definitions. The
1.24 wiz 11416: former works out whether <a href=
11417: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11418: <span class="citerefentry"><span class=
11419: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11420: the base system, and, if it isn't, installs the
11421: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11422: href=
1.1 grant 11423: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 11424: target="_top"><code xmlns="" class=
11425: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11426: adds a build dependency on either an installed version
11427: of an older gettext package, or if it isn't, installs
11428: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11429: href=
11430: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 11431: target="_top"><code xmlns="" class=
11432: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11433: </div>
11434:
11435: <div class="sect2" lang="en" xml:lang="en">
11436: <div class="titlepage">
11437: <div>
11438: <div>
1.30 wiz 11439: <h3 class="title"><a name="conflicts" id=
1.38 dillo 11440: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11441: with other packages</h3>
11442: </div>
11443: </div>
11444: </div>
11445:
11446: <p>Your package may conflict with other packages a user
11447: might already have installed on his system, e.g. if
11448: your package installs the same set of files like
11449: another package in our pkgsrc tree.</p>
11450:
1.14 xtraeme 11451: <p>In this case you can set <code class=
11452: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 11453: packages (including version string) your package
11454: conflicts with.</p>
11455:
11456: <p>For example <a xmlns=
11457: "http://www.w3.org/TR/xhtml1/transitional" href=
11458: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 11459: target="_top"><code xmlns="" class=
11460: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11461: "http://www.w3.org/TR/xhtml1/transitional" href=
11462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 11463: target="_top"><code xmlns="" class=
11464: "filename">x11/Xaw-Xpm</code></a> install provide the
11465: same shared library, thus you set in <code xmlns=
11466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11467: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 11468: <pre class="programlisting">
11469: CONFLICTS= Xaw-Xpm-[0-9]*
11470: </pre>
11471:
1.45 wiz 11472: <p>and in <code xmlns=
11473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11474: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 11475: <pre class="programlisting">
11476: CONFLICTS= Xaw3d-[0-9]*
11477: </pre>
11478:
11479: <p>Packages will automatically conflict with other
11480: packages with the name prefix and a different version
11481: string. “<span class=
11482: "quote">Xaw3d-1.5</span>” e.g. will automatically
11483: conflict with the older version “<span class=
11484: "quote">Xaw3d-1.3</span>”.</p>
11485: </div>
11486:
11487: <div class="sect2" lang="en" xml:lang="en">
11488: <div class="titlepage">
11489: <div>
11490: <div>
1.30 wiz 11491: <h3 class="title"><a name="not-building-packages"
11492: id=
1.38 dillo 11493: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 11494: that cannot or should not be built</h3>
1.1 grant 11495: </div>
11496: </div>
11497: </div>
11498:
11499: <p>There are several reasons why a package might be
11500: instructed to not build under certain circumstances. If
11501: the package builds and runs on most platforms, the
1.14 xtraeme 11502: exceptions should be noted with <code class=
11503: "varname">NOT_FOR_PLATFORM</code>. If the package
11504: builds and runs on a small handful of platforms, set
11505: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 11506: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
11507: <code class="varname">NOT_FOR_PLATFORM</code> are OS
11508: triples (OS-version-platform) that can use glob-style
11509: wildcards.</p>
11510:
11511: <p>If the package should be skipped (for example,
11512: because it provides functionality already provided by
11513: the system), set <code class=
1.14 xtraeme 11514: "varname">PKG_SKIP_REASON</code> to a descriptive
11515: message. If the package should fail because some
11516: preconditions are not met, set <code class=
11517: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 11518: message.</p>
11519: </div>
11520:
11521: <div class="sect2" lang="en" xml:lang="en">
11522: <div class="titlepage">
11523: <div>
11524: <div>
1.30 wiz 11525: <h3 class="title"><a name="undeletable-packages"
11526: id=
1.38 dillo 11527: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 11528: which should not be deleted, once installed</h3>
1.1 grant 11529: </div>
11530: </div>
11531: </div>
11532:
11533: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 11534: has been installed, the <code class=
11535: "varname">PKG_PRESERVE</code> definition should be set
11536: in the package Makefile. This will be carried into any
1.1 grant 11537: binary package that is made from this pkgsrc entry. A
11538: “<span class="quote">preserved</span>”
11539: package will not be deleted using <a href=
11540: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11541: <span class="citerefentry"><span class=
11542: "refentrytitle">pkg_delete</span>(1)</span></a> unless
11543: the “<span class="quote">-f</span>” option
11544: is used.</p>
11545: </div>
11546:
11547: <div class="sect2" lang="en" xml:lang="en">
11548: <div class="titlepage">
11549: <div>
11550: <div>
11551: <h3 class="title"><a name="security-handling" id=
1.38 dillo 11552: "security-handling"></a>15.1.8. Handling
1.1 grant 11553: packages with security problems</h3>
11554: </div>
11555: </div>
11556: </div>
11557:
11558: <p>When a vulnerability is found, this should be noted
1.45 wiz 11559: in <code xmlns=
11560: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11561: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 11562: and after committing that file, use
11563: <span><strong class="command">make
11564: upload</strong></span> in the same directory to update
11565: the file on ftp.NetBSD.org.</p>
11566:
11567: <p>After fixing the vulnerability by a patch, its
11568: <code class="varname">PKGREVISION</code> should be
11569: increased (this is of course not necessary if the
11570: problem is fixed by using a newer release of the
1.45 wiz 11571: software). In addition, if a <code xmlns=
11572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11573: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 11574: affected package, a corresponding <code class=
1.14 xtraeme 11575: "varname">BUILDLINK_RECOMMENDED.<em class=
11576: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 11577: be added or updated in it.</p>
1.1 grant 11578:
11579: <p>Also, if the fix should be applied to the stable
11580: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 11581:
11582: <p>Binary packages already on ftp.NetBSD.org will be
11583: handled semi-automatically by a weekly cron job.</p>
1.1 grant 11584: </div>
11585:
11586: <div class="sect2" lang="en" xml:lang="en">
11587: <div class="titlepage">
11588: <div>
11589: <div>
1.30 wiz 11590: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 11591: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 11592: compiler bugs</h3>
11593: </div>
11594: </div>
11595: </div>
11596:
11597: <p>Some source files trigger bugs in the compiler,
11598: based on combinations of compiler version and
11599: architecture and almost always relation to optimisation
11600: being enabled. Common symptoms are gcc internal errors
11601: or never finishing compiling a file.</p>
11602:
11603: <p>Typically a workaround involves testing the
1.14 xtraeme 11604: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 11605: version, disabling optimisation for that
1.14 xtraeme 11606: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 11607: combination, and documenting it in <code xmlns=
11608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11609: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 11610: number of examples!</p>
11611: </div>
11612:
11613: <div class="sect2" lang="en" xml:lang="en">
11614: <div class="titlepage">
11615: <div>
11616: <div>
1.30 wiz 11617: <h3 class="title"><a name="bumping-pkgrevision"
1.38 dillo 11618: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 11619: handle incrementing versions when fixing an
11620: existing package</h3>
1.1 grant 11621: </div>
11622: </div>
11623: </div>
11624:
11625: <p>When making fixes to an existing package it can be
1.14 xtraeme 11626: useful to change the version number in <code class=
11627: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 11628: future versions by the original author, a
11629: “<span class="quote">nb1</span>”,
11630: “<span class="quote">nb2</span>”, ...
11631: suffix can be used on package versions by setting
1.14 xtraeme 11632: <code class="varname">PKGREVISION=1</code> (2, ...).
11633: The “<span class="quote">nb</span>” is
11634: treated like a “<span class=
11635: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 11636: <pre class="programlisting">
11637: DISTNAME= foo-17.42
11638: PKGREVISION= 9
11639: </pre>
11640:
1.14 xtraeme 11641: <p>will result in a <code class=
11642: "varname">PKGNAME</code> of “<span class=
1.1 grant 11643: "quote">foo-17.42nb9</span>”.</p>
11644:
11645: <p>When a new release of the package is released, the
1.14 xtraeme 11646: <code class="varname">PKGREVISION</code> should be
11647: removed. e.g. on a new minor release of the above
11648: package, things should be like:</p>
1.1 grant 11649: <pre class="programlisting">
11650: DISTNAME= foo-17.43
11651: </pre>
11652: </div>
11653:
11654: <div class="sect2" lang="en" xml:lang="en">
11655: <div class="titlepage">
11656: <div>
11657: <div>
1.30 wiz 11658: <h3 class="title"><a name=
11659: "portability-of-packages" id=
1.38 dillo 11660: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 11661: of packages</h3>
1.1 grant 11662: </div>
11663: </div>
11664: </div>
11665:
11666: <p>One appealing feature of pkgsrc is that it runs on
11667: many different platforms. As a result, it is important
11668: to ensure, where possible, that packages in pkgsrc are
11669: portable. There are some particular details you should
11670: pay attention to while working on pkgsrc.</p>
11671:
11672: <div class="sect3" lang="en" xml:lang="en">
11673: <div class="titlepage">
11674: <div>
11675: <div>
1.30 wiz 11676: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 11677: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 11678: ${INSTALL_DATA_DIR}, ...</h4>
11679: </div>
11680: </div>
11681: </div>
11682:
1.14 xtraeme 11683: <p>The BSD-compatible <span><strong class=
11684: "command">install</strong></span> supplied with some
1.1 grant 11685: operating systems will not perform more than one
11686: operation at a time. As such, you should call
11687: “<span class="quote">${INSTALL}</span>”,
11688: etc. like this:</p>
11689: <pre class="programlisting">
11690: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
11691: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
11692: </pre>
11693: </div>
11694: </div>
11695: </div>
11696:
11697: <div class="sect1" lang="en" xml:lang="en">
11698: <div class="titlepage">
11699: <div>
11700: <div>
11701: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11702: "downloading-issues" id=
1.38 dillo 11703: "downloading-issues"></a>15.2. Possible
1.1 grant 11704: downloading issues</h2>
11705: </div>
11706: </div>
11707: </div>
11708:
11709: <div class="sect2" lang="en" xml:lang="en">
11710: <div class="titlepage">
11711: <div>
11712: <div>
1.30 wiz 11713: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 11714: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 11715: whose distfiles aren't available for plain
1.1 grant 11716: downloading</h3>
11717: </div>
11718: </div>
11719: </div>
11720:
11721: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 11722: set <code class="varname">DYNAMIC_MASTER_SITES</code>
11723: and a <span><strong class="command">make
1.45 wiz 11724: fetch</strong></span> will call <code xmlns=
11725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11726: "filename">files/getsite.sh</code> with the name of
11727: each file to download as an argument, expecting it to
11728: output the URL of the directory from which to download
11729: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11730: href=
1.1 grant 11731: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 11732: target="_top"><code xmlns="" class=
11733: "filename">graphics/ns-cult3d</code></a> is an example
11734: of this usage.</p>
1.1 grant 11735:
11736: <p>If the download can't be automated, because the user
11737: must submit personal information to apply for a
11738: password, or must pay for the source, or whatever, you
1.14 xtraeme 11739: can set <code class="varname">_FETCH_MESSAGE</code> to
11740: a macro which displays a message explaining the
11741: situation. <code class="varname">_FETCH_MESSAGE</code>
11742: must be executable shell commands, not just a message.
11743: (Generally, it executes <code class=
11744: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 11745: following packages use this: <a xmlns=
11746: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11747: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 11748: target="_top"><code xmlns="" class=
11749: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 11750: "http://www.w3.org/TR/xhtml1/transitional" href=
11751: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 11752: target="_top"><code xmlns="" class=
11753: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 11754: "http://www.w3.org/TR/xhtml1/transitional" href=
11755: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 11756: target="_top"><code xmlns="" class=
11757: "filename">emulators/vmware-module</code></a>,
11758: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11759: href=
1.20 ben 11760: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 11761: target="_top"><code xmlns="" class=
11762: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 11763: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 11764: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 11765: target="_top"><code xmlns="" class=
11766: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 11767: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11768: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 11769: target="_top"><code xmlns="" class=
11770: "filename">sysutils/storage-manager</code></a>,
11771: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11772: href=
1.20 ben 11773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 11774: target="_top"><code xmlns="" class=
11775: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 11776: "http://www.w3.org/TR/xhtml1/transitional" href=
11777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 11778: target="_top"><code xmlns="" class=
11779: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 11780: with them.</p>
1.1 grant 11781: </div>
11782:
11783: <div class="sect2" lang="en" xml:lang="en">
11784: <div class="titlepage">
11785: <div>
11786: <div>
1.30 wiz 11787: <h3 class="title"><a name=
11788: "modified-distfiles-same-name" id=
1.38 dillo 11789: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 11790: to handle modified distfiles with the 'old'
11791: name</h3>
1.1 grant 11792: </div>
11793: </div>
11794: </div>
11795:
11796: <p>Sometimes authors of a software package make some
11797: modifications after the software was released, and they
11798: put up a new distfile without changing the package's
11799: version number. If a package is already in pkgsrc at
1.32 wiz 11800: that time, the checksum will no longer match. The
11801: contents of the new distfile should be compared against
11802: the old one before changing anything, to make sure the
11803: distfile was really updated on purpose, and that no
11804: trojan horse or so crept in. Then, the correct way to
11805: work around this is to set <code class=
11806: "varname">DIST_SUBDIR</code> to a unique directory
11807: name, usually based on <code class=
11808: "varname">PKGNAME_NOREV</code>. In case this happens
11809: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 11810: used (thus including the <code xmlns=
11811: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11812: "filename">nbX</code> suffix) or a date stamp can be
11813: appended, like <code class=
11814: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 11815: forget regenerating the <code xmlns=
11816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11817: "filename">distinfo</code> file after that, since it
11818: contains the <code class="varname">DIST_SUBDIR</code>
11819: path in the filenames. Furthermore, a mail to the
11820: package's authors seems appropriate telling them that
11821: changing distfiles after releases without changing the
11822: file names is not good practice.</p>
1.1 grant 11823: </div>
11824: </div>
11825:
11826: <div class="sect1" lang="en" xml:lang="en">
11827: <div class="titlepage">
11828: <div>
11829: <div>
11830: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11831: "configuration-gotchas" id=
1.38 dillo 11832: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 11833: gotchas</h2>
11834: </div>
11835: </div>
11836: </div>
11837:
11838: <div class="sect2" lang="en" xml:lang="en">
11839: <div class="titlepage">
11840: <div>
11841: <div>
11842: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 11843: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 11844: - libtool</h3>
11845: </div>
11846: </div>
11847: </div>
11848:
11849: <p>pkgsrc supports many different machines, with
11850: different object formats like a.out and ELF, and
11851: varying abilities to do shared library and dynamic
11852: loading at all. To accompany this, varying commands and
11853: options have to be passed to the compiler, linker, etc.
11854: to get the Right Thing, which can be pretty annoying
11855: especially if you don't have all the machines at your
11856: hand to test things. The <a xmlns=
11857: "http://www.w3.org/TR/xhtml1/transitional" href=
11858: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 11859: target="_top"><code xmlns="" class=
11860: "filename">devel/libtool</code></a> pkg can help here,
11861: as it just “<span class=
11862: "quote">knows</span>” how to build both static
11863: and dynamic libraries from a set of source files, thus
11864: being platform independent.</p>
1.1 grant 11865:
11866: <p>Here's how to use libtool in a pkg in seven simple
11867: steps:</p>
11868:
11869: <div class="orderedlist">
11870: <ol type="1">
11871: <li>
1.14 xtraeme 11872: <p>Add <code class=
11873: "varname">USE_LIBTOOL=yes</code> to the package
11874: Makefile.</p>
1.1 grant 11875: </li>
11876:
11877: <li>
11878: <p>For library objects, use “<span class=
11879: "quote">${LIBTOOL} --mode=compile
11880: ${CC}</span>” in place of
11881: “<span class="quote">${CC}</span>”.
11882: You could even add it to the definition of
1.14 xtraeme 11883: <code class="varname">CC</code>, if only
11884: libraries are being built in a given Makefile.
11885: This one command will build both PIC and non-PIC
11886: library objects, so you need not have separate
11887: shared and non-shared library rules.</p>
1.1 grant 11888: </li>
11889:
11890: <li>
11891: <p>For the linking of the library, remove any
11892: “<span class="quote">ar</span>”,
11893: “<span class="quote">ranlib</span>”,
11894: and “<span class="quote">ld
11895: -Bshareable</span>” commands, and instead
11896: use:</p>
11897: <pre class="programlisting">
11898: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
11899: </pre>
11900:
11901: <p>Note that the library is changed to have a
1.45 wiz 11902: <code xmlns=
11903: "http://www.w3.org/TR/xhtml1/transitional" class=
11904: "filename">.la</code> extension, and the objects
11905: are changed to have a <code xmlns=
11906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11907: "filename">.lo</code> extension. Change
11908: <code class="varname">OBJS</code> as necessary.
11909: This automatically creates all of the
1.45 wiz 11910: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11911: class="filename">.a</code>, <code xmlns=
11912: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11913: "filename">.so.major.minor</code>, and ELF
11914: symlinks (if necessary) in the build directory.
11915: Be sure to include “<span class=
1.1 grant 11916: "quote">-version-info</span>”, especially
11917: when major and minor are zero, as libtool will
11918: otherwise strip off the shared library
11919: version.</p>
11920:
11921: <p>From the libtool manual:</p>
11922: <pre class="programlisting">
11923: So, libtool library versions are described by three integers:
11924:
11925: CURRENT
11926: The most recent interface number that this library implements.
11927:
11928: REVISION
11929: The implementation number of the CURRENT interface.
11930:
11931: AGE
11932: The difference between the newest and oldest interfaces that this
11933: library implements. In other words, the library implements all the
11934: interface numbers in the range from number `CURRENT - AGE' to
11935: `CURRENT'.
11936:
11937: If two libraries have identical CURRENT and AGE numbers, then the
11938: dynamic linker chooses the library with the greater REVISION number.
11939: </pre>
11940:
11941: <p>The “<span class=
11942: "quote">-release</span>” option will
11943: produce different results for a.out and ELF
11944: (excluding symlinks) in only one case. An ELF
11945: library of the form “<span class=
11946: "quote">libfoo-release.so.<span class=
11947: "emphasis"><em>x</em></span>.<span class=
11948: "emphasis"><em>y</em></span></span>” will
11949: have a symlink of “<span class=
11950: "quote">libfoo.so.<span class=
11951: "emphasis"><em>x</em></span>.<span class=
11952: "emphasis"><em>y</em></span></span>” on an
11953: a.out platform. This is handled
11954: automatically.</p>
11955:
11956: <p>The “<span class="quote">-rpath
11957: argument</span>” is the install directory
11958: of the library being built.</p>
11959:
1.45 wiz 11960: <p>In the <code xmlns=
11961: "http://www.w3.org/TR/xhtml1/transitional" class=
11962: "filename">PLIST</code>, include only the
11963: <code xmlns=
11964: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 11965: "filename">.la</code> file, the other files will
11966: be added automatically.</p>
1.1 grant 11967: </li>
11968:
11969: <li>
1.45 wiz 11970: <p>When linking shared object (<code xmlns=
11971: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11972: "filename">.so</code>) files, i.e. files that are
1.24 wiz 11973: loaded via <a href=
11974: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
11975: <span class="citerefentry"><span class=
11976: "refentrytitle">dlopen</span>(3)</span></a>, NOT
11977: shared libraries, use “<span class=
11978: "quote">-module -avoid-version</span>” to
11979: prevent them getting version tacked on.</p>
1.1 grant 11980:
1.45 wiz 11981: <p>The <code xmlns=
11982: "http://www.w3.org/TR/xhtml1/transitional" class=
11983: "filename">PLIST</code> file gets the
11984: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11985: class="filename">foo.so</code> entry.</p>
1.1 grant 11986: </li>
11987:
11988: <li>
11989: <p>When linking programs that depend on these
11990: libraries <span class=
11991: "emphasis"><em>before</em></span> they are
11992: installed, preface the <a href=
11993: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
11994: <span class="citerefentry"><span class=
11995: "refentrytitle">cc</span>(1)</span></a> or
11996: <a href=
11997: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
11998: <span class="citerefentry"><span class=
11999: "refentrytitle">ld</span>(1)</span></a> line with
12000: “<span class="quote">${LIBTOOL}
12001: --mode=link</span>”, and it will find the
12002: correct libraries (static or shared), but please
12003: be aware that libtool will not allow you to
12004: specify a relative path in -L (such as
12005: “<span class=
12006: "quote">-L../somelib</span>”), because it
12007: expects you to change that argument to be the
1.45 wiz 12008: <code xmlns=
12009: "http://www.w3.org/TR/xhtml1/transitional" class=
12010: "filename">.la</code> file. e.g.</p>
1.1 grant 12011: <pre class="programlisting">
12012: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
12013: </pre>
12014:
12015: <p>should be changed to:</p>
12016: <pre class="programlisting">
1.14 xtraeme 12017: ${LIBTOOL} --mode=link ${CC} -o <em class=
12018: "replaceable"><code>someprog</code></em> <em class=
12019: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12020: </pre>
12021:
12022: <p>and it will do the right thing with the
12023: libraries.</p>
12024: </li>
12025:
12026: <li>
12027: <p>When installing libraries, preface the
12028: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12029: <span class="citerefentry"><span class=
12030: "refentrytitle">install</span>(1)</span></a> or
12031: <a href=
12032: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12033: <span class="citerefentry"><span class=
12034: "refentrytitle">cp</span>(1)</span></a> command
12035: with “<span class="quote">${LIBTOOL}
12036: --mode=install</span>”, and change the
1.45 wiz 12037: library name to <code xmlns=
12038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12039: "filename">.la</code>. e.g.</p>
1.1 grant 12040: <pre class="programlisting">
12041: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
12042: </pre>
12043:
1.45 wiz 12044: <p>This will install the static <code xmlns=
12045: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12046: "filename">.a</code>, shared library, any needed
1.1 grant 12047: symlinks, and run <a href=
12048: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12049: <span class="citerefentry"><span class=
12050: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12051: </li>
12052:
12053: <li>
1.45 wiz 12054: <p>In your <code xmlns=
12055: "http://www.w3.org/TR/xhtml1/transitional" class=
12056: "filename">PLIST</code>, include only the
12057: <code xmlns=
12058: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12059: "filename">.la</code> file (this is a change from
12060: previous behaviour).</p>
1.1 grant 12061: </li>
12062: </ol>
12063: </div>
12064: </div>
12065:
12066: <div class="sect2" lang="en" xml:lang="en">
12067: <div class="titlepage">
12068: <div>
12069: <div>
1.30 wiz 12070: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12071: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12072: GNU packages that already support libtool</h3>
1.1 grant 12073: </div>
12074: </div>
12075: </div>
12076:
1.14 xtraeme 12077: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12078: the package Makefile. This will override the package's
12079: own libtool in most cases. For older libtool using
1.1 grant 12080: packages, libtool is made by ltconfig script during the
12081: do-configure step; you can check the libtool script
1.14 xtraeme 12082: location by doing <span><strong class="command">make
12083: configure; find work*/ -name
12084: libtool</strong></span>.</p>
12085:
12086: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12087: specifies which libtool scripts, relative to
12088: <code class="varname">WRKSRC</code>, to override. By
12089: default, it is set to “<span class=
12090: "quote">libtool */libtool */*/libtool</span>”. If
12091: this does not match the location of the package's
12092: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12093:
1.45 wiz 12094: <p>If you do not need <code xmlns=
12095: "http://www.w3.org/TR/xhtml1/transitional" class=
12096: "filename">*.a</code> static libraries built and
12097: installed, then use <code class=
12098: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12099:
12100: <p>If your package makes use of the platform
12101: independent library for loading dynamic shared objects,
12102: that comes with libtool (libltdl), you should include
1.22 tv 12103: devel/libltdl/buildlink3.mk.</p>
1.1 grant 12104:
12105: <p>Some packages use libtool incorrectly so that the
12106: package may not work or build in some circumstances.
12107: Some of the more common errors are:</p>
12108:
12109: <div class="itemizedlist">
12110: <ul type="disc">
12111: <li>
12112: <p>The inclusion of a shared object (-module) as
12113: a dependent library in an executable or library.
12114: This in itself isn't a problem if one of two
12115: things has been done:</p>
12116:
12117: <div class="orderedlist">
12118: <ol type="1">
12119: <li>
12120: <p>The shared object is named correctly,
1.45 wiz 12121: i.e. <code xmlns=
12122: "http://www.w3.org/TR/xhtml1/transitional"
12123: class="filename">libfoo.la</code>, not
12124: <code xmlns=
12125: "http://www.w3.org/TR/xhtml1/transitional"
12126: class="filename">foo.la</code></p>
1.1 grant 12127: </li>
12128:
12129: <li>
12130: <p>The -dlopen option is used when linking
12131: an executable.</p>
12132: </li>
12133: </ol>
12134: </div>
12135: </li>
12136:
12137: <li>
12138: <p>The use of libltdl without the correct calls
12139: to initialisation routines. The function
12140: lt_dlinit() should be called and the macro
1.14 xtraeme 12141: <code class=
12142: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12143: included in executables.</p>
12144: </li>
12145: </ul>
12146: </div>
12147: </div>
12148:
12149: <div class="sect2" lang="en" xml:lang="en">
12150: <div class="titlepage">
12151: <div>
12152: <div>
1.30 wiz 12153: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12154: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12155: Autoconf/Automake</h3>
12156: </div>
12157: </div>
12158: </div>
12159:
12160: <p>If a package needs GNU autoconf or automake to be
12161: executed to regenerate the configure script and
12162: Makefile.in makefile templates, then they should be
1.35 jmmv 12163: executed in a pre-configure target.</p>
1.1 grant 12164:
12165: <p>For packages that need only autoconf:</p>
12166: <pre class="programlisting">
1.35 jmmv 12167: AUTOCONF_REQD= 2.50 # if default version is not good enough
12168: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 12169: ...
12170:
12171: pre-configure:
1.35 jmmv 12172: cd ${WRKSRC}; autoconf
1.1 grant 12173:
12174: ...
12175: </pre>
12176:
12177: <p>and for packages that need automake and
12178: autoconf:</p>
12179: <pre class="programlisting">
1.35 jmmv 12180: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 wiz 12181: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 12182: ...
12183:
12184: pre-configure:
12185: cd ${WRKSRC}; \
1.35 jmmv 12186: aclocal; autoheader; \
12187: automake -a --foreign -i; autoconf
1.1 grant 12188:
12189: ...
12190: </pre>
12191:
12192: <p>Packages which use GNU Automake will almost
1.35 jmmv 12193: certainly require GNU Make.</p>
1.1 grant 12194:
12195: <p>There are times when the configure process makes
12196: additional changes to the generated files, which then
12197: causes the build process to try to re-execute the
12198: automake sequence. This is prevented by touching
12199: various files in the configure stage. If this causes
1.14 xtraeme 12200: problems with your package you can set <code class=
12201: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12202: Makefile.</p>
12203: </div>
12204: </div>
12205:
12206: <div class="sect1" lang="en" xml:lang="en">
12207: <div class="titlepage">
12208: <div>
12209: <div>
12210: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12211: "building-considerations" id=
1.38 dillo 12212: "building-considerations"></a>15.4. Building
1.1 grant 12213: considerations</h2>
12214: </div>
12215: </div>
12216: </div>
12217:
12218: <div class="sect2" lang="en" xml:lang="en">
12219: <div class="titlepage">
12220: <div>
12221: <div>
1.30 wiz 12222: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12223: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12224: </div>
12225: </div>
12226: </div>
12227:
12228: <p>To port an application to NetBSD, it's usually
12229: necessary for the compiler to be able to judge the
12230: system on which it's compiling, and we use definitions
12231: so that the C pre-processor can do this.</p>
12232:
12233: <p>To test whether you are working on a 4.4 BSD-derived
12234: system, you should use the BSD definition, which is
1.45 wiz 12235: defined in <code xmlns=
12236: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12237: "filename"><sys/param.h></code> on said
1.1 grant 12238: systems.</p>
12239: <pre class="programlisting">
12240: #include <sys/param.h>
12241: </pre>
12242:
12243: <p>and then you can surround the BSD-specific parts of
12244: your package's C/C++ code using this conditional:</p>
12245: <pre class="programlisting">
12246: #if (defined(BSD) && BSD >= 199306)
12247: ...
12248: #endif
12249: </pre>
12250:
12251: <p>Please use the “<span class=
12252: "quote">__NetBSD__</span>” definition sparingly -
12253: it should only apply to features of NetBSD that are not
12254: present in other 4.4-lite derived BSDs.</p>
12255: </div>
12256: </div>
12257:
12258: <div class="sect1" lang="en" xml:lang="en">
12259: <div class="titlepage">
12260: <div>
12261: <div>
12262: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12263: "package-specific-actions" id=
1.38 dillo 12264: "package-specific-actions"></a>15.5. Package
1.1 grant 12265: specific actions</h2>
12266: </div>
12267: </div>
12268: </div>
12269:
12270: <div class="sect2" lang="en" xml:lang="en">
12271: <div class="titlepage">
12272: <div>
12273: <div>
1.30 wiz 12274: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 12275: "user-interaction"></a>15.5.1. User
1.2 hubertf 12276: interaction</h3>
1.1 grant 12277: </div>
12278: </div>
12279: </div>
12280:
12281: <p>Occasionally, packages require interaction from the
12282: user, and this can be in a number of ways:</p>
12283:
12284: <div class="itemizedlist">
12285: <ul type="disc">
12286: <li>
12287: <p>help in fetching the distfiles</p>
12288: </li>
12289:
12290: <li>
12291: <p>help to configure the package before it is
12292: built</p>
12293: </li>
12294:
12295: <li>
12296: <p>help during the build process</p>
12297: </li>
12298:
12299: <li>
12300: <p>help during the installation of a package</p>
12301: </li>
12302: </ul>
12303: </div>
12304:
1.14 xtraeme 12305: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12306: definition is provided to notify the pkgsrc mechanism
12307: of an interactive stage which will be needed, and this
1.45 wiz 12308: should be set in the package's <code xmlns=
12309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12310: "filename">Makefile</code>. e.g.</p>
1.1 grant 12311: <pre class="programlisting">
12312: INTERACTIVE_STAGE= build
12313: </pre>
12314:
12315: <p>Multiple interactive stages can be specified:</p>
12316: <pre class="programlisting">
12317: INTERACTIVE_STAGE= configure install
12318: </pre>
12319: </div>
12320:
12321: <div class="sect2" lang="en" xml:lang="en">
12322: <div class="titlepage">
12323: <div>
12324: <div>
1.30 wiz 12325: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 12326: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12327: licenses</h3>
12328: </div>
12329: </div>
12330: </div>
12331:
1.44 gdt 12332: <p>A package may be covered by a license which the user
12333: has or has not agreed to accept. For these cases,
12334: pkgsrc contains a mechanism to note that a package is
12335: covered by a particular license, and the package cannot
12336: be built unless the user has accepted the license.
12337: (Installation of binary packages are not currently
12338: subject to this mechanism.) Packages with licenses that
12339: are either Open Source according to the Open Source
12340: Initiative or Free according to the Free Software
12341: Foundation will not be marked with a license tag.
12342: Packages with licenses that have not been determined to
12343: meet either definition will be marked with a license
12344: tag referring to the license. This will prevent
12345: building unless pkgsrc is informed that the license is
12346: acceptable, and enables displaying the license.</p>
12347:
12348: <p>The license tag mechanism is intended to address
12349: copyright-related issues surrounding building,
12350: installing and using a package, and not to address
12351: redistribution issues (see <code class=
12352: "varname">RESTRICTED</code> and <code class=
12353: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12354: above definition of licenses for which tags are not
12355: needed implies that packages with redistribution
12356: restrictions should have tags.</p>
12357:
12358: <p>Denoting that a package is covered by a particular
1.45 wiz 12359: license is done by placing the license in <code xmlns=
12360: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12361: "filename">pkgsrc/licenses</code> and setting the
12362: <code class="varname">LICENSE</code> variable to a
12363: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12364: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12365: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 12366: target="_top"><code xmlns="" class=
12367: "filename">graphics/xv</code></a>:</p>
1.1 grant 12368: <pre class="programlisting">
1.44 gdt 12369: LICENSE= xv-license
1.1 grant 12370: </pre>
12371:
12372: <p>When trying to build, the user will get a notice
1.44 gdt 12373: that the package is covered by a license which has not
12374: been accepted:</p>
1.1 grant 12375: <pre class="programlisting">
1.14 xtraeme 12376: <code class="prompt">%</code> <strong class=
12377: "userinput"><code>make</code></strong>
1.44 gdt 12378: ===> xv-3.10anb9 has an unacceptable license: xv-license.
1.1 grant 12379: ===> To view the license, enter "/usr/bin/make show-license".
1.44 gdt 12380: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12381: ===> ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12382: *** Error code 1
12383: </pre>
12384:
1.14 xtraeme 12385: <p>The license can be viewed with <span><strong class=
12386: "command">make show-license</strong></span>, and if it
12387: is considered appropriate, the line printed above can
1.45 wiz 12388: be added to <code xmlns=
12389: "http://www.w3.org/TR/xhtml1/transitional" class=
12390: "filename">/etc/mk.conf</code> to indicate acceptance
12391: of the particular license:</p>
1.1 grant 12392: <pre class="programlisting">
1.44 gdt 12393: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12394: </pre>
12395:
12396: <p>When adding a package with a new license, the
1.45 wiz 12397: license text should be added to <code xmlns=
12398: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12399: "filename">pkgsrc/licenses</code> for displaying. A
12400: list of known licenses can be seen in this directory as
12401: well as by looking at the list of (commented out)
12402: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 12403: variable settings in <code xmlns=
12404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12405: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 12406:
1.44 gdt 12407: <p>The use of <code class=
12408: "varname">LICENSE=shareware</code>, <code class=
12409: "varname">LICENSE=no-commercial-use</code>, and similar
12410: language is deprecated because it does not crisply
12411: refer to a particular license text. Another problem
12412: with such usage is that it does not enable a user to
12413: denote acceptance of the license for a single package
12414: without accepting the same license text for another
12415: package. In particular, this can be inappropriate when
12416: e.g. one accepts a particular license to indicate to
12417: pkgsrc that a fee has been paid.</p>
1.1 grant 12418: </div>
12419:
12420: <div class="sect2" lang="en" xml:lang="en">
12421: <div class="titlepage">
12422: <div>
12423: <div>
1.30 wiz 12424: <h3 class="title"><a name=
12425: "installing-score-files" id=
1.38 dillo 12426: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 12427: score files</h3>
1.1 grant 12428: </div>
12429: </div>
12430: </div>
12431:
12432: <p>Certain packages, most of them in the games
12433: category, install a score file that allows all users on
12434: the system to record their highscores. In order for
12435: this to work, the binaries need to be installed setgid
12436: and the score files owned by the appropriate group
12437: and/or owner (traditionally the "games" user/group).
12438: The following variables, documented in more detail in
1.45 wiz 12439: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12440: class="filename">mk/defaults/mk.conf</code>, control
12441: this behaviour: <code class=
1.14 xtraeme 12442: "varname">SETGIDGAME</code>, <code class=
12443: "varname">GAMEDATAMODE</code>, <code class=
12444: "varname">GAMEGRP</code>, <code class=
12445: "varname">GAMEMODE</code>, <code class=
12446: "varname">GAMEOWN</code>.</p>
1.1 grant 12447:
12448: <p>Note that per default, setgid installation of games
1.14 xtraeme 12449: is disabled; setting <code class=
12450: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 12451: variables accordingly.</p>
12452:
12453: <p>A package should therefor never hard code file
1.14 xtraeme 12454: ownership or access permissions but rely on
12455: <code class="varname">INSTALL_GAME</code> and
12456: <code class="varname">INSTALL_GAME_DATA</code> to set
12457: these correctly.</p>
1.1 grant 12458: </div>
12459:
12460: <div class="sect2" lang="en" xml:lang="en">
12461: <div class="titlepage">
12462: <div>
12463: <div>
1.30 wiz 12464: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 12465: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 12466: containing perl scripts</h3>
1.1 grant 12467: </div>
12468: </div>
12469: </div>
12470:
12471: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 12472: set <code class="varname">REPLACE_PERL</code> to ensure
12473: that the proper interpreter path is set. <code class=
12474: "varname">REPLACE_PERL</code> should contain a list of
12475: scripts, relative to <code class=
12476: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 12477: </div>
12478:
12479: <div class="sect2" lang="en" xml:lang="en">
12480: <div class="titlepage">
12481: <div>
12482: <div>
1.30 wiz 12483: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 12484: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 12485: hardcoded paths to other interpreters</h3>
12486: </div>
12487: </div>
12488: </div>
12489:
12490: <p>Your package may also contain scripts with hardcoded
12491: paths to other interpreters besides (or as well as)
12492: perl. To correct the full pathname to the script
12493: interpreter, you need to set the following definitions
1.45 wiz 12494: in your <code xmlns=
12495: "http://www.w3.org/TR/xhtml1/transitional" class=
12496: "filename">Makefile</code> (we shall use
12497: <span><strong class="command">tclsh</strong></span> in
12498: this example):</p>
1.1 grant 12499: <pre class="programlisting">
12500: REPLACE_INTERPRETER+= tcl
12501: _REPLACE.tcl.old= .*/bin/tclsh
12502: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
12503: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
12504: relative to ${WRKSRC}, just as in REPLACE_PERL
12505: </pre>
12506: </div>
12507:
12508: <div class="sect2" lang="en" xml:lang="en">
12509: <div class="titlepage">
12510: <div>
12511: <div>
1.30 wiz 12512: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 12513: "perl-modules"></a>15.5.6. Packages
1.30 wiz 12514: installing perl modules</h3>
1.1 grant 12515: </div>
12516: </div>
12517: </div>
12518:
12519: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 12520: include the Makefile fragment <code xmlns=
12521: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12522: "filename">../../lang/perl5/module.mk</code>. It
12523: provides a <span><strong class=
12524: "command">do-configure</strong></span> target for the
12525: standard perl configuration for such modules as well as
12526: various hooks to tune this configuration. See comments
12527: in this file for details.</p>
1.1 grant 12528:
12529: <p>Perl5 modules will install into different places
12530: depending on the version of perl used during the build
12531: process. To address this, pkgsrc will append lines to
1.45 wiz 12532: the <code xmlns=
12533: "http://www.w3.org/TR/xhtml1/transitional" class=
12534: "filename">PLIST</code> corresponding to the files
12535: listed in the installed <code xmlns=
12536: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12537: "filename">.packlist</code> file generated by most
12538: perl5 modules. This is invoked by defining <code class=
12539: "varname">PERL5_PACKLIST</code> to a space-separated
12540: list of paths to packlist files, e.g.:</p>
1.1 grant 12541: <pre class="programlisting">
12542: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
12543: </pre>
12544:
1.14 xtraeme 12545: <p>The variables <code class=
12546: "varname">PERL5_SITELIB</code>, <code class=
12547: "varname">PERL5_SITEARCH</code>, and <code class=
12548: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 12549: locations in which perl5 modules may be installed, and
12550: may be used by perl5 packages that don't have a
12551: packlist. These three variables are also substituted
1.45 wiz 12552: for in the <code xmlns=
12553: "http://www.w3.org/TR/xhtml1/transitional" class=
12554: "filename">PLIST</code>.</p>
1.1 grant 12555: </div>
12556:
12557: <div class="sect2" lang="en" xml:lang="en">
12558: <div class="titlepage">
12559: <div>
12560: <div>
12561: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 12562: "faq.info-files"></a>15.5.7. Packages
1.1 grant 12563: installing info files</h3>
12564: </div>
12565: </div>
12566: </div>
12567:
12568: <p>Some packages install info files or use the
12569: “<span class="quote">makeinfo</span>” or
12570: “<span class="quote">install-info</span>”
12571: commands. Each of the info files:</p>
12572:
12573: <div class="itemizedlist">
12574: <ul type="disc">
12575: <li>
12576: <p>is considered to be installed in the directory
1.45 wiz 12577: <code xmlns=
12578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12579: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 12580: </li>
12581:
12582: <li>
12583: <p>is registered in the Info directory file
1.45 wiz 12584: <code xmlns=
12585: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12586: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 12587: </li>
12588:
12589: <li>
12590: <p>and must be listed as a filename in the
1.14 xtraeme 12591: <code class="varname">INFO_FILES</code> variable
12592: in the package Makefile.</p>
1.1 grant 12593: </li>
12594: </ul>
12595: </div>
12596:
1.14 xtraeme 12597: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 12598: “<span class="quote">info</span>” and can
1.45 wiz 12599: be overridden in the package Makefile. <code xmlns=
12600: "http://www.w3.org/TR/xhtml1/transitional" class=
12601: "filename">INSTALL</code> and <code xmlns=
12602: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12603: "filename">DEINSTALL</code> scripts will be generated
12604: to handle registration of the info files in the Info
1.1 grant 12605: directory file. The “<span class=
12606: "quote">install-info</span>” command used for the
12607: info files registration is either provided by the
12608: system, or by a special purpose package automatically
12609: added as dependency if needed.</p>
12610:
12611: <p>A package which needs the “<span class=
12612: "quote">makeinfo</span>” command at build time
1.14 xtraeme 12613: must define the variable <code class=
12614: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 12615: minimum version of the “<span class=
12616: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 12617: should be noted with the <code class=
12618: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 12619: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12620: class="filename">Makefile</code>. By default, a minimum
12621: version of 3.12 is required. If the system does not
12622: provide a <span><strong class=
1.14 xtraeme 12623: "command">makeinfo</strong></span> command or if it
12624: does not match the required minimum, a build dependency
12625: on the <a xmlns=
12626: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 12627: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 12628: target="_top"><code xmlns="" class=
12629: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 12630: added automatically.</p>
1.1 grant 12631:
12632: <p>The build and installation process of the software
12633: provided by the package should not use the
1.14 xtraeme 12634: <span><strong class=
12635: "command">install-info</strong></span> command as the
12636: registration of info files is the task of the package
1.45 wiz 12637: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12638: class="filename">INSTALL</code> script, and it must use
12639: the appropriate <span><strong class=
1.14 xtraeme 12640: "command">makeinfo</strong></span> command.</p>
1.1 grant 12641:
12642: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 12643: creates overriding scripts for the <span><strong class=
12644: "command">install-info</strong></span> and
12645: <span><strong class="command">makeinfo</strong></span>
12646: commands in a directory listed early in <code class=
12647: "varname">PATH</code>.</p>
1.1 grant 12648:
1.14 xtraeme 12649: <p>The script overriding <span><strong class=
12650: "command">install-info</strong></span> has no effect
12651: except the logging of a message. The script overriding
12652: <span><strong class="command">makeinfo</strong></span>
12653: logs a message and according to the value of
12654: <code class="varname">USE_MAKEINFO</code> and
12655: <code class="varname">TEXINFO_REQD</code> either run
12656: the appropriate <span><strong class=
12657: "command">makeinfo</strong></span> command or exit on
12658: error.</p>
1.1 grant 12659: </div>
12660:
12661: <div class="sect2" lang="en" xml:lang="en">
12662: <div class="titlepage">
12663: <div>
12664: <div>
1.30 wiz 12665: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 12666: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 12667: installing GConf2 data files</h3>
1.1 grant 12668: </div>
12669: </div>
12670: </div>
12671:
1.45 wiz 12672: <p>If a package installs <code xmlns=
12673: "http://www.w3.org/TR/xhtml1/transitional" class=
12674: "filename">.schemas</code> or <code xmlns=
12675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12676: "filename">.entries</code> files, used by GConf2, you
1.1 grant 12677: need to take some extra steps to make sure they get
12678: registered in the database:</p>
12679:
12680: <div class="orderedlist">
12681: <ol type="1">
12682: <li>
1.45 wiz 12683: <p>Include <code xmlns=
12684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12685: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 12686: instead of its <code xmlns=
12687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12688: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12689: care of rebuilding the GConf2 database at
12690: installation and deinstallation time, and tells
12691: the package where to install GConf2 data files
12692: using some standard configure arguments. It also
12693: disallows any access to the database directly
12694: from the package.</p>
12695: </li>
12696:
12697: <li>
12698: <p>Ensure that the package installs its
1.45 wiz 12699: <code xmlns=
12700: "http://www.w3.org/TR/xhtml1/transitional" class=
12701: "filename">.schemas</code> files under
12702: <code xmlns=
12703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12704: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 12705: If they get installed under <code xmlns=
12706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12707: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 12708: manually patch the package.</p>
12709: </li>
12710:
12711: <li>
12712: <p>Check the PLIST and remove any entries under
12713: the etc/gconf directory, as they will be handled
12714: automatically. See <a href="#faq.conf" title=
1.38 dillo 12715: "7.14. How do I change the location of configuration files?">
12716: Section 7.14, “How do I change the
1.35 jmmv 12717: location of configuration files?”</a> for
12718: more information.</p>
1.1 grant 12719: </li>
12720:
12721: <li>
1.14 xtraeme 12722: <p>Define the <code class=
12723: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 12724: <code xmlns=
12725: "http://www.w3.org/TR/xhtml1/transitional" class=
12726: "filename">Makefile</code> with a list of all
12727: <code xmlns=
12728: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12729: "filename">.schemas</code> files installed by the
12730: package, if any. Names must not contain any
12731: directories in them.</p>
1.1 grant 12732: </li>
12733:
12734: <li>
1.14 xtraeme 12735: <p>Define the <code class=
12736: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 12737: <code xmlns=
12738: "http://www.w3.org/TR/xhtml1/transitional" class=
12739: "filename">Makefile</code> with a list of all
12740: <code xmlns=
12741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12742: "filename">.entries</code> files installed by the
12743: package, if any. Names must not contain any
12744: directories in them.</p>
1.1 grant 12745: </li>
12746: </ol>
12747: </div>
12748: </div>
12749:
12750: <div class="sect2" lang="en" xml:lang="en">
12751: <div class="titlepage">
12752: <div>
12753: <div>
1.30 wiz 12754: <h3 class="title"><a name=
12755: "scrollkeeper-data-files" id=
1.38 dillo 12756: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 12757: installing scrollkeeper data files</h3>
1.1 grant 12758: </div>
12759: </div>
12760: </div>
12761:
1.45 wiz 12762: <p>If a package installs <code xmlns=
12763: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12764: "filename">.omf</code> files, used by scrollkeeper, you
12765: need to take some extra steps to make sure they get
12766: registered in the database:</p>
1.1 grant 12767:
12768: <div class="orderedlist">
12769: <ol type="1">
12770: <li>
1.45 wiz 12771: <p>Include <code xmlns=
12772: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12773: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 12774: instead of its <code xmlns=
12775: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12776: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12777: care of rebuilding the scrollkeeper database at
12778: installation and deinstallation time, and
12779: disallows any access to it directly from the
12780: package.</p>
12781: </li>
12782:
12783: <li>
12784: <p>Check the PLIST and remove any entries under
1.45 wiz 12785: the <code xmlns=
12786: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12787: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 12788: as they will be handled automatically.</p>
12789: </li>
12790:
12791: <li>
1.45 wiz 12792: <p>Remove the <code xmlns=
12793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12794: "filename">share/omf</code> directory from the
12795: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 12796: </li>
12797: </ol>
12798: </div>
12799: </div>
12800:
12801: <div class="sect2" lang="en" xml:lang="en">
12802: <div class="titlepage">
12803: <div>
12804: <div>
1.30 wiz 12805: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 12806: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 12807: X11 fonts</h3>
12808: </div>
12809: </div>
12810: </div>
12811:
12812: <p>If a package installs font files, you will need to
12813: rebuild the fonts database in the directory where they
12814: get installed at installation and deinstallation time.
1.45 wiz 12815: This can be automatically done by using <code xmlns=
12816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12817: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 12818: include in your <code xmlns=
12819: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12820: "filename">Makefile</code>.</p>
1.1 grant 12821:
12822: <p>When the file is included, you can list the
1.14 xtraeme 12823: directories where fonts are installed in the
12824: <code class="varname">FONTS_<em class=
12825: "replaceable"><code>type</code></em>_DIRS</code>
12826: variables, where <em class=
12827: "replaceable"><code>type</code></em> can be one of
12828: “<span class="quote">TTF</span>”,
1.1 grant 12829: “<span class="quote">TYPE1</span>” or
12830: “<span class="quote">X11</span>”. Also make
1.45 wiz 12831: sure that the database file <code xmlns=
12832: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12833: "filename">fonts.dir</code> is not listed in the
1.1 grant 12834: PLIST.</p>
12835:
12836: <p>Note that you should not create new directories for
12837: fonts; instead use the standard ones to avoid that the
12838: user needs to manually configure his X server to find
12839: them.</p>
12840: </div>
12841:
12842: <div class="sect2" lang="en" xml:lang="en">
12843: <div class="titlepage">
12844: <div>
12845: <div>
1.30 wiz 12846: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 12847: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 12848: installing GTK2 modules</h3>
1.1 grant 12849: </div>
12850: </div>
12851: </div>
12852:
12853: <p>If a package installs gtk2 immodules or loaders, you
12854: need to take some extra steps to get them registered in
12855: the GTK2 database properly:</p>
12856:
12857: <div class="orderedlist">
12858: <ol type="1">
12859: <li>
1.45 wiz 12860: <p>Include <code xmlns=
12861: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12862: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 12863: instead of its <code xmlns=
12864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12865: "filename">buildlink3.mk</code> file. This takes
12866: care of rebuilding the database at installation
12867: and deinstallation time.</p>
1.1 grant 12868: </li>
12869:
12870: <li>
1.14 xtraeme 12871: <p>Set <code class=
12872: "varname">GTK2_IMMODULES=YES</code> if your
12873: package installs GTK2 immodules.</p>
1.1 grant 12874: </li>
12875:
12876: <li>
1.14 xtraeme 12877: <p>Set <code class=
12878: "varname">GTK2_LOADERS=YES</code> if your package
12879: installs GTK2 loaders.</p>
1.1 grant 12880: </li>
12881:
12882: <li>
12883: <p>Patch the package to not touch any of the gtk2
12884: databases directly. These are:</p>
12885:
12886: <div class="itemizedlist">
12887: <ul type="disc">
12888: <li>
1.45 wiz 12889: <p><code xmlns=
12890: "http://www.w3.org/TR/xhtml1/transitional"
12891: class=
1.14 xtraeme 12892: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 12893: </li>
12894:
12895: <li>
1.45 wiz 12896: <p><code xmlns=
12897: "http://www.w3.org/TR/xhtml1/transitional"
12898: class=
1.14 xtraeme 12899: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 12900: </li>
12901: </ul>
12902: </div>
12903: </li>
12904:
12905: <li>
12906: <p>Check the PLIST and remove any entries under
1.45 wiz 12907: the <code xmlns=
12908: "http://www.w3.org/TR/xhtml1/transitional" class=
12909: "filename">libdata/gtk-2.0</code> directory, as
12910: they will be handled automatically.</p>
1.1 grant 12911: </li>
12912: </ol>
12913: </div>
12914: </div>
12915:
12916: <div class="sect2" lang="en" xml:lang="en">
12917: <div class="titlepage">
12918: <div>
12919: <div>
1.30 wiz 12920: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 12921: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 12922: installing SGML or XML data</h3>
1.1 grant 12923: </div>
12924: </div>
12925: </div>
12926:
12927: <p>If a package installs SGML or XML data files that
12928: need to be registered in system-wide catalogs (like
12929: DTDs, sub-catalogs, etc.), you need to take some extra
12930: steps:</p>
12931:
12932: <div class="orderedlist">
12933: <ol type="1">
12934: <li>
1.45 wiz 12935: <p>Include <code xmlns=
12936: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12937: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 12938: in your <code xmlns=
12939: "http://www.w3.org/TR/xhtml1/transitional" class=
12940: "filename">Makefile</code>, which takes care of
12941: registering those files in system-wide catalogs
12942: at installation and deinstallation time.</p>
1.1 grant 12943: </li>
12944:
12945: <li>
1.14 xtraeme 12946: <p>Set <code class="varname">SGML_CATALOGS</code>
12947: to the full path of any SGML catalogs installed
12948: by the package.</p>
1.1 grant 12949: </li>
12950:
12951: <li>
1.14 xtraeme 12952: <p>Set <code class="varname">XML_CATALOGS</code>
12953: to the full path of any XML catalogs installed by
1.1 grant 12954: the package.</p>
12955: </li>
12956:
12957: <li>
1.14 xtraeme 12958: <p>Set <code class="varname">SGML_ENTRIES</code>
12959: to individual entries to be added to the SGML
1.1 grant 12960: catalog. These come in groups of three strings;
12961: see xmlcatmgr(1) for more information
12962: (specifically, arguments recognized by the 'add'
12963: action). Note that you will normally not use this
12964: variable.</p>
12965: </li>
12966:
12967: <li>
1.14 xtraeme 12968: <p>Set <code class="varname">XML_ENTRIES</code>
12969: to individual entries to be added to the XML
1.1 grant 12970: catalog. These come in groups of three strings;
12971: see xmlcatmgr(1) for more information
12972: (specifically, arguments recognized by the 'add'
12973: action). Note that you will normally not use this
12974: variable.</p>
12975: </li>
12976: </ol>
12977: </div>
12978: </div>
12979:
12980: <div class="sect2" lang="en" xml:lang="en">
12981: <div class="titlepage">
12982: <div>
12983: <div>
1.30 wiz 12984: <h3 class="title"><a name="mime-database" id=
1.38 dillo 12985: "mime-database"></a>15.5.13. Packages
1.30 wiz 12986: installing extensions to the MIME database</h3>
1.1 grant 12987: </div>
12988: </div>
12989: </div>
12990:
12991: <p>If a package provides extensions to the MIME
1.45 wiz 12992: database by installing <code xmlns=
12993: "http://www.w3.org/TR/xhtml1/transitional" class=
12994: "filename">.xml</code> files inside <code xmlns=
12995: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12996: "filename">${PREFIX}/share/mime/packages</code>, you
12997: need to take some extra steps to ensure that the
12998: database is kept consistent with respect to these new
12999: files:</p>
1.1 grant 13000:
13001: <div class="orderedlist">
13002: <ol type="1">
13003: <li>
1.45 wiz 13004: <p>Include <code xmlns=
13005: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13006: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13007: (avoid using the <code xmlns=
13008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13009: "filename">buildlink3.mk</code> file from this
13010: same directory, which is reserved for inclusion
1.45 wiz 13011: from other <code xmlns=
13012: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13013: "filename">buildlink3.mk</code> files). It takes
13014: care of rebuilding the MIME database at
13015: installation and deinstallation time, and
13016: disallows any access to it directly from the
1.1 grant 13017: package.</p>
13018: </li>
13019:
13020: <li>
13021: <p>Check the PLIST and remove any entries under
1.45 wiz 13022: the <code xmlns=
13023: "http://www.w3.org/TR/xhtml1/transitional" class=
13024: "filename">share/mime</code> directory,
13025: <span class="emphasis"><em>except</em></span> for
13026: files saved under <code xmlns=
13027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13028: "filename">share/mime/packages</code>. The former
1.1 grant 13029: are handled automatically by the
13030: update-mime-database program, but the later are
13031: package-dependent and must be removed by the
13032: package that installed them in the first
13033: place.</p>
13034: </li>
13035:
13036: <li>
1.45 wiz 13037: <p>Remove any <code xmlns=
13038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13039: "filename">share/mime/*</code> directories from
13040: the PLIST. They will be handled by the
1.1 grant 13041: shared-mime-info package.</p>
13042: </li>
13043: </ol>
13044: </div>
13045: </div>
13046:
13047: <div class="sect2" lang="en" xml:lang="en">
13048: <div class="titlepage">
13049: <div>
13050: <div>
1.30 wiz 13051: <h3 class="title"><a name="intltool" id=
1.38 dillo 13052: "intltool"></a>15.5.14. Packages using
1.1 grant 13053: intltool</h3>
13054: </div>
13055: </div>
13056: </div>
13057:
13058: <p>If a package uses intltool during its build, include
1.45 wiz 13059: the <code xmlns=
13060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13061: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13062: file, which forces it to use the intltool package
13063: provided by pkgsrc, instead of the one bundled with the
13064: distribution file.</p>
13065:
13066: <p>This tracks intltool's build-time dependencies and
13067: uses the latest available version; this way, the
13068: package benefits of any bug fixes that may have
13069: appeared since it was released.</p>
13070: </div>
1.18 xtraeme 13071:
13072: <div class="sect2" lang="en" xml:lang="en">
13073: <div class="titlepage">
13074: <div>
13075: <div>
1.30 wiz 13076: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 13077: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13078: installing startup scripts</h3>
1.18 xtraeme 13079: </div>
13080: </div>
13081: </div>
13082:
13083: <p>If a package contains a rc.d script, it won't be
13084: copied into the startup directory by default, but you
13085: can enable it, by adding the option <code class=
1.45 wiz 13086: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13087: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13088: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13089: the scripts into <code xmlns=
13090: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13091: "filename">/etc/rc.d</code> when a package is
13092: installed, and it will automatically remove the scripts
13093: when the package is deinstalled.</p>
13094: </div>
1.1 grant 13095: </div>
13096:
13097: <div class="sect1" lang="en" xml:lang="en">
13098: <div class="titlepage">
13099: <div>
13100: <div>
13101: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13102: "feedback-to-author" id=
1.38 dillo 13103: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13104: author</h2>
1.1 grant 13105: </div>
13106: </div>
13107: </div>
13108:
13109: <p>If you have found any bugs in the package you make
13110: available, if you had to do special steps to make it run
13111: under NetBSD or if you enhanced the software in various
13112: other ways, be sure to report these changes back to the
13113: original author of the program! With that kind of
13114: support, the next release of the program can incorporate
13115: these fixes, and people not using the NetBSD packages
13116: system can win from your efforts.</p>
13117:
13118: <p>Support the idea of free software!</p>
13119: </div>
13120: </div>
13121:
13122: <div class="chapter" lang="en" xml:lang="en">
13123: <div class="titlepage">
13124: <div>
13125: <div>
13126: <h2 class="title"><a name="debug" id=
1.38 dillo 13127: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13128: </div>
13129: </div>
13130: </div>
13131:
13132: <p>To check out all the gotchas when building a package,
13133: here are the steps that I do in order to get a package
13134: working. Please note this is basically the same as what was
13135: explained in the previous sections, only with some
13136: debugging aids.</p>
13137:
13138: <div class="itemizedlist">
13139: <ul type="disc">
13140: <li>
1.14 xtraeme 13141: <p>Be sure to set <code class=
1.45 wiz 13142: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13143: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13144: "filename">/etc/mk.conf</code></p>
1.1 grant 13145: </li>
13146:
13147: <li>
13148: <p>Install <a xmlns=
13149: "http://www.w3.org/TR/xhtml1/transitional" href=
13150: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13151: target="_top"><code xmlns="" class=
13152: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13153: directory for a new package, change into it, then run
13154: <span><strong class=
13155: "command">url2pkg</strong></span>:</p>
1.1 grant 13156: <pre class="screen">
1.14 xtraeme 13157: <code class="prompt">%</code> <strong class=
13158: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13159: "replaceable"><code>category</code></em>/<em class=
13160: "replaceable"><code>examplepkg</code></em></code></strong>
13161: <code class="prompt">%</code> <strong class=
13162: "userinput"><code>cd /usr/pkgsrc/<em class=
13163: "replaceable"><code>category</code></em>/<em class=
13164: "replaceable"><code>examplepkg</code></em></code></strong>
13165: <code class="prompt">%</code> <strong class=
13166: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13167: </pre>
13168: </li>
13169:
13170: <li>
1.45 wiz 13171: <p>Edit the <code xmlns=
13172: "http://www.w3.org/TR/xhtml1/transitional" class=
13173: "filename">Makefile</code> as requested.</p>
1.1 grant 13174: </li>
13175:
13176: <li>
1.45 wiz 13177: <p>Fill in the <code xmlns=
13178: "http://www.w3.org/TR/xhtml1/transitional" class=
13179: "filename">DESCR</code> file</p>
1.1 grant 13180: </li>
13181:
13182: <li>
1.14 xtraeme 13183: <p>Run <span><strong class="command">make
13184: configure</strong></span></p>
1.1 grant 13185: </li>
13186:
13187: <li>
13188: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13189: and the configure step to the package's <code xmlns=
13190: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13191: "filename">Makefile</code>.</p>
1.1 grant 13192: </li>
13193:
13194: <li>
13195: <p>Make the package compile, doing multiple rounds
13196: of</p>
13197: <pre class="screen">
1.14 xtraeme 13198: <code class="prompt">%</code> <strong class=
13199: "userinput"><code>make</code></strong>
13200: <code class="prompt">%</code> <strong class=
13201: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13202: <code class="prompt">%</code> <strong class=
13203: "userinput"><code>mkpatches</code></strong>
13204: <code class="prompt">%</code> <strong class=
13205: "userinput"><code>patchdiff</code></strong>
13206: <code class="prompt">%</code> <strong class=
13207: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13208: <code class="prompt">%</code> <strong class=
13209: "userinput"><code>make mps</code></strong>
13210: <code class="prompt">%</code> <strong class=
13211: "userinput"><code>make clean</code></strong>
1.1 grant 13212: </pre>
13213:
13214: <p>Doing as non-root user will ensure that no files
13215: are modified that shouldn't be, especially during the
1.14 xtraeme 13216: build phase. <span><strong class=
13217: "command">mkpatches</strong></span>,
13218: <span><strong class=
13219: "command">patchdiff</strong></span> and
13220: <span><strong class="command">pkgvi</strong></span>
13221: are from the <a xmlns=
1.1 grant 13222: "http://www.w3.org/TR/xhtml1/transitional" href=
13223: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13224: target="_top"><code xmlns="" class=
13225: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13226: </li>
13227:
13228: <li>
1.45 wiz 13229: <p>Look at the <code xmlns=
13230: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13231: "filename">Makefile</code>, fix if necessary; see
13232: <a href="#components.Makefile" title=
1.38 dillo 13233: "8.1. Makefile">Section 8.1,
1.45 wiz 13234: “<code xmlns=
13235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13236: "filename">Makefile</code>”</a>.</p>
1.1 grant 13237: </li>
13238:
13239: <li>
1.45 wiz 13240: <p>Generate a <code xmlns=
13241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13242: "filename">PLIST</code>:</p>
1.1 grant 13243: <pre class="screen">
1.14 xtraeme 13244: <code class="prompt">#</code> <strong class=
13245: "userinput"><code>make install</code></strong>
13246: <code class="prompt">#</code> <strong class=
13247: "userinput"><code>make print-PLIST >PLIST</code></strong>
13248: <code class="prompt">#</code> <strong class=
13249: "userinput"><code>make deinstall</code></strong>
13250: <code class="prompt">#</code> <strong class=
13251: "userinput"><code>make install</code></strong>
13252: <code class="prompt">#</code> <strong class=
13253: "userinput"><code>make deinstall</code></strong>
1.1 grant 13254: </pre>
13255:
1.45 wiz 13256: <p>You usually need to be <code xmlns=
13257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13258: "username">root</code> to do this. Look if there are
1.1 grant 13259: any files left:</p>
13260: <pre class="screen">
1.14 xtraeme 13261: <code class="prompt">#</code> <strong class=
13262: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13263: </pre>
13264:
13265: <p>If this reveals any files that are missing in
1.45 wiz 13266: <code xmlns=
13267: "http://www.w3.org/TR/xhtml1/transitional" class=
13268: "filename">PLIST</code>, add them.</p>
1.1 grant 13269: </li>
13270:
13271: <li>
1.45 wiz 13272: <p>Now that the <code xmlns=
13273: "http://www.w3.org/TR/xhtml1/transitional" class=
13274: "filename">PLIST</code> is OK, install the package
13275: again and make a binary package:</p>
1.1 grant 13276: <pre class="screen">
1.14 xtraeme 13277: <code class="prompt">#</code> <strong class=
13278: "userinput"><code>make reinstall</code></strong>
13279: <code class="prompt">#</code> <strong class=
13280: "userinput"><code>make package</code></strong>
1.1 grant 13281: </pre>
13282: </li>
13283:
13284: <li>
13285: <p>Delete the installed package:</p>
13286: <pre class="screen">
1.14 xtraeme 13287: <code class="prompt">#</code> <strong class=
13288: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13289: </pre>
13290: </li>
13291:
13292: <li>
1.14 xtraeme 13293: <p>Repeat the above <span><strong class=
13294: "command">make print-PLIST</strong></span> command,
13295: which shouldn't find anything now:</p>
1.1 grant 13296: <pre class="screen">
1.14 xtraeme 13297: <code class="prompt">#</code> <strong class=
13298: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13299: </pre>
13300: </li>
13301:
13302: <li>
13303: <p>Reinstall the binary package:</p>
13304: <pre class="screen">
1.14 xtraeme 13305: <code class="prompt">#</code> <strong class=
13306: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13307: </pre>
13308: </li>
13309:
13310: <li>
13311: <p>Play with it. Make sure everything works.</p>
13312: </li>
13313:
13314: <li>
1.14 xtraeme 13315: <p>Run <span><strong class=
13316: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 13317: "http://www.w3.org/TR/xhtml1/transitional" href=
13318: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13319: target="_top"><code xmlns="" class=
13320: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 13321: problems it reports:</p>
1.1 grant 13322: <pre class="screen">
1.14 xtraeme 13323: <code class="prompt">#</code> <strong class=
13324: "userinput"><code>pkglint</code></strong>
1.1 grant 13325: </pre>
13326: </li>
13327:
13328: <li>
13329: <p>Submit (or commit, if you have cvs access); see
13330: <a href="#submit" title=
1.38 dillo 13331: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 13332: <i>Submitting and Committing</i></a>.</p>
13333: </li>
13334: </ul>
13335: </div>
13336: </div>
13337:
13338: <div class="chapter" lang="en" xml:lang="en">
13339: <div class="titlepage">
13340: <div>
13341: <div>
13342: <h2 class="title"><a name="submit" id=
1.38 dillo 13343: "submit"></a>Chapter 17. Submitting and
1.1 grant 13344: Committing</h2>
13345: </div>
13346: </div>
13347: </div>
13348:
13349: <div class="toc">
13350: <p><b>Table of Contents</b></p>
13351:
13352: <dl>
1.30 wiz 13353: <dt><span class="sect1"><a href=
1.38 dillo 13354: "#submitting-your-package">17.1. Submitting your
1.30 wiz 13355: packages</a></span></dt>
1.1 grant 13356:
1.30 wiz 13357: <dt><span class="sect1"><a href=
1.41 wiz 13358: "#general-notes-for-changes">17.2. General notes when
13359: adding, updating, or removing packages</a></span></dt>
13360:
13361: <dt><span class="sect1"><a href=
13362: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 13363: package into CVS</a></span></dt>
1.1 grant 13364:
1.30 wiz 13365: <dt><span class="sect1"><a href=
1.41 wiz 13366: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 13367: version</a></span></dt>
1.1 grant 13368:
1.41 wiz 13369: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 13370: Moving a package in pkgsrc</a></span></dt>
1.1 grant 13371: </dl>
13372: </div>
13373:
13374: <div class="sect1" lang="en" xml:lang="en">
13375: <div class="titlepage">
13376: <div>
13377: <div>
13378: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13379: "submitting-your-package" id=
1.38 dillo 13380: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 13381: your packages</h2>
1.1 grant 13382: </div>
13383: </div>
13384: </div>
13385:
13386: <p>You have to separate between binary and
13387: “<span class="quote">normal</span>” (source)
13388: packages here:</p>
13389:
13390: <div class="itemizedlist">
13391: <ul type="disc">
13392: <li>
13393: <p>precompiled binary packages</p>
13394:
13395: <p>Our policy is that we accept binaries only from
13396: pkgsrc developers to guarantee that the packages
13397: don't contain any trojan horses etc. This is not to
1.13 hubertf 13398: annoy anyone but rather to protect our users!
1.1 grant 13399: You're still free to put up your home-made binary
1.13 hubertf 13400: packages and tell the world where to get them.
13401: NetBSD developers doing bulk builds and wanting to
13402: upload them please see <a href="#bulk-upload"
1.38 dillo 13403: title="6.3.8. Uploading results of a bulk build">
13404: Section 6.3.8, “Uploading results of a
1.13 hubertf 13405: bulk build”</a>.</p>
1.1 grant 13406: </li>
13407:
13408: <li>
13409: <p>packages</p>
13410:
13411: <p>First, check that your package is complete,
13412: compiles and runs well; see <a href="#debug" title=
1.38 dillo 13413: "Chapter 16. Debugging">Chapter 16,
1.1 grant 13414: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 13415: Next, generate an uuencoded gzipped <a href=
13416: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
13417: <span class="citerefentry"><span class=
13418: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 13419: preferably with all files in a single directory.
1.14 xtraeme 13420: Finally, <span><strong class=
13421: "command">send-pr</strong></span> with category
1.1 grant 13422: “<span class="quote">pkg</span>”, a
13423: synopsis which includes the package name and
13424: version number, a short description of your package
13425: (contents of the COMMENT variable or DESCR file are
13426: OK) and attach the archive to your PR.</p>
13427:
13428: <p>If you want to submit several packages, please
13429: send a separate PR for each one, it's easier for us
13430: to track things that way.</p>
13431:
13432: <p>Alternatively, you can also import new packages
13433: into pkgsrc-wip (“<span class="quote">pkgsrc
13434: work-in-progress</span>”); see the homepage
13435: at <a href="http://pkgsrc-wip.sourceforge.net/"
13436: target=
13437: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
13438: details.</p>
13439: </li>
13440: </ul>
13441: </div>
13442: </div>
13443:
13444: <div class="sect1" lang="en" xml:lang="en">
13445: <div class="titlepage">
13446: <div>
13447: <div>
13448: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13449: "general-notes-for-changes" id=
13450: "general-notes-for-changes"></a>17.2. General
13451: notes when adding, updating, or removing
13452: packages</h2>
13453: </div>
13454: </div>
13455: </div>
13456:
13457: <p>Please note all package additions, updates, moves, and
1.45 wiz 13458: removals in <code xmlns=
13459: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13460: "filename">pkgsrc/doc/CHANGES</code>. It's very important
13461: to keep this file up to date and conforming to the
13462: existing format, because it will be used by scripts to
13463: automatically update pages on <a href=
13464: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 13465: and other sites. Additionally, check the <code xmlns=
13466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13467: "filename">pkgsrc/doc/TODO</code> file and remove the
13468: entry for the package you updated or removed, in case it
13469: was mentioned there.</p>
13470:
13471: <p>There is a make target that helps in creating proper
1.45 wiz 13472: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13473: class="filename">CHANGES</code> entries:
1.41 wiz 13474: <span><strong class="command">make
13475: changes-entry</strong></span>. It uses the optional
13476: <code class="varname">CTYPE</code> and <code class=
13477: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 13478: usage is to first make sure that your <code xmlns=
13479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13480: "filename">CHANGES</code> file is up-to-date (to avoid
13481: having to resolve conflicts later-on) and then to
13482: <span><strong class="command">cd</strong></span> to the
13483: package directory. For package updates,
13484: <span><strong class="command">make
13485: changes-entry</strong></span> is enough. For new
13486: packages, or package moves or removals, set the
13487: <code class="varname">CTYPE</code> variable on the
13488: command line to "Added", "Moved", or "Removed". You can
13489: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 13490: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13491: class="filename">/etc/mk.conf</code> if your local login
13492: name is not the same as your NetBSD login name. Don't
13493: forget to commit the changes to <code xmlns=
13494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13495: "filename">pkgsrc/doc/CHANGES</code>!</p>
13496: </div>
13497:
13498: <div class="sect1" lang="en" xml:lang="en">
13499: <div class="titlepage">
13500: <div>
13501: <div>
13502: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13503: "committing-importing" id=
1.41 wiz 13504: "committing-importing"></a>17.3. Committing:
1.30 wiz 13505: Importing a package into CVS</h2>
1.1 grant 13506: </div>
13507: </div>
13508: </div>
13509:
13510: <p>This section is only of interest for pkgsrc developers
13511: with write access to the pkgsrc repository. Please
13512: remember that cvs imports files relative to the current
13513: working directory, and that the pathname that you give
1.14 xtraeme 13514: the <span><strong class="command">cvs
13515: import</strong></span> command is so that it knows where
13516: to place the files in the repository. Newly created
13517: packages should be imported with a vendor tag of
13518: “<span class="quote">TNF</span>” and a
13519: release tag of “<span class=
13520: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 13521: <pre class="programlisting">
13522: % cd .../pkgsrc/category/pkgname
13523: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
13524: </pre>
13525:
13526: <p>Remember to move the directory from which you imported
13527: out of the way, or cvs will complain the next time you
13528: “<span class="quote">cvs update</span>” your
13529: source tree. Also don't forget to add the new package to
1.45 wiz 13530: the category's <code xmlns=
13531: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13532: "filename">Makefile</code>.</p>
1.1 grant 13533:
13534: <p>The commit message of the initial import should
1.45 wiz 13535: include part of the <code xmlns=
13536: "http://www.w3.org/TR/xhtml1/transitional" class=
13537: "filename">DESCR</code> file, so people reading the
13538: mailing lists know what the package is/does.</p>
1.1 grant 13539:
13540: <p>For new packages, “<span class="quote">cvs
13541: import</span>” is preferred to “<span class=
13542: "quote">cvs add</span>” because the former gets
13543: everything with a single command, and provides a
13544: consistent tag.</p>
13545: </div>
13546:
13547: <div class="sect1" lang="en" xml:lang="en">
13548: <div class="titlepage">
13549: <div>
13550: <div>
13551: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13552: "updating-package" id=
1.41 wiz 13553: "updating-package"></a>17.4. Updating a
1.30 wiz 13554: package to a newer version</h2>
1.1 grant 13555: </div>
13556: </div>
13557: </div>
13558:
13559: <p>Please always put a concise, appropriate and relevant
13560: summary of the changes between old and new versions into
13561: the commit log when updating a package. There are various
13562: reasons for this:</p>
13563:
13564: <div class="itemizedlist">
13565: <ul type="disc">
13566: <li>
13567: <p>A URL is volatile, and can change over time. It
13568: may go away completely or its information may be
13569: overwritten by newer information.</p>
13570: </li>
13571:
13572: <li>
13573: <p>Having the change information between old and
13574: new versions in our CVS repository is very useful
13575: for people who use either cvs or anoncvs.</p>
13576: </li>
13577:
13578: <li>
13579: <p>Having the change information between old and
13580: new versions in our CVS repository is very useful
13581: for people who read the pkgsrc-changes mailing
13582: list, so that they can make tactical decisions
13583: about when to upgrade the package.</p>
13584: </li>
13585: </ul>
13586: </div>
13587:
1.18 xtraeme 13588: <p>Please also recognize that, just because a new version
1.1 grant 13589: of a package has been released, it should not
13590: automatically be upgraded in the CVS repository. We
13591: prefer to be conservative in the packages that are
13592: included in pkgsrc - development or beta packages are not
13593: really the best thing for most places in which pkgsrc is
13594: used. Please use your judgement about what should go into
13595: pkgsrc, and bear in mind that stability is to be
13596: preferred above new and possibly untested features.</p>
13597: </div>
13598:
13599: <div class="sect1" lang="en" xml:lang="en">
13600: <div class="titlepage">
13601: <div>
13602: <div>
13603: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13604: "moving-package" id=
1.41 wiz 13605: "moving-package"></a>17.5. Moving a package in
1.30 wiz 13606: pkgsrc</h2>
1.1 grant 13607: </div>
13608: </div>
13609: </div>
13610:
13611: <div class="orderedlist">
13612: <ol type="1">
13613: <li>
13614: <p>Make a copy of the directory somewhere else.</p>
13615: </li>
13616:
13617: <li>
13618: <p>Remove all CVS dirs.</p>
13619:
13620: <p>Alternatively to the first two steps you can
13621: also do:</p>
13622: <pre class="screen">
1.14 xtraeme 13623: <code class="prompt">%</code> <strong class=
13624: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 13625: </pre>
13626:
13627: <p>and use that for further work.</p>
13628: </li>
13629:
13630: <li>
1.14 xtraeme 13631: <p>Fix <code class="varname">CATEGORIES</code> and
13632: any <code class="varname">DEPENDS</code> paths that
13633: just did “<span class=
1.1 grant 13634: "quote">../package</span>” instead of
13635: “<span class=
13636: "quote">../../category/package</span>”.</p>
13637: </li>
13638:
13639: <li>
1.14 xtraeme 13640: <p><span><strong class="command">cvs
13641: import</strong></span> the modified package in the
13642: new place.</p>
1.1 grant 13643: </li>
13644:
13645: <li>
13646: <p>Check if any package depends on it:</p>
13647: <pre class="screen">
1.14 xtraeme 13648: <code class="prompt">%</code> <strong class=
13649: "userinput"><code>cd /usr/pkgsrc</code></strong>
13650: <code class="prompt">%</code> <strong class=
13651: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 13652: </pre>
13653: </li>
13654:
13655: <li>
13656: <p>Fix paths in packages from step 5 to point to
13657: new location.</p>
13658: </li>
13659:
13660: <li>
1.14 xtraeme 13661: <p><span><strong class="command">cvs rm
13662: (-f)</strong></span> the package at the old
13663: location.</p>
1.1 grant 13664: </li>
13665:
13666: <li>
1.45 wiz 13667: <p>Remove from <code xmlns=
13668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13669: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 13670: </li>
13671:
13672: <li>
1.45 wiz 13673: <p>Add to <code xmlns=
13674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13675: "filename">newcategory/Makefile</code>.</p>
1.1 grant 13676: </li>
13677:
13678: <li>
13679: <p>Commit the changed and removed files:</p>
13680: <pre class="screen">
1.14 xtraeme 13681: <code class="prompt">%</code> <strong class=
13682: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 13683: </pre>
13684:
13685: <p>(and any packages from step 5, of course).</p>
13686: </li>
13687: </ol>
13688: </div>
13689: </div>
13690: </div>
13691: </div>
13692:
13693: <div class="appendix" lang="en" xml:lang="en">
13694: <div class="titlepage">
13695: <div>
13696: <div>
13697: <h2 class="title"><a name="examples" id=
1.46 ! gdt 13698: "examples"></a>Appendix A. A simple example
1.1 grant 13699: package: bison</h2>
13700: </div>
13701: </div>
13702: </div>
13703:
13704: <div class="toc">
13705: <p><b>Table of Contents</b></p>
13706:
13707: <dl>
1.46 ! gdt 13708: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 13709: files</a></span></dt>
13710:
13711: <dd>
13712: <dl>
1.30 wiz 13713: <dt><span class="sect2"><a href=
1.46 ! gdt 13714: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 13715:
1.30 wiz 13716: <dt><span class="sect2"><a href=
1.46 ! gdt 13717: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 13718:
1.30 wiz 13719: <dt><span class="sect2"><a href=
1.46 ! gdt 13720: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 13721:
1.30 wiz 13722: <dt><span class="sect2"><a href=
1.46 ! gdt 13723: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 13724: package with <span><strong class=
1.14 xtraeme 13725: "command">pkglint</strong></span></a></span></dt>
1.1 grant 13726: </dl>
13727: </dd>
13728:
1.46 ! gdt 13729: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 13730: Steps for building, installing, packaging</a></span></dt>
1.1 grant 13731: </dl>
13732: </div>
13733:
13734: <p>We checked to find a piece of software that wasn't in the
13735: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 13736: would want to have <span><strong class=
13737: "command">bison</strong></span> when Berkeley
13738: <span><strong class="command">yacc</strong></span> is already
13739: present in the tree is beyond us, but it's useful for the
13740: purposes of this exercise.</p>
1.1 grant 13741:
13742: <div class="sect1" lang="en" xml:lang="en">
13743: <div class="titlepage">
13744: <div>
13745: <div>
13746: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13747: "example-files" id=
1.46 ! gdt 13748: "example-files"></a>A.1. files</h2>
1.1 grant 13749: </div>
13750: </div>
13751: </div>
13752:
13753: <div class="sect2" lang="en" xml:lang="en">
13754: <div class="titlepage">
13755: <div>
13756: <div>
1.30 wiz 13757: <h3 class="title"><a name="example-Makefile" id=
1.46 ! gdt 13758: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 13759: </div>
13760: </div>
13761: </div>
13762: <pre class="programlisting">
1.17 sketch 13763: # $NetBSD$
1.1 grant 13764: #
13765:
13766: DISTNAME= bison-1.25
13767: CATEGORIES= devel
13768: MASTER_SITES= ${MASTER_SITE_GNU}
13769:
13770: MAINTAINER= thorpej@NetBSD.org
13771: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
13772: COMMENT= GNU yacc clone
13773:
13774: GNU_CONFIGURE= yes
13775: INFO_FILES= bison.info
13776:
13777: .include "../../mk/bsd.pkg.mk"
13778: </pre>
13779: </div>
13780:
13781: <div class="sect2" lang="en" xml:lang="en">
13782: <div class="titlepage">
13783: <div>
13784: <div>
1.30 wiz 13785: <h3 class="title"><a name="example-descr" id=
1.46 ! gdt 13786: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 13787: </div>
13788: </div>
13789: </div>
13790: <pre class="programlisting">
13791: GNU version of yacc. Can make re-entrant parsers, and numerous other
13792: improvements. Why you would want this when Berkeley <a href=
13793: "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
13794: of the NetBSD source tree is beyond me.
13795: </pre>
13796: </div>
13797:
13798: <div class="sect2" lang="en" xml:lang="en">
13799: <div class="titlepage">
13800: <div>
13801: <div>
1.30 wiz 13802: <h3 class="title"><a name="example-plist" id=
1.46 ! gdt 13803: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 13804: </div>
13805: </div>
13806: </div>
13807: <pre class="programlisting">
1.17 sketch 13808: @comment $NetBSD$
1.1 grant 13809: bin/bison
13810: man/man1/bison.1.gz
13811: share/bison.simple
13812: share/bison.hairy
13813: </pre>
13814: </div>
13815:
13816: <div class="sect2" lang="en" xml:lang="en">
13817: <div class="titlepage">
13818: <div>
13819: <div>
1.30 wiz 13820: <h3 class="title"><a name=
13821: "checking-package-with-pkglint" id=
1.46 ! gdt 13822: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 13823: a package with <span><strong class=
1.14 xtraeme 13824: "command">pkglint</strong></span></h3>
1.1 grant 13825: </div>
13826: </div>
13827: </div>
13828:
13829: <p>The NetBSD package system comes with <a xmlns=
13830: "http://www.w3.org/TR/xhtml1/transitional" href=
13831: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13832: target="_top"><code xmlns="" class=
13833: "filename">pkgtools/pkglint</code></a> which helps to
13834: check the contents of these files. After installation it
13835: is quite easy to use, just change to the directory of the
1.20 ben 13836: package you wish to examine and execute
13837: <span><strong class=
13838: "command">pkglint</strong></span>:</p>
1.1 grant 13839: <pre class="screen">
1.14 xtraeme 13840: <code class="prompt">$</code> <strong class=
13841: "userinput"><code>pkglint</code></strong>
1.1 grant 13842: looks fine.
13843: </pre>
13844:
13845: <p>Depending on the supplied command line arguments (see
13846: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 13847: e.g. <span><strong class="command">pkglint
13848: -v</strong></span> for a very verbose check.</p>
1.1 grant 13849: </div>
13850: </div>
13851:
13852: <div class="sect1" lang="en" xml:lang="en">
13853: <div class="titlepage">
13854: <div>
13855: <div>
13856: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13857: "steps-for-b-i-p" id=
1.46 ! gdt 13858: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 13859: installing, packaging</h2>
1.1 grant 13860: </div>
13861: </div>
13862: </div>
13863:
13864: <p>Create the directory where the package lives, plus any
13865: auxiliary directories:</p>
13866: <pre class="screen">
1.14 xtraeme 13867: <code class="prompt">#</code> <strong class=
13868: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
13869: <code class="prompt">#</code> <strong class=
13870: "userinput"><code>mkdir bison</code></strong>
13871: <code class="prompt">#</code> <strong class=
13872: "userinput"><code>cd bison</code></strong>
13873: <code class="prompt">#</code> <strong class=
13874: "userinput"><code>mkdir patches</code></strong>
1.1 grant 13875: </pre>
13876:
1.45 wiz 13877: <p>Create <code xmlns=
13878: "http://www.w3.org/TR/xhtml1/transitional" class=
13879: "filename">Makefile</code>, <code xmlns=
13880: "http://www.w3.org/TR/xhtml1/transitional" class=
13881: "filename">DESCR</code> and <code xmlns=
13882: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13883: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 13884: "Chapter 8. Package components - files, directories and contents">
13885: Chapter 8, <i>Package components - files, directories and
1.1 grant 13886: contents</i></a>) then continue with fetching the
13887: distfile:</p>
13888: <pre class="screen">
1.14 xtraeme 13889: <code class="prompt">#</code> <strong class=
13890: "userinput"><code>make fetch</code></strong>
1.1 grant 13891: >> bison-1.25.tar.gz doesn't seem to exist on this system.
13892: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
13893: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13894: ftp: Error retrieving file: 500 Internal error
13895:
13896: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
13897: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13898: ftp: Error retrieving file: 500 Internal error
13899:
13900: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
13901: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13902: Successfully retrieved file.
13903: </pre>
13904:
1.45 wiz 13905: <p>Generate the checksum of the distfile into <code xmlns=
13906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13907: "filename">distinfo</code>:</p>
1.1 grant 13908: <pre class="screen">
1.14 xtraeme 13909: <code class="prompt">#</code> <strong class=
13910: "userinput"><code>make makesum</code></strong>
1.1 grant 13911: </pre>
13912:
13913: <p>Now compile:</p>
13914: <pre class="screen">
1.14 xtraeme 13915: <code class="prompt">#</code> <strong class=
13916: "userinput"><code>make</code></strong>
1.1 grant 13917: >> Checksum OK for bison-1.25.tar.gz.
13918: ===> Extracting for bison-1.25
13919: ===> Patching for bison-1.25
13920: ===> Ignoring empty patch directory
13921: ===> Configuring for bison-1.25
13922: creating cache ./config.cache
13923: checking for gcc... cc
13924: checking whether we are using GNU C... yes
13925: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
13926: checking how to run the C preprocessor... cc -E
13927: checking for minix/config.h... no
13928: checking for POSIXized ISC... no
13929: checking whether cross-compiling... no
13930: checking for ANSI C header files... yes
13931: checking for string.h... yes
13932: checking for stdlib.h... yes
13933: checking for memory.h... yes
13934: checking for working const... yes
13935: checking for working alloca.h... no
13936: checking for alloca... yes
13937: checking for strerror... yes
13938: updating cache ./config.cache
13939: creating ./config.status
13940: creating Makefile
13941: ===> Building for bison-1.25
13942: 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
13943: 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
13944: 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
13945: 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
13946: 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
13947: 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
13948: 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
13949: 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
13950: 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
13951: 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
13952: 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
13953: 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
13954: 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
13955: 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
13956: 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
13957: 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
13958: 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
13959: 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
13960: 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
13961: 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
13962: 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
13963: 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
13964: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
13965: rm -f bison.s1
13966: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
13967: </pre>
13968:
13969: <p>Everything seems OK, so install the files:</p>
13970: <pre class="screen">
1.14 xtraeme 13971: <code class="prompt">#</code> <strong class=
13972: "userinput"><code>make install</code></strong>
1.1 grant 13973: >> Checksum OK for bison-1.25.tar.gz.
13974: ===> Installing for bison-1.25
13975: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
13976: rm -f /usr/pkg/bin/bison
13977: cd /usr/pkg/share; rm -f bison.simple bison.hairy
13978: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
13979: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
13980: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
13981: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
13982: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
13983: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
13984: ===> Registering installation for bison-1.25
13985: </pre>
13986:
13987: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 13988: remove it with <span><strong class="command">pkg_delete
13989: bison</strong></span>. Should you decide that you want a
13990: binary package, do this now:</p>
1.1 grant 13991: <pre class="screen">
1.14 xtraeme 13992: <code class="prompt">#</code> <strong class=
13993: "userinput"><code>make package</code></strong>
1.1 grant 13994: >> Checksum OK for bison-1.25.tar.gz.
13995: ===> Building package for bison-1.25
13996: Creating package bison-1.25.tgz
13997: Registering depends:.
13998: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
13999: </pre>
14000:
14001: <p>Now that you don't need the source and object files any
14002: more, clean up:</p>
14003: <pre class="screen">
1.14 xtraeme 14004: <code class="prompt">#</code> <strong class=
14005: "userinput"><code>make clean</code></strong>
1.1 grant 14006: ===> Cleaning for bison-1.25
14007: </pre>
14008: </div>
14009: </div>
14010:
14011: <div class="appendix" lang="en" xml:lang="en">
14012: <div class="titlepage">
14013: <div>
14014: <div>
14015: <h2 class="title"><a name="logs" id=
1.46 ! gdt 14016: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14017: </div>
14018: </div>
14019: </div>
14020:
14021: <div class="toc">
14022: <p><b>Table of Contents</b></p>
14023:
14024: <dl>
1.46 ! gdt 14025: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14026: Building figlet</a></span></dt>
14027:
1.46 ! gdt 14028: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14029: Packaging figlet</a></span></dt>
14030: </dl>
14031: </div>
14032:
14033: <div class="sect1" lang="en" xml:lang="en">
14034: <div class="titlepage">
14035: <div>
14036: <div>
14037: <h2 class="title" style="clear: both"><a name=
14038: "logs.building" id=
1.46 ! gdt 14039: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14040: </div>
14041: </div>
14042: </div>
14043: <pre class="screen">
1.14 xtraeme 14044: <code class="prompt">#</code> <strong class=
14045: "userinput"><code>make</code></strong>
1.1 grant 14046: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14047: => figlet221.tar.gz doesn't seem to exist on this system.
14048: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14049: => [172219 bytes]
14050: Connected to ftp.plig.net.
14051: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14052: 331 Guest login ok, send your complete e-mail address as password.
14053: 230-You are user #5 of 500 simultaneous users allowed.
14054: 230-
14055: 230- ___ _ _ _
14056: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14057: 230- | _| _| . |_| . | | | . |_| . | _| . |
14058: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14059: 230- |_| |_| |___| |___|
14060: 230-
14061: 230-** Welcome to ftp.plig.org **
14062: 230-
14063: 230-Please note that all transfers from this FTP site are logged. If you
14064: 230-do not like this, please disconnect now.
14065: 230-
14066: 230-This arhive is available via
14067: 230-
14068: 230-HTTP: http://ftp.plig.org/
14069: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14070: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14071: 230-
14072: 230-Please email comments, bug reports and requests for packages to be
14073: 230-mirrored to ftp-admin@plig.org.
14074: 230-
14075: 230-
14076: 230 Logged in anonymously.
14077: Remote system type is UNIX.
14078: Using binary mode to transfer files.
14079: 200 Type okay.
14080: 250 "/pub" is new cwd.
14081: 250-"/pub/figlet" is new cwd.
14082: 250-
14083: 250-Welcome to the figlet archive at ftp.figlet.org
14084: 250-
14085: 250- ftp://ftp.figlet.org/pub/figlet/
14086: 250-
14087: 250-The official FIGlet web page is:
14088: 250- http://www.figlet.org/
14089: 250-
14090: 250-If you have questions, please mailto:info@figlet.org. If you want to
14091: 250-contribute a font or something else, you can email us.
14092: 250
14093: 250 "/pub/figlet/program" is new cwd.
14094: 250 "/pub/figlet/program/unix" is new cwd.
14095: local: figlet221.tar.gz remote: figlet221.tar.gz
14096: 502 Unimplemented command.
14097: 227 Entering Passive Mode (195,40,6,41,246,104)
14098: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14099: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14100: 226 Transfer completed.
14101: 172219 bytes received in 00:02 (75.99 KB/s)
14102: 221 Goodbye.
14103: => Checksum OK for figlet221.tar.gz.
14104: ===> Extracting for figlet-2.2.1nb2
14105: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14106: ===> Patching for figlet-2.2.1nb2
14107: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14108: ===> Overriding tools for figlet-2.2.1nb2
14109: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14110: ===> Configuring for figlet-2.2.1nb2
14111: ===> Building for figlet-2.2.1nb2
14112: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14113: chmod a+x figlet
14114: gcc -O2 -o chkfont chkfont.c
14115: => Unwrapping files-to-be-installed.
1.14 xtraeme 14116: <code class="prompt">#</code>
14117: <code class="prompt">#</code> <strong class=
14118: "userinput"><code>make install</code></strong>
1.1 grant 14119: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14120: ===> Installing for figlet-2.2.1nb2
14121: install -d -o root -g wheel -m 755 /usr/pkg/bin
14122: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14123: mkdir -p /usr/pkg/share/figlet
14124: cp figlet /usr/pkg/bin
14125: cp chkfont /usr/pkg/bin
14126: chmod 555 figlist showfigfonts
14127: cp figlist /usr/pkg/bin
14128: cp showfigfonts /usr/pkg/bin
14129: cp fonts/*.flf /usr/pkg/share/figlet
14130: cp fonts/*.flc /usr/pkg/share/figlet
14131: cp figlet.6 /usr/pkg/man/man6
14132: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14133: <code class="prompt">#</code>
1.1 grant 14134: </pre>
14135: </div>
14136:
14137: <div class="sect1" lang="en" xml:lang="en">
14138: <div class="titlepage">
14139: <div>
14140: <div>
14141: <h2 class="title" style="clear: both"><a name=
14142: "logs.package" id=
1.46 ! gdt 14143: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14144: </div>
14145: </div>
14146: </div>
14147: <pre class="screen">
1.14 xtraeme 14148: <code class="prompt">#</code> <strong class=
14149: "userinput"><code>make package</code></strong>
1.1 grant 14150: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14151: ===> Packaging figlet-2.2.1nb2
14152: ===> Building binary package for figlet-2.2.1nb2
14153: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14154: Using SrcDir value of /usr/pkg
14155: Registering depends:.
1.14 xtraeme 14156: <code class="prompt">#</code>
1.1 grant 14157: </pre>
14158: </div>
14159: </div>
14160:
14161: <div class="appendix" lang="en" xml:lang="en">
14162: <div class="titlepage">
14163: <div>
14164: <div>
14165: <h2 class="title"><a name="ftp-layout" id=
1.46 ! gdt 14166: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14167: FTP server's package archive</h2>
14168: </div>
14169: </div>
14170: </div>
14171:
14172: <p>Layout for precompiled binary packages on
14173: ftp.NetBSD.org:</p>
14174: <pre class="programlisting">
14175: /pub/NetBSD/packages/
14176: distfiles/
14177:
14178: # Unpacked pkgsrc trees
14179: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14180: pkgsrc-2003Q4 -> N/A
14181: pkgsrc-2004Q1/pkgsrc
14182:
14183: # pkgsrc archives
14184: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14185: pkgsrc-2003Q4.tar.gz -> N/A
14186: pkgsrc-2004Q1.tar.gz -> N/A
14187:
14188: # Per pkgsrc-release/OS-release/arch package archives
14189: pkgsrc-2003Q4/
14190: NetBSD-1.6.2/
14191: i386/
14192: All/
14193: archivers/
14194: foo -> ../All/foo
14195: ...
14196: pkgsrc-2004Q1/
14197: NetBSD-1.6.2/
14198: i386/
14199: All/
14200: ...
14201: NetBSD-2.0/
14202: i386/
14203: All/
14204: ...
14205: SunOS-5.9/
14206: sparc/
14207: All/
14208: ...
14209: x86/
14210: All/
14211: ...
14212:
14213: # Per os-release package archive convenience links
14214: NetBSD-1.6.2 -> 1.6.2
14215: 1.6.2/
14216: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14217: m68k/
14218: All/
14219: archivers/
14220: foo -> ../All/foo
14221: ...
14222: amiga -> m68k
14223: atari -> m68k
14224: ...
14225:
14226: 2.0 -> NetBSD-2.0 # backward compat, historic
14227: NetBSD-2.0/
14228: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14229: SunOS-5.9/
14230: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14231: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
14232:
14233: </pre>
14234:
14235: <p>To create:</p>
14236:
14237: <div class="orderedlist">
14238: <ol type="1">
14239: <li>
14240: <p>Run bulk build, see <a href="#bulkbuild" title=
1.38 dillo 14241: "6.3. Doing a bulk build of all packages">Section
14242: 6.3, “Doing a bulk build of all
1.1 grant 14243: packages”</a></p>
14244: </li>
14245:
14246: <li>
14247: <p>Upload /usr/pkgsrc/packages to</p>
14248: <pre class="programlisting">
14249: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 14250: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 14251: `uname -s`-`uname -r`/ # OS & version
14252: `uname -p` # architecture
14253:
14254: </pre>
14255: </li>
14256:
14257: <li>
1.14 xtraeme 14258: <p>If necessary, create a symlink <span><strong class=
14259: "command">ln -s `uname -m` `uname -p`</strong></span>
14260: (amiga -> m68k, ...)</p>
1.1 grant 14261: </li>
14262: </ol>
14263: </div>
14264: </div>
1.2 hubertf 14265:
14266: <div class="appendix" lang="en" xml:lang="en">
14267: <div class="titlepage">
14268: <div>
14269: <div>
14270: <h2 class="title"><a name="editing" id=
1.46 ! gdt 14271: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 14272: for the pkgsrc guide</h2>
14273: </div>
14274: </div>
14275: </div>
14276:
14277: <div class="toc">
14278: <p><b>Table of Contents</b></p>
14279:
14280: <dl>
1.46 ! gdt 14281: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 14282: Targets</a></span></dt>
14283:
1.46 ! gdt 14284: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 14285: Procedure</a></span></dt>
14286: </dl>
14287: </div>
14288:
14289: <p>This section contains information on editing the pkgsrc
14290: guide itself.</p>
14291:
14292: <div class="sect1" lang="en" xml:lang="en">
14293: <div class="titlepage">
14294: <div>
14295: <div>
14296: <h2 class="title" style="clear: both"><a name=
1.46 ! gdt 14297: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 14298: </div>
14299: </div>
14300: </div>
14301:
1.45 wiz 14302: <p>The pkgsrc guide's source code is stored in <code xmlns=
14303: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14304: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14305: are created from it:</p>
14306:
14307: <div class="itemizedlist">
14308: <ul type="disc">
14309: <li>
1.45 wiz 14310: <p><code xmlns=
14311: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14312: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14313: </li>
14314:
14315: <li>
1.45 wiz 14316: <p><code xmlns=
14317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14318: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 14319: </li>
14320:
14321: <li>
1.45 wiz 14322: <p><code xmlns=
14323: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14324: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 14325: the documentation on the NetBSD website will be built
14326: from pkgsrc and kept up to date on the web server
14327: itself. This means you <span class=
14328: "emphasis"><em>must</em></span> make sure that your
14329: changes haven't broken the build!</p>
14330: </li>
1.6 hubertf 14331:
14332: <li>
1.45 wiz 14333: <p><code xmlns=
14334: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14335: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 14336: PDF version of the pkgsrc guide.</p>
14337: </li>
14338:
14339: <li>
1.45 wiz 14340: <p><code xmlns=
14341: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14342: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 14343: PostScript version of the pkgsrc guide.</p>
14344: </li>
1.2 hubertf 14345: </ul>
14346: </div>
14347: </div>
14348:
14349: <div class="sect1" lang="en" xml:lang="en">
14350: <div class="titlepage">
14351: <div>
14352: <div>
14353: <h2 class="title" style="clear: both"><a name=
1.30 wiz 14354: "procedure" id=
1.46 ! gdt 14355: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 14356: </div>
14357: </div>
14358: </div>
14359:
14360: <p>The procedure to edit the pkgsrc guide is:</p>
14361:
14362: <div class="itemizedlist">
14363: <ul type="disc">
14364: <li>
1.6 hubertf 14365: <p>Make sure you have the packages needed to
14366: re-generate the pkgsrc guide (and other XML-based
14367: NetBSD documentation) installed. These are
1.11 ben 14368: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 14369: for creating the ASCII- and HTML-version, and
14370: “<span class=
1.11 ben 14371: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 14372: PostScript- and PDF version. You will need both
14373: packages installed, to make sure documentation is
14374: consistent across all formats. The packages can be
1.45 wiz 14375: found in <code xmlns=
14376: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14377: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 14378: <code xmlns=
14379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14380: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 14381: </li>
14382:
14383: <li>
1.45 wiz 14384: <p>Edit the XML file(s) in <code xmlns=
14385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14386: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 14387: </li>
14388:
14389: <li>
1.14 xtraeme 14390: <p>Run <span><strong class="command">make extract
14391: && make do-lint</strong></span> in
1.45 wiz 14392: <code xmlns=
14393: "http://www.w3.org/TR/xhtml1/transitional" class=
14394: "filename">pkgsrc/doc/guide</code> to check the XML
14395: syntax, and fix it if needed.</p>
1.4 hubertf 14396: </li>
14397:
14398: <li>
1.14 xtraeme 14399: <p>Run <span><strong class=
1.45 wiz 14400: "command">make</strong></span> in <code xmlns=
14401: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14402: "filename">pkgsrc/doc/guide</code> to build the HTML
14403: and ASCII version.</p>
1.2 hubertf 14404: </li>
14405:
14406: <li>
1.14 xtraeme 14407: <p>If all is well, run <span><strong class=
14408: "command">make install-doc</strong></span> to put the
1.45 wiz 14409: generated files into <code xmlns=
14410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14411: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 14412: </li>
14413:
14414: <li>
1.14 xtraeme 14415: <p><span><strong class="command">cvs commit
14416: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 14417: </li>
14418:
14419: <li>
1.14 xtraeme 14420: <p><span><strong class="command">cvs commit -m
14421: re-generate
14422: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 14423: </li>
1.4 hubertf 14424:
14425: <li>
14426: <p>Until the webserver on www.NetBSD.org is really
14427: updated automatically to pick up changes to the
1.14 xtraeme 14428: pkgsrc guide automatically, also run
1.18 xtraeme 14429: <span><strong class="command">make install-htdocs
1.14 xtraeme 14430: HTDOCSDIR=../../../htdocs</strong></span> (or
14431: similar, adjust <code class=
14432: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 14433: </li>
14434:
14435: <li>
1.14 xtraeme 14436: <p><span><strong class="command">cvs commit
14437: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 14438: </li>
1.2 hubertf 14439: </ul>
14440: </div>
14441: </div>
14442: </div>
1.1 grant 14443: </div>
14444: </body>
14445: </html>
CVSweb <webmaster@jp.NetBSD.org>