Annotation of pkgsrc/doc/pkgsrc.html, revision 1.47
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=
1.47 ! reed 142: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 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.47 ! reed 288: sandbox for chrooted 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.47 ! reed 506: "#manpage-compression">10.5. Man
! 507: page-compression</a></span></dt>
1.1 grant 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.47 ! reed 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.47 ! reed 614: software where configuration files
1.35 jmmv 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:
1.47 ! reed 1014: <p>There is a lot of software freely available for
! 1015: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 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
1.47 ! reed 1280: be constructed from all the files in the distfile by
1.1 grant 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=
1.47 ! reed 1348: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 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.47 ! reed 1493: sandbox for chrooted 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=
1.47 ! reed 1735: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 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>
1.47 ! reed 1857:
! 1858: <div class="note" style=
! 1859: "margin-left: 0.5in; margin-right: 0.5in;">
! 1860: <h3 class="title">Note</h3>
! 1861:
! 1862: <p>The bootstrap installs a <span><strong class=
! 1863: "command">bmake</strong></span> tool. Use this
! 1864: <span><strong class="command">bmake</strong></span>
! 1865: when building via pkgsrc. For examples in this guide,
! 1866: use <span><strong class="command">bmake</strong></span>
! 1867: instead of “<span class=
! 1868: "quote">make</span>”.</p>
! 1869: </div>
1.1 grant 1870: </div>
1871:
1872: <div class="sect1" lang="en" xml:lang="en">
1873: <div class="titlepage">
1874: <div>
1875: <div>
1876: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1877: "platform-specific-notes" id=
1.47 ! reed 1878: "platform-specific-notes"></a>3.2. Platform-specific
! 1879: notes</h2>
1.1 grant 1880: </div>
1881: </div>
1882: </div>
1883:
1884: <p>Here are some platform-specific notes you should be
1885: aware of.</p>
1886:
1887: <div class="sect2" lang="en" xml:lang="en">
1888: <div class="titlepage">
1889: <div>
1890: <div>
1.30 wiz 1891: <h3 class="title"><a name="darwin" id=
1892: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1893: </div>
1894: </div>
1895: </div>
1896:
1897: <p>Darwin 5.x and 6.x are supported. There are two
1898: methods of using pkgsrc on Mac OS X, by using a
1899: <a href="#platform.osx-image" title=
1900: "3.2.1.1. Using a disk image">disk image</a>, or a
1901: <a href="#platform.osx-ufs" title=
1902: "3.2.1.2. Using a UFS partition">UFS
1903: partition</a>.</p>
1904:
1905: <p>Before you start, you will need to download and
1906: install the Mac OS X Developer Tools from Apple's
1907: Developer Connection. See <a href=
1908: "http://developer.apple.com/macosx/" target=
1909: "_top">http://developer.apple.com/macosx/</a> for
1910: details. Also, make sure you install X11 for Mac OS X
1911: and the X11 SDK from <a href=
1912: "http://www.apple.com/macosx/x11/download/" target=
1913: "_top">http://www.apple.com/macosx/x11/download/</a> if
1914: you intend to build packages that use the X11 Window
1915: System.</p>
1916:
1917: <p>If you already have a UFS partition, or have a spare
1918: partition that you can format as UFS, it is recommended
1919: to use that instead of the disk image. It'll be
1920: somewhat faster and will mount automatically at boot
1921: time, where you must manually mount a disk image.</p>
1922:
1923: <div class="note" style=
1924: "margin-left: 0.5in; margin-right: 0.5in;">
1925: <h3 class="title">Note</h3>
1926:
1927: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 ! reed 1928: because pkgsrc currently requires the file system to
1.1 grant 1929: be case-sensitive, and HFS+ is not.</p>
1930: </div>
1931:
1932: <div class="sect3" lang="en" xml:lang="en">
1933: <div class="titlepage">
1934: <div>
1935: <div>
1936: <h4 class="title"><a name="platform.osx-image"
1937: id="platform.osx-image"></a>3.2.1.1. Using
1938: a disk image</h4>
1939: </div>
1940: </div>
1941: </div>
1942:
1943: <p>Create the disk image:</p>
1944: <pre class="screen">
1.14 xtraeme 1945: <code class="prompt">#</code> <strong class=
1946: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1947: <code class="prompt">#</code> <strong class=
1948: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1949: <code class="prompt">#</code> <strong class=
1950: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1951: <code class="prompt">#</code> <strong class=
1952: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1953: </pre>
1954:
1955: <p>That's it!</p>
1956: </div>
1957:
1958: <div class="sect3" lang="en" xml:lang="en">
1959: <div class="titlepage">
1960: <div>
1961: <div>
1962: <h4 class="title"><a name="platform.osx-ufs"
1963: id="platform.osx-ufs"></a>3.2.1.2. Using a
1964: UFS partition</h4>
1965: </div>
1966: </div>
1967: </div>
1968:
1.45 wiz 1969: <p>By default, <code xmlns=
1970: "http://www.w3.org/TR/xhtml1/transitional" class=
1971: "filename">/usr</code> will be on your root file
1972: system, normally HFS+. It is possible to use the
1973: default <span class="emphasis"><em>prefix</em></span>
1974: of <code xmlns=
1975: "http://www.w3.org/TR/xhtml1/transitional" class=
1976: "filename">/usr/pkg</code> by symlinking <code xmlns=
1977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1978: "filename">/usr/pkg</code> to a directory on a UFS
1979: file system. Obviously, another symlink is required
1980: if you want to place the package database directory
1981: outside the <span class=
1982: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1983: <pre class="screen">
1.14 xtraeme 1984: <code class="prompt">#</code> <strong class=
1.22 tv 1985: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1986: </pre>
1987:
1988: <p>If you created your partitions at the time of
1989: installing Mac OS X and formatted the target
1990: partition as UFS, it should automatically mount on
1.45 wiz 1991: <code xmlns=
1992: "http://www.w3.org/TR/xhtml1/transitional" class=
1993: "filename">/Volumes/<volume name></code> when
1994: the machine boots. If you are (re)formatting a
1995: partition as UFS, you need to ensure that the
1996: partition map correctly reflects “<span class=
1997: "quote">Apple_UFS</span>” and not
1998: “<span class=
1.1 grant 1999: "quote">Apple_HFS</span>”.</p>
2000:
2001: <p>The problem is that none of the disk tools will
2002: let you touch a disk that is booted from. You can
2003: unmount the partition, but even if you newfs it, the
2004: partition type will be incorrect and the automounter
2005: won't mount it. It can be mounted manually, but it
2006: won't appear in Finder.</p>
2007:
2008: <p>You'll need to boot off of the OS X Installation
2009: (User) CD. When the Installation program starts, go
2010: up to the menu and select Disk Utility. Now, you will
2011: be able to select the partition you want to be UFS,
2012: and Format it Apple UFS. Quit the Disk Utility, quit
2013: the installer which will reboot your machine. The new
2014: UFS file system will appear in Finder.</p>
2015:
2016: <p>Be aware that the permissions on the new file
2017: system will be writable by root only.</p>
2018:
2019: <p>This note is as of 10.2 (Jaguar) and applies to
2020: earlier versions. Hopefully Apple will fix Disk
2021: Utility in 10.3 (Panther).</p>
2022: </div>
2023: </div>
2024:
2025: <div class="sect2" lang="en" xml:lang="en">
2026: <div class="titlepage">
2027: <div>
2028: <div>
1.30 wiz 2029: <h3 class="title"><a name="freebsd" id=
2030: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2031: </div>
2032: </div>
2033: </div>
2034:
2035: <p>FreeBSD 4.7 and 5.0 have been tested and are
2036: supported, other versions may work.</p>
2037:
2038: <p>Care should be taken so that the tools that this kit
2039: installs do not conflict with the FreeBSD userland
2040: tools. There are several steps:</p>
2041:
2042: <div class="orderedlist">
2043: <ol type="1">
2044: <li>
2045: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2046: <code xmlns=
2047: "http://www.w3.org/TR/xhtml1/transitional" class=
2048: "filename">/var/db/pkg</code>. It is therefore
2049: recommended that you choose a different location
2050: (e.g. <code xmlns=
2051: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2052: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2053: --pkgdbdir option to the bootstrap script.</p>
2054: </li>
2055:
2056: <li>
2057: <p>If you do not intend to use the FreeBSD ports
2058: tools, it's probably a good idea to move them out
2059: of the way to avoid confusion, e.g.</p>
2060: <pre class="screen">
1.14 xtraeme 2061: <code class="prompt">#</code> <strong class=
2062: "userinput"><code>cd /usr/sbin</code></strong>
2063: <code class="prompt">#</code> <strong class=
2064: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2065: <code class="prompt">#</code> <strong class=
2066: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2067: <code class="prompt">#</code> <strong class=
2068: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2069: <code class="prompt">#</code> <strong class=
2070: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2071: </pre>
2072: </li>
2073:
2074: <li>
1.45 wiz 2075: <p>An example <code xmlns=
2076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2077: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2078: placed in <code xmlns=
2079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2080: "filename">/etc/mk.conf.example</code> file when
2081: you use the bootstrap script.</p>
1.1 grant 2082: </li>
2083: </ol>
2084: </div>
2085: </div>
2086:
2087: <div class="sect2" lang="en" xml:lang="en">
2088: <div class="titlepage">
2089: <div>
2090: <div>
1.30 wiz 2091: <h3 class="title"><a name="interix" id=
2092: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2093: </div>
2094: </div>
2095: </div>
2096:
1.47 ! reed 2097: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2098: Windows NT kernel, providing a Unix-like environment
2099: with a tighter kernel integration than available with
2100: Cygwin. It is part of the Windows Services for Unix
2101: package, available for free for any licensed copy of
1.22 tv 2102: Windows 2000, XP (not including XP Home), or 2003. SFU
2103: can be downloaded from <a href=
2104: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2105: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2106:
2107: <p>Services for Unix 3.5, current as of this writing,
2108: has been tested. 3.0 or 3.1 may work, but are not
2109: officially supported. (The main difference in 3.0/3.1
2110: is lack of pthreads.)</p>
2111:
2112: <div class="sect3" lang="en" xml:lang="en">
2113: <div class="titlepage">
2114: <div>
2115: <div>
2116: <h4 class="title"><a name=
2117: "platform.interix-sfu-install" id=
2118: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2119: installing Interix/SFU</h4>
1.1 grant 2120: </div>
2121: </div>
2122: </div>
2123:
2124: <p>At an absolute minimum, the following packages
2125: must be installed from the Windows Services for Unix
2126: 3.5 distribution in order to use pkgsrc:</p>
2127:
2128: <div class="itemizedlist">
2129: <ul type="disc">
2130: <li>
2131: <p>Utilities -> Base Utilities</p>
2132: </li>
2133:
2134: <li>
2135: <p>Interix GNU Components -> (all)</p>
2136: </li>
2137:
2138: <li>
2139: <p>Remote Connectivity</p>
2140: </li>
2141:
2142: <li>
2143: <p>Interix SDK</p>
2144: </li>
2145: </ul>
2146: </div>
2147:
2148: <p>When using pkgsrc on Interix, DO NOT install the
2149: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2150: without shared module support, installed to
2151: /usr/local, and will only cause confusion. Instead,
2152: install Perl 5.8 from pkgsrc (or from a binary
2153: package).</p>
2154:
2155: <p>The Remote Connectivity subcomponent "Windows
2156: Remote Shell Service" does not need to be installed,
2157: but Remote Connectivity itself should be installed in
2158: order to have a working inetd.</p>
2159:
2160: <p>Finally, during installation you may be asked
2161: whether to enable setuid behavior for Interix
2162: programs, and whether to make pathnames default to
2163: case-sensitive. Setuid should be enabled, and
2164: case-sensitivity MUST be enabled. (Without
2165: case-sensitivity, a large number of packages
2166: including perl will not build.)</p>
2167: </div>
2168:
2169: <div class="sect3" lang="en" xml:lang="en">
2170: <div class="titlepage">
2171: <div>
2172: <div>
2173: <h4 class="title"><a name=
2174: "platform.interix-sfu-postinstall" id=
2175: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2176: to do if Interix/SFU is already installed</h4>
2177: </div>
2178: </div>
2179: </div>
2180:
2181: <p>If SFU is already installed and you wish to alter
2182: these settings to work with pkgsrc, note the
2183: following things.</p>
2184:
2185: <div class="itemizedlist">
2186: <ul type="disc">
2187: <li>
2188: <p>To uninstall UNIX Perl, use Add/Remove
2189: Programs, select Microsoft Windows Services for
2190: UNIX, then click Change. In the installer,
2191: choose Add or Remove, then uncheck
2192: Utilities->UNIX Perl.</p>
2193: </li>
2194:
2195: <li>
1.47 ! reed 2196: <p>To enable case-sensitivity for the file
! 2197: system, run REGEDIT.EXE, and change the
1.1 grant 2198: following registry key:</p>
2199:
2200: <p>
2201: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2202: Manager\kernel</p>
2203:
2204: <p>Set the DWORD value "obcaseinsensitive" to
2205: 0; then reboot.</p>
2206: </li>
2207:
2208: <li>
2209: <p>To enable setuid binaries (optional), run
2210: REGEDIT.EXE, and change the following registry
2211: key:</p>
2212:
2213: <p>
2214: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2215: for UNIX</p>
2216:
2217: <p>Set the DWORD value "EnableSetuidBinaries"
2218: to 1; then reboot.</p>
2219: </li>
2220: </ul>
2221: </div>
2222: </div>
2223:
2224: <div class="sect3" lang="en" xml:lang="en">
2225: <div class="titlepage">
2226: <div>
2227: <div>
2228: <h4 class="title"><a name=
2229: "platform.interix-notes" id=
2230: "platform.interix-notes"></a>3.2.3.3. Important
2231: notes for using pkgsrc</h4>
2232: </div>
2233: </div>
2234: </div>
2235:
2236: <p>The package imanager (either the pkgsrc "su" user,
2237: or the user running "pkg_add") must be a member of
2238: the local Administrators group. Such a user must also
2239: be used to run the bootstrap. This is slightly
2240: relaxed from the normal pkgsrc requirement of
2241: "root".</p>
2242:
2243: <p>The package manager should use a umask of 002.
2244: "make install" will automatically complain if this is
2245: not the case. This ensures that directories written
2246: in /var/db/pkg are Administrators-group
2247: writeable.</p>
2248:
2249: <p>The popular Interix binary packages from
2250: http://www.interopsystems.com/ use an older version
2251: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2252: used in conjunction with pkgsrc. If you choose to use
2253: them at the same time as the pkgsrc packages, ensure
2254: that you use the proper pkg_* tools for each type of
2255: binary package.</p>
1.22 tv 2256:
2257: <p>The TERM setting used for DOS-type console windows
2258: (including those invoked by the csh and ksh startup
2259: shortcuts) is "interix". Most systems don't have a
2260: termcap/terminfo entry for it, but the following
2261: .termcap entry provides adequate emulation in most
2262: cases:</p>
2263: <pre class="programlisting">
2264: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2265: </pre>
1.1 grant 2266: </div>
2267: </div>
2268:
2269: <div class="sect2" lang="en" xml:lang="en">
2270: <div class="titlepage">
2271: <div>
2272: <div>
1.30 wiz 2273: <h3 class="title"><a name="irix" id=
2274: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2275: </div>
2276: </div>
2277: </div>
2278:
2279: <p>You will need a working C compiler, either gcc or
2280: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2281: the <code class="varname">CC</code> environment
2282: variable according to your preference. If you do not
2283: have a license for the MIPSpro compiler suite, you can
1.1 grant 2284: download a gcc tardist file from <a href=
2285: "http://freeware.sgi.com/" target=
2286: "_top">http://freeware.sgi.com/</a>.</p>
2287:
2288: <p>Please note that you will need IRIX 6.5.17 or
2289: higher, as this is the earliest version of IRIX
1.24 wiz 2290: providing support for <a href=
2291: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2292: <span class="citerefentry"><span class=
2293: "refentrytitle">if_indextoname</span>(3)</span></a>,
2294: <a href=
2295: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2296: <span class="citerefentry"><span class=
2297: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2298: etc.</p>
1.1 grant 2299:
1.27 rillig 2300: <p>At this point in time, pkgsrc only supports one ABI
2301: at a time. That is, you can not switch between the old
2302: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2303: you start out using "abi=n32", that's what all your
2304: packages will be built with.</p>
1.1 grant 2305:
2306: <p>Therefore, please make sure that you have no
1.14 xtraeme 2307: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2308: environment or the <code xmlns=
2309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2310: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2311: that you do not try to link n32 object files with lib64
1.45 wiz 2312: or vice versa. Check your <code xmlns=
2313: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2314: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2315:
2316: <p>If you have the actual pkgsrc tree mounted via NFS
2317: from a different host, please make sure to set
1.14 xtraeme 2318: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2319: directory, as it appears that IRIX linker occasionally
1.47 ! reed 2320: runs into issues when trying to link over a
! 2321: network-mounted file system.</p>
1.1 grant 2322:
2323: <p>The bootstrapping process should set all the right
2324: options for programs such as imake(1), but you may want
2325: to set some options depending on your local setup.
1.45 wiz 2326: Please see <code xmlns=
2327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2328: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2329: course, your compiler's man pages for details.</p>
1.22 tv 2330:
2331: <p>If you are using SGI's MIPSPro compiler, please
2332: set</p>
2333: <pre class="programlisting">
2334: PKGSRC_COMPILER=mipspro
2335: </pre>
2336:
1.45 wiz 2337: <p>in <code xmlns=
2338: "http://www.w3.org/TR/xhtml1/transitional" class=
2339: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2340: assume you are using gcc and may end up passing invalid
2341: flags to the compiler. Note that bootstrap should
2342: create an appropriate <code xmlns=
2343: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2344: "filename">mk.conf.example</code> by default.</p>
2345:
2346: <p>If you have both the MIPSPro compiler chain
2347: installed as well as gcc, but want to make sure that
2348: MIPRPro is used, please set your <code class=
2349: "varname">PATH</code> to <span class=
2350: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2351: gcc (often <code xmlns=
2352: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2353: "filename">/usr/freeware/bin</code>), and (important)
2354: pass the '--preserve-path' flag.</p>
1.1 grant 2355: </div>
2356:
2357: <div class="sect2" lang="en" xml:lang="en">
2358: <div class="titlepage">
2359: <div>
2360: <div>
1.30 wiz 2361: <h3 class="title"><a name="linux" id=
2362: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2363: </div>
2364: </div>
2365: </div>
2366:
2367: <p>Some versions of Linux (for example Debian
2368: GNU/Linux) need either libtermcap or libcurses
2369: (libncurses). Installing the distributions
2370: libncurses-dev package (or equivalent) should fix the
2371: problem.</p>
2372:
2373: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2374: and icc (Intel C++ Compiler). gcc is the default. icc
2375: 8.0 and 8.1 on i386 have been tested.</p>
2376:
2377: <p>To bootstrap using icc, assuming the default icc
2378: installation directory:</p>
2379: <pre class="programlisting">
2380: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2381: ac_cv___attribute__=yes ./bootstrap
2382: </pre>
2383:
2384: <div class="note" style=
2385: "margin-left: 0.5in; margin-right: 0.5in;">
2386: <h3 class="title">Note</h3>
2387:
2388: <p>icc 8.1 needs the `-i-static' argument instead of
2389: -static-libcxa.</p>
2390: </div>
2391:
2392: <p>icc supports __attribute__, but the GNU configure
2393: test uses a nested function, which icc does not
2394: support. #undef'ing __attribute__ has the unfortunate
2395: side-effect of breaking many of the Linux header files,
2396: which cannot be compiled properly without
2397: __attribute__. The test must be overridden so that
2398: __attribute__ is assumed supported by the compiler.</p>
2399:
2400: <p>After bootstrapping, you should set <code class=
1.45 wiz 2401: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2402: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2403: "filename">/etc/mk.conf</code>:</p>
2404: <pre class="programlisting">
2405: PKGSRC_COMPILER=icc
2406: </pre>
2407:
2408: <p>The default installation directory for icc is
1.45 wiz 2409: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2410: class="filename">/opt/intel_cc_80</code>, which is also
2411: the pkgsrc default. If you have installed it into a
2412: different directory, set <code class=
2413: "varname">ICCBASE</code> in <code xmlns=
2414: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2415: "filename">/etc/mk.conf</code>:</p>
2416: <pre class="programlisting">
2417: ICCBASE=/opt/icc
2418: </pre>
2419:
2420: <p>pkgsrc uses the static linking method of the runtime
2421: libraries provided by icc, so binaries can be run on
2422: other systems which do not have the shared libraries
2423: installed.</p>
2424:
2425: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2426: the <a href=
2427: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2428: <span class="citerefentry"><span class=
2429: "refentrytitle">ld</span>(1)</span></a> command run
2430: when linking a C++ shared library and records it,
2431: throwing away the -Bstatic and -Bdynamic options
2432: interspersed between the libraries. This means that
2433: libtool-linked C++ shared libraries will have a runtime
2434: dependency on the icc libraries until this is fixed in
2435: libtool.</p>
1.22 tv 2436: </div>
2437:
2438: <div class="sect2" lang="en" xml:lang="en">
2439: <div class="titlepage">
2440: <div>
2441: <div>
1.30 wiz 2442: <h3 class="title"><a name="openbsd" id=
2443: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2444: </div>
2445: </div>
2446: </div>
2447:
2448: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2449:
2450: <p>Care should be taken so that the tools that this kit
2451: installs do not conflict with the OpenBSD userland
2452: tools. There are several steps:</p>
2453:
2454: <div class="orderedlist">
2455: <ol type="1">
2456: <li>
2457: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2458: <code xmlns=
2459: "http://www.w3.org/TR/xhtml1/transitional" class=
2460: "filename">/var/db/pkg</code>. It is therefore
2461: recommended that you choose a different location
2462: (e.g. <code xmlns=
2463: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2464: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2465: --pkgdbdir option to the bootstrap script.</p>
2466: </li>
2467:
2468: <li>
2469: <p>If you do not intend to use the OpenBSD ports
2470: tools, it's probably a good idea to move them out
2471: of the way to avoid confusion, e.g.</p>
2472: <pre class="screen">
1.14 xtraeme 2473: <code class="prompt">#</code> <strong class=
2474: "userinput"><code>cd /usr/sbin</code></strong>
2475: <code class="prompt">#</code> <strong class=
2476: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2477: <code class="prompt">#</code> <strong class=
2478: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2479: <code class="prompt">#</code> <strong class=
2480: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2481: <code class="prompt">#</code> <strong class=
2482: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2483: </pre>
2484: </li>
2485:
2486: <li>
1.45 wiz 2487: <p>An example <code xmlns=
2488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2489: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2490: placed in <code xmlns=
2491: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2492: "filename">/etc/mk.conf.example</code> file when
2493: you use the bootstrap script. OpenBSD's make
1.45 wiz 2494: program uses <code xmlns=
2495: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2496: "filename">/etc/mk.conf</code> as well. You can
1.47 ! reed 2497: work around this by enclosing all the
! 2498: pkgsrc-specific parts of the file with:</p>
1.1 grant 2499: <pre class="programlisting">
2500: .ifdef BSD_PKG_MK
1.11 ben 2501: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2502: .else
2503: # OpenBSD stuff
2504: .endif
2505: </pre>
2506: </li>
2507: </ol>
2508: </div>
2509: </div>
2510:
2511: <div class="sect2" lang="en" xml:lang="en">
2512: <div class="titlepage">
2513: <div>
2514: <div>
1.30 wiz 2515: <h3 class="title"><a name="solaris" id=
2516: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2517: </div>
2518: </div>
2519: </div>
2520:
2521: <p>Solaris 2.6 through 9 are supported on both x86 and
2522: sparc. You will need a working C compiler. Both gcc
2523: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2524:
2525: <p>The following packages are required on Solaris 8 for
2526: the bootstrap process and to build packages.</p>
2527:
2528: <div class="itemizedlist">
2529: <ul type="disc">
2530: <li>
2531: <p>SUNWsprot</p>
2532: </li>
2533:
2534: <li>
2535: <p>SUNWarc</p>
2536: </li>
2537:
2538: <li>
2539: <p>SUNWbtool</p>
2540: </li>
2541:
2542: <li>
2543: <p>SUNWtoo</p>
2544: </li>
2545:
2546: <li>
2547: <p>SUNWlibm</p>
2548: </li>
2549: </ul>
2550: </div>
2551:
2552: <p>Please note the use of GNU binutils on Solaris is
2553: <span class="emphasis"><em>not</em></span>
2554: supported.</p>
2555:
2556: <div class="sect3" lang="en" xml:lang="en">
2557: <div class="titlepage">
2558: <div>
2559: <div>
1.30 wiz 2560: <h4 class="title"><a name="solaris-gcc-note"
2561: id="solaris-gcc-note"></a>3.2.7.1. If you
2562: are using gcc</h4>
1.1 grant 2563: </div>
2564: </div>
2565: </div>
2566:
2567: <p>It makes life much simpler if you only use the
2568: same gcc consistently for building all packages.</p>
2569:
2570: <p>It is recommended that an external gcc be used
2571: only for bootstrapping, then either build gcc from
2572: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2573: href=
2574: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2575: target="_top"><code xmlns="" class=
2576: "filename">lang/gcc</code></a> or install a binary
2577: gcc package, then remove gcc used during
1.20 ben 2578: bootstrapping.</p>
1.1 grant 2579:
2580: <p>Binary packages of gcc can be found through
2581: <a href=
2582: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2583: target=
2584: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2585: </div>
2586:
2587: <div class="sect3" lang="en" xml:lang="en">
2588: <div class="titlepage">
2589: <div>
2590: <div>
1.30 wiz 2591: <h4 class="title"><a name=
2592: "solaris-sun-workshop-note" id=
2593: "solaris-sun-workshop-note"></a>3.2.7.2. If
2594: you are using Sun WorkShop</h4>
1.1 grant 2595: </div>
2596: </div>
2597: </div>
2598:
2599: <p>You will need at least the following packages
2600: installed (from WorkShop 5.0)</p>
2601:
2602: <div class="itemizedlist">
2603: <ul type="disc">
2604: <li>
2605: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2606: </li>
2607:
2608: <li>
2609: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2610: </li>
2611:
2612: <li>
2613: <p>SPROild - Sun WorkShop Incremental
2614: Linker</p>
2615: </li>
2616:
2617: <li>
2618: <p>SPROlang - Sun WorkShop Compilers common
2619: components</p>
2620: </li>
2621: </ul>
2622: </div>
2623:
1.14 xtraeme 2624: <p>You should set <code class="varname">CC</code>,
2625: <code class="varname">CXX</code> and optionally,
1.45 wiz 2626: <code class="varname">CPP</code> in <code xmlns=
2627: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 2628: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2629: <pre class="programlisting">
1.27 rillig 2630: CC= cc
1.1 grant 2631: CXX= CC
2632: CPP= /usr/ccs/lib/cpp
2633: </pre>
2634:
2635: <p>You may also want to build 64-bit binaries,
1.47 ! reed 2636: e.g.:</p>
1.1 grant 2637: <pre class="programlisting">
2638: CFLAGS= -xtarget=ultra -xarch=v9
2639: </pre>
2640:
2641: <p>Whichever compiler you use, please ensure the
2642: compiler tools and your $prefix are in your
1.14 xtraeme 2643: <code class="varname">PATH</code>. This includes
1.45 wiz 2644: <code xmlns=
2645: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 2646: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2647: <code xmlns=
2648: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2649: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2650: </div>
2651: </div>
2652: </div>
2653: </div>
2654:
2655: <div class="chapter" lang="en" xml:lang="en">
2656: <div class="titlepage">
2657: <div>
2658: <div>
2659: <h2 class="title"><a name="using" id=
2660: "using"></a>Chapter 4. Using pkgsrc</h2>
2661: </div>
2662: </div>
2663: </div>
2664:
2665: <div class="toc">
2666: <p><b>Table of Contents</b></p>
2667:
2668: <dl>
2669: <dt><span class="sect1"><a href="#getting-started">4.1.
2670: Working with binary packages</a></span></dt>
2671:
2672: <dd>
2673: <dl>
1.30 wiz 2674: <dt><span class="sect2"><a href=
2675: "#where-to-get-binary-packages">4.1.1. Where to get
2676: binary packages</a></span></dt>
1.1 grant 2677:
1.30 wiz 2678: <dt><span class="sect2"><a href=
2679: "#how-to-use-binary-packages">4.1.2. How to use
2680: binary packages</a></span></dt>
1.1 grant 2681:
1.30 wiz 2682: <dt><span class="sect2"><a href=
2683: "#a-word-of-warning">4.1.3. A word of
2684: warning</a></span></dt>
1.1 grant 2685: </dl>
2686: </dd>
2687:
1.30 wiz 2688: <dt><span class="sect1"><a href=
2689: "#building-packages-from-source">4.2. Building packages
2690: from source</a></span></dt>
1.1 grant 2691:
2692: <dd>
2693: <dl>
1.30 wiz 2694: <dt><span class="sect2"><a href=
2695: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2696:
1.30 wiz 2697: <dt><span class="sect2"><a href=
2698: "#fetching-distfiles">4.2.2. Fetching
2699: distfiles</a></span></dt>
1.1 grant 2700:
1.30 wiz 2701: <dt><span class="sect2"><a href=
2702: "#how-to-build-and-install">4.2.3. How to build and
2703: install</a></span></dt>
1.1 grant 2704:
1.30 wiz 2705: <dt><span class="sect2"><a href=
2706: "#selecting-the-compiler">4.2.4. Selecting the
2707: compiler</a></span></dt>
1.1 grant 2708: </dl>
2709: </dd>
2710: </dl>
2711: </div>
2712:
2713: <div class="sect1" lang="en" xml:lang="en">
2714: <div class="titlepage">
2715: <div>
2716: <div>
2717: <h2 class="title" style="clear: both"><a name=
2718: "getting-started" id=
2719: "getting-started"></a>4.1. Working with binary
2720: packages</h2>
2721: </div>
2722: </div>
2723: </div>
2724:
2725: <p>This section describes how to find, retrieve and
2726: install a precompiled binary package that someone else
2727: already prepared for your type of machine.</p>
2728:
2729: <div class="sect2" lang="en" xml:lang="en">
2730: <div class="titlepage">
2731: <div>
2732: <div>
1.30 wiz 2733: <h3 class="title"><a name=
2734: "where-to-get-binary-packages" id=
2735: "where-to-get-binary-packages"></a>4.1.1. Where
2736: to get binary packages</h3>
1.1 grant 2737: </div>
2738: </div>
2739: </div>
2740:
2741: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2742: and its mirrors in the directory <code xmlns=
2743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2744: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2745: for anonymous FTP access. <code class=
2746: "varname">OSVERSION</code> is the NetBSD version
2747: (<span><strong class="command">uname
2748: -r</strong></span>), <code class="varname">ARCH</code>
2749: is the architecture (<span><strong class=
2750: "command">uname -p</strong></span>). In that directory,
2751: there is a subdirectory for each category plus a
1.45 wiz 2752: subdirectory <code xmlns=
2753: "http://www.w3.org/TR/xhtml1/transitional" class=
2754: "filename">All</code> which includes the actual
2755: binaries in <code xmlns=
2756: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2757: "filename">.tgz</code> files. The category
2758: subdirectories use symbolic links to those files (this
1.45 wiz 2759: is the same directory layout as in <code xmlns=
2760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2761: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2762:
1.47 ! reed 2763: <p>This same directory layout applies for CD-ROM
1.1 grant 2764: distributions, only that the directory may be rooted
1.45 wiz 2765: somewhere else, probably somewhere below <code xmlns=
2766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 2767: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 2768: documentation for the exact location.</p>
2769: </div>
2770:
2771: <div class="sect2" lang="en" xml:lang="en">
2772: <div class="titlepage">
2773: <div>
2774: <div>
1.30 wiz 2775: <h3 class="title"><a name=
2776: "how-to-use-binary-packages" id=
2777: "how-to-use-binary-packages"></a>4.1.2. How
2778: to use binary packages</h3>
1.1 grant 2779: </div>
2780: </div>
2781: </div>
2782:
1.47 ! reed 2783: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 2784: to your hard disk, you can install them with the
1.27 rillig 2785: following command (be sure to <span><strong class=
1.14 xtraeme 2786: "command">su</strong></span> to root first):</p>
1.1 grant 2787: <pre class="screen">
1.14 xtraeme 2788: <code class="prompt">#</code> <strong class=
2789: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2790: </pre>
2791:
2792: <p>If you have FTP access and you don't want to
2793: download the packages via FTP prior to installation,
1.14 xtraeme 2794: you can do this automatically by giving
2795: <span><strong class="command">pkg_add</strong></span>
2796: an FTP URL:</p>
1.1 grant 2797: <pre class="screen">
1.14 xtraeme 2798: <code class="prompt">#</code> <strong class=
1.27 rillig 2799: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2800: </pre>
2801:
1.27 rillig 2802: <p>Note that any prerequisite packages needed to run
2803: the package in question will be installed, too,
1.1 grant 2804: assuming they are present where you install from.</p>
2805:
1.23 wiz 2806: <p>To save some typing, you can set the <code class=
2807: "varname">PKG_PATH</code> environment variable to a
1.47 ! reed 2808: semicolon-separated list of paths (including remote
1.23 wiz 2809: URLs); trailing slashes are not allowed.</p>
2810:
1.45 wiz 2811: <p>Additionally to the <code xmlns=
2812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 2813: "filename">All</code> directory there exists a
1.45 wiz 2814: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2815: class="filename">vulnerable</code> directory to which
2816: binary packages with known vulnerabilities are moved,
2817: since removing them could cause missing dependencies.
2818: To use these packages, add the <code xmlns=
2819: "http://www.w3.org/TR/xhtml1/transitional" class=
2820: "filename">vulnerable</code> directory to your
2821: <code class="varname">PKG_PATH</code>. However, you
2822: should run <a xmlns=
1.23 wiz 2823: "http://www.w3.org/TR/xhtml1/transitional" href=
2824: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 2825: target="_top"><code xmlns="" class=
2826: "filename">security/audit-packages</code></a>
1.47 ! reed 2827: regularly, especially after installing new packages,
! 2828: and verify that the vulnerabilities are acceptable for
! 2829: your configuration. An example <code class=
! 2830: "varname">PKG_PATH</code> would be: <code xmlns=
! 2831: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2832: "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 2833: Please note that semicolon (';') is a shell
2834: meta-character, so you'll probably have to quote
2835: it.</p>
2836:
1.1 grant 2837: <p>After you've installed packages, be sure to have
1.45 wiz 2838: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2839: class="filename">/usr/pkg/bin</code> and <code xmlns=
2840: "http://www.w3.org/TR/xhtml1/transitional" class=
2841: "filename">/usr/pkg/sbin</code> in your <code class=
2842: "varname">PATH</code> so you can actually start the
2843: just installed program.</p>
1.1 grant 2844: </div>
2845:
2846: <div class="sect2" lang="en" xml:lang="en">
2847: <div class="titlepage">
2848: <div>
2849: <div>
1.30 wiz 2850: <h3 class="title"><a name="a-word-of-warning" id=
2851: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2852: warning</h3>
2853: </div>
2854: </div>
2855: </div>
2856:
2857: <p>Please pay very careful attention to the warnings
2858: expressed in the <a href=
2859: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2860: <span class="citerefentry"><span class=
2861: "refentrytitle">pkg_add</span>(1)</span></a> manual
2862: page about the inherent dangers of installing binary
2863: packages which you did not create yourself, and the
2864: security holes that can be introduced onto your system
2865: by indiscriminate adding of such files.</p>
2866: </div>
2867: </div>
2868:
2869: <div class="sect1" lang="en" xml:lang="en">
2870: <div class="titlepage">
2871: <div>
2872: <div>
2873: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2874: "building-packages-from-source" id=
2875: "building-packages-from-source"></a>4.2. Building
1.1 grant 2876: packages from source</h2>
2877: </div>
2878: </div>
2879: </div>
2880:
2881: <p>This assumes that the package is already in pkgsrc. If
2882: it is not, see <a href="#developers-guide" title=
1.46 gdt 2883: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2884: “The pkgsrc developer's guide”</a> for
2885: instructions how to create your own packages.</p>
1.1 grant 2886:
2887: <div class="sect2" lang="en" xml:lang="en">
2888: <div class="titlepage">
2889: <div>
2890: <div>
1.30 wiz 2891: <h3 class="title"><a name="requirements" id=
2892: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2893: </div>
2894: </div>
2895: </div>
2896:
2897: <p>To build packages from source on a NetBSD system the
2898: “<span class="quote">comp</span>” and the
2899: “<span class="quote">text</span>”
2900: distribution sets must be installed. If you want to
1.47 ! reed 2901: build X11-related packages the “<span class=
1.1 grant 2902: "quote">xbase</span>” and “<span class=
2903: "quote">xcomp</span>” distribution sets are
2904: required, too.</p>
2905: </div>
2906:
2907: <div class="sect2" lang="en" xml:lang="en">
2908: <div class="titlepage">
2909: <div>
2910: <div>
1.30 wiz 2911: <h3 class="title"><a name="fetching-distfiles"
2912: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2913: distfiles</h3>
2914: </div>
2915: </div>
2916: </div>
2917:
1.27 rillig 2918: <p>The first step for building a package is downloading
2919: the distfiles (i.e. the unmodified source). If they
2920: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2921: automatically.</p>
2922:
2923: <p>You can overwrite some of the major distribution
2924: sites to fit to sites that are close to your own. Have
1.45 wiz 2925: a look at <code xmlns=
2926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2927: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2928: some examples — in particular, look for the
1.14 xtraeme 2929: <code class="varname">MASTER_SORT</code>, <code class=
2930: "varname">MASTER_SORT_REGEX</code> and <code class=
2931: "varname">INET_COUNTRY</code> definitions. This may
2932: save some of your bandwidth and time.</p>
1.1 grant 2933:
2934: <p>You can change these settings either in your shell's
2935: environment, or, if you want to keep the settings, by
1.45 wiz 2936: editing the <code xmlns=
2937: "http://www.w3.org/TR/xhtml1/transitional" class=
2938: "filename">/etc/mk.conf</code> file, and adding the
2939: definitions there.</p>
1.1 grant 2940:
2941: <p>If you don't have a permanent Internet connection
2942: and you want to know which files to download,
1.14 xtraeme 2943: <span><strong class="command">make
2944: fetch-list</strong></span> will tell you what you'll
1.45 wiz 2945: need. Put these distfiles into <code xmlns=
2946: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2947: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2948: </div>
2949:
2950: <div class="sect2" lang="en" xml:lang="en">
2951: <div class="titlepage">
2952: <div>
2953: <div>
1.30 wiz 2954: <h3 class="title"><a name=
2955: "how-to-build-and-install" id=
2956: "how-to-build-and-install"></a>4.2.3. How to
2957: build and install</h3>
1.1 grant 2958: </div>
2959: </div>
2960: </div>
2961:
2962: <p>Assuming that the distfile has been fetched (see
2963: previous section), become root and change into the
1.47 ! reed 2964: relevant directory and run <span><strong class=
! 2965: "command">make</strong></span>.</p>
! 2966:
! 2967: <div class="note" style=
! 2968: "margin-left: 0.5in; margin-right: 0.5in;">
! 2969: <h3 class="title">Note</h3>
! 2970:
! 2971: <p>If using bootstrap or pkgsrc on a non-NetBSD
! 2972: system, use the pkgsrc <span><strong class=
! 2973: "command">bmake</strong></span> command instead of
! 2974: “<span class="quote">make</span>” in the
! 2975: examples in this guide.</p>
! 2976: </div>
! 2977:
! 2978: <p>For example, type</p>
1.1 grant 2979: <pre class="screen">
1.14 xtraeme 2980: <code class="prompt">%</code> <strong class=
2981: "userinput"><code>cd misc/figlet</code></strong>
2982: <code class="prompt">%</code> <strong class=
2983: "userinput"><code>make</code></strong>
1.1 grant 2984: </pre>
2985:
2986: <p>at the shell prompt to build the various components
2987: of the package, and</p>
2988: <pre class="screen">
1.14 xtraeme 2989: <code class="prompt">#</code> <strong class=
2990: "userinput"><code>make install</code></strong>
1.1 grant 2991: </pre>
2992:
2993: <p>to install the various components into the correct
2994: places on your system. Installing the package on your
2995: system requires you to be root. However, pkgsrc has a
2996: <span class="emphasis"><em>just-in-time-su</em></span>
2997: feature, which allows you to only become root for the
2998: actual installation step</p>
2999:
3000: <p>Taking the figlet utility as an example, we can
3001: install it on our system by building as shown in
3002: <a href="#logs" title=
1.46 gdt 3003: "Appendix B. Build logs">Appendix B, <i>Build
1.1 grant 3004: logs</i></a>.</p>
3005:
3006: <p>The program is installed under the default root of
1.45 wiz 3007: the packages tree - <code xmlns=
3008: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3009: "filename">/usr/pkg</code>. Should this not conform to
3010: your tastes, set the <code class=
3011: "varname">LOCALBASE</code> variable in your
1.1 grant 3012: environment, and it will use that value as the root of
1.45 wiz 3013: your packages tree. So, to use <code xmlns=
3014: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3015: "filename">/usr/local</code>, set <code class=
3016: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3017: environment. Please note that you should use a
3018: directory which is dedicated to packages and not shared
1.47 ! reed 3019: with other programs (i.e., do not try and use
1.14 xtraeme 3020: <code class="varname">LOCALBASE=/usr</code>). Also, you
3021: should not try to add any of your own files or
1.45 wiz 3022: directories (such as <code xmlns=
3023: "http://www.w3.org/TR/xhtml1/transitional" class=
3024: "filename">src/</code>, <code xmlns=
3025: "http://www.w3.org/TR/xhtml1/transitional" class=
3026: "filename">obj/</code>, or <code xmlns=
3027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3028: "filename">pkgsrc/</code>) below the <code class=
3029: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3030: possible conflicts between programs and other files
3031: installed by the package system and whatever else may
3032: have been installed there.</p>
3033:
1.45 wiz 3034: <p>Some packages look in <code xmlns=
3035: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3036: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3037: configuration options at build time. Have a look at
1.45 wiz 3038: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3039: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3040: get an overview of what will be set there by default.
1.14 xtraeme 3041: Environment variables such as <code class=
1.45 wiz 3042: "varname">LOCALBASE</code> can be set in <code xmlns=
3043: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3044: "filename">/etc/mk.conf</code> to save having to
3045: remember to set them each time you want to use
3046: pkgsrc.</p>
1.1 grant 3047:
3048: <p>Occasionally, people want to “<span class=
3049: "quote">look under the covers</span>” to see what
3050: is going on when a package is building or being
3051: installed. This may be for debugging purposes, or out
3052: of simple curiosity. A number of utility values have
3053: been added to help with this.</p>
3054:
3055: <div class="orderedlist">
3056: <ol type="1">
3057: <li>
3058: <p>If you invoke the <a href=
3059: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3060: <span class="citerefentry"><span class=
3061: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3062: with <code class=
3063: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3064: amount of information will be displayed. For
3065: example,</p>
1.1 grant 3066: <pre class="screen">
1.14 xtraeme 3067: <strong class=
3068: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3069: </pre>
3070:
3071: <p>will show all the commands that are invoked,
3072: up to and including the “<span class=
3073: "quote">patch</span>” stage.</p>
3074: </li>
3075:
3076: <li>
3077: <p>If you want to know the value of a certain
1.22 tv 3078: <a href=
3079: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3080: <span class="citerefentry"><span class=
3081: "refentrytitle">make</span>(1)</span></a>
3082: definition, then the <code class=
1.14 xtraeme 3083: "varname">VARNAME</code> definition should be
3084: used, in conjunction with the show-var target.
3085: e.g. to show the expansion of the <a href=
1.1 grant 3086: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3087: <span class="citerefentry"><span class=
3088: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3089: variable <code class=
1.22 tv 3090: "varname">LOCALBASE</code>:</p>
1.1 grant 3091: <pre class="screen">
1.14 xtraeme 3092: <code class="prompt">%</code> <strong class=
3093: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3094: /usr/pkg
1.14 xtraeme 3095: <code class="prompt">%</code>
1.1 grant 3096:
3097: </pre>
3098: </li>
3099: </ol>
3100: </div>
3101:
3102: <p>If you want to install a binary package that you've
3103: either created yourself (see next section), that you
3104: put into pkgsrc/packages manually or that is located on
1.8 wiz 3105: a remote FTP server, you can use the "bin-install"
1.1 grant 3106: target. This target will install a binary package - if
3107: available - via <a href=
3108: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3109: <span class="citerefentry"><span class=
3110: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3111: <span><strong class="command">make
3112: package</strong></span>. The list of remote FTP sites
3113: searched is kept in the variable <code class=
3114: "varname">BINPKG_SITES</code>, which defaults to
3115: ftp.NetBSD.org. Any flags that should be added to
3116: <a href=
1.1 grant 3117: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3118: <span class="citerefentry"><span class=
3119: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3120: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3121: See <code xmlns=
3122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3123: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3124: details.</p>
1.1 grant 3125:
1.47 ! reed 3126: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3127: has a non-standard setting for <code class=
3128: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3129: any packages are installed, as you can not use several
3130: directories for the same purpose. Doing so will result
3131: in pkgsrc not being able to properly detect your
3132: installed packages, and fail miserably. Note also that
3133: precompiled binary packages are usually built with the
1.14 xtraeme 3134: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3135: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3136: class="filename">/usr/pkg</code>, and that you should
3137: <span class="emphasis"><em>not</em></span> install any
3138: if you use a non-standard <code class=
1.14 xtraeme 3139: "varname">LOCALBASE</code>.</p>
1.1 grant 3140: </div>
3141:
3142: <div class="sect2" lang="en" xml:lang="en">
3143: <div class="titlepage">
3144: <div>
3145: <div>
1.30 wiz 3146: <h3 class="title"><a name=
3147: "selecting-the-compiler" id=
3148: "selecting-the-compiler"></a>4.2.4. Selecting
3149: the compiler</h3>
1.1 grant 3150: </div>
3151: </div>
3152: </div>
3153:
3154: <p>By default, pkgsrc will use GCC to build packages.
3155: This may be overridden by setting the following
3156: variables in /etc/mk.conf:</p>
3157:
3158: <div class="variablelist">
3159: <dl>
1.14 xtraeme 3160: <dt><span class="term"><code class=
3161: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3162:
3163: <dd>
3164: <p>This is a list of values specifying the chain
3165: of compilers to invoke when building packages.
3166: Valid values are:</p>
3167:
3168: <div class="itemizedlist">
3169: <ul type="disc">
3170: <li>
1.14 xtraeme 3171: <p><code class="varname">distcc</code>:
1.1 grant 3172: distributed C/C++ (chainable)</p>
3173: </li>
3174:
3175: <li>
1.14 xtraeme 3176: <p><code class="varname">ccache</code>:
1.1 grant 3177: compiler cache (chainable)</p>
3178: </li>
3179:
3180: <li>
1.14 xtraeme 3181: <p><code class="varname">gcc</code>: GNU
3182: C/C++ Compiler</p>
1.1 grant 3183: </li>
3184:
3185: <li>
1.14 xtraeme 3186: <p><code class="varname">mipspro</code>:
1.1 grant 3187: Silicon Graphics, Inc. MIPSpro
3188: (n32/n64)</p>
3189: </li>
3190:
3191: <li>
1.14 xtraeme 3192: <p><code class="varname">mipspro</code>:
1.1 grant 3193: Silicon Graphics, Inc. MIPSpro (o32)</p>
3194: </li>
3195:
3196: <li>
1.14 xtraeme 3197: <p><code class="varname">sunpro</code>:
1.1 grant 3198: Microsystems, Inc. WorkShip/Forte/Sun ONE
3199: Studio</p>
3200: </li>
3201: </ul>
3202: </div>
3203:
3204: <p>The default is “<span class=
1.14 xtraeme 3205: "quote"><code class=
3206: "varname">gcc</code></span>”. You can use
3207: <code class="varname">ccache</code> and/or
3208: <code class="varname">distcc</code> with an
3209: appropriate <code class=
3210: "varname">PKGSRC_COMPILER</code> setting, e.g.
3211: “<span class="quote"><code class=
3212: "varname">ccache gcc</code></span>”. This
1.1 grant 3213: variable should always be terminated with a value
3214: for a real compiler.</p>
3215: </dd>
3216:
1.14 xtraeme 3217: <dt><span class="term"><code class=
3218: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3219:
3220: <dd>
3221: <p>This specifies the minimum version of GCC to
3222: use when building packages. If the system GCC
3223: doesn't satisfy this requirement, then pkgsrc
3224: will build and install one of the GCC packages to
3225: use instead.</p>
3226: </dd>
3227: </dl>
3228: </div>
3229: </div>
3230: </div>
3231: </div>
3232:
3233: <div class="chapter" lang="en" xml:lang="en">
3234: <div class="titlepage">
3235: <div>
3236: <div>
1.38 dillo 3237: <h2 class="title"><a name="configuring" id=
3238: "configuring"></a>Chapter 5. Configuring
3239: pkgsrc</h2>
3240: </div>
3241: </div>
3242: </div>
3243:
3244: <div class="toc">
3245: <p><b>Table of Contents</b></p>
3246:
3247: <dl>
3248: <dt><span class="sect1"><a href=
1.45 wiz 3249: "#general-configuration">5.1. General
3250: configuration</a></span></dt>
3251:
3252: <dt><span class="sect1"><a href=
3253: "#variables-affecting-build">5.2. Variables affecting
3254: the build process</a></span></dt>
3255:
3256: <dt><span class="sect1"><a href=
3257: "#developer-advanced-settings">5.3. Developer/advanced
3258: settings</a></span></dt>
3259:
3260: <dt><span class="sect1"><a href=
3261: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3262: Options</a></span></dt>
1.38 dillo 3263: </dl>
3264: </div>
3265:
3266: <div class="sect1" lang="en" xml:lang="en">
3267: <div class="titlepage">
3268: <div>
3269: <div>
3270: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3271: "general-configuration" id=
3272: "general-configuration"></a>5.1. General
3273: configuration</h2>
3274: </div>
3275: </div>
3276: </div>
3277:
1.47 ! reed 3278: <p>In this section, you can find some variables that
! 3279: apply to all pkgsrc packages. The preferred method of
! 3280: setting these variables is by setting them in
! 3281: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 3282: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3283:
3284: <div class="itemizedlist">
3285: <ul type="disc">
3286: <li>
3287: <p><code class="varname">LOCALBASE</code>: Where
3288: packages will be installed. The default is
3289: <code xmlns=
3290: "http://www.w3.org/TR/xhtml1/transitional" class=
3291: "filename">/usr/pkg</code>. Do not mix binary
3292: packages with different <code class=
3293: "varname">LOCALBASE</code>s!</p>
3294: </li>
3295:
3296: <li>
3297: <p><code class="varname">CROSSBASE</code>: Where
3298: “<span class="quote">cross</span>”
3299: category packages will be installed. The default is
3300: <code xmlns=
3301: "http://www.w3.org/TR/xhtml1/transitional" class=
3302: "filename">${LOCALBASE}/cross</code>.</p>
3303: </li>
3304:
3305: <li>
3306: <p><code class="varname">X11BASE</code>: Where X11
3307: is installed on the system. The default is
3308: <code xmlns=
3309: "http://www.w3.org/TR/xhtml1/transitional" class=
3310: "filename">/usr/X11R6</code>.</p>
3311: </li>
3312:
3313: <li>
3314: <p><code class="varname">DISTDIR</code>: Where to
3315: store the downloaded copies of the original source
3316: distributions used for building pkgsrc packages.
3317: The default is <code xmlns=
3318: "http://www.w3.org/TR/xhtml1/transitional" class=
3319: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3320: </li>
3321:
3322: <li>
3323: <p><code class=
3324: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3325: override the packages' <code class=
3326: "varname">MASTER_SITES</code> with this value.</p>
3327: </li>
3328:
3329: <li>
3330: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3331: Backup location(s) for distribution files and patch
3332: files if not found locally or in <code xmlns=
3333: "http://www.w3.org/TR/xhtml1/transitional" class=
3334: "filename">${MASTER_SITES}</code> or <code xmlns=
3335: "http://www.w3.org/TR/xhtml1/transitional" class=
3336: "filename">${PATCH_SITES}</code> respectively. The
3337: defaults are <code xmlns=
3338: "http://www.w3.org/TR/xhtml1/transitional" class=
3339: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3340: and <code xmlns=
3341: "http://www.w3.org/TR/xhtml1/transitional" class=
3342: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3343: </li>
3344:
3345: <li>
3346: <p><code class="varname">BINPKG_SITES</code>: List
3347: of sites carrying binary pkgs.</p>
3348: </li>
3349: </ul>
3350: </div>
3351: </div>
3352:
3353: <div class="sect1" lang="en" xml:lang="en">
3354: <div class="titlepage">
3355: <div>
3356: <div>
3357: <h2 class="title" style="clear: both"><a name=
3358: "variables-affecting-build" id=
3359: "variables-affecting-build"></a>5.2. Variables
3360: affecting the build process</h2>
3361: </div>
3362: </div>
3363: </div>
3364:
3365: <p>XXX</p>
3366:
3367: <div class="itemizedlist">
3368: <ul type="disc">
3369: <li>
3370: <p><code class="varname">PACKAGES</code>: The top
3371: level directory for the binary packages. The
3372: default is <code xmlns=
3373: "http://www.w3.org/TR/xhtml1/transitional" class=
3374: "filename">${PKGSRCDIR}/packages</code>.</p>
3375: </li>
3376:
3377: <li>
3378: <p><code class="varname">WRKOBJDIR</code>: The top
3379: level directory where, if defined, the separate
3380: working directories will get created, and
3381: symbolically linked to from <code xmlns=
3382: "http://www.w3.org/TR/xhtml1/transitional" class=
3383: "filename">${WRKDIR}</code> (see below). This is
3384: useful for building packages on several
3385: architectures, then <code xmlns=
3386: "http://www.w3.org/TR/xhtml1/transitional" class=
3387: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3388: while <code xmlns=
3389: "http://www.w3.org/TR/xhtml1/transitional" class=
3390: "filename">${WRKOBJDIR}</code> is local to every
3391: architecture. (It should be noted that <code class=
3392: "varname">PKGSRCDIR</code> should not be set by the
3393: user — it is an internal definition which
3394: refers to the root of the pkgsrc tree. It is
3395: possible to have many pkgsrc tree instances.)</p>
3396: </li>
3397:
3398: <li>
3399: <p><code class="varname">LOCALPATCHES</code>:
3400: Directory for local patches that aren't part of
3401: pkgsrc. See <a href="#components.patches" title=
3402: "8.3. patches/*">Section 8.3,
3403: “patches/*”</a> for more information.
3404: <em class="replaceable"><code>rel</code></em> and
3405: <em class="replaceable"><code>arch</code></em> are
3406: replaced with OS release (“<span class=
3407: "quote">2.0</span>”, etc.) and architecture
3408: (“<span class="quote">mipsel</span>”,
3409: etc.).</p>
3410: </li>
3411:
3412: <li>
3413: <p><code class="varname">PKGMAKECONF</code>:
3414: Location of the <code xmlns=
3415: "http://www.w3.org/TR/xhtml1/transitional" class=
3416: "filename">mk.conf</code> file used by a package's
3417: BSD-style Makefile. If this is not set,
3418: <code class="varname">MAKECONF</code> is set to
3419: <code xmlns=
3420: "http://www.w3.org/TR/xhtml1/transitional" class=
3421: "filename">/dev/null</code> to avoid picking up
3422: settings used by builds in <code xmlns=
3423: "http://www.w3.org/TR/xhtml1/transitional" class=
3424: "filename">/usr/src</code>.</p>
3425: </li>
3426: </ul>
3427: </div>
3428: </div>
3429:
3430: <div class="sect1" lang="en" xml:lang="en">
3431: <div class="titlepage">
3432: <div>
3433: <div>
3434: <h2 class="title" style="clear: both"><a name=
3435: "developer-advanced-settings" id=
3436: "developer-advanced-settings"></a>5.3. Developer/advanced
3437: settings</h2>
3438: </div>
3439: </div>
3440: </div>
3441:
3442: <p>XXX</p>
3443:
3444: <div class="itemizedlist">
3445: <ul type="disc">
3446: <li>
3447: <p><code class="varname">PKG_DEVELOPER</code>: Run
3448: some sanity checks that package developers
3449: want:</p>
3450:
3451: <div class="itemizedlist">
3452: <ul type="circle">
3453: <li>
3454: <p>make sure patches apply with zero fuzz</p>
3455: </li>
3456:
3457: <li>
3458: <p>run check-shlibs to see that all binaries
3459: will find their shared libs.</p>
3460: </li>
3461: </ul>
3462: </div>
3463: </li>
3464:
3465: <li>
3466: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3467: The level of debugging output which is displayed
3468: whilst making and installing the package. The
3469: default value for this is 0, which will not display
3470: the commands as they are executed (normal, default,
3471: quiet operation); the value 1 will display all
3472: shell commands before their invocation, and the
3473: value 2 will display both the shell commands before
3474: their invocation, and their actual execution
3475: progress with <span><strong class="command">set
3476: -x</strong></span> will be displayed.</p>
3477: </li>
3478: </ul>
3479: </div>
3480: </div>
3481:
3482: <div class="sect1" lang="en" xml:lang="en">
3483: <div class="titlepage">
3484: <div>
3485: <div>
3486: <h2 class="title" style="clear: both"><a name=
3487: "selecting-build-options" id=
3488: "selecting-build-options"></a>5.4. Selecting
3489: Build Options</h2>
1.38 dillo 3490: </div>
3491: </div>
3492: </div>
3493:
3494: <p>Some packages have build time options, usually to
3495: select between different dependencies, enable optional
3496: support for big dependencies or enable experimental
3497: features.</p>
3498:
3499: <p>To see which options, if any, a package supports, and
3500: which options are mutually exclusive, run
3501: <span><strong class="command">make
3502: show-options</strong></span>, for example:</p>
3503: <pre class="programlisting">
1.44 gdt 3504: The following options are supported by this package:
3505: ssl Enable SSL support.
3506: Exactly one of the following gecko options is required:
3507: firefox Use firefox as gecko rendering engine.
3508: mozilla Use mozilla as gecko rendering engine.
3509: At most one of the following database options may be selected:
3510: mysql Enable support for MySQL database.
3511: pgsql Enable support for PostgreSQL database.
1.38 dillo 3512:
1.44 gdt 3513: These options are enabled by default: firefox
3514: These options are currently enabled: mozilla ssl
3515:
1.38 dillo 3516: </pre>
3517:
1.45 wiz 3518: <p>The following variables can be defined in <code xmlns=
3519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3520: "filename">/etc/mk.conf</code> to select which options to
3521: enable for a package: <code class=
3522: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3523: to select or disable options for all packages that
3524: support them, and <code class=
3525: "varname">PKG_OPTIONS.<em class=
3526: "replaceable"><code>pkgbase</code></em></code>, which can
3527: be used to select or disable options specifically for
3528: package <em class=
3529: "replaceable"><code>pkgbase</code></em>. Options listed
3530: in these variables are selected, options preceded by
3531: “<span class="quote">-</span>” are
3532: disabled.</p>
3533:
1.39 dillo 3534: <p>The following settings are consulted in the order
3535: given, and the last setting that selects or disables an
3536: option is used:</p>
1.38 dillo 3537:
3538: <div class="orderedlist">
3539: <ol type="1">
3540: <li>
3541: <p>the default options as suggested by the package
3542: maintainer</p>
3543: </li>
3544:
3545: <li>
3546: <p>the options implied by the settings of legacy
3547: variables (see below)</p>
3548: </li>
3549:
3550: <li>
3551: <p><code class=
3552: "varname">PKG_DEFAULT_OPTIONS</code></p>
3553: </li>
3554:
3555: <li>
3556: <p><code class="varname">PKG_OPTIONS.<em class=
3557: "replaceable"><code>pkgbase</code></em></code></p>
3558: </li>
3559: </ol>
3560: </div>
3561:
3562: <p>For groups of mutually exclusive options, the last
3563: option selected is used, all others are automatically
3564: disabled. If an option of the group is explicitly
3565: disabled, the previously selected option, if any, is
3566: used. It is an error if no option from a required group
3567: of options is selected, and building the package will
3568: fail.</p>
3569:
3570: <p>Before the options framework was introduced, build
3571: options were selected by setting a variable in
1.45 wiz 3572: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3573: class="filename">/etc/mk.conf</code> for each option. To
3574: ease transition to the options framework for the user,
3575: these legacy variables are converted to the appropriate
3576: options setting automatically. A warning is issued to
3577: prompt the user to update <code xmlns=
3578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3579: "filename">/etc/mk.conf</code> to use the options
3580: framework directly. Support for these legacy variables
3581: will be removed eventually.</p>
3582: </div>
3583: </div>
3584:
3585: <div class="chapter" lang="en" xml:lang="en">
3586: <div class="titlepage">
3587: <div>
3588: <div>
1.1 grant 3589: <h2 class="title"><a name="binary" id=
1.38 dillo 3590: "binary"></a>Chapter 6. Creating binary
1.1 grant 3591: packages</h2>
3592: </div>
3593: </div>
3594: </div>
3595:
3596: <div class="toc">
3597: <p><b>Table of Contents</b></p>
3598:
3599: <dl>
1.30 wiz 3600: <dt><span class="sect1"><a href=
1.38 dillo 3601: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3602: single binary package</a></span></dt>
1.1 grant 3603:
1.30 wiz 3604: <dt><span class="sect1"><a href=
1.38 dillo 3605: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3606: Settings for creation of binary
3607: packages</a></span></dt>
3608:
1.38 dillo 3609: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3610: a bulk build of all packages</a></span></dt>
3611:
3612: <dd>
3613: <dl>
3614: <dt><span class="sect2"><a href=
1.38 dillo 3615: "#binary.configuration">6.3.1.
1.1 grant 3616: Configuration</a></span></dt>
3617:
1.30 wiz 3618: <dt><span class="sect2"><a href=
1.38 dillo 3619: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3620: environmental considerations</a></span></dt>
1.1 grant 3621:
1.38 dillo 3622: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3623: Operation</a></span></dt>
3624:
1.30 wiz 3625: <dt><span class="sect2"><a href=
1.38 dillo 3626: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3627:
1.30 wiz 3628: <dt><span class="sect2"><a href=
1.38 dillo 3629: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3630: requirements</a></span></dt>
1.1 grant 3631:
1.30 wiz 3632: <dt><span class="sect2"><a href=
1.38 dillo 3633: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 ! reed 3634: for chrooted builds</a></span></dt>
1.1 grant 3635:
1.30 wiz 3636: <dt><span class="sect2"><a href=
1.38 dillo 3637: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3638: set of packages</a></span></dt>
1.13 hubertf 3639:
3640: <dt><span class="sect2"><a href=
1.38 dillo 3641: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3642: build</a></span></dt>
1.1 grant 3643: </dl>
3644: </dd>
3645:
1.38 dillo 3646: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3647: Creating a multiple CD-ROM packages
3648: collection</a></span></dt>
3649:
3650: <dd>
3651: <dl>
1.30 wiz 3652: <dt><span class="sect2"><a href=
1.38 dillo 3653: "#cdpack-example">6.4.1. Example of
1.30 wiz 3654: cdpack</a></span></dt>
1.1 grant 3655: </dl>
3656: </dd>
3657: </dl>
3658: </div>
3659:
3660: <div class="sect1" lang="en" xml:lang="en">
3661: <div class="titlepage">
3662: <div>
3663: <div>
3664: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3665: "building-a-single-binary-package" id=
1.38 dillo 3666: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3667: a single binary package</h2>
1.1 grant 3668: </div>
3669: </div>
3670: </div>
3671:
3672: <p>Once you have built and installed a package, you can
3673: create a <span class="emphasis"><em>binary
3674: package</em></span> which can be installed on another
3675: system with <a href=
3676: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3677: <span class="citerefentry"><span class=
1.47 ! reed 3678: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3679: having to build the same package on a group of hosts and
3680: wasting CPU time. It also provides a simple means for
3681: others to install your package, should you distribute
3682: it.</p>
3683:
3684: <p>To create a binary package, change into the
1.14 xtraeme 3685: appropriate directory in pkgsrc, and run
3686: <span><strong class="command">make
3687: package</strong></span>:</p>
1.1 grant 3688: <pre class="screen">
1.14 xtraeme 3689: <code class="prompt">#</code> <strong class=
3690: "userinput"><code>cd misc/figlet</code></strong>
3691: <code class="prompt">#</code> <strong class=
3692: "userinput"><code>make package</code></strong>
1.1 grant 3693: </pre>
3694:
3695: <p>This will build and install your package (if not
3696: already done), and then build a binary package from what
1.14 xtraeme 3697: was installed. You can then use the <span><strong class=
3698: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3699: Binary packages are created by default in <code xmlns=
3700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3701: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3702: gzipped tar file. See <a href="#logs.package" title=
1.46 gdt 3703: "B.2. Packaging figlet">Section B.2,
1.1 grant 3704: “Packaging figlet”</a> for a continuation of
3705: the above <a xmlns=
3706: "http://www.w3.org/TR/xhtml1/transitional" href=
3707: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3708: target="_top"><code xmlns="" class=
3709: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3710:
3711: <p>See <a href="#submit" title=
1.38 dillo 3712: "Chapter 17. Submitting and Committing">Chapter
3713: 17, <i>Submitting and Committing</i></a> for information
1.1 grant 3714: on how to submit such a binary package.</p>
3715: </div>
3716:
3717: <div class="sect1" lang="en" xml:lang="en">
3718: <div class="titlepage">
3719: <div>
3720: <div>
3721: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3722: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3723: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3724: for creation of binary packages</h2>
3725: </div>
3726: </div>
3727: </div>
3728:
3729: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3730: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3731: “Other helpful targets”</a>.</p>
3732: </div>
3733:
3734: <div class="sect1" lang="en" xml:lang="en">
3735: <div class="titlepage">
3736: <div>
3737: <div>
3738: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3739: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
1.1 grant 3740: bulk build of all packages</h2>
3741: </div>
3742: </div>
3743: </div>
3744:
3745: <p>If you want to get a full set of precompiled binary
3746: packages, this section describes how to get them. Beware
3747: that the bulk build will remove all currently installed
1.23 wiz 3748: packages from your system! Having an FTP server
3749: configured either on the machine doing the bulk builds or
3750: on a nearby NFS server can help to make the packages
3751: available to everyone. See <a href=
1.1 grant 3752: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3753: <span class="citerefentry"><span class=
3754: "refentrytitle">ftpd</span>(8)</span></a> for more
3755: information. If you use a remote NFS server's storage, be
3756: sure to not actually compile on NFS storage, as this
3757: slows things down a lot.</p>
3758:
3759: <div class="sect2" lang="en" xml:lang="en">
3760: <div class="titlepage">
3761: <div>
3762: <div>
3763: <h3 class="title"><a name="binary.configuration"
3764: id=
1.38 dillo 3765: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3766: </div>
3767: </div>
3768: </div>
3769:
3770: <div class="sect3" lang="en" xml:lang="en">
3771: <div class="titlepage">
3772: <div>
3773: <div>
3774: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3775: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3776: </div>
3777: </div>
3778: </div>
3779:
1.45 wiz 3780: <p>You may want to set variables in <code xmlns=
3781: "http://www.w3.org/TR/xhtml1/transitional" class=
3782: "filename">/etc/mk.conf</code>. Look at <code xmlns=
3783: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3784: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3785: details of the default settings. You will want to
1.14 xtraeme 3786: ensure that <code class=
3787: "varname">ACCEPTABLE_LICENSES</code> meet your local
3788: policy. As used in this example, <code class=
3789: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3790: "emphasis"><em>all</em></span> licenses.</p>
3791: <pre class="programlisting">
3792: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3793: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3794: BSDSRCDIR= /usr/src
3795: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3796: OBJHOSTNAME?= yes # use work.`hostname`
3797: FAILOVER_FETCH= yes # insist on the correct checksum
3798: PKG_DEVELOPER?= yes
3799: _ACCEPTABLE= yes
3800: </pre>
3801: </div>
3802:
3803: <div class="sect3" lang="en" xml:lang="en">
3804: <div class="titlepage">
3805: <div>
3806: <div>
1.30 wiz 3807: <h4 class="title"><a name="build.conf" id=
1.45 wiz 3808: "build.conf"></a>6.3.1.2. <code xmlns=
3809: "http://www.w3.org/TR/xhtml1/transitional"
3810: class="filename">build.conf</code></h4>
1.1 grant 3811: </div>
3812: </div>
3813: </div>
3814:
1.45 wiz 3815: <p>In <code xmlns=
3816: "http://www.w3.org/TR/xhtml1/transitional" class=
3817: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
3818: "http://www.w3.org/TR/xhtml1/transitional" class=
3819: "filename">build.conf-example</code> to <code xmlns=
3820: "http://www.w3.org/TR/xhtml1/transitional" class=
3821: "filename">build.conf</code> and edit it, following
3822: the comments in that file. This is the config file
3823: that determines where log files are generated after
3824: the build, where to mail the build report to, where
3825: your pkgsrc tree is located and the user to which
3826: user to <a href=
1.1 grant 3827: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3828: <span class="citerefentry"><span class=
1.23 wiz 3829: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3830: <span><strong class="command">cvs
3831: update</strong></span>.</p>
1.1 grant 3832: </div>
3833:
3834: <div class="sect3" lang="en" xml:lang="en">
3835: <div class="titlepage">
3836: <div>
3837: <div>
1.30 wiz 3838: <h4 class="title"><a name="pre-build.local" id=
1.45 wiz 3839: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3840: class="filename">pre-build.local</code></h4>
1.1 grant 3841: </div>
3842: </div>
3843: </div>
3844:
3845: <p>It is possible to configure the bulk build to
1.47 ! reed 3846: perform certain site-specific tasks at the end of the
1.45 wiz 3847: pre-build stage. If the file <code xmlns=
3848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3849: "filename">pre-build.local</code> exists in
1.45 wiz 3850: <code xmlns=
3851: "http://www.w3.org/TR/xhtml1/transitional" class=
3852: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
3853: executed (as a <a href=
1.24 wiz 3854: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3855: <span class="citerefentry"><span class=
3856: "refentrytitle">sh</span>(1)</span></a> script) at
3857: the end of the usual pre-build stage. An example use
1.45 wiz 3858: of <code xmlns=
3859: "http://www.w3.org/TR/xhtml1/transitional" class=
3860: "filename">pre-build.local</code> is to have the
3861: line:</p>
1.1 grant 3862: <pre class="screen">
1.14 xtraeme 3863: <code class="prompt">#</code> <strong class=
3864: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3865: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3866: </pre>
3867:
3868: <p>to prevent the system from trying to build a
3869: particular package which requires nearly 3 GB of disk
3870: space.</p>
3871: </div>
3872: </div>
3873:
3874: <div class="sect2" lang="en" xml:lang="en">
3875: <div class="titlepage">
3876: <div>
3877: <div>
1.30 wiz 3878: <h3 class="title"><a name=
3879: "other-environmental-considerations" id=
1.38 dillo 3880: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 3881: environmental considerations</h3>
1.1 grant 3882: </div>
3883: </div>
3884: </div>
3885:
1.45 wiz 3886: <p>As <code xmlns=
3887: "http://www.w3.org/TR/xhtml1/transitional" class=
3888: "filename">/usr/pkg</code> will be completely deleted
3889: at the start of bulk builds, make sure your login shell
3890: is placed somewhere else. Either drop it into
3891: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3892: class="filename">/usr/local/bin</code> (and adjust your
3893: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 3894: <a href=
1.1 grant 3895: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3896: <span class="citerefentry"><span class=
3897: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 3898: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3899: class="filename">/etc/rc.local</code>, so you can login
3900: after a reboot (remember that your current process
3901: won't die if the package is removed, you just can't
3902: start any new instances of the shell any more). Also,
3903: if you use NetBSD earlier than 1.5, or you still want
3904: to use the pkgsrc version of ssh for some reason, be
3905: sure to install ssh before starting it from
3906: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3907: class="filename">rc.local</code>:</p>
1.1 grant 3908: <pre class="programlisting">
3909: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3910: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3911: /usr/pkg/etc/rc.d/sshd
3912: fi
3913: </pre>
3914:
3915: <p>Not doing so will result in you being not able to
3916: log in via ssh after the bulk build is finished or if
3917: the machine gets rebooted or crashes. You have been
3918: warned! :)</p>
3919: </div>
3920:
3921: <div class="sect2" lang="en" xml:lang="en">
3922: <div class="titlepage">
3923: <div>
3924: <div>
1.30 wiz 3925: <h3 class="title"><a name="operation" id=
1.38 dillo 3926: "operation"></a>6.3.3. Operation</h3>
1.1 grant 3927: </div>
3928: </div>
3929: </div>
3930:
3931: <p>Make sure you don't need any of the packages still
3932: installed.</p>
3933:
3934: <div class="warning" style=
3935: "margin-left: 0.5in; margin-right: 0.5in;">
3936: <h3 class="title">Warning</h3>
3937:
3938: <p>During the bulk build, <span class=
3939: "emphasis"><em>all packages will be
3940: removed!</em></span></p>
3941: </div>
3942:
3943: <p>Be sure to remove all other things that might
3944: interfere with builds, like some libs installed in
1.45 wiz 3945: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3946: class="filename">/usr/local</code>, etc. then become
3947: root and type:</p>
1.1 grant 3948: <pre class="screen">
1.14 xtraeme 3949: <code class="prompt">#</code> <strong class=
3950: "userinput"><code>cd /usr/pkgsrc</code></strong>
3951: <code class="prompt">#</code> <strong class=
3952: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3953: </pre>
3954:
3955: <p>If for some reason your last build didn't complete
3956: (power failure, system panic, ...), you can continue it
3957: by running:</p>
3958: <pre class="screen">
1.14 xtraeme 3959: <code class="prompt">#</code> <strong class=
3960: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3961: </pre>
3962:
3963: <p>At the end of the bulk build, you will get a summary
3964: via mail, and find build logs in the directory
1.14 xtraeme 3965: specified by <code class="varname">FTP</code> in the
1.45 wiz 3966: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3967: class="filename">build.conf</code> file.</p>
1.1 grant 3968: </div>
3969:
3970: <div class="sect2" lang="en" xml:lang="en">
3971: <div class="titlepage">
3972: <div>
3973: <div>
1.30 wiz 3974: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 3975: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 3976: </div>
3977: </div>
3978: </div>
3979:
3980: <p>The bulk builds consist of three steps:</p>
3981:
3982: <div class="variablelist">
3983: <dl>
3984: <dt><span class="term">1. pre-build</span></dt>
3985:
3986: <dd>
3987: <p>The script updates your pkgsrc tree via
3988: (anon)cvs, then cleans out any broken distfiles,
3989: and removes all packages installed.</p>
3990: </dd>
3991:
3992: <dt><span class="term">2. the bulk
3993: build</span></dt>
3994:
3995: <dd>
3996: <p>This is basically “<span class=
3997: "quote">make bulk-package</span>” with an
3998: optimised order in which packages will be built.
3999: Packages that don't require other packages will
4000: be built first, and packages with many
4001: dependencies will be built later.</p>
4002: </dd>
4003:
4004: <dt><span class="term">3. post-build</span></dt>
4005:
4006: <dd>
4007: <p>Generates a report that's placed in the
1.45 wiz 4008: directory specified in the <code xmlns=
4009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4010: "filename">build.conf</code> file named
1.45 wiz 4011: <code xmlns=
4012: "http://www.w3.org/TR/xhtml1/transitional" class=
4013: "filename">broken.html</code>, a short version of
4014: that report will also be mailed to the build's
4015: admin.</p>
1.1 grant 4016: </dd>
4017: </dl>
4018: </div>
4019:
4020: <p>During the build, a list of broken packages will be
1.45 wiz 4021: compiled in <code xmlns=
4022: "http://www.w3.org/TR/xhtml1/transitional" class=
4023: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4025: "filename">.../.broken.${MACHINE}</code> if
4026: <code class="varname">OBJMACHINE</code> is set),
4027: individual build logs of broken builds can be found in
4028: the package's directory. These files are used by the
4029: bulk-targets to mark broken builds to not waste time
4030: trying to rebuild them, and they can be used to debug
4031: these broken package builds later.</p>
1.1 grant 4032: </div>
4033:
4034: <div class="sect2" lang="en" xml:lang="en">
4035: <div class="titlepage">
4036: <div>
4037: <div>
1.30 wiz 4038: <h3 class="title"><a name=
4039: "disk-space-requirements" id=
1.38 dillo 4040: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4041: space requirements</h3>
1.1 grant 4042: </div>
4043: </div>
4044: </div>
4045:
4046: <p>Currently, roughly the following requirements are
4047: valid for NetBSD 2.0/i386:</p>
4048:
4049: <div class="itemizedlist">
4050: <ul type="disc">
4051: <li>
4052: <p>10 GB - distfiles (NFS ok)</p>
4053: </li>
4054:
4055: <li>
4056: <p>8 GB - full set of all binaries (NFS ok)</p>
4057: </li>
4058:
4059: <li>
4060: <p>5 GB - temp space for compiling (local disk
4061: recommended)</p>
4062: </li>
4063: </ul>
4064: </div>
4065:
4066: <p>Note that all pkgs will be de-installed as soon as
4067: they are turned into a binary package, and that sources
4068: are removed, so there is no excessively huge demand to
4069: disk space. Afterwards, if the package is needed again,
4070: it will be installed via <a href=
4071: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4072: <span class="citerefentry"><span class=
4073: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4074: building again, so there are no cycles wasted by
4075: recompiling.</p>
4076: </div>
4077:
4078: <div class="sect2" lang="en" xml:lang="en">
4079: <div class="titlepage">
4080: <div>
4081: <div>
1.30 wiz 4082: <h3 class="title"><a name="setting-up-a-sandbox"
1.38 dillo 4083: id="setting-up-a-sandbox"></a>6.3.6. Setting
1.47 ! reed 4084: up a sandbox for chrooted builds</h3>
1.1 grant 4085: </div>
4086: </div>
4087: </div>
4088:
1.12 agc 4089: <p>If you don't want all the packages nuked from a
4090: machine (rendering it useless for anything but pkg
1.23 wiz 4091: compiling), there is the possibility of doing the
4092: package bulk build inside a chroot environment.</p>
1.12 agc 4093:
4094: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4095: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4096: class="filename">/usr/sandbox</code>. This can be done
4097: by using null mounts, or manually.</p>
1.12 agc 4098:
1.45 wiz 4099: <p>There is a shell script called <code xmlns=
4100: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4101: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4102: set up the sandbox environment using null mounts. It
1.45 wiz 4103: will also create a script called <code xmlns=
4104: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4105: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4106: environment, which will allow the null mounts to be
1.14 xtraeme 4107: activated using the <span><strong class=
4108: "command">sandbox mount</strong></span> command and
4109: deactivated using the <span><strong class=
4110: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4111:
4112: <p>To set up a sandbox environment by hand, after
4113: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4114: doing a <span><strong class="command">make distribution
1.45 wiz 4115: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4116: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4117: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4118: items are present and properly configured:</p>
1.1 grant 4119:
4120: <div class="procedure">
4121: <ol type="1">
4122: <li>
4123: <p>Kernel</p>
4124: <pre class="screen">
1.14 xtraeme 4125: <code class="prompt">#</code> <strong class=
4126: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4127: </pre>
4128: </li>
4129:
4130: <li>
1.45 wiz 4131: <p><code xmlns=
4132: "http://www.w3.org/TR/xhtml1/transitional" class=
4133: "filename">/dev/*</code></p>
1.1 grant 4134: <pre class="screen">
1.14 xtraeme 4135: <code class="prompt">#</code> <strong class=
4136: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4137: </pre>
4138: </li>
4139:
4140: <li>
1.45 wiz 4141: <p><code xmlns=
4142: "http://www.w3.org/TR/xhtml1/transitional" class=
4143: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4144: "http://www.w3.org/TR/xhtml1/transitional" href=
4145: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4146: target="_top"><code xmlns="" class=
4147: "filename">security/smtpd</code></a> and
4148: mail):</p>
1.1 grant 4149: <pre class="screen">
1.14 xtraeme 4150: <code class="prompt">#</code> <strong class=
4151: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4152: </pre>
4153: </li>
4154:
4155: <li>
4156: <p>Working(!) mail config (hostname,
4157: sendmail.cf):</p>
4158: <pre class="screen">
1.14 xtraeme 4159: <code class="prompt">#</code> <strong class=
4160: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4161: </pre>
4162: </li>
4163:
4164: <li>
1.45 wiz 4165: <p><code xmlns=
4166: "http://www.w3.org/TR/xhtml1/transitional" class=
4167: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4168: "http://www.w3.org/TR/xhtml1/transitional" href=
4169: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4170: target="_top"><code xmlns="" class=
4171: "filename">security/smtpd</code></a>):</p>
1.1 grant 4172: <pre class="screen">
1.14 xtraeme 4173: <code class="prompt">#</code> <strong class=
4174: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4175: </pre>
4176: </li>
4177:
4178: <li>
1.45 wiz 4179: <p><code xmlns=
4180: "http://www.w3.org/TR/xhtml1/transitional" class=
4181: "filename">/usr/src</code> (system sources, for
4182: <a xmlns=
1.1 grant 4183: "http://www.w3.org/TR/xhtml1/transitional" href=
4184: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4185: target="_top"><code xmlns="" class=
4186: "filename">sysutils/aperture</code></a>,
4187: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4188: href=
1.20 ben 4189: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4190: target="_top"><code xmlns="" class=
4191: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4192: <pre class="screen">
1.14 xtraeme 4193: <code class="prompt">#</code> <strong class=
4194: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4195: <code class="prompt">#</code> <strong class=
1.23 wiz 4196: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4197: </pre>
4198: </li>
4199:
4200: <li>
1.45 wiz 4201: <p>Create <code xmlns=
4202: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4203: "filename">/var/db/pkg</code> (not part of
4204: default install):</p>
1.1 grant 4205: <pre class="screen">
1.14 xtraeme 4206: <code class="prompt">#</code> <strong class=
4207: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4208: </pre>
4209: </li>
4210:
4211: <li>
1.45 wiz 4212: <p>Create <code xmlns=
4213: "http://www.w3.org/TR/xhtml1/transitional" class=
4214: "filename">/usr/pkg</code> (not part of default
4215: install):</p>
1.1 grant 4216: <pre class="screen">
1.14 xtraeme 4217: <code class="prompt">#</code> <strong class=
4218: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4219: </pre>
4220: </li>
4221:
4222: <li>
1.45 wiz 4223: <p>Checkout pkgsrc via cvs into <code xmlns=
4224: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4225: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4226: <pre class="screen">
1.14 xtraeme 4227: <code class="prompt">#</code> <strong class=
4228: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4229: <code class="prompt">#</code> <strong class=
4230: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4231: </pre>
4232:
4233: <p>Do not mount/link this to the copy of your
4234: pkgsrc tree you do development in, as this will
4235: likely cause problems!</p>
4236: </li>
4237:
4238: <li>
1.45 wiz 4239: <p>Make <code xmlns=
4240: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4241: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4242: and <code xmlns=
4243: "http://www.w3.org/TR/xhtml1/transitional" class=
4244: "filename">.../distfiles</code> point somewhere
4245: appropriate. NFS- and/or nullfs-mounts may come
4246: in handy!</p>
1.1 grant 4247: </li>
4248:
4249: <li>
1.45 wiz 4250: <p>Edit <code xmlns=
4251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4252: "filename">/etc/mk.conf</code>, see <a href=
4253: "#binary.mk.conf" title=
1.38 dillo 4254: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4255: “/etc/mk.conf”</a>.</p>
4256: </li>
4257:
4258: <li>
1.45 wiz 4259: <p>Adjust <code xmlns=
4260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4261: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4262: needs.</p>
4263: </li>
4264:
4265: <li>
1.14 xtraeme 4266: <p>If you have set <code class=
1.45 wiz 4267: "varname">CVS_USER</code> in <code xmlns=
4268: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4269: "filename">build.conf</code>, make sure that
4270: account exists and can do a <span><strong class=
4271: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4272: properly!</p>
4273: </li>
4274: </ol>
4275: </div>
4276:
1.47 ! reed 4277: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4278: build with the following steps:</p>
4279: <pre class="screen">
1.14 xtraeme 4280: <code class="prompt">#</code> <strong class=
4281: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4282: <code class="prompt">#</code> <strong class=
4283: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4284: </pre>
4285:
4286: <p>This will just jump inside the sandbox and start
4287: building. At the end of the build, mail will be sent
4288: with the results of the build. Created binary pkgs will
1.45 wiz 4289: be in <code xmlns=
4290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4291: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4292: (wherever that points/mounts to/from).</p>
4293: </div>
4294:
4295: <div class="sect2" lang="en" xml:lang="en">
4296: <div class="titlepage">
4297: <div>
4298: <div>
1.30 wiz 4299: <h3 class="title"><a name=
4300: "building-a-partial-set" id=
1.38 dillo 4301: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4302: a partial set of packages</h3>
1.1 grant 4303: </div>
4304: </div>
4305: </div>
4306:
4307: <p>In addition to building a complete set of all
1.45 wiz 4308: packages in pkgsrc, the <code xmlns=
4309: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4310: "filename">pkgsrc/mk/bulk/build</code> script may be
4311: used to build a subset of the packages contained in
1.47 ! reed 4312: pkgsrc. By setting <code class=
1.45 wiz 4313: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4314: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4315: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4316:
4317: <div class="itemizedlist">
4318: <ul type="disc">
4319: <li>
4320: <p>SITE_SPECIFIC_PKGS</p>
4321: </li>
4322:
4323: <li>
4324: <p>HOST_SPECIFIC_PKGS</p>
4325: </li>
4326:
4327: <li>
4328: <p>GROUP_SPECIFIC_PKGS</p>
4329: </li>
4330:
4331: <li>
4332: <p>USER_SPECIFIC_PKGS</p>
4333: </li>
4334: </ul>
4335: </div>
4336:
4337: <p>will define the set of packages which should be
4338: built. The bulk build code will also include any
4339: packages which are needed as dependencies for the
4340: explicitly listed packages.</p>
4341:
4342: <p>One use of this is to do a bulk build with
1.14 xtraeme 4343: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4344: sandbox periodically to have a complete set of the
4345: binary packages needed for your site available without
4346: the overhead of building extra packages that are not
4347: needed.</p>
4348: </div>
1.13 hubertf 4349:
4350: <div class="sect2" lang="en" xml:lang="en">
4351: <div class="titlepage">
4352: <div>
4353: <div>
4354: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4355: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4356: of a bulk build</h3>
4357: </div>
4358: </div>
4359: </div>
4360:
4361: <p>This section describes how pkgsrc developers can
4362: upload binary pkgs built by bulk builds to
4363: ftp.NetBSD.org.</p>
4364:
1.17 sketch 4365: <p>If you would like to automatically create checksum
4366: files for the binary packages you intend to upload,
4367: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4368: in your <code xmlns=
4369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4370: "filename">mk/bulk/build.conf</code>.</p>
4371:
4372: <p>If you would like to PGP sign the checksum files
4373: (highly recommended!), remember to set <code class=
4374: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4375: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4376: class="filename">mk/bulk/build.conf</code>. This will
4377: prompt you for your GPG password to sign the files
1.17 sketch 4378: before uploading everything.</p>
4379:
4380: <p>Then, make sure that you have <code class=
1.14 xtraeme 4381: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4382: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4383: class="filename">mk/bulk/build.conf</code> file, i.e.
4384: adjust it to something like one of the following:</p>
1.13 hubertf 4385: <pre class="screen">
4386: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4387: </pre>
4388:
1.47 ! reed 4389: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4390: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4391: ftp.NetBSD.org is different from <code class=
4392: "varname">CVS_USER</code>, write your login directly
4393: into the variable, e.g. my local account is "feyrer",
4394: but for my login "hubertf", I use:</p>
1.13 hubertf 4395: <pre class="screen">
4396: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4397: </pre>
4398:
1.45 wiz 4399: <p>A separate <code xmlns=
4400: "http://www.w3.org/TR/xhtml1/transitional" class=
4401: "filename">upload</code> directory is used here to
4402: allow "closing" the directory during upload. To do so,
4403: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4404: <pre class="screen">
1.14 xtraeme 4405: nbftp% <strong class=
4406: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4407: </pre>
4408:
1.45 wiz 4409: <p>Please note that <code xmlns=
4410: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4411: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4412: appropriate for packages for the NetBSD operating
4413: system. Binary packages for other operating systems
1.45 wiz 4414: should go into <code xmlns=
4415: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4416: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4417:
4418: <p>Before uploading the binary pkgs, ssh authentication
1.47 ! reed 4419: needs to be set up. This example shows how to set up
1.13 hubertf 4420: temporary keys for the root account <span class=
4421: "emphasis"><em>inside the sandbox</em></span> (assuming
4422: that no keys should be present there usually):</p>
4423: <pre class="screen">
1.14 xtraeme 4424: <code class="prompt">#</code> <strong class=
4425: "userinput"><code>chroot /usr/sandbox</code></strong>
4426: chroot-<code class="prompt">#</code> <strong class=
4427: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4428: chroot-<code class="prompt">#</code> <strong class=
4429: "userinput"><code>ssh-keygen -t dsa</code></strong>
4430: chroot-<code class="prompt">#</code> <strong class=
4431: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4432: </pre>
4433:
1.45 wiz 4434: <p>Now take the output of <code xmlns=
4435: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4436: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4437: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4438: class="filename">~/.ssh/authorized_keys</code> file on
4439: ftp.NetBSD.org. You can remove the key after the upload
4440: is done!</p>
1.13 hubertf 4441:
4442: <p>Next, test if your ssh connection really works:</p>
4443: <pre class="screen">
1.14 xtraeme 4444: chroot-<code class="prompt">#</code> <strong class=
4445: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4446: </pre>
4447:
4448: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4449:
4450: <p>Now after all this works, you can exit the sandbox
4451: and start the upload:</p>
4452: <pre class="screen">
1.14 xtraeme 4453: chroot-<code class="prompt">#</code> <strong class=
4454: "userinput"><code>exit</code></strong>
4455: <code class="prompt">#</code> <strong class=
4456: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4457: <code class="prompt">#</code> <strong class=
4458: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4459: </pre>
4460:
4461: <p>The upload process may take quite some time. Use
1.24 wiz 4462: <a href=
4463: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4464: <span class="citerefentry"><span class=
4465: "refentrytitle">ls</span>(1)</span></a> or <a href=
4466: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4467: <span class="citerefentry"><span class=
4468: "refentrytitle">du</span>(1)</span></a> on the FTP
4469: server to monitor progress of the upload. The upload
4470: script will take care of not uploading restricted
4471: packages and putting vulnerable packages into the
1.45 wiz 4472: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4473: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4474:
4475: <p>After the upload has ended, first thing is to revoke
4476: ssh access:</p>
4477: <pre class="screen">
1.14 xtraeme 4478: nbftp% <strong class=
4479: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4480: Gdd:x!
4481: </pre>
4482:
4483: <p>Use whatever is needed to remove the key you've
4484: entered before! Last, move the uploaded packages out of
1.45 wiz 4485: the <code xmlns=
4486: "http://www.w3.org/TR/xhtml1/transitional" class=
4487: "filename">upload</code> directory to have them
4488: accessible to everyone:</p>
1.13 hubertf 4489: <pre class="screen">
1.14 xtraeme 4490: nbftp% <strong class=
4491: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4492: nbftp% <strong class=
4493: "userinput"><code>mv upload/* .</code></strong>
4494: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4495: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4496: </pre>
4497: </div>
1.1 grant 4498: </div>
4499:
4500: <div class="sect1" lang="en" xml:lang="en">
4501: <div class="titlepage">
4502: <div>
4503: <div>
4504: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4505: "creating-cdroms" id=
1.38 dillo 4506: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4507: CD-ROM packages collection</h2>
1.1 grant 4508: </div>
4509: </div>
4510: </div>
4511:
4512: <p>After your pkgsrc bulk-build has completed, you may
4513: wish to create a CD-ROM set of the resulting binary
4514: packages to assist in installing packages on other
4515: machines. The <a xmlns=
4516: "http://www.w3.org/TR/xhtml1/transitional" href=
4517: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4518: target="_top"><code xmlns="" class=
4519: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4520: simple tool for creating the ISO 9660 images.
4521: <span><strong class="command">cdpack</strong></span>
4522: arranges the packages on the CD-ROMs in a way that keeps
1.47 ! reed 4523: all the dependencies for a given package on the same CD
! 4524: as that package.</p>
1.1 grant 4525:
4526: <div class="sect2" lang="en" xml:lang="en">
4527: <div class="titlepage">
4528: <div>
4529: <div>
1.30 wiz 4530: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4531: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4532: cdpack</h3>
4533: </div>
4534: </div>
4535: </div>
4536:
4537: <p>Complete documentation for cdpack is found in the
1.47 ! reed 4538: cdpack(1) man page. The following short example assumes
1.45 wiz 4539: that the binary packages are left in <code xmlns=
4540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4541: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4542: sufficient disk space exists in <code xmlns=
4543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4544: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4545: <pre class="screen">
1.14 xtraeme 4546: <code class="prompt">#</code> <strong class=
4547: "userinput"><code>mkdir /u2/images</code></strong>
4548: <code class="prompt">#</code> <strong class=
4549: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4550: <code class="prompt">#</code> <strong class=
4551: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4552: </pre>
4553:
4554: <p>If you wish to include a common set of files
1.45 wiz 4555: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4556: class="filename">COPYRIGHT</code>, <code xmlns=
4557: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4558: "filename">README</code>, etc.) on each CD in the
1.1 grant 4559: collection, then you need to create a directory which
4560: contains these files. e.g.</p>
4561: <pre class="screen">
1.14 xtraeme 4562: <code class="prompt">#</code> <strong class=
4563: "userinput"><code>mkdir /tmp/common</code></strong>
4564: <code class="prompt">#</code> <strong class=
4565: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4566: <code class="prompt">#</code> <strong class=
4567: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4568: <code class="prompt">#</code> <strong class=
4569: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4570: <code class="prompt">#</code> <strong class=
4571: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4572: <code class="prompt">#</code> <strong class=
4573: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4574: <code class="prompt">#</code> <strong class=
4575: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4576: </pre>
4577:
4578: <p>Now create the images:</p>
4579: <pre class="screen">
1.14 xtraeme 4580: <code class="prompt">#</code> <strong class=
4581: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4582: </pre>
4583:
1.45 wiz 4584: <p>Each image will contain <code xmlns=
4585: "http://www.w3.org/TR/xhtml1/transitional" class=
4586: "filename">README</code>, <code xmlns=
4587: "http://www.w3.org/TR/xhtml1/transitional" class=
4588: "filename">COPYING</code>, and <code xmlns=
4589: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4590: "filename">bin/myscript</code> in their root
1.1 grant 4591: directories.</p>
4592: </div>
4593: </div>
4594: </div>
4595:
4596: <div class="chapter" lang="en" xml:lang="en">
4597: <div class="titlepage">
4598: <div>
4599: <div>
4600: <h2 class="title"><a name="faq" id=
1.38 dillo 4601: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4602: Questions</h2>
4603: </div>
4604: </div>
4605: </div>
4606:
4607: <div class="toc">
4608: <p><b>Table of Contents</b></p>
4609:
4610: <dl>
1.30 wiz 4611: <dt><span class="sect1"><a href=
1.38 dillo 4612: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4613: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4614:
1.38 dillo 4615: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4616: Where's the pkgviews documentation?</a></span></dt>
4617:
1.38 dillo 4618: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4619: Utilities for package management
4620: (pkgtools)</a></span></dt>
4621:
1.38 dillo 4622: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4623: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4624:
1.30 wiz 4625: <dt><span class="sect1"><a href=
1.38 dillo 4626: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4627: fetching distfiles?</a></span></dt>
1.14 xtraeme 4628:
1.30 wiz 4629: <dt><span class="sect1"><a href=
1.38 dillo 4630: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4631: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4632:
1.30 wiz 4633: <dt><span class="sect1"><a href=
1.38 dillo 4634: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4635: from pkgsrc?</a></span></dt>
1.1 grant 4636:
1.30 wiz 4637: <dt><span class="sect1"><a href=
1.38 dillo 4638: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4639: behind a firewall</a></span></dt>
1.1 grant 4640:
1.38 dillo 4641: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4642: do I tell <span><strong class="command">make
4643: fetch</strong></span> to do passive
4644: FTP?</a></span></dt>
1.1 grant 4645:
1.30 wiz 4646: <dt><span class="sect1"><a href=
1.38 dillo 4647: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4648: distfiles at once</a></span></dt>
1.1 grant 4649:
1.30 wiz 4650: <dt><span class="sect1"><a href=
1.38 dillo 4651: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4652: “<span class="quote">Don't know how to make
1.14 xtraeme 4653: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4654: mean?</a></span></dt>
4655:
1.30 wiz 4656: <dt><span class="sect1"><a href=
1.38 dillo 4657: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4658: “<span class="quote">Could not find
1.14 xtraeme 4659: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4660:
1.30 wiz 4661: <dt><span class="sect1"><a href=
1.38 dillo 4662: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4663: pkgsrc</a></span></dt>
1.1 grant 4664:
1.38 dillo 4665: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4666: do I change the location of configuration
4667: files?</a></span></dt>
1.1 grant 4668:
1.38 dillo 4669: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4670: Automated security checks</a></span></dt>
4671: </dl>
4672: </div>
4673:
4674: <p>This section contains hints, tips & tricks on
4675: special things in pkgsrc that we didn't find a better place
4676: for in the previous chapters, and it contains items for
4677: both pkgsrc users and developers.</p>
4678:
4679: <div class="sect1" lang="en" xml:lang="en">
4680: <div class="titlepage">
4681: <div>
4682: <div>
4683: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4684: "mailing-list-pointers" id=
1.38 dillo 4685: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4686: mailing lists for pkg-related discussion?</h2>
1.1 grant 4687: </div>
4688: </div>
4689: </div>
4690:
1.18 xtraeme 4691: <p>The following mailing lists may be of interest to
4692: pkgsrc users:</p>
4693:
4694: <div class="itemizedlist">
4695: <ul type="disc">
4696: <li>
4697: <p><a href=
4698: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4699: target="_top">pkgsrc-bugs</a>: A list where problem
4700: reports related to pkgsrc are sent and
4701: discussed.</p>
1.18 xtraeme 4702: </li>
4703:
4704: <li>
4705: <p><a href=
4706: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4707: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4708: results of pkgsrc bulk builds are sent and
1.34 wiz 4709: discussed.</p>
1.18 xtraeme 4710: </li>
4711:
4712: <li>
4713: <p><a href=
4714: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4715: target="_top">pkgsrc-changes</a>: A list where all
4716: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4717: </li>
4718:
4719: <li>
4720: <p><a href=
4721: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4722: target="_top">tech-pkg</a>: A general discussion
4723: list for all things related to pkgsrc.</p>
1.18 xtraeme 4724: </li>
4725: </ul>
4726: </div>
4727:
4728: <p>To subscribe, do:</p>
1.1 grant 4729: <pre class="programlisting">
1.18 xtraeme 4730: <code class="prompt">%</code> echo subscribe <em class=
4731: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4732: </pre>
4733:
1.18 xtraeme 4734: <p>Archives for all these mailing lists are available
4735: from <a href="http://mail-index.NetBSD.org/" target=
4736: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4737: </div>
4738:
4739: <div class="sect1" lang="en" xml:lang="en">
4740: <div class="titlepage">
4741: <div>
4742: <div>
4743: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4744: "pkgviews-docs" id=
1.38 dillo 4745: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4746: documentation?</h2>
1.1 grant 4747: </div>
4748: </div>
4749: </div>
4750:
4751: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4752: find a pkgviews User's guide in <code xmlns=
4753: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4754: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4755: </div>
4756:
4757: <div class="sect1" lang="en" xml:lang="en">
4758: <div class="titlepage">
4759: <div>
4760: <div>
4761: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4762: "faq-pkgtools" id=
1.38 dillo 4763: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4764: management (pkgtools)</h2>
1.1 grant 4765: </div>
4766: </div>
4767: </div>
4768:
1.45 wiz 4769: <p>The <code xmlns=
4770: "http://www.w3.org/TR/xhtml1/transitional" class=
4771: "filename">pkgsrc/pkgtools</code> directory pkgtools
4772: contains a number of useful utilities for both users and
4773: developers of pkgsrc. This section attempts only to make
4774: the reader aware of the utilities and when they might be
4775: useful, and not to duplicate the documentation that comes
4776: with each package.</p>
1.1 grant 4777:
4778: <p>Utilities used by pkgsrc (automatically installed when
4779: needed):</p>
4780:
4781: <div class="itemizedlist">
4782: <ul type="disc">
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/x11-links/README.html"
1.45 wiz 4787: target="_top"><code xmlns="" class=
4788: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4789: for use by buildlink.</p>
1.1 grant 4790: </li>
4791: </ul>
4792: </div>
4793:
4794: <p>OS tool augmentation (automatically installed when
4795: needed):</p>
4796:
4797: <div class="itemizedlist">
4798: <ul type="disc">
4799: <li>
4800: <p><a xmlns=
4801: "http://www.w3.org/TR/xhtml1/transitional" href=
4802: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 4803: target="_top"><code xmlns="" class=
4804: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 4805: various kinds of checksums (including SHA1).</p>
1.1 grant 4806: </li>
4807:
4808: <li>
4809: <p><a xmlns=
4810: "http://www.w3.org/TR/xhtml1/transitional" href=
4811: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 4812: target="_top"><code xmlns="" class=
4813: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 4814: Compatibility library for pkgsrc tools.</p>
1.1 grant 4815: </li>
4816:
4817: <li>
4818: <p><a xmlns=
4819: "http://www.w3.org/TR/xhtml1/transitional" href=
4820: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 4821: target="_top"><code xmlns="" class=
4822: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 4823: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4824: </li>
4825:
4826: <li>
4827: <p><a xmlns=
4828: "http://www.w3.org/TR/xhtml1/transitional" href=
4829: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 4830: target="_top"><code xmlns="" class=
4831: "filename">pkgtools/pkg_install</code></a>:
4832: Up-to-date replacement for <code xmlns=
4833: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 4834: "filename">/usr/sbin/pkg_install</code>, or for use
4835: on operating systems where pkg_install is not
4836: present.</p>
1.1 grant 4837: </li>
4838: </ul>
4839: </div>
4840:
4841: <p>Utilities used by pkgsrc (not automatically
4842: installed):</p>
4843:
4844: <div class="itemizedlist">
4845: <ul type="disc">
4846: <li>
4847: <p><a xmlns=
4848: "http://www.w3.org/TR/xhtml1/transitional" href=
4849: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 4850: target="_top"><code xmlns="" class=
4851: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 4852: binary package from an already-installed package.
1.34 wiz 4853: Used by <span><strong class="command">make
4854: replace</strong></span> to save the old
4855: package.</p>
1.1 grant 4856: </li>
4857:
4858: <li>
4859: <p><a xmlns=
4860: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4861: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 4862: target="_top"><code xmlns="" class=
4863: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 4864: functionality to pkgsrc, allowing it to fetch
4865: distfiles from multiple locations. It currently
4866: supports the following methods: multiple CD-ROMs
4867: and network FTP/HTTP connections.</p>
1.5 hubertf 4868: </li>
4869:
4870: <li>
4871: <p><a xmlns=
4872: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4873: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 4874: target="_top"><code xmlns="" class=
4875: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 4876: packages someplace else (enabled by default).</p>
1.1 grant 4877: </li>
1.5 hubertf 4878:
4879: <li>
4880: <p><a xmlns=
4881: "http://www.w3.org/TR/xhtml1/transitional" href=
4882: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 4883: target="_top"><code xmlns="" class=
4884: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 4885: best compiler flags to optimise code for your
1.20 ben 4886: current CPU and compiler.</p>
1.5 hubertf 4887: </li>
1.1 grant 4888: </ul>
4889: </div>
4890:
4891: <p>Utilities for keeping track of installed packages,
4892: being up to date, etc:</p>
4893:
4894: <div class="itemizedlist">
4895: <ul type="disc">
4896: <li>
4897: <p><a xmlns=
4898: "http://www.w3.org/TR/xhtml1/transitional" href=
4899: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 4900: target="_top"><code xmlns="" class=
4901: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 4902: packages whose installed versions do not match the
1.34 wiz 4903: latest pkgsrc entries.</p>
1.1 grant 4904: </li>
4905:
4906: <li>
4907: <p><a xmlns=
4908: "http://www.w3.org/TR/xhtml1/transitional" href=
4909: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 4910: target="_top"><code xmlns="" class=
4911: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 4912: dependency graphs of packages, to aid in choosing a
1.34 wiz 4913: strategy for updating.</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/pkgdepgraph/README.html"
1.45 wiz 4920: target="_top"><code xmlns="" class=
4921: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 4922: graphs from the output of <a xmlns=
4923: "http://www.w3.org/TR/xhtml1/transitional" href=
4924: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 4925: target="_top"><code xmlns="" class=
4926: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 4927: graphviz).</p>
1.1 grant 4928: </li>
4929:
4930: <li>
4931: <p><a xmlns=
4932: "http://www.w3.org/TR/xhtml1/transitional" href=
4933: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 4934: target="_top"><code xmlns="" class=
4935: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 4936: pkglint(1) program checks a pkgsrc entry for
4937: errors, lintpkgsrc(1) does various checks on the
4938: complete pkgsrc system.</p>
1.1 grant 4939: </li>
4940:
4941: <li>
4942: <p><a xmlns=
4943: "http://www.w3.org/TR/xhtml1/transitional" href=
4944: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 4945: target="_top"><code xmlns="" class=
4946: "filename">pkgtools/pkgsurvey</code></a>: Report
4947: what packages you have installed.</p>
1.1 grant 4948: </li>
4949: </ul>
4950: </div>
4951:
4952: <p>Utilities for people maintaining or creating
4953: individual packages:</p>
4954:
4955: <div class="itemizedlist">
4956: <ul type="disc">
4957: <li>
4958: <p><a xmlns=
4959: "http://www.w3.org/TR/xhtml1/transitional" href=
4960: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 4961: target="_top"><code xmlns="" class=
4962: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 4963: making and maintaining patches for a package
1.34 wiz 4964: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4965: </li>
4966:
4967: <li>
4968: <p><a xmlns=
4969: "http://www.w3.org/TR/xhtml1/transitional" href=
4970: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 4971: target="_top"><code xmlns="" class=
4972: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 4973: "http://www.w3.org/TR/xhtml1/transitional" href=
4974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 4975: target="_top"><code xmlns="" class=
4976: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 4977: converting to pkgsrc.</p>
1.1 grant 4978: </li>
4979:
4980: <li>
4981: <p><a xmlns=
4982: "http://www.w3.org/TR/xhtml1/transitional" href=
4983: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 4984: target="_top"><code xmlns="" class=
4985: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 4986: pkgsrc to a Solaris package.</p>
1.1 grant 4987: </li>
4988: </ul>
4989: </div>
4990:
1.47 ! reed 4991: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 4992: obscure pkg utilities)</p>
4993:
4994: <div class="itemizedlist">
4995: <ul type="disc">
4996: <li>
4997: <p><a xmlns=
4998: "http://www.w3.org/TR/xhtml1/transitional" href=
4999: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5000: target="_top"><code xmlns="" class=
5001: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5002: packages in a chrooted area.</p>
1.1 grant 5003: </li>
5004:
5005: <li>
5006: <p><a xmlns=
5007: "http://www.w3.org/TR/xhtml1/transitional" href=
5008: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5009: target="_top"><code xmlns="" class=
5010: "filename">pkgtools/libkver</code></a>: Spoof
5011: kernel version for chrooted cross builds.</p>
1.1 grant 5012: </li>
5013: </ul>
5014: </div>
5015: </div>
5016:
5017: <div class="sect1" lang="en" xml:lang="en">
5018: <div class="titlepage">
5019: <div>
5020: <div>
5021: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5022: "non-root-pkgsrc" id=
1.38 dillo 5023: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5024: as non-root</h2>
1.1 grant 5025: </div>
5026: </div>
5027: </div>
5028:
5029: <p>If you want to use pkgsrc as non-root user, you can
5030: set some variables to make pkgsrc work under these
1.33 jmmv 5031: conditions. At the very least, you need to set
5032: <code class="varname">UNPRIVILEGED</code> to
5033: “<span class="quote">yes</span>”; this will
5034: turn on unprivileged mode and set multiple related
5035: variables to allow installation of packages as
5036: non-root.</p>
5037:
5038: <p>In case the defaults are not enough, you may want to
5039: tune some other variables used. For example, if the
5040: automatic user/group detection leads to incorrect values
5041: (or not the ones you would like to use), you can change
5042: them by setting <code class=
5043: "varname">UNPRIVILEGED_USER</code> and <code class=
5044: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5045:
5046: <p>As regards bootstrapping, please note that the
5047: <span><strong class="command">bootstrap</strong></span>
5048: script will ease non-root configuration when given the
5049: “<span class=
5050: "quote">--ignore-user-check</span>” flag, as it
5051: will choose and use multiple default directories under
1.45 wiz 5052: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5053: class="filename">~/pkg</code> as the installation
1.33 jmmv 5054: targets. These directories can be overriden by the
5055: “<span class="quote">--prefix</span>” flag
5056: provided by the script, as well as some others that allow
5057: finer tuning of the tree layout.</p>
1.14 xtraeme 5058: </div>
5059:
5060: <div class="sect1" lang="en" xml:lang="en">
5061: <div class="titlepage">
5062: <div>
5063: <div>
5064: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5065: "resume-transfers" id=
1.38 dillo 5066: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5067: transfers when fetching distfiles?</h2>
1.14 xtraeme 5068: </div>
5069: </div>
5070: </div>
5071:
1.47 ! reed 5072: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5073: but you can enable this feature by adding the option
5074: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5075: into <code xmlns=
5076: "http://www.w3.org/TR/xhtml1/transitional" class=
5077: "filename">/etc/mk.conf</code>. If, during a fetch step,
5078: an incomplete distfile is found, pkgsrc will try to
5079: resume it.</p>
1.15 xtraeme 5080:
5081: <p>You can also use a different program than the default
1.24 wiz 5082: <a href=
5083: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5084: <span class="citerefentry"><span class=
5085: "refentrytitle">ftp</span>(1)</span></a> by changing the
5086: <code class="varname">FETCH_CMD</code> variable. Don't
5087: forget to set <code class=
5088: "varname">FETCH_RESUME_ARGS</code> and <code class=
5089: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5090: default values.</p>
1.14 xtraeme 5091:
1.45 wiz 5092: <p>For example, if you want to use <code xmlns=
5093: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5094: "filename">wget</code> to resume downloads, you'll have
5095: to use something like:</p>
5096: <pre class="programlisting">
1.34 wiz 5097: FETCH_CMD=wget
5098: FETCH_BEFORE_ARGS=--passive-ftp
5099: FETCH_RESUME_ARGS=-c
5100: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 5101: </pre>
1.1 grant 5102: </div>
5103:
5104: <div class="sect1" lang="en" xml:lang="en">
5105: <div class="titlepage">
5106: <div>
5107: <div>
5108: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5109: "XFree86-from-pkgsrc" id=
1.38 dillo 5110: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5111: install/use XFree86 from pkgsrc?</h2>
5112: </div>
5113: </div>
5114: </div>
5115:
5116: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5117: system's own X11 (<code xmlns=
5118: "http://www.w3.org/TR/xhtml1/transitional" class=
5119: "filename">/usr/X11R6</code>, <code xmlns=
5120: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5121: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5122: add the following line into <code xmlns=
5123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5124: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5125: <pre class="programlisting">
1.34 wiz 5126: X11_TYPE=XFree86
1.1 grant 5127: </pre>
5128: </div>
5129:
5130: <div class="sect1" lang="en" xml:lang="en">
5131: <div class="titlepage">
5132: <div>
5133: <div>
5134: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5135: "x.org-from-pkgsrc" id=
1.38 dillo 5136: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5137: install/use X.org from pkgsrc?</h2>
5138: </div>
5139: </div>
5140: </div>
5141:
5142: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5143: system's own X11 (<code xmlns=
5144: "http://www.w3.org/TR/xhtml1/transitional" class=
5145: "filename">/usr/X11R6</code>, <code xmlns=
5146: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5147: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5148: the following line into <code xmlns=
5149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5150: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5151: <pre class="programlisting">
1.34 wiz 5152: X11_TYPE=xorg
1.1 grant 5153: </pre>
5154: </div>
5155:
5156: <div class="sect1" lang="en" xml:lang="en">
5157: <div class="titlepage">
5158: <div>
5159: <div>
5160: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5161: "fetch-behind-firewall" id=
1.38 dillo 5162: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5163: files from behind a firewall</h2>
1.1 grant 5164: </div>
5165: </div>
5166: </div>
5167:
5168: <p>If you are sitting behind a firewall which does not
5169: allow direct connections to Internet hosts (i.e.
5170: non-NAT), you may specify the relevant proxy hosts. This
5171: is done using an environment variable in the form of a
1.47 ! reed 5172: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5173: "quote">orpheus.amdahl.com</span>” is one of the
5174: firewalls, and it uses port 80 as the proxy port number.
5175: So the proxy environment variables are:</p>
5176: <pre class="programlisting">
1.34 wiz 5177: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 5178: http_proxy=http://orpheus.amdahl.com:80/
5179: </pre>
5180: </div>
5181:
5182: <div class="sect1" lang="en" xml:lang="en">
5183: <div class="titlepage">
5184: <div>
5185: <div>
5186: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5187: "passive-ftp" id="passive-ftp"></a>7.9. How do
1.30 wiz 5188: I tell <span><strong class="command">make
1.14 xtraeme 5189: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5190: </div>
5191: </div>
5192: </div>
5193:
5194: <p>This depends on which utility is used to retrieve
1.45 wiz 5195: distfiles. From <code xmlns=
5196: "http://www.w3.org/TR/xhtml1/transitional" class=
5197: "filename">bsd.pkg.mk</code>, <code class=
5198: "varname">FETCH_CMD</code> is assigned the first
5199: available command from the following list:</p>
1.34 wiz 5200:
5201: <div class="itemizedlist">
5202: <ul type="disc">
5203: <li>
1.45 wiz 5204: <p><code xmlns=
5205: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5206: "filename">${LOCALBASE}/bin/ftp</code></p>
5207: </li>
5208:
5209: <li>
1.45 wiz 5210: <p><code xmlns=
5211: "http://www.w3.org/TR/xhtml1/transitional" class=
5212: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5213: </li>
5214: </ul>
5215: </div>
1.1 grant 5216:
5217: <p>On a default NetBSD installation, this will be
1.45 wiz 5218: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5219: class="filename">/usr/bin/ftp</code>, which automatically
5220: tries passive connections first, and falls back to active
5221: connections if the server refuses to do passive. For the
5222: other tools, add the following to your <code xmlns=
5223: "http://www.w3.org/TR/xhtml1/transitional" class=
5224: "filename">/etc/mk.conf</code> file: <code class=
5225: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5226:
1.45 wiz 5227: <p>Having that option present will prevent <code xmlns=
5228: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5229: "filename">/usr/bin/ftp</code> from falling back to
5230: active transfers.</p>
1.1 grant 5231: </div>
5232:
5233: <div class="sect1" lang="en" xml:lang="en">
5234: <div class="titlepage">
5235: <div>
5236: <div>
5237: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5238: "fetching-all-distfiles" id=
1.38 dillo 5239: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5240: fetch all distfiles at once</h2>
5241: </div>
5242: </div>
5243: </div>
5244:
5245: <p>You would like to download all the distfiles in a
5246: single batch from work or university, where you can't run
1.14 xtraeme 5247: a <span><strong class="command">make
5248: fetch</strong></span>. There is an archive of distfiles
5249: on <a href=
1.1 grant 5250: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5251: target="_top">ftp.NetBSD.org</a>, but downloading the
5252: entire directory may not be appropriate.</p>
5253:
1.14 xtraeme 5254: <p>The answer here is to do a <span><strong class=
1.45 wiz 5255: "command">make fetch-list</strong></span> in <code xmlns=
5256: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 5257: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5258: subdirectories, carry the resulting list to your machine
1.23 wiz 5259: at work/school and use it there. If you don't have a
1.24 wiz 5260: NetBSD-compatible <a href=
5261: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5262: <span class="citerefentry"><span class=
5263: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5264: at work, don't forget to set <code class=
5265: "varname">FETCH_CMD</code> to something that fetches a
5266: URL:</p>
1.1 grant 5267:
5268: <p>At home:</p>
5269: <pre class="screen">
1.14 xtraeme 5270: <code class="prompt">%</code> <strong class=
5271: "userinput"><code>cd /usr/pkgsrc</code></strong>
5272: <code class="prompt">%</code> <strong class=
5273: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5274: <code class="prompt">%</code> <strong class=
5275: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5276: </pre>
5277:
5278: <p>At work:</p>
5279: <pre class="screen">
1.14 xtraeme 5280: <code class="prompt">%</code> <strong class=
5281: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5282: </pre>
5283:
1.45 wiz 5284: <p>then tar up <code xmlns=
5285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5286: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5287:
5288: <p>If you have a machine running NetBSD, and you want to
5289: get <span class="emphasis"><em>all</em></span> distfiles
5290: (even ones that aren't for your machine architecture),
5291: you can do so by using the above-mentioned
1.14 xtraeme 5292: <span><strong class="command">make
5293: fetch-list</strong></span> approach, or fetch the
5294: distfiles directly by running:</p>
1.1 grant 5295: <pre class="screen">
1.14 xtraeme 5296: <code class="prompt">%</code> <strong class=
5297: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5298: </pre>
5299:
1.14 xtraeme 5300: <p>If you even decide to ignore <code class=
5301: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5302: can get everything by running:</p>
1.1 grant 5303: <pre class="screen">
1.14 xtraeme 5304: <code class="prompt">%</code> <strong class=
5305: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5306: </pre>
5307: </div>
5308:
5309: <div class="sect1" lang="en" xml:lang="en">
5310: <div class="titlepage">
5311: <div>
5312: <div>
5313: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5314: "tmac.andoc-missing" id=
1.38 dillo 5315: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5316: “<span class="quote">Don't know how to make
5317: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5318: </div>
5319: </div>
5320: </div>
5321:
5322: <p>When compiling the <a xmlns=
5323: "http://www.w3.org/TR/xhtml1/transitional" href=
5324: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5325: target="_top"><code xmlns="" class=
5326: "filename">pkgtools/pkg_install</code></a> package, you
5327: get the error from make that it doesn't know how to make
5328: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5329: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5330: indicates that you don't have installed the
1.23 wiz 5331: “<span class="quote">text</span>” set (nroff,
5332: ...) from the NetBSD base distribution on your machine.
1.47 ! reed 5333: It is recommended to do that to format man pages.</p>
1.1 grant 5334:
5335: <p>In the case of the <a xmlns=
5336: "http://www.w3.org/TR/xhtml1/transitional" href=
5337: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5338: target="_top"><code xmlns="" class=
5339: "filename">pkgtools/pkg_install</code></a> package, you
5340: can get away with setting <code class=
1.20 ben 5341: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5342: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5343: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5344: </div>
5345:
5346: <div class="sect1" lang="en" xml:lang="en">
5347: <div class="titlepage">
5348: <div>
5349: <div>
5350: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5351: "bsd.own.mk-missing" id=
1.38 dillo 5352: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5353: “<span class="quote">Could not find
5354: bsd.own.mk</span>” mean?</h2>
5355: </div>
5356: </div>
5357: </div>
5358:
1.45 wiz 5359: <p>You didn't install the compiler set, <code xmlns=
5360: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5361: "filename">comp.tgz</code>, when you installed your
1.47 ! reed 5362: NetBSD machine. Please get and install it, by extracting
! 5363: it in <code xmlns=
1.45 wiz 5364: "http://www.w3.org/TR/xhtml1/transitional" class=
5365: "filename">/</code>:</p>
1.1 grant 5366: <pre class="screen">
1.14 xtraeme 5367: <code class="prompt">#</code> <strong class=
5368: "userinput"><code>cd /</code></strong>
5369: <code class="prompt">#</code> <strong class=
5370: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5371: </pre>
5372:
1.45 wiz 5373: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5374: class="filename">comp.tgz</code> is part of every NetBSD
5375: release. Get the one that corresponds to your release
5376: (determine via <span><strong class="command">uname
5377: -r</strong></span>).</p>
1.1 grant 5378: </div>
5379:
5380: <div class="sect1" lang="en" xml:lang="en">
5381: <div class="titlepage">
5382: <div>
5383: <div>
5384: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5385: "using-sudo-with-pkgsrc" id=
1.38 dillo 5386: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5387: 'sudo' with pkgsrc</h2>
5388: </div>
5389: </div>
5390: </div>
5391:
5392: <p>When installing packages as non-root user and using
1.24 wiz 5393: the just-in-time <a href=
5394: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5395: <span class="citerefentry"><span class=
5396: "refentrytitle">su</span>(1)</span></a> feature of
5397: pkgsrc, it can become annoying to type in the root
5398: password for each required package installed. To avoid
5399: this, the sudo package can be used, which does password
5400: caching over a limited time. To use it, install sudo
5401: (either as binary package or from <a xmlns=
5402: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5403: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5404: target="_top"><code xmlns="" class=
5405: "filename">security/sudo</code></a>) and then put the
5406: following into your <code xmlns=
5407: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5408: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5409: <pre class="programlisting">
1.34 wiz 5410: .if exists(${LOCALBASE}/bin/sudo)
5411: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
5412: .endif
1.1 grant 5413: </pre>
5414: </div>
5415:
5416: <div class="sect1" lang="en" xml:lang="en">
5417: <div class="titlepage">
5418: <div>
5419: <div>
5420: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5421: "faq.conf" id="faq.conf"></a>7.14. How do I
1.35 jmmv 5422: change the location of configuration files?</h2>
1.1 grant 5423: </div>
5424: </div>
5425: </div>
5426:
1.35 jmmv 5427: <p>As the system administrator, you can choose where
5428: configuration files are installed. The default settings
1.45 wiz 5429: make all these files go into <code xmlns=
5430: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5431: "filename">${PREFIX}/etc</code> or some of its
5432: subdirectories; this may be suboptimal depending on your
5433: expectations (e.g., a read-only, NFS-exported
5434: <code class="varname">PREFIX</code> with a need of
5435: per-machine configuration of the provided packages).</p>
5436:
5437: <p>In order to change the defaults, you can modify the
5438: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5439: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5440: class="filename">/etc/mk.conf</code>) to point to your
5441: preferred configuration directory; some common examples
5442: include <code xmlns=
5443: "http://www.w3.org/TR/xhtml1/transitional" class=
5444: "filename">/etc</code> or <code xmlns=
5445: "http://www.w3.org/TR/xhtml1/transitional" class=
5446: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5447:
5448: <p>Furthermore, you can change this value on a
5449: per-package basis by setting the <code class=
5450: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5451: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5452: value usually matches the name of the package you would
5453: like to modify, that is, the contents of <code class=
5454: "varname">PKGBASE</code>.</p>
1.1 grant 5455:
1.47 ! reed 5456: <p>Note that after changing these settings, you must
1.35 jmmv 5457: rebuild and reinstall any affected packages.</p>
1.1 grant 5458: </div>
5459:
5460: <div class="sect1" lang="en" xml:lang="en">
5461: <div class="titlepage">
5462: <div>
5463: <div>
5464: <h2 class="title" style="clear: both"><a name=
5465: "audit-packages" id=
1.38 dillo 5466: "audit-packages"></a>7.15. Automated security
1.1 grant 5467: checks</h2>
5468: </div>
5469: </div>
5470: </div>
5471:
5472: <p>Please be aware that there can often be bugs in
5473: third-party software, and some of these bugs can leave a
5474: machine vulnerable to exploitation by attackers. In an
5475: effort to lessen the exposure, the NetBSD packages team
5476: maintains a database of known-exploits to packages which
5477: have at one time been included in pkgsrc. The database
5478: can be downloaded automatically, and a security audit of
5479: all packages installed on a system can take place. To do
5480: this, install the <a xmlns=
5481: "http://www.w3.org/TR/xhtml1/transitional" href=
5482: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5483: target="_top"><code xmlns="" class=
5484: "filename">security/audit-packages</code></a> package. It
1.20 ben 5485: has two components:</p>
1.1 grant 5486:
5487: <div class="orderedlist">
5488: <ol type="1">
5489: <li>
1.34 wiz 5490: <p><span><strong class=
5491: "command">download-vulnerability-list</strong></span>,
1.1 grant 5492: an easy way to download a list of the security
5493: vulnerabilities information. This list is kept up
5494: to date by the NetBSD security officer and the
5495: NetBSD packages team, and is distributed from the
5496: NetBSD ftp server:</p>
5497:
5498: <p><a href=
5499: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5500: target=
5501: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5502: </li>
5503:
5504: <li>
1.34 wiz 5505: <p><span><strong class=
5506: "command">audit-packages</strong></span>, an easy
5507: way to audit the current machine, checking each
1.1 grant 5508: vulnerability which is known. If a vulnerable
5509: package is installed, it will be shown by output to
5510: stdout, including a description of the type of
5511: vulnerability, and a URL containing more
5512: information.</p>
5513: </li>
5514: </ol>
5515: </div>
5516:
1.23 wiz 5517: <p>Use of the <a xmlns=
5518: "http://www.w3.org/TR/xhtml1/transitional" href=
5519: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5520: target="_top"><code xmlns="" class=
5521: "filename">security/audit-packages</code></a> package is
1.23 wiz 5522: strongly recommended! After “<span class=
5523: "quote">audit-packages</span>” is installed, please
5524: read the package's message, which you can get by running
5525: <strong class="userinput"><code>pkg_info -D
5526: audit-package</code></strong>.</p>
1.1 grant 5527: </div>
5528: </div>
5529: </div>
5530:
5531: <div class="part" lang="en" xml:lang="en">
5532: <div class="titlepage">
5533: <div>
5534: <div>
5535: <h1 class="title"><a name="developers-guide" id=
1.46 gdt 5536: "developers-guide"></a>The pkgsrc developer's
5537: guide</h1>
1.1 grant 5538: </div>
5539: </div>
5540: </div>
5541:
5542: <div class="toc">
5543: <p><b>Table of Contents</b></p>
5544:
5545: <dl>
1.38 dillo 5546: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5547: Package components - files, directories and
5548: contents</a></span></dt>
5549:
5550: <dd>
5551: <dl>
5552: <dt><span class="sect1"><a href=
1.45 wiz 5553: "#components.Makefile">8.1. <code xmlns=
5554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5555: "filename">Makefile</code></a></span></dt>
5556:
5557: <dt><span class="sect1"><a href=
1.45 wiz 5558: "#components.distinfo">8.2. <code xmlns=
5559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5560: "filename">distinfo</code></a></span></dt>
5561:
5562: <dt><span class="sect1"><a href=
1.38 dillo 5563: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5564:
1.30 wiz 5565: <dt><span class="sect1"><a href=
1.38 dillo 5566: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5567: files</a></span></dt>
1.27 rillig 5568:
5569: <dt><span class="sect1"><a href=
1.38 dillo 5570: "#components.optional">8.5. Optional
1.27 rillig 5571: files</a></span></dt>
5572:
1.38 dillo 5573: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5574: <code xmlns=
5575: "http://www.w3.org/TR/xhtml1/transitional" class=
5576: "filename">work*</code></a></span></dt>
1.27 rillig 5577:
1.38 dillo 5578: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5579: <code xmlns=
5580: "http://www.w3.org/TR/xhtml1/transitional" class=
5581: "filename">files/*</code></a></span></dt>
1.27 rillig 5582: </dl>
5583: </dd>
5584:
1.38 dillo 5585: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5586: Programming in <code xmlns=
5587: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5588: "filename">Makefile</code>s</a></span></dt>
5589:
5590: <dd>
5591: <dl>
5592: <dt><span class="sect1"><a href=
1.45 wiz 5593: "#makefile.variables">9.1. <code xmlns=
5594: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5595: "filename">Makefile</code> variables</a></span></dt>
5596:
1.27 rillig 5597: <dd>
5598: <dl>
5599: <dt><span class="sect2"><a href=
1.38 dillo 5600: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5601: conventions</a></span></dt>
5602: </dl>
5603: </dd>
5604:
1.38 dillo 5605: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5606: Code snippets</a></span></dt>
5607:
5608: <dd>
5609: <dl>
5610: <dt><span class="sect2"><a href=
1.38 dillo 5611: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5612: list</a></span></dt>
5613:
5614: <dt><span class="sect2"><a href=
1.38 dillo 5615: "#converting-internal-to-external">9.2.2.
1.30 wiz 5616: Converting an internal list into an external
5617: list</a></span></dt>
1.25 rillig 5618:
5619: <dt><span class="sect2"><a href=
1.38 dillo 5620: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5621: variables to a shell command</a></span></dt>
1.27 rillig 5622:
5623: <dt><span class="sect2"><a href=
1.38 dillo 5624: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5625: guideline</a></span></dt>
5626:
5627: <dt><span class="sect2"><a href=
1.38 dillo 5628: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5629: a bug in BSD Make</a></span></dt>
1.25 rillig 5630: </dl>
5631: </dd>
5632: </dl>
5633: </dd>
5634:
1.38 dillo 5635: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5636: issues</a></span></dt>
5637:
5638: <dd>
5639: <dl>
1.38 dillo 5640: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5641: ID</a></span></dt>
5642:
1.30 wiz 5643: <dt><span class="sect1"><a href=
1.38 dillo 5644: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5645: <code xmlns=
5646: "http://www.w3.org/TR/xhtml1/transitional" class=
5647: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5648:
1.38 dillo 5649: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5650: Tweaking output of <span><strong class="command">make
5651: print-PLIST</strong></span></a></span></dt>
1.1 grant 5652:
1.38 dillo 5653: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5654: Variable substitution in PLIST</a></span></dt>
5655:
1.30 wiz 5656: <dt><span class="sect1"><a href=
1.47 ! reed 5657: "#manpage-compression">10.5. Man
! 5658: page-compression</a></span></dt>
1.1 grant 5659:
1.30 wiz 5660: <dt><span class="sect1"><a href=
1.38 dillo 5661: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5662: <code class=
1.14 xtraeme 5663: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5664:
1.30 wiz 5665: <dt><span class="sect1"><a href=
1.47 ! reed 5666: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5667: and differing PLISTs</a></span></dt>
1.1 grant 5668:
5669: <dt><span class="sect1"><a href=
1.38 dillo 5670: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5671: packages</a></span></dt>
5672: </dl>
5673: </dd>
5674:
1.38 dillo 5675: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5676: Buildlink methodology</a></span></dt>
5677:
5678: <dd>
5679: <dl>
1.30 wiz 5680: <dt><span class="sect1"><a href=
1.38 dillo 5681: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5682: to use buildlink3</a></span></dt>
1.1 grant 5683:
1.30 wiz 5684: <dt><span class="sect1"><a href=
1.45 wiz 5685: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5686: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5687: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5688:
5689: <dd>
5690: <dl>
5691: <dt><span class="sect2"><a href=
1.38 dillo 5692: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5693: buildlink3.mk file</a></span></dt>
1.1 grant 5694:
5695: <dt><span class="sect2"><a href=
1.38 dillo 5696: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5697: <code class=
5698: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 wiz 5699: <code>pkg</code></em></code> in <code xmlns=
5700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5701: "filename">buildlink3.mk</code>
1.1 grant 5702: files</a></span></dt>
5703: </dl>
5704: </dd>
5705:
1.30 wiz 5706: <dt><span class="sect1"><a href=
1.45 wiz 5707: "#writing-builtin.mk">11.3. Writing <code xmlns=
5708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5709: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5710:
5711: <dd>
5712: <dl>
5713: <dt><span class="sect2"><a href=
1.38 dillo 5714: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5715: <code xmlns=
5716: "http://www.w3.org/TR/xhtml1/transitional" class=
5717: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5718:
5719: <dt><span class="sect2"><a href=
1.38 dillo 5720: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5721: preferences for native or pkgsrc
5722: software</a></span></dt>
1.1 grant 5723: </dl>
5724: </dd>
5725: </dl>
5726: </dd>
5727:
1.38 dillo 5728: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5729: pkginstall framework</a></span></dt>
5730:
5731: <dd>
5732: <dl>
5733: <dt><span class="sect1"><a href=
1.38 dillo 5734: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5735: directories outside the installation
5736: prefix</a></span></dt>
5737:
5738: <dd>
5739: <dl>
5740: <dt><span class="sect2"><a href=
1.38 dillo 5741: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5742: manipulation</a></span></dt>
5743:
5744: <dt><span class="sect2"><a href=
1.38 dillo 5745: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5746: manipulation</a></span></dt>
5747: </dl>
5748: </dd>
5749:
1.38 dillo 5750: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5751: Configuration files</a></span></dt>
5752:
5753: <dd>
5754: <dl>
5755: <dt><span class="sect2"><a href=
1.38 dillo 5756: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5757: "varname">PKG_SYSCONFDIR</code> is
5758: set</a></span></dt>
5759:
5760: <dt><span class="sect2"><a href=
1.38 dillo 5761: "#conf-files-configure">12.2.2. Telling the
1.47 ! reed 5762: software where configuration files
1.35 jmmv 5763: are</a></span></dt>
5764:
5765: <dt><span class="sect2"><a href=
1.38 dillo 5766: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5767: installations</a></span></dt>
5768:
5769: <dt><span class="sect2"><a href=
1.38 dillo 5770: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5771: of configuration files</a></span></dt>
5772: </dl>
5773: </dd>
5774:
1.38 dillo 5775: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5776: System startup scripts</a></span></dt>
5777:
5778: <dd>
5779: <dl>
5780: <dt><span class="sect2"><a href=
1.38 dillo 5781: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5782: of system startup scripts</a></span></dt>
5783: </dl>
5784: </dd>
5785:
5786: <dt><span class="sect1"><a href=
1.38 dillo 5787: "#users-and-groups">12.4. System users and
1.35 jmmv 5788: groups</a></span></dt>
5789:
1.38 dillo 5790: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5791: System shells</a></span></dt>
5792:
5793: <dd>
5794: <dl>
5795: <dt><span class="sect2"><a href=
1.38 dillo 5796: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5797: configuration files</a></span></dt>
5798: </dl>
5799: </dd>
5800: </dl>
5801: </dd>
5802:
1.38 dillo 5803: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5804: handling</a></span></dt>
5805:
5806: <dd>
5807: <dl>
1.30 wiz 5808: <dt><span class="sect1"><a href=
1.38 dillo 5809: "#global-default-options">13.1. Global default
1.30 wiz 5810: options</a></span></dt>
1.1 grant 5811:
1.30 wiz 5812: <dt><span class="sect1"><a href=
1.38 dillo 5813: "#converting-to-options">13.2. Converting packages to
1.45 wiz 5814: use <code xmlns=
5815: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5816: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5817: </dl>
5818: </dd>
5819:
1.38 dillo 5820: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5821: process</a></span></dt>
5822:
5823: <dd>
5824: <dl>
1.38 dillo 5825: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5826: Program location</a></span></dt>
5827:
1.38 dillo 5828: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5829: Main targets</a></span></dt>
5830:
5831: <dt><span class="sect1"><a href=
1.38 dillo 5832: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5833: targets</a></span></dt>
5834: </dl>
5835: </dd>
5836:
1.38 dillo 5837: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5838: fixes for packages</a></span></dt>
5839:
5840: <dd>
5841: <dl>
1.30 wiz 5842: <dt><span class="sect1"><a href=
1.38 dillo 5843: "#general-operation">15.1. General
1.30 wiz 5844: operation</a></span></dt>
1.1 grant 5845:
5846: <dd>
5847: <dl>
5848: <dt><span class="sect2"><a href=
1.38 dillo 5849: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5850: pull in variables from
5851: /etc/mk.conf</a></span></dt>
1.1 grant 5852:
5853: <dt><span class="sect2"><a href=
1.38 dillo 5854: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5855: to install documentation</a></span></dt>
5856:
5857: <dt><span class="sect2"><a href=
1.38 dillo 5858: "#restricted-packages">15.1.3. Restricted
1.1 grant 5859: packages</a></span></dt>
5860:
5861: <dt><span class="sect2"><a href=
1.38 dillo 5862: "#dependencies">15.1.4. Handling
1.1 grant 5863: dependencies</a></span></dt>
5864:
5865: <dt><span class="sect2"><a href=
1.38 dillo 5866: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5867: other packages</a></span></dt>
5868:
5869: <dt><span class="sect2"><a href=
1.38 dillo 5870: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5871: cannot or should not be built</a></span></dt>
1.1 grant 5872:
5873: <dt><span class="sect2"><a href=
1.38 dillo 5874: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 5875: should not be deleted, once
5876: installed</a></span></dt>
1.1 grant 5877:
5878: <dt><span class="sect2"><a href=
1.38 dillo 5879: "#security-handling">15.1.8. Handling packages
1.1 grant 5880: with security problems</a></span></dt>
5881:
5882: <dt><span class="sect2"><a href=
1.38 dillo 5883: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 5884: bugs</a></span></dt>
5885:
5886: <dt><span class="sect2"><a href=
1.38 dillo 5887: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 5888: incrementing versions when fixing an existing
1.1 grant 5889: package</a></span></dt>
5890:
5891: <dt><span class="sect2"><a href=
1.38 dillo 5892: "#portability-of-packages">15.1.11. Portability
1.30 wiz 5893: of packages</a></span></dt>
1.1 grant 5894: </dl>
5895: </dd>
5896:
1.30 wiz 5897: <dt><span class="sect1"><a href=
1.38 dillo 5898: "#downloading-issues">15.2. Possible downloading
1.30 wiz 5899: issues</a></span></dt>
1.1 grant 5900:
5901: <dd>
5902: <dl>
5903: <dt><span class="sect2"><a href=
1.38 dillo 5904: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 5905: distfiles aren't available for plain
1.1 grant 5906: downloading</a></span></dt>
5907:
5908: <dt><span class="sect2"><a href=
1.38 dillo 5909: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 5910: handle modified distfiles with the 'old'
5911: name</a></span></dt>
1.1 grant 5912: </dl>
5913: </dd>
5914:
1.30 wiz 5915: <dt><span class="sect1"><a href=
1.38 dillo 5916: "#configuration-gotchas">15.3. Configuration
1.30 wiz 5917: gotchas</a></span></dt>
1.1 grant 5918:
5919: <dd>
5920: <dl>
5921: <dt><span class="sect2"><a href=
1.38 dillo 5922: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 5923: libtool</a></span></dt>
5924:
5925: <dt><span class="sect2"><a href=
1.38 dillo 5926: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 5927: packages that already support
5928: libtool</a></span></dt>
5929:
5930: <dt><span class="sect2"><a href=
1.38 dillo 5931: "#autoconf-automake">15.3.3. GNU
1.1 grant 5932: Autoconf/Automake</a></span></dt>
5933: </dl>
5934: </dd>
5935:
1.30 wiz 5936: <dt><span class="sect1"><a href=
1.38 dillo 5937: "#building-considerations">15.4. Building
1.30 wiz 5938: considerations</a></span></dt>
1.1 grant 5939:
5940: <dd>
5941: <dl>
5942: <dt><span class="sect2"><a href=
1.38 dillo 5943: "#cpp-defines">15.4.1. CPP
1.30 wiz 5944: defines</a></span></dt>
1.1 grant 5945: </dl>
5946: </dd>
5947:
1.30 wiz 5948: <dt><span class="sect1"><a href=
1.38 dillo 5949: "#package-specific-actions">15.5. Package specific
1.30 wiz 5950: actions</a></span></dt>
1.1 grant 5951:
5952: <dd>
5953: <dl>
5954: <dt><span class="sect2"><a href=
1.38 dillo 5955: "#user-interaction">15.5.1. User
1.2 hubertf 5956: interaction</a></span></dt>
1.1 grant 5957:
5958: <dt><span class="sect2"><a href=
1.38 dillo 5959: "#handling-licenses">15.5.2. Handling
1.1 grant 5960: licenses</a></span></dt>
5961:
5962: <dt><span class="sect2"><a href=
1.38 dillo 5963: "#installing-score-files">15.5.3. Installing
1.30 wiz 5964: score files</a></span></dt>
1.1 grant 5965:
5966: <dt><span class="sect2"><a href=
1.38 dillo 5967: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 5968: scripts</a></span></dt>
5969:
5970: <dt><span class="sect2"><a href=
1.38 dillo 5971: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 5972: hardcoded paths to other
5973: interpreters</a></span></dt>
1.1 grant 5974:
5975: <dt><span class="sect2"><a href=
1.38 dillo 5976: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 5977: modules</a></span></dt>
5978:
5979: <dt><span class="sect2"><a href=
1.38 dillo 5980: "#faq.info-files">15.5.7. Packages installing
1.1 grant 5981: info files</a></span></dt>
5982:
5983: <dt><span class="sect2"><a href=
1.38 dillo 5984: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 5985: GConf2 data files</a></span></dt>
1.1 grant 5986:
5987: <dt><span class="sect2"><a href=
1.38 dillo 5988: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 5989: installing scrollkeeper data
5990: files</a></span></dt>
1.1 grant 5991:
5992: <dt><span class="sect2"><a href=
1.38 dillo 5993: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 5994: fonts</a></span></dt>
5995:
5996: <dt><span class="sect2"><a href=
1.38 dillo 5997: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 5998: modules</a></span></dt>
5999:
6000: <dt><span class="sect2"><a href=
1.38 dillo 6001: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 6002: SGML or XML data</a></span></dt>
1.1 grant 6003:
6004: <dt><span class="sect2"><a href=
1.38 dillo 6005: "#mime-database">15.5.13. Packages installing
1.1 grant 6006: extensions to the MIME database</a></span></dt>
6007:
6008: <dt><span class="sect2"><a href=
1.38 dillo 6009: "#intltool">15.5.14. Packages using
1.1 grant 6010: intltool</a></span></dt>
1.18 xtraeme 6011:
6012: <dt><span class="sect2"><a href=
1.38 dillo 6013: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 6014: startup scripts</a></span></dt>
1.1 grant 6015: </dl>
6016: </dd>
6017:
1.30 wiz 6018: <dt><span class="sect1"><a href=
1.38 dillo 6019: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6020: author</a></span></dt>
1.1 grant 6021: </dl>
6022: </dd>
6023:
1.38 dillo 6024: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6025: Debugging</a></span></dt>
6026:
1.38 dillo 6027: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6028: Submitting and Committing</a></span></dt>
6029:
6030: <dd>
6031: <dl>
1.30 wiz 6032: <dt><span class="sect1"><a href=
1.38 dillo 6033: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6034: packages</a></span></dt>
1.1 grant 6035:
1.30 wiz 6036: <dt><span class="sect1"><a href=
1.41 wiz 6037: "#general-notes-for-changes">17.2. General notes when
6038: adding, updating, or removing
6039: packages</a></span></dt>
6040:
6041: <dt><span class="sect1"><a href=
6042: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6043: package into CVS</a></span></dt>
1.1 grant 6044:
1.30 wiz 6045: <dt><span class="sect1"><a href=
1.41 wiz 6046: "#updating-package">17.4. Updating a package to a
1.30 wiz 6047: newer version</a></span></dt>
1.1 grant 6048:
1.30 wiz 6049: <dt><span class="sect1"><a href=
1.41 wiz 6050: "#moving-package">17.5. Moving a package in
1.30 wiz 6051: pkgsrc</a></span></dt>
1.1 grant 6052: </dl>
6053: </dd>
6054: </dl>
6055: </div>
6056:
6057: <div class="chapter" lang="en" xml:lang="en">
6058: <div class="titlepage">
6059: <div>
6060: <div>
1.27 rillig 6061: <h2 class="title"><a name="components" id=
1.38 dillo 6062: "components"></a>Chapter 8. Package
1.27 rillig 6063: components - files, directories and contents</h2>
1.25 rillig 6064: </div>
6065: </div>
6066: </div>
6067:
6068: <div class="toc">
6069: <p><b>Table of Contents</b></p>
6070:
6071: <dl>
6072: <dt><span class="sect1"><a href=
1.45 wiz 6073: "#components.Makefile">8.1. <code xmlns=
6074: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6075: "filename">Makefile</code></a></span></dt>
6076:
6077: <dt><span class="sect1"><a href=
1.45 wiz 6078: "#components.distinfo">8.2. <code xmlns=
6079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6080: "filename">distinfo</code></a></span></dt>
6081:
6082: <dt><span class="sect1"><a href=
1.38 dillo 6083: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6084:
1.30 wiz 6085: <dt><span class="sect1"><a href=
1.38 dillo 6086: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6087: files</a></span></dt>
1.25 rillig 6088:
1.27 rillig 6089: <dt><span class="sect1"><a href=
1.38 dillo 6090: "#components.optional">8.5. Optional
1.27 rillig 6091: files</a></span></dt>
1.25 rillig 6092:
1.38 dillo 6093: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6094: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6095: class="filename">work*</code></a></span></dt>
1.25 rillig 6096:
1.38 dillo 6097: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6098: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6099: class="filename">files/*</code></a></span></dt>
1.25 rillig 6100: </dl>
6101: </div>
6102:
1.27 rillig 6103: <p>Whenever you're preparing a package, there are a number
6104: of files involved which are described in the following
6105: sections.</p>
1.25 rillig 6106:
6107: <div class="sect1" lang="en" xml:lang="en">
6108: <div class="titlepage">
6109: <div>
6110: <div>
6111: <h2 class="title" style="clear: both"><a name=
1.27 rillig 6112: "components.Makefile" id=
1.45 wiz 6113: "components.Makefile"></a>8.1. <code xmlns=
6114: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6115: "filename">Makefile</code></h2>
1.25 rillig 6116: </div>
6117: </div>
6118: </div>
6119:
1.27 rillig 6120: <p>Building, installation and creation of a binary
1.45 wiz 6121: package are all controlled by the package's <code xmlns=
6122: "http://www.w3.org/TR/xhtml1/transitional" class=
6123: "filename">Makefile</code>. The <code xmlns=
6124: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6125: "filename">Makefile</code> describes various things about
6126: a package, for example from where to get it, how to
6127: configure, build, and install it.</p>
6128:
1.45 wiz 6129: <p>A package <code xmlns=
6130: "http://www.w3.org/TR/xhtml1/transitional" class=
6131: "filename">Makefile</code> contains several sections that
6132: describe the package.</p>
1.25 rillig 6133:
1.27 rillig 6134: <p>In the first section there are the following
6135: variables, which should appear exactly in the order given
6136: here.</p>
1.25 rillig 6137:
6138: <div class="itemizedlist">
6139: <ul type="disc">
6140: <li>
1.27 rillig 6141: <p><code class="varname">DISTNAME</code> is the
6142: basename of the distribution file to be downloaded
6143: from the package's website.</p>
6144: </li>
6145:
6146: <li>
6147: <p><code class="varname">PKGNAME</code> is the name
6148: of the package, as used by pkgsrc. You only need to
6149: provide it if it differs from DISTNAME. Usually it
6150: is the directory name together with the version
6151: number. It must match the regular expression
6152: <code class=
6153: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6154: that is, it starts with a letter or digit, and
6155: contains only letters, digits, dashes, underscores,
6156: dots and plus signs.</p>
1.25 rillig 6157: </li>
6158:
6159: <li>
1.27 rillig 6160: <p><code class="varname">CATEGORIES</code> is a
6161: list of categories which the package fits in. You
6162: can choose any of the top-level directories of
6163: pkgsrc for it.</p>
1.45 wiz 6164:
6165: <p>Currently the following values are available for
6166: <code class="varname">CATEGORIES</code>. If more
6167: than one is used, they need to be separated by
6168: spaces:</p>
6169: <pre class="programlisting">
6170: archivers cross geography meta-pkgs security
6171: audio databases graphics misc shells
6172: benchmarks devel ham multimedia sysutils
6173: biology editors inputmethod net textproc
6174: cad emulators lang news time
6175: chat finance mail parallel wm
6176: comms fonts math pkgtools www
6177: converters games mbone print x11
6178: </pre>
1.25 rillig 6179: </li>
6180:
6181: <li>
1.27 rillig 6182: <p><code class="varname">MASTER_SITES</code> is a
6183: list of URLs where the distribution files can be
6184: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6185:
6186: <p>The <code class="varname">MASTER_SITES</code>
6187: may make use of the following predefined sites:</p>
6188: <pre class="programlisting">
6189: ${MASTER_SITE_APACHE}
6190: ${MASTER_SITE_BACKUP}
6191: ${MASTER_SITE_CYGWIN}
6192: ${MASTER_SITE_DEBIAN}
6193: ${MASTER_SITE_FREEBSD}
6194: ${MASTER_SITE_FREEBSD_LOCAL}
6195: ${MASTER_SITE_GNOME}
6196: ${MASTER_SITE_GNU}
6197: ${MASTER_SITE_GNUSTEP}
6198: ${MASTER_SITE_IFARCHIVE}
6199: ${MASTER_SITE_MOZILLA}
6200: ${MASTER_SITE_OPENOFFICE}
6201: ${MASTER_SITE_PERL_CPAN}
6202: ${MASTER_SITE_R_CRAN}
6203: ${MASTER_SITE_SOURCEFORGE}
6204: ${MASTER_SITE_SUNSITE}
6205: ${MASTER_SITE_SUSE}
6206: ${MASTER_SITE_TEX_CTAN}
6207: ${MASTER_SITE_XCONTRIB}
6208: ${MASTER_SITE_XEMACS}
6209:
6210: </pre>
6211:
6212: <p>If one of these predefined sites is chosen, you
6213: may want to specify a subdirectory of that site.
6214: Since these macros may expand to more than one
6215: actual site, you <span class=
6216: "emphasis"><em>must</em></span> use the following
6217: construct to specify a subdirectory:</p>
6218: <pre class="programlisting">
6219: ${MASTER_SITE_GNU:=subdirectory/name/}
6220: ${MASTER_SITE_SOURCEFORGE:=project_name/}
6221: </pre>
6222:
6223: <p>Note the trailing slash after the subdirectory
6224: name.</p>
6225:
6226: <p>If the package has multiple <code class=
6227: "varname">DISTFILES</code> or multiple <code class=
6228: "varname">PATCHFILES</code> from different sites,
6229: set <code class="varname">SITES_foo</code> to a
1.47 ! reed 6230: list of URIs where file “<span class=
1.45 wiz 6231: "quote">foo</span>” may be found.
6232: “<span class="quote">foo</span>”
1.47 ! reed 6233: includes the suffix, e.g.:</p>
1.45 wiz 6234: <pre class="programlisting">
6235: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6236: DISTFILES+= foo-file.tar.gz
6237: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6238: http://www.somewhereelse.com/mirror/somehow/
6239: </pre>
6240: </li>
6241:
6242: <li>
6243: <p><code class="varname">DISTFILES</code>: Name(s)
6244: of archive file(s) containing distribution. The
6245: default is <code xmlns=
6246: "http://www.w3.org/TR/xhtml1/transitional" class=
6247: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6248: Should only be set if you have more than one
6249: distfile.</p>
6250:
6251: <p>Note that the normal default setting of
6252: <code class="varname">DISTFILES</code> must be made
6253: explicit if you want to add to it (rather than
6254: replace it), as you usually would.</p>
6255: </li>
6256:
6257: <li>
6258: <p><code class="varname">EXTRACT_SUFX</code>:
6259: Suffix of the distribution file, will be appended
6260: to <code class="varname">DISTNAME</code>. Defaults
6261: to <code xmlns=
6262: "http://www.w3.org/TR/xhtml1/transitional" class=
6263: "filename">.tar.gz</code>.</p>
6264: </li>
6265: </ul>
6266: </div>
6267:
6268: <p>The second section contains information about
6269: separately downloaded patches, if any.</p>
6270:
6271: <div class="itemizedlist">
6272: <ul type="disc">
6273: <li>
1.47 ! reed 6274: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6275: of additional files that contain distribution
6276: patches. There is no default. pkgsrc will look for
6277: them at <code class="varname">PATCH_SITES</code>.
6278: They will automatically be uncompressed before
6279: patching if the names end with <code xmlns=
6280: "http://www.w3.org/TR/xhtml1/transitional" class=
6281: "filename">.gz</code> or <code xmlns=
6282: "http://www.w3.org/TR/xhtml1/transitional" class=
6283: "filename">.Z</code>.</p>
6284: </li>
6285:
6286: <li>
6287: <p><code class="varname">PATCH_SITES</code>:
6288: Primary location(s) for distribution patch files
6289: (see <code class="varname">PATCHFILES</code> below)
6290: if not found locally.</p>
1.25 rillig 6291: </li>
6292: </ul>
6293: </div>
6294:
1.45 wiz 6295: <p>The third section contains the following
1.27 rillig 6296: variables.</p>
1.25 rillig 6297:
1.27 rillig 6298: <div class="itemizedlist">
6299: <ul type="disc">
6300: <li>
6301: <p><code class="varname">MAINTAINER</code> is the
1.45 wiz 6302: email address of the contact person for this
6303: package. The person who feels responsible for this
6304: package, and who is most likely to look at problems
6305: or questions regarding this package which have been
6306: reported with <a href=
6307: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6308: <span class="citerefentry"><span class=
6309: "refentrytitle">send-pr</span>(1)</span></a>. The
6310: right person to contact before making major changes
6311: to the package. When packaging a new program, set
6312: <code class="varname">MAINTAINER</code> to
6313: yourself. If you really can't maintain the package
6314: for future updates, set it to <code class=
6315: "email"><<a href=
6316: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6317: </li>
1.25 rillig 6318:
1.27 rillig 6319: <li>
6320: <p><code class="varname">HOMEPAGE</code> is a URL
6321: where users can find more information about the
1.23 wiz 6322: package.</p>
6323: </li>
1.1 grant 6324:
1.23 wiz 6325: <li>
6326: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6327: one-line description of the package (should not
6328: include the package name).</p>
1.23 wiz 6329: </li>
6330: </ul>
6331: </div>
1.1 grant 6332:
1.45 wiz 6333: <p>Other variables that affect the build:</p>
1.1 grant 6334:
1.45 wiz 6335: <div class="itemizedlist">
6336: <ul type="disc">
6337: <li>
6338: <p><code class="varname">WRKSRC</code>: The
6339: subdirectory of <code xmlns=
6340: "http://www.w3.org/TR/xhtml1/transitional" class=
6341: "filename">${WRKDIR}</code> to which the
6342: distribution actually unpacks. The default is
6343: <code xmlns=
6344: "http://www.w3.org/TR/xhtml1/transitional" class=
6345: "filename">${WRKDIR}/${DISTNAME}</code>. The value
6346: of <code class="varname">WRKSRC</code> should be
6347: set explicitly if the package does not follow
6348: standard conventions and include the package's name
6349: as a subdirectory.</p>
6350: </li>
6351: </ul>
1.1 grant 6352: </div>
6353:
6354: <p>Please pay attention to the following gotchas:</p>
6355:
6356: <div class="itemizedlist">
6357: <ul type="disc">
6358: <li>
1.14 xtraeme 6359: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 ! reed 6360: if man pages are installed in compressed form by
! 6361: the package; see comment in <code xmlns=
1.45 wiz 6362: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6363: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6364: </li>
6365:
6366: <li>
1.45 wiz 6367: <p>Replace <code xmlns=
6368: "http://www.w3.org/TR/xhtml1/transitional" class=
6369: "filename">/usr/local</code> with
6370: “<span class="quote">${PREFIX}</span>”
6371: in all files (see patches, below).</p>
1.1 grant 6372: </li>
6373:
6374: <li>
6375: <p>If the package installs any info files, see
6376: <a href="#faq.info-files" title=
1.45 wiz 6377: "15.5.7. Packages installing info files">Section 15.5.7,
6378: “Packages installing info
1.1 grant 6379: files”</a>.</p>
6380: </li>
6381: </ul>
6382: </div>
6383: </div>
6384:
6385: <div class="sect1" lang="en" xml:lang="en">
6386: <div class="titlepage">
6387: <div>
6388: <div>
6389: <h2 class="title" style="clear: both"><a name=
6390: "components.distinfo" id=
1.45 wiz 6391: "components.distinfo"></a>8.2. <code xmlns=
6392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6393: "filename">distinfo</code></h2>
1.1 grant 6394: </div>
6395: </div>
6396: </div>
6397:
6398: <p>Most important, the mandatory message digest, or
6399: checksum, of all the distfiles needed for the package to
6400: compile, confirming they match the original file
6401: distributed by the author. This ensures that the distfile
6402: retrieved from the Internet has not been corrupted during
6403: transfer or altered by a malign force to introduce a
1.14 xtraeme 6404: security hole. It is generated using the
6405: <span><strong class="command">make
6406: makesum</strong></span> command. The digest algorithm
6407: used was, at one stage, md5, but that was felt lacking
6408: compared to sha1, and so sha1 is now the default
1.1 grant 6409: algorithm. The distfile size is also generated and stored
6410: in new distinfo files. The <a xmlns=
6411: "http://www.w3.org/TR/xhtml1/transitional" href=
6412: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 6413: target="_top"><code xmlns="" class=
6414: "filename">pkgtools/digest</code></a> utility calculates
1.20 ben 6415: all of the digests in the distinfo file, and it provides
6416: various different algorithms. At the current time, the
6417: algorithms provided are: <span class=
6418: "emphasis"><em>md5</em></span>, <span class=
6419: "emphasis"><em>rmd160</em></span>, <span class=
6420: "emphasis"><em>sha1</em></span>, <span class=
6421: "emphasis"><em>sha256</em></span>, <span class=
6422: "emphasis"><em>sha384</em></span> and <span class=
6423: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 6424:
6425: <p>Some packages have different sets of distfiles on a
6426: per architecture basis, for example <a xmlns=
6427: "http://www.w3.org/TR/xhtml1/transitional" href=
6428: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6429: target="_top"><code xmlns="" class=
6430: "filename">www/navigator</code></a>). These are kept in
6431: the same distinfo file and care should be taken when
1.20 ben 6432: upgrading such a package to ensure distfile information
6433: is not lost.</p>
1.1 grant 6434:
6435: <p>The message digest/checksum for all the official
1.45 wiz 6436: patches found in the <code xmlns=
6437: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6438: "filename">patches/</code> directory (see <a href=
6439: "#components.patches" title=
1.38 dillo 6440: "8.3. patches/*">Section 8.3,
1.1 grant 6441: “patches/*”</a>) for the package is also
1.45 wiz 6442: stored in the <code xmlns=
6443: "http://www.w3.org/TR/xhtml1/transitional" class=
6444: "filename">distinfo</code> file. This is a message
6445: digest/checksum of all lines in the patch file except the
6446: NetBSD RCS Id. This file is generated by invoking
6447: <span><strong class="command">make
1.14 xtraeme 6448: makepatchsum</strong></span> (or <span><strong class=
6449: "command">make mps</strong></span> if you're in a
6450: hurry).</p>
1.1 grant 6451: </div>
6452:
6453: <div class="sect1" lang="en" xml:lang="en">
6454: <div class="titlepage">
6455: <div>
6456: <div>
6457: <h2 class="title" style="clear: both"><a name=
6458: "components.patches" id=
1.38 dillo 6459: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6460: </div>
6461: </div>
6462: </div>
6463:
6464: <p>This directory contains files that are used by the
6465: <a href=
6466: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6467: <span class="citerefentry"><span class=
6468: "refentrytitle">patch</span>(1)</span></a> command to
6469: modify the sources as distributed in the distribution
6470: file into a form that will compile and run perfectly on
6471: NetBSD. The files are applied successively in alphabetic
6472: order (as returned by a shell “<span class=
6473: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6474: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6475: class="filename">patch-aa</code> is applied before
6476: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6477: class="filename">patch-ab</code>, etc.</p>
6478:
6479: <p>The <code xmlns=
6480: "http://www.w3.org/TR/xhtml1/transitional" class=
6481: "filename">patch-*</code> files should be in
6482: <span><strong class="command">diff -bu</strong></span>
6483: format, and apply without a fuzz to avoid problems. (To
6484: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6485: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6486: not put changes for more than one file into a single
1.47 ! reed 6487: patch file, as this will make future modifications more
1.1 grant 6488: difficult.</p>
6489:
6490: <p>Similar, a file should be patched at most once, not
6491: several times by several different patches. If a file
6492: needs several patches, they should be combined into one
6493: file.</p>
6494:
6495: <p>One important thing to mention is to pay attention
6496: that no RCS IDs get stored in the patch files, as these
6497: will cause problems when later checked into the NetBSD
1.14 xtraeme 6498: CVS tree. Use the <span><strong class=
6499: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6500: "http://www.w3.org/TR/xhtml1/transitional" href=
6501: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6502: target="_top"><code xmlns="" class=
6503: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6504: these problems.</p>
1.1 grant 6505:
6506: <p>For even more automation, we recommend using
1.14 xtraeme 6507: <span><strong class="command">mkpatches</strong></span>
6508: from the same package to make a whole set of patches. You
6509: just have to backup files before you edit them to
1.45 wiz 6510: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6511: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6512: <span><strong class="command">cp -p filename
6513: filename.orig</strong></span> or, easier, by using
6514: <span><strong class="command">pkgvi</strong></span> again
6515: from the same package. If you upgrade a package this way,
6516: you can easily compare the new set of patches with the
6517: previously existing one with <span><strong class=
6518: "command">patchdiff</strong></span>.</p>
1.1 grant 6519:
6520: <p>When you have finished a package, remember to generate
6521: the checksums for the patch files by using the
1.14 xtraeme 6522: <span><strong class="command">make
6523: makepatchsum</strong></span> command, see <a href=
6524: "#components.distinfo" title=
1.38 dillo 6525: "8.2. distinfo">Section 8.2,
1.45 wiz 6526: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6527: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6528:
1.46 gdt 6529: <p>When adding a patch that corrects a problem in the
6530: distfile (rather than e.g. enforcing pkgsrc's view of
6531: where man pages should go), send the patch as a bug
6532: report to the maintainer. This benefits non-pkgsrc users
6533: of the package, and usually enables removing the patch in
6534: future version.</p>
6535:
1.1 grant 6536: <p>Patch files that are distributed by the author or
1.14 xtraeme 6537: other maintainers can be listed in <code class=
6538: "varname">$PATCHFILES</code>.</p>
1.1 grant 6539:
6540: <p>If it is desired to store any patches that should not
6541: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6542: pkgsrc tree in the <code xmlns=
6543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6544: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6545: tree there is expected to have the same
6546: “<span class="quote">category/package</span>”
6547: structure as pkgsrc, and patches are expected to be
1.45 wiz 6548: stored inside these dirs (also known as <code xmlns=
6549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 6550: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
! 6551: if you want to keep a private patch for <code xmlns=
1.45 wiz 6552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6553: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6554: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6555: class=
1.14 xtraeme 6556: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6557: files in the named directory are expected to be patch
1.1 grant 6558: files, and <span class="emphasis"><em>they are applied
6559: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6560: </div>
6561:
6562: <div class="sect1" lang="en" xml:lang="en">
6563: <div class="titlepage">
6564: <div>
6565: <div>
6566: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6567: "other-mandatory-files" id=
1.38 dillo 6568: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6569: mandatory files</h2>
6570: </div>
6571: </div>
6572: </div>
6573:
6574: <div class="variablelist">
6575: <dl>
1.45 wiz 6576: <dt><span class="term"><code xmlns=
6577: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6578: "filename">DESCR</code></span></dt>
6579:
6580: <dd>
6581: <p>A multi-line description of the piece of
6582: software. This should include any credits where
6583: they are due. Please bear in mind that others do
6584: not share your sense of humour (or spelling
6585: idiosyncrasies), and that others will read
6586: everything that you write here.</p>
6587: </dd>
6588:
1.45 wiz 6589: <dt><span class="term"><code xmlns=
6590: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6591: "filename">PLIST</code></span></dt>
6592:
6593: <dd>
6594: <p>This file governs the files that are installed
6595: on your system: all the binaries, manual pages,
6596: etc. There are other directives which may be
6597: entered in this file, to control the creation and
6598: deletion of directories, and the location of
6599: inserted files. See <a href="#plist" title=
1.38 dillo 6600: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6601: <i>PLIST issues</i></a> for more information.</p>
6602: </dd>
6603: </dl>
6604: </div>
6605: </div>
6606:
6607: <div class="sect1" lang="en" xml:lang="en">
6608: <div class="titlepage">
6609: <div>
6610: <div>
6611: <h2 class="title" style="clear: both"><a name=
6612: "components.optional" id=
1.38 dillo 6613: "components.optional"></a>8.5. Optional
1.27 rillig 6614: files</h2>
6615: </div>
6616: </div>
6617: </div>
6618:
6619: <div class="variablelist">
6620: <dl>
1.45 wiz 6621: <dt><span class="term"><code xmlns=
6622: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6623: "filename">INSTALL</code></span></dt>
6624:
6625: <dd>
6626: <p>This shell script is invoked twice by <a href=
6627: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6628: <span class="citerefentry"><span class=
6629: "refentrytitle">pkg_add</span>(1)</span></a>. First
6630: time after package extraction and before files are
6631: moved in place, the second time after the files to
6632: install are moved in place. This can be used to do
6633: any custom procedures not possible with @exec
1.45 wiz 6634: commands in <code xmlns=
6635: "http://www.w3.org/TR/xhtml1/transitional" class=
6636: "filename">PLIST</code>. See <a href=
1.27 rillig 6637: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6638: <span class="citerefentry"><span class=
6639: "refentrytitle">pkg_add</span>(1)</span></a> and
6640: <a href=
6641: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6642: <span class="citerefentry"><span class=
6643: "refentrytitle">pkg_create</span>(1)</span></a> for
6644: more information.</p>
6645: </dd>
6646:
1.45 wiz 6647: <dt><span class="term"><code xmlns=
6648: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6649: "filename">DEINSTALL</code></span></dt>
6650:
6651: <dd>
6652: <p>This script is executed before and after any
6653: files are removed. It is this script's
6654: responsibility to clean up any additional messy
6655: details around the package's installation, since
6656: all pkg_delete knows is how to delete the files
6657: created in the original distribution. See <a href=
6658: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6659: <span class="citerefentry"><span class=
6660: "refentrytitle">pkg_delete</span>(1)</span></a> and
6661: <a href=
6662: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6663: <span class="citerefentry"><span class=
6664: "refentrytitle">pkg_create</span>(1)</span></a> for
6665: more information.</p>
6666: </dd>
6667:
1.45 wiz 6668: <dt><span class="term"><code xmlns=
6669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6670: "filename">MESSAGE</code></span></dt>
6671:
6672: <dd>
6673: <p>Display this file after installation of the
6674: package. Useful for things like legal notices on
6675: almost-free software and hints for updating config
6676: files after installing modules for apache, PHP etc.
6677: Please note that you can modify variables in it
6678: easily by using <code class=
6679: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 6680: <code xmlns=
6681: "http://www.w3.org/TR/xhtml1/transitional" class=
6682: "filename">Makefile</code>:</p>
1.27 rillig 6683: <pre class="programlisting">
6684: MESSAGE_SUBST+= SOMEVAR="somevalue"
6685: </pre>
6686:
6687: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 6688: "quote">somevalue</span>” in <code xmlns=
6689: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6690: "filename">MESSAGE</code>.</p>
6691: </dd>
6692: </dl>
6693: </div>
6694: </div>
6695:
6696: <div class="sect1" lang="en" xml:lang="en">
6697: <div class="titlepage">
6698: <div>
6699: <div>
6700: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6701: "work-dir" id="work-dir"></a>8.6. <code xmlns=
6702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6703: "filename">work*</code></h2>
6704: </div>
6705: </div>
6706: </div>
6707:
6708: <p>When you type <span><strong class=
1.47 ! reed 6709: "command">make</strong></span>, the distribution files
! 6710: are unpacked into the directory denoted by <code class=
1.45 wiz 6711: "varname">WRKDIR</code>. It can be removed by running
6712: <span><strong class="command">make clean</strong></span>.
6713: Besides the sources, this directory is also used to keep
6714: various timestamp files. The directory gets <span class=
6715: "emphasis"><em>removed completely</em></span> on clean.
6716: The default is <code xmlns=
6717: "http://www.w3.org/TR/xhtml1/transitional" class=
6718: "filename">${.CURDIR}/work</code> or <code xmlns=
6719: "http://www.w3.org/TR/xhtml1/transitional" class=
6720: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
6721: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 6722:
6723: <p>If a package doesn't create a subdirectory for itself
6724: (like GNU software does, for instance), but extracts
6725: itself in the current directory, you should set
6726: <code class="varname">WRKSRC</code> accordingly, e.g.
6727: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.45 wiz 6729: target="_top"><code xmlns="" class=
6730: "filename">editors/sam</code></a> again, but the quick
1.27 rillig 6731: answer is:</p>
6732: <pre class="programlisting">
6733: WRKSRC= ${WRKDIR}
6734: </pre>
6735:
1.45 wiz 6736: <p>If a package doesn't create a subdir with the name of
6737: <code class="varname">DISTNAME</code> but some different
6738: name, set <code class="varname">WRKSRC</code> to point to
6739: the proper name in <code xmlns=
6740: "http://www.w3.org/TR/xhtml1/transitional" class=
6741: "filename">${WRKDIR}</code>. See <a xmlns=
6742: "http://www.w3.org/TR/xhtml1/transitional" href=
1.27 rillig 6743: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.45 wiz 6744: target="_top"><code xmlns="" class=
6745: "filename">lang/tcl</code></a> and <a xmlns=
1.27 rillig 6746: "http://www.w3.org/TR/xhtml1/transitional" href=
6747: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
1.45 wiz 6748: target="_top"><code xmlns="" class=
6749: "filename">x11/tk</code></a> for examples, and here is
1.27 rillig 6750: another one:</p>
6751: <pre class="programlisting">
6752: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6753: </pre>
6754:
6755: <p>The name of the working directory created by pkgsrc is
1.45 wiz 6756: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6757: class="filename">work</code> by default. If the same
6758: pkgsrc tree should be used on several different
1.27 rillig 6759: platforms, the variable <code class=
6760: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
6761: attach the platform to the directory name, e.g.
1.45 wiz 6762: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6763: class="filename">work.i386</code> or <code xmlns=
6764: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6765: "filename">work.sparc</code>.</p>
6766: </div>
6767:
6768: <div class="sect1" lang="en" xml:lang="en">
6769: <div class="titlepage">
6770: <div>
6771: <div>
6772: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6773: "files-dir" id=
1.45 wiz 6774: "files-dir"></a>8.7. <code xmlns=
6775: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6776: "filename">files/*</code></h2>
6777: </div>
6778: </div>
6779: </div>
6780:
6781: <p>If you have any files that you wish to be placed in
6782: the package prior to configuration or building, you could
6783: place these files here and use a “<span class=
6784: "quote">${CP}</span>” command in the
6785: “<span class="quote">pre-configure</span>”
6786: target to achieve this. Alternatively, you could simply
1.45 wiz 6787: diff the file against <code xmlns=
6788: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6789: "filename">/dev/null</code> and use the patch mechanism
6790: to manage the creation of this file.</p>
6791: </div>
6792: </div>
6793:
6794: <div class="chapter" lang="en" xml:lang="en">
6795: <div class="titlepage">
6796: <div>
6797: <div>
6798: <h2 class="title"><a name="makefile" id=
1.38 dillo 6799: "makefile"></a>Chapter 9. Programming in
1.45 wiz 6800: <code xmlns=
6801: "http://www.w3.org/TR/xhtml1/transitional" class=
6802: "filename">Makefile</code>s</h2>
1.27 rillig 6803: </div>
6804: </div>
6805: </div>
6806:
6807: <div class="toc">
6808: <p><b>Table of Contents</b></p>
6809:
6810: <dl>
6811: <dt><span class="sect1"><a href=
1.45 wiz 6812: "#makefile.variables">9.1. <code xmlns=
6813: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6814: "filename">Makefile</code> variables</a></span></dt>
6815:
6816: <dd>
6817: <dl>
6818: <dt><span class="sect2"><a href=
1.38 dillo 6819: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6820: conventions</a></span></dt>
6821: </dl>
6822: </dd>
6823:
1.38 dillo 6824: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6825: Code snippets</a></span></dt>
6826:
6827: <dd>
6828: <dl>
1.30 wiz 6829: <dt><span class="sect2"><a href=
1.38 dillo 6830: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6831: list</a></span></dt>
1.27 rillig 6832:
1.30 wiz 6833: <dt><span class="sect2"><a href=
1.38 dillo 6834: "#converting-internal-to-external">9.2.2.
1.27 rillig 6835: Converting an internal list into an external
6836: list</a></span></dt>
6837:
1.30 wiz 6838: <dt><span class="sect2"><a href=
1.38 dillo 6839: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6840: variables to a shell command</a></span></dt>
1.27 rillig 6841:
1.30 wiz 6842: <dt><span class="sect2"><a href=
1.38 dillo 6843: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6844: guideline</a></span></dt>
1.27 rillig 6845:
1.30 wiz 6846: <dt><span class="sect2"><a href=
1.38 dillo 6847: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6848: bug in BSD Make</a></span></dt>
1.27 rillig 6849: </dl>
6850: </dd>
6851: </dl>
6852: </div>
6853:
1.45 wiz 6854: <p>Pkgsrc consists of many <code xmlns=
6855: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6856: "filename">Makefile</code> fragments, each of which forms a
6857: well-defined part of the pkgsrc system. Using the <a href=
6858: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6859: <span class="citerefentry"><span class=
6860: "refentrytitle">make</span>(1)</span></a> system as a
6861: programming language for a big system like pkgsrc requires
6862: some discipline to keep the code correct and
6863: understandable.</p>
6864:
1.45 wiz 6865: <p>The basic ingredients for <code xmlns=
6866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6867: "filename">Makefile</code> programming are variables (which
6868: are actually macros) and shell commands. Among these shell
6869: commands may even be more complex ones like <a href=
6870: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6871: <span class="citerefentry"><span class=
6872: "refentrytitle">awk</span>(1)</span></a> programs. To make
6873: sure that every shell command runs as intended it is
6874: necessary to quote all variables correctly when they are
6875: used.</p>
6876:
6877: <p>This chapter describes some patterns, that appear quite
1.45 wiz 6878: often in <code xmlns=
6879: "http://www.w3.org/TR/xhtml1/transitional" class=
6880: "filename">Makefile</code>s, including the pitfalls that
6881: come along with them.</p>
1.27 rillig 6882:
6883: <div class="sect1" lang="en" xml:lang="en">
6884: <div class="titlepage">
6885: <div>
6886: <div>
6887: <h2 class="title" style="clear: both"><a name=
6888: "makefile.variables" id=
1.45 wiz 6889: "makefile.variables"></a>9.1. <code xmlns=
6890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6891: "filename">Makefile</code> variables</h2>
6892: </div>
6893: </div>
6894: </div>
6895:
1.45 wiz 6896: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6897: class="filename">Makefile</code> variables contain
6898: strings that can be processed using the five operators
6899: ``='', ``+='', ``?='', ``:='', and ``!='', which are
6900: described in the <a href=
1.27 rillig 6901: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6902: <span class="citerefentry"><span class=
6903: "refentrytitle">make</span>(1)</span></a> man page.</p>
6904:
1.45 wiz 6905: <p>When a variable's value is parsed from a <code xmlns=
6906: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6907: "filename">Makefile</code>, the hash character ``#'' and
6908: the backslash character ``\'' are handled specially. If a
6909: backslash is followed by a newline, any whitespace
6910: immediately in front of the backslash, the backslash, the
6911: newline, and any whitespace immediately behind the
6912: newline are replaced with a single space. A backspace
6913: character and an immediately following hash character are
1.47 ! reed 6914: replaced with a single hash character. Otherwise, the
1.27 rillig 6915: backslash is passed as is. In a variable assignment, any
6916: hash character that is not preceded by a backslash starts
6917: a comment that continues upto the end of the logical
6918: line.</p>
6919:
6920: <p><span class="emphasis"><em>Note:</em></span> Because
6921: of this parsing algorithm the only way to create a
6922: variable consisting of a single backslash is using the
6923: ``!='' operator, for example: <code class=
6924: "varname">BACKSLASH!=echo "\\"</code>.</p>
6925:
6926: <p>So far for defining variables. The other thing you can
6927: do with variables is evaluating them. A variable is
6928: evaluated when it is part of the right side of the ``:=''
6929: or the ``!='' operator, or directly before executing a
6930: shell command which the variable is part of. In all other
1.47 ! reed 6931: cases, <a href=
1.27 rillig 6932: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6933: <span class="citerefentry"><span class=
6934: "refentrytitle">make</span>(1)</span></a> performs lazy
6935: evaluation, that is, variables are not evaluated until
6936: there's no other way. The ``modifiers'' mentioned in the
6937: man page also evaluate the variable.</p>
6938:
6939: <p>Some of the modifiers split the string into words and
6940: then operate on the words, others operate on the string
1.47 ! reed 6941: as a whole. When a string is split into words, it is
! 6942: split as you would expect it from <a href=
1.27 rillig 6943: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6944: <span class="citerefentry"><span class=
6945: "refentrytitle">sh</span>(1)</span></a>.</p>
6946:
6947: <p>No rule without exception—the
6948: <span><strong class="command">.for</strong></span> loop
6949: does not follow the shell quoting rules but splits at
6950: sequences of whitespace.</p>
6951:
6952: <p>There are several types of variables that should be
6953: handled differently. Strings and two types of lists.</p>
6954:
6955: <div class="itemizedlist">
6956: <ul type="disc">
6957: <li>
6958: <p><span class="emphasis"><em>Strings</em></span>
1.47 ! reed 6959: can contain arbitrary characters. Nevertheless, you
1.27 rillig 6960: should restrict yourself to only using printable
6961: characters. Examples are <code class=
6962: "varname">PREFIX</code> and <code class=
6963: "varname">COMMENT</code>.</p>
6964: </li>
6965:
6966: <li>
6967: <p><span class="emphasis"><em>Internal
6968: lists</em></span> are lists that are never exported
6969: to any shell command. Their elements are separated
1.47 ! reed 6970: by whitespace. Therefore, the elements themselves
1.27 rillig 6971: cannot have embedded whitespace. Any other
6972: characters are allowed. Internal lists can be used
6973: in <span><strong class=
6974: "command">.for</strong></span> loops. Examples are
6975: <code class="varname">DEPENDS</code> and
6976: <code class="varname">BUILD_DEPENDS</code>.</p>
6977: </li>
6978:
6979: <li>
6980: <p><span class="emphasis"><em>External
6981: lists</em></span> are lists that may be exported to
6982: a shell command. Their elements can contain any
6983: characters, including whitespace. That's why they
6984: cannot be used in <span><strong class=
6985: "command">.for</strong></span> loops. Examples are
6986: <code class="varname">DISTFILES</code> and
6987: <code class="varname">MASTER_SITES</code>.</p>
6988: </li>
6989: </ul>
6990: </div>
6991:
6992: <div class="sect2" lang="en" xml:lang="en">
6993: <div class="titlepage">
6994: <div>
6995: <div>
6996: <h3 class="title"><a name=
6997: "makefile.variables.names" id=
1.38 dillo 6998: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 6999: conventions</h3>
7000: </div>
7001: </div>
7002: </div>
7003:
7004: <div class="itemizedlist">
7005: <ul type="disc">
7006: <li>
7007: <p>All variable names starting with an underscore
7008: are reserved for use by the pkgsrc
7009: infrastructure. They shall not be used by package
1.45 wiz 7010: <code xmlns=
7011: "http://www.w3.org/TR/xhtml1/transitional" class=
7012: "filename">Makefile</code>s.</p>
1.27 rillig 7013: </li>
7014:
7015: <li>
7016: <p>In <span><strong class=
7017: "command">.for</strong></span> loops you should
7018: use lowercase variable names for the iteration
7019: variables.</p>
7020: </li>
7021:
7022: <li>
7023: <p>All list variables should have a ``plural''
7024: name, e.g. <code class=
7025: "varname">PKG_OPTIONS</code> or <code class=
7026: "varname">DISTFILES</code>.</p>
7027: </li>
7028: </ul>
7029: </div>
7030: </div>
7031: </div>
7032:
7033: <div class="sect1" lang="en" xml:lang="en">
7034: <div class="titlepage">
7035: <div>
7036: <div>
7037: <h2 class="title" style="clear: both"><a name=
7038: "makefile.code" id=
1.38 dillo 7039: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7040: </div>
7041: </div>
7042: </div>
7043:
7044: <p>This section presents you with some code snippets you
7045: should use in your own code. If you don't find anything
7046: appropriate here, you should test your code and add it
7047: here.</p>
7048:
7049: <div class="sect2" lang="en" xml:lang="en">
7050: <div class="titlepage">
7051: <div>
7052: <div>
1.30 wiz 7053: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7054: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7055: a list</h3>
1.27 rillig 7056: </div>
7057: </div>
7058: </div>
7059: <pre class="programlisting">
7060: STRING= foo * bar `date`
7061: INT_LIST= # empty
7062: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7063: EXT_LIST= # empty
7064: ANOTHER_EXT_LIST= a=b c=d
7065:
7066: INT_LIST+= ${STRING} # 1
7067: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7068: EXT_LIST+= ${STRING:Q} # 3
7069: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
7070:
7071: </pre>
7072:
7073: <p>When you add a string to an external list (example
7074: 3), it must be quoted. In all other cases, you must not
7075: add a quoting level. You must not merge internal and
7076: external lists, unless you are sure that all entries
7077: are correctly interpreted in both lists.</p>
7078: </div>
7079:
7080: <div class="sect2" lang="en" xml:lang="en">
7081: <div class="titlepage">
7082: <div>
7083: <div>
1.30 wiz 7084: <h3 class="title"><a name=
7085: "converting-internal-to-external" id=
1.38 dillo 7086: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7087: an internal list into an external list</h3>
1.27 rillig 7088: </div>
7089: </div>
7090: </div>
7091: <pre class="programlisting">
7092: EXT_LIST= # empty
7093: .for i in ${INT_LIST}
7094: EXT_LIST+= ${i:Q}""
7095: .endfor
7096:
7097: </pre>
7098:
7099: <p>This code converts the internal list <code class=
7100: "varname">INT_LIST</code> into the external list
7101: <code class="varname">EXT_LIST</code>. As the elements
7102: of an internal list are unquoted they must be quoted
7103: here. The reason for appending <code class=
7104: "varname">""</code> is explained below.</p>
7105: </div>
1.1 grant 7106:
1.27 rillig 7107: <div class="sect2" lang="en" xml:lang="en">
7108: <div class="titlepage">
1.1 grant 7109: <div>
1.27 rillig 7110: <div>
1.30 wiz 7111: <h3 class="title"><a name=
7112: "passing-variable-to-shell" id=
1.38 dillo 7113: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7114: variables to a shell command</h3>
1.27 rillig 7115: </div>
1.1 grant 7116: </div>
7117: </div>
1.27 rillig 7118: <pre class="programlisting">
7119: STRING= foo bar < > * `date` $$HOME ' "
7120: EXT_LIST= string=${STRING:Q} x=second\ item
7121:
7122: all:
7123: echo ${STRING} # 1
7124: echo "${STRING}" # 2
7125: echo "${STRING:Q}" # 3
7126: echo ${STRING:Q} # 4
7127: echo x${STRING:Q} | sed 1s,.,, # 5
7128: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
7129:
7130: </pre>
7131:
7132: <p>Example 1 leads to a syntax error in the shell, as
7133: the characters are just copied.</p>
7134:
7135: <p>Example 2 leads to a syntax error too, and if you
7136: leave out the last " character from <code class=
7137: "varname">${STRING}</code>, <a href=
7138: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7139: <span class="citerefentry"><span class=
7140: "refentrytitle">date</span>(1)</span></a> will be
7141: executed. The <code class="varname">$HOME</code> shell
7142: variable would be evaluated, too.</p>
7143:
7144: <p>Example 3 outputs each space character preceded by a
7145: backslash (or not), depending on the implementation of
7146: the <a href=
7147: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7148: <span class="citerefentry"><span class=
7149: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7150:
1.27 rillig 7151: <p>Example 4 handles correctly every string that does
7152: not start with a dash. In that case, the result depends
7153: on the implementation of the <a href=
7154: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7155: <span class="citerefentry"><span class=
7156: "refentrytitle">echo</span>(1)</span></a> command. As
7157: long as you can guarantee that your input does not
1.47 ! reed 7158: start with a dash, this form is appropriate.</p>
1.1 grant 7159:
1.27 rillig 7160: <p>Example 5 handles even the case of a leading dash
7161: correctly.</p>
1.1 grant 7162:
1.27 rillig 7163: <p>The <code class="varname">EXT_LIST</code> does not
1.47 ! reed 7164: need to be quoted because the quoting has already been
1.27 rillig 7165: done when adding elements to the list.</p>
1.1 grant 7166:
1.27 rillig 7167: <p>As internal lists shall not be passed to the shell,
7168: there is no example for it.</p>
1.1 grant 7169: </div>
7170:
1.27 rillig 7171: <div class="sect2" lang="en" xml:lang="en">
7172: <div class="titlepage">
1.1 grant 7173: <div>
1.27 rillig 7174: <div>
1.30 wiz 7175: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7176: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7177: guideline</h3>
7178: </div>
1.1 grant 7179: </div>
7180: </div>
7181:
1.27 rillig 7182: <p>There are many possible sources of wrongly quoted
7183: variables. This section lists some of the commonly
7184: known ones.</p>
1.1 grant 7185:
1.27 rillig 7186: <div class="itemizedlist">
7187: <ul type="disc">
7188: <li>
7189: <p>Whenever you use the value of a list, think
7190: about what happens to leading or trailing
7191: whitespace. If the list is a well-formed shell
1.47 ! reed 7192: expression, you can apply the <code class=
1.27 rillig 7193: "varname">:M*</code> modifier to strip leading
7194: and trailing whitespace from each word. The
7195: <code class="varname">:M</code> operator first
7196: splits its argument according to the rules of the
7197: shell, and then creates a new list consisting of
7198: all words that match the shell glob expression
7199: <code class="varname">*</code>, that is: all. One
7200: class of situations where this is needed is when
7201: adding a variable like <code class=
7202: "varname">CPPFLAGS</code> to <code class=
7203: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 ! reed 7204: script invokes other configure scripts, it strips
1.27 rillig 7205: the leading and trailing whitespace from the
7206: variable and then passes it to the other
7207: configure scripts. But these configure scripts
7208: expect the (child) <code class=
7209: "varname">CPPFLAGS</code> variable to be the same
7210: as the parent <code class=
7211: "varname">CPPFLAGS</code>. That's why we better
7212: pass the <code class="varname">CPPFLAGS</code>
7213: value properly trimmed. And here is how we do
7214: it:</p>
7215: <pre class="programlisting">
7216: CPPFLAGS= # empty
7217: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7218: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 7219:
1.27 rillig 7220: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 7221:
1.27 rillig 7222: all:
7223: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7224: echo x${CONFIGURE_ARGS}x # properly trimmed
7225:
7226: </pre>
7227: </li>
1.1 grant 7228:
1.27 rillig 7229: <li>
7230: <p>The example above contains one bug: The
7231: <code class="varname">${PREFIX}</code> is a
7232: properly quoted shell expression, but there is
7233: the C compiler after it, which also expects a
7234: properly quoted string (this time in C syntax).
7235: The version above is therefore only correct if
7236: <code class="varname">${PREFIX}</code> does not
7237: have embedded backslashes or double quotes. If
7238: you want to allow these, you have to add another
7239: layer of quoting to each variable that is used as
7240: a C string literal. You cannot use the
7241: <code class="varname">:Q</code> operator for it,
7242: as this operator only works for the shell.</p>
7243: </li>
1.1 grant 7244:
1.27 rillig 7245: <li>
1.47 ! reed 7246: <p>Whenever a variable can be empty, the
1.27 rillig 7247: <code class="varname">:Q</code> operator can have
7248: surprising results. Here are two completely
7249: different cases which can be solved with the same
7250: trick.</p>
7251: <pre class="programlisting">
7252: EMPTY= # empty
7253: empty_test:
7254: for i in a ${EMPTY:Q} c; do \
7255: echo "$$i"; \
7256: done
7257:
7258: for_test:
7259: .for i in a:\ a:\test.txt
7260: echo ${i:Q}
7261: echo "foo"
7262: .endfor
7263:
1.1 grant 7264: </pre>
7265:
1.27 rillig 7266: <p>The first example will only print two of the
7267: three lines we might have expected. This is
7268: because <code class="varname">${EMPTY:Q}</code>
7269: expands to the empty string, which the shell
7270: cannot see. The workaround is to write
7271: <code class="varname">${EMPTY:Q}""</code>. This
7272: pattern can be often found as <code class=
7273: "varname">${TEST} -z ${VAR:Q}</code> or as
7274: <code class="varname">${TEST} -f
7275: ${FNAME:Q}</code> (both of these are wrong).</p>
7276:
7277: <p>The second example will only print three lines
7278: instead of four. The first line looks like
7279: <code class="varname">a:\ echo foo</code>. This
7280: is because the backslash of the value
7281: <code class="varname">a:\</code> is interpreted
7282: as a line-continuation by <a href=
7283: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7284: <span class="citerefentry"><span class=
7285: "refentrytitle">make</span>(1)</span></a>, which
7286: makes the second line the arguments of the
7287: <a href=
7288: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7289: <span class="citerefentry"><span class=
7290: "refentrytitle">echo</span>(1)</span></a> command
7291: from the first line. To avoid this, write
7292: <code class="varname">${i:Q}""</code>.</p>
7293: </li>
7294: </ul>
7295: </div>
1.1 grant 7296: </div>
7297:
1.27 rillig 7298: <div class="sect2" lang="en" xml:lang="en">
7299: <div class="titlepage">
1.1 grant 7300: <div>
1.27 rillig 7301: <div>
1.30 wiz 7302: <h3 class="title"><a name=
7303: "bsd-make-bug-workaround" id=
1.38 dillo 7304: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7305: for a bug in BSD Make</h3>
1.27 rillig 7306: </div>
1.1 grant 7307: </div>
7308: </div>
7309:
1.27 rillig 7310: <p>The pkgsrc bmake program does not handle the
7311: following assignment correctly. In case <code class=
7312: "varname">_othervar_</code> contains a ``-'' character,
7313: one of the closing braces is included in <code class=
7314: "varname">${VAR}</code> after this code executes.</p>
7315: <pre class="programlisting">
7316: VAR:= ${VAR:N${_othervar_:C/-//}}
7317:
1.1 grant 7318: </pre>
7319:
1.27 rillig 7320: <p>For a more complex code snippet and a workaround,
7321: see the package <a xmlns=
7322: "http://www.w3.org/TR/xhtml1/transitional" href=
7323: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7324: target="_top"><code xmlns="" class=
7325: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7326: <code class="varname">bug1</code>.</p>
1.1 grant 7327: </div>
7328: </div>
7329: </div>
7330:
7331: <div class="chapter" lang="en" xml:lang="en">
7332: <div class="titlepage">
7333: <div>
7334: <div>
7335: <h2 class="title"><a name="plist" id=
1.38 dillo 7336: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7337: </div>
7338: </div>
7339: </div>
7340:
7341: <div class="toc">
7342: <p><b>Table of Contents</b></p>
7343:
7344: <dl>
1.38 dillo 7345: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7346: ID</a></span></dt>
7347:
1.30 wiz 7348: <dt><span class="sect1"><a href=
1.38 dillo 7349: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7350: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7351: class="filename">PLIST</code>
1.14 xtraeme 7352: generation</a></span></dt>
1.1 grant 7353:
1.38 dillo 7354: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7355: Tweaking output of <span><strong class="command">make
7356: print-PLIST</strong></span></a></span></dt>
1.1 grant 7357:
1.38 dillo 7358: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7359: Variable substitution in PLIST</a></span></dt>
7360:
1.30 wiz 7361: <dt><span class="sect1"><a href=
1.47 ! reed 7362: "#manpage-compression">10.5. Man
! 7363: page-compression</a></span></dt>
1.1 grant 7364:
1.38 dillo 7365: <dt><span class="sect1"><a href=
7366: "#using-PLIST_SRC">10.6. Changing PLIST source with
7367: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7368:
1.30 wiz 7369: <dt><span class="sect1"><a href=
1.47 ! reed 7370: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7371: differing PLISTs</a></span></dt>
1.1 grant 7372:
1.38 dillo 7373: <dt><span class="sect1"><a href=
7374: "#faq.common-dirs">10.8. Sharing directories between
7375: packages</a></span></dt>
1.1 grant 7376: </dl>
7377: </div>
7378:
1.45 wiz 7379: <p>The <code xmlns=
7380: "http://www.w3.org/TR/xhtml1/transitional" class=
7381: "filename">PLIST</code> file contains a package's
7382: “<span class="quote">packing list</span>”, i.e.
7383: a list of files that belong to the package (relative to the
7384: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7385: class="filename">${PREFIX}</code> directory it's been
7386: installed in) plus some additional statements - see the
7387: <a href=
1.1 grant 7388: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7389: <span class="citerefentry"><span class=
1.47 ! reed 7390: "refentrytitle">pkg_create</span>(1)</span></a> man page
! 7391: for a full list. This chapter addresses some issues that
! 7392: need attention when dealing with the <code xmlns=
1.45 wiz 7393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7394: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7395:
7396: <div class="sect1" lang="en" xml:lang="en">
7397: <div class="titlepage">
7398: <div>
7399: <div>
7400: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7401: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7402: </div>
7403: </div>
7404: </div>
7405:
7406: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7407: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7408: class="filename">PLIST</code> file you write:</p>
1.1 grant 7409: <pre class="programlisting">
1.17 sketch 7410: @comment $NetBSD$
1.1 grant 7411: </pre>
7412: </div>
7413:
7414: <div class="sect1" lang="en" xml:lang="en">
7415: <div class="titlepage">
7416: <div>
7417: <div>
7418: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7419: "automatic-plist-generation" id=
1.38 dillo 7420: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7421: <code xmlns=
7422: "http://www.w3.org/TR/xhtml1/transitional" class=
7423: "filename">PLIST</code> generation</h2>
1.1 grant 7424: </div>
7425: </div>
7426: </div>
7427:
1.14 xtraeme 7428: <p>You can use the <span><strong class="command">make
7429: print-PLIST</strong></span> command to output a PLIST
7430: that matches any new files since the package was
7431: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 7432: "14.3. Other helpful targets">Section 14.3,
1.1 grant 7433: “Other helpful targets”</a> for more
7434: information on this target.</p>
7435: </div>
7436:
7437: <div class="sect1" lang="en" xml:lang="en">
7438: <div class="titlepage">
7439: <div>
7440: <div>
7441: <h2 class="title" style="clear: both"><a name=
7442: "print-PLIST" id=
1.38 dillo 7443: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7444: <span><strong class="command">make
7445: print-PLIST</strong></span></h2>
1.1 grant 7446: </div>
7447: </div>
7448: </div>
7449:
7450: <p>If you have used any of the *-dirs packages, as
7451: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7452: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7453: “Sharing directories between packages”</a>,
1.14 xtraeme 7454: you may have noticed that <span><strong class=
7455: "command">make print-PLIST</strong></span> outputs a set
7456: of <code class="varname">@comment</code>s instead of real
7457: <code class="varname">@dirrm</code> lines. You can also
7458: do this for specific directories and files, so that the
7459: results of that command are very close to reality. This
7460: helps <span class="emphasis"><em>a lot</em></span> during
7461: the update of packages.</p>
7462:
7463: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7464: variable takes a set of AWK patterns and actions that are
7465: used to filter the output of print-PLIST. You can
7466: <span class="emphasis"><em>append</em></span> any chunk
7467: of AWK scripting you like to it, but be careful with
1.1 grant 7468: quoting.</p>
7469:
1.45 wiz 7470: <p>For example, to get all files inside the <code xmlns=
7471: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7472: "filename">libdata/foo</code> directory removed from the
1.1 grant 7473: resulting PLIST:</p>
7474: <pre class="programlisting">
7475: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
7476:
7477: </pre>
7478:
1.14 xtraeme 7479: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7480: lines referring to a specific (shared) directory
1.14 xtraeme 7481: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7482: <pre class="programlisting">
7483: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
7484:
7485: </pre>
7486: </div>
7487:
7488: <div class="sect1" lang="en" xml:lang="en">
7489: <div class="titlepage">
7490: <div>
7491: <div>
7492: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7493: "plist.misc" id=
7494: "plist.misc"></a>10.4. Variable substitution
7495: in PLIST</h2>
1.1 grant 7496: </div>
7497: </div>
7498: </div>
7499:
7500: <p>A number of variables are substituted automatically in
7501: PLISTs when a package is installed on a system. This
7502: includes the following variables:</p>
7503:
7504: <div class="variablelist">
7505: <dl>
1.14 xtraeme 7506: <dt><span class="term"><code class=
7507: "varname">${MACHINE_ARCH}</code>, <code class=
7508: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7509:
7510: <dd>
7511: <p>Some packages like emacs and perl embed
7512: information about which architecture they were
7513: built on into the pathnames where they install
1.47 ! reed 7514: their files. To handle this case, PLIST will be
1.1 grant 7515: preprocessed before actually used, and the symbol
1.14 xtraeme 7516: “<span class="quote"><code class=
7517: "varname">${MACHINE_ARCH}</code></span>” will
7518: be replaced by what <span><strong class=
7519: "command">uname -p</strong></span> gives. The same
7520: is done if the string <code class=
7521: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7522: PLIST somewhere - use this on packages that have
1.47 ! reed 7523: GNU autoconf-created configure scripts.</p>
1.1 grant 7524:
7525: <div class="note" style=
7526: "margin-left: 0.5in; margin-right: 0.5in;">
7527: <h3 class="title">Legacy note</h3>
7528:
7529: <p>There used to be a symbol “<span class=
1.14 xtraeme 7530: "quote"><code class=
7531: "varname">$ARCH</code></span>” that was
7532: replaced by the output of <span><strong class=
7533: "command">uname -m</strong></span>, but that's no
1.1 grant 7534: longer supported and has been removed.</p>
7535: </div>
7536: </dd>
7537:
1.14 xtraeme 7538: <dt><span class="term"><code class=
7539: "varname">${OPSYS}</code>, <code class=
7540: "varname">${LOWER_OPSYS}</code>, <code class=
7541: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7542:
7543: <dd>
7544: <p>Some packages want to embed the OS name and
7545: version into some paths. To do this, use these
1.45 wiz 7546: variables in the <code xmlns=
7547: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7548: "filename">PLIST</code>:</p>
1.1 grant 7549:
7550: <div class="itemizedlist">
7551: <ul type="disc">
7552: <li>
1.14 xtraeme 7553: <p><code class="varname">${OPSYS}</code> -
7554: output of “<span class=
7555: "quote"><span><strong class="command">uname
7556: -s</strong></span></span>”</p>
1.1 grant 7557: </li>
7558:
7559: <li>
1.14 xtraeme 7560: <p><code class=
7561: "varname">${LOWER_OPSYS}</code> - lowercase
7562: common name (eg. “<span class=
7563: "quote">solaris</span>”)</p>
1.1 grant 7564: </li>
7565:
7566: <li>
1.14 xtraeme 7567: <p><code class="varname">${OS_VERSION}</code>
7568: - “<span class=
7569: "quote"><span><strong class="command">uname
7570: -r</strong></span></span>”</p>
1.1 grant 7571: </li>
7572: </ul>
7573: </div>
7574: </dd>
7575:
1.14 xtraeme 7576: <dt><span class="term"><code class=
7577: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7578:
7579: <dd>
7580: <p>Packages that install locale files should list
7581: them in the PLIST as “<span class=
7582: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7583: instead of “<span class=
7584: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7585: This properly handles the fact that different
7586: operating systems expect locale files to be either
1.45 wiz 7587: in <code xmlns=
7588: "http://www.w3.org/TR/xhtml1/transitional" class=
7589: "filename">share</code> or <code xmlns=
7590: "http://www.w3.org/TR/xhtml1/transitional" class=
7591: "filename">lib</code> by default.</p>
1.1 grant 7592: </dd>
7593: </dl>
7594: </div>
7595:
7596: <p>For a complete list of values which are replaced by
1.45 wiz 7597: default, please look in <code xmlns=
7598: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7599: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7600: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7601:
7602: <p>If you want to change other variables not listed
7603: above, you can add variables and their expansions to this
1.14 xtraeme 7604: variable in the following way, similar to <code class=
7605: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7606: "#components.optional" title=
1.38 dillo 7607: "8.5. Optional files">Section 8.5,
1.1 grant 7608: “Optional files”</a>):</p>
7609: <pre class="programlisting">
7610: PLIST_SUBST+= SOMEVAR="somevalue"
7611: </pre>
7612:
7613: <p>This replaces all occurrences of “<span class=
7614: "quote">${SOMEVAR}</span>” in the PLIST with
7615: “<span class="quote">somevalue</span>”.</p>
7616: </div>
7617:
7618: <div class="sect1" lang="en" xml:lang="en">
7619: <div class="titlepage">
7620: <div>
7621: <div>
7622: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7623: "manpage-compression" id=
1.47 ! reed 7624: "manpage-compression"></a>10.5. Man
! 7625: page-compression</h2>
1.1 grant 7626: </div>
7627: </div>
7628: </div>
7629:
1.47 ! reed 7630: <p>Man pages should be installed in compressed form if
1.45 wiz 7631: <code class="varname">MANZ</code> is set (in <code xmlns=
7632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7633: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7634: otherwise. To handle this in the <code xmlns=
7635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7636: "filename">PLIST</code> file, the suffix
7637: “<span class="quote">.gz</span>” is
1.47 ! reed 7638: appended/removed automatically for man pages according to
1.14 xtraeme 7639: <code class="varname">MANZ</code> and <code class=
7640: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7641: above for details. This modification of the <code xmlns=
7642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7643: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7644: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7645: class="filename">PLIST</code> itself.</p>
1.1 grant 7646: </div>
7647:
7648: <div class="sect1" lang="en" xml:lang="en">
7649: <div class="titlepage">
7650: <div>
7651: <div>
7652: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7653: "using-PLIST_SRC" id=
1.38 dillo 7654: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7655: source with <code class=
1.14 xtraeme 7656: "varname">PLIST_SRC</code></h2>
1.1 grant 7657: </div>
7658: </div>
7659: </div>
7660:
1.14 xtraeme 7661: <p>To use one or more files as source for the
1.45 wiz 7662: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7663: class="filename">PLIST</code> used in generating the
7664: binary package, set the variable <code class=
1.14 xtraeme 7665: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7666: The files are later concatenated using <a href=
7667: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7668: <span class="citerefentry"><span class=
7669: "refentrytitle">cat</span>(1)</span></a>, and order of
7670: things is important.</p>
1.1 grant 7671: </div>
7672:
7673: <div class="sect1" lang="en" xml:lang="en">
7674: <div class="titlepage">
7675: <div>
7676: <div>
7677: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7678: "platform-specific-plist" id=
1.47 ! reed 7679: "platform-specific-plist"></a>10.7. Platform-specific
! 7680: and differing PLISTs</h2>
1.1 grant 7681: </div>
7682: </div>
7683: </div>
7684:
7685: <p>Some packages decide to install a different set of
7686: files based on the operating system being used. These
7687: differences can be automatically handled by using the
7688: following files:</p>
7689:
7690: <div class="itemizedlist">
7691: <ul type="disc">
7692: <li>
1.45 wiz 7693: <p><code xmlns=
7694: "http://www.w3.org/TR/xhtml1/transitional" class=
7695: "filename">PLIST.common</code></p>
1.1 grant 7696: </li>
7697:
7698: <li>
1.45 wiz 7699: <p><code xmlns=
7700: "http://www.w3.org/TR/xhtml1/transitional" class=
7701: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7702: </li>
7703:
7704: <li>
1.45 wiz 7705: <p><code xmlns=
7706: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7707: "filename">PLIST.${MACHINE_ARCH}</code></p>
7708: </li>
7709:
7710: <li>
1.45 wiz 7711: <p><code xmlns=
7712: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7713: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7714: </li>
7715:
7716: <li>
1.45 wiz 7717: <p><code xmlns=
7718: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7719: "filename">PLIST.common_end</code></p>
1.1 grant 7720: </li>
7721: </ul>
7722: </div>
7723: </div>
7724:
7725: <div class="sect1" lang="en" xml:lang="en">
7726: <div class="titlepage">
7727: <div>
7728: <div>
7729: <h2 class="title" style="clear: both"><a name=
7730: "faq.common-dirs" id=
1.38 dillo 7731: "faq.common-dirs"></a>10.8. Sharing
7732: directories between packages</h2>
1.1 grant 7733: </div>
7734: </div>
7735: </div>
7736:
7737: <p>A “<span class="quote">shared
7738: directory</span>” is a directory where multiple
7739: (and unrelated) packages install files. These directories
7740: are problematic because you have to add special tricks in
7741: the PLIST to conditionally remove them, or have some
7742: centralized package handle them.</p>
7743:
7744: <p>Within pkgsrc, you'll find both approaches. If a
7745: directory is shared by a few unrelated packages, it's
7746: often not worth to add an extra package to remove it.
7747: Therefore, one simply does:</p>
7748: <pre class="programlisting">
7749: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
7750:
7751: </pre>
7752:
7753: <p>in the PLISTs of all affected packages, instead of the
7754: regular "@dirrm" line.</p>
7755:
7756: <p>However, if the directory is shared across many
7757: packages, two different solutions are available:</p>
7758:
7759: <div class="orderedlist">
7760: <ol type="1">
7761: <li>
7762: <p>If the packages have a common dependency, the
7763: directory can be removed in that. For example, see
7764: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7765: href=
7766: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 7767: target="_top"><code xmlns="" class=
7768: "filename">textproc/scrollkeeper</code></a>, which
7769: removes the shared directory <code xmlns=
7770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7771: "filename">share/omf</code>.</p>
1.1 grant 7772: </li>
7773:
7774: <li>
7775: <p>If the packages using the directory are not
7776: related at all (they have no common dependencies),
7777: a *-dirs package is used.</p>
7778: </li>
7779: </ol>
7780: </div>
7781:
7782: <p>From now on, we'll discuss the second solution. To get
7783: an idea of the *-dirs packages available, issue:</p>
7784: <pre class="programlisting">
1.14 xtraeme 7785: <code class="prompt">%</code> cd .../pkgsrc
7786: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7787:
7788: </pre>
7789:
7790: <p>Their use from other packages is very simple. The
1.14 xtraeme 7791: <code class="varname">USE_DIRS</code> variable takes a
7792: list of package names (without the “<span class=
1.1 grant 7793: "quote">-dirs</span>” part) together with the
7794: required version number (always pick the latest one when
1.34 wiz 7795: writing new packages).</p>
1.1 grant 7796:
7797: <p>For example, if a package installs files under
1.45 wiz 7798: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7799: class="filename">share/applications</code>, it should
7800: have the following line in it:</p>
1.1 grant 7801: <pre class="programlisting">
7802: USE_DIRS+= xdg-1.1
7803:
7804: </pre>
7805:
1.14 xtraeme 7806: <p>After regenerating the PLIST using
7807: <span><strong class="command">make
7808: print-PLIST</strong></span>, you should get the right
7809: (commented out) lines.</p>
1.1 grant 7810:
1.47 ! reed 7811: <p>Note that even if your package is using <code xmlns=
1.45 wiz 7812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7813: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7814: *-x11-dirs packages. Just specify the name without that
1.45 wiz 7815: part and pkgsrc (in particular, <code xmlns=
7816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7817: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7818: </div>
7819: </div>
7820:
7821: <div class="chapter" lang="en" xml:lang="en">
7822: <div class="titlepage">
7823: <div>
7824: <div>
7825: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7826: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7827: methodology</h2>
7828: </div>
7829: </div>
7830: </div>
7831:
7832: <div class="toc">
7833: <p><b>Table of Contents</b></p>
7834:
7835: <dl>
1.30 wiz 7836: <dt><span class="sect1"><a href=
1.38 dillo 7837: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7838: to use buildlink3</a></span></dt>
1.1 grant 7839:
1.30 wiz 7840: <dt><span class="sect1"><a href=
1.45 wiz 7841: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
7842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7843: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7844:
7845: <dd>
7846: <dl>
1.25 rillig 7847: <dt><span class="sect2"><a href=
1.38 dillo 7848: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7849: buildlink3.mk file</a></span></dt>
1.1 grant 7850:
1.25 rillig 7851: <dt><span class="sect2"><a href=
1.38 dillo 7852: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7853: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7854: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 7855: <code xmlns=
7856: "http://www.w3.org/TR/xhtml1/transitional" class=
7857: "filename">buildlink3.mk</code>
1.1 grant 7858: files</a></span></dt>
7859: </dl>
7860: </dd>
7861:
1.30 wiz 7862: <dt><span class="sect1"><a href=
1.45 wiz 7863: "#writing-builtin.mk">11.3. Writing <code xmlns=
7864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7865: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7866:
7867: <dd>
7868: <dl>
1.25 rillig 7869: <dt><span class="sect2"><a href=
1.38 dillo 7870: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 7871: <code xmlns=
7872: "http://www.w3.org/TR/xhtml1/transitional" class=
7873: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 7874:
1.25 rillig 7875: <dt><span class="sect2"><a href=
1.38 dillo 7876: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7877: preferences for native or pkgsrc
7878: software</a></span></dt>
1.1 grant 7879: </dl>
7880: </dd>
7881: </dl>
7882: </div>
7883:
7884: <p>Buildlink is a framework in pkgsrc that controls what
7885: headers and libraries are seen by a package's configure and
7886: build processes. This is implemented in a two step
7887: process:</p>
7888:
7889: <div class="orderedlist">
7890: <ol type="1">
7891: <li>
7892: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7893: into <code class="varname">BUILDLINK_DIR</code>,
7894: which by default is a subdirectory of <code class=
7895: "varname">WRKDIR</code>.</p>
1.1 grant 7896: </li>
7897:
7898: <li>
7899: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7900: the normal compiler tools that translate <code class=
7901: "option">-I${LOCALBASE}/include</code> and
7902: <code class="option">-L${LOCALBASE}/lib</code> into
7903: references to <code class=
7904: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7905: also make native compiler on some operating systems
7906: look like GCC, so that packages that expect GCC won't
7907: require modifications to build with those native
7908: compilers.</p>
1.1 grant 7909: </li>
7910: </ol>
7911: </div>
7912:
7913: <p>This normalizes the environment in which a package is
7914: built so that the package may be built consistently despite
7915: what other software may be installed. Please note that the
1.45 wiz 7916: normal system header and library paths, e.g. <code xmlns=
7917: "http://www.w3.org/TR/xhtml1/transitional" class=
7918: "filename">/usr/include</code>, <code xmlns=
7919: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7920: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7921: buildlink3 is designed to insulate the package build from
7922: non-system-supplied software.</p>
7923:
7924: <div class="sect1" lang="en" xml:lang="en">
7925: <div class="titlepage">
7926: <div>
7927: <div>
7928: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7929: "converting-to-buildlink3" id=
1.38 dillo 7930: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 7931: packages to use buildlink3</h2>
1.1 grant 7932: </div>
7933: </div>
7934: </div>
7935:
7936: <p>The process of converting packages to use the
7937: buildlink3 framework (“<span class=
7938: "quote">bl3ifying</span>”) is fairly
7939: straightforward. The things to keep in mind are:</p>
7940:
7941: <div class="orderedlist">
7942: <ol type="1">
7943: <li>
7944: <p>Ensure that the build always calls the wrapper
7945: scripts instead of the actual toolchain. Some
7946: packages are tricky, and the only way to know for
1.45 wiz 7947: sure is the check <code xmlns=
7948: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7949: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7950: wrappers are being invoked.</p>
7951: </li>
7952:
7953: <li>
1.14 xtraeme 7954: <p>Don't override <code class=
7955: "varname">PREFIX</code> from within the package
7956: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 7957: because the code to symlink files into <code xmlns=
7958: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7959: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7960: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7961: <em class=
7962: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7963: </li>
7964:
7965: <li>
7966: <p>Remember that <span class=
1.45 wiz 7967: "emphasis"><em>only</em></span> the <code xmlns=
7968: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7969: "filename">buildlink3.mk</code> files that you list
1.1 grant 7970: in a package's Makefile are added as dependencies
7971: for that package.</p>
7972: </li>
7973: </ol>
7974: </div>
7975:
7976: <p>If a dependency on a particular package is required
7977: for its libraries and headers, then we replace:</p>
7978: <pre class="programlisting">
1.27 rillig 7979: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7980: </pre>
7981:
7982: <p>with</p>
7983: <pre class="programlisting">
7984: .include "../../category/foo/buildlink3.mk"
7985: </pre>
7986:
1.47 ! reed 7987: <p>The buildlink3.mk files usually define the required
! 7988: dependencies. If you need a newer version of the
! 7989: dependency when using buildlink3.mk files, then you can
! 7990: define it in your Makefile; for example:</p>
! 7991: <pre class="programlisting">
! 7992: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
! 7993: .include "../../category/foo/buildlink3.mk"
! 7994: </pre>
! 7995:
1.45 wiz 7996: <p>There are several <code xmlns=
7997: "http://www.w3.org/TR/xhtml1/transitional" class=
7998: "filename">buildlink3.mk</code> files in <code xmlns=
7999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8000: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8001: issues:</p>
8002:
8003: <div class="itemizedlist">
8004: <ul type="disc">
8005: <li>
1.45 wiz 8006: <p><code xmlns=
8007: "http://www.w3.org/TR/xhtml1/transitional" class=
8008: "filename">bdb.buildlink3.mk</code> chooses either
8009: the native or a pkgsrc Berkeley DB implementation
8010: based on the values of <code class=
1.14 xtraeme 8011: "varname">BDB_ACCEPTED</code> and <code class=
8012: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8013: </li>
8014:
8015: <li>
1.45 wiz 8016: <p><code xmlns=
8017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 8018: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8019: system comes with neither Curses nor NCurses, this
8020: will take care to install the <a xmlns=
8021: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8022: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8023: target="_top"><code xmlns="" class=
8024: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8025: </li>
8026:
8027: <li>
1.45 wiz 8028: <p><code xmlns=
8029: "http://www.w3.org/TR/xhtml1/transitional" class=
8030: "filename">krb5.buildlink3.mk</code> uses the value
8031: of <code class="varname">KRB5_ACCEPTED</code> to
8032: choose between adding a dependency on Heimdal or
8033: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8034: implementation.</p>
8035: </li>
8036:
8037: <li>
1.45 wiz 8038: <p><code xmlns=
8039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8040: "filename">motif.buildlink3.mk</code> checks for a
8041: system-provided Motif installation or adds a
8042: dependency on <a xmlns=
1.1 grant 8043: "http://www.w3.org/TR/xhtml1/transitional" href=
8044: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8045: target="_top"><code xmlns="" class=
8046: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8047: "http://www.w3.org/TR/xhtml1/transitional" href=
8048: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8049: target="_top"><code xmlns="" class=
1.47 ! reed 8050: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8051: </li>
8052:
8053: <li>
1.45 wiz 8054: <p><code xmlns=
8055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8056: "filename">ossaudio.buildlink3.mk</code> defines
8057: several variables that may be used by packages that
1.47 ! reed 8058: use the Open Sound System (OSS) API.</p>
1.1 grant 8059: </li>
8060:
8061: <li>
1.45 wiz 8062: <p><code xmlns=
8063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8064: "filename">pgsql.buildlink3.mk</code> will accept
8065: either Postgres 7.3 or 7.4, whichever is found
8066: installed. See the file for more information.</p>
1.1 grant 8067: </li>
8068:
8069: <li>
1.45 wiz 8070: <p><code xmlns=
8071: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8072: "filename">pthread.buildlink3.mk</code> uses the
8073: value of <code class="varname">PTHREAD_OPTS</code>
8074: and checks for native pthreads or adds a dependency
8075: on <a xmlns=
1.1 grant 8076: "http://www.w3.org/TR/xhtml1/transitional" href=
8077: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8078: target="_top"><code xmlns="" class=
1.47 ! reed 8079: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8080: </li>
8081:
8082: <li>
1.45 wiz 8083: <p><code xmlns=
8084: "http://www.w3.org/TR/xhtml1/transitional" class=
8085: "filename">xaw.buildlink3.mk</code> uses the value
8086: of <code class="varname">XAW_TYPE</code> to choose
8087: a particular Athena widgets library.</p>
1.1 grant 8088: </li>
8089: </ul>
8090: </div>
8091:
1.45 wiz 8092: <p>The comments in those <code xmlns=
8093: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8094: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8095: complete description of how to use them properly.</p>
8096: </div>
8097:
8098: <div class="sect1" lang="en" xml:lang="en">
8099: <div class="titlepage">
8100: <div>
8101: <div>
8102: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8103: "creating-buildlink3.mk" id=
1.38 dillo 8104: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8105: <code xmlns=
8106: "http://www.w3.org/TR/xhtml1/transitional" class=
8107: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8108: </div>
8109: </div>
8110: </div>
8111:
1.45 wiz 8112: <p>A package's <code xmlns=
8113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8114: "filename">buildlink3.mk</code> file is included by
8115: Makefiles to indicate the need to compile and link
8116: against header files and libraries provided by the
1.45 wiz 8117: package. A <code xmlns=
8118: "http://www.w3.org/TR/xhtml1/transitional" class=
8119: "filename">buildlink3.mk</code> file should always
8120: provide enough information to add the correct type of
8121: dependency relationship and include any other
8122: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8123: class="filename">buildlink3.mk</code> files that it needs
8124: to find headers and libraries that it needs in turn.</p>
1.1 grant 8125:
1.45 wiz 8126: <p>To generate an initial <code xmlns=
8127: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8128: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8129: Rene Hexel's <a xmlns=
8130: "http://www.w3.org/TR/xhtml1/transitional" href=
8131: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8132: target="_top"><code xmlns="" class=
8133: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8134: highly recommended. For most packages, the following
8135: command will generate a good starting point for
1.45 wiz 8136: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8137: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8138: <pre class="screen">
1.14 xtraeme 8139: <code class="prompt">%</code> <strong class=
8140: "userinput"><code>cd pkgsrc/<em class=
8141: "replaceable"><code>category</code></em>/<em class=
8142: "replaceable"><code>pkgdir</code></em>
8143: <code class=
8144: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 8145: </pre>
8146:
8147: <div class="sect2" lang="en" xml:lang="en">
8148: <div class="titlepage">
8149: <div>
8150: <div>
1.30 wiz 8151: <h3 class="title"><a name="anatomy-of-bl3" id=
1.38 dillo 8152: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8153: buildlink3.mk file</h3>
1.1 grant 8154: </div>
8155: </div>
8156: </div>
8157:
1.45 wiz 8158: <p>The following real-life example <code xmlns=
8159: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8160: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8161: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8162: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8163: <pre class="programlisting">
1.17 sketch 8164: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8165:
8166: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8167: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
8168:
8169: .if !empty(BUILDLINK_DEPTH:M+)
8170: BUILDLINK_DEPENDS+= tiff
8171: .endif
8172:
8173: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8174: BUILDLINK_PACKAGES+= tiff
8175:
8176: .if !empty(TIFF_BUILDLINK3_MK:M+)
8177: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8178: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8179: .endif # TIFF_BUILDLINK3_MK
8180:
8181: .include "../../devel/zlib/buildlink3.mk"
8182: .include "../../graphics/jpeg/buildlink3.mk"
8183:
8184: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
8185: </pre>
8186:
1.14 xtraeme 8187: <p>The header and footer manipulate <code class=
8188: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8189: across all <code xmlns=
8190: "http://www.w3.org/TR/xhtml1/transitional" class=
8191: "filename">buildlink3.mk</code> files and is used to
8192: track at what depth we are including <code xmlns=
8193: "http://www.w3.org/TR/xhtml1/transitional" class=
8194: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8195:
8196: <p>The first section controls if the dependency on
1.14 xtraeme 8197: <em class="replaceable"><code>pkg</code></em> is added.
8198: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8199: global list of packages for which dependencies are
8200: added by buildlink3.</p>
8201:
8202: <p>The second section advises pkgsrc that the
1.45 wiz 8203: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8204: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8205: <em class="replaceable"><code>pkg</code></em> has been
8206: included at some point. <code class=
8207: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8208: of packages for which <code xmlns=
8209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8210: "filename">buildlink3.mk</code> files have been
8211: included. It must <span class=
8212: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8213: a <code xmlns=
8214: "http://www.w3.org/TR/xhtml1/transitional" class=
8215: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8216:
8217: <p>The third section is protected from multiple
1.14 xtraeme 8218: inclusion and controls how the dependency on <em class=
8219: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8220: important variables are set in the section:</p>
8221:
8222: <div class="itemizedlist">
8223: <ul type="disc">
8224: <li>
1.14 xtraeme 8225: <p><code class=
8226: "varname">BUILDLINK_DEPENDS.<em class=
8227: "replaceable"><code>pkg</code></em></code> is the
8228: actual dependency recorded in the installed
8229: package; this should always be set using
8230: <span><strong class="command">+=</strong></span>
8231: to ensure that we're appending to any
8232: pre-existing list of values. This variable should
8233: be set to the first version of the package that
8234: had the last change in the major number of a
8235: shared library or that had a major API
8236: change.</p>
1.1 grant 8237: </li>
8238:
8239: <li>
1.14 xtraeme 8240: <p><code class=
8241: "varname">BUILDLINK_PKGSRCDIR.<em class=
8242: "replaceable"><code>pkg</code></em></code> is the
8243: location of the <em class=
8244: "replaceable"><code>pkg</code></em> pkgsrc
1.47 ! reed 8245: directory.</p>
1.1 grant 8246: </li>
8247:
8248: <li>
1.14 xtraeme 8249: <p><code class=
8250: "varname">BUILDLINK_DEPMETHOD.<em class=
8251: "replaceable"><code>pkg</code></em></code> (not
8252: shown above) controls whether we use <code class=
8253: "varname">BUILD_DEPENDS</code> or <code class=
8254: "varname">DEPENDS</code> to add the dependency on
8255: <em class="replaceable"><code>pkg</code></em>.
8256: The build dependency is selected by setting
8257: <code class=
8258: "varname">BUILDLINK_DEPMETHOD.<em class=
8259: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8260: “<span class="quote">build</span>”.
8261: By default, the full dependency is used.</p>
8262: </li>
8263:
8264: <li>
1.14 xtraeme 8265: <p><code class=
8266: "varname">BUILDLINK_INCDIRS.<em class=
8267: "replaceable"><code>pkg</code></em></code> and
8268: <code class=
8269: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
8270: <code>pkg</code></em></code> (not shown above)
1.45 wiz 8271: are lists of subdirectories of <code xmlns=
8272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8273: "filename">${BUILDLINK_PREFIX.<em class=
8274: "replaceable"><code>pkg</code></em>}</code> to
8275: add to the header and library search paths. These
1.1 grant 8276: default to “<span class=
8277: "quote">include</span>” and
8278: “<span class="quote">lib</span>”
8279: respectively.</p>
8280: </li>
8281:
8282: <li>
1.14 xtraeme 8283: <p><code class=
8284: "varname">BUILDLINK_CPPFLAGS.<em class=
8285: "replaceable"><code>pkg</code></em></code> (not
8286: shown above) is the list of preprocessor flags to
8287: add to <code class="varname">CPPFLAGS</code>,
8288: which are passed on to the configure and build
8289: phases. The “<span class=
8290: "quote">-I</span>” option should be avoided
8291: and instead be handled using <code class=
8292: "varname">BUILDLINK_INCDIRS.<em class=
8293: "replaceable"><code>pkg</code></em></code> as
8294: above.</p>
1.1 grant 8295: </li>
8296: </ul>
8297: </div>
8298:
8299: <p>The following variables are all optionally defined
8300: within this second section (protected against multiple
8301: inclusion) and control which package files are
1.45 wiz 8302: symlinked into <code xmlns=
8303: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8304: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8305: are transformed during the symlinking:</p>
8306:
8307: <div class="itemizedlist">
8308: <ul type="disc">
8309: <li>
1.14 xtraeme 8310: <p><code class=
8311: "varname">BUILDLINK_FILES.<em class=
8312: "replaceable"><code>pkg</code></em></code> (not
8313: shown above) is a shell glob pattern relative to
1.45 wiz 8314: <code xmlns=
8315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8316: "filename">${BUILDLINK_PREFIX.<em class=
8317: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8318: symlinked into <code xmlns=
8319: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8320: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8321: <code xmlns=
8322: "http://www.w3.org/TR/xhtml1/transitional" class=
8323: "filename">include/*.h</code>.</p>
1.1 grant 8324: </li>
8325:
8326: <li>
1.14 xtraeme 8327: <p><code class=
8328: "varname">BUILDLINK_FILES_CMD.<em class=
8329: "replaceable"><code>pkg</code></em></code> (not
8330: shown above) is a shell pipeline that outputs to
1.45 wiz 8331: stdout a list of 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>. The
1.1 grant 8335: resulting files are to be symlinked into
1.45 wiz 8336: <code xmlns=
8337: "http://www.w3.org/TR/xhtml1/transitional" class=
8338: "filename">${BUILDLINK_DIR}</code>. By default,
8339: this takes the <code xmlns=
8340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8341: "filename">+CONTENTS</code> of a <em class=
8342: "replaceable"><code>pkg</code></em> and filters
8343: it through <code class=
8344: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8345: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8346: </li>
8347:
8348: <li>
1.14 xtraeme 8349: <p><code class=
8350: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8351: "replaceable"><code>pkg</code></em></code> (not
8352: shown above) is a filter command that filters
1.45 wiz 8353: <code xmlns=
8354: "http://www.w3.org/TR/xhtml1/transitional" class=
8355: "filename">+CONTENTS</code> input into a list of
8356: files relative to <code xmlns=
8357: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8358: "filename">${BUILDLINK_PREFIX.<em class=
8359: "replaceable"><code>pkg</code></em>}</code> on
8360: stdout. By default for overwrite packages,
8361: <code class=
8362: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8363: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8364: outputs the contents of the <code xmlns=
8365: "http://www.w3.org/TR/xhtml1/transitional" class=
8366: "filename">include</code> and <code xmlns=
8367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8368: "filename">lib</code> directories in the package
1.45 wiz 8369: <code xmlns=
8370: "http://www.w3.org/TR/xhtml1/transitional" class=
8371: "filename">+CONTENTS</code>, and for pkgviews
8372: packages, it outputs any libtool archives in
8373: <code xmlns=
8374: "http://www.w3.org/TR/xhtml1/transitional" class=
8375: "filename">lib</code> directories.</p>
1.1 grant 8376: </li>
8377:
8378: <li>
1.14 xtraeme 8379: <p><code class=
8380: "varname">BUILDLINK_TRANSFORM.<em class=
8381: "replaceable"><code>pkg</code></em></code> (not
8382: shown above) is a list of sed arguments used to
1.1 grant 8383: transform the name of the source filename into a
1.14 xtraeme 8384: destination filename, e.g. <span><strong class=
1.1 grant 8385: "command">-e
1.14 xtraeme 8386: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8387: </li>
8388: </ul>
8389: </div>
8390:
1.45 wiz 8391: <p>The last section includes any <code xmlns=
8392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8393: "filename">buildlink3.mk</code> needed for <em class=
8394: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8395: dependencies. Including these <code xmlns=
8396: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8397: "filename">buildlink3.mk</code> files means that the
8398: headers and libraries for these dependencies are also
1.45 wiz 8399: symlinked into <code xmlns=
8400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8401: "filename">${BUILDLINK_DIR}</code> whenever the
8402: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8403: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8404: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8405: included.</p>
1.1 grant 8406: </div>
8407:
8408: <div class="sect2" lang="en" xml:lang="en">
8409: <div class="titlepage">
8410: <div>
8411: <div>
1.30 wiz 8412: <h3 class="title"><a name=
8413: "updating-buildlink-depends" id=
1.38 dillo 8414: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8415: <code class=
8416: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45 wiz 8417: <code>pkg</code></em></code> in <code xmlns=
8418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8419: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8420: </div>
8421: </div>
8422: </div>
8423:
8424: <p>There are two situations that require increasing the
1.14 xtraeme 8425: dependency listed in <code class=
8426: "varname">BUILDLINK_DEPENDS.<em class=
8427: "replaceable"><code>pkg</code></em></code> after a
8428: package update:</p>
1.1 grant 8429:
8430: <div class="orderedlist">
8431: <ol type="1">
8432: <li>
8433: <p>if the sonames (major number of the library
8434: version) of any installed shared libraries
1.47 ! reed 8435: change.</p>
1.1 grant 8436: </li>
8437:
8438: <li>
8439: <p>if the API or interface to the header files
8440: change.</p>
8441: </li>
8442: </ol>
8443: </div>
8444:
1.14 xtraeme 8445: <p>In these cases, <code class=
8446: "varname">BUILDLINK_DEPENDS.<em class=
8447: "replaceable"><code>pkg</code></em></code> should be
8448: adjusted to require at least the new package version.
8449: In some cases, the packages that depend on this new
8450: version may need their <code class=
8451: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8452: have <code xmlns=
8453: "http://www.w3.org/TR/xhtml1/transitional" class=
8454: "filename">buildlink3.mk</code> files, their
8455: <code class="varname">BUILDLINK_DEPENDS.<em class=
8456: "replaceable"><code>pkg</code></em></code> adjusted,
8457: too. This is needed so that binary packages made using
8458: it will require the correct package dependency and not
8459: settle for an older one which will not contain the
8460: necessary shared libraries.</p>
1.1 grant 8461:
8462: <p>Please take careful consideration before adjusting
1.14 xtraeme 8463: <code class="varname">BUILDLINK_DEPENDS.<em class=
8464: "replaceable"><code>pkg</code></em></code> as we don't
8465: want to cause unneeded package deletions and rebuilds.
8466: In many cases, new versions of packages work just fine
8467: with older dependencies. See <a href="#dependencies"
1.38 dillo 8468: title="15.1.4. Handling dependencies">Section
8469: 15.1.4, “Handling dependencies”</a> for
1.36 wiz 8470: more information about dependencies on other packages,
1.25 rillig 8471: including the <code class=
8472: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8473: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8474: </div>
8475: </div>
8476:
8477: <div class="sect1" lang="en" xml:lang="en">
8478: <div class="titlepage">
8479: <div>
8480: <div>
8481: <h2 class="title" style="clear: both"><a name=
1.30 wiz 8482: "writing-builtin.mk" id=
1.38 dillo 8483: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8484: <code xmlns=
8485: "http://www.w3.org/TR/xhtml1/transitional" class=
8486: "filename">builtin.mk</code> files</h2>
1.1 grant 8487: </div>
8488: </div>
8489: </div>
8490:
8491: <p>Some packages in pkgsrc install headers and libraries
8492: that coincide with headers and libraries present in the
1.45 wiz 8493: base system. Aside from a <code xmlns=
8494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8495: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8496: should also include a <code xmlns=
8497: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8498: "filename">builtin.mk</code> file that includes the
8499: necessary checks to decide whether using the built-in
8500: software or the pkgsrc software is appropriate.</p>
1.1 grant 8501:
8502: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8503: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8504:
8505: <div class="orderedlist">
8506: <ol type="1">
8507: <li>
1.14 xtraeme 8508: <p>It should set <code class=
8509: "varname">USE_BUILTIN.<em class=
8510: "replaceable"><code>pkg</code></em></code> to
8511: either “<span class="quote">yes</span>”
8512: or “<span class="quote">no</span>”
8513: after it is included.</p>
1.1 grant 8514: </li>
8515:
8516: <li>
8517: <p>It should <span class=
8518: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8519: <code class="varname">USE_BUILTIN.<em class=
8520: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8521: already set before the <code xmlns=
8522: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8523: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8524: </li>
8525:
8526: <li>
8527: <p>It should be written to allow multiple
8528: inclusion. This is <span class=
8529: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8530: careful attention to <code xmlns=
8531: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8532: "filename">Makefile</code> coding.</p>
1.1 grant 8533: </li>
8534: </ol>
8535: </div>
8536:
8537: <div class="sect2" lang="en" xml:lang="en">
8538: <div class="titlepage">
8539: <div>
8540: <div>
1.30 wiz 8541: <h3 class="title"><a name="anatomy-of-builtin.mk"
8542: id=
1.38 dillo 8543: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8544: of a <code xmlns=
8545: "http://www.w3.org/TR/xhtml1/transitional" class=
8546: "filename">builtin.mk</code> file</h3>
1.1 grant 8547: </div>
8548: </div>
8549: </div>
8550:
8551: <p>The following is the recommended template for
8552: builtin.mk files:</p>
8553: <pre class="programlisting">
8554: .if !defined(IS_BUILTIN.foo)
8555: #
8556: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8557: # genuinely exists in the system or not.
8558: #
8559: IS_BUILTIN.foo?= no
8560:
8561: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8562: # version can be determined.
8563: #
8564: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8565: BUILTIN_PKG.foo?= foo-1.0
8566: . endif
8567: .endif # IS_BUILTIN.foo
8568:
8569: .if !defined(USE_BUILTIN.foo)
8570: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8571: . if defined(BUILTIN_PKG.foo)
8572: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8573: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8574: USE_BUILTIN.foo!= \
8575: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8576: ${ECHO} "yes"; \
8577: else \
8578: ${ECHO} "no"; \
8579: fi
8580: . endif
8581: . endfor
8582: . endif
8583: .endif # USE_BUILTIN.foo
8584:
8585: CHECK_BUILTIN.foo?= no
8586: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8587: #
8588: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8589: # "yes" or "no".
8590: #
8591: .endif # CHECK_BUILTIN.foo
8592:
8593: </pre>
8594:
1.14 xtraeme 8595: <p>The first section sets <code class=
8596: "varname">IS_BUILTIN.<em class=
8597: "replaceable"><code>pkg</code></em></code> depending on
8598: if <em class="replaceable"><code>pkg</code></em> really
8599: exists in the base system. This should not be a base
8600: system software with similar functionality to
8601: <em class="replaceable"><code>pkg</code></em>; it
8602: should only be “<span class=
8603: "quote">yes</span>” if the actual package is
8604: included as part of the base system. This variable is
1.45 wiz 8605: only used internally within the <code xmlns=
8606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8607: "filename">builtin.mk</code> file.</p>
8608:
8609: <p>The second section sets <code class=
8610: "varname">BUILTIN_PKG.<em class=
8611: "replaceable"><code>pkg</code></em></code> to the
8612: version of <em class=
8613: "replaceable"><code>pkg</code></em> in the base system
8614: if it exists (if <code class=
8615: "varname">IS_BUILTIN.<em class=
8616: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8617: “<span class="quote">yes</span>”). This
1.14 xtraeme 8618: variable is only used internally within the
1.45 wiz 8619: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8620: class="filename">builtin.mk</code> file.</p>
1.1 grant 8621:
1.14 xtraeme 8622: <p>The third section sets <code class=
8623: "varname">USE_BUILTIN.<em class=
8624: "replaceable"><code>pkg</code></em></code> and is
8625: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8626: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8627: class="filename">builtin.mk</code> files. The code in
8628: this section must make the determination whether the
8629: built-in software is adequate to satisfy the
8630: dependencies listed in <code class=
1.14 xtraeme 8631: "varname">BUILDLINK_DEPENDS.<em class=
8632: "replaceable"><code>pkg</code></em></code>. This is
8633: typically done by comparing <code class=
8634: "varname">BUILTIN_PKG.<em class=
8635: "replaceable"><code>pkg</code></em></code> against each
8636: of the dependencies in <code class=
8637: "varname">BUILDLINK_DEPENDS.<em class=
8638: "replaceable"><code>pkg</code></em></code>.
8639: <code class="varname">USE_BUILTIN.<em class=
8640: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8641: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8642: value by the end of the <code xmlns=
8643: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8644: "filename">builtin.mk</code> file. Note that
8645: <code class="varname">USE_BUILTIN.<em class=
8646: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8647: “<span class="quote">yes</span>” even if
1.14 xtraeme 8648: <code class="varname">IS_BUILTIN.<em class=
8649: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8650: “<span class="quote">no</span>” because we
8651: may make the determination that the built-in version of
8652: the software is similar enough to be used as a
8653: replacement.</p>
8654:
1.14 xtraeme 8655: <p>The last section is guarded by <code class=
8656: "varname">CHECK_BUILTIN.<em class=
8657: "replaceable"><code>pkg</code></em></code>, and
8658: includes code that uses the value of <code class=
8659: "varname">USE_BUILTIN.<em class=
8660: "replaceable"><code>pkg</code></em></code> set in the
8661: previous section. This typically includes, e.g., adding
1.1 grant 8662: additional dependency restrictions and listing
1.45 wiz 8663: additional files to symlink into <code xmlns=
8664: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8665: "filename">${BUILDLINK_DIR}</code> (via <code class=
8666: "varname">BUILDLINK_FILES.<em class=
8667: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8668: </div>
8669:
8670: <div class="sect2" lang="en" xml:lang="en">
8671: <div class="titlepage">
8672: <div>
8673: <div>
1.30 wiz 8674: <h3 class="title"><a name=
8675: "native-or-pkgsrc-preference" id=
1.38 dillo 8676: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8677: preferences for native or pkgsrc software</h3>
1.1 grant 8678: </div>
8679: </div>
8680: </div>
8681:
8682: <p>When building packages, it's possible to choose
8683: whether to set a global preference for using either the
8684: built-in (native) version or the pkgsrc version of
8685: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8686: setting <code class="varname">PREFER_PKGSRC</code> and
8687: <code class="varname">PREFER_NATIVE</code>. These
8688: variables take values of either “<span class=
1.1 grant 8689: "quote">yes</span>”, “<span class=
8690: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8691: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8692: to use the pkgsrc versions of software, while
8693: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8694: to use the built-in versions. Preferences are
8695: determined by the most specific instance of the package
8696: in either <code class="varname">PREFER_PKGSRC</code> or
8697: <code class="varname">PREFER_NATIVE</code>. If a
8698: package is specified in neither or in both variables,
8699: then <code class="varname">PREFER_PKGSRC</code> has
8700: precedence over <code class=
8701: "varname">PREFER_NATIVE</code>. For example, to require
8702: using pkgsrc versions of software for all but the most
8703: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8704: <pre class="programlisting">
8705: PREFER_PKGSRC= yes
8706: PREFER_NATIVE= getopt skey tcp_wrappers
8707:
8708: </pre>
8709:
8710: <p>A package <span class=
1.45 wiz 8711: "emphasis"><em>must</em></span> have a <code xmlns=
8712: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8713: "filename">builtin.mk</code> file to be listed in
8714: <code class="varname">PREFER_NATIVE</code>, otherwise
8715: it is simply ignored in that list.</p>
1.1 grant 8716: </div>
8717: </div>
8718: </div>
8719:
8720: <div class="chapter" lang="en" xml:lang="en">
8721: <div class="titlepage">
8722: <div>
8723: <div>
1.35 jmmv 8724: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 8725: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8726: framework</h2>
1.1 grant 8727: </div>
8728: </div>
8729: </div>
8730:
8731: <div class="toc">
8732: <p><b>Table of Contents</b></p>
8733:
8734: <dl>
1.30 wiz 8735: <dt><span class="sect1"><a href=
1.38 dillo 8736: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8737: directories outside the installation
8738: prefix</a></span></dt>
8739:
8740: <dd>
8741: <dl>
8742: <dt><span class="sect2"><a href=
1.38 dillo 8743: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8744: manipulation</a></span></dt>
8745:
8746: <dt><span class="sect2"><a href=
1.38 dillo 8747: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8748: manipulation</a></span></dt>
8749: </dl>
8750: </dd>
8751:
1.38 dillo 8752: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8753: Configuration files</a></span></dt>
8754:
8755: <dd>
8756: <dl>
8757: <dt><span class="sect2"><a href=
1.38 dillo 8758: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8759: "varname">PKG_SYSCONFDIR</code> is
8760: set</a></span></dt>
8761:
8762: <dt><span class="sect2"><a href=
1.38 dillo 8763: "#conf-files-configure">12.2.2. Telling the
1.47 ! reed 8764: software where configuration files
1.35 jmmv 8765: are</a></span></dt>
8766:
8767: <dt><span class="sect2"><a href=
1.38 dillo 8768: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8769: installations</a></span></dt>
8770:
8771: <dt><span class="sect2"><a href=
1.38 dillo 8772: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8773: configuration files</a></span></dt>
8774: </dl>
8775: </dd>
8776:
1.38 dillo 8777: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8778: System startup scripts</a></span></dt>
8779:
8780: <dd>
8781: <dl>
8782: <dt><span class="sect2"><a href=
1.38 dillo 8783: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8784: of system startup scripts</a></span></dt>
8785: </dl>
8786: </dd>
1.1 grant 8787:
1.30 wiz 8788: <dt><span class="sect1"><a href=
1.38 dillo 8789: "#users-and-groups">12.4. System users and
1.35 jmmv 8790: groups</a></span></dt>
8791:
1.38 dillo 8792: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8793: shells</a></span></dt>
8794:
8795: <dd>
8796: <dl>
8797: <dt><span class="sect2"><a href=
1.38 dillo 8798: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8799: configuration files</a></span></dt>
8800: </dl>
8801: </dd>
1.1 grant 8802: </dl>
8803: </div>
8804:
1.35 jmmv 8805: <p>This chapter describes the framework known as
8806: <code class="literal">pkginstall</code>, whose key features
8807: are:</p>
8808:
8809: <div class="itemizedlist">
8810: <ul type="disc">
8811: <li>
8812: <p>Generic installation and manipulation of
8813: directories and files outside the pkgsrc-handled
8814: tree, <code class="varname">LOCALBASE</code>.</p>
8815: </li>
8816:
8817: <li>
8818: <p>Automatic handling of configuration files during
8819: installation, provided that packages are correctly
8820: designed.</p>
8821: </li>
8822:
8823: <li>
8824: <p>Generation and installation of system startup
8825: scripts.</p>
8826: </li>
8827:
8828: <li>
8829: <p>Registration of system users and groups.</p>
8830: </li>
8831:
8832: <li>
8833: <p>Registration of system shells.</p>
8834: </li>
8835: </ul>
8836: </div>
8837:
8838: <p>The following sections inspect each of the above points
1.47 ! reed 8839: in detail. Note that in order to use any of the described
1.35 jmmv 8840: functionalities, you must add the following to your
1.45 wiz 8841: package's <code xmlns=
8842: "http://www.w3.org/TR/xhtml1/transitional" class=
8843: "filename">Makefile</code>:</p>
1.35 jmmv 8844: <pre class="programlisting">
8845: USE_PKGINSTALL=YES
8846: </pre>
8847:
8848: <p>You may be thinking that many of the things described
8849: here could be easily done with simple code in the package's
8850: post-installation target (<code class=
8851: "literal">post-install</code>). <span class=
8852: "emphasis"><em>This is incorrect</em></span>, as the code
8853: in them is only executed when building from source.
8854: Machines using binary packages could not benefit from it at
8855: all (as the code itself could be unavailable). Therefore,
8856: the only way to achieve any of the items described above is
8857: by means of the installation scripts, which are
8858: automatically generated by pkginstall.</p>
1.1 grant 8859:
8860: <div class="sect1" lang="en" xml:lang="en">
8861: <div class="titlepage">
8862: <div>
8863: <div>
8864: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 8865: "files-and-dirs-outside-prefix" id=
1.38 dillo 8866: "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35 jmmv 8867: directories outside the installation prefix</h2>
1.1 grant 8868: </div>
8869: </div>
8870: </div>
8871:
1.45 wiz 8872: <p>As you already know, the <code xmlns=
8873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8874: "filename">PLIST</code> file holds a list of files and
8875: directories that belong to a package. The names used in
1.45 wiz 8876: it are relative to the installation prefix (<code xmlns=
8877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8878: "filename">${PREFIX}</code>), which means that it cannot
8879: register files outside this directory (absolute path
8880: names are not allowed). Despite this restriction, some
8881: packages need to install files outside this location;
1.45 wiz 8882: e.g., under <code xmlns=
8883: "http://www.w3.org/TR/xhtml1/transitional" class=
8884: "filename">${VARBASE}</code> or <code xmlns=
8885: "http://www.w3.org/TR/xhtml1/transitional" class=
8886: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 8887:
8888: <p>The only way to achieve this is to create such files
8889: during installation time by using the installation
8890: scripts. These scripts can run arbitrary commands, so
8891: they have the potential to create and manage files
1.47 ! reed 8892: anywhere in the file system. Here is where pkginstall
1.35 jmmv 8893: comes into play: it provides generic scripts to abstract
8894: the manipulation of such files and directories based on
1.45 wiz 8895: variables set in the package's <code xmlns=
8896: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8897: "filename">Makefile</code>. The rest of this section
1.47 ! reed 8898: describes these variables.</p>
1.1 grant 8899:
1.35 jmmv 8900: <div class="sect2" lang="en" xml:lang="en">
8901: <div class="titlepage">
1.1 grant 8902: <div>
1.35 jmmv 8903: <div>
8904: <h3 class="title"><a name="dirs-outside-prefix"
1.38 dillo 8905: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8906: manipulation</h3>
8907: </div>
1.1 grant 8908: </div>
8909: </div>
8910:
1.35 jmmv 8911: <p>The following variables can be set to request the
1.47 ! reed 8912: creation of directories anywhere in the file
! 8913: system:</p>
1.27 rillig 8914:
1.35 jmmv 8915: <div class="itemizedlist">
8916: <ul type="disc">
8917: <li>
8918: <p><code class="varname">MAKE_DIRS</code> and
8919: <code class="varname">OWN_DIRS</code> contain a
8920: list of directories that should be created and
8921: should attempt to be destroyed by the
8922: installation scripts. The difference between the
8923: two is that the latter prompts the administrator
8924: to remove any directories that may be left after
8925: deinstallation (because they were not empty),
8926: while the former does not.</p>
8927: </li>
1.1 grant 8928:
1.35 jmmv 8929: <li>
8930: <p><code class="varname">MAKE_DIRS_PERMS</code>
8931: and <code class="varname">OWN_DIRS_PERMS</code>
8932: contain a list of tuples describing which
8933: directories should be created and should attempt
8934: to be destroyed by the installation scripts. Each
8935: tuple holds the following values, separated by
8936: spaces: the directory name, its owner, its group
8937: and its numerical mode. For example:</p>
8938: <pre class="programlisting">
8939: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8940: </pre>
1.1 grant 8941:
1.35 jmmv 8942: <p>The difference between the two is exactly the
8943: same as their non-<code class=
8944: "varname">PERMS</code> counterparts.</p>
8945: </li>
8946: </ul>
8947: </div>
8948: </div>
8949:
8950: <div class="sect2" lang="en" xml:lang="en">
8951: <div class="titlepage">
8952: <div>
8953: <div>
8954: <h3 class="title"><a name="files-outside-prefix"
1.38 dillo 8955: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 8956: manipulation</h3>
8957: </div>
8958: </div>
8959: </div>
8960:
8961: <p>Creating non-empty files outside the installation
1.45 wiz 8962: prefix is tricky because the <code xmlns=
8963: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8964: "filename">PLIST</code> forces all files to be inside
8965: it. To overcome this problem, the only solution is to
8966: extract the file in the known place (i.e., inside the
8967: installation prefix) and copy it to the appropriate
8968: location during installation (done by the installation
8969: scripts generated by pkginstall). We will call the
8970: former the <span class="emphasis"><em>master
8971: file</em></span> in the following paragraphs, which
8972: describe the variables that can be used to
8973: automatically and consistently handle files outside the
8974: installation prefix:</p>
8975:
8976: <div class="itemizedlist">
8977: <ul type="disc">
8978: <li>
8979: <p><code class="varname">CONF_FILES</code> and
8980: <code class="varname">SUPPORT_FILES</code> are
8981: pairs of master and target files. During
8982: installation time, the master file is copied to
8983: the target one if and only if the latter does not
8984: exist. Upon deinstallation, the target file is
8985: removed provided that it was not modified by the
8986: installation.</p>
8987:
8988: <p>The difference between the two is that the
8989: latter prompts the administrator to remove any
8990: files that may be left after deinstallation
8991: (because they were not empty), while the former
8992: does not.</p>
8993: </li>
8994:
8995: <li>
8996: <p><code class="varname">CONF_FILES_PERMS</code>
8997: and <code class=
8998: "varname">SUPPORT_FILES_PERMS</code> contain
8999: tuples describing master files as well as their
9000: target locations. For each of them, it also
9001: specifies their owner, their group and their
9002: numeric permissions, in this order. For
9003: example:</p>
9004: <pre class="programlisting">
9005: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
9006: </pre>
9007:
9008: <p>The difference between the two is exactly the
9009: same as their non-<code class=
9010: "varname">PERMS</code> counterparts.</p>
9011: </li>
9012: </ul>
9013: </div>
9014: </div>
9015: </div>
9016:
9017: <div class="sect1" lang="en" xml:lang="en">
9018: <div class="titlepage">
9019: <div>
9020: <div>
9021: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9022: "conf-files" id="conf-files"></a>12.2.
1.35 jmmv 9023: Configuration files</h2>
9024: </div>
9025: </div>
9026: </div>
9027:
9028: <p>Configuration files are special in the sense that they
9029: are installed in their own specific directory,
9030: <code class="varname">PKG_SYSCONFDIR</code>, and need
9031: special treatment during installation (most of which is
9032: automated by pkginstall). The main concept you must bear
1.36 wiz 9033: in mind is that files marked as configuration files are
1.35 jmmv 9034: automatically copied to the right place (somewhere inside
9035: <code class="varname">PKG_SYSCONFDIR</code>) during
9036: installation <span class="emphasis"><em>if and only
9037: if</em></span> they didn't exist before. Similarly, they
9038: will not be removed if they have local modifications.
1.36 wiz 9039: This ensures that administrators never lose any custom
1.35 jmmv 9040: changes they may have made.</p>
9041:
9042: <div class="sect2" lang="en" xml:lang="en">
9043: <div class="titlepage">
9044: <div>
9045: <div>
9046: <h3 class="title"><a name="conf-files-sysconfdir"
1.38 dillo 9047: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9048: <code class="varname">PKG_SYSCONFDIR</code> is
9049: set</h3>
9050: </div>
9051: </div>
9052: </div>
9053:
9054: <p>As said before, the <code class=
9055: "varname">PKG_SYSCONFDIR</code> variable specifies
9056: where configuration files shall be installed. Its
9057: contents are set based upon the following
9058: variables:</p>
9059:
9060: <div class="itemizedlist">
9061: <ul type="disc">
9062: <li>
9063: <p><code class="varname">PKG_SYSCONFBASE</code>:
9064: The configuration's root directory. Defaults to
1.45 wiz 9065: <code xmlns=
9066: "http://www.w3.org/TR/xhtml1/transitional" class=
9067: "filename">${PREFIX}/etc</code> although it may
9068: be overridden by the user to point to his
9069: preferred location (e.g., <code xmlns=
9070: "http://www.w3.org/TR/xhtml1/transitional" class=
9071: "filename">/etc</code>, <code xmlns=
9072: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9073: "filename">/etc/pkg</code>, etc.). Packages must
9074: not use it directly.</p>
9075: </li>
9076:
9077: <li>
9078: <p><code class=
9079: "varname">PKG_SYSCONFSUBDIR</code>: A
9080: subdirectory of <code class=
9081: "varname">PKG_SYSCONFBASE</code> under which the
9082: configuration files for the package being built
9083: shall be installed. The definition of this
9084: variable only makes sense in the package's
1.45 wiz 9085: <code xmlns=
9086: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 9087: "filename">Makefile</code> (i.e., it is not
! 9088: user-customizable).</p>
1.35 jmmv 9089:
9090: <p>As an example, consider the Apache package,
9091: <a xmlns=
9092: "http://www.w3.org/TR/xhtml1/transitional" href=
9093: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9094: target="_top"><code xmlns="" class=
9095: "filename">www/apache2</code></a>, which places
9096: its configuration files under the <code xmlns=
9097: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9098: "filename">httpd/</code> subdirectory of
9099: <code class="varname">PKG_SYSCONFBASE</code>.
9100: This should be set in the package Makefile.</p>
9101: </li>
9102:
9103: <li>
9104: <p><code class="varname">PKG_SYSCONFVAR</code>:
9105: Specifies the name of the variable that holds
9106: this package's configuration directory (if
9107: different from <code class=
9108: "varname">PKG_SYSCONFBASE</code>). It defaults to
9109: <code class="varname">PKGBASE</code>'s value, and
9110: is always prefixed with <code class=
9111: "literal">PKG_SYSCONFDIR</code>.</p>
9112: </li>
9113:
9114: <li>
9115: <p><code class=
9116: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9117: Holds the directory where the configuration files
9118: for the package identified by <code class=
9119: "varname">PKG_SYSCONFVAR</code>'s shall be
9120: placed.</p>
9121: </li>
9122: </ul>
9123: </div>
9124:
9125: <p>Based on the above variables, pkginstall determines
9126: the value of <code class=
9127: "varname">PKG_SYSCONFDIR</code>, which is the
9128: <span class="emphasis"><em>only</em></span> variable
9129: that can be used within a package to refer to its
9130: configuration directory. The algorithm used to set its
9131: value is basically the following:</p>
9132:
9133: <div class="orderedlist">
9134: <ol type="1">
9135: <li>
9136: <p>If <code class=
9137: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9138: is set, its value is used.</p>
9139: </li>
9140:
9141: <li>
9142: <p>If the previous variable is not defined but
9143: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9144: set in the package's <code xmlns=
9145: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9146: "filename">Makefile</code>, the resulting value
1.45 wiz 9147: is <code xmlns=
9148: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9149: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9150: </li>
9151:
9152: <li>
1.45 wiz 9153: <p>Otherwise, it is set to <code xmlns=
9154: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9155: "filename">${PKG_SYSCONFBASE}</code>.</p>
9156: </li>
9157: </ol>
9158: </div>
9159:
1.45 wiz 9160: <p>It is worth mentioning that <code xmlns=
9161: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9162: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9163: added to <code xmlns=
9164: "http://www.w3.org/TR/xhtml1/transitional" class=
9165: "filename">OWN_DIRS</code>. See <a href=
9166: "#dirs-outside-prefix" title=
1.38 dillo 9167: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9168: “Directory manipulation”</a> what this
9169: means.</p>
9170: </div>
9171:
9172: <div class="sect2" lang="en" xml:lang="en">
9173: <div class="titlepage">
9174: <div>
9175: <div>
9176: <h3 class="title"><a name="conf-files-configure"
1.38 dillo 9177: id="conf-files-configure"></a>12.2.2. Telling the
1.47 ! reed 9178: software where configuration files are</h3>
1.35 jmmv 9179: </div>
9180: </div>
9181: </div>
9182:
9183: <p>Given that pkgsrc (and users!) expect configuration
9184: files to be in a known place, you need to teach each
1.36 wiz 9185: package where it shall install its files. In some cases
1.35 jmmv 9186: you will have to patch the package Makefiles to achieve
9187: it. If you are lucky, though, it may be as easy as
9188: passing an extra flag to the configuration script; this
1.47 ! reed 9189: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9190: <pre class="programlisting">
9191: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
9192: </pre>
9193:
9194: <p>Note that this specifies where the package has to
9195: <span class="emphasis"><em>look for</em></span> its
9196: configuration files, not where they will be originally
9197: installed (although the difference is never explicit,
9198: unfortunately).</p>
9199: </div>
9200:
9201: <div class="sect2" lang="en" xml:lang="en">
9202: <div class="titlepage">
9203: <div>
9204: <div>
9205: <h3 class="title"><a name="conf-files-patching"
1.38 dillo 9206: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9207: installations</h3>
9208: </div>
9209: </div>
9210: </div>
9211:
9212: <p>As said before, pkginstall automatically handles
9213: configuration files. This means that <span class=
9214: "strong"><strong>the packages themselves must not touch
1.45 wiz 9215: the contents of <code xmlns=
9216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9217: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9218: directly</strong></span>. Bad news is that many
9219: software installation scripts will, out of the box,
9220: mess with the contents of that directory. So what is
9221: the correct procedure to fix this issue?</p>
1.35 jmmv 9222:
9223: <p>You must teach the package (usually by manually
9224: patching it) to install any configuration files under
1.45 wiz 9225: the examples hierarchy, <code xmlns=
9226: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9227: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9228: the <code xmlns=
9229: "http://www.w3.org/TR/xhtml1/transitional" class=
9230: "filename">PLIST</code> registers them and the
9231: administrator always has the original copies
1.35 jmmv 9232: available.</p>
9233:
9234: <p>Once the required configuration files are in place
9235: (i.e., under the examples hierarchy), the pkginstall
9236: framework can use them as master copies during the
1.45 wiz 9237: package installation to update what is in <code xmlns=
9238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9239: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9240: the variables <code class="varname">CONF_FILES</code>
9241: and <code class="varname">CONF_FILES_PERMS</code> are
9242: used. Check out <a href="#files-outside-prefix" title=
1.38 dillo 9243: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9244: “File manipulation”</a> for information
9245: about their syntax and their purpose. Here is an
9246: example, taken from the <a xmlns=
9247: "http://www.w3.org/TR/xhtml1/transitional" href=
9248: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9249: target="_top"><code xmlns="" class=
9250: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9251: <pre class="programlisting">
9252: EGDIR= ${PREFIX}/share/doc/mutt/samples
9253: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
9254: </pre>
9255:
9256: <p>Note that the <code class="varname">EGDIR</code>
9257: variable is specific to that package and has no meaning
9258: outside it.</p>
9259: </div>
9260:
9261: <div class="sect2" lang="en" xml:lang="en">
9262: <div class="titlepage">
9263: <div>
9264: <div>
9265: <h3 class="title"><a name="conf-files-disable"
1.38 dillo 9266: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9267: handling of configuration files</h3>
9268: </div>
9269: </div>
9270: </div>
9271:
9272: <p>The automatic copying of config files can be toggled
9273: by setting the environment variable <code class=
9274: "varname">PKG_CONFIG</code> prior to package
9275: installation.</p>
9276: </div>
9277: </div>
9278:
9279: <div class="sect1" lang="en" xml:lang="en">
9280: <div class="titlepage">
9281: <div>
9282: <div>
9283: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9284: "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35 jmmv 9285: startup scripts</h2>
9286: </div>
9287: </div>
9288: </div>
9289:
9290: <p>System startup scripts are special files because they
9291: must be installed in a place known by the underlying OS,
9292: usually outside the installation prefix. Therefore, the
9293: same rules described in <a href=
9294: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9295: "12.1. Files and directories outside the installation prefix">
9296: Section 12.1, “Files and directories outside the
1.35 jmmv 9297: installation prefix”</a> apply, and the same
9298: solutions can be used. However, pkginstall provides a
1.36 wiz 9299: special mechanism to handle these files.</p>
1.35 jmmv 9300:
9301: <p>In order to provide system startup scripts, the
9302: package has to:</p>
9303:
9304: <div class="orderedlist">
9305: <ol type="1">
9306: <li>
1.45 wiz 9307: <p>Store the script inside <code xmlns=
9308: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9309: "filename">${FILESDIR}</code>, with the
9310: <code class="literal">.sh</code> suffix appended.
9311: Considering the <a xmlns=
9312: "http://www.w3.org/TR/xhtml1/transitional" href=
9313: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9314: target="_top"><code xmlns="" class=
9315: "filename">print/cups</code></a> package as an
9316: example, it has a <code xmlns=
9317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9318: "filename">cupsd.sh</code> in its files
9319: directory.</p>
9320: </li>
9321:
9322: <li>
9323: <p>Tell pkginstall to handle it, appending the name
9324: of the script, without its extension, to the
9325: <code class="varname">RCD_SCRIPTS</code> variable.
9326: Continuing the previous example:</p>
9327: <pre class="programlisting">
9328: RCD_SCRIPTS+= cupsd
9329: </pre>
9330: </li>
9331: </ol>
9332: </div>
9333:
9334: <p>Once this is done, pkginstall will do the following
9335: steps for each script in an automated fashion:</p>
9336:
9337: <div class="orderedlist">
9338: <ol type="1">
9339: <li>
9340: <p>Process the file found in the files directory
9341: applying all the substitutions described in the
1.45 wiz 9342: <code xmlns=
9343: "http://www.w3.org/TR/xhtml1/transitional" class=
9344: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9345: </li>
9346:
9347: <li>
9348: <p>Copy the script from the files directory to the
1.45 wiz 9349: examples hierarchy, <code xmlns=
9350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9351: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9352: Note that this master file must be explicitly
1.45 wiz 9353: registered in the <code xmlns=
9354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9355: "filename">PLIST</code>.</p>
9356: </li>
9357:
9358: <li>
9359: <p>Add code to the installation scripts to copy the
9360: startup script from the examples hierarchy into the
9361: system-wide startup scripts directory.</p>
9362: </li>
9363: </ol>
9364: </div>
9365:
9366: <div class="sect2" lang="en" xml:lang="en">
9367: <div class="titlepage">
9368: <div>
9369: <div>
9370: <h3 class="title"><a name="rcd-scripts-disable"
1.38 dillo 9371: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9372: handling of system startup scripts</h3>
9373: </div>
9374: </div>
9375: </div>
9376:
9377: <p>The automatic copying of config files can be toggled
9378: by setting the environment variable <code class=
9379: "varname">PKG_RCD_SCRIPTS</code> prior to package
9380: installation. Note that the scripts will be always
1.45 wiz 9381: copied inside the examples hierarchy, <code xmlns=
9382: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9383: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9384: matter what the value of this variable is.</p>
9385: </div>
9386: </div>
9387:
9388: <div class="sect1" lang="en" xml:lang="en">
9389: <div class="titlepage">
9390: <div>
9391: <div>
9392: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9393: "users-and-groups" id="users-and-groups"></a>12.4.
1.35 jmmv 9394: System users and groups</h2>
9395: </div>
9396: </div>
9397: </div>
9398:
9399: <p>If a package needs to create special users and/or
9400: groups during installation, it can do so by using the
9401: pkginstall framework.</p>
9402:
9403: <p>Users can be created by adding entries to the
9404: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9405: entry has the following syntax, which mimics <code xmlns=
9406: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9407: "filename">/etc/passwd</code>:</p>
9408: <pre class="programlisting">
9409: user:group[:[userid][:[descr][:[home][:shell]]]]
9410: </pre>
9411:
9412: <p>Only the user and group are required; everything else
9413: is optional, but the colons must be in the right places
9414: when specifying optional bits. By default, a new user
1.45 wiz 9415: will have home directory <code xmlns=
9416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9417: "filename">/nonexistent</code>, and login shell
1.45 wiz 9418: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9419: class="filename">/sbin/nologin</code> unless they are
9420: specified as part of the user element. Note that if the
9421: description contains spaces, then spaces should be double
9422: backslash-escaped, as in:</p>
1.35 jmmv 9423: <pre class="programlisting">
9424: foo:foogrp::The\\ Foomister
9425: </pre>
9426:
9427: <p>Similarly, groups can be created using the
9428: <code class="varname">PKG_GROUPS</code> variable, whose
9429: syntax is:</p>
9430: <pre class="programlisting">
9431: group[:groupid]
9432: </pre>
9433:
9434: <p>As before, only the group name is required; the
9435: numeric identifier is optional.</p>
9436: </div>
9437:
9438: <div class="sect1" lang="en" xml:lang="en">
9439: <div class="titlepage">
9440: <div>
9441: <div>
9442: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9443: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9444: </div>
9445: </div>
9446: </div>
9447:
9448: <p>Packages that install system shells should register
1.45 wiz 9449: them in the shell database, <code xmlns=
9450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9451: "filename">/etc/shells</code>, to make things easier to
9452: the administrator. This must be done from the
9453: installation scripts to keep binary packages working on
9454: any system. pkginstall provides an easy way to accomplish
9455: this task.</p>
9456:
9457: <p>When a package provides a shell interpreter, it has to
9458: set the <code class="varname">PKG_SHELL</code> variable
9459: to its absolute file name. This will add some hooks to
9460: the installation scripts to handle it. Consider the
9461: following example, taken from <a xmlns=
9462: "http://www.w3.org/TR/xhtml1/transitional" href=
9463: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9464: target="_top"><code xmlns="" class=
9465: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9466: <pre class="programlisting">
9467: USE_PKGINSTALL= YES
9468: PKG_SHELL= ${PREFIX}/bin/zsh
9469: </pre>
9470:
9471: <div class="sect2" lang="en" xml:lang="en">
9472: <div class="titlepage">
9473: <div>
9474: <div>
9475: <h3 class="title"><a name="shells-disable" id=
1.38 dillo 9476: "shells-disable"></a>12.5.1. Disabling handling
1.35 jmmv 9477: of configuration files</h3>
9478: </div>
9479: </div>
9480: </div>
9481:
9482: <p>The automatic registration of shell interpreters can
9483: be disabled by the administrator by setting the
1.45 wiz 9484: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9485: class="filename">PKG_REGISTER_SHELLS</code> environment
9486: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9487: </div>
9488: </div>
9489: </div>
9490:
9491: <div class="chapter" lang="en" xml:lang="en">
9492: <div class="titlepage">
9493: <div>
9494: <div>
9495: <h2 class="title"><a name="options" id=
1.38 dillo 9496: "options"></a>Chapter 13. Options
1.35 jmmv 9497: handling</h2>
9498: </div>
9499: </div>
9500: </div>
9501:
9502: <div class="toc">
9503: <p><b>Table of Contents</b></p>
9504:
9505: <dl>
9506: <dt><span class="sect1"><a href=
1.38 dillo 9507: "#global-default-options">13.1. Global default
1.35 jmmv 9508: options</a></span></dt>
9509:
9510: <dt><span class="sect1"><a href=
1.38 dillo 9511: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9512: use <code xmlns=
9513: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9514: "filename">bsd.options.mk</code></a></span></dt>
9515: </dl>
9516: </div>
9517:
9518: <p>Many packages have the ability to be built to support
1.45 wiz 9519: different sets of features. <code xmlns=
9520: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9521: "filename">bsd.options.mk</code> is a framework in pkgsrc
9522: that provides generic handling of those options that
9523: determine different ways in which the packages can be
9524: built. It's possible for the user to specify exactly which
9525: sets of options will be built into a package or to allow a
9526: set of global default options apply.</p>
9527:
9528: <div class="sect1" lang="en" xml:lang="en">
9529: <div class="titlepage">
9530: <div>
9531: <div>
9532: <h2 class="title" style="clear: both"><a name=
9533: "global-default-options" id=
1.38 dillo 9534: "global-default-options"></a>13.1. Global
1.35 jmmv 9535: default options</h2>
9536: </div>
9537: </div>
9538: </div>
9539:
9540: <p>Global default options are listed in <code class=
9541: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9542: the options that should be built into every package if
9543: that option is supported. This variable should be set in
1.45 wiz 9544: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9545: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9546: </div>
9547:
9548: <div class="sect1" lang="en" xml:lang="en">
9549: <div class="titlepage">
9550: <div>
9551: <div>
9552: <h2 class="title" style="clear: both"><a name=
9553: "converting-to-options" id=
1.38 dillo 9554: "converting-to-options"></a>13.2. Converting
1.45 wiz 9555: packages to use <code xmlns=
9556: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9557: "filename">bsd.options.mk</code></h2>
9558: </div>
9559: </div>
9560: </div>
9561:
1.45 wiz 9562: <p>The following example shows how <code xmlns=
9563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9564: "filename">bsd.options.mk</code> should be used by the
9565: hypothetical ``wibble'' package, either in the package
1.45 wiz 9566: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9567: class="filename">Makefile</code>, or in a file, e.g.
9568: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9569: class="filename">options.mk</code>, that is included by
9570: the main package <code xmlns=
9571: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9572: "filename">Makefile</code>.</p>
9573: <pre class="programlisting">
1.37 dillo 9574: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9575: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
1.47 ! reed 9576: PKG_OPTIONS_OPTIONAL_GROUPS= database
! 9577: PKG_OPTIONS_GROUP.database= mysql pgsql
1.37 dillo 9578: PKG_SUGGESTED_OPTIONS= wibble-foo
9579: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9580: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9581:
9582: .include "../../mk/bsd.prefs.mk"
9583:
9584: # this package was previously named wibble2
9585: .if defined(PKG_OPTIONS.wibble2)
9586: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.40 dillo 9587: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37 dillo 9588: .endif
1.35 jmmv 9589:
9590: .include "../../mk/bsd.options.mk"
9591:
9592: # Package-specific option-handling
9593:
9594: ###
1.37 dillo 9595: ### FOO support
9596: ###
9597: .if !empty(PKG_OPTIONS:Mwibble-foo)
9598: CONFIGURE_ARGS+= --enable-foo
9599: .endif
9600:
9601: ###
1.35 jmmv 9602: ### LDAP support
9603: ###
9604: .if !empty(PKG_OPTIONS:Mldap)
9605: . include "../../databases/openldap/buildlink3.mk"
1.37 dillo 9606: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35 jmmv 9607: .endif
1.1 grant 9608:
9609: ###
1.37 dillo 9610: ### database support
1.1 grant 9611: ###
1.37 dillo 9612: .if !empty(PKG_OPTIONS:Mmysql)
9613: . include "../../mk/mysql.buildlink3.mk"
9614: .endif
9615: .if !empty(PKG_OPTIONS:Mpgsql)
9616: . include "../../mk/pgsql.buildlink3.mk"
1.1 grant 9617: .endif
9618: </pre>
9619:
1.28 rillig 9620: <p>The first section contains the information about which
9621: build options are supported by the package, and any
1.1 grant 9622: default options settings if needed.</p>
9623:
9624: <div class="orderedlist">
9625: <ol type="1">
9626: <li>
1.14 xtraeme 9627: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9628: the name of the <a href=
1.1 grant 9629: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9630: <span class="citerefentry"><span class=
1.27 rillig 9631: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9632: that the user can set to override the default
9633: options. It should be set to “<span class=
9634: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9635: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9636: </li>
9637:
9638: <li>
1.14 xtraeme 9639: <p><code class=
9640: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9641: build options supported by the package.</p>
9642: </li>
9643:
9644: <li>
9645: <p><code class=
9646: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9647: list of names of groups of mutually exclusive
9648: options. The options in each group are listed in
9649: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9650: "replaceable"><code>groupname</code></em></code>.
9651: The most specific setting of any option from the
9652: group takes precedence over all other options in
9653: the group. Options from the groups will be
9654: automatically added to <code class=
9655: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9656: </li>
9657:
9658: <li>
9659: <p><code class=
9660: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9661: like <code class=
9662: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9663: building the packages will fail if no option from
9664: the group is selected.</p>
1.1 grant 9665: </li>
9666:
9667: <li>
1.27 rillig 9668: <p><code class=
1.44 gdt 9669: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9670: list of names of sets of options. At least one
9671: option from each set must be selected. The options
9672: in each set are listed in <code class=
9673: "varname">PKG_OPTIONS_SET.<em class=
9674: "replaceable"><code>setname</code></em></code>.
9675: Options from the sets will be automatically added
9676: to <code class=
9677: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9678: the package will fail if no option from the set is
9679: selected.</p>
9680: </li>
9681:
9682: <li>
9683: <p><code class=
1.27 rillig 9684: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9685: build options which are enabled by default.</p>
9686: </li>
9687:
9688: <li>
1.37 dillo 9689: <p><code class=
9690: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9691: of “<span class="quote"><em class=
9692: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
9693: <code>option</code></em></span>” pairs that
1.45 wiz 9694: map legacy <code xmlns=
9695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9696: "filename">/etc/mk.conf</code> variables to their
9697: option counterparts. Pairs should be added with
9698: “<span class="quote">+=</span>” to keep
9699: the listing of global legacy variables. A warning
9700: will be issued if the user uses a legacy
9701: variable.</p>
9702: </li>
1.1 grant 9703:
1.37 dillo 9704: <li>
9705: <p><code class=
9706: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9707: of “<span class="quote"><em class=
9708: "replaceable"><code>old-option</code></em>:<em class="replaceable">
9709: <code>new-option</code></em></span>” pairs
9710: that map options that have been renamed to their
9711: new counterparts. Pairs should be added with
9712: “<span class="quote">+=</span>” to keep
9713: the listing of global legacy options. A warning
9714: will be issued if the user uses a legacy
9715: option.</p>
9716: </li>
1.1 grant 9717:
1.37 dillo 9718: <li>
9719: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9720: is a list of options implied by deprecated
9721: variables used. This can be used for cases that
9722: neither <code class=
9723: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9724: <code class=
9725: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9726: handle, e. g. when <code class=
9727: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9728: </li>
9729:
9730: <li>
1.37 dillo 9731: <p><code class=
9732: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9733: a list of warnings about deprecated variables or
9734: options used, and what to use instead.</p>
1.1 grant 9735: </li>
1.28 rillig 9736: </ol>
1.1 grant 9737: </div>
9738:
1.37 dillo 9739: <p>A package should never modify <code class=
9740: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9741: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9742: These are strictly user-settable. To suggest a default
9743: set of options, use <code class=
9744: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9745:
1.42 dillo 9746: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 9747: defined before including <code xmlns=
9748: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9749: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9750: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9751: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9752: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 ! reed 9753: are defined (as can happen with platform-specific options
1.42 dillo 9754: if none of them is supported on the current platform),
9755: <code class="varname">PKG_OPTIONS</code> is set to the
9756: empty list and the package is otherwise treated as not
9757: using the options framework.</p>
1.37 dillo 9758:
1.45 wiz 9759: <p>After the inclusion of <code xmlns=
9760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9761: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9762: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9763: list of selected build options, properly filtered to
1.28 rillig 9764: remove unsupported and duplicate options.</p>
9765:
1.1 grant 9766: <p>The remaining sections contain the logic that is
1.37 dillo 9767: specific to each option. The correct way to check for an
9768: option is to check whether it is listed in <code class=
9769: "varname">PKG_OPTIONS</code>:</p>
9770: <pre class="programlisting">
9771: .if !empty(PKG_OPTIONS:M<em class=
9772: "replaceable"><code>option</code></em>)
9773: </pre>
9774:
9775: <p>If another package already has an option with the same
9776: meaning, use the same name. For options applicable to
9777: multiple packages (like enabling support for a library),
9778: use short option names (like the name of the library).
9779: For options specific to this package, prefix the name
9780: with <code class="varname"><em class=
9781: "replaceable"><code>pkgname</code></em>-</code>. Document
1.45 wiz 9782: the option and its meaning in <code xmlns=
9783: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9784: "filename">mk/defaults/options.description</code>.</p>
1.1 grant 9785: </div>
9786: </div>
9787:
9788: <div class="chapter" lang="en" xml:lang="en">
9789: <div class="titlepage">
9790: <div>
9791: <div>
9792: <h2 class="title"><a name="build" id=
1.38 dillo 9793: "build"></a>Chapter 14. The build
1.1 grant 9794: process</h2>
9795: </div>
9796: </div>
9797: </div>
9798:
9799: <div class="toc">
9800: <p><b>Table of Contents</b></p>
9801:
9802: <dl>
1.38 dillo 9803: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 9804: Program location</a></span></dt>
9805:
1.38 dillo 9806: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 9807: Main targets</a></span></dt>
1.1 grant 9808:
9809: <dt><span class="sect1"><a href=
1.38 dillo 9810: "#build.helpful-targets">14.3. Other helpful
1.1 grant 9811: targets</a></span></dt>
9812: </dl>
9813: </div>
9814:
9815: <p>The basic steps for building a program are always the
9816: same. First the program's source (<span class=
9817: "emphasis"><em>distfile</em></span>) must be brought to the
9818: local system and then extracted. After any patches to
9819: compile properly on NetBSD are applied, the software can be
9820: configured, then built (usually by compiling), and finally
9821: the generated binaries, etc. can be put into place on the
9822: system. These are exactly the steps performed by the NetBSD
9823: package system, which is implemented as a series of targets
1.45 wiz 9824: in a central Makefile, <code xmlns=
9825: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9826: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 9827:
9828: <div class="sect1" lang="en" xml:lang="en">
9829: <div class="titlepage">
9830: <div>
9831: <div>
9832: <h2 class="title" style="clear: both"><a name=
9833: "build.prefix" id=
1.38 dillo 9834: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9835: </div>
9836: </div>
9837: </div>
9838:
9839: <p>Before outlining the process performed by the NetBSD
9840: package system in the next section, here's a brief
9841: discussion on where programs are installed, and which
9842: variables influence this.</p>
9843:
1.14 xtraeme 9844: <p>The automatic variable <code class=
9845: "varname">PREFIX</code> indicates where all files of the
9846: final program shall be installed. It is usually set to
1.45 wiz 9847: <code class="varname">LOCALBASE</code> (<code xmlns=
9848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9849: "filename">/usr/pkg</code>), or <code class=
9850: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9851: “<span class="quote">cross</span>” category.
1.14 xtraeme 9852: The value of <code class="varname">PREFIX</code> needs to
9853: be put into the various places in the program's source
9854: where paths to these files are encoded. See <a href=
1.1 grant 9855: "#components.patches" title=
1.38 dillo 9856: "8.3. patches/*">Section 8.3,
1.1 grant 9857: “patches/*”</a> and <a href="#fixes.libtool"
9858: title=
1.38 dillo 9859: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9860: “Shared libraries - libtool”</a> for more
9861: details.</p>
9862:
9863: <p>When choosing which of these variables to use, follow
9864: the following rules:</p>
9865:
9866: <div class="itemizedlist">
9867: <ul type="disc">
9868: <li>
1.14 xtraeme 9869: <p><code class="varname">PREFIX</code> always
9870: points to the location where the current pkg will
9871: be installed. When referring to a pkg's own
1.1 grant 9872: installation path, use “<span class=
9873: "quote">${PREFIX}</span>”.</p>
9874: </li>
9875:
9876: <li>
1.14 xtraeme 9877: <p><code class="varname">LOCALBASE</code> is where
9878: all non-X11 pkgs are installed. If you need to
1.1 grant 9879: construct a -I or -L argument to the compiler to
9880: find includes and libraries installed by another
9881: non-X11 pkg, use “<span class=
9882: "quote">${LOCALBASE}</span>”.</p>
9883: </li>
9884:
9885: <li>
1.14 xtraeme 9886: <p><code class="varname">X11BASE</code> is where
9887: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9888: installed. When looking for <span class=
9889: "emphasis"><em>standard</em></span> X11 includes
9890: (not those installed by a pkg), use
9891: “<span class=
9892: "quote">${X11BASE}</span>”.</p>
9893: </li>
9894:
9895: <li>
1.47 ! reed 9896: <p>X11-based packages are special in that they may
! 9897: be installed in either <code class=
1.14 xtraeme 9898: "varname">X11BASE</code> or <code class=
9899: "varname">LOCALBASE</code>.</p>
1.1 grant 9900:
9901: <p>Usually, X11 packages should be installed under
1.14 xtraeme 9902: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 9903: possible. Note that you will need to include
1.45 wiz 9904: <code xmlns=
9905: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 9906: "filename">../../mk/x11.buildlink3.mk</code> in
9907: them to request the presence of X11 and to get the
9908: right compilation flags.</p>
1.1 grant 9909:
9910: <p>Even though, there are some packages that cannot
1.14 xtraeme 9911: be installed under <code class=
9912: "varname">LOCALBASE</code>: those that come with
1.1 grant 9913: app-defaults files. These packages are special and
1.14 xtraeme 9914: they must be placed under <code class=
9915: "varname">X11BASE</code>. To accomplish this, set
9916: either <code class="varname">USE_X11BASE</code> or
9917: <code class="varname">USE_IMAKE</code> in your
1.1 grant 9918: package.</p>
9919:
1.34 wiz 9920: <p>Some notes: If you need to find includes or
1.14 xtraeme 9921: libraries installed by a pkg that has <code class=
9922: "varname">USE_IMAKE</code> or <code class=
9923: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 9924: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9925: class="filename">Makefile</code>, you need to look
9926: in <span class="emphasis"><em>both</em></span>
9927: <code xmlns=
9928: "http://www.w3.org/TR/xhtml1/transitional" class=
9929: "filename">${X11BASE}</code> and <code xmlns=
9930: "http://www.w3.org/TR/xhtml1/transitional" class=
9931: "filename">${LOCALBASE}</code>. To force
9932: installation of all X11 packages in <code class=
9933: "varname">LOCALBASE</code>, the <a xmlns=
9934: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 9935: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 9936: target="_top"><code xmlns="" class=
9937: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 9938: enabled by default.</p>
1.1 grant 9939: </li>
9940:
9941: <li>
1.14 xtraeme 9942: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 9943: used to refer to the installed location of an X11
1.14 xtraeme 9944: package. <code class="varname">X11PREFIX</code>
9945: will be set to <code class="varname">X11BASE</code>
9946: if xpkgwedge is not installed, and to <code class=
9947: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 9948: installed.</p>
9949: </li>
9950:
9951: <li>
9952: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 9953: have some packages installed in <code class=
9954: "varname">X11BASE</code> and some in <code class=
9955: "varname">LOCALBASE</code>. To determine the prefix
9956: of an installed package, the <code class=
9957: "varname">EVAL_PREFIX</code> definition can be
9958: used. It takes pairs in the format
9959: “<span class=
1.1 grant 9960: "quote">DIRNAME=<package></span>”, and
1.24 wiz 9961: the <a href=
9962: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9963: <span class="citerefentry"><span class=
9964: "refentrytitle">make</span>(1)</span></a> variable
9965: <code class="varname">DIRNAME</code> will be set to
9966: the prefix of the installed package
9967: <package>, or “<span class=
1.1 grant 9968: "quote">${X11PREFIX}</span>” if the package
9969: is not installed.</p>
9970:
9971: <p>This is best illustrated by example.</p>
9972:
1.45 wiz 9973: <p>The following lines are taken from <code xmlns=
9974: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9975: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 9976: <pre class="programlisting">
1.14 xtraeme 9977: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 9978: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
9979: --with-gtk-prefix="${GTKDIR}" \
9980: --enable-multibyte
9981: </pre>
9982:
9983: <p>Specific defaults can be defined for the
1.14 xtraeme 9984: packages evaluated using <code class=
9985: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 9986: of the form:</p>
9987: <pre class="programlisting">
9988: GTKDIR_DEFAULT= ${LOCALBASE}
9989: </pre>
9990:
1.14 xtraeme 9991: <p>where <code class="varname">GTKDIR</code>
1.1 grant 9992: corresponds to the first definition in the
1.14 xtraeme 9993: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 9994: </li>
9995:
9996: <li>
1.45 wiz 9997: <p>Within <code xmlns=
9998: "http://www.w3.org/TR/xhtml1/transitional" class=
9999: "filename">${PREFIX}</code>, packages should
10000: install files according to <a href=
1.24 wiz 10001: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10002: <span class="citerefentry"><span class=
10003: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10004: exception that manual pages go into <code xmlns=
10005: "http://www.w3.org/TR/xhtml1/transitional" class=
10006: "filename">${PREFIX}/man</code>, not <code xmlns=
10007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10008: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10009: </li>
10010: </ul>
10011: </div>
10012: </div>
10013:
10014: <div class="sect1" lang="en" xml:lang="en">
10015: <div class="titlepage">
10016: <div>
10017: <div>
10018: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10019: "main-targets" id=
1.38 dillo 10020: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 10021: </div>
10022: </div>
10023: </div>
10024:
10025: <p>The main targets used during the build process defined
1.45 wiz 10026: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10027: class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 10028:
10029: <div class="variablelist">
10030: <dl>
10031: <dt><span class="term">fetch</span></dt>
10032:
10033: <dd>
10034: <p>This will check if the file(s) given in the
1.14 xtraeme 10035: variables <code class="varname">DISTFILES</code>
10036: and <code class="varname">PATCHFILES</code> (as
10037: defined in the package's Makefile) are present on
1.45 wiz 10038: the local system in <code xmlns=
10039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10040: "filename">/usr/pkgsrc/distfiles</code>. If they
10041: are not present, an attempt will be made to fetch
10042: them using commands of the form:</p>
1.1 grant 10043: <pre class="programlisting">
10044: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
10045: </pre>
10046:
10047: <p>where ${site} varies through several
1.14 xtraeme 10048: possibilities in turn: first, <code class=
10049: "varname">MASTER_SITE_OVERRIDE</code> is tried,
10050: then the sites specified in either <code class=
10051: "varname">SITES_file</code> if defined, else
10052: <code class="varname">MASTER_SITES</code> or
10053: <code class="varname">PATCH_SITES</code>, as
10054: applies, then finally the value of <code class=
10055: "varname">MASTER_SITE_BACKUP</code>. The order of
10056: all except the first can be optionally sorted by
10057: the user, via setting either <code class=
10058: "varname">MASTER_SORT_AWK</code> or <code class=
10059: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 10060: </dd>
10061:
10062: <dt><span class="term">checksum</span></dt>
10063:
10064: <dd>
10065: <p>After the distfile(s) are fetched, their
10066: checksum is generated and compared with the
10067: checksums stored in the distinfo file. If the
10068: checksums don't match, the build is aborted. This
10069: is to ensure the same distfile is used for
10070: building, and that the distfile wasn't changed,
10071: e.g. by some malign force, deliberately changed
10072: distfiles on the master distribution site or
10073: network lossage.</p>
10074: </dd>
10075:
10076: <dt><span class="term">extract</span></dt>
10077:
10078: <dd>
10079: <p>When the distfiles are present on the local
10080: system, they need to be extracted, as they are
10081: usually in the form of some compressed archive
1.45 wiz 10082: format, most commonly <code xmlns=
10083: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10084: "filename">.tar.gz</code>.</p>
1.1 grant 10085:
10086: <p>If only some of the distfiles need to be
10087: uncompressed, the files to be uncompressed should
1.14 xtraeme 10088: be put into <code class=
10089: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10090:
1.45 wiz 10091: <p>If the distfiles are not in <code xmlns=
10092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10093: "filename">.tar.gz</code> format, they can be
10094: extracted by setting either <code class=
10095: "varname">EXTRACT_SUFX</code>, or <code class=
10096: "varname">EXTRACT_CMD</code>, <code class=
10097: "varname">EXTRACT_BEFORE_ARGS</code> and
10098: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
10099: the former case, pkgsrc knows how to extract a
1.45 wiz 10100: number of suffixes (<code xmlns=
10101: "http://www.w3.org/TR/xhtml1/transitional" class=
10102: "filename">.tar.gz</code>, <code xmlns=
10103: "http://www.w3.org/TR/xhtml1/transitional" class=
10104: "filename">.tgz</code>, <code xmlns=
10105: "http://www.w3.org/TR/xhtml1/transitional" class=
10106: "filename">.tar.gz2</code>, <code xmlns=
10107: "http://www.w3.org/TR/xhtml1/transitional" class=
10108: "filename">.tbz</code>, <code xmlns=
10109: "http://www.w3.org/TR/xhtml1/transitional" class=
10110: "filename">.tar.Z</code>, <code xmlns=
10111: "http://www.w3.org/TR/xhtml1/transitional" class=
10112: "filename">.tar</code>, <code xmlns=
10113: "http://www.w3.org/TR/xhtml1/transitional" class=
10114: "filename">.shar.gz</code>, <code xmlns=
10115: "http://www.w3.org/TR/xhtml1/transitional" class=
10116: "filename">.shar.bz2</code>, <code xmlns=
10117: "http://www.w3.org/TR/xhtml1/transitional" class=
10118: "filename">.shar.Z</code>, <code xmlns=
10119: "http://www.w3.org/TR/xhtml1/transitional" class=
10120: "filename">.shar</code>, <code xmlns=
10121: "http://www.w3.org/TR/xhtml1/transitional" class=
10122: "filename">.Z</code>, <code xmlns=
10123: "http://www.w3.org/TR/xhtml1/transitional" class=
10124: "filename">.bz2</code> and <code xmlns=
10125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10126: "filename">.gz</code>; see the definition of the
10127: various <code class="varname">DECOMPRESS_CMD</code>
1.47 ! reed 10128: variables in <code xmlns=
1.45 wiz 10129: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 10130: "filename">bsd.pkg.extract.mk</code> for a complete
! 10131: list). Here's an example on how to use the other
! 10132: variables for a program that comes with a
! 10133: compressed shell archive whose name ends in
! 10134: <code xmlns=
1.45 wiz 10135: "http://www.w3.org/TR/xhtml1/transitional" class=
10136: "filename">.msg.gz</code>:</p>
1.1 grant 10137: <pre class="programlisting">
10138: EXTRACT_SUFX= .msg.gz
10139: EXTRACT_CMD= zcat
10140: EXTRACT_BEFORE_ARGS=
10141: EXTRACT_AFTER_ARGS= |sh
10142: </pre>
10143: </dd>
10144:
10145: <dt><span class="term">patch</span></dt>
10146:
10147: <dd>
10148: <p>After extraction, all the patches named by the
1.14 xtraeme 10149: <code class="varname">PATCHFILES</code>, those
10150: present in the patches subdirectory of the package
10151: as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45 wiz 10152: <code xmlns=
10153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10154: "filename">/usr/local/patches/graphics/png</code>)
1.45 wiz 10155: are applied. Patchfiles ending in <code xmlns=
10156: "http://www.w3.org/TR/xhtml1/transitional" class=
10157: "filename">.Z</code> or <code xmlns=
10158: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10159: "filename">.gz</code> are uncompressed before they
1.45 wiz 10160: are applied, files ending in <code xmlns=
10161: "http://www.w3.org/TR/xhtml1/transitional" class=
10162: "filename">.orig</code> or <code xmlns=
10163: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10164: "filename">.rej</code> are ignored. Any special
1.24 wiz 10165: options to <a href=
10166: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10167: <span class="citerefentry"><span class=
10168: "refentrytitle">patch</span>(1)</span></a> can be
10169: handed in <code class=
1.14 xtraeme 10170: "varname">PATCH_DIST_ARGS</code>. See <a href=
10171: "#components.patches" title=
1.38 dillo 10172: "8.3. patches/*">Section 8.3,
1.1 grant 10173: “patches/*”</a> for more details.</p>
10174:
1.24 wiz 10175: <p>By default <a href=
10176: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10177: <span class="citerefentry"><span class=
10178: "refentrytitle">patch</span>(1)</span></a> is given
10179: special args to make it fail if the patches apply
10180: with some lines of fuzz. Please fix (regen) the
10181: patches so that they apply cleanly. The rationale
10182: behind this is that patches that don't apply
10183: cleanly may end up being applied in the wrong
10184: place, and cause severe harm there.</p>
1.1 grant 10185: </dd>
10186:
10187: <dt><span class="term">configure</span></dt>
10188:
10189: <dd>
10190: <p>Most pieces of software need information on the
10191: header files, system calls, and library routines
10192: which are available in NetBSD. This is the process
10193: known as configuration, and is usually automated.
10194: In most cases, a script is supplied with the
10195: source, and its invocation results in generation of
10196: header files, Makefiles, etc.</p>
10197:
10198: <p>If the program's distfile contains its own
10199: configure script, this can be invoked by setting
1.14 xtraeme 10200: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 10201: configure script is a GNU autoconf script,
1.14 xtraeme 10202: <code class="varname">GNU_CONFIGURE</code> should
10203: be specified instead. In either case, any arguments
10204: to the configure script can be specified in the
10205: <code class="varname">CONFIGURE_ARGS</code>
10206: variable, and the configure script's name can be
10207: set in <code class=
10208: "varname">CONFIGURE_SCRIPT</code> if it differs
10209: from the default “<span class=
1.1 grant 10210: "quote">configure</span>”. Here's an example
10211: from the <a xmlns=
10212: "http://www.w3.org/TR/xhtml1/transitional" href=
10213: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45 wiz 10214: target="_top"><code xmlns="" class=
10215: "filename">sysutils/top</code></a> package:</p>
1.1 grant 10216: <pre class="programlisting">
10217: HAS_CONFIGURE= yes
10218: CONFIGURE_SCRIPT= Configure
10219: CONFIGURE_ARGS+= netbsd13
10220: </pre>
10221:
10222: <p>If the program uses an Imakefile for
10223: configuration, the appropriate steps can be invoked
1.14 xtraeme 10224: by setting <code class="varname">USE_IMAKE</code>
10225: to “<span class="quote">YES</span>”.
10226: (If you only want the package installed in
10227: <code class="varname">$X11PREFIX</code> but xmkmf
10228: not being run, set <code class=
10229: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 10230: </dd>
10231:
10232: <dt><span class="term">build</span></dt>
10233:
10234: <dd>
10235: <p>Once configuration has taken place, the software
1.14 xtraeme 10236: will be built by invoking <code class=
10237: "varname">$MAKE_PROGRAM</code> on <code class=
10238: "varname">$MAKEFILE</code> with <code class=
10239: "varname">$BUILD_TARGET</code> as the target to
10240: build. The default <code class=
10241: "varname">MAKE_PROGRAM</code> is
10242: “<span class="quote">gmake</span>” if
1.29 rillig 10243: <code class="varname">USE_TOOLS</code> contains
10244: “<span class="quote">gmake</span>”,
1.1 grant 10245: “<span class="quote">make</span>”
1.14 xtraeme 10246: otherwise. <code class="varname">MAKEFILE</code> is
10247: set to “<span class=
1.1 grant 10248: "quote">Makefile</span>” by default, and
1.14 xtraeme 10249: <code class="varname">BUILD_TARGET</code> defaults
10250: to “<span class="quote">all</span>”.
10251: Any of these variables can be set in the package's
1.1 grant 10252: Makefile to change the default build process.</p>
10253: </dd>
10254:
10255: <dt><span class="term">install</span></dt>
10256:
10257: <dd>
10258: <p>Once the build stage has completed, the final
10259: step is to install the software in public
10260: directories, so users can access the programs and
1.14 xtraeme 10261: files. As in the build-target, <code class=
10262: "varname">$MAKE_PROGRAM</code> is invoked on
10263: <code class="varname">$MAKEFILE</code> here, but
10264: with the <code class=
10265: "varname">$INSTALL_TARGET</code> instead, the
10266: latter defaulting to “<span class=
10267: "quote">install</span>” (plus
10268: “<span class=
10269: "quote">install.man</span>”, if <code class=
10270: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 10271: </dd>
10272: </dl>
10273: </div>
10274:
10275: <p>If no target is specified, the default is
10276: “<span class="quote">build</span>”. If a
10277: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 10278: e.g. <span><strong class="command">make
10279: build</strong></span> will also perform the equivalent
10280: of:</p>
1.1 grant 10281: <pre class="programlisting">
10282: make fetch
10283: make checksum
10284: make extract
10285: make patch
10286: make configure
10287: make build
10288: </pre>
10289: </div>
10290:
10291: <div class="sect1" lang="en" xml:lang="en">
10292: <div class="titlepage">
10293: <div>
10294: <div>
10295: <h2 class="title" style="clear: both"><a name=
10296: "build.helpful-targets" id=
1.38 dillo 10297: "build.helpful-targets"></a>14.3. Other
1.1 grant 10298: helpful targets</h2>
10299: </div>
10300: </div>
10301: </div>
10302:
10303: <div class="variablelist">
10304: <dl>
10305: <dt><span class="term">pre/post-*</span></dt>
10306:
10307: <dd>
10308: <p>For any of the main targets described in the
10309: previous section, two auxiliary targets exist with
10310: “<span class="quote">pre-</span>” and
10311: “<span class="quote">post-</span>” used
10312: as a prefix for the main target's name. These
10313: targets are invoked before and after the main
10314: target is called, allowing extra configuration or
10315: installation steps be performed from a package's
10316: Makefile, for example, which a program's configure
10317: script or install target omitted.</p>
10318: </dd>
10319:
10320: <dt><span class="term">do-*</span></dt>
10321:
10322: <dd>
10323: <p>Should one of the main targets do the wrong
10324: thing, and should there be no variable to fix this,
10325: you can redefine it with the do-* target. (Note
10326: that redefining the target itself instead of the
10327: do-* target is a bad idea, as the pre-* and post-*
10328: targets won't be called anymore, etc.) You will not
10329: usually need to do this.</p>
10330: </dd>
10331:
10332: <dt><span class="term">reinstall</span></dt>
10333:
10334: <dd>
1.14 xtraeme 10335: <p>If you did a <span><strong class="command">make
10336: install</strong></span> and you noticed some file
10337: was not installed properly, you can repeat the
1.1 grant 10338: installation with this target, which will ignore
10339: the “<span class="quote">already
10340: installed</span>” flag.</p>
10341: </dd>
10342:
10343: <dt><span class="term">deinstall</span></dt>
10344:
10345: <dd>
1.24 wiz 10346: <p>This target does a <a href=
10347: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10348: <span class="citerefentry"><span class=
10349: "refentrytitle">pkg_delete</span>(1)</span></a> in
10350: the current directory, effectively de-installing
10351: the package. The following variables can be used to
10352: tune the behaviour:</p>
1.1 grant 10353:
10354: <div class="variablelist">
10355: <dl>
1.14 xtraeme 10356: <dt><span class="term"><code class=
10357: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10358:
10359: <dd>
10360: <p>Add a "-v" to the <a href=
10361: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10362: <span class="citerefentry"><span class=
10363: "refentrytitle">pkg_delete</span>(1)</span></a>
10364: command.</p>
10365: </dd>
10366:
1.14 xtraeme 10367: <dt><span class="term"><code class=
10368: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10369:
10370: <dd>
10371: <p>Remove all packages that require (depend
10372: on) the given package. This can be used to
10373: remove any packages that may have been pulled
10374: in by a given package, e.g. if
1.14 xtraeme 10375: <span><strong class="command">make deinstall
10376: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10377: <code xmlns=
10378: "http://www.w3.org/TR/xhtml1/transitional"
10379: class="filename">pkgsrc/x11/kde</code>, this
10380: is likely to remove whole KDE. Works by
1.1 grant 10381: adding “<span class=
10382: "quote">-R</span>” to the <a href=
10383: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10384: <span class="citerefentry"><span class=
10385: "refentrytitle">pkg_delete</span>(1)</span></a>
10386: command line.</p>
10387: </dd>
10388: </dl>
10389: </div>
10390: </dd>
10391:
10392: <dt><span class="term">update</span></dt>
10393:
10394: <dd>
10395: <p>This target causes the current package to be
10396: updated to the latest version. The package and all
10397: depending packages first get de-installed, then
10398: current versions of the corresponding packages get
10399: compiled and installed. This is similar to manually
10400: noting which packages are currently installed, then
1.14 xtraeme 10401: performing a series of <span><strong class=
10402: "command">make deinstall</strong></span> and
10403: <span><strong class="command">make
10404: install</strong></span> (or whatever <code class=
10405: "varname">UPDATE_TARGET</code> is set to) for these
10406: packages.</p>
1.1 grant 10407:
10408: <p>You can use the “<span class=
10409: "quote">update</span>” target to resume
1.14 xtraeme 10410: package updating in case a previous
10411: <span><strong class="command">make
10412: update</strong></span> was interrupted for some
10413: reason. However, in this case, make sure you don't
10414: call <span><strong class="command">make
10415: clean</strong></span> or otherwise remove the list
10416: of dependent packages in <code class=
1.47 ! reed 10417: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 10418: ability to automatically update the current package
10419: along with the dependent packages you have
10420: installed.</p>
10421:
1.14 xtraeme 10422: <p>Resuming an interrupted <span><strong class=
10423: "command">make update</strong></span> will only
10424: work as long as the package tree remains unchanged.
10425: If the source code for one of the packages to be
10426: updated has been changed, resuming
10427: <span><strong class="command">make
10428: update</strong></span> will most certainly
10429: fail!</p>
1.1 grant 10430:
10431: <p>The following variables can be used either on
1.45 wiz 10432: the command line or in <code xmlns=
10433: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10434: "filename">/etc/mk.conf</code> to alter the
10435: behaviour of <span><strong class="command">make
10436: update</strong></span>:</p>
1.1 grant 10437:
10438: <div class="variablelist">
10439: <dl>
1.14 xtraeme 10440: <dt><span class="term"><code class=
10441: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10442:
10443: <dd>
10444: <p>Install target to recursively use for the
10445: updated package and the dependent packages.
1.14 xtraeme 10446: Defaults to <code class=
10447: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10448: “<span class=
10449: "quote">install</span>” otherwise for
1.14 xtraeme 10450: <span><strong class="command">make
10451: update</strong></span>. e.g.
10452: <span><strong class="command">make update
10453: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10454: </dd>
10455:
1.14 xtraeme 10456: <dt><span class="term"><code class=
10457: "varname">NOCLEAN</code></span></dt>
1.1 grant 10458:
10459: <dd>
10460: <p>Don't clean up after updating. Useful if
10461: you want to leave the work sources of the
10462: updated packages around for inspection or
10463: other purposes. Be sure you eventually clean
10464: up the source tree (see the
10465: “<span class=
10466: "quote">clean-update</span>” target
10467: below) or you may run into troubles with old
10468: source code still lying around on your next
1.14 xtraeme 10469: <span><strong class=
10470: "command">make</strong></span> or
10471: <span><strong class="command">make
10472: update</strong></span>.</p>
1.1 grant 10473: </dd>
10474:
1.14 xtraeme 10475: <dt><span class="term"><code class=
10476: "varname">REINSTALL</code></span></dt>
1.1 grant 10477:
10478: <dd>
10479: <p>Deinstall each package before installing
1.14 xtraeme 10480: (making <code class=
10481: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10482: necessary if the “<span class=
10483: "quote">clean-update</span>” target
10484: (see below) was called after interrupting a
1.14 xtraeme 10485: running <span><strong class="command">make
10486: update</strong></span>.</p>
1.1 grant 10487: </dd>
10488:
1.14 xtraeme 10489: <dt><span class="term"><code class=
10490: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10491:
10492: <dd>
10493: <p>Allows you to disable recursion and
10494: hardcode the target for packages. The default
10495: is “<span class=
10496: "quote">update</span>” for the update
10497: target, facilitating a recursive update of
1.14 xtraeme 10498: prerequisite packages. Only set <code class=
10499: "varname">DEPENDS_TARGET</code> if you want
10500: to disable recursive updates. Use
10501: <code class="varname">UPDATE_TARGET</code>
10502: instead to just set a specific target for
10503: each package to be installed during
10504: <span><strong class="command">make
10505: update</strong></span> (see above).</p>
1.1 grant 10506: </dd>
10507: </dl>
10508: </div>
10509: </dd>
10510:
10511: <dt><span class="term">clean-update</span></dt>
10512:
10513: <dd>
10514: <p>Clean the source tree for all packages that
1.14 xtraeme 10515: would get updated if <span><strong class=
10516: "command">make update</strong></span> was called
10517: from the current directory. This target should not
10518: be used if the current package (or any of its
10519: depending packages) have already been de-installed
10520: (e.g., after calling <span><strong class=
10521: "command">make update</strong></span>) or you may
10522: lose some packages you intended to update. As a
10523: rule of thumb: only use this target <span class=
10524: "emphasis"><em>before</em></span> the first time
10525: you run <span><strong class="command">make
10526: update</strong></span> and only if you have a dirty
10527: package tree (e.g., if you used <code class=
10528: "varname">NOCLEAN</code>).</p>
1.1 grant 10529:
1.47 ! reed 10530: <p>If you are unsure about whether your tree is
! 10531: clean, you can either perform a
1.14 xtraeme 10532: <span><strong class="command">make
1.47 ! reed 10533: clean</strong></span> at the top of the tree, or
! 10534: use the following sequence of commands from the
! 10535: directory of the package you want to update
! 10536: (<span class="emphasis"><em>before</em></span>
! 10537: running <span><strong class="command">make
1.14 xtraeme 10538: update</strong></span> for the first time,
10539: otherwise you lose all the packages you wanted to
10540: update!):</p>
1.1 grant 10541: <pre class="screen">
1.14 xtraeme 10542: <code class="prompt">#</code> <strong class=
10543: "userinput"><code>make clean-update</code></strong>
10544: <code class="prompt">#</code> <strong class=
10545: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
10546: <code class="prompt">#</code> <strong class=
10547: "userinput"><code>make update</code></strong>
1.1 grant 10548: </pre>
10549:
10550: <p>The following variables can be used either on
1.45 wiz 10551: the command line or in <code xmlns=
10552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10553: "filename">/etc/mk.conf</code> to alter the
10554: behaviour of <span><strong class="command">make
10555: clean-update</strong></span>:</p>
1.1 grant 10556:
10557: <div class="variablelist">
10558: <dl>
1.14 xtraeme 10559: <dt><span class="term"><code class=
10560: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 10561:
10562: <dd>
1.14 xtraeme 10563: <p>After <span><strong class="command">make
10564: clean</strong></span>, do not reconstruct the
10565: list of directories to update for this
10566: package. Only use this if
10567: <span><strong class="command">make
10568: update</strong></span> successfully installed
10569: all packages you wanted to update. Normally,
10570: this is done automatically on
10571: <span><strong class="command">make
10572: update</strong></span>, but may have been
10573: suppressed by the <code class=
10574: "varname">NOCLEAN</code> variable (see
1.1 grant 10575: above).</p>
10576: </dd>
10577: </dl>
10578: </div>
10579: </dd>
10580:
10581: <dt><span class="term">info</span></dt>
10582:
10583: <dd>
10584: <p>This target invokes <a href=
10585: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10586: <span class="citerefentry"><span class=
10587: "refentrytitle">pkg_info</span>(1)</span></a> for
10588: the current package. You can use this to check
10589: which version of a package is installed.</p>
10590: </dd>
10591:
10592: <dt><span class="term">readme</span></dt>
10593:
10594: <dd>
1.45 wiz 10595: <p>This target generates a <code xmlns=
10596: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10597: "filename">README.html</code> file, which can be
1.1 grant 10598: viewed using a browser such as <a xmlns=
10599: "http://www.w3.org/TR/xhtml1/transitional" href=
10600: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 10601: target="_top"><code xmlns="" class=
10602: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 10603: "http://www.w3.org/TR/xhtml1/transitional" href=
10604: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 10605: target="_top"><code xmlns="" class=
10606: "filename">www/links</code></a>. The generated
10607: files contain references to any packages which are
10608: in the <code class="varname">PACKAGES</code>
10609: directory on the local host. The generated files
10610: can be made to refer to URLs based on <code class=
1.20 ben 10611: "varname">FTP_PKG_URL_HOST</code> and <code class=
10612: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 10613: wanted to generate <code xmlns=
10614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10615: "filename">README.html</code> files which pointed
10616: to binary packages on the local machine, in the
1.45 wiz 10617: directory <code xmlns=
10618: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10619: "filename">/usr/packages</code>, set <code class=
10620: "varname">FTP_PKG_URL_HOST=file://localhost</code>
10621: and <code class=
10622: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
10623: <code class="varname">${PACKAGES}</code> directory
10624: and its subdirectories will be searched for all the
10625: binary packages.</p>
1.1 grant 10626: </dd>
10627:
10628: <dt><span class="term">readme-all</span></dt>
10629:
10630: <dd>
1.45 wiz 10631: <p>Use this target to create a file <code xmlns=
10632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10633: "filename">README-all.html</code> which contains a
1.1 grant 10634: list of all packages currently available in the
10635: NetBSD Packages Collection, together with the
10636: category they belong to and a short description.
1.45 wiz 10637: This file is compiled from the <code xmlns=
10638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10639: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 10640: sure to run this <span class=
1.14 xtraeme 10641: "emphasis"><em>after</em></span> a
10642: <span><strong class="command">make
10643: readme</strong></span>.</p>
1.1 grant 10644: </dd>
10645:
10646: <dt><span class="term">cdrom-readme</span></dt>
10647:
10648: <dd>
10649: <p>This is very much the same as the
10650: “<span class="quote">readme</span>”
10651: target (see above), but is to be used when
10652: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 10653: This target also produces <code xmlns=
10654: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10655: "filename">README.html</code> files, and can be
10656: made to refer to URLs based on <code class=
10657: "varname">CDROM_PKG_URL_HOST</code> and
10658: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 10659: </dd>
10660:
10661: <dt><span class="term">show-distfiles</span></dt>
10662:
10663: <dd>
10664: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 10665: are needed to build the package. (<code class=
10666: "varname">DISTFILES</code> and <code class=
1.45 wiz 10667: "varname">PATCHFILES</code>, but not <code xmlns=
10668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10669: "filename">patches/*</code>)</p>
1.1 grant 10670: </dd>
10671:
10672: <dt><span class="term">show-downlevel</span></dt>
10673:
10674: <dd>
10675: <p>This target shows nothing if the package is not
10676: installed. If a version of this package is
10677: installed, but is not the version provided in this
10678: version of pkgsrc, then a warning message is
10679: displayed. This target can be used to show which of
10680: your installed packages are downlevel, and so the
10681: old versions can be deleted, and the current ones
10682: added.</p>
10683: </dd>
10684:
10685: <dt><span class="term">show-pkgsrc-dir</span></dt>
10686:
10687: <dd>
10688: <p>This target shows the directory in the pkgsrc
10689: hierarchy from which the package can be built and
10690: installed. This may not be the same directory as
10691: the one from which the package was installed. This
10692: target is intended to be used by people who may
10693: wish to upgrade many packages on a single host, and
10694: can be invoked from the top-level pkgsrc Makefile
10695: by using the “<span class=
10696: "quote">show-host-specific-pkgs</span>”
10697: target.</p>
10698: </dd>
10699:
10700: <dt><span class=
10701: "term">show-installed-depends</span></dt>
10702:
10703: <dd>
10704: <p>This target shows which installed packages match
1.14 xtraeme 10705: the current package's <code class=
10706: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 10707: dependencies are causing build problems.</p>
10708: </dd>
10709:
10710: <dt><span class="term">check-shlibs</span></dt>
10711:
10712: <dd>
10713: <p>After a package is installed, check all its
10714: binaries and (on ELF platforms) shared libraries to
10715: see if they find the shared libs they need. Run by
1.14 xtraeme 10716: default if <code class=
10717: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 10718: <code xmlns=
10719: "http://www.w3.org/TR/xhtml1/transitional" class=
10720: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10721: </dd>
10722:
10723: <dt><span class="term">print-PLIST</span></dt>
10724:
10725: <dd>
10726: <p>After a “<span class="quote">make
10727: install</span>” from a new or upgraded pkg,
10728: this prints out an attempt to generate a new
1.45 wiz 10729: <code xmlns=
10730: "http://www.w3.org/TR/xhtml1/transitional" class=
10731: "filename">PLIST</code> from a <span><strong class=
10732: "command">find -newer
1.14 xtraeme 10733: work/.extract_done</strong></span>. An attempt is
10734: made to care for shared libs etc., but it is
1.1 grant 10735: <span class="emphasis"><em>strongly</em></span>
10736: recommended to review the result before putting it
1.45 wiz 10737: into <code xmlns=
10738: "http://www.w3.org/TR/xhtml1/transitional" class=
10739: "filename">PLIST</code>. On upgrades, it's useful
10740: to diff the output of this command against an
10741: already existing <code xmlns=
10742: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10743: "filename">PLIST</code> file.</p>
1.1 grant 10744:
1.24 wiz 10745: <p>If the package installs files via <a href=
10746: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
10747: <span class="citerefentry"><span class=
10748: "refentrytitle">tar</span>(1)</span></a> or other
10749: methods that don't update file access times, be
10750: sure to add these files manually to your
1.45 wiz 10751: <code xmlns=
10752: "http://www.w3.org/TR/xhtml1/transitional" class=
10753: "filename">PLIST</code>, as the “<span class=
10754: "quote">find -newer</span>” command used by
10755: this target won't catch them!</p>
1.1 grant 10756:
10757: <p>See <a href="#print-PLIST" title=
1.38 dillo 10758: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 10759: “Tweaking output of <span><strong class=
10760: "command">make
10761: print-PLIST</strong></span>”</a> for more
10762: information on this target.</p>
1.1 grant 10763: </dd>
10764:
10765: <dt><span class="term">bulk-package</span></dt>
10766:
10767: <dd>
10768: <p>Used to do bulk builds. If an appropriate binary
10769: package already exists, no action is taken. If not,
10770: this target will compile, install and package it
1.47 ! reed 10771: (and its depends, if <code class=
1.14 xtraeme 10772: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 10773: <a href="#binary.configuration" title=
1.38 dillo 10774: "6.3.1. Configuration">Section 6.3.1,
1.47 ! reed 10775: “Configuration”</a>). After creating
! 10776: the binary package, the sources, the just-installed
! 10777: package and its required packages are removed,
1.1 grant 10778: preserving free disk space.</p>
10779:
10780: <p><span class="emphasis"><em>Beware that this
10781: target may deinstall all packages installed on a
10782: system!</em></span></p>
10783: </dd>
10784:
10785: <dt><span class="term">bulk-install</span></dt>
10786:
10787: <dd>
10788: <p>Used during bulk-installs to install required
1.47 ! reed 10789: packages. If an up-to-date binary package is
1.1 grant 10790: available, it will be installed via <a href=
10791: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10792: <span class="citerefentry"><span class=
10793: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 10794: not, <span><strong class="command">make
10795: bulk-package</strong></span> will be executed, but
1.47 ! reed 10796: the installed binary won't be removed.</p>
1.1 grant 10797:
10798: <p>A binary package is considered
1.47 ! reed 10799: “<span class="quote">up-to-date</span>”
1.1 grant 10800: to be installed via <a href=
10801: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10802: <span class="citerefentry"><span class=
10803: "refentrytitle">pkg_add</span>(1)</span></a>
10804: if:</p>
10805:
10806: <div class="itemizedlist">
10807: <ul type="disc">
10808: <li>
1.45 wiz 10809: <p>None of the package's files (<code xmlns=
10810: "http://www.w3.org/TR/xhtml1/transitional"
10811: class="filename">Makefile</code>, ...) were
1.14 xtraeme 10812: modified since it was built.</p>
1.1 grant 10813: </li>
10814:
10815: <li>
10816: <p>None of the package's required (binary)
10817: packages were modified since it was
10818: built.</p>
10819: </li>
10820: </ul>
10821: </div>
10822:
10823: <p><span class="emphasis"><em>Beware that this
10824: target may deinstall all packages installed on a
10825: system!</em></span></p>
10826: </dd>
10827: </dl>
10828: </div>
10829: </div>
10830: </div>
10831:
10832: <div class="chapter" lang="en" xml:lang="en">
10833: <div class="titlepage">
10834: <div>
10835: <div>
10836: <h2 class="title"><a name="fixes" id=
1.38 dillo 10837: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 10838: packages</h2>
10839: </div>
10840: </div>
10841: </div>
10842:
10843: <div class="toc">
10844: <p><b>Table of Contents</b></p>
10845:
10846: <dl>
1.30 wiz 10847: <dt><span class="sect1"><a href=
1.38 dillo 10848: "#general-operation">15.1. General
1.30 wiz 10849: operation</a></span></dt>
1.1 grant 10850:
10851: <dd>
10852: <dl>
10853: <dt><span class="sect2"><a href=
1.38 dillo 10854: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 10855: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 10856:
10857: <dt><span class="sect2"><a href=
1.38 dillo 10858: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 10859: install documentation</a></span></dt>
10860:
10861: <dt><span class="sect2"><a href=
1.38 dillo 10862: "#restricted-packages">15.1.3. Restricted
1.1 grant 10863: packages</a></span></dt>
10864:
10865: <dt><span class="sect2"><a href=
1.38 dillo 10866: "#dependencies">15.1.4. Handling
1.1 grant 10867: dependencies</a></span></dt>
10868:
10869: <dt><span class="sect2"><a href=
1.38 dillo 10870: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 10871: packages</a></span></dt>
10872:
10873: <dt><span class="sect2"><a href=
1.38 dillo 10874: "#not-building-packages">15.1.6. Packages that
1.30 wiz 10875: cannot or should not be built</a></span></dt>
1.1 grant 10876:
10877: <dt><span class="sect2"><a href=
1.38 dillo 10878: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 10879: should not be deleted, once
10880: installed</a></span></dt>
1.1 grant 10881:
10882: <dt><span class="sect2"><a href=
1.38 dillo 10883: "#security-handling">15.1.8. Handling packages with
1.1 grant 10884: security problems</a></span></dt>
10885:
10886: <dt><span class="sect2"><a href=
1.38 dillo 10887: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 10888: bugs</a></span></dt>
10889:
10890: <dt><span class="sect2"><a href=
1.38 dillo 10891: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10892: incrementing versions when fixing an existing
1.1 grant 10893: package</a></span></dt>
10894:
10895: <dt><span class="sect2"><a href=
1.38 dillo 10896: "#portability-of-packages">15.1.11. Portability of
1.1 grant 10897: packages</a></span></dt>
10898: </dl>
10899: </dd>
10900:
1.30 wiz 10901: <dt><span class="sect1"><a href=
1.38 dillo 10902: "#downloading-issues">15.2. Possible downloading
1.30 wiz 10903: issues</a></span></dt>
1.1 grant 10904:
10905: <dd>
10906: <dl>
10907: <dt><span class="sect2"><a href=
1.38 dillo 10908: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 10909: distfiles aren't available for plain
1.1 grant 10910: downloading</a></span></dt>
10911:
10912: <dt><span class="sect2"><a href=
1.38 dillo 10913: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 10914: handle modified distfiles with the 'old'
10915: name</a></span></dt>
1.1 grant 10916: </dl>
10917: </dd>
10918:
1.30 wiz 10919: <dt><span class="sect1"><a href=
1.38 dillo 10920: "#configuration-gotchas">15.3. Configuration
1.30 wiz 10921: gotchas</a></span></dt>
1.1 grant 10922:
10923: <dd>
10924: <dl>
10925: <dt><span class="sect2"><a href=
1.38 dillo 10926: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 10927: libtool</a></span></dt>
10928:
10929: <dt><span class="sect2"><a href=
1.38 dillo 10930: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 10931: packages that already support
10932: libtool</a></span></dt>
1.1 grant 10933:
10934: <dt><span class="sect2"><a href=
1.38 dillo 10935: "#autoconf-automake">15.3.3. GNU
1.1 grant 10936: Autoconf/Automake</a></span></dt>
10937: </dl>
10938: </dd>
10939:
1.30 wiz 10940: <dt><span class="sect1"><a href=
1.38 dillo 10941: "#building-considerations">15.4. Building
1.30 wiz 10942: considerations</a></span></dt>
1.1 grant 10943:
10944: <dd>
10945: <dl>
10946: <dt><span class="sect2"><a href=
1.38 dillo 10947: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1 grant 10948: </dl>
10949: </dd>
10950:
1.30 wiz 10951: <dt><span class="sect1"><a href=
1.38 dillo 10952: "#package-specific-actions">15.5. Package specific
1.30 wiz 10953: actions</a></span></dt>
1.1 grant 10954:
10955: <dd>
10956: <dl>
10957: <dt><span class="sect2"><a href=
1.38 dillo 10958: "#user-interaction">15.5.1. User
1.2 hubertf 10959: interaction</a></span></dt>
1.1 grant 10960:
10961: <dt><span class="sect2"><a href=
1.38 dillo 10962: "#handling-licenses">15.5.2. Handling
1.1 grant 10963: licenses</a></span></dt>
10964:
10965: <dt><span class="sect2"><a href=
1.38 dillo 10966: "#installing-score-files">15.5.3. Installing score
1.1 grant 10967: files</a></span></dt>
10968:
10969: <dt><span class="sect2"><a href=
1.38 dillo 10970: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 10971: scripts</a></span></dt>
10972:
10973: <dt><span class="sect2"><a href=
1.38 dillo 10974: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 10975: paths to other interpreters</a></span></dt>
1.1 grant 10976:
10977: <dt><span class="sect2"><a href=
1.38 dillo 10978: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 10979: modules</a></span></dt>
10980:
10981: <dt><span class="sect2"><a href=
1.38 dillo 10982: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 10983: files</a></span></dt>
10984:
10985: <dt><span class="sect2"><a href=
1.38 dillo 10986: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 10987: GConf2 data files</a></span></dt>
1.1 grant 10988:
10989: <dt><span class="sect2"><a href=
1.38 dillo 10990: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 10991: installing scrollkeeper data files</a></span></dt>
1.1 grant 10992:
10993: <dt><span class="sect2"><a href=
1.38 dillo 10994: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 10995: fonts</a></span></dt>
10996:
10997: <dt><span class="sect2"><a href=
1.38 dillo 10998: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 10999: modules</a></span></dt>
11000:
11001: <dt><span class="sect2"><a href=
1.38 dillo 11002: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 11003: or XML data</a></span></dt>
1.1 grant 11004:
11005: <dt><span class="sect2"><a href=
1.38 dillo 11006: "#mime-database">15.5.13. Packages installing
1.1 grant 11007: extensions to the MIME database</a></span></dt>
11008:
11009: <dt><span class="sect2"><a href=
1.38 dillo 11010: "#intltool">15.5.14. Packages using
1.1 grant 11011: intltool</a></span></dt>
1.18 xtraeme 11012:
11013: <dt><span class="sect2"><a href=
1.38 dillo 11014: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 11015: startup scripts</a></span></dt>
1.1 grant 11016: </dl>
11017: </dd>
11018:
1.30 wiz 11019: <dt><span class="sect1"><a href=
1.38 dillo 11020: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11021: author</a></span></dt>
1.1 grant 11022: </dl>
11023: </div>
11024:
11025: <div class="sect1" lang="en" xml:lang="en">
11026: <div class="titlepage">
11027: <div>
11028: <div>
11029: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11030: "general-operation" id=
1.38 dillo 11031: "general-operation"></a>15.1. General
1.1 grant 11032: operation</h2>
11033: </div>
11034: </div>
11035: </div>
11036:
11037: <div class="sect2" lang="en" xml:lang="en">
11038: <div class="titlepage">
11039: <div>
11040: <div>
1.30 wiz 11041: <h3 class="title"><a name=
11042: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11043: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11044: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11045: </div>
11046: </div>
11047: </div>
11048:
11049: <p>The problem with package-defined variables that can
1.14 xtraeme 11050: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11051: or <code xmlns=
11052: "http://www.w3.org/TR/xhtml1/transitional" class=
11053: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11054: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11055: <span class="citerefentry"><span class=
11056: "refentrytitle">make</span>(1)</span></a> expands a
1.47 ! reed 11057: variable as it is used, but evaluates preprocessor-like
1.1 grant 11058: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11059: So, to use any variable (which may be set in
1.45 wiz 11060: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11061: class="filename">/etc/mk.conf</code>) in one of the
11062: .if* statements, the file <code xmlns=
11063: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11064: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11065: that .if* statement.</p>
11066:
1.47 ! reed 11067: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11068: including <code xmlns=
11069: "http://www.w3.org/TR/xhtml1/transitional" class=
11070: "filename">/etc/mk.conf</code>, should it exist, or
11071: <code class="varname">MAKECONF</code>, should it exist,
11072: include the <code xmlns=
11073: "http://www.w3.org/TR/xhtml1/transitional" class=
11074: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11075: package Makefile before any preprocessor-like .if,
11076: .ifdef, or .ifndef statements:</p>
1.1 grant 11077: <pre class="programlisting">
11078: .include "../../mk/bsd.prefs.mk"
11079:
11080: .if defined(USE_MENUS)
11081: ...
11082: .endif
11083: </pre>
11084:
1.14 xtraeme 11085: <p>If you wish to set the <code class=
1.45 wiz 11086: "varname">CFLAGS</code> variable in <code xmlns=
11087: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 11088: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11089: use:</p>
11090: <pre class="programlisting">
11091: CFLAGS+= -your -flags
11092: </pre>
11093:
1.14 xtraeme 11094: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11095: without the “<span class="quote">+</span>”)
11096: may lead to problems with packages that need to add
11097: their own flags. Also, you may want to take a look at
11098: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11099: href=
11100: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11101: target="_top"><code xmlns="" class=
11102: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11103: interested in optimization for the current CPU.</p>
1.1 grant 11104: </div>
11105:
11106: <div class="sect2" lang="en" xml:lang="en">
11107: <div class="titlepage">
11108: <div>
11109: <div>
1.31 wiz 11110: <h3 class="title"><a name=
11111: "where-to-install-documentation" id=
1.38 dillo 11112: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11113: to install documentation</h3>
11114: </div>
11115: </div>
11116: </div>
11117:
1.45 wiz 11118: <p>Documentation should be installed into <code xmlns=
11119: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11120: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11121: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11122: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11123: (the latter includes the version number of the
11124: package).</p>
1.31 wiz 11125: </div>
11126:
11127: <div class="sect2" lang="en" xml:lang="en">
11128: <div class="titlepage">
11129: <div>
11130: <div>
1.30 wiz 11131: <h3 class="title"><a name="restricted-packages"
11132: id=
1.38 dillo 11133: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11134: packages</h3>
11135: </div>
11136: </div>
11137: </div>
11138:
11139: <p>Some licenses restrict how software may be
11140: re-distributed. In order to satisfy these restrictions,
11141: the package system defines five make variables that can
11142: be set to note these restrictions:</p>
11143:
11144: <div class="itemizedlist">
11145: <ul type="disc">
11146: <li>
1.14 xtraeme 11147: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11148:
11149: <p>This variable should be set whenever a
11150: restriction exists (regardless of its kind). Set
11151: this variable to a string containing the reason
11152: for the restriction.</p>
11153: </li>
11154:
11155: <li>
1.14 xtraeme 11156: <p><code class=
11157: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11158:
11159: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11160: variable to <code class=
11161: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11162: package may not be included on a CD-ROM.</p>
11163: </li>
11164:
11165: <li>
1.14 xtraeme 11166: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11167:
11168: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11169: Set this variable to <code class=
11170: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11171: package may not not be made available on the
11172: Internet.</p>
11173: </li>
11174:
11175: <li>
1.14 xtraeme 11176: <p><code class=
11177: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11178:
11179: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11180: this variable to <code class=
11181: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11182: of the source code or other distfile(s) is not
11183: allowed on CD-ROMs.</p>
11184: </li>
11185:
11186: <li>
1.14 xtraeme 11187: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11188:
11189: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11190: variable to <code class=
11191: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11192: of the source code or other distfile(s) via the
11193: Internet is not allowed.</p>
11194: </li>
11195: </ul>
11196: </div>
11197:
1.14 xtraeme 11198: <p>Please note that the use of <code class=
11199: "varname">NO_PACKAGE</code>, <code class=
11200: "varname">IGNORE</code>, <code class=
11201: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11202: variables to denote restrictions is deprecated, because
11203: they unconditionally prevent users from generating
11204: binary packages!</p>
11205: </div>
11206:
11207: <div class="sect2" lang="en" xml:lang="en">
11208: <div class="titlepage">
11209: <div>
11210: <div>
11211: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11212: "dependencies"></a>15.1.4. Handling
1.1 grant 11213: dependencies</h3>
11214: </div>
11215: </div>
11216: </div>
11217:
11218: <p>Your package may depend on some other package being
11219: present - and there are various ways of expressing this
1.14 xtraeme 11220: dependency. pkgsrc supports the <code class=
11221: "varname">BUILD_DEPENDS</code> and <code class=
1.47 ! reed 11222: "varname">DEPENDS</code> definitions, the <code class=
! 11223: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11224: dependencies via <code xmlns=
11225: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11226: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11227: way to handle dependencies, and which uses the
11228: variables named above. See <a href="#buildlink" title=
1.38 dillo 11229: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11230: <i>Buildlink methodology</i></a> for more
11231: information.</p>
11232:
11233: <p>The basic difference between the two variables is as
1.14 xtraeme 11234: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11235: definition registers that pre-requisite in the binary
11236: package so it will be pulled in when the binary package
1.14 xtraeme 11237: is later installed, whilst the <code class=
11238: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11239: marking a dependency that is only needed for building
11240: the package.</p>
11241:
11242: <p>This means that if you only need a package present
11243: whilst you are building, it should be noted as a
1.14 xtraeme 11244: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11245:
1.14 xtraeme 11246: <p>The format for a <code class=
11247: "varname">BUILD_DEPENDS</code> and a <code class=
11248: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11249: <pre class="programlisting">
11250: <pre-req-package-name>:../../<category>/<pre-req-package>
11251: </pre>
11252:
11253: <p>Please note that the “<span class=
11254: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11255: any of the wildcard version numbers recognized by
1.1 grant 11256: <a href=
11257: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11258: <span class="citerefentry"><span class=
11259: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11260:
11261: <div class="orderedlist">
11262: <ol type="1">
11263: <li>
11264: <p>If your package needs another package's
11265: binaries or libraries to build or run, and if
1.45 wiz 11266: that package has a <code xmlns=
11267: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11268: "filename">buildlink3.mk</code> file available,
11269: use it:</p>
1.1 grant 11270: <pre class="programlisting">
11271: .include "../../graphics/jpeg/buildlink3.mk"
11272:
11273: </pre>
11274: </li>
11275:
11276: <li>
11277: <p>If your package needs to use another package
1.45 wiz 11278: to build itself and there is no <code xmlns=
11279: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11280: "filename">buildlink3.mk</code> file available,
11281: use the <code class=
11282: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11283: <pre class="programlisting">
11284: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
11285: </pre>
11286: </li>
11287:
11288: <li>
11289: <p>If your package needs a library with which to
1.45 wiz 11290: link and again there is no <code xmlns=
11291: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11292: "filename">buildlink3.mk</code> file available,
11293: this is specified using the <code class=
11294: "varname">DEPENDS</code> definition. An example
11295: of this is the <a xmlns=
1.1 grant 11296: "http://www.w3.org/TR/xhtml1/transitional" href=
11297: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11298: target="_top"><code xmlns="" class=
11299: "filename">print/lyx</code></a> package, which
11300: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11301: <pre class="programlisting">
11302: DEPENDS+= xpm-3.4j:../../graphics/xpm
11303: </pre>
11304:
11305: <p>You can also use wildcards in package
11306: dependences:</p>
11307: <pre class="programlisting">
11308: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
11309: </pre>
11310:
11311: <p>Note that such wildcard dependencies are
11312: retained when creating binary packages. The
11313: dependency is checked when installing the binary
11314: package and any package which matches the pattern
11315: will be used. Wildcard dependencies should be
11316: used with care.</p>
11317:
11318: <p>The “<span class=
11319: "quote">-[0-9]*</span>” should be used
11320: instead of “<span class=
11321: "quote">-*</span>” to avoid potentially
11322: ambiguous matches such as “<span class=
11323: "quote">tk-postgresql</span>” matching a
11324: “<span class="quote">tk-*</span>”
1.14 xtraeme 11325: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11326:
11327: <p>Wildcards can also be used to specify that a
11328: package will only build against a certain minimum
11329: version of a pre-requisite:</p>
11330: <pre class="programlisting">
11331: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
11332: </pre>
11333:
11334: <p>This means that the package will build against
11335: version 3.5.4 of the tiff library or newer. Such
11336: a dependency may be warranted if, for example,
11337: the API of the library has changed with version
11338: 3.5.4 and a package would not compile against an
11339: earlier version of tiff.</p>
11340:
11341: <p>Please note that such dependencies should only
11342: be updated if a package requires a newer
11343: pre-requisite, but not to denote recommendations
11344: such as security updates or ABI changes that do
11345: not prevent a package from building correctly.
11346: Such recommendations can be expressed using
1.14 xtraeme 11347: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11348: <pre class="programlisting">
11349: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
11350: </pre>
11351:
1.14 xtraeme 11352: <p>In addition to the above <code class=
11353: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11354: while a package will build against
11355: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11356: recommended. <code class=
11357: "varname">RECOMMENDED</code> entries will be
11358: turned into dependencies unless explicitly
11359: ignored (in which case a warning will be
1.36 wiz 11360: printed).</p>
11361:
11362: <p>To ignore these dependency recommendations and
11363: just use the required <code class=
11364: "varname">DEPENDS</code>, set <code class=
11365: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11366: make it easier and faster to update packages
11367: built using pkgsrc, since older compatible
11368: dependencies can continue to be used. This is
11369: useful for people who watch their rebuilds very
11370: carefully; it is not very good as a
11371: general-purpose hammer. If you use it, you need
11372: to be mindful of possible ABI changes, including
11373: those from the underlying OS.</p>
11374:
11375: <p>Packages that are built with recommendations
11376: ignored may not be uploaded to ftp.NetBSD.org by
11377: developers and should not be used across
11378: different systems that may have different
11379: versions of binary packages installed.</p>
1.1 grant 11380:
11381: <p>For security fixes, please update the package
11382: vulnerabilities file as well as setting
1.14 xtraeme 11383: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11384: <a href="#security-handling" title=
1.38 dillo 11385: "15.1.8. Handling packages with security problems">
11386: Section 15.1.8, “Handling packages with
1.1 grant 11387: security problems”</a> for more
11388: information.</p>
11389: </li>
11390:
11391: <li>
11392: <p>If your package needs some executable to be
1.17 sketch 11393: able to run correctly and if there's no
1.45 wiz 11394: <code xmlns=
11395: "http://www.w3.org/TR/xhtml1/transitional" class=
11396: "filename">buildlink3.mk</code> file, this is
11397: specified using the <code class=
1.14 xtraeme 11398: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11399: "http://www.w3.org/TR/xhtml1/transitional" href=
11400: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11401: target="_top"><code xmlns="" class=
11402: "filename">print/lyx</code></a> package needs to
11403: be able to execute the latex binary from the
11404: teTeX package when it runs, and that is
11405: specified:</p>
1.1 grant 11406: <pre class="programlisting">
11407: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
11408: </pre>
11409:
11410: <p>The comment about wildcard dependencies from
11411: previous paragraph applies here, too.</p>
11412: </li>
11413: </ol>
11414: </div>
11415:
11416: <p>If your package needs files from another package to
11417: build, see the first part of the “<span class=
11418: "quote">do-configure</span>” target <a xmlns=
11419: "http://www.w3.org/TR/xhtml1/transitional" href=
11420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11421: target="_top"><code xmlns="" class=
11422: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11423: relies on the jpeg sources being present in source form
11424: during the build):</p>
1.1 grant 11425: <pre class="programlisting">
11426: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11427: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
11428: fi
11429: </pre>
11430:
11431: <p>If you build any other packages that way, please
11432: make sure the working files are deleted too when this
11433: package's working files are cleaned up. The easiest way
11434: to do so is by adding a pre-clean target:</p>
11435: <pre class="programlisting">
11436: pre-clean:
11437: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
11438: </pre>
11439:
1.14 xtraeme 11440: <p>Please also note the <code class=
11441: "varname">BUILD_USES_MSGFMT</code> and <code class=
11442: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11443: which are provided as convenience definitions. The
1.24 wiz 11444: former works out whether <a href=
11445: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11446: <span class="citerefentry"><span class=
11447: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11448: the base system, and, if it isn't, installs the
11449: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11450: href=
1.1 grant 11451: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 11452: target="_top"><code xmlns="" class=
11453: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11454: adds a build dependency on either an installed version
11455: of an older gettext package, or if it isn't, installs
11456: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11457: href=
11458: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 11459: target="_top"><code xmlns="" class=
11460: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11461: </div>
11462:
11463: <div class="sect2" lang="en" xml:lang="en">
11464: <div class="titlepage">
11465: <div>
11466: <div>
1.30 wiz 11467: <h3 class="title"><a name="conflicts" id=
1.38 dillo 11468: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11469: with other packages</h3>
11470: </div>
11471: </div>
11472: </div>
11473:
11474: <p>Your package may conflict with other packages a user
11475: might already have installed on his system, e.g. if
11476: your package installs the same set of files like
11477: another package in our pkgsrc tree.</p>
11478:
1.14 xtraeme 11479: <p>In this case you can set <code class=
1.47 ! reed 11480: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 11481: packages (including version string) your package
11482: conflicts with.</p>
11483:
1.47 ! reed 11484: <p>For example, <a xmlns=
1.1 grant 11485: "http://www.w3.org/TR/xhtml1/transitional" href=
11486: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 11487: target="_top"><code xmlns="" class=
11488: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11489: "http://www.w3.org/TR/xhtml1/transitional" href=
11490: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 11491: target="_top"><code xmlns="" class=
1.47 ! reed 11492: "filename">x11/Xaw-Xpm</code></a> install the same
! 11493: shared library, thus you set in <code xmlns=
1.45 wiz 11494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11495: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 11496: <pre class="programlisting">
11497: CONFLICTS= Xaw-Xpm-[0-9]*
11498: </pre>
11499:
1.45 wiz 11500: <p>and in <code xmlns=
11501: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11502: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 11503: <pre class="programlisting">
11504: CONFLICTS= Xaw3d-[0-9]*
11505: </pre>
11506:
11507: <p>Packages will automatically conflict with other
11508: packages with the name prefix and a different version
11509: string. “<span class=
11510: "quote">Xaw3d-1.5</span>” e.g. will automatically
11511: conflict with the older version “<span class=
11512: "quote">Xaw3d-1.3</span>”.</p>
11513: </div>
11514:
11515: <div class="sect2" lang="en" xml:lang="en">
11516: <div class="titlepage">
11517: <div>
11518: <div>
1.30 wiz 11519: <h3 class="title"><a name="not-building-packages"
11520: id=
1.38 dillo 11521: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 11522: that cannot or should not be built</h3>
1.1 grant 11523: </div>
11524: </div>
11525: </div>
11526:
11527: <p>There are several reasons why a package might be
11528: instructed to not build under certain circumstances. If
11529: the package builds and runs on most platforms, the
1.14 xtraeme 11530: exceptions should be noted with <code class=
11531: "varname">NOT_FOR_PLATFORM</code>. If the package
11532: builds and runs on a small handful of platforms, set
11533: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 11534: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
11535: <code class="varname">NOT_FOR_PLATFORM</code> are OS
11536: triples (OS-version-platform) that can use glob-style
11537: wildcards.</p>
11538:
11539: <p>If the package should be skipped (for example,
11540: because it provides functionality already provided by
11541: the system), set <code class=
1.14 xtraeme 11542: "varname">PKG_SKIP_REASON</code> to a descriptive
11543: message. If the package should fail because some
11544: preconditions are not met, set <code class=
11545: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 11546: message.</p>
11547: </div>
11548:
11549: <div class="sect2" lang="en" xml:lang="en">
11550: <div class="titlepage">
11551: <div>
11552: <div>
1.30 wiz 11553: <h3 class="title"><a name="undeletable-packages"
11554: id=
1.38 dillo 11555: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 11556: which should not be deleted, once installed</h3>
1.1 grant 11557: </div>
11558: </div>
11559: </div>
11560:
11561: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 11562: has been installed, the <code class=
11563: "varname">PKG_PRESERVE</code> definition should be set
11564: in the package Makefile. This will be carried into any
1.1 grant 11565: binary package that is made from this pkgsrc entry. A
11566: “<span class="quote">preserved</span>”
11567: package will not be deleted using <a href=
11568: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11569: <span class="citerefentry"><span class=
11570: "refentrytitle">pkg_delete</span>(1)</span></a> unless
11571: the “<span class="quote">-f</span>” option
11572: is used.</p>
11573: </div>
11574:
11575: <div class="sect2" lang="en" xml:lang="en">
11576: <div class="titlepage">
11577: <div>
11578: <div>
11579: <h3 class="title"><a name="security-handling" id=
1.38 dillo 11580: "security-handling"></a>15.1.8. Handling
1.1 grant 11581: packages with security problems</h3>
11582: </div>
11583: </div>
11584: </div>
11585:
11586: <p>When a vulnerability is found, this should be noted
1.45 wiz 11587: in <code xmlns=
11588: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11589: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 11590: and after committing that file, use
11591: <span><strong class="command">make
11592: upload</strong></span> in the same directory to update
11593: the file on ftp.NetBSD.org.</p>
11594:
11595: <p>After fixing the vulnerability by a patch, its
11596: <code class="varname">PKGREVISION</code> should be
11597: increased (this is of course not necessary if the
11598: problem is fixed by using a newer release of the
1.45 wiz 11599: software). In addition, if a <code xmlns=
11600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11601: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 11602: affected package, a corresponding <code class=
1.14 xtraeme 11603: "varname">BUILDLINK_RECOMMENDED.<em class=
11604: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 11605: be added or updated in it.</p>
1.1 grant 11606:
11607: <p>Also, if the fix should be applied to the stable
11608: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 11609:
11610: <p>Binary packages already on ftp.NetBSD.org will be
11611: handled semi-automatically by a weekly cron job.</p>
1.1 grant 11612: </div>
11613:
11614: <div class="sect2" lang="en" xml:lang="en">
11615: <div class="titlepage">
11616: <div>
11617: <div>
1.30 wiz 11618: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 11619: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 11620: compiler bugs</h3>
11621: </div>
11622: </div>
11623: </div>
11624:
11625: <p>Some source files trigger bugs in the compiler,
11626: based on combinations of compiler version and
11627: architecture and almost always relation to optimisation
11628: being enabled. Common symptoms are gcc internal errors
11629: or never finishing compiling a file.</p>
11630:
1.47 ! reed 11631: <p>Typically, a workaround involves testing the
1.14 xtraeme 11632: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 11633: version, disabling optimisation for that
1.14 xtraeme 11634: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 11635: combination, and documenting it in <code xmlns=
11636: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11637: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 11638: number of examples!</p>
11639: </div>
11640:
11641: <div class="sect2" lang="en" xml:lang="en">
11642: <div class="titlepage">
11643: <div>
11644: <div>
1.30 wiz 11645: <h3 class="title"><a name="bumping-pkgrevision"
1.38 dillo 11646: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 11647: handle incrementing versions when fixing an
11648: existing package</h3>
1.1 grant 11649: </div>
11650: </div>
11651: </div>
11652:
11653: <p>When making fixes to an existing package it can be
1.14 xtraeme 11654: useful to change the version number in <code class=
11655: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 11656: future versions by the original author, a
11657: “<span class="quote">nb1</span>”,
11658: “<span class="quote">nb2</span>”, ...
11659: suffix can be used on package versions by setting
1.14 xtraeme 11660: <code class="varname">PKGREVISION=1</code> (2, ...).
11661: The “<span class="quote">nb</span>” is
11662: treated like a “<span class=
11663: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 11664: <pre class="programlisting">
11665: DISTNAME= foo-17.42
11666: PKGREVISION= 9
11667: </pre>
11668:
1.14 xtraeme 11669: <p>will result in a <code class=
11670: "varname">PKGNAME</code> of “<span class=
1.1 grant 11671: "quote">foo-17.42nb9</span>”.</p>
11672:
11673: <p>When a new release of the package is released, the
1.14 xtraeme 11674: <code class="varname">PKGREVISION</code> should be
1.47 ! reed 11675: removed, e.g. on a new minor release of the above
1.14 xtraeme 11676: package, things should be like:</p>
1.1 grant 11677: <pre class="programlisting">
11678: DISTNAME= foo-17.43
11679: </pre>
11680: </div>
11681:
11682: <div class="sect2" lang="en" xml:lang="en">
11683: <div class="titlepage">
11684: <div>
11685: <div>
1.30 wiz 11686: <h3 class="title"><a name=
11687: "portability-of-packages" id=
1.38 dillo 11688: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 11689: of packages</h3>
1.1 grant 11690: </div>
11691: </div>
11692: </div>
11693:
11694: <p>One appealing feature of pkgsrc is that it runs on
11695: many different platforms. As a result, it is important
11696: to ensure, where possible, that packages in pkgsrc are
11697: portable. There are some particular details you should
11698: pay attention to while working on pkgsrc.</p>
11699:
11700: <div class="sect3" lang="en" xml:lang="en">
11701: <div class="titlepage">
11702: <div>
11703: <div>
1.30 wiz 11704: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 11705: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 11706: ${INSTALL_DATA_DIR}, ...</h4>
11707: </div>
11708: </div>
11709: </div>
11710:
1.14 xtraeme 11711: <p>The BSD-compatible <span><strong class=
11712: "command">install</strong></span> supplied with some
1.1 grant 11713: operating systems will not perform more than one
11714: operation at a time. As such, you should call
11715: “<span class="quote">${INSTALL}</span>”,
11716: etc. like this:</p>
11717: <pre class="programlisting">
11718: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
11719: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
11720: </pre>
11721: </div>
11722: </div>
11723: </div>
11724:
11725: <div class="sect1" lang="en" xml:lang="en">
11726: <div class="titlepage">
11727: <div>
11728: <div>
11729: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11730: "downloading-issues" id=
1.38 dillo 11731: "downloading-issues"></a>15.2. Possible
1.1 grant 11732: downloading issues</h2>
11733: </div>
11734: </div>
11735: </div>
11736:
11737: <div class="sect2" lang="en" xml:lang="en">
11738: <div class="titlepage">
11739: <div>
11740: <div>
1.30 wiz 11741: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 11742: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 11743: whose distfiles aren't available for plain
1.1 grant 11744: downloading</h3>
11745: </div>
11746: </div>
11747: </div>
11748:
11749: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 11750: set <code class="varname">DYNAMIC_MASTER_SITES</code>
11751: and a <span><strong class="command">make
1.45 wiz 11752: fetch</strong></span> will call <code xmlns=
11753: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11754: "filename">files/getsite.sh</code> with the name of
11755: each file to download as an argument, expecting it to
11756: output the URL of the directory from which to download
11757: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11758: href=
1.1 grant 11759: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 11760: target="_top"><code xmlns="" class=
11761: "filename">graphics/ns-cult3d</code></a> is an example
11762: of this usage.</p>
1.1 grant 11763:
11764: <p>If the download can't be automated, because the user
11765: must submit personal information to apply for a
11766: password, or must pay for the source, or whatever, you
1.14 xtraeme 11767: can set <code class="varname">_FETCH_MESSAGE</code> to
11768: a macro which displays a message explaining the
11769: situation. <code class="varname">_FETCH_MESSAGE</code>
11770: must be executable shell commands, not just a message.
11771: (Generally, it executes <code class=
11772: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 11773: following packages use this: <a xmlns=
11774: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11775: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 11776: target="_top"><code xmlns="" class=
11777: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 11778: "http://www.w3.org/TR/xhtml1/transitional" href=
11779: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 11780: target="_top"><code xmlns="" class=
11781: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 11782: "http://www.w3.org/TR/xhtml1/transitional" href=
11783: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 11784: target="_top"><code xmlns="" class=
11785: "filename">emulators/vmware-module</code></a>,
11786: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11787: href=
1.20 ben 11788: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 11789: target="_top"><code xmlns="" class=
11790: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 11791: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 11792: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 11793: target="_top"><code xmlns="" class=
11794: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 11795: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11796: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 11797: target="_top"><code xmlns="" class=
11798: "filename">sysutils/storage-manager</code></a>,
11799: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11800: href=
1.20 ben 11801: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 11802: target="_top"><code xmlns="" class=
11803: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 11804: "http://www.w3.org/TR/xhtml1/transitional" href=
11805: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 11806: target="_top"><code xmlns="" class=
11807: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 11808: with them.</p>
1.1 grant 11809: </div>
11810:
11811: <div class="sect2" lang="en" xml:lang="en">
11812: <div class="titlepage">
11813: <div>
11814: <div>
1.30 wiz 11815: <h3 class="title"><a name=
11816: "modified-distfiles-same-name" id=
1.38 dillo 11817: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 11818: to handle modified distfiles with the 'old'
11819: name</h3>
1.1 grant 11820: </div>
11821: </div>
11822: </div>
11823:
11824: <p>Sometimes authors of a software package make some
11825: modifications after the software was released, and they
11826: put up a new distfile without changing the package's
11827: version number. If a package is already in pkgsrc at
1.32 wiz 11828: that time, the checksum will no longer match. The
11829: contents of the new distfile should be compared against
11830: the old one before changing anything, to make sure the
11831: distfile was really updated on purpose, and that no
11832: trojan horse or so crept in. Then, the correct way to
11833: work around this is to set <code class=
11834: "varname">DIST_SUBDIR</code> to a unique directory
11835: name, usually based on <code class=
11836: "varname">PKGNAME_NOREV</code>. In case this happens
11837: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 11838: used (thus including the <code xmlns=
11839: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11840: "filename">nbX</code> suffix) or a date stamp can be
11841: appended, like <code class=
11842: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 11843: forget regenerating the <code xmlns=
11844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11845: "filename">distinfo</code> file after that, since it
11846: contains the <code class="varname">DIST_SUBDIR</code>
11847: path in the filenames. Furthermore, a mail to the
11848: package's authors seems appropriate telling them that
11849: changing distfiles after releases without changing the
11850: file names is not good practice.</p>
1.1 grant 11851: </div>
11852: </div>
11853:
11854: <div class="sect1" lang="en" xml:lang="en">
11855: <div class="titlepage">
11856: <div>
11857: <div>
11858: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11859: "configuration-gotchas" id=
1.38 dillo 11860: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 11861: gotchas</h2>
11862: </div>
11863: </div>
11864: </div>
11865:
11866: <div class="sect2" lang="en" xml:lang="en">
11867: <div class="titlepage">
11868: <div>
11869: <div>
11870: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 11871: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 11872: - libtool</h3>
11873: </div>
11874: </div>
11875: </div>
11876:
11877: <p>pkgsrc supports many different machines, with
11878: different object formats like a.out and ELF, and
11879: varying abilities to do shared library and dynamic
11880: loading at all. To accompany this, varying commands and
11881: options have to be passed to the compiler, linker, etc.
11882: to get the Right Thing, which can be pretty annoying
11883: especially if you don't have all the machines at your
11884: hand to test things. The <a xmlns=
11885: "http://www.w3.org/TR/xhtml1/transitional" href=
11886: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 11887: target="_top"><code xmlns="" class=
11888: "filename">devel/libtool</code></a> pkg can help here,
11889: as it just “<span class=
11890: "quote">knows</span>” how to build both static
11891: and dynamic libraries from a set of source files, thus
1.47 ! reed 11892: being platform-independent.</p>
1.1 grant 11893:
11894: <p>Here's how to use libtool in a pkg in seven simple
11895: steps:</p>
11896:
11897: <div class="orderedlist">
11898: <ol type="1">
11899: <li>
1.14 xtraeme 11900: <p>Add <code class=
11901: "varname">USE_LIBTOOL=yes</code> to the package
11902: Makefile.</p>
1.1 grant 11903: </li>
11904:
11905: <li>
11906: <p>For library objects, use “<span class=
11907: "quote">${LIBTOOL} --mode=compile
11908: ${CC}</span>” in place of
11909: “<span class="quote">${CC}</span>”.
11910: You could even add it to the definition of
1.14 xtraeme 11911: <code class="varname">CC</code>, if only
11912: libraries are being built in a given Makefile.
11913: This one command will build both PIC and non-PIC
11914: library objects, so you need not have separate
11915: shared and non-shared library rules.</p>
1.1 grant 11916: </li>
11917:
11918: <li>
11919: <p>For the linking of the library, remove any
11920: “<span class="quote">ar</span>”,
11921: “<span class="quote">ranlib</span>”,
11922: and “<span class="quote">ld
11923: -Bshareable</span>” commands, and instead
11924: use:</p>
11925: <pre class="programlisting">
11926: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
11927: </pre>
11928:
11929: <p>Note that the library is changed to have a
1.45 wiz 11930: <code xmlns=
11931: "http://www.w3.org/TR/xhtml1/transitional" class=
11932: "filename">.la</code> extension, and the objects
11933: are changed to have a <code xmlns=
11934: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11935: "filename">.lo</code> extension. Change
11936: <code class="varname">OBJS</code> as necessary.
11937: This automatically creates all of the
1.45 wiz 11938: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11939: class="filename">.a</code>, <code xmlns=
11940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11941: "filename">.so.major.minor</code>, and ELF
11942: symlinks (if necessary) in the build directory.
11943: Be sure to include “<span class=
1.1 grant 11944: "quote">-version-info</span>”, especially
11945: when major and minor are zero, as libtool will
11946: otherwise strip off the shared library
11947: version.</p>
11948:
11949: <p>From the libtool manual:</p>
11950: <pre class="programlisting">
11951: So, libtool library versions are described by three integers:
11952:
11953: CURRENT
11954: The most recent interface number that this library implements.
11955:
11956: REVISION
11957: The implementation number of the CURRENT interface.
11958:
11959: AGE
11960: The difference between the newest and oldest interfaces that this
11961: library implements. In other words, the library implements all the
11962: interface numbers in the range from number `CURRENT - AGE' to
11963: `CURRENT'.
11964:
11965: If two libraries have identical CURRENT and AGE numbers, then the
11966: dynamic linker chooses the library with the greater REVISION number.
11967: </pre>
11968:
11969: <p>The “<span class=
11970: "quote">-release</span>” option will
11971: produce different results for a.out and ELF
11972: (excluding symlinks) in only one case. An ELF
11973: library of the form “<span class=
11974: "quote">libfoo-release.so.<span class=
11975: "emphasis"><em>x</em></span>.<span class=
11976: "emphasis"><em>y</em></span></span>” will
11977: have a symlink of “<span class=
11978: "quote">libfoo.so.<span class=
11979: "emphasis"><em>x</em></span>.<span class=
11980: "emphasis"><em>y</em></span></span>” on an
11981: a.out platform. This is handled
11982: automatically.</p>
11983:
11984: <p>The “<span class="quote">-rpath
11985: argument</span>” is the install directory
11986: of the library being built.</p>
11987:
1.45 wiz 11988: <p>In the <code xmlns=
11989: "http://www.w3.org/TR/xhtml1/transitional" class=
11990: "filename">PLIST</code>, include only the
11991: <code xmlns=
11992: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 11993: "filename">.la</code> file, the other files will
11994: be added automatically.</p>
1.1 grant 11995: </li>
11996:
11997: <li>
1.45 wiz 11998: <p>When linking shared object (<code xmlns=
11999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12000: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12001: loaded via <a href=
12002: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12003: <span class="citerefentry"><span class=
12004: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12005: shared libraries, use “<span class=
12006: "quote">-module -avoid-version</span>” to
12007: prevent them getting version tacked on.</p>
1.1 grant 12008:
1.45 wiz 12009: <p>The <code xmlns=
12010: "http://www.w3.org/TR/xhtml1/transitional" class=
12011: "filename">PLIST</code> file gets the
12012: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12013: class="filename">foo.so</code> entry.</p>
1.1 grant 12014: </li>
12015:
12016: <li>
12017: <p>When linking programs that depend on these
12018: libraries <span class=
12019: "emphasis"><em>before</em></span> they are
12020: installed, preface the <a href=
12021: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12022: <span class="citerefentry"><span class=
12023: "refentrytitle">cc</span>(1)</span></a> or
12024: <a href=
12025: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12026: <span class="citerefentry"><span class=
12027: "refentrytitle">ld</span>(1)</span></a> line with
12028: “<span class="quote">${LIBTOOL}
12029: --mode=link</span>”, and it will find the
12030: correct libraries (static or shared), but please
12031: be aware that libtool will not allow you to
12032: specify a relative path in -L (such as
12033: “<span class=
12034: "quote">-L../somelib</span>”), because it
12035: expects you to change that argument to be the
1.45 wiz 12036: <code xmlns=
12037: "http://www.w3.org/TR/xhtml1/transitional" class=
12038: "filename">.la</code> file. e.g.</p>
1.1 grant 12039: <pre class="programlisting">
12040: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
12041: </pre>
12042:
12043: <p>should be changed to:</p>
12044: <pre class="programlisting">
1.14 xtraeme 12045: ${LIBTOOL} --mode=link ${CC} -o <em class=
12046: "replaceable"><code>someprog</code></em> <em class=
12047: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12048: </pre>
12049:
12050: <p>and it will do the right thing with the
12051: libraries.</p>
12052: </li>
12053:
12054: <li>
12055: <p>When installing libraries, preface the
12056: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12057: <span class="citerefentry"><span class=
12058: "refentrytitle">install</span>(1)</span></a> or
12059: <a href=
12060: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12061: <span class="citerefentry"><span class=
12062: "refentrytitle">cp</span>(1)</span></a> command
12063: with “<span class="quote">${LIBTOOL}
12064: --mode=install</span>”, and change the
1.45 wiz 12065: library name to <code xmlns=
12066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12067: "filename">.la</code>. e.g.</p>
1.1 grant 12068: <pre class="programlisting">
12069: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
12070: </pre>
12071:
1.45 wiz 12072: <p>This will install the static <code xmlns=
12073: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12074: "filename">.a</code>, shared library, any needed
1.1 grant 12075: symlinks, and run <a href=
12076: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12077: <span class="citerefentry"><span class=
12078: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12079: </li>
12080:
12081: <li>
1.45 wiz 12082: <p>In your <code xmlns=
12083: "http://www.w3.org/TR/xhtml1/transitional" class=
12084: "filename">PLIST</code>, include only the
12085: <code xmlns=
12086: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12087: "filename">.la</code> file (this is a change from
12088: previous behaviour).</p>
1.1 grant 12089: </li>
12090: </ol>
12091: </div>
12092: </div>
12093:
12094: <div class="sect2" lang="en" xml:lang="en">
12095: <div class="titlepage">
12096: <div>
12097: <div>
1.30 wiz 12098: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12099: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12100: GNU packages that already support libtool</h3>
1.1 grant 12101: </div>
12102: </div>
12103: </div>
12104:
1.14 xtraeme 12105: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12106: the package Makefile. This will override the package's
12107: own libtool in most cases. For older libtool using
1.1 grant 12108: packages, libtool is made by ltconfig script during the
12109: do-configure step; you can check the libtool script
1.14 xtraeme 12110: location by doing <span><strong class="command">make
12111: configure; find work*/ -name
12112: libtool</strong></span>.</p>
12113:
12114: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12115: specifies which libtool scripts, relative to
12116: <code class="varname">WRKSRC</code>, to override. By
12117: default, it is set to “<span class=
12118: "quote">libtool */libtool */*/libtool</span>”. If
12119: this does not match the location of the package's
12120: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12121:
1.45 wiz 12122: <p>If you do not need <code xmlns=
12123: "http://www.w3.org/TR/xhtml1/transitional" class=
12124: "filename">*.a</code> static libraries built and
12125: installed, then use <code class=
12126: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12127:
1.47 ! reed 12128: <p>If your package makes use of the
! 12129: platform-independent library for loading dynamic shared
! 12130: objects, that comes with libtool (libltdl), you should
! 12131: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12132:
12133: <p>Some packages use libtool incorrectly so that the
12134: package may not work or build in some circumstances.
12135: Some of the more common errors are:</p>
12136:
12137: <div class="itemizedlist">
12138: <ul type="disc">
12139: <li>
12140: <p>The inclusion of a shared object (-module) as
12141: a dependent library in an executable or library.
12142: This in itself isn't a problem if one of two
12143: things has been done:</p>
12144:
12145: <div class="orderedlist">
12146: <ol type="1">
12147: <li>
12148: <p>The shared object is named correctly,
1.45 wiz 12149: i.e. <code xmlns=
12150: "http://www.w3.org/TR/xhtml1/transitional"
12151: class="filename">libfoo.la</code>, not
12152: <code xmlns=
12153: "http://www.w3.org/TR/xhtml1/transitional"
12154: class="filename">foo.la</code></p>
1.1 grant 12155: </li>
12156:
12157: <li>
12158: <p>The -dlopen option is used when linking
12159: an executable.</p>
12160: </li>
12161: </ol>
12162: </div>
12163: </li>
12164:
12165: <li>
12166: <p>The use of libltdl without the correct calls
12167: to initialisation routines. The function
12168: lt_dlinit() should be called and the macro
1.14 xtraeme 12169: <code class=
12170: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12171: included in executables.</p>
12172: </li>
12173: </ul>
12174: </div>
12175: </div>
12176:
12177: <div class="sect2" lang="en" xml:lang="en">
12178: <div class="titlepage">
12179: <div>
12180: <div>
1.30 wiz 12181: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12182: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12183: Autoconf/Automake</h3>
12184: </div>
12185: </div>
12186: </div>
12187:
12188: <p>If a package needs GNU autoconf or automake to be
12189: executed to regenerate the configure script and
12190: Makefile.in makefile templates, then they should be
1.35 jmmv 12191: executed in a pre-configure target.</p>
1.1 grant 12192:
12193: <p>For packages that need only autoconf:</p>
12194: <pre class="programlisting">
1.35 jmmv 12195: AUTOCONF_REQD= 2.50 # if default version is not good enough
12196: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 12197: ...
12198:
12199: pre-configure:
1.35 jmmv 12200: cd ${WRKSRC}; autoconf
1.1 grant 12201:
12202: ...
12203: </pre>
12204:
12205: <p>and for packages that need automake and
12206: autoconf:</p>
12207: <pre class="programlisting">
1.35 jmmv 12208: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 wiz 12209: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 12210: ...
12211:
12212: pre-configure:
12213: cd ${WRKSRC}; \
1.35 jmmv 12214: aclocal; autoheader; \
12215: automake -a --foreign -i; autoconf
1.1 grant 12216:
12217: ...
12218: </pre>
12219:
12220: <p>Packages which use GNU Automake will almost
1.35 jmmv 12221: certainly require GNU Make.</p>
1.1 grant 12222:
12223: <p>There are times when the configure process makes
12224: additional changes to the generated files, which then
12225: causes the build process to try to re-execute the
12226: automake sequence. This is prevented by touching
12227: various files in the configure stage. If this causes
1.14 xtraeme 12228: problems with your package you can set <code class=
12229: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12230: Makefile.</p>
12231: </div>
12232: </div>
12233:
12234: <div class="sect1" lang="en" xml:lang="en">
12235: <div class="titlepage">
12236: <div>
12237: <div>
12238: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12239: "building-considerations" id=
1.38 dillo 12240: "building-considerations"></a>15.4. Building
1.1 grant 12241: considerations</h2>
12242: </div>
12243: </div>
12244: </div>
12245:
12246: <div class="sect2" lang="en" xml:lang="en">
12247: <div class="titlepage">
12248: <div>
12249: <div>
1.30 wiz 12250: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12251: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12252: </div>
12253: </div>
12254: </div>
12255:
12256: <p>To port an application to NetBSD, it's usually
12257: necessary for the compiler to be able to judge the
12258: system on which it's compiling, and we use definitions
12259: so that the C pre-processor can do this.</p>
12260:
12261: <p>To test whether you are working on a 4.4 BSD-derived
12262: system, you should use the BSD definition, which is
1.45 wiz 12263: defined in <code xmlns=
12264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12265: "filename"><sys/param.h></code> on said
1.1 grant 12266: systems.</p>
12267: <pre class="programlisting">
12268: #include <sys/param.h>
12269: </pre>
12270:
12271: <p>and then you can surround the BSD-specific parts of
12272: your package's C/C++ code using this conditional:</p>
12273: <pre class="programlisting">
12274: #if (defined(BSD) && BSD >= 199306)
12275: ...
12276: #endif
12277: </pre>
12278:
12279: <p>Please use the “<span class=
12280: "quote">__NetBSD__</span>” definition sparingly -
12281: it should only apply to features of NetBSD that are not
1.47 ! reed 12282: present in other 4.4-lite-derived BSDs.</p>
1.1 grant 12283: </div>
12284: </div>
12285:
12286: <div class="sect1" lang="en" xml:lang="en">
12287: <div class="titlepage">
12288: <div>
12289: <div>
12290: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12291: "package-specific-actions" id=
1.38 dillo 12292: "package-specific-actions"></a>15.5. Package
1.1 grant 12293: specific actions</h2>
12294: </div>
12295: </div>
12296: </div>
12297:
12298: <div class="sect2" lang="en" xml:lang="en">
12299: <div class="titlepage">
12300: <div>
12301: <div>
1.30 wiz 12302: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 12303: "user-interaction"></a>15.5.1. User
1.2 hubertf 12304: interaction</h3>
1.1 grant 12305: </div>
12306: </div>
12307: </div>
12308:
12309: <p>Occasionally, packages require interaction from the
12310: user, and this can be in a number of ways:</p>
12311:
12312: <div class="itemizedlist">
12313: <ul type="disc">
12314: <li>
12315: <p>help in fetching the distfiles</p>
12316: </li>
12317:
12318: <li>
12319: <p>help to configure the package before it is
12320: built</p>
12321: </li>
12322:
12323: <li>
12324: <p>help during the build process</p>
12325: </li>
12326:
12327: <li>
12328: <p>help during the installation of a package</p>
12329: </li>
12330: </ul>
12331: </div>
12332:
1.14 xtraeme 12333: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12334: definition is provided to notify the pkgsrc mechanism
12335: of an interactive stage which will be needed, and this
1.45 wiz 12336: should be set in the package's <code xmlns=
12337: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 ! reed 12338: "filename">Makefile</code>, e.g.:</p>
1.1 grant 12339: <pre class="programlisting">
12340: INTERACTIVE_STAGE= build
12341: </pre>
12342:
12343: <p>Multiple interactive stages can be specified:</p>
12344: <pre class="programlisting">
12345: INTERACTIVE_STAGE= configure install
12346: </pre>
12347: </div>
12348:
12349: <div class="sect2" lang="en" xml:lang="en">
12350: <div class="titlepage">
12351: <div>
12352: <div>
1.30 wiz 12353: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 12354: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12355: licenses</h3>
12356: </div>
12357: </div>
12358: </div>
12359:
1.44 gdt 12360: <p>A package may be covered by a license which the user
12361: has or has not agreed to accept. For these cases,
12362: pkgsrc contains a mechanism to note that a package is
12363: covered by a particular license, and the package cannot
12364: be built unless the user has accepted the license.
12365: (Installation of binary packages are not currently
12366: subject to this mechanism.) Packages with licenses that
12367: are either Open Source according to the Open Source
12368: Initiative or Free according to the Free Software
12369: Foundation will not be marked with a license tag.
12370: Packages with licenses that have not been determined to
12371: meet either definition will be marked with a license
12372: tag referring to the license. This will prevent
12373: building unless pkgsrc is informed that the license is
12374: acceptable, and enables displaying the license.</p>
12375:
12376: <p>The license tag mechanism is intended to address
12377: copyright-related issues surrounding building,
12378: installing and using a package, and not to address
12379: redistribution issues (see <code class=
12380: "varname">RESTRICTED</code> and <code class=
12381: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12382: above definition of licenses for which tags are not
12383: needed implies that packages with redistribution
12384: restrictions should have tags.</p>
12385:
12386: <p>Denoting that a package is covered by a particular
1.45 wiz 12387: license is done by placing the license in <code xmlns=
12388: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12389: "filename">pkgsrc/licenses</code> and setting the
12390: <code class="varname">LICENSE</code> variable to a
12391: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12392: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12393: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 12394: target="_top"><code xmlns="" class=
12395: "filename">graphics/xv</code></a>:</p>
1.1 grant 12396: <pre class="programlisting">
1.44 gdt 12397: LICENSE= xv-license
1.1 grant 12398: </pre>
12399:
12400: <p>When trying to build, the user will get a notice
1.44 gdt 12401: that the package is covered by a license which has not
12402: been accepted:</p>
1.1 grant 12403: <pre class="programlisting">
1.14 xtraeme 12404: <code class="prompt">%</code> <strong class=
12405: "userinput"><code>make</code></strong>
1.44 gdt 12406: ===> xv-3.10anb9 has an unacceptable license: xv-license.
1.1 grant 12407: ===> To view the license, enter "/usr/bin/make show-license".
1.44 gdt 12408: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12409: ===> ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12410: *** Error code 1
12411: </pre>
12412:
1.14 xtraeme 12413: <p>The license can be viewed with <span><strong class=
12414: "command">make show-license</strong></span>, and if it
12415: is considered appropriate, the line printed above can
1.45 wiz 12416: be added to <code xmlns=
12417: "http://www.w3.org/TR/xhtml1/transitional" class=
12418: "filename">/etc/mk.conf</code> to indicate acceptance
12419: of the particular license:</p>
1.1 grant 12420: <pre class="programlisting">
1.44 gdt 12421: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12422: </pre>
12423:
12424: <p>When adding a package with a new license, the
1.45 wiz 12425: license text should be added to <code xmlns=
12426: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12427: "filename">pkgsrc/licenses</code> for displaying. A
12428: list of known licenses can be seen in this directory as
12429: well as by looking at the list of (commented out)
12430: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 12431: variable settings in <code xmlns=
12432: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12433: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 12434:
1.44 gdt 12435: <p>The use of <code class=
12436: "varname">LICENSE=shareware</code>, <code class=
12437: "varname">LICENSE=no-commercial-use</code>, and similar
12438: language is deprecated because it does not crisply
12439: refer to a particular license text. Another problem
12440: with such usage is that it does not enable a user to
12441: denote acceptance of the license for a single package
12442: without accepting the same license text for another
12443: package. In particular, this can be inappropriate when
12444: e.g. one accepts a particular license to indicate to
12445: pkgsrc that a fee has been paid.</p>
1.1 grant 12446: </div>
12447:
12448: <div class="sect2" lang="en" xml:lang="en">
12449: <div class="titlepage">
12450: <div>
12451: <div>
1.30 wiz 12452: <h3 class="title"><a name=
12453: "installing-score-files" id=
1.38 dillo 12454: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 12455: score files</h3>
1.1 grant 12456: </div>
12457: </div>
12458: </div>
12459:
12460: <p>Certain packages, most of them in the games
12461: category, install a score file that allows all users on
12462: the system to record their highscores. In order for
12463: this to work, the binaries need to be installed setgid
12464: and the score files owned by the appropriate group
12465: and/or owner (traditionally the "games" user/group).
12466: The following variables, documented in more detail in
1.45 wiz 12467: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12468: class="filename">mk/defaults/mk.conf</code>, control
12469: this behaviour: <code class=
1.14 xtraeme 12470: "varname">SETGIDGAME</code>, <code class=
12471: "varname">GAMEDATAMODE</code>, <code class=
12472: "varname">GAMEGRP</code>, <code class=
12473: "varname">GAMEMODE</code>, <code class=
12474: "varname">GAMEOWN</code>.</p>
1.1 grant 12475:
12476: <p>Note that per default, setgid installation of games
1.14 xtraeme 12477: is disabled; setting <code class=
12478: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 12479: variables accordingly.</p>
12480:
12481: <p>A package should therefor never hard code file
1.14 xtraeme 12482: ownership or access permissions but rely on
12483: <code class="varname">INSTALL_GAME</code> and
12484: <code class="varname">INSTALL_GAME_DATA</code> to set
12485: these correctly.</p>
1.1 grant 12486: </div>
12487:
12488: <div class="sect2" lang="en" xml:lang="en">
12489: <div class="titlepage">
12490: <div>
12491: <div>
1.30 wiz 12492: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 12493: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 12494: containing perl scripts</h3>
1.1 grant 12495: </div>
12496: </div>
12497: </div>
12498:
12499: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 12500: set <code class="varname">REPLACE_PERL</code> to ensure
12501: that the proper interpreter path is set. <code class=
12502: "varname">REPLACE_PERL</code> should contain a list of
12503: scripts, relative to <code class=
12504: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 12505: </div>
12506:
12507: <div class="sect2" lang="en" xml:lang="en">
12508: <div class="titlepage">
12509: <div>
12510: <div>
1.30 wiz 12511: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 12512: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 12513: hardcoded paths to other interpreters</h3>
12514: </div>
12515: </div>
12516: </div>
12517:
12518: <p>Your package may also contain scripts with hardcoded
12519: paths to other interpreters besides (or as well as)
12520: perl. To correct the full pathname to the script
12521: interpreter, you need to set the following definitions
1.45 wiz 12522: in your <code xmlns=
12523: "http://www.w3.org/TR/xhtml1/transitional" class=
12524: "filename">Makefile</code> (we shall use
12525: <span><strong class="command">tclsh</strong></span> in
12526: this example):</p>
1.1 grant 12527: <pre class="programlisting">
12528: REPLACE_INTERPRETER+= tcl
12529: _REPLACE.tcl.old= .*/bin/tclsh
12530: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
12531: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
12532: relative to ${WRKSRC}, just as in REPLACE_PERL
12533: </pre>
12534: </div>
12535:
12536: <div class="sect2" lang="en" xml:lang="en">
12537: <div class="titlepage">
12538: <div>
12539: <div>
1.30 wiz 12540: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 12541: "perl-modules"></a>15.5.6. Packages
1.30 wiz 12542: installing perl modules</h3>
1.1 grant 12543: </div>
12544: </div>
12545: </div>
12546:
12547: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 12548: include the Makefile fragment <code xmlns=
12549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12550: "filename">../../lang/perl5/module.mk</code>. It
12551: provides a <span><strong class=
12552: "command">do-configure</strong></span> target for the
12553: standard perl configuration for such modules as well as
12554: various hooks to tune this configuration. See comments
12555: in this file for details.</p>
1.1 grant 12556:
12557: <p>Perl5 modules will install into different places
12558: depending on the version of perl used during the build
12559: process. To address this, pkgsrc will append lines to
1.45 wiz 12560: the <code xmlns=
12561: "http://www.w3.org/TR/xhtml1/transitional" class=
12562: "filename">PLIST</code> corresponding to the files
12563: listed in the installed <code xmlns=
12564: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12565: "filename">.packlist</code> file generated by most
12566: perl5 modules. This is invoked by defining <code class=
12567: "varname">PERL5_PACKLIST</code> to a space-separated
12568: list of paths to packlist files, e.g.:</p>
1.1 grant 12569: <pre class="programlisting">
12570: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
12571: </pre>
12572:
1.14 xtraeme 12573: <p>The variables <code class=
12574: "varname">PERL5_SITELIB</code>, <code class=
12575: "varname">PERL5_SITEARCH</code>, and <code class=
12576: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 12577: locations in which perl5 modules may be installed, and
12578: may be used by perl5 packages that don't have a
12579: packlist. These three variables are also substituted
1.45 wiz 12580: for in the <code xmlns=
12581: "http://www.w3.org/TR/xhtml1/transitional" class=
12582: "filename">PLIST</code>.</p>
1.1 grant 12583: </div>
12584:
12585: <div class="sect2" lang="en" xml:lang="en">
12586: <div class="titlepage">
12587: <div>
12588: <div>
12589: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 12590: "faq.info-files"></a>15.5.7. Packages
1.1 grant 12591: installing info files</h3>
12592: </div>
12593: </div>
12594: </div>
12595:
12596: <p>Some packages install info files or use the
12597: “<span class="quote">makeinfo</span>” or
12598: “<span class="quote">install-info</span>”
12599: commands. Each of the info files:</p>
12600:
12601: <div class="itemizedlist">
12602: <ul type="disc">
12603: <li>
12604: <p>is considered to be installed in the directory
1.45 wiz 12605: <code xmlns=
12606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12607: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 12608: </li>
12609:
12610: <li>
12611: <p>is registered in the Info directory file
1.45 wiz 12612: <code xmlns=
12613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12614: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 12615: </li>
12616:
12617: <li>
12618: <p>and must be listed as a filename in the
1.14 xtraeme 12619: <code class="varname">INFO_FILES</code> variable
12620: in the package Makefile.</p>
1.1 grant 12621: </li>
12622: </ul>
12623: </div>
12624:
1.14 xtraeme 12625: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 12626: “<span class="quote">info</span>” and can
1.45 wiz 12627: be overridden in the package Makefile. <code xmlns=
12628: "http://www.w3.org/TR/xhtml1/transitional" class=
12629: "filename">INSTALL</code> and <code xmlns=
12630: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12631: "filename">DEINSTALL</code> scripts will be generated
12632: to handle registration of the info files in the Info
1.1 grant 12633: directory file. The “<span class=
12634: "quote">install-info</span>” command used for the
12635: info files registration is either provided by the
12636: system, or by a special purpose package automatically
12637: added as dependency if needed.</p>
12638:
12639: <p>A package which needs the “<span class=
12640: "quote">makeinfo</span>” command at build time
1.14 xtraeme 12641: must define the variable <code class=
12642: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 12643: minimum version of the “<span class=
12644: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 12645: should be noted with the <code class=
12646: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 12647: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12648: class="filename">Makefile</code>. By default, a minimum
12649: version of 3.12 is required. If the system does not
12650: provide a <span><strong class=
1.14 xtraeme 12651: "command">makeinfo</strong></span> command or if it
12652: does not match the required minimum, a build dependency
12653: on the <a xmlns=
12654: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 12655: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 12656: target="_top"><code xmlns="" class=
12657: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 12658: added automatically.</p>
1.1 grant 12659:
12660: <p>The build and installation process of the software
12661: provided by the package should not use the
1.14 xtraeme 12662: <span><strong class=
12663: "command">install-info</strong></span> command as the
12664: registration of info files is the task of the package
1.45 wiz 12665: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12666: class="filename">INSTALL</code> script, and it must use
12667: the appropriate <span><strong class=
1.14 xtraeme 12668: "command">makeinfo</strong></span> command.</p>
1.1 grant 12669:
1.47 ! reed 12670: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 12671: creates overriding scripts for the <span><strong class=
12672: "command">install-info</strong></span> and
12673: <span><strong class="command">makeinfo</strong></span>
12674: commands in a directory listed early in <code class=
12675: "varname">PATH</code>.</p>
1.1 grant 12676:
1.14 xtraeme 12677: <p>The script overriding <span><strong class=
12678: "command">install-info</strong></span> has no effect
12679: except the logging of a message. The script overriding
12680: <span><strong class="command">makeinfo</strong></span>
12681: logs a message and according to the value of
12682: <code class="varname">USE_MAKEINFO</code> and
12683: <code class="varname">TEXINFO_REQD</code> either run
12684: the appropriate <span><strong class=
12685: "command">makeinfo</strong></span> command or exit on
12686: error.</p>
1.1 grant 12687: </div>
12688:
12689: <div class="sect2" lang="en" xml:lang="en">
12690: <div class="titlepage">
12691: <div>
12692: <div>
1.30 wiz 12693: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 12694: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 12695: installing GConf2 data files</h3>
1.1 grant 12696: </div>
12697: </div>
12698: </div>
12699:
1.45 wiz 12700: <p>If a package installs <code xmlns=
12701: "http://www.w3.org/TR/xhtml1/transitional" class=
12702: "filename">.schemas</code> or <code xmlns=
12703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12704: "filename">.entries</code> files, used by GConf2, you
1.1 grant 12705: need to take some extra steps to make sure they get
12706: registered in the database:</p>
12707:
12708: <div class="orderedlist">
12709: <ol type="1">
12710: <li>
1.45 wiz 12711: <p>Include <code xmlns=
12712: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12713: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 12714: instead of its <code xmlns=
12715: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12716: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12717: care of rebuilding the GConf2 database at
12718: installation and deinstallation time, and tells
12719: the package where to install GConf2 data files
12720: using some standard configure arguments. It also
12721: disallows any access to the database directly
12722: from the package.</p>
12723: </li>
12724:
12725: <li>
12726: <p>Ensure that the package installs its
1.45 wiz 12727: <code xmlns=
12728: "http://www.w3.org/TR/xhtml1/transitional" class=
12729: "filename">.schemas</code> files under
12730: <code xmlns=
12731: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12732: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 12733: If they get installed under <code xmlns=
12734: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12735: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 12736: manually patch the package.</p>
12737: </li>
12738:
12739: <li>
12740: <p>Check the PLIST and remove any entries under
12741: the etc/gconf directory, as they will be handled
12742: automatically. See <a href="#faq.conf" title=
1.38 dillo 12743: "7.14. How do I change the location of configuration files?">
12744: Section 7.14, “How do I change the
1.35 jmmv 12745: location of configuration files?”</a> for
12746: more information.</p>
1.1 grant 12747: </li>
12748:
12749: <li>
1.14 xtraeme 12750: <p>Define the <code class=
12751: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 12752: <code xmlns=
12753: "http://www.w3.org/TR/xhtml1/transitional" class=
12754: "filename">Makefile</code> with a list of all
12755: <code xmlns=
12756: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12757: "filename">.schemas</code> files installed by the
12758: package, if any. Names must not contain any
12759: directories in them.</p>
1.1 grant 12760: </li>
12761:
12762: <li>
1.14 xtraeme 12763: <p>Define the <code class=
12764: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 12765: <code xmlns=
12766: "http://www.w3.org/TR/xhtml1/transitional" class=
12767: "filename">Makefile</code> with a list of all
12768: <code xmlns=
12769: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12770: "filename">.entries</code> files installed by the
12771: package, if any. Names must not contain any
12772: directories in them.</p>
1.1 grant 12773: </li>
12774: </ol>
12775: </div>
12776: </div>
12777:
12778: <div class="sect2" lang="en" xml:lang="en">
12779: <div class="titlepage">
12780: <div>
12781: <div>
1.30 wiz 12782: <h3 class="title"><a name=
12783: "scrollkeeper-data-files" id=
1.38 dillo 12784: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 12785: installing scrollkeeper data files</h3>
1.1 grant 12786: </div>
12787: </div>
12788: </div>
12789:
1.45 wiz 12790: <p>If a package installs <code xmlns=
12791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12792: "filename">.omf</code> files, used by scrollkeeper, you
12793: need to take some extra steps to make sure they get
12794: registered in the database:</p>
1.1 grant 12795:
12796: <div class="orderedlist">
12797: <ol type="1">
12798: <li>
1.45 wiz 12799: <p>Include <code xmlns=
12800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12801: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 12802: instead of its <code xmlns=
12803: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12804: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12805: care of rebuilding the scrollkeeper database at
12806: installation and deinstallation time, and
12807: disallows any access to it directly from the
12808: package.</p>
12809: </li>
12810:
12811: <li>
12812: <p>Check the PLIST and remove any entries under
1.45 wiz 12813: the <code xmlns=
12814: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12815: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 12816: as they will be handled automatically.</p>
12817: </li>
12818:
12819: <li>
1.45 wiz 12820: <p>Remove the <code xmlns=
12821: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12822: "filename">share/omf</code> directory from the
12823: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 12824: </li>
12825: </ol>
12826: </div>
12827: </div>
12828:
12829: <div class="sect2" lang="en" xml:lang="en">
12830: <div class="titlepage">
12831: <div>
12832: <div>
1.30 wiz 12833: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 12834: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 12835: X11 fonts</h3>
12836: </div>
12837: </div>
12838: </div>
12839:
12840: <p>If a package installs font files, you will need to
12841: rebuild the fonts database in the directory where they
12842: get installed at installation and deinstallation time.
1.45 wiz 12843: This can be automatically done by using <code xmlns=
12844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12845: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 12846: include in your <code xmlns=
12847: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12848: "filename">Makefile</code>.</p>
1.1 grant 12849:
12850: <p>When the file is included, you can list the
1.14 xtraeme 12851: directories where fonts are installed in the
12852: <code class="varname">FONTS_<em class=
12853: "replaceable"><code>type</code></em>_DIRS</code>
12854: variables, where <em class=
12855: "replaceable"><code>type</code></em> can be one of
12856: “<span class="quote">TTF</span>”,
1.1 grant 12857: “<span class="quote">TYPE1</span>” or
12858: “<span class="quote">X11</span>”. Also make
1.45 wiz 12859: sure that the database file <code xmlns=
12860: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12861: "filename">fonts.dir</code> is not listed in the
1.1 grant 12862: PLIST.</p>
12863:
12864: <p>Note that you should not create new directories for
12865: fonts; instead use the standard ones to avoid that the
12866: user needs to manually configure his X server to find
12867: them.</p>
12868: </div>
12869:
12870: <div class="sect2" lang="en" xml:lang="en">
12871: <div class="titlepage">
12872: <div>
12873: <div>
1.30 wiz 12874: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 12875: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 12876: installing GTK2 modules</h3>
1.1 grant 12877: </div>
12878: </div>
12879: </div>
12880:
1.47 ! reed 12881: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 12882: need to take some extra steps to get them registered in
12883: the GTK2 database properly:</p>
12884:
12885: <div class="orderedlist">
12886: <ol type="1">
12887: <li>
1.45 wiz 12888: <p>Include <code xmlns=
12889: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12890: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 12891: instead of its <code xmlns=
12892: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12893: "filename">buildlink3.mk</code> file. This takes
12894: care of rebuilding the database at installation
12895: and deinstallation time.</p>
1.1 grant 12896: </li>
12897:
12898: <li>
1.14 xtraeme 12899: <p>Set <code class=
12900: "varname">GTK2_IMMODULES=YES</code> if your
12901: package installs GTK2 immodules.</p>
1.1 grant 12902: </li>
12903:
12904: <li>
1.14 xtraeme 12905: <p>Set <code class=
12906: "varname">GTK2_LOADERS=YES</code> if your package
12907: installs GTK2 loaders.</p>
1.1 grant 12908: </li>
12909:
12910: <li>
1.47 ! reed 12911: <p>Patch the package to not touch any of the GTK2
1.1 grant 12912: databases directly. These are:</p>
12913:
12914: <div class="itemizedlist">
12915: <ul type="disc">
12916: <li>
1.45 wiz 12917: <p><code xmlns=
12918: "http://www.w3.org/TR/xhtml1/transitional"
12919: class=
1.14 xtraeme 12920: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 12921: </li>
12922:
12923: <li>
1.45 wiz 12924: <p><code xmlns=
12925: "http://www.w3.org/TR/xhtml1/transitional"
12926: class=
1.14 xtraeme 12927: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 12928: </li>
12929: </ul>
12930: </div>
12931: </li>
12932:
12933: <li>
12934: <p>Check the PLIST and remove any entries under
1.45 wiz 12935: the <code xmlns=
12936: "http://www.w3.org/TR/xhtml1/transitional" class=
12937: "filename">libdata/gtk-2.0</code> directory, as
12938: they will be handled automatically.</p>
1.1 grant 12939: </li>
12940: </ol>
12941: </div>
12942: </div>
12943:
12944: <div class="sect2" lang="en" xml:lang="en">
12945: <div class="titlepage">
12946: <div>
12947: <div>
1.30 wiz 12948: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 12949: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 12950: installing SGML or XML data</h3>
1.1 grant 12951: </div>
12952: </div>
12953: </div>
12954:
12955: <p>If a package installs SGML or XML data files that
12956: need to be registered in system-wide catalogs (like
12957: DTDs, sub-catalogs, etc.), you need to take some extra
12958: steps:</p>
12959:
12960: <div class="orderedlist">
12961: <ol type="1">
12962: <li>
1.45 wiz 12963: <p>Include <code xmlns=
12964: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12965: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 12966: in your <code xmlns=
12967: "http://www.w3.org/TR/xhtml1/transitional" class=
12968: "filename">Makefile</code>, which takes care of
12969: registering those files in system-wide catalogs
12970: at installation and deinstallation time.</p>
1.1 grant 12971: </li>
12972:
12973: <li>
1.14 xtraeme 12974: <p>Set <code class="varname">SGML_CATALOGS</code>
12975: to the full path of any SGML catalogs installed
12976: by the package.</p>
1.1 grant 12977: </li>
12978:
12979: <li>
1.14 xtraeme 12980: <p>Set <code class="varname">XML_CATALOGS</code>
12981: to the full path of any XML catalogs installed by
1.1 grant 12982: the package.</p>
12983: </li>
12984:
12985: <li>
1.14 xtraeme 12986: <p>Set <code class="varname">SGML_ENTRIES</code>
12987: to individual entries to be added to the SGML
1.1 grant 12988: catalog. These come in groups of three strings;
12989: see xmlcatmgr(1) for more information
12990: (specifically, arguments recognized by the 'add'
12991: action). Note that you will normally not use this
12992: variable.</p>
12993: </li>
12994:
12995: <li>
1.14 xtraeme 12996: <p>Set <code class="varname">XML_ENTRIES</code>
12997: to individual entries to be added to the XML
1.1 grant 12998: catalog. These come in groups of three strings;
12999: see xmlcatmgr(1) for more information
13000: (specifically, arguments recognized by the 'add'
13001: action). Note that you will normally not use this
13002: variable.</p>
13003: </li>
13004: </ol>
13005: </div>
13006: </div>
13007:
13008: <div class="sect2" lang="en" xml:lang="en">
13009: <div class="titlepage">
13010: <div>
13011: <div>
1.30 wiz 13012: <h3 class="title"><a name="mime-database" id=
1.38 dillo 13013: "mime-database"></a>15.5.13. Packages
1.30 wiz 13014: installing extensions to the MIME database</h3>
1.1 grant 13015: </div>
13016: </div>
13017: </div>
13018:
13019: <p>If a package provides extensions to the MIME
1.45 wiz 13020: database by installing <code xmlns=
13021: "http://www.w3.org/TR/xhtml1/transitional" class=
13022: "filename">.xml</code> files inside <code xmlns=
13023: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13024: "filename">${PREFIX}/share/mime/packages</code>, you
13025: need to take some extra steps to ensure that the
13026: database is kept consistent with respect to these new
13027: files:</p>
1.1 grant 13028:
13029: <div class="orderedlist">
13030: <ol type="1">
13031: <li>
1.45 wiz 13032: <p>Include <code xmlns=
13033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13034: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13035: (avoid using the <code xmlns=
13036: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13037: "filename">buildlink3.mk</code> file from this
13038: same directory, which is reserved for inclusion
1.45 wiz 13039: from other <code xmlns=
13040: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13041: "filename">buildlink3.mk</code> files). It takes
13042: care of rebuilding the MIME database at
13043: installation and deinstallation time, and
13044: disallows any access to it directly from the
1.1 grant 13045: package.</p>
13046: </li>
13047:
13048: <li>
13049: <p>Check the PLIST and remove any entries under
1.45 wiz 13050: the <code xmlns=
13051: "http://www.w3.org/TR/xhtml1/transitional" class=
13052: "filename">share/mime</code> directory,
13053: <span class="emphasis"><em>except</em></span> for
13054: files saved under <code xmlns=
13055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13056: "filename">share/mime/packages</code>. The former
1.1 grant 13057: are handled automatically by the
1.47 ! reed 13058: update-mime-database program, but the latter are
1.1 grant 13059: package-dependent and must be removed by the
13060: package that installed them in the first
13061: place.</p>
13062: </li>
13063:
13064: <li>
1.45 wiz 13065: <p>Remove any <code xmlns=
13066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13067: "filename">share/mime/*</code> directories from
13068: the PLIST. They will be handled by the
1.1 grant 13069: shared-mime-info package.</p>
13070: </li>
13071: </ol>
13072: </div>
13073: </div>
13074:
13075: <div class="sect2" lang="en" xml:lang="en">
13076: <div class="titlepage">
13077: <div>
13078: <div>
1.30 wiz 13079: <h3 class="title"><a name="intltool" id=
1.38 dillo 13080: "intltool"></a>15.5.14. Packages using
1.1 grant 13081: intltool</h3>
13082: </div>
13083: </div>
13084: </div>
13085:
13086: <p>If a package uses intltool during its build, include
1.45 wiz 13087: the <code xmlns=
13088: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13089: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13090: file, which forces it to use the intltool package
13091: provided by pkgsrc, instead of the one bundled with the
13092: distribution file.</p>
13093:
13094: <p>This tracks intltool's build-time dependencies and
13095: uses the latest available version; this way, the
13096: package benefits of any bug fixes that may have
13097: appeared since it was released.</p>
13098: </div>
1.18 xtraeme 13099:
13100: <div class="sect2" lang="en" xml:lang="en">
13101: <div class="titlepage">
13102: <div>
13103: <div>
1.30 wiz 13104: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 13105: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13106: installing startup scripts</h3>
1.18 xtraeme 13107: </div>
13108: </div>
13109: </div>
13110:
13111: <p>If a package contains a rc.d script, it won't be
13112: copied into the startup directory by default, but you
13113: can enable it, by adding the option <code class=
1.45 wiz 13114: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13115: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13116: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13117: the scripts into <code xmlns=
13118: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13119: "filename">/etc/rc.d</code> when a package is
13120: installed, and it will automatically remove the scripts
13121: when the package is deinstalled.</p>
13122: </div>
1.1 grant 13123: </div>
13124:
13125: <div class="sect1" lang="en" xml:lang="en">
13126: <div class="titlepage">
13127: <div>
13128: <div>
13129: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13130: "feedback-to-author" id=
1.38 dillo 13131: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13132: author</h2>
1.1 grant 13133: </div>
13134: </div>
13135: </div>
13136:
13137: <p>If you have found any bugs in the package you make
13138: available, if you had to do special steps to make it run
13139: under NetBSD or if you enhanced the software in various
13140: other ways, be sure to report these changes back to the
13141: original author of the program! With that kind of
13142: support, the next release of the program can incorporate
13143: these fixes, and people not using the NetBSD packages
13144: system can win from your efforts.</p>
13145:
13146: <p>Support the idea of free software!</p>
13147: </div>
13148: </div>
13149:
13150: <div class="chapter" lang="en" xml:lang="en">
13151: <div class="titlepage">
13152: <div>
13153: <div>
13154: <h2 class="title"><a name="debug" id=
1.38 dillo 13155: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13156: </div>
13157: </div>
13158: </div>
13159:
13160: <p>To check out all the gotchas when building a package,
13161: here are the steps that I do in order to get a package
13162: working. Please note this is basically the same as what was
13163: explained in the previous sections, only with some
13164: debugging aids.</p>
13165:
13166: <div class="itemizedlist">
13167: <ul type="disc">
13168: <li>
1.14 xtraeme 13169: <p>Be sure to set <code class=
1.45 wiz 13170: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13171: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13172: "filename">/etc/mk.conf</code></p>
1.1 grant 13173: </li>
13174:
13175: <li>
13176: <p>Install <a xmlns=
13177: "http://www.w3.org/TR/xhtml1/transitional" href=
13178: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13179: target="_top"><code xmlns="" class=
13180: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13181: directory for a new package, change into it, then run
13182: <span><strong class=
13183: "command">url2pkg</strong></span>:</p>
1.1 grant 13184: <pre class="screen">
1.14 xtraeme 13185: <code class="prompt">%</code> <strong class=
13186: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13187: "replaceable"><code>category</code></em>/<em class=
13188: "replaceable"><code>examplepkg</code></em></code></strong>
13189: <code class="prompt">%</code> <strong class=
13190: "userinput"><code>cd /usr/pkgsrc/<em class=
13191: "replaceable"><code>category</code></em>/<em class=
13192: "replaceable"><code>examplepkg</code></em></code></strong>
13193: <code class="prompt">%</code> <strong class=
13194: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13195: </pre>
13196: </li>
13197:
13198: <li>
1.45 wiz 13199: <p>Edit the <code xmlns=
13200: "http://www.w3.org/TR/xhtml1/transitional" class=
13201: "filename">Makefile</code> as requested.</p>
1.1 grant 13202: </li>
13203:
13204: <li>
1.45 wiz 13205: <p>Fill in the <code xmlns=
13206: "http://www.w3.org/TR/xhtml1/transitional" class=
13207: "filename">DESCR</code> file</p>
1.1 grant 13208: </li>
13209:
13210: <li>
1.14 xtraeme 13211: <p>Run <span><strong class="command">make
13212: configure</strong></span></p>
1.1 grant 13213: </li>
13214:
13215: <li>
13216: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13217: and the configure step to the package's <code xmlns=
13218: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13219: "filename">Makefile</code>.</p>
1.1 grant 13220: </li>
13221:
13222: <li>
13223: <p>Make the package compile, doing multiple rounds
13224: of</p>
13225: <pre class="screen">
1.14 xtraeme 13226: <code class="prompt">%</code> <strong class=
13227: "userinput"><code>make</code></strong>
13228: <code class="prompt">%</code> <strong class=
13229: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13230: <code class="prompt">%</code> <strong class=
13231: "userinput"><code>mkpatches</code></strong>
13232: <code class="prompt">%</code> <strong class=
13233: "userinput"><code>patchdiff</code></strong>
13234: <code class="prompt">%</code> <strong class=
13235: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13236: <code class="prompt">%</code> <strong class=
13237: "userinput"><code>make mps</code></strong>
13238: <code class="prompt">%</code> <strong class=
13239: "userinput"><code>make clean</code></strong>
1.1 grant 13240: </pre>
13241:
13242: <p>Doing as non-root user will ensure that no files
13243: are modified that shouldn't be, especially during the
1.14 xtraeme 13244: build phase. <span><strong class=
13245: "command">mkpatches</strong></span>,
13246: <span><strong class=
13247: "command">patchdiff</strong></span> and
13248: <span><strong class="command">pkgvi</strong></span>
13249: are from the <a xmlns=
1.1 grant 13250: "http://www.w3.org/TR/xhtml1/transitional" href=
13251: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13252: target="_top"><code xmlns="" class=
13253: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13254: </li>
13255:
13256: <li>
1.45 wiz 13257: <p>Look at the <code xmlns=
13258: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13259: "filename">Makefile</code>, fix if necessary; see
13260: <a href="#components.Makefile" title=
1.38 dillo 13261: "8.1. Makefile">Section 8.1,
1.45 wiz 13262: “<code xmlns=
13263: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13264: "filename">Makefile</code>”</a>.</p>
1.1 grant 13265: </li>
13266:
13267: <li>
1.45 wiz 13268: <p>Generate a <code xmlns=
13269: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13270: "filename">PLIST</code>:</p>
1.1 grant 13271: <pre class="screen">
1.14 xtraeme 13272: <code class="prompt">#</code> <strong class=
13273: "userinput"><code>make install</code></strong>
13274: <code class="prompt">#</code> <strong class=
13275: "userinput"><code>make print-PLIST >PLIST</code></strong>
13276: <code class="prompt">#</code> <strong class=
13277: "userinput"><code>make deinstall</code></strong>
13278: <code class="prompt">#</code> <strong class=
13279: "userinput"><code>make install</code></strong>
13280: <code class="prompt">#</code> <strong class=
13281: "userinput"><code>make deinstall</code></strong>
1.1 grant 13282: </pre>
13283:
1.45 wiz 13284: <p>You usually need to be <code xmlns=
13285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13286: "username">root</code> to do this. Look if there are
1.1 grant 13287: any files left:</p>
13288: <pre class="screen">
1.14 xtraeme 13289: <code class="prompt">#</code> <strong class=
13290: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13291: </pre>
13292:
13293: <p>If this reveals any files that are missing in
1.45 wiz 13294: <code xmlns=
13295: "http://www.w3.org/TR/xhtml1/transitional" class=
13296: "filename">PLIST</code>, add them.</p>
1.1 grant 13297: </li>
13298:
13299: <li>
1.45 wiz 13300: <p>Now that the <code xmlns=
13301: "http://www.w3.org/TR/xhtml1/transitional" class=
13302: "filename">PLIST</code> is OK, install the package
13303: again and make a binary package:</p>
1.1 grant 13304: <pre class="screen">
1.14 xtraeme 13305: <code class="prompt">#</code> <strong class=
13306: "userinput"><code>make reinstall</code></strong>
13307: <code class="prompt">#</code> <strong class=
13308: "userinput"><code>make package</code></strong>
1.1 grant 13309: </pre>
13310: </li>
13311:
13312: <li>
13313: <p>Delete the installed package:</p>
13314: <pre class="screen">
1.14 xtraeme 13315: <code class="prompt">#</code> <strong class=
13316: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13317: </pre>
13318: </li>
13319:
13320: <li>
1.14 xtraeme 13321: <p>Repeat the above <span><strong class=
13322: "command">make print-PLIST</strong></span> command,
13323: which shouldn't find anything now:</p>
1.1 grant 13324: <pre class="screen">
1.14 xtraeme 13325: <code class="prompt">#</code> <strong class=
13326: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13327: </pre>
13328: </li>
13329:
13330: <li>
13331: <p>Reinstall the binary package:</p>
13332: <pre class="screen">
1.14 xtraeme 13333: <code class="prompt">#</code> <strong class=
13334: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13335: </pre>
13336: </li>
13337:
13338: <li>
13339: <p>Play with it. Make sure everything works.</p>
13340: </li>
13341:
13342: <li>
1.14 xtraeme 13343: <p>Run <span><strong class=
13344: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 13345: "http://www.w3.org/TR/xhtml1/transitional" href=
13346: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13347: target="_top"><code xmlns="" class=
13348: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 13349: problems it reports:</p>
1.1 grant 13350: <pre class="screen">
1.14 xtraeme 13351: <code class="prompt">#</code> <strong class=
13352: "userinput"><code>pkglint</code></strong>
1.1 grant 13353: </pre>
13354: </li>
13355:
13356: <li>
13357: <p>Submit (or commit, if you have cvs access); see
13358: <a href="#submit" title=
1.38 dillo 13359: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 13360: <i>Submitting and Committing</i></a>.</p>
13361: </li>
13362: </ul>
13363: </div>
13364: </div>
13365:
13366: <div class="chapter" lang="en" xml:lang="en">
13367: <div class="titlepage">
13368: <div>
13369: <div>
13370: <h2 class="title"><a name="submit" id=
1.38 dillo 13371: "submit"></a>Chapter 17. Submitting and
1.1 grant 13372: Committing</h2>
13373: </div>
13374: </div>
13375: </div>
13376:
13377: <div class="toc">
13378: <p><b>Table of Contents</b></p>
13379:
13380: <dl>
1.30 wiz 13381: <dt><span class="sect1"><a href=
1.38 dillo 13382: "#submitting-your-package">17.1. Submitting your
1.30 wiz 13383: packages</a></span></dt>
1.1 grant 13384:
1.30 wiz 13385: <dt><span class="sect1"><a href=
1.41 wiz 13386: "#general-notes-for-changes">17.2. General notes when
13387: adding, updating, or removing packages</a></span></dt>
13388:
13389: <dt><span class="sect1"><a href=
13390: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 13391: package into CVS</a></span></dt>
1.1 grant 13392:
1.30 wiz 13393: <dt><span class="sect1"><a href=
1.41 wiz 13394: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 13395: version</a></span></dt>
1.1 grant 13396:
1.41 wiz 13397: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 13398: Moving a package in pkgsrc</a></span></dt>
1.1 grant 13399: </dl>
13400: </div>
13401:
13402: <div class="sect1" lang="en" xml:lang="en">
13403: <div class="titlepage">
13404: <div>
13405: <div>
13406: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13407: "submitting-your-package" id=
1.38 dillo 13408: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 13409: your packages</h2>
1.1 grant 13410: </div>
13411: </div>
13412: </div>
13413:
13414: <p>You have to separate between binary and
13415: “<span class="quote">normal</span>” (source)
13416: packages here:</p>
13417:
13418: <div class="itemizedlist">
13419: <ul type="disc">
13420: <li>
13421: <p>precompiled binary packages</p>
13422:
13423: <p>Our policy is that we accept binaries only from
13424: pkgsrc developers to guarantee that the packages
13425: don't contain any trojan horses etc. This is not to
1.13 hubertf 13426: annoy anyone but rather to protect our users!
1.1 grant 13427: You're still free to put up your home-made binary
1.13 hubertf 13428: packages and tell the world where to get them.
13429: NetBSD developers doing bulk builds and wanting to
13430: upload them please see <a href="#bulk-upload"
1.38 dillo 13431: title="6.3.8. Uploading results of a bulk build">
13432: Section 6.3.8, “Uploading results of a
1.13 hubertf 13433: bulk build”</a>.</p>
1.1 grant 13434: </li>
13435:
13436: <li>
13437: <p>packages</p>
13438:
13439: <p>First, check that your package is complete,
13440: compiles and runs well; see <a href="#debug" title=
1.38 dillo 13441: "Chapter 16. Debugging">Chapter 16,
1.1 grant 13442: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 13443: Next, generate an uuencoded gzipped <a href=
13444: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
13445: <span class="citerefentry"><span class=
13446: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 13447: preferably with all files in a single directory.
1.14 xtraeme 13448: Finally, <span><strong class=
13449: "command">send-pr</strong></span> with category
1.1 grant 13450: “<span class="quote">pkg</span>”, a
13451: synopsis which includes the package name and
13452: version number, a short description of your package
13453: (contents of the COMMENT variable or DESCR file are
13454: OK) and attach the archive to your PR.</p>
13455:
13456: <p>If you want to submit several packages, please
13457: send a separate PR for each one, it's easier for us
13458: to track things that way.</p>
13459:
13460: <p>Alternatively, you can also import new packages
13461: into pkgsrc-wip (“<span class="quote">pkgsrc
13462: work-in-progress</span>”); see the homepage
13463: at <a href="http://pkgsrc-wip.sourceforge.net/"
13464: target=
13465: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
13466: details.</p>
13467: </li>
13468: </ul>
13469: </div>
13470: </div>
13471:
13472: <div class="sect1" lang="en" xml:lang="en">
13473: <div class="titlepage">
13474: <div>
13475: <div>
13476: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13477: "general-notes-for-changes" id=
13478: "general-notes-for-changes"></a>17.2. General
13479: notes when adding, updating, or removing
13480: packages</h2>
13481: </div>
13482: </div>
13483: </div>
13484:
13485: <p>Please note all package additions, updates, moves, and
1.45 wiz 13486: removals in <code xmlns=
13487: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13488: "filename">pkgsrc/doc/CHANGES</code>. It's very important
13489: to keep this file up to date and conforming to the
13490: existing format, because it will be used by scripts to
13491: automatically update pages on <a href=
13492: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 13493: and other sites. Additionally, check the <code xmlns=
13494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13495: "filename">pkgsrc/doc/TODO</code> file and remove the
13496: entry for the package you updated or removed, in case it
13497: was mentioned there.</p>
13498:
13499: <p>There is a make target that helps in creating proper
1.45 wiz 13500: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13501: class="filename">CHANGES</code> entries:
1.41 wiz 13502: <span><strong class="command">make
13503: changes-entry</strong></span>. It uses the optional
13504: <code class="varname">CTYPE</code> and <code class=
13505: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 13506: usage is to first make sure that your <code xmlns=
13507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13508: "filename">CHANGES</code> file is up-to-date (to avoid
13509: having to resolve conflicts later-on) and then to
13510: <span><strong class="command">cd</strong></span> to the
13511: package directory. For package updates,
13512: <span><strong class="command">make
13513: changes-entry</strong></span> is enough. For new
13514: packages, or package moves or removals, set the
13515: <code class="varname">CTYPE</code> variable on the
13516: command line to "Added", "Moved", or "Removed". You can
13517: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 13518: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13519: class="filename">/etc/mk.conf</code> if your local login
13520: name is not the same as your NetBSD login name. Don't
13521: forget to commit the changes to <code xmlns=
13522: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13523: "filename">pkgsrc/doc/CHANGES</code>!</p>
13524: </div>
13525:
13526: <div class="sect1" lang="en" xml:lang="en">
13527: <div class="titlepage">
13528: <div>
13529: <div>
13530: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13531: "committing-importing" id=
1.41 wiz 13532: "committing-importing"></a>17.3. Committing:
1.30 wiz 13533: Importing a package into CVS</h2>
1.1 grant 13534: </div>
13535: </div>
13536: </div>
13537:
13538: <p>This section is only of interest for pkgsrc developers
13539: with write access to the pkgsrc repository. Please
13540: remember that cvs imports files relative to the current
13541: working directory, and that the pathname that you give
1.14 xtraeme 13542: the <span><strong class="command">cvs
13543: import</strong></span> command is so that it knows where
13544: to place the files in the repository. Newly created
13545: packages should be imported with a vendor tag of
13546: “<span class="quote">TNF</span>” and a
13547: release tag of “<span class=
13548: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 13549: <pre class="programlisting">
13550: % cd .../pkgsrc/category/pkgname
13551: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
13552: </pre>
13553:
13554: <p>Remember to move the directory from which you imported
13555: out of the way, or cvs will complain the next time you
13556: “<span class="quote">cvs update</span>” your
13557: source tree. Also don't forget to add the new package to
1.45 wiz 13558: the category's <code xmlns=
13559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13560: "filename">Makefile</code>.</p>
1.1 grant 13561:
13562: <p>The commit message of the initial import should
1.45 wiz 13563: include part of the <code xmlns=
13564: "http://www.w3.org/TR/xhtml1/transitional" class=
13565: "filename">DESCR</code> file, so people reading the
13566: mailing lists know what the package is/does.</p>
1.1 grant 13567:
13568: <p>For new packages, “<span class="quote">cvs
13569: import</span>” is preferred to “<span class=
13570: "quote">cvs add</span>” because the former gets
13571: everything with a single command, and provides a
13572: consistent tag.</p>
13573: </div>
13574:
13575: <div class="sect1" lang="en" xml:lang="en">
13576: <div class="titlepage">
13577: <div>
13578: <div>
13579: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13580: "updating-package" id=
1.41 wiz 13581: "updating-package"></a>17.4. Updating a
1.30 wiz 13582: package to a newer version</h2>
1.1 grant 13583: </div>
13584: </div>
13585: </div>
13586:
13587: <p>Please always put a concise, appropriate and relevant
13588: summary of the changes between old and new versions into
13589: the commit log when updating a package. There are various
13590: reasons for this:</p>
13591:
13592: <div class="itemizedlist">
13593: <ul type="disc">
13594: <li>
13595: <p>A URL is volatile, and can change over time. It
13596: may go away completely or its information may be
13597: overwritten by newer information.</p>
13598: </li>
13599:
13600: <li>
13601: <p>Having the change information between old and
13602: new versions in our CVS repository is very useful
13603: for people who use either cvs or anoncvs.</p>
13604: </li>
13605:
13606: <li>
13607: <p>Having the change information between old and
13608: new versions in our CVS repository is very useful
13609: for people who read the pkgsrc-changes mailing
13610: list, so that they can make tactical decisions
13611: about when to upgrade the package.</p>
13612: </li>
13613: </ul>
13614: </div>
13615:
1.18 xtraeme 13616: <p>Please also recognize that, just because a new version
1.1 grant 13617: of a package has been released, it should not
13618: automatically be upgraded in the CVS repository. We
13619: prefer to be conservative in the packages that are
13620: included in pkgsrc - development or beta packages are not
13621: really the best thing for most places in which pkgsrc is
13622: used. Please use your judgement about what should go into
13623: pkgsrc, and bear in mind that stability is to be
13624: preferred above new and possibly untested features.</p>
13625: </div>
13626:
13627: <div class="sect1" lang="en" xml:lang="en">
13628: <div class="titlepage">
13629: <div>
13630: <div>
13631: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13632: "moving-package" id=
1.41 wiz 13633: "moving-package"></a>17.5. Moving a package in
1.30 wiz 13634: pkgsrc</h2>
1.1 grant 13635: </div>
13636: </div>
13637: </div>
13638:
13639: <div class="orderedlist">
13640: <ol type="1">
13641: <li>
13642: <p>Make a copy of the directory somewhere else.</p>
13643: </li>
13644:
13645: <li>
13646: <p>Remove all CVS dirs.</p>
13647:
13648: <p>Alternatively to the first two steps you can
13649: also do:</p>
13650: <pre class="screen">
1.14 xtraeme 13651: <code class="prompt">%</code> <strong class=
13652: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 13653: </pre>
13654:
13655: <p>and use that for further work.</p>
13656: </li>
13657:
13658: <li>
1.14 xtraeme 13659: <p>Fix <code class="varname">CATEGORIES</code> and
13660: any <code class="varname">DEPENDS</code> paths that
13661: just did “<span class=
1.1 grant 13662: "quote">../package</span>” instead of
13663: “<span class=
13664: "quote">../../category/package</span>”.</p>
13665: </li>
13666:
13667: <li>
1.14 xtraeme 13668: <p><span><strong class="command">cvs
13669: import</strong></span> the modified package in the
13670: new place.</p>
1.1 grant 13671: </li>
13672:
13673: <li>
13674: <p>Check if any package depends on it:</p>
13675: <pre class="screen">
1.14 xtraeme 13676: <code class="prompt">%</code> <strong class=
13677: "userinput"><code>cd /usr/pkgsrc</code></strong>
13678: <code class="prompt">%</code> <strong class=
13679: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 13680: </pre>
13681: </li>
13682:
13683: <li>
13684: <p>Fix paths in packages from step 5 to point to
13685: new location.</p>
13686: </li>
13687:
13688: <li>
1.14 xtraeme 13689: <p><span><strong class="command">cvs rm
13690: (-f)</strong></span> the package at the old
13691: location.</p>
1.1 grant 13692: </li>
13693:
13694: <li>
1.45 wiz 13695: <p>Remove from <code xmlns=
13696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13697: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 13698: </li>
13699:
13700: <li>
1.45 wiz 13701: <p>Add to <code xmlns=
13702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13703: "filename">newcategory/Makefile</code>.</p>
1.1 grant 13704: </li>
13705:
13706: <li>
13707: <p>Commit the changed and removed files:</p>
13708: <pre class="screen">
1.14 xtraeme 13709: <code class="prompt">%</code> <strong class=
13710: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 13711: </pre>
13712:
13713: <p>(and any packages from step 5, of course).</p>
13714: </li>
13715: </ol>
13716: </div>
13717: </div>
13718: </div>
13719: </div>
13720:
13721: <div class="appendix" lang="en" xml:lang="en">
13722: <div class="titlepage">
13723: <div>
13724: <div>
13725: <h2 class="title"><a name="examples" id=
1.46 gdt 13726: "examples"></a>Appendix A. A simple example
1.1 grant 13727: package: bison</h2>
13728: </div>
13729: </div>
13730: </div>
13731:
13732: <div class="toc">
13733: <p><b>Table of Contents</b></p>
13734:
13735: <dl>
1.46 gdt 13736: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 13737: files</a></span></dt>
13738:
13739: <dd>
13740: <dl>
1.30 wiz 13741: <dt><span class="sect2"><a href=
1.46 gdt 13742: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 13743:
1.30 wiz 13744: <dt><span class="sect2"><a href=
1.46 gdt 13745: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 13746:
1.30 wiz 13747: <dt><span class="sect2"><a href=
1.46 gdt 13748: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 13749:
1.30 wiz 13750: <dt><span class="sect2"><a href=
1.46 gdt 13751: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 13752: package with <span><strong class=
1.14 xtraeme 13753: "command">pkglint</strong></span></a></span></dt>
1.1 grant 13754: </dl>
13755: </dd>
13756:
1.46 gdt 13757: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 13758: Steps for building, installing, packaging</a></span></dt>
1.1 grant 13759: </dl>
13760: </div>
13761:
13762: <p>We checked to find a piece of software that wasn't in the
13763: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 13764: would want to have <span><strong class=
13765: "command">bison</strong></span> when Berkeley
13766: <span><strong class="command">yacc</strong></span> is already
13767: present in the tree is beyond us, but it's useful for the
13768: purposes of this exercise.</p>
1.1 grant 13769:
13770: <div class="sect1" lang="en" xml:lang="en">
13771: <div class="titlepage">
13772: <div>
13773: <div>
13774: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13775: "example-files" id=
1.46 gdt 13776: "example-files"></a>A.1. files</h2>
1.1 grant 13777: </div>
13778: </div>
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-Makefile" id=
1.46 gdt 13786: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 13787: </div>
13788: </div>
13789: </div>
13790: <pre class="programlisting">
1.17 sketch 13791: # $NetBSD$
1.1 grant 13792: #
13793:
13794: DISTNAME= bison-1.25
13795: CATEGORIES= devel
13796: MASTER_SITES= ${MASTER_SITE_GNU}
13797:
13798: MAINTAINER= thorpej@NetBSD.org
13799: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
13800: COMMENT= GNU yacc clone
13801:
13802: GNU_CONFIGURE= yes
13803: INFO_FILES= bison.info
13804:
13805: .include "../../mk/bsd.pkg.mk"
13806: </pre>
13807: </div>
13808:
13809: <div class="sect2" lang="en" xml:lang="en">
13810: <div class="titlepage">
13811: <div>
13812: <div>
1.30 wiz 13813: <h3 class="title"><a name="example-descr" id=
1.46 gdt 13814: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 13815: </div>
13816: </div>
13817: </div>
13818: <pre class="programlisting">
13819: GNU version of yacc. Can make re-entrant parsers, and numerous other
13820: improvements. Why you would want this when Berkeley <a href=
13821: "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
13822: of the NetBSD source tree is beyond me.
13823: </pre>
13824: </div>
13825:
13826: <div class="sect2" lang="en" xml:lang="en">
13827: <div class="titlepage">
13828: <div>
13829: <div>
1.30 wiz 13830: <h3 class="title"><a name="example-plist" id=
1.46 gdt 13831: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 13832: </div>
13833: </div>
13834: </div>
13835: <pre class="programlisting">
1.17 sketch 13836: @comment $NetBSD$
1.1 grant 13837: bin/bison
13838: man/man1/bison.1.gz
13839: share/bison.simple
13840: share/bison.hairy
13841: </pre>
13842: </div>
13843:
13844: <div class="sect2" lang="en" xml:lang="en">
13845: <div class="titlepage">
13846: <div>
13847: <div>
1.30 wiz 13848: <h3 class="title"><a name=
13849: "checking-package-with-pkglint" id=
1.46 gdt 13850: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 13851: a package with <span><strong class=
1.14 xtraeme 13852: "command">pkglint</strong></span></h3>
1.1 grant 13853: </div>
13854: </div>
13855: </div>
13856:
13857: <p>The NetBSD package system comes with <a xmlns=
13858: "http://www.w3.org/TR/xhtml1/transitional" href=
13859: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13860: target="_top"><code xmlns="" class=
13861: "filename">pkgtools/pkglint</code></a> which helps to
13862: check the contents of these files. After installation it
13863: is quite easy to use, just change to the directory of the
1.20 ben 13864: package you wish to examine and execute
13865: <span><strong class=
13866: "command">pkglint</strong></span>:</p>
1.1 grant 13867: <pre class="screen">
1.14 xtraeme 13868: <code class="prompt">$</code> <strong class=
13869: "userinput"><code>pkglint</code></strong>
1.1 grant 13870: looks fine.
13871: </pre>
13872:
13873: <p>Depending on the supplied command line arguments (see
1.47 ! reed 13874: pkglint(1)), more verbose checks will be performed. Use
1.14 xtraeme 13875: e.g. <span><strong class="command">pkglint
13876: -v</strong></span> for a very verbose check.</p>
1.1 grant 13877: </div>
13878: </div>
13879:
13880: <div class="sect1" lang="en" xml:lang="en">
13881: <div class="titlepage">
13882: <div>
13883: <div>
13884: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13885: "steps-for-b-i-p" id=
1.46 gdt 13886: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 13887: installing, packaging</h2>
1.1 grant 13888: </div>
13889: </div>
13890: </div>
13891:
13892: <p>Create the directory where the package lives, plus any
13893: auxiliary directories:</p>
13894: <pre class="screen">
1.14 xtraeme 13895: <code class="prompt">#</code> <strong class=
13896: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
13897: <code class="prompt">#</code> <strong class=
13898: "userinput"><code>mkdir bison</code></strong>
13899: <code class="prompt">#</code> <strong class=
13900: "userinput"><code>cd bison</code></strong>
13901: <code class="prompt">#</code> <strong class=
13902: "userinput"><code>mkdir patches</code></strong>
1.1 grant 13903: </pre>
13904:
1.45 wiz 13905: <p>Create <code xmlns=
13906: "http://www.w3.org/TR/xhtml1/transitional" class=
13907: "filename">Makefile</code>, <code xmlns=
13908: "http://www.w3.org/TR/xhtml1/transitional" class=
13909: "filename">DESCR</code> and <code xmlns=
13910: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13911: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 13912: "Chapter 8. Package components - files, directories and contents">
13913: Chapter 8, <i>Package components - files, directories and
1.1 grant 13914: contents</i></a>) then continue with fetching the
13915: distfile:</p>
13916: <pre class="screen">
1.14 xtraeme 13917: <code class="prompt">#</code> <strong class=
13918: "userinput"><code>make fetch</code></strong>
1.1 grant 13919: >> bison-1.25.tar.gz doesn't seem to exist on this system.
13920: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
13921: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13922: ftp: Error retrieving file: 500 Internal error
13923:
13924: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
13925: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13926: ftp: Error retrieving file: 500 Internal error
13927:
13928: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
13929: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
13930: Successfully retrieved file.
13931: </pre>
13932:
1.45 wiz 13933: <p>Generate the checksum of the distfile into <code xmlns=
13934: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13935: "filename">distinfo</code>:</p>
1.1 grant 13936: <pre class="screen">
1.14 xtraeme 13937: <code class="prompt">#</code> <strong class=
13938: "userinput"><code>make makesum</code></strong>
1.1 grant 13939: </pre>
13940:
13941: <p>Now compile:</p>
13942: <pre class="screen">
1.14 xtraeme 13943: <code class="prompt">#</code> <strong class=
13944: "userinput"><code>make</code></strong>
1.1 grant 13945: >> Checksum OK for bison-1.25.tar.gz.
13946: ===> Extracting for bison-1.25
13947: ===> Patching for bison-1.25
13948: ===> Ignoring empty patch directory
13949: ===> Configuring for bison-1.25
13950: creating cache ./config.cache
13951: checking for gcc... cc
13952: checking whether we are using GNU C... yes
13953: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
13954: checking how to run the C preprocessor... cc -E
13955: checking for minix/config.h... no
13956: checking for POSIXized ISC... no
13957: checking whether cross-compiling... no
13958: checking for ANSI C header files... yes
13959: checking for string.h... yes
13960: checking for stdlib.h... yes
13961: checking for memory.h... yes
13962: checking for working const... yes
13963: checking for working alloca.h... no
13964: checking for alloca... yes
13965: checking for strerror... yes
13966: updating cache ./config.cache
13967: creating ./config.status
13968: creating Makefile
13969: ===> Building for bison-1.25
13970: 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
13971: 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
13972: 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
13973: 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
13974: 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
13975: 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
13976: 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
13977: 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
13978: 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
13979: 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
13980: 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
13981: 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
13982: 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
13983: 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
13984: 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
13985: 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
13986: 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
13987: 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
13988: 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
13989: 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
13990: 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
13991: 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
13992: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
13993: rm -f bison.s1
13994: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
13995: </pre>
13996:
13997: <p>Everything seems OK, so install the files:</p>
13998: <pre class="screen">
1.14 xtraeme 13999: <code class="prompt">#</code> <strong class=
14000: "userinput"><code>make install</code></strong>
1.1 grant 14001: >> Checksum OK for bison-1.25.tar.gz.
14002: ===> Installing for bison-1.25
14003: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14004: rm -f /usr/pkg/bin/bison
14005: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14006: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14007: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14008: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14009: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14010: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14011: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14012: ===> Registering installation for bison-1.25
14013: </pre>
14014:
14015: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14016: remove it with <span><strong class="command">pkg_delete
14017: bison</strong></span>. Should you decide that you want a
14018: binary package, do this now:</p>
1.1 grant 14019: <pre class="screen">
1.14 xtraeme 14020: <code class="prompt">#</code> <strong class=
14021: "userinput"><code>make package</code></strong>
1.1 grant 14022: >> Checksum OK for bison-1.25.tar.gz.
14023: ===> Building package for bison-1.25
14024: Creating package bison-1.25.tgz
14025: Registering depends:.
14026: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14027: </pre>
14028:
14029: <p>Now that you don't need the source and object files any
14030: more, clean up:</p>
14031: <pre class="screen">
1.14 xtraeme 14032: <code class="prompt">#</code> <strong class=
14033: "userinput"><code>make clean</code></strong>
1.1 grant 14034: ===> Cleaning for bison-1.25
14035: </pre>
14036: </div>
14037: </div>
14038:
14039: <div class="appendix" lang="en" xml:lang="en">
14040: <div class="titlepage">
14041: <div>
14042: <div>
14043: <h2 class="title"><a name="logs" id=
1.46 gdt 14044: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14045: </div>
14046: </div>
14047: </div>
14048:
14049: <div class="toc">
14050: <p><b>Table of Contents</b></p>
14051:
14052: <dl>
1.46 gdt 14053: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14054: Building figlet</a></span></dt>
14055:
1.46 gdt 14056: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14057: Packaging figlet</a></span></dt>
14058: </dl>
14059: </div>
14060:
14061: <div class="sect1" lang="en" xml:lang="en">
14062: <div class="titlepage">
14063: <div>
14064: <div>
14065: <h2 class="title" style="clear: both"><a name=
14066: "logs.building" id=
1.46 gdt 14067: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14068: </div>
14069: </div>
14070: </div>
14071: <pre class="screen">
1.14 xtraeme 14072: <code class="prompt">#</code> <strong class=
14073: "userinput"><code>make</code></strong>
1.1 grant 14074: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14075: => figlet221.tar.gz doesn't seem to exist on this system.
14076: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14077: => [172219 bytes]
14078: Connected to ftp.plig.net.
14079: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14080: 331 Guest login ok, send your complete e-mail address as password.
14081: 230-You are user #5 of 500 simultaneous users allowed.
14082: 230-
14083: 230- ___ _ _ _
14084: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14085: 230- | _| _| . |_| . | | | . |_| . | _| . |
14086: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14087: 230- |_| |_| |___| |___|
14088: 230-
14089: 230-** Welcome to ftp.plig.org **
14090: 230-
14091: 230-Please note that all transfers from this FTP site are logged. If you
14092: 230-do not like this, please disconnect now.
14093: 230-
14094: 230-This arhive is available via
14095: 230-
14096: 230-HTTP: http://ftp.plig.org/
14097: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14098: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14099: 230-
14100: 230-Please email comments, bug reports and requests for packages to be
14101: 230-mirrored to ftp-admin@plig.org.
14102: 230-
14103: 230-
14104: 230 Logged in anonymously.
14105: Remote system type is UNIX.
14106: Using binary mode to transfer files.
14107: 200 Type okay.
14108: 250 "/pub" is new cwd.
14109: 250-"/pub/figlet" is new cwd.
14110: 250-
14111: 250-Welcome to the figlet archive at ftp.figlet.org
14112: 250-
14113: 250- ftp://ftp.figlet.org/pub/figlet/
14114: 250-
14115: 250-The official FIGlet web page is:
14116: 250- http://www.figlet.org/
14117: 250-
14118: 250-If you have questions, please mailto:info@figlet.org. If you want to
14119: 250-contribute a font or something else, you can email us.
14120: 250
14121: 250 "/pub/figlet/program" is new cwd.
14122: 250 "/pub/figlet/program/unix" is new cwd.
14123: local: figlet221.tar.gz remote: figlet221.tar.gz
14124: 502 Unimplemented command.
14125: 227 Entering Passive Mode (195,40,6,41,246,104)
14126: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14127: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14128: 226 Transfer completed.
14129: 172219 bytes received in 00:02 (75.99 KB/s)
14130: 221 Goodbye.
14131: => Checksum OK for figlet221.tar.gz.
14132: ===> Extracting for figlet-2.2.1nb2
14133: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14134: ===> Patching for figlet-2.2.1nb2
14135: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14136: ===> Overriding tools for figlet-2.2.1nb2
14137: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14138: ===> Configuring for figlet-2.2.1nb2
14139: ===> Building for figlet-2.2.1nb2
14140: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14141: chmod a+x figlet
14142: gcc -O2 -o chkfont chkfont.c
14143: => Unwrapping files-to-be-installed.
1.14 xtraeme 14144: <code class="prompt">#</code>
14145: <code class="prompt">#</code> <strong class=
14146: "userinput"><code>make install</code></strong>
1.1 grant 14147: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14148: ===> Installing for figlet-2.2.1nb2
14149: install -d -o root -g wheel -m 755 /usr/pkg/bin
14150: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14151: mkdir -p /usr/pkg/share/figlet
14152: cp figlet /usr/pkg/bin
14153: cp chkfont /usr/pkg/bin
14154: chmod 555 figlist showfigfonts
14155: cp figlist /usr/pkg/bin
14156: cp showfigfonts /usr/pkg/bin
14157: cp fonts/*.flf /usr/pkg/share/figlet
14158: cp fonts/*.flc /usr/pkg/share/figlet
14159: cp figlet.6 /usr/pkg/man/man6
14160: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14161: <code class="prompt">#</code>
1.1 grant 14162: </pre>
14163: </div>
14164:
14165: <div class="sect1" lang="en" xml:lang="en">
14166: <div class="titlepage">
14167: <div>
14168: <div>
14169: <h2 class="title" style="clear: both"><a name=
14170: "logs.package" id=
1.46 gdt 14171: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14172: </div>
14173: </div>
14174: </div>
14175: <pre class="screen">
1.14 xtraeme 14176: <code class="prompt">#</code> <strong class=
14177: "userinput"><code>make package</code></strong>
1.1 grant 14178: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14179: ===> Packaging figlet-2.2.1nb2
14180: ===> Building binary package for figlet-2.2.1nb2
14181: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14182: Using SrcDir value of /usr/pkg
14183: Registering depends:.
1.14 xtraeme 14184: <code class="prompt">#</code>
1.1 grant 14185: </pre>
14186: </div>
14187: </div>
14188:
14189: <div class="appendix" lang="en" xml:lang="en">
14190: <div class="titlepage">
14191: <div>
14192: <div>
14193: <h2 class="title"><a name="ftp-layout" id=
1.46 gdt 14194: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14195: FTP server's package archive</h2>
14196: </div>
14197: </div>
14198: </div>
14199:
14200: <p>Layout for precompiled binary packages on
14201: ftp.NetBSD.org:</p>
14202: <pre class="programlisting">
14203: /pub/NetBSD/packages/
14204: distfiles/
14205:
14206: # Unpacked pkgsrc trees
14207: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14208: pkgsrc-2003Q4 -> N/A
14209: pkgsrc-2004Q1/pkgsrc
14210:
14211: # pkgsrc archives
14212: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14213: pkgsrc-2003Q4.tar.gz -> N/A
14214: pkgsrc-2004Q1.tar.gz -> N/A
14215:
14216: # Per pkgsrc-release/OS-release/arch package archives
14217: pkgsrc-2003Q4/
14218: NetBSD-1.6.2/
14219: i386/
14220: All/
14221: archivers/
14222: foo -> ../All/foo
14223: ...
14224: pkgsrc-2004Q1/
14225: NetBSD-1.6.2/
14226: i386/
14227: All/
14228: ...
14229: NetBSD-2.0/
14230: i386/
14231: All/
14232: ...
14233: SunOS-5.9/
14234: sparc/
14235: All/
14236: ...
14237: x86/
14238: All/
14239: ...
14240:
14241: # Per os-release package archive convenience links
14242: NetBSD-1.6.2 -> 1.6.2
14243: 1.6.2/
14244: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14245: m68k/
14246: All/
14247: archivers/
14248: foo -> ../All/foo
14249: ...
14250: amiga -> m68k
14251: atari -> m68k
14252: ...
14253:
14254: 2.0 -> NetBSD-2.0 # backward compat, historic
14255: NetBSD-2.0/
14256: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14257: SunOS-5.9/
14258: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14259: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
14260:
14261: </pre>
14262:
14263: <p>To create:</p>
14264:
14265: <div class="orderedlist">
14266: <ol type="1">
14267: <li>
14268: <p>Run bulk build, see <a href="#bulkbuild" title=
1.38 dillo 14269: "6.3. Doing a bulk build of all packages">Section
14270: 6.3, “Doing a bulk build of all
1.1 grant 14271: packages”</a></p>
14272: </li>
14273:
14274: <li>
14275: <p>Upload /usr/pkgsrc/packages to</p>
14276: <pre class="programlisting">
14277: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 14278: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 14279: `uname -s`-`uname -r`/ # OS & version
14280: `uname -p` # architecture
14281:
14282: </pre>
14283: </li>
14284:
14285: <li>
1.14 xtraeme 14286: <p>If necessary, create a symlink <span><strong class=
14287: "command">ln -s `uname -m` `uname -p`</strong></span>
14288: (amiga -> m68k, ...)</p>
1.1 grant 14289: </li>
14290: </ol>
14291: </div>
14292: </div>
1.2 hubertf 14293:
14294: <div class="appendix" lang="en" xml:lang="en">
14295: <div class="titlepage">
14296: <div>
14297: <div>
14298: <h2 class="title"><a name="editing" id=
1.46 gdt 14299: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 14300: for the pkgsrc guide</h2>
14301: </div>
14302: </div>
14303: </div>
14304:
14305: <div class="toc">
14306: <p><b>Table of Contents</b></p>
14307:
14308: <dl>
1.46 gdt 14309: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 14310: Targets</a></span></dt>
14311:
1.46 gdt 14312: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 14313: Procedure</a></span></dt>
14314: </dl>
14315: </div>
14316:
14317: <p>This section contains information on editing the pkgsrc
14318: guide itself.</p>
14319:
14320: <div class="sect1" lang="en" xml:lang="en">
14321: <div class="titlepage">
14322: <div>
14323: <div>
14324: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14325: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 14326: </div>
14327: </div>
14328: </div>
14329:
1.45 wiz 14330: <p>The pkgsrc guide's source code is stored in <code xmlns=
14331: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14332: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14333: are created from it:</p>
14334:
14335: <div class="itemizedlist">
14336: <ul type="disc">
14337: <li>
1.45 wiz 14338: <p><code xmlns=
14339: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14340: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14341: </li>
14342:
14343: <li>
1.45 wiz 14344: <p><code xmlns=
14345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14346: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 14347: </li>
14348:
14349: <li>
1.45 wiz 14350: <p><code xmlns=
14351: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14352: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 14353: the documentation on the NetBSD website will be built
14354: from pkgsrc and kept up to date on the web server
14355: itself. This means you <span class=
14356: "emphasis"><em>must</em></span> make sure that your
14357: changes haven't broken the build!</p>
14358: </li>
1.6 hubertf 14359:
14360: <li>
1.45 wiz 14361: <p><code xmlns=
14362: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14363: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 14364: PDF version of the pkgsrc guide.</p>
14365: </li>
14366:
14367: <li>
1.45 wiz 14368: <p><code xmlns=
14369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14370: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 14371: PostScript version of the pkgsrc guide.</p>
14372: </li>
1.2 hubertf 14373: </ul>
14374: </div>
14375: </div>
14376:
14377: <div class="sect1" lang="en" xml:lang="en">
14378: <div class="titlepage">
14379: <div>
14380: <div>
14381: <h2 class="title" style="clear: both"><a name=
1.30 wiz 14382: "procedure" id=
1.46 gdt 14383: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 14384: </div>
14385: </div>
14386: </div>
14387:
14388: <p>The procedure to edit the pkgsrc guide is:</p>
14389:
14390: <div class="itemizedlist">
14391: <ul type="disc">
14392: <li>
1.6 hubertf 14393: <p>Make sure you have the packages needed to
14394: re-generate the pkgsrc guide (and other XML-based
14395: NetBSD documentation) installed. These are
1.11 ben 14396: “<span class="quote">netbsd-doc</span>”
1.47 ! reed 14397: for creating the ASCII and HTML versions, and
1.6 hubertf 14398: “<span class=
1.47 ! reed 14399: "quote">netbsd-doc-print</span>” for the
! 14400: PostScript and PDF versions. You will need both
1.6 hubertf 14401: packages installed, to make sure documentation is
14402: consistent across all formats. The packages can be
1.45 wiz 14403: found in <code xmlns=
14404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14405: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 14406: <code xmlns=
14407: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14408: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 14409: </li>
14410:
14411: <li>
1.45 wiz 14412: <p>Edit the XML file(s) in <code xmlns=
14413: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14414: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 14415: </li>
14416:
14417: <li>
1.14 xtraeme 14418: <p>Run <span><strong class="command">make extract
14419: && make do-lint</strong></span> in
1.45 wiz 14420: <code xmlns=
14421: "http://www.w3.org/TR/xhtml1/transitional" class=
14422: "filename">pkgsrc/doc/guide</code> to check the XML
14423: syntax, and fix it if needed.</p>
1.4 hubertf 14424: </li>
14425:
14426: <li>
1.14 xtraeme 14427: <p>Run <span><strong class=
1.45 wiz 14428: "command">make</strong></span> in <code xmlns=
14429: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14430: "filename">pkgsrc/doc/guide</code> to build the HTML
14431: and ASCII version.</p>
1.2 hubertf 14432: </li>
14433:
14434: <li>
1.14 xtraeme 14435: <p>If all is well, run <span><strong class=
14436: "command">make install-doc</strong></span> to put the
1.45 wiz 14437: generated files into <code xmlns=
14438: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14439: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 14440: </li>
14441:
14442: <li>
1.14 xtraeme 14443: <p><span><strong class="command">cvs commit
14444: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 14445: </li>
14446:
14447: <li>
1.14 xtraeme 14448: <p><span><strong class="command">cvs commit -m
14449: re-generate
14450: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 14451: </li>
1.4 hubertf 14452:
14453: <li>
14454: <p>Until the webserver on www.NetBSD.org is really
14455: updated automatically to pick up changes to the
1.14 xtraeme 14456: pkgsrc guide automatically, also run
1.18 xtraeme 14457: <span><strong class="command">make install-htdocs
1.14 xtraeme 14458: HTDOCSDIR=../../../htdocs</strong></span> (or
14459: similar, adjust <code class=
14460: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 14461: </li>
14462:
14463: <li>
1.14 xtraeme 14464: <p><span><strong class="command">cvs commit
14465: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 14466: </li>
1.2 hubertf 14467: </ul>
14468: </div>
14469: </div>
14470: </div>
1.1 grant 14471: </div>
14472: </body>
14473: </html>
CVSweb <webmaster@jp.NetBSD.org>