Annotation of pkgsrc/doc/pkgsrc.html, revision 1.40
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.2 hubertf 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
142: "#platform-specific-notes">3.2. Platform specific
143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
1.38 dillo 224: <dt><span class="chapter"><a href="#configuring">5.
225: Configuring pkgsrc</a></span></dt>
226:
227: <dd>
228: <dl>
229: <dt><span class="sect1"><a href=
230: "#selecting-options">5.1. Selecting build
231: options</a></span></dt>
232: </dl>
233: </dd>
234:
235: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 236: binary packages</a></span></dt>
237:
238: <dd>
239: <dl>
1.30 wiz 240: <dt><span class="sect1"><a href=
1.38 dillo 241: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 242: single binary package</a></span></dt>
1.1 grant 243:
1.30 wiz 244: <dt><span class="sect1"><a href=
1.38 dillo 245: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 246: Settings for creation of binary
247: packages</a></span></dt>
248:
1.38 dillo 249: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 250: Doing a bulk build of all packages</a></span></dt>
251:
252: <dd>
253: <dl>
254: <dt><span class="sect2"><a href=
1.38 dillo 255: "#binary.configuration">6.3.1.
1.1 grant 256: Configuration</a></span></dt>
257:
258: <dt><span class="sect2"><a href=
1.38 dillo 259: "#other-environmental-considerations">6.3.2.
1.30 wiz 260: Other environmental
1.1 grant 261: considerations</a></span></dt>
262:
263: <dt><span class="sect2"><a href=
1.38 dillo 264: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 265:
266: <dt><span class="sect2"><a href=
1.38 dillo 267: "#what-it-does">6.3.4. What it
1.1 grant 268: does</a></span></dt>
269:
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 272: requirements</a></span></dt>
273:
274: <dt><span class="sect2"><a href=
1.38 dillo 275: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 276: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 277:
278: <dt><span class="sect2"><a href=
1.38 dillo 279: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 280: partial set of packages</a></span></dt>
1.13 hubertf 281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 284: bulk build</a></span></dt>
1.1 grant 285: </dl>
286: </dd>
287:
1.30 wiz 288: <dt><span class="sect1"><a href=
1.38 dillo 289: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 290: packages collection</a></span></dt>
1.1 grant 291:
292: <dd>
293: <dl>
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#cdpack-example">6.4.1. Example of
1.1 grant 296: cdpack</a></span></dt>
297: </dl>
298: </dd>
299: </dl>
300: </dd>
301:
1.38 dillo 302: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 303: Asked Questions</a></span></dt>
304:
305: <dd>
306: <dl>
1.30 wiz 307: <dt><span class="sect1"><a href=
1.38 dillo 308: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 309: lists for pkg-related discussion?</a></span></dt>
1.1 grant 310:
1.30 wiz 311: <dt><span class="sect1"><a href=
1.38 dillo 312: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 313: documentation?</a></span></dt>
1.1 grant 314:
1.5 hubertf 315: <dt><span class="sect1"><a href=
1.38 dillo 316: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 317: management (pkgtools)</a></span></dt>
1.1 grant 318:
1.30 wiz 319: <dt><span class="sect1"><a href=
1.38 dillo 320: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 321: non-root</a></span></dt>
322:
323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 325: when fetching distfiles?</a></span></dt>
326:
327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 329: XFree86 from pkgsrc?</a></span></dt>
330:
331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 333: X.org from pkgsrc?</a></span></dt>
1.1 grant 334:
1.30 wiz 335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 337: from behind a firewall</a></span></dt>
1.1 grant 338:
1.38 dillo 339: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 340: How do I tell <span><strong class="command">make
341: fetch</strong></span> to do passive
1.1 grant 342: FTP?</a></span></dt>
343:
1.30 wiz 344: <dt><span class="sect1"><a href=
1.38 dillo 345: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 346: distfiles at once</a></span></dt>
1.1 grant 347:
1.30 wiz 348: <dt><span class="sect1"><a href=
1.38 dillo 349: "#tmac.andoc-missing">7.11. What does
1.30 wiz 350: “<span class="quote">Don't know how to make
351: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 352: mean?</a></span></dt>
1.13 hubertf 353:
1.30 wiz 354: <dt><span class="sect1"><a href=
1.38 dillo 355: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 356: “<span class="quote">Could not find
1.14 xtraeme 357: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 358:
1.30 wiz 359: <dt><span class="sect1"><a href=
1.38 dillo 360: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 361: pkgsrc</a></span></dt>
1.1 grant 362:
1.38 dillo 363: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 364: How do I change the location of configuration
365: files?</a></span></dt>
1.1 grant 366:
367: <dt><span class="sect1"><a href=
1.38 dillo 368: "#audit-packages">7.15. Automated security
1.1 grant 369: checks</a></span></dt>
370: </dl>
371: </dd>
372: </dl>
373: </dd>
374:
1.2 hubertf 375: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 376: pkgsrc developer's guide</a></span></dt>
377:
378: <dd>
379: <dl>
1.38 dillo 380: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 381: Package components - files, directories and
382: contents</a></span></dt>
383:
384: <dd>
385: <dl>
386: <dt><span class="sect1"><a href=
1.38 dillo 387: "#components.Makefile">8.1. <code class=
1.27 rillig 388: "filename">Makefile</code></a></span></dt>
389:
390: <dt><span class="sect1"><a href=
1.38 dillo 391: "#components.distinfo">8.2. <code class=
1.27 rillig 392: "filename">distinfo</code></a></span></dt>
393:
394: <dt><span class="sect1"><a href=
1.38 dillo 395: "#components.patches">8.3.
1.27 rillig 396: patches/*</a></span></dt>
397:
1.30 wiz 398: <dt><span class="sect1"><a href=
1.38 dillo 399: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 400: files</a></span></dt>
1.27 rillig 401:
402: <dt><span class="sect1"><a href=
1.38 dillo 403: "#components.optional">8.5. Optional
1.27 rillig 404: files</a></span></dt>
405:
1.38 dillo 406: <dt><span class="sect1"><a href="#work-dir">8.6.
1.27 rillig 407: <code class="filename">work*</code></a></span></dt>
408:
1.38 dillo 409: <dt><span class="sect1"><a href="#files-dir">8.7.
1.27 rillig 410: <code class=
411: "filename">files/*</code></a></span></dt>
412: </dl>
413: </dd>
414:
1.38 dillo 415: <dt><span class="chapter"><a href="#makefile">9.
1.25 rillig 416: Programming in <code class=
417: "filename">Makefile</code>s</a></span></dt>
418:
419: <dd>
420: <dl>
421: <dt><span class="sect1"><a href=
1.38 dillo 422: "#makefile.variables">9.1. <code class=
1.25 rillig 423: "filename">Makefile</code>
424: variables</a></span></dt>
425:
1.27 rillig 426: <dd>
427: <dl>
428: <dt><span class="sect2"><a href=
1.38 dillo 429: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 430: conventions</a></span></dt>
431: </dl>
432: </dd>
433:
1.25 rillig 434: <dt><span class="sect1"><a href=
1.38 dillo 435: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 436:
437: <dd>
438: <dl>
439: <dt><span class="sect2"><a href=
1.38 dillo 440: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 441: list</a></span></dt>
442:
443: <dt><span class="sect2"><a href=
1.38 dillo 444: "#converting-internal-to-external">9.2.2.
1.30 wiz 445: Converting an internal list into an external
446: list</a></span></dt>
1.25 rillig 447:
448: <dt><span class="sect2"><a href=
1.38 dillo 449: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 450: variables to a shell command</a></span></dt>
1.27 rillig 451:
452: <dt><span class="sect2"><a href=
1.38 dillo 453: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 454: guideline</a></span></dt>
455:
456: <dt><span class="sect2"><a href=
1.38 dillo 457: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 458: for a bug in BSD Make</a></span></dt>
1.25 rillig 459: </dl>
460: </dd>
461: </dl>
462: </dd>
463:
1.38 dillo 464: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 465: issues</a></span></dt>
466:
467: <dd>
468: <dl>
1.38 dillo 469: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 470: ID</a></span></dt>
1.1 grant 471:
1.30 wiz 472: <dt><span class="sect1"><a href=
1.38 dillo 473: "#automatic-plist-generation">10.2. Semi-automatic
1.30 wiz 474: <code class="filename">PLIST</code>
1.14 xtraeme 475: generation</a></span></dt>
1.1 grant 476:
1.38 dillo 477: <dt><span class="sect1"><a href=
478: "#print-PLIST">10.3. Tweaking output of
479: <span><strong class="command">make
1.14 xtraeme 480: print-PLIST</strong></span></a></span></dt>
1.1 grant 481:
1.38 dillo 482: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 483: Variable substitution in PLIST</a></span></dt>
484:
1.30 wiz 485: <dt><span class="sect1"><a href=
1.38 dillo 486: "#manpage-compression">10.5.
1.1 grant 487: Manpage-compression</a></span></dt>
488:
1.30 wiz 489: <dt><span class="sect1"><a href=
1.38 dillo 490: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 491: <code class=
1.14 xtraeme 492: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 493:
1.30 wiz 494: <dt><span class="sect1"><a href=
1.38 dillo 495: "#platform-specific-plist">10.7. Platform specific
1.30 wiz 496: and differing PLISTs</a></span></dt>
1.1 grant 497:
498: <dt><span class="sect1"><a href=
1.38 dillo 499: "#faq.common-dirs">10.8. Sharing directories
500: between packages</a></span></dt>
1.1 grant 501: </dl>
502: </dd>
503:
1.38 dillo 504: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 505: Buildlink methodology</a></span></dt>
506:
507: <dd>
508: <dl>
1.30 wiz 509: <dt><span class="sect1"><a href=
1.38 dillo 510: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 511: packages to use buildlink3</a></span></dt>
1.1 grant 512:
1.30 wiz 513: <dt><span class="sect1"><a href=
1.38 dillo 514: "#creating-buildlink3.mk">11.2. Writing
1.30 wiz 515: <code class="filename">buildlink3.mk</code>
1.14 xtraeme 516: files</a></span></dt>
1.1 grant 517:
518: <dd>
519: <dl>
520: <dt><span class="sect2"><a href=
1.38 dillo 521: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 522: buildlink3.mk file</a></span></dt>
1.1 grant 523:
524: <dt><span class="sect2"><a href=
1.38 dillo 525: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 526: <code class=
1.14 xtraeme 527: "varname">BUILDLINK_DEPENDS.<em class=
528: "replaceable"><code>pkg</code></em></code> in
529: <code class="filename">buildlink3.mk</code>
1.1 grant 530: files</a></span></dt>
531: </dl>
532: </dd>
533:
1.30 wiz 534: <dt><span class="sect1"><a href=
1.38 dillo 535: "#writing-builtin.mk">11.3. Writing <code class=
1.30 wiz 536: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 537:
538: <dd>
539: <dl>
540: <dt><span class="sect2"><a href=
1.38 dillo 541: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30 wiz 542: <code class="filename">builtin.mk</code>
1.1 grant 543: file</a></span></dt>
544:
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 547: preferences for native or pkgsrc
548: software</a></span></dt>
1.1 grant 549: </dl>
550: </dd>
551: </dl>
552: </dd>
553:
1.38 dillo 554: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 555: pkginstall framework</a></span></dt>
556:
557: <dd>
558: <dl>
559: <dt><span class="sect1"><a href=
1.38 dillo 560: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 561: directories outside the installation
562: prefix</a></span></dt>
563:
564: <dd>
565: <dl>
566: <dt><span class="sect2"><a href=
1.38 dillo 567: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 568: manipulation</a></span></dt>
569:
570: <dt><span class="sect2"><a href=
1.38 dillo 571: "#files-outside-prefix">12.1.2. File
1.35 jmmv 572: manipulation</a></span></dt>
573: </dl>
574: </dd>
575:
1.38 dillo 576: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 577: Configuration files</a></span></dt>
578:
579: <dd>
580: <dl>
581: <dt><span class="sect2"><a href=
1.38 dillo 582: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 583: <code class="varname">PKG_SYSCONFDIR</code> is
584: set</a></span></dt>
585:
586: <dt><span class="sect2"><a href=
1.38 dillo 587: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 588: software were configuration files
589: are</a></span></dt>
590:
591: <dt><span class="sect2"><a href=
1.38 dillo 592: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 593: installations</a></span></dt>
594:
595: <dt><span class="sect2"><a href=
1.38 dillo 596: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 597: handling of configuration files</a></span></dt>
598: </dl>
599: </dd>
600:
601: <dt><span class="sect1"><a href=
1.38 dillo 602: "#rcd-scripts">12.3. System startup
1.35 jmmv 603: scripts</a></span></dt>
604:
605: <dd>
606: <dl>
607: <dt><span class="sect2"><a href=
1.38 dillo 608: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 609: handling of system startup
610: scripts</a></span></dt>
611: </dl>
612: </dd>
613:
614: <dt><span class="sect1"><a href=
1.38 dillo 615: "#users-and-groups">12.4. System users and
1.35 jmmv 616: groups</a></span></dt>
617:
1.38 dillo 618: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 619: System shells</a></span></dt>
620:
621: <dd>
622: <dl>
623: <dt><span class="sect2"><a href=
1.38 dillo 624: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 625: configuration files</a></span></dt>
626: </dl>
627: </dd>
628: </dl>
629: </dd>
630:
1.38 dillo 631: <dt><span class="chapter"><a href="#options">13.
1.1 grant 632: Options handling</a></span></dt>
633:
634: <dd>
635: <dl>
1.30 wiz 636: <dt><span class="sect1"><a href=
1.38 dillo 637: "#global-default-options">13.1. Global default
1.30 wiz 638: options</a></span></dt>
1.1 grant 639:
1.30 wiz 640: <dt><span class="sect1"><a href=
1.38 dillo 641: "#converting-to-options">13.2. Converting packages
1.30 wiz 642: to use <code class=
1.14 xtraeme 643: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 644: </dl>
645: </dd>
646:
1.38 dillo 647: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 648: build process</a></span></dt>
649:
650: <dd>
651: <dl>
652: <dt><span class="sect1"><a href=
1.38 dillo 653: "#build.prefix">14.1. Program
1.1 grant 654: location</a></span></dt>
655:
1.30 wiz 656: <dt><span class="sect1"><a href=
1.38 dillo 657: "#main-targets">14.2. Main targets</a></span></dt>
1.1 grant 658:
659: <dt><span class="sect1"><a href=
1.38 dillo 660: "#build.helpful-targets">14.3. Other helpful
1.1 grant 661: targets</a></span></dt>
662: </dl>
663: </dd>
664:
1.38 dillo 665: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 666: fixes for packages</a></span></dt>
667:
668: <dd>
669: <dl>
1.30 wiz 670: <dt><span class="sect1"><a href=
1.38 dillo 671: "#general-operation">15.1. General
1.30 wiz 672: operation</a></span></dt>
1.1 grant 673:
674: <dd>
675: <dl>
676: <dt><span class="sect2"><a href=
1.38 dillo 677: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 678: pull in variables from
679: /etc/mk.conf</a></span></dt>
1.1 grant 680:
681: <dt><span class="sect2"><a href=
1.38 dillo 682: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 683: to install documentation</a></span></dt>
684:
685: <dt><span class="sect2"><a href=
1.38 dillo 686: "#restricted-packages">15.1.3. Restricted
1.1 grant 687: packages</a></span></dt>
688:
689: <dt><span class="sect2"><a href=
1.38 dillo 690: "#dependencies">15.1.4. Handling
1.1 grant 691: dependencies</a></span></dt>
692:
693: <dt><span class="sect2"><a href=
1.38 dillo 694: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 695: other packages</a></span></dt>
696:
697: <dt><span class="sect2"><a href=
1.38 dillo 698: "#not-building-packages">15.1.6. Packages that
1.30 wiz 699: cannot or should not be built</a></span></dt>
1.1 grant 700:
701: <dt><span class="sect2"><a href=
1.38 dillo 702: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 703: should not be deleted, once
704: installed</a></span></dt>
1.1 grant 705:
706: <dt><span class="sect2"><a href=
1.38 dillo 707: "#security-handling">15.1.8. Handling packages
1.1 grant 708: with security problems</a></span></dt>
709:
710: <dt><span class="sect2"><a href=
1.38 dillo 711: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 712: bugs</a></span></dt>
713:
714: <dt><span class="sect2"><a href=
1.38 dillo 715: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 716: incrementing versions when fixing an existing
1.1 grant 717: package</a></span></dt>
718:
719: <dt><span class="sect2"><a href=
1.38 dillo 720: "#portability-of-packages">15.1.11. Portability
1.30 wiz 721: of packages</a></span></dt>
1.1 grant 722: </dl>
723: </dd>
724:
1.30 wiz 725: <dt><span class="sect1"><a href=
1.38 dillo 726: "#downloading-issues">15.2. Possible downloading
1.30 wiz 727: issues</a></span></dt>
1.1 grant 728:
729: <dd>
730: <dl>
731: <dt><span class="sect2"><a href=
1.38 dillo 732: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 733: distfiles aren't available for plain
1.1 grant 734: downloading</a></span></dt>
735:
736: <dt><span class="sect2"><a href=
1.38 dillo 737: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 738: handle modified distfiles with the 'old'
739: name</a></span></dt>
1.1 grant 740: </dl>
741: </dd>
742:
1.30 wiz 743: <dt><span class="sect1"><a href=
1.38 dillo 744: "#configuration-gotchas">15.3. Configuration
1.30 wiz 745: gotchas</a></span></dt>
1.1 grant 746:
747: <dd>
748: <dl>
749: <dt><span class="sect2"><a href=
1.38 dillo 750: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 751: libtool</a></span></dt>
752:
753: <dt><span class="sect2"><a href=
1.38 dillo 754: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 755: packages that already support
756: libtool</a></span></dt>
757:
758: <dt><span class="sect2"><a href=
1.38 dillo 759: "#autoconf-automake">15.3.3. GNU
1.1 grant 760: Autoconf/Automake</a></span></dt>
761: </dl>
762: </dd>
763:
1.30 wiz 764: <dt><span class="sect1"><a href=
1.38 dillo 765: "#building-considerations">15.4. Building
1.30 wiz 766: considerations</a></span></dt>
1.1 grant 767:
768: <dd>
769: <dl>
770: <dt><span class="sect2"><a href=
1.38 dillo 771: "#cpp-defines">15.4.1. CPP
1.1 grant 772: defines</a></span></dt>
773: </dl>
774: </dd>
775:
1.30 wiz 776: <dt><span class="sect1"><a href=
1.38 dillo 777: "#package-specific-actions">15.5. Package specific
1.30 wiz 778: actions</a></span></dt>
1.1 grant 779:
780: <dd>
781: <dl>
782: <dt><span class="sect2"><a href=
1.38 dillo 783: "#user-interaction">15.5.1. User
1.2 hubertf 784: interaction</a></span></dt>
1.1 grant 785:
786: <dt><span class="sect2"><a href=
1.38 dillo 787: "#handling-licenses">15.5.2. Handling
1.1 grant 788: licenses</a></span></dt>
789:
790: <dt><span class="sect2"><a href=
1.38 dillo 791: "#installing-score-files">15.5.3. Installing
1.30 wiz 792: score files</a></span></dt>
1.1 grant 793:
794: <dt><span class="sect2"><a href=
1.38 dillo 795: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 796: perl scripts</a></span></dt>
1.1 grant 797:
798: <dt><span class="sect2"><a href=
1.38 dillo 799: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 800: hardcoded paths to other
801: interpreters</a></span></dt>
1.1 grant 802:
803: <dt><span class="sect2"><a href=
1.38 dillo 804: "#perl-modules">15.5.6. Packages installing
1.30 wiz 805: perl modules</a></span></dt>
1.1 grant 806:
807: <dt><span class="sect2"><a href=
1.38 dillo 808: "#faq.info-files">15.5.7. Packages installing
1.1 grant 809: info files</a></span></dt>
810:
811: <dt><span class="sect2"><a href=
1.38 dillo 812: "#gconf2-data-files">15.5.8. Packages
1.30 wiz 813: installing GConf2 data files</a></span></dt>
1.1 grant 814:
815: <dt><span class="sect2"><a href=
1.38 dillo 816: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 817: installing scrollkeeper data
818: files</a></span></dt>
1.1 grant 819:
820: <dt><span class="sect2"><a href=
1.38 dillo 821: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 822: fonts</a></span></dt>
823:
824: <dt><span class="sect2"><a href=
1.38 dillo 825: "#gtk2-modules">15.5.11. Packages installing
1.30 wiz 826: GTK2 modules</a></span></dt>
1.1 grant 827:
828: <dt><span class="sect2"><a href=
1.38 dillo 829: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 830: SGML or XML data</a></span></dt>
1.1 grant 831:
832: <dt><span class="sect2"><a href=
1.38 dillo 833: "#mime-database">15.5.13. Packages installing
1.1 grant 834: extensions to the MIME database</a></span></dt>
835:
836: <dt><span class="sect2"><a href=
1.38 dillo 837: "#intltool">15.5.14. Packages using
1.1 grant 838: intltool</a></span></dt>
1.18 xtraeme 839:
840: <dt><span class="sect2"><a href=
1.38 dillo 841: "#startup-scripts">15.5.15. Packages installing
1.18 xtraeme 842: startup scripts</a></span></dt>
1.1 grant 843: </dl>
844: </dd>
845:
1.30 wiz 846: <dt><span class="sect1"><a href=
1.38 dillo 847: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 848: author</a></span></dt>
1.1 grant 849: </dl>
850: </dd>
851:
1.38 dillo 852: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 853: Debugging</a></span></dt>
854:
1.38 dillo 855: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 856: Submitting and Committing</a></span></dt>
857:
858: <dd>
859: <dl>
1.30 wiz 860: <dt><span class="sect1"><a href=
1.38 dillo 861: "#submitting-your-package">17.1. Submitting your
1.30 wiz 862: packages</a></span></dt>
1.1 grant 863:
1.30 wiz 864: <dt><span class="sect1"><a href=
1.38 dillo 865: "#committing-importing">17.2. Committing: Importing
1.30 wiz 866: a package into CVS</a></span></dt>
1.1 grant 867:
1.30 wiz 868: <dt><span class="sect1"><a href=
1.38 dillo 869: "#updating-package">17.3. Updating a package to a
1.30 wiz 870: newer version</a></span></dt>
1.1 grant 871:
1.30 wiz 872: <dt><span class="sect1"><a href=
1.38 dillo 873: "#moving-package">17.4. Moving a package in
1.30 wiz 874: pkgsrc</a></span></dt>
1.1 grant 875: </dl>
876: </dd>
877: </dl>
878: </dd>
879:
880: <dt><span class="appendix"><a href="#examples">A. A simple
881: example package: bison</a></span></dt>
882:
883: <dd>
884: <dl>
1.30 wiz 885: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 886: files</a></span></dt>
887:
888: <dd>
889: <dl>
1.30 wiz 890: <dt><span class="sect2"><a href=
891: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 892:
1.30 wiz 893: <dt><span class="sect2"><a href=
894: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 895:
1.30 wiz 896: <dt><span class="sect2"><a href=
897: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 898:
1.30 wiz 899: <dt><span class="sect2"><a href=
900: "#checking-package-with-pkglint">A.1.4. Checking a
901: package with <span><strong class=
1.14 xtraeme 902: "command">pkglint</strong></span></a></span></dt>
1.1 grant 903: </dl>
904: </dd>
905:
1.30 wiz 906: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
907: Steps for building, installing,
908: packaging</a></span></dt>
1.1 grant 909: </dl>
910: </dd>
911:
912: <dt><span class="appendix"><a href="#logs">B. Build
913: logs</a></span></dt>
914:
915: <dd>
916: <dl>
917: <dt><span class="sect1"><a href="#logs.building">B.1.
918: Building figlet</a></span></dt>
919:
920: <dt><span class="sect1"><a href="#logs.package">B.2.
921: Packaging figlet</a></span></dt>
922: </dl>
923: </dd>
924:
925: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
926: of the FTP server's package archive</a></span></dt>
1.2 hubertf 927:
928: <dt><span class="appendix"><a href="#editing">D. Editing
929: guidelines for the pkgsrc guide</a></span></dt>
930:
931: <dd>
932: <dl>
1.30 wiz 933: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 934: Targets</a></span></dt>
935:
1.30 wiz 936: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 937: Procedure</a></span></dt>
938: </dl>
939: </dd>
1.1 grant 940: </dl>
941: </div>
942:
943: <div class="chapter" lang="en" xml:lang="en">
944: <div class="titlepage">
945: <div>
946: <div>
947: <h2 class="title"><a name="introduction" id=
948: "introduction"></a>Chapter 1. Introduction</h2>
949: </div>
950: </div>
951: </div>
952:
953: <div class="toc">
954: <p><b>Table of Contents</b></p>
955:
956: <dl>
1.30 wiz 957: <dt><span class="sect1"><a href=
958: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 959:
960: <dt><span class="sect1"><a href="#overview">1.2.
961: Overview</a></span></dt>
962:
963: <dt><span class="sect1"><a href="#terminology">1.3.
964: Terminology</a></span></dt>
965:
966: <dt><span class="sect1"><a href="#typography">1.4.
967: Typography</a></span></dt>
968: </dl>
969: </div>
970:
971: <div class="sect1" lang="en" xml:lang="en">
972: <div class="titlepage">
973: <div>
974: <div>
975: <h2 class="title" style="clear: both"><a name=
1.30 wiz 976: "introduction-section" id=
977: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 978: </div>
979: </div>
980: </div>
981:
982: <p>There is a lot of software freely available for Unix
983: based systems, which usually runs on NetBSD and other
984: Unix-flavoured systems, too, sometimes with some
985: modifications. The NetBSD Packages Collection (pkgsrc)
986: incorporates any such changes necessary to make that
987: software run, and makes the installation (and
988: de-installation) of the software package easy by means of a
989: single command.</p>
990:
991: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 992: the <span><strong class="command">pkg_*</strong></span>
993: tools so that installation and de-installation, printing of
994: an inventory of all installed packages and retrieval of
995: one-line comments or more verbose descriptions are all
996: simple.</p>
1.1 grant 997:
998: <p>pkgsrc currently contains several thousand packages,
999: including:</p>
1000:
1001: <div class="itemizedlist">
1002: <ul type="disc">
1003: <li>
1004: <p><a xmlns=
1005: "http://www.w3.org/TR/xhtml1/transitional" href=
1006: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 1007: class="pkgname">www/apache</a> - The Apache web
1008: server</p>
1.1 grant 1009: </li>
1010:
1011: <li>
1012: <p><a xmlns=
1013: "http://www.w3.org/TR/xhtml1/transitional" href=
1014: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 1015: class="pkgname">www/mozilla</a> - The Mozilla web
1016: browser</p>
1.1 grant 1017: </li>
1018:
1019: <li>
1020: <p><a xmlns=
1021: "http://www.w3.org/TR/xhtml1/transitional" href=
1022: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 1023: class="pkgname">meta-pkgs/gnome</a> - The GNOME
1024: Desktop Environment</p>
1.1 grant 1025: </li>
1026:
1027: <li>
1028: <p><a xmlns=
1029: "http://www.w3.org/TR/xhtml1/transitional" href=
1030: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 1031: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
1032: Environment</p>
1.1 grant 1033: </li>
1034: </ul>
1035: </div>
1036:
1037: <p>...just to name a few.</p>
1038:
1039: <p>pkgsrc has built-in support for handling varying
1040: dependencies, such as pthreads and X11, and extended
1041: features such as IPv6 support on a range of platforms.</p>
1042:
1043: <p>pkgsrc was derived from FreeBSD's ports system, and
1044: initially developed for NetBSD only. Since then, pkgsrc has
1045: grown a lot, and now supports the following platforms:</p>
1046:
1047: <div class="itemizedlist">
1048: <ul type="disc">
1049: <li>
1050: <p><a href="http://developer.apple.com/darwin/"
1051: target="_top">Darwin</a> (<a href=
1052: "http://www.apple.com/macosx/" target="_top">Mac OS
1053: X</a>)</p>
1054: </li>
1055:
1056: <li>
1.3 hubertf 1057: <p><a href="http://www.DragonFlyBSD.org/" target=
1058: "_top">DragonFlyBSD</a></p>
1059: </li>
1060:
1061: <li>
1.1 grant 1062: <p><a href="http://www.FreeBSD.org/" target=
1063: "_top">FreeBSD</a></p>
1064: </li>
1065:
1066: <li>
1.3 hubertf 1067: <p>Microsoft Windows, via <a href=
1068: "http://www.microsoft.com/windows/sfu/" target=
1069: "_top">Interix</a></p>
1.1 grant 1070: </li>
1071:
1072: <li>
1073: <p><a href="http://www.sgi.com/software/irix6.5/"
1074: target="_top">IRIX</a></p>
1075: </li>
1076:
1077: <li>
1078: <p><a href="http://www.linux.org/" target=
1079: "_top">Linux</a></p>
1080: </li>
1081:
1082: <li>
1083: <p><a href="http://www.NetBSD.org/" target=
1084: "_top">NetBSD</a> (of course)</p>
1085: </li>
1086:
1087: <li>
1.17 sketch 1088: <p><a href="http://h30097.www3.hp.com/" target=
1089: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1090: </li>
1091:
1092: <li>
1.1 grant 1093: <p><a href="http://www.openbsd.org/" target=
1094: "_top">OpenBSD</a></p>
1095: </li>
1096:
1097: <li>
1098: <p><a href="http://www.sun.com/solaris/" target=
1099: "_top">Solaris</a></p>
1100: </li>
1101: </ul>
1102: </div>
1103: </div>
1104:
1105: <div class="sect1" lang="en" xml:lang="en">
1106: <div class="titlepage">
1107: <div>
1108: <div>
1109: <h2 class="title" style="clear: both"><a name=
1110: "overview" id="overview"></a>1.2. Overview</h2>
1111: </div>
1112: </div>
1113: </div>
1114:
1115: <p>This document is divided into two parts. The first,
1116: <a href="#users-guide" title=
1.2 hubertf 1117: "Part I. The pkgsrc user's guide">The pkgsrc
1118: user's guide</a>, describes how one can use one of the
1119: packages in the Package Collection, either by installing a
1120: precompiled binary package, or by building one's own copy
1121: using the NetBSD package system. The second part, <a href=
1.1 grant 1122: "#developers-guide" title=
1.2 hubertf 1123: "Part II. The pkgsrc developer's guide">The
1124: pkgsrc developer's guide</a>, explains how to prepare a
1125: package so it can be easily built by other NetBSD users
1126: without knowing about the package's building details.</p>
1.1 grant 1127:
1128: <p>This document is available in various formats:</p>
1129:
1130: <div class="itemizedlist">
1131: <ul type="disc">
1132: <li>
1133: <p><a href="index.html" target="_top">HTML</a></p>
1134: </li>
1135:
1136: <li>
1137: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1138: </li>
1139:
1140: <li>
1141: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1142: </li>
1143:
1144: <li>
1145: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1146: </li>
1147: </ul>
1148: </div>
1149: </div>
1150:
1151: <div class="sect1" lang="en" xml:lang="en">
1152: <div class="titlepage">
1153: <div>
1154: <div>
1155: <h2 class="title" style="clear: both"><a name=
1156: "terminology" id=
1157: "terminology"></a>1.3. Terminology</h2>
1158: </div>
1159: </div>
1160: </div>
1161:
1162: <p>There has been a lot of talk about “<span class=
1163: "quote">ports</span>”, “<span class=
1164: "quote">packages</span>”, etc. so far. Here is a
1165: description of all the terminology used within this
1166: document.</p>
1167:
1168: <div class="variablelist">
1169: <dl>
1170: <dt><span class="term">Package</span></dt>
1171:
1172: <dd>
1173: <p>A set of files and building instructions that
1174: describe what's necessary to build a certain piece of
1175: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1176: stored under <code class=
1177: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1178: </dd>
1179:
1180: <dt><span class="term">The NetBSD package
1181: system</span></dt>
1182:
1183: <dd>
1184: <p>This is the former name of “<span class=
1185: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1186: NetBSD operating system and can be bootstrapped to
1187: run on non-NetBSD operating systems as well. It
1188: handles building (compiling), installing, and
1189: removing of packages.</p>
1.1 grant 1190: </dd>
1191:
1192: <dt><span class="term">Distfile</span></dt>
1193:
1194: <dd>
1195: <p>This term describes the file or files that are
1196: provided by the author of the piece of software to
1197: distribute his work. All the changes necessary to
1198: build on NetBSD are reflected in the corresponding
1199: package. Usually the distfile is in the form of a
1200: compressed tar-archive, but other types are possible,
1.14 xtraeme 1201: too. Distfiles are usually stored below <code class=
1202: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1203: </dd>
1204:
1205: <dt><span class="term">Port</span></dt>
1206:
1207: <dd>
1208: <p>This is the term used by FreeBSD and OpenBSD
1209: people for what we call a package. In NetBSD
1210: terminology, “<span class=
1211: "quote">port</span>” refers to a different
1212: architecture.</p>
1213: </dd>
1214:
1215: <dt><span class="term">Precompiled/binary
1216: package</span></dt>
1217:
1218: <dd>
1219: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1220: distfile and stuffed together in a single
1221: <code class="filename">.tgz</code> file so it can be
1222: installed on machines of the same machine
1223: architecture without the need to recompile. Packages
1224: are usually generated in <code class=
1225: "filename">/usr/pkgsrc/packages</code>; there is also
1226: an archive on <a href=
1.1 grant 1227: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1228: "_top">ftp.NetBSD.org</a>.</p>
1229:
1230: <p>Sometimes, this is referred to by the term
1231: “<span class="quote">package</span>” too,
1232: especially in the context of precompiled
1233: packages.</p>
1234: </dd>
1235:
1236: <dt><span class="term">Program</span></dt>
1237:
1238: <dd>
1239: <p>The piece of software to be installed which will
1240: be constructed from all the files in the Distfile by
1241: the actions defined in the corresponding package.</p>
1242: </dd>
1243: </dl>
1244: </div>
1245: </div>
1246:
1247: <div class="sect1" lang="en" xml:lang="en">
1248: <div class="titlepage">
1249: <div>
1250: <div>
1251: <h2 class="title" style="clear: both"><a name=
1252: "typography" id=
1253: "typography"></a>1.4. Typography</h2>
1254: </div>
1255: </div>
1256: </div>
1257:
1258: <p>When giving examples for commands, shell prompts are
1259: used to show if the command should/can be issued as root,
1260: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1261: privileges are sufficient. We use a <code class=
1262: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1263: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1264: assuming they use the C-shell or tcsh.</p>
1.1 grant 1265: </div>
1266: </div>
1267:
1268: <div class="part" lang="en" xml:lang="en">
1269: <div class="titlepage">
1270: <div>
1271: <div>
1272: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1273: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1274: </div>
1275: </div>
1276: </div>
1277:
1278: <div class="toc">
1279: <p><b>Table of Contents</b></p>
1280:
1281: <dl>
1282: <dt><span class="chapter"><a href="#getting">2. Where to
1283: get pkgsrc</a></span></dt>
1284:
1285: <dd>
1286: <dl>
1.30 wiz 1287: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1288: As tar file</a></span></dt>
1.1 grant 1289:
1.30 wiz 1290: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1291: SUP</a></span></dt>
1292:
1.30 wiz 1293: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1294: CVS</a></span></dt>
1295: </dl>
1296: </dd>
1297:
1298: <dt><span class="chapter"><a href="#platforms">3. Using
1299: pkgsrc on systems other than NetBSD</a></span></dt>
1300:
1301: <dd>
1302: <dl>
1.30 wiz 1303: <dt><span class="sect1"><a href=
1304: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1305: pkgsrc</a></span></dt>
1.1 grant 1306:
1.30 wiz 1307: <dt><span class="sect1"><a href=
1308: "#platform-specific-notes">3.2. Platform specific
1309: notes</a></span></dt>
1.1 grant 1310:
1311: <dd>
1312: <dl>
1.30 wiz 1313: <dt><span class="sect2"><a href="#darwin">3.2.1.
1314: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1315:
1.30 wiz 1316: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1317: FreeBSD</a></span></dt>
1.22 tv 1318:
1.30 wiz 1319: <dt><span class="sect2"><a href="#interix">3.2.3.
1320: Interix</a></span></dt>
1.1 grant 1321:
1.30 wiz 1322: <dt><span class="sect2"><a href="#irix">3.2.4.
1323: IRIX</a></span></dt>
1.1 grant 1324:
1.30 wiz 1325: <dt><span class="sect2"><a href="#linux">3.2.5.
1326: Linux</a></span></dt>
1.1 grant 1327:
1.30 wiz 1328: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1329: OpenBSD</a></span></dt>
1.1 grant 1330:
1.30 wiz 1331: <dt><span class="sect2"><a href="#solaris">3.2.7.
1332: Solaris</a></span></dt>
1.1 grant 1333: </dl>
1334: </dd>
1335: </dl>
1336: </dd>
1337:
1338: <dt><span class="chapter"><a href="#using">4. Using
1339: pkgsrc</a></span></dt>
1340:
1341: <dd>
1342: <dl>
1343: <dt><span class="sect1"><a href=
1344: "#getting-started">4.1. Working with binary
1345: packages</a></span></dt>
1346:
1347: <dd>
1348: <dl>
1349: <dt><span class="sect2"><a href=
1.30 wiz 1350: "#where-to-get-binary-packages">4.1.1. Where to
1351: get binary packages</a></span></dt>
1.1 grant 1352:
1353: <dt><span class="sect2"><a href=
1.30 wiz 1354: "#how-to-use-binary-packages">4.1.2. How to use
1355: binary packages</a></span></dt>
1.1 grant 1356:
1357: <dt><span class="sect2"><a href=
1.30 wiz 1358: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1359: warning</a></span></dt>
1360: </dl>
1361: </dd>
1362:
1.30 wiz 1363: <dt><span class="sect1"><a href=
1364: "#building-packages-from-source">4.2. Building
1365: packages from source</a></span></dt>
1.1 grant 1366:
1367: <dd>
1368: <dl>
1369: <dt><span class="sect2"><a href=
1.30 wiz 1370: "#requirements">4.2.1.
1371: Requirements</a></span></dt>
1.1 grant 1372:
1373: <dt><span class="sect2"><a href=
1.30 wiz 1374: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1375: distfiles</a></span></dt>
1376:
1377: <dt><span class="sect2"><a href=
1.30 wiz 1378: "#how-to-build-and-install">4.2.3. How to build
1379: and install</a></span></dt>
1.1 grant 1380:
1381: <dt><span class="sect2"><a href=
1.30 wiz 1382: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1383: compiler</a></span></dt>
1384: </dl>
1385: </dd>
1386: </dl>
1387: </dd>
1388:
1.38 dillo 1389: <dt><span class="chapter"><a href="#configuring">5.
1390: Configuring pkgsrc</a></span></dt>
1391:
1392: <dd>
1393: <dl>
1394: <dt><span class="sect1"><a href=
1395: "#selecting-options">5.1. Selecting build
1396: options</a></span></dt>
1397: </dl>
1398: </dd>
1399:
1400: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1401: binary packages</a></span></dt>
1402:
1403: <dd>
1404: <dl>
1.30 wiz 1405: <dt><span class="sect1"><a href=
1.38 dillo 1406: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1407: single binary package</a></span></dt>
1.1 grant 1408:
1.30 wiz 1409: <dt><span class="sect1"><a href=
1.38 dillo 1410: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1411: Settings for creation of binary
1412: packages</a></span></dt>
1413:
1.38 dillo 1414: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1415: Doing a bulk build of all packages</a></span></dt>
1416:
1417: <dd>
1418: <dl>
1419: <dt><span class="sect2"><a href=
1.38 dillo 1420: "#binary.configuration">6.3.1.
1.1 grant 1421: Configuration</a></span></dt>
1422:
1423: <dt><span class="sect2"><a href=
1.38 dillo 1424: "#other-environmental-considerations">6.3.2.
1.30 wiz 1425: Other environmental
1.1 grant 1426: considerations</a></span></dt>
1427:
1428: <dt><span class="sect2"><a href=
1.38 dillo 1429: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1430:
1431: <dt><span class="sect2"><a href=
1.38 dillo 1432: "#what-it-does">6.3.4. What it
1.30 wiz 1433: does</a></span></dt>
1.1 grant 1434:
1435: <dt><span class="sect2"><a href=
1.38 dillo 1436: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1437: requirements</a></span></dt>
1438:
1439: <dt><span class="sect2"><a href=
1.38 dillo 1440: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 1441: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1442:
1443: <dt><span class="sect2"><a href=
1.38 dillo 1444: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1445: partial set of packages</a></span></dt>
1.13 hubertf 1446:
1447: <dt><span class="sect2"><a href=
1.38 dillo 1448: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1449: build</a></span></dt>
1.1 grant 1450: </dl>
1451: </dd>
1452:
1.30 wiz 1453: <dt><span class="sect1"><a href=
1.38 dillo 1454: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1455: packages collection</a></span></dt>
1.1 grant 1456:
1457: <dd>
1458: <dl>
1459: <dt><span class="sect2"><a href=
1.38 dillo 1460: "#cdpack-example">6.4.1. Example of
1.1 grant 1461: cdpack</a></span></dt>
1462: </dl>
1463: </dd>
1464: </dl>
1465: </dd>
1466:
1.38 dillo 1467: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1468: Asked Questions</a></span></dt>
1469:
1470: <dd>
1471: <dl>
1.30 wiz 1472: <dt><span class="sect1"><a href=
1.38 dillo 1473: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1474: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1475:
1.38 dillo 1476: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1477: Where's the pkgviews documentation?</a></span></dt>
1478:
1.38 dillo 1479: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1480: Utilities for package management
1481: (pkgtools)</a></span></dt>
1482:
1.30 wiz 1483: <dt><span class="sect1"><a href=
1.38 dillo 1484: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1485: non-root</a></span></dt>
1.1 grant 1486:
1.30 wiz 1487: <dt><span class="sect1"><a href=
1.38 dillo 1488: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1489: fetching distfiles?</a></span></dt>
1.14 xtraeme 1490:
1.30 wiz 1491: <dt><span class="sect1"><a href=
1.38 dillo 1492: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1493: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1494:
1.30 wiz 1495: <dt><span class="sect1"><a href=
1.38 dillo 1496: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1497: from pkgsrc?</a></span></dt>
1.1 grant 1498:
1.30 wiz 1499: <dt><span class="sect1"><a href=
1.38 dillo 1500: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1501: behind a firewall</a></span></dt>
1.1 grant 1502:
1.38 dillo 1503: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1504: How do I tell <span><strong class="command">make
1.14 xtraeme 1505: fetch</strong></span> to do passive
1.1 grant 1506: FTP?</a></span></dt>
1507:
1.30 wiz 1508: <dt><span class="sect1"><a href=
1.38 dillo 1509: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1510: distfiles at once</a></span></dt>
1.1 grant 1511:
1.30 wiz 1512: <dt><span class="sect1"><a href=
1.38 dillo 1513: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1514: “<span class="quote">Don't know how to make
1515: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1516: mean?</a></span></dt>
1.13 hubertf 1517:
1.30 wiz 1518: <dt><span class="sect1"><a href=
1.38 dillo 1519: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1520: “<span class="quote">Could not find
1.14 xtraeme 1521: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1522:
1.30 wiz 1523: <dt><span class="sect1"><a href=
1.38 dillo 1524: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1525: pkgsrc</a></span></dt>
1.1 grant 1526:
1.38 dillo 1527: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1528: do I change the location of configuration
1529: files?</a></span></dt>
1.1 grant 1530:
1531: <dt><span class="sect1"><a href=
1.38 dillo 1532: "#audit-packages">7.15. Automated security
1.1 grant 1533: checks</a></span></dt>
1534: </dl>
1535: </dd>
1536: </dl>
1537: </div>
1538:
1539: <div class="chapter" lang="en" xml:lang="en">
1540: <div class="titlepage">
1541: <div>
1542: <div>
1543: <h2 class="title"><a name="getting" id=
1544: "getting"></a>Chapter 2. Where to get
1545: pkgsrc</h2>
1546: </div>
1547: </div>
1548: </div>
1549:
1550: <div class="toc">
1551: <p><b>Table of Contents</b></p>
1552:
1553: <dl>
1.30 wiz 1554: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1555: tar file</a></span></dt>
1556:
1.30 wiz 1557: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1558: SUP</a></span></dt>
1559:
1.30 wiz 1560: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1561: CVS</a></span></dt>
1562: </dl>
1563: </div>
1564:
1565: <p>There are three ways to get pkgsrc. Either as a tar
1566: file, via SUP, or via CVS. All three ways are described
1567: here.</p>
1568:
1569: <div class="sect1" lang="en" xml:lang="en">
1570: <div class="titlepage">
1571: <div>
1572: <div>
1573: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1574: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1575: file</h2>
1576: </div>
1577: </div>
1578: </div>
1579:
1580: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1581: file from <a href=
1.11 ben 1582: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1583: target="_top">ftp.NetBSD.org</a> and unpack it into
1584: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1585: </div>
1586:
1587: <div class="sect1" lang="en" xml:lang="en">
1588: <div class="titlepage">
1589: <div>
1590: <div>
1591: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1592: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1593: </div>
1594: </div>
1595: </div>
1596:
1597: <p>As an alternative to the tar file, you can get pkgsrc
1598: via the Software Update Protocol, SUP. To do so, make
1599: sure your supfile has a line</p>
1600: <pre class="programlisting">
1601: release=pkgsrc
1602: </pre>
1603:
1.14 xtraeme 1604: <p>in it, see the examples in <code class=
1605: "filename">/usr/share/examples/supfiles</code>, and that
1606: the <code class="filename">/usr/pkgsrc</code> directory
1607: exists. Then, simply run <span><strong class=
1608: "command">sup -v <em class=
1609: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1610: </div>
1611:
1612: <div class="sect1" lang="en" xml:lang="en">
1613: <div class="titlepage">
1614: <div>
1615: <div>
1616: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1617: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1618: </div>
1619: </div>
1620: </div>
1621:
1622: <p>To get pkgsrc via CVS, make sure you have
1623: “<span class="quote">cvs</span>” installed.
1.27 rillig 1624: To do an initial (full) checkout of pkgsrc, do the
1625: following steps:</p>
1.1 grant 1626: <pre class="screen">
1.14 xtraeme 1627: <code class="prompt">%</code> <strong class=
1628: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1629: <code class="prompt">%</code> <strong class=
1630: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1631: <code class="prompt">%</code> <strong class=
1632: "userinput"><code>cd /usr</code></strong>
1633: <code class="prompt">%</code> <strong class=
1634: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1635: </pre>
1636:
1637: <p>This will create the <code class=
1638: "filename">pkgsrc</code> directory in your <code class=
1639: "filename">/usr</code>, and all the package source will
1640: be stored under <code class=
1641: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1642: initial checkout, make sure you have <code class=
1643: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1644: <pre class="screen">
1.14 xtraeme 1645: <code class="prompt">%</code> <strong class=
1646: "userinput"><code>cd /usr/pkgsrc</code></strong>
1647: <code class="prompt">%</code> <strong class=
1648: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1649: </pre>
1650:
1651: <p>Please also note that it is possible to have multiple
1652: copies of the pkgsrc hierarchy in use at any one time -
1653: all work is done relatively within the pkgsrc tree.</p>
1654: </div>
1655: </div>
1656:
1657: <div class="chapter" lang="en" xml:lang="en">
1658: <div class="titlepage">
1659: <div>
1660: <div>
1661: <h2 class="title"><a name="platforms" id=
1662: "platforms"></a>Chapter 3. Using pkgsrc on
1663: systems other than NetBSD</h2>
1664: </div>
1665: </div>
1666: </div>
1667:
1668: <div class="toc">
1669: <p><b>Table of Contents</b></p>
1670:
1671: <dl>
1.30 wiz 1672: <dt><span class="sect1"><a href=
1673: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1674: pkgsrc</a></span></dt>
1.1 grant 1675:
1.30 wiz 1676: <dt><span class="sect1"><a href=
1677: "#platform-specific-notes">3.2. Platform specific
1678: notes</a></span></dt>
1.1 grant 1679:
1680: <dd>
1681: <dl>
1.30 wiz 1682: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1683: Darwin (Mac OS X)</a></span></dt>
1684:
1.30 wiz 1685: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1686: FreeBSD</a></span></dt>
1687:
1.30 wiz 1688: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1689: Interix</a></span></dt>
1690:
1.30 wiz 1691: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1692: IRIX</a></span></dt>
1693:
1.30 wiz 1694: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1695: Linux</a></span></dt>
1696:
1.30 wiz 1697: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1698: OpenBSD</a></span></dt>
1699:
1.30 wiz 1700: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1701: Solaris</a></span></dt>
1702: </dl>
1703: </dd>
1704: </dl>
1705: </div>
1706:
1707: <div class="sect1" lang="en" xml:lang="en">
1708: <div class="titlepage">
1709: <div>
1710: <div>
1711: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1712: "bootstrapping-pkgsrc" id=
1713: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1714: pkgsrc</h2>
1.1 grant 1715: </div>
1716: </div>
1717: </div>
1718:
1.27 rillig 1719: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1720: bootstrap kit to build the required tools to use pkgsrc
1721: on your platform. Besides support for native NetBSD,
1722: pkgsrc and the bootstrap kit have support for the
1723: following operating systems:</p>
1724:
1725: <div class="itemizedlist">
1726: <ul type="disc">
1727: <li>
1728: <p>Darwin (Mac OS X)</p>
1729: </li>
1730:
1731: <li>
1.16 grant 1732: <p>DragonFlyBSD</p>
1733: </li>
1734:
1735: <li>
1.1 grant 1736: <p>FreeBSD</p>
1737: </li>
1738:
1739: <li>
1740: <p>Interix (Windows 2000, XP, 2003)</p>
1741: </li>
1742:
1743: <li>
1744: <p>IRIX</p>
1745: </li>
1746:
1747: <li>
1748: <p>Linux</p>
1749: </li>
1750:
1751: <li>
1752: <p>OpenBSD</p>
1753: </li>
1754:
1755: <li>
1756: <p>Solaris</p>
1757: </li>
1.16 grant 1758:
1759: <li>
1760: <p>Tru64 (Digital UNIX/OSF1)</p>
1761: </li>
1.1 grant 1762: </ul>
1763: </div>
1764:
1765: <p>Support for other platforms is under development.</p>
1766:
1767: <p>Installing the bootstrap kit should be as simple
1768: as:</p>
1769: <pre class="screen">
1.14 xtraeme 1770: <code class="prompt">#</code> <strong class=
1771: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1772: <code class="prompt">#</code> <strong class=
1773: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1774: <code class="prompt">#</code> <strong class=
1775: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1776: </pre>
1777:
1778: <p>See <a href="#getting" title=
1779: "Chapter 2. Where to get pkgsrc">Chapter 2,
1780: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1781: pkgsrc before bootstrapping. The given
1782: <span><strong class="command">bootstrap</strong></span>
1783: command will use the defaults of <code class=
1784: "filename">/usr/pkg</code> for the <span class=
1785: "emphasis"><em>prefix</em></span> where programs will be
1786: installed in, and <code class=
1787: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1788: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1789: However, these can also be set using command-line
1.27 rillig 1790: arguments.</p>
1.1 grant 1791:
1792: <p>Binary packages for the pkgsrc tools and an initial
1793: set of packages is available for supported platforms. An
1794: up-to-date list of these can be found on <a href=
1795: "http://www.pkgsrc.org/" target=
1796: "_top">www.pkgsrc.org</a>.</p>
1797: </div>
1798:
1799: <div class="sect1" lang="en" xml:lang="en">
1800: <div class="titlepage">
1801: <div>
1802: <div>
1803: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1804: "platform-specific-notes" id=
1805: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1806: specific notes</h2>
1807: </div>
1808: </div>
1809: </div>
1810:
1811: <p>Here are some platform-specific notes you should be
1812: aware of.</p>
1813:
1814: <div class="sect2" lang="en" xml:lang="en">
1815: <div class="titlepage">
1816: <div>
1817: <div>
1.30 wiz 1818: <h3 class="title"><a name="darwin" id=
1819: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1820: </div>
1821: </div>
1822: </div>
1823:
1824: <p>Darwin 5.x and 6.x are supported. There are two
1825: methods of using pkgsrc on Mac OS X, by using a
1826: <a href="#platform.osx-image" title=
1827: "3.2.1.1. Using a disk image">disk image</a>, or a
1828: <a href="#platform.osx-ufs" title=
1829: "3.2.1.2. Using a UFS partition">UFS
1830: partition</a>.</p>
1831:
1832: <p>Before you start, you will need to download and
1833: install the Mac OS X Developer Tools from Apple's
1834: Developer Connection. See <a href=
1835: "http://developer.apple.com/macosx/" target=
1836: "_top">http://developer.apple.com/macosx/</a> for
1837: details. Also, make sure you install X11 for Mac OS X
1838: and the X11 SDK from <a href=
1839: "http://www.apple.com/macosx/x11/download/" target=
1840: "_top">http://www.apple.com/macosx/x11/download/</a> if
1841: you intend to build packages that use the X11 Window
1842: System.</p>
1843:
1844: <p>If you already have a UFS partition, or have a spare
1845: partition that you can format as UFS, it is recommended
1846: to use that instead of the disk image. It'll be
1847: somewhat faster and will mount automatically at boot
1848: time, where you must manually mount a disk image.</p>
1849:
1850: <div class="note" style=
1851: "margin-left: 0.5in; margin-right: 0.5in;">
1852: <h3 class="title">Note</h3>
1853:
1854: <p>You cannot use a HFS+ file system for pkgsrc,
1855: because pkgsrc currently requires the filesystem to
1856: be case-sensitive, and HFS+ is not.</p>
1857: </div>
1858:
1859: <div class="sect3" lang="en" xml:lang="en">
1860: <div class="titlepage">
1861: <div>
1862: <div>
1863: <h4 class="title"><a name="platform.osx-image"
1864: id="platform.osx-image"></a>3.2.1.1. Using
1865: a disk image</h4>
1866: </div>
1867: </div>
1868: </div>
1869:
1870: <p>Create the disk image:</p>
1871: <pre class="screen">
1.14 xtraeme 1872: <code class="prompt">#</code> <strong class=
1873: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1874: <code class="prompt">#</code> <strong class=
1875: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1876: <code class="prompt">#</code> <strong class=
1877: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1878: <code class="prompt">#</code> <strong class=
1879: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1880: </pre>
1881:
1882: <p>That's it!</p>
1883: </div>
1884:
1885: <div class="sect3" lang="en" xml:lang="en">
1886: <div class="titlepage">
1887: <div>
1888: <div>
1889: <h4 class="title"><a name="platform.osx-ufs"
1890: id="platform.osx-ufs"></a>3.2.1.2. Using a
1891: UFS partition</h4>
1892: </div>
1893: </div>
1894: </div>
1895:
1.14 xtraeme 1896: <p>By default, <code class="filename">/usr</code>
1897: will be on your root file system, normally HFS+. It
1898: is possible to use the default <span class=
1899: "emphasis"><em>prefix</em></span> of <code class=
1900: "filename">/usr/pkg</code> by symlinking <code class=
1901: "filename">/usr/pkg</code> to a directory on a UFS
1902: file system. Obviously, another symlink is required
1903: if you want to place the package database directory
1904: outside the <span class=
1905: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1906: <pre class="screen">
1.14 xtraeme 1907: <code class="prompt">#</code> <strong class=
1.22 tv 1908: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1909: </pre>
1910:
1911: <p>If you created your partitions at the time of
1912: installing Mac OS X and formatted the target
1913: partition as UFS, it should automatically mount on
1.14 xtraeme 1914: <code class="filename">/Volumes/<volume
1915: name></code> when the machine boots. If you are
1.1 grant 1916: (re)formatting a partition as UFS, you need to ensure
1917: that the partition map correctly reflects
1918: “<span class="quote">Apple_UFS</span>”
1919: and not “<span class=
1920: "quote">Apple_HFS</span>”.</p>
1921:
1922: <p>The problem is that none of the disk tools will
1923: let you touch a disk that is booted from. You can
1924: unmount the partition, but even if you newfs it, the
1925: partition type will be incorrect and the automounter
1926: won't mount it. It can be mounted manually, but it
1927: won't appear in Finder.</p>
1928:
1929: <p>You'll need to boot off of the OS X Installation
1930: (User) CD. When the Installation program starts, go
1931: up to the menu and select Disk Utility. Now, you will
1932: be able to select the partition you want to be UFS,
1933: and Format it Apple UFS. Quit the Disk Utility, quit
1934: the installer which will reboot your machine. The new
1935: UFS file system will appear in Finder.</p>
1936:
1937: <p>Be aware that the permissions on the new file
1938: system will be writable by root only.</p>
1939:
1940: <p>This note is as of 10.2 (Jaguar) and applies to
1941: earlier versions. Hopefully Apple will fix Disk
1942: Utility in 10.3 (Panther).</p>
1943: </div>
1944: </div>
1945:
1946: <div class="sect2" lang="en" xml:lang="en">
1947: <div class="titlepage">
1948: <div>
1949: <div>
1.30 wiz 1950: <h3 class="title"><a name="freebsd" id=
1951: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 1952: </div>
1953: </div>
1954: </div>
1955:
1956: <p>FreeBSD 4.7 and 5.0 have been tested and are
1957: supported, other versions may work.</p>
1958:
1959: <p>Care should be taken so that the tools that this kit
1960: installs do not conflict with the FreeBSD userland
1961: tools. There are several steps:</p>
1962:
1963: <div class="orderedlist">
1964: <ol type="1">
1965: <li>
1966: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1967: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1968: therefore recommended that you choose a different
1.14 xtraeme 1969: location (e.g. <code class=
1970: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1971: --pkgdbdir option to the bootstrap script.</p>
1972: </li>
1973:
1974: <li>
1975: <p>If you do not intend to use the FreeBSD ports
1976: tools, it's probably a good idea to move them out
1977: of the way to avoid confusion, e.g.</p>
1978: <pre class="screen">
1.14 xtraeme 1979: <code class="prompt">#</code> <strong class=
1980: "userinput"><code>cd /usr/sbin</code></strong>
1981: <code class="prompt">#</code> <strong class=
1982: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1983: <code class="prompt">#</code> <strong class=
1984: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1985: <code class="prompt">#</code> <strong class=
1986: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1987: <code class="prompt">#</code> <strong class=
1988: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1989: </pre>
1990: </li>
1991:
1992: <li>
1.14 xtraeme 1993: <p>An example <code class=
1994: "filename">/etc/mk.conf</code> file will be
1995: placed in <code class=
1996: "filename">/etc/mk.conf.example</code> file when
1997: you use the bootstrap script.</p>
1.1 grant 1998: </li>
1999: </ol>
2000: </div>
2001: </div>
2002:
2003: <div class="sect2" lang="en" xml:lang="en">
2004: <div class="titlepage">
2005: <div>
2006: <div>
1.30 wiz 2007: <h3 class="title"><a name="interix" id=
2008: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2009: </div>
2010: </div>
2011: </div>
2012:
2013: <p>Interix is a POSIX compatible subsystem for the
2014: Windows NT kernel, providing a Unix-like environment
2015: with a tighter kernel integration than available with
2016: Cygwin. It is part of the Windows Services for Unix
2017: package, available for free for any licensed copy of
1.22 tv 2018: Windows 2000, XP (not including XP Home), or 2003. SFU
2019: can be downloaded from <a href=
2020: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2021: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2022:
2023: <p>Services for Unix 3.5, current as of this writing,
2024: has been tested. 3.0 or 3.1 may work, but are not
2025: officially supported. (The main difference in 3.0/3.1
2026: is lack of pthreads.)</p>
2027:
2028: <div class="sect3" lang="en" xml:lang="en">
2029: <div class="titlepage">
2030: <div>
2031: <div>
2032: <h4 class="title"><a name=
2033: "platform.interix-sfu-install" id=
2034: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2035: installing Interix/SFU</h4>
1.1 grant 2036: </div>
2037: </div>
2038: </div>
2039:
2040: <p>At an absolute minimum, the following packages
2041: must be installed from the Windows Services for Unix
2042: 3.5 distribution in order to use pkgsrc:</p>
2043:
2044: <div class="itemizedlist">
2045: <ul type="disc">
2046: <li>
2047: <p>Utilities -> Base Utilities</p>
2048: </li>
2049:
2050: <li>
2051: <p>Interix GNU Components -> (all)</p>
2052: </li>
2053:
2054: <li>
2055: <p>Remote Connectivity</p>
2056: </li>
2057:
2058: <li>
2059: <p>Interix SDK</p>
2060: </li>
2061: </ul>
2062: </div>
2063:
2064: <p>When using pkgsrc on Interix, DO NOT install the
2065: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2066: without shared module support, installed to
2067: /usr/local, and will only cause confusion. Instead,
2068: install Perl 5.8 from pkgsrc (or from a binary
2069: package).</p>
2070:
2071: <p>The Remote Connectivity subcomponent "Windows
2072: Remote Shell Service" does not need to be installed,
2073: but Remote Connectivity itself should be installed in
2074: order to have a working inetd.</p>
2075:
2076: <p>Finally, during installation you may be asked
2077: whether to enable setuid behavior for Interix
2078: programs, and whether to make pathnames default to
2079: case-sensitive. Setuid should be enabled, and
2080: case-sensitivity MUST be enabled. (Without
2081: case-sensitivity, a large number of packages
2082: including perl will not build.)</p>
2083: </div>
2084:
2085: <div class="sect3" lang="en" xml:lang="en">
2086: <div class="titlepage">
2087: <div>
2088: <div>
2089: <h4 class="title"><a name=
2090: "platform.interix-sfu-postinstall" id=
2091: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2092: to do if Interix/SFU is already installed</h4>
2093: </div>
2094: </div>
2095: </div>
2096:
2097: <p>If SFU is already installed and you wish to alter
2098: these settings to work with pkgsrc, note the
2099: following things.</p>
2100:
2101: <div class="itemizedlist">
2102: <ul type="disc">
2103: <li>
2104: <p>To uninstall UNIX Perl, use Add/Remove
2105: Programs, select Microsoft Windows Services for
2106: UNIX, then click Change. In the installer,
2107: choose Add or Remove, then uncheck
2108: Utilities->UNIX Perl.</p>
2109: </li>
2110:
2111: <li>
2112: <p>To enable case-sensitivity for the
2113: filesystem, run REGEDIT.EXE, and change the
2114: following registry key:</p>
2115:
2116: <p>
2117: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2118: Manager\kernel</p>
2119:
2120: <p>Set the DWORD value "obcaseinsensitive" to
2121: 0; then reboot.</p>
2122: </li>
2123:
2124: <li>
2125: <p>To enable setuid binaries (optional), run
2126: REGEDIT.EXE, and change the following registry
2127: key:</p>
2128:
2129: <p>
2130: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2131: for UNIX</p>
2132:
2133: <p>Set the DWORD value "EnableSetuidBinaries"
2134: to 1; then reboot.</p>
2135: </li>
2136: </ul>
2137: </div>
2138: </div>
2139:
2140: <div class="sect3" lang="en" xml:lang="en">
2141: <div class="titlepage">
2142: <div>
2143: <div>
2144: <h4 class="title"><a name=
2145: "platform.interix-notes" id=
2146: "platform.interix-notes"></a>3.2.3.3. Important
2147: notes for using pkgsrc</h4>
2148: </div>
2149: </div>
2150: </div>
2151:
2152: <p>The package imanager (either the pkgsrc "su" user,
2153: or the user running "pkg_add") must be a member of
2154: the local Administrators group. Such a user must also
2155: be used to run the bootstrap. This is slightly
2156: relaxed from the normal pkgsrc requirement of
2157: "root".</p>
2158:
2159: <p>The package manager should use a umask of 002.
2160: "make install" will automatically complain if this is
2161: not the case. This ensures that directories written
2162: in /var/db/pkg are Administrators-group
2163: writeable.</p>
2164:
2165: <p>The popular Interix binary packages from
2166: http://www.interopsystems.com/ use an older version
2167: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2168: used in conjunction with pkgsrc. If you choose to use
2169: them at the same time as the pkgsrc packages, ensure
2170: that you use the proper pkg_* tools for each type of
2171: binary package.</p>
1.22 tv 2172:
2173: <p>The TERM setting used for DOS-type console windows
2174: (including those invoked by the csh and ksh startup
2175: shortcuts) is "interix". Most systems don't have a
2176: termcap/terminfo entry for it, but the following
2177: .termcap entry provides adequate emulation in most
2178: cases:</p>
2179: <pre class="programlisting">
2180: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2181: </pre>
1.1 grant 2182: </div>
2183: </div>
2184:
2185: <div class="sect2" lang="en" xml:lang="en">
2186: <div class="titlepage">
2187: <div>
2188: <div>
1.30 wiz 2189: <h3 class="title"><a name="irix" id=
2190: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2191: </div>
2192: </div>
2193: </div>
2194:
2195: <p>You will need a working C compiler, either gcc or
2196: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2197: the <code class="varname">CC</code> environment
2198: variable according to your preference. If you do not
2199: have a license for the MIPSpro compiler suite, you can
1.1 grant 2200: download a gcc tardist file from <a href=
2201: "http://freeware.sgi.com/" target=
2202: "_top">http://freeware.sgi.com/</a>.</p>
2203:
2204: <p>Please note that you will need IRIX 6.5.17 or
2205: higher, as this is the earliest version of IRIX
1.24 wiz 2206: providing support for <a href=
2207: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2208: <span class="citerefentry"><span class=
2209: "refentrytitle">if_indextoname</span>(3)</span></a>,
2210: <a href=
2211: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2212: <span class="citerefentry"><span class=
2213: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2214: etc.</p>
1.1 grant 2215:
1.27 rillig 2216: <p>At this point in time, pkgsrc only supports one ABI
2217: at a time. That is, you can not switch between the old
2218: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2219: you start out using "abi=n32", that's what all your
2220: packages will be built with.</p>
1.1 grant 2221:
2222: <p>Therefore, please make sure that you have no
1.14 xtraeme 2223: conflicting <code class="varname">CFLAGS</code> in your
2224: environment or the <code class=
2225: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2226: that you do not try to link n32 object files with lib64
1.14 xtraeme 2227: or vice versa. Check your <code class=
2228: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2229:
2230: <p>If you have the actual pkgsrc tree mounted via NFS
2231: from a different host, please make sure to set
1.14 xtraeme 2232: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2233: directory, as it appears that IRIX linker occasionally
2234: runs into issues when trying to link over a network
2235: mounted filesystem.</p>
2236:
2237: <p>The bootstrapping process should set all the right
2238: options for programs such as imake(1), but you may want
2239: to set some options depending on your local setup.
1.14 xtraeme 2240: Please see <code class=
2241: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2242: course, your compiler's man pages for details.</p>
1.22 tv 2243:
2244: <p>If you are using SGI's MIPSPro compiler, please
2245: set</p>
2246: <pre class="programlisting">
2247: PKGSRC_COMPILER=mipspro
2248: </pre>
2249:
2250: <p>in <code class="filename">/etc/mk.conf</code>.
2251: Otherwise, pkgsrc will assume you are using gcc and may
2252: end up passing invalid flags to the compiler. Note that
2253: bootstrap should create an appropriate <code class=
2254: "filename">mk.conf.example</code> by default.</p>
2255:
2256: <p>If you have both the MIPSPro compiler chain
2257: installed as well as gcc, but want to make sure that
2258: MIPRPro is used, please set your <code class=
2259: "varname">PATH</code> to <span class=
2260: "emphasis"><em>not</em></span> include the location of
2261: gcc (often <code class=
2262: "filename">/usr/freeware/bin</code>), and (important)
2263: pass the '--preserve-path' flag.</p>
1.1 grant 2264: </div>
2265:
2266: <div class="sect2" lang="en" xml:lang="en">
2267: <div class="titlepage">
2268: <div>
2269: <div>
1.30 wiz 2270: <h3 class="title"><a name="linux" id=
2271: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2272: </div>
2273: </div>
2274: </div>
2275:
2276: <p>Some versions of Linux (for example Debian
2277: GNU/Linux) need either libtermcap or libcurses
2278: (libncurses). Installing the distributions
2279: libncurses-dev package (or equivalent) should fix the
2280: problem.</p>
2281:
2282: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2283: and icc (Intel C++ Compiler). gcc is the default. icc
2284: 8.0 and 8.1 on i386 have been tested.</p>
2285:
2286: <p>To bootstrap using icc, assuming the default icc
2287: installation directory:</p>
2288: <pre class="programlisting">
2289: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2290: ac_cv___attribute__=yes ./bootstrap
2291: </pre>
2292:
2293: <div class="note" style=
2294: "margin-left: 0.5in; margin-right: 0.5in;">
2295: <h3 class="title">Note</h3>
2296:
2297: <p>icc 8.1 needs the `-i-static' argument instead of
2298: -static-libcxa.</p>
2299: </div>
2300:
2301: <p>icc supports __attribute__, but the GNU configure
2302: test uses a nested function, which icc does not
2303: support. #undef'ing __attribute__ has the unfortunate
2304: side-effect of breaking many of the Linux header files,
2305: which cannot be compiled properly without
2306: __attribute__. The test must be overridden so that
2307: __attribute__ is assumed supported by the compiler.</p>
2308:
2309: <p>After bootstrapping, you should set <code class=
2310: "varname">PKGSRC_COMPILER</code> in <code class=
2311: "filename">/etc/mk.conf</code>:</p>
2312: <pre class="programlisting">
2313: PKGSRC_COMPILER=icc
2314: </pre>
2315:
2316: <p>The default installation directory for icc is
2317: <code class="filename">/opt/intel_cc_80</code>, which
2318: is also the pkgsrc default. If you have installed it
2319: into a different directory, set <code class=
2320: "varname">ICCBASE</code> in <code class=
2321: "filename">/etc/mk.conf</code>:</p>
2322: <pre class="programlisting">
2323: ICCBASE=/opt/icc
2324: </pre>
2325:
2326: <p>pkgsrc uses the static linking method of the runtime
2327: libraries provided by icc, so binaries can be run on
2328: other systems which do not have the shared libraries
2329: installed.</p>
2330:
2331: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2332: the <a href=
2333: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2334: <span class="citerefentry"><span class=
2335: "refentrytitle">ld</span>(1)</span></a> command run
2336: when linking a C++ shared library and records it,
2337: throwing away the -Bstatic and -Bdynamic options
2338: interspersed between the libraries. This means that
2339: libtool-linked C++ shared libraries will have a runtime
2340: dependency on the icc libraries until this is fixed in
2341: libtool.</p>
1.22 tv 2342: </div>
2343:
2344: <div class="sect2" lang="en" xml:lang="en">
2345: <div class="titlepage">
2346: <div>
2347: <div>
1.30 wiz 2348: <h3 class="title"><a name="openbsd" id=
2349: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2350: </div>
2351: </div>
2352: </div>
2353:
2354: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2355:
2356: <p>Care should be taken so that the tools that this kit
2357: installs do not conflict with the OpenBSD userland
2358: tools. There are several steps:</p>
2359:
2360: <div class="orderedlist">
2361: <ol type="1">
2362: <li>
2363: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2364: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2365: therefore recommended that you choose a different
1.14 xtraeme 2366: location (e.g. <code class=
2367: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2368: --pkgdbdir option to the bootstrap script.</p>
2369: </li>
2370:
2371: <li>
2372: <p>If you do not intend to use the OpenBSD ports
2373: tools, it's probably a good idea to move them out
2374: of the way to avoid confusion, e.g.</p>
2375: <pre class="screen">
1.14 xtraeme 2376: <code class="prompt">#</code> <strong class=
2377: "userinput"><code>cd /usr/sbin</code></strong>
2378: <code class="prompt">#</code> <strong class=
2379: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2380: <code class="prompt">#</code> <strong class=
2381: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2382: <code class="prompt">#</code> <strong class=
2383: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2384: <code class="prompt">#</code> <strong class=
2385: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2386: </pre>
2387: </li>
2388:
2389: <li>
1.14 xtraeme 2390: <p>An example <code class=
2391: "filename">/etc/mk.conf</code> file will be
2392: placed in <code class=
2393: "filename">/etc/mk.conf.example</code> file when
2394: you use the bootstrap script. OpenBSD's make
2395: program uses <code class=
2396: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2397: work around this by enclosing all the pkgsrc
2398: specific parts of the file with:</p>
2399: <pre class="programlisting">
2400: .ifdef BSD_PKG_MK
1.11 ben 2401: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2402: .else
2403: # OpenBSD stuff
2404: .endif
2405: </pre>
2406: </li>
2407: </ol>
2408: </div>
2409: </div>
2410:
2411: <div class="sect2" lang="en" xml:lang="en">
2412: <div class="titlepage">
2413: <div>
2414: <div>
1.30 wiz 2415: <h3 class="title"><a name="solaris" id=
2416: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2417: </div>
2418: </div>
2419: </div>
2420:
2421: <p>Solaris 2.6 through 9 are supported on both x86 and
2422: sparc. You will need a working C compiler. Both gcc
2423: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2424:
2425: <p>The following packages are required on Solaris 8 for
2426: the bootstrap process and to build packages.</p>
2427:
2428: <div class="itemizedlist">
2429: <ul type="disc">
2430: <li>
2431: <p>SUNWsprot</p>
2432: </li>
2433:
2434: <li>
2435: <p>SUNWarc</p>
2436: </li>
2437:
2438: <li>
2439: <p>SUNWbtool</p>
2440: </li>
2441:
2442: <li>
2443: <p>SUNWtoo</p>
2444: </li>
2445:
2446: <li>
2447: <p>SUNWlibm</p>
2448: </li>
2449: </ul>
2450: </div>
2451:
2452: <p>Please note the use of GNU binutils on Solaris is
2453: <span class="emphasis"><em>not</em></span>
2454: supported.</p>
2455:
2456: <div class="sect3" lang="en" xml:lang="en">
2457: <div class="titlepage">
2458: <div>
2459: <div>
1.30 wiz 2460: <h4 class="title"><a name="solaris-gcc-note"
2461: id="solaris-gcc-note"></a>3.2.7.1. If you
2462: are using gcc</h4>
1.1 grant 2463: </div>
2464: </div>
2465: </div>
2466:
2467: <p>It makes life much simpler if you only use the
2468: same gcc consistently for building all packages.</p>
2469:
2470: <p>It is recommended that an external gcc be used
2471: only for bootstrapping, then either build gcc from
2472: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2473: href=
2474: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2475: class="pkgname">lang/gcc</a> or install a binary gcc
2476: package, then remove gcc used during
2477: bootstrapping.</p>
1.1 grant 2478:
2479: <p>Binary packages of gcc can be found through
2480: <a href=
2481: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2482: target=
2483: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2484: </div>
2485:
2486: <div class="sect3" lang="en" xml:lang="en">
2487: <div class="titlepage">
2488: <div>
2489: <div>
1.30 wiz 2490: <h4 class="title"><a name=
2491: "solaris-sun-workshop-note" id=
2492: "solaris-sun-workshop-note"></a>3.2.7.2. If
2493: you are using Sun WorkShop</h4>
1.1 grant 2494: </div>
2495: </div>
2496: </div>
2497:
2498: <p>You will need at least the following packages
2499: installed (from WorkShop 5.0)</p>
2500:
2501: <div class="itemizedlist">
2502: <ul type="disc">
2503: <li>
2504: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2505: </li>
2506:
2507: <li>
2508: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2509: </li>
2510:
2511: <li>
2512: <p>SPROild - Sun WorkShop Incremental
2513: Linker</p>
2514: </li>
2515:
2516: <li>
2517: <p>SPROlang - Sun WorkShop Compilers common
2518: components</p>
2519: </li>
2520: </ul>
2521: </div>
2522:
1.14 xtraeme 2523: <p>You should set <code class="varname">CC</code>,
2524: <code class="varname">CXX</code> and optionally,
2525: <code class="varname">CPP</code> in <code class=
2526: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2527: <pre class="programlisting">
1.27 rillig 2528: CC= cc
1.1 grant 2529: CXX= CC
2530: CPP= /usr/ccs/lib/cpp
2531: </pre>
2532:
2533: <p>You may also want to build 64-bit binaries,
2534: eg.</p>
2535: <pre class="programlisting">
2536: CFLAGS= -xtarget=ultra -xarch=v9
2537: </pre>
2538:
2539: <p>Whichever compiler you use, please ensure the
2540: compiler tools and your $prefix are in your
1.14 xtraeme 2541: <code class="varname">PATH</code>. This includes
2542: <code class="filename">/usr/ccs/{bin,lib}</code> and
2543: eg. <code class=
2544: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2545: </div>
2546: </div>
2547: </div>
2548: </div>
2549:
2550: <div class="chapter" lang="en" xml:lang="en">
2551: <div class="titlepage">
2552: <div>
2553: <div>
2554: <h2 class="title"><a name="using" id=
2555: "using"></a>Chapter 4. Using pkgsrc</h2>
2556: </div>
2557: </div>
2558: </div>
2559:
2560: <div class="toc">
2561: <p><b>Table of Contents</b></p>
2562:
2563: <dl>
2564: <dt><span class="sect1"><a href="#getting-started">4.1.
2565: Working with binary packages</a></span></dt>
2566:
2567: <dd>
2568: <dl>
1.30 wiz 2569: <dt><span class="sect2"><a href=
2570: "#where-to-get-binary-packages">4.1.1. Where to get
2571: binary packages</a></span></dt>
1.1 grant 2572:
1.30 wiz 2573: <dt><span class="sect2"><a href=
2574: "#how-to-use-binary-packages">4.1.2. How to use
2575: binary packages</a></span></dt>
1.1 grant 2576:
1.30 wiz 2577: <dt><span class="sect2"><a href=
2578: "#a-word-of-warning">4.1.3. A word of
2579: warning</a></span></dt>
1.1 grant 2580: </dl>
2581: </dd>
2582:
1.30 wiz 2583: <dt><span class="sect1"><a href=
2584: "#building-packages-from-source">4.2. Building packages
2585: from source</a></span></dt>
1.1 grant 2586:
2587: <dd>
2588: <dl>
1.30 wiz 2589: <dt><span class="sect2"><a href=
2590: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2591:
1.30 wiz 2592: <dt><span class="sect2"><a href=
2593: "#fetching-distfiles">4.2.2. Fetching
2594: distfiles</a></span></dt>
1.1 grant 2595:
1.30 wiz 2596: <dt><span class="sect2"><a href=
2597: "#how-to-build-and-install">4.2.3. How to build and
2598: install</a></span></dt>
1.1 grant 2599:
1.30 wiz 2600: <dt><span class="sect2"><a href=
2601: "#selecting-the-compiler">4.2.4. Selecting the
2602: compiler</a></span></dt>
1.1 grant 2603: </dl>
2604: </dd>
2605: </dl>
2606: </div>
2607:
2608: <div class="sect1" lang="en" xml:lang="en">
2609: <div class="titlepage">
2610: <div>
2611: <div>
2612: <h2 class="title" style="clear: both"><a name=
2613: "getting-started" id=
2614: "getting-started"></a>4.1. Working with binary
2615: packages</h2>
2616: </div>
2617: </div>
2618: </div>
2619:
2620: <p>This section describes how to find, retrieve and
2621: install a precompiled binary package that someone else
2622: already prepared for your type of machine.</p>
2623:
2624: <div class="sect2" lang="en" xml:lang="en">
2625: <div class="titlepage">
2626: <div>
2627: <div>
1.30 wiz 2628: <h3 class="title"><a name=
2629: "where-to-get-binary-packages" id=
2630: "where-to-get-binary-packages"></a>4.1.1. Where
2631: to get binary packages</h3>
1.1 grant 2632: </div>
2633: </div>
2634: </div>
2635:
2636: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2637: and its mirrors in the directory <code class=
1.27 rillig 2638: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2639: for anonymous FTP access. <code class=
2640: "varname">OSVERSION</code> is the NetBSD version
2641: (<span><strong class="command">uname
2642: -r</strong></span>), <code class="varname">ARCH</code>
2643: is the architecture (<span><strong class=
2644: "command">uname -p</strong></span>). In that directory,
2645: there is a subdirectory for each category plus a
2646: subdirectory <code class="filename">All</code> which
2647: includes the actual binaries in <code class=
2648: "filename">.tgz</code> files. The category
2649: subdirectories use symbolic links to those files (this
2650: is the same directory layout as in <code class=
1.14 xtraeme 2651: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2652:
2653: <p>This same directory layout applies for CDROM
2654: distributions, only that the directory may be rooted
1.14 xtraeme 2655: somewhere else, probably somewhere below <code class=
2656: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2657: documentation for the exact location.</p>
2658: </div>
2659:
2660: <div class="sect2" lang="en" xml:lang="en">
2661: <div class="titlepage">
2662: <div>
2663: <div>
1.30 wiz 2664: <h3 class="title"><a name=
2665: "how-to-use-binary-packages" id=
2666: "how-to-use-binary-packages"></a>4.1.2. How
2667: to use binary packages</h3>
1.1 grant 2668: </div>
2669: </div>
2670: </div>
2671:
2672: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2673: to your hard disk, you can install them with the
1.27 rillig 2674: following command (be sure to <span><strong class=
1.14 xtraeme 2675: "command">su</strong></span> to root first):</p>
1.1 grant 2676: <pre class="screen">
1.14 xtraeme 2677: <code class="prompt">#</code> <strong class=
2678: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2679: </pre>
2680:
2681: <p>If you have FTP access and you don't want to
2682: download the packages via FTP prior to installation,
1.14 xtraeme 2683: you can do this automatically by giving
2684: <span><strong class="command">pkg_add</strong></span>
2685: an FTP URL:</p>
1.1 grant 2686: <pre class="screen">
1.14 xtraeme 2687: <code class="prompt">#</code> <strong class=
1.27 rillig 2688: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2689: </pre>
2690:
1.27 rillig 2691: <p>Note that any prerequisite packages needed to run
2692: the package in question will be installed, too,
1.1 grant 2693: assuming they are present where you install from.</p>
2694:
1.23 wiz 2695: <p>To save some typing, you can set the <code class=
2696: "varname">PKG_PATH</code> environment variable to a
2697: semicolon separated list of paths (including remote
2698: URLs); trailing slashes are not allowed.</p>
2699:
2700: <p>Additionally to the <code class=
2701: "filename">All</code> directory there exists a
2702: <code class="filename">vulnerable</code> directory to
2703: which binary packages with known vulnerabilities are
2704: moved, since removing them could cause missing
2705: dependencies. To use these packages, add the
2706: <code class="filename">vulnerable</code> directory to
2707: your <code class="varname">PKG_PATH</code>. However,
2708: you should run <a xmlns=
2709: "http://www.w3.org/TR/xhtml1/transitional" href=
2710: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
2711: class="pkgname">security/audit-packages</a> regularly,
2712: and especially after installing new packages, and
2713: verify that the vulnerabilities are acceptable for your
2714: configuration. An example <code class=
2715: "varname">PKG_PATH</code> would be: <code class=
1.27 rillig 2716: "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 2717: Please note that semicolon (';') is a shell
2718: meta-character, so you'll probably have to quote
2719: it.</p>
2720:
1.1 grant 2721: <p>After you've installed packages, be sure to have
1.27 rillig 2722: <code class="filename">/usr/pkg/bin</code> and
2723: <code class="filename">/usr/pkg/sbin</code> in your
1.14 xtraeme 2724: <code class="varname">PATH</code> so you can actually
2725: start the just installed program.</p>
1.1 grant 2726: </div>
2727:
2728: <div class="sect2" lang="en" xml:lang="en">
2729: <div class="titlepage">
2730: <div>
2731: <div>
1.30 wiz 2732: <h3 class="title"><a name="a-word-of-warning" id=
2733: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2734: warning</h3>
2735: </div>
2736: </div>
2737: </div>
2738:
2739: <p>Please pay very careful attention to the warnings
2740: expressed in the <a href=
2741: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2742: <span class="citerefentry"><span class=
2743: "refentrytitle">pkg_add</span>(1)</span></a> manual
2744: page about the inherent dangers of installing binary
2745: packages which you did not create yourself, and the
2746: security holes that can be introduced onto your system
2747: by indiscriminate adding of such files.</p>
2748: </div>
2749: </div>
2750:
2751: <div class="sect1" lang="en" xml:lang="en">
2752: <div class="titlepage">
2753: <div>
2754: <div>
2755: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2756: "building-packages-from-source" id=
2757: "building-packages-from-source"></a>4.2. Building
1.1 grant 2758: packages from source</h2>
2759: </div>
2760: </div>
2761: </div>
2762:
2763: <p>This assumes that the package is already in pkgsrc. If
2764: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2765: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2766: “The pkgsrc developer's guide”</a> for
2767: instructions how to create your own packages.</p>
1.1 grant 2768:
2769: <div class="sect2" lang="en" xml:lang="en">
2770: <div class="titlepage">
2771: <div>
2772: <div>
1.30 wiz 2773: <h3 class="title"><a name="requirements" id=
2774: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2775: </div>
2776: </div>
2777: </div>
2778:
2779: <p>To build packages from source on a NetBSD system the
2780: “<span class="quote">comp</span>” and the
2781: “<span class="quote">text</span>”
2782: distribution sets must be installed. If you want to
2783: build X11 related packages the “<span class=
2784: "quote">xbase</span>” and “<span class=
2785: "quote">xcomp</span>” distribution sets are
2786: required, too.</p>
2787: </div>
2788:
2789: <div class="sect2" lang="en" xml:lang="en">
2790: <div class="titlepage">
2791: <div>
2792: <div>
1.30 wiz 2793: <h3 class="title"><a name="fetching-distfiles"
2794: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2795: distfiles</h3>
2796: </div>
2797: </div>
2798: </div>
2799:
1.27 rillig 2800: <p>The first step for building a package is downloading
2801: the distfiles (i.e. the unmodified source). If they
2802: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2803: automatically.</p>
2804:
2805: <p>You can overwrite some of the major distribution
2806: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2807: a look at <code class=
2808: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2809: some examples — in particular, look for the
1.14 xtraeme 2810: <code class="varname">MASTER_SORT</code>, <code class=
2811: "varname">MASTER_SORT_REGEX</code> and <code class=
2812: "varname">INET_COUNTRY</code> definitions. This may
2813: save some of your bandwidth and time.</p>
1.1 grant 2814:
2815: <p>You can change these settings either in your shell's
2816: environment, or, if you want to keep the settings, by
1.14 xtraeme 2817: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2818: file, and adding the definitions there.</p>
2819:
2820: <p>If you don't have a permanent Internet connection
2821: and you want to know which files to download,
1.14 xtraeme 2822: <span><strong class="command">make
2823: fetch-list</strong></span> will tell you what you'll
2824: need. Put these distfiles into <code class=
2825: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2826: </div>
2827:
2828: <div class="sect2" lang="en" xml:lang="en">
2829: <div class="titlepage">
2830: <div>
2831: <div>
1.30 wiz 2832: <h3 class="title"><a name=
2833: "how-to-build-and-install" id=
2834: "how-to-build-and-install"></a>4.2.3. How to
2835: build and install</h3>
1.1 grant 2836: </div>
2837: </div>
2838: </div>
2839:
2840: <p>Assuming that the distfile has been fetched (see
2841: previous section), become root and change into the
1.14 xtraeme 2842: relevant directory and running <span><strong class=
2843: "command">make</strong></span>. For example, type</p>
1.1 grant 2844: <pre class="screen">
1.14 xtraeme 2845: <code class="prompt">%</code> <strong class=
2846: "userinput"><code>cd misc/figlet</code></strong>
2847: <code class="prompt">%</code> <strong class=
2848: "userinput"><code>make</code></strong>
1.1 grant 2849: </pre>
2850:
2851: <p>at the shell prompt to build the various components
2852: of the package, and</p>
2853: <pre class="screen">
1.14 xtraeme 2854: <code class="prompt">#</code> <strong class=
2855: "userinput"><code>make install</code></strong>
1.1 grant 2856: </pre>
2857:
2858: <p>to install the various components into the correct
2859: places on your system. Installing the package on your
2860: system requires you to be root. However, pkgsrc has a
2861: <span class="emphasis"><em>just-in-time-su</em></span>
2862: feature, which allows you to only become root for the
2863: actual installation step</p>
2864:
2865: <p>Taking the figlet utility as an example, we can
2866: install it on our system by building as shown in
2867: <a href="#logs" title=
2868: "Appendix B. Build logs">Appendix B, <i>Build
2869: logs</i></a>.</p>
2870:
2871: <p>The program is installed under the default root of
1.14 xtraeme 2872: the packages tree - <code class=
2873: "filename">/usr/pkg</code>. Should this not conform to
2874: your tastes, set the <code class=
2875: "varname">LOCALBASE</code> variable in your
1.1 grant 2876: environment, and it will use that value as the root of
1.14 xtraeme 2877: your packages tree. So, to use <code class=
2878: "filename">/usr/local</code>, set <code class=
2879: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2880: environment. Please note that you should use a
2881: directory which is dedicated to packages and not shared
1.14 xtraeme 2882: with other programs (ie, do not try and use
2883: <code class="varname">LOCALBASE=/usr</code>). Also, you
2884: should not try to add any of your own files or
2885: directories (such as <code class=
2886: "filename">src/</code>, <code class=
2887: "filename">obj/</code>, or <code class=
2888: "filename">pkgsrc/</code>) below the <code class=
2889: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2890: possible conflicts between programs and other files
2891: installed by the package system and whatever else may
2892: have been installed there.</p>
2893:
1.14 xtraeme 2894: <p>Some packages look in <code class=
2895: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2896: configuration options at build time. Have a look at
1.14 xtraeme 2897: <code class=
2898: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2899: overview of what will be set there by default.
2900: Environment variables such as <code class=
2901: "varname">LOCALBASE</code> can be set in <code class=
2902: "filename">/etc/mk.conf</code> to save having to
2903: remember to set them each time you want to use
2904: pkgsrc.</p>
1.1 grant 2905:
2906: <p>Occasionally, people want to “<span class=
2907: "quote">look under the covers</span>” to see what
2908: is going on when a package is building or being
2909: installed. This may be for debugging purposes, or out
2910: of simple curiosity. A number of utility values have
2911: been added to help with this.</p>
2912:
2913: <div class="orderedlist">
2914: <ol type="1">
2915: <li>
2916: <p>If you invoke the <a href=
2917: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2918: <span class="citerefentry"><span class=
2919: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2920: with <code class=
2921: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2922: amount of information will be displayed. For
2923: example,</p>
1.1 grant 2924: <pre class="screen">
1.14 xtraeme 2925: <strong class=
2926: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2927: </pre>
2928:
2929: <p>will show all the commands that are invoked,
2930: up to and including the “<span class=
2931: "quote">patch</span>” stage.</p>
2932: </li>
2933:
2934: <li>
2935: <p>If you want to know the value of a certain
1.22 tv 2936: <a href=
2937: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2938: <span class="citerefentry"><span class=
2939: "refentrytitle">make</span>(1)</span></a>
2940: definition, then the <code class=
1.14 xtraeme 2941: "varname">VARNAME</code> definition should be
2942: used, in conjunction with the show-var target.
2943: e.g. to show the expansion of the <a href=
1.1 grant 2944: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2945: <span class="citerefentry"><span class=
2946: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2947: variable <code class=
1.22 tv 2948: "varname">LOCALBASE</code>:</p>
1.1 grant 2949: <pre class="screen">
1.14 xtraeme 2950: <code class="prompt">%</code> <strong class=
2951: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2952: /usr/pkg
1.14 xtraeme 2953: <code class="prompt">%</code>
1.1 grant 2954:
2955: </pre>
2956: </li>
2957: </ol>
2958: </div>
2959:
2960: <p>If you want to install a binary package that you've
2961: either created yourself (see next section), that you
2962: put into pkgsrc/packages manually or that is located on
1.8 wiz 2963: a remote FTP server, you can use the "bin-install"
1.1 grant 2964: target. This target will install a binary package - if
2965: available - via <a href=
2966: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2967: <span class="citerefentry"><span class=
2968: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2969: <span><strong class="command">make
2970: package</strong></span>. The list of remote FTP sites
2971: searched is kept in the variable <code class=
2972: "varname">BINPKG_SITES</code>, which defaults to
2973: ftp.NetBSD.org. Any flags that should be added to
2974: <a href=
1.1 grant 2975: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2976: <span class="citerefentry"><span class=
2977: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2978: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2979: See <code class=
2980: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2981: details.</p>
1.1 grant 2982:
2983: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2984: has a non-standard setting for <code class=
2985: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2986: any packages are installed, as you can not use several
2987: directories for the same purpose. Doing so will result
2988: in pkgsrc not being able to properly detect your
2989: installed packages, and fail miserably. Note also that
2990: precompiled binary packages are usually built with the
1.14 xtraeme 2991: default <code class="varname">LOCALBASE</code> of
2992: <code class="filename">/usr/pkg</code>, and that you
2993: should <span class="emphasis"><em>not</em></span>
2994: install any if you use a non-standard <code class=
2995: "varname">LOCALBASE</code>.</p>
1.1 grant 2996: </div>
2997:
2998: <div class="sect2" lang="en" xml:lang="en">
2999: <div class="titlepage">
3000: <div>
3001: <div>
1.30 wiz 3002: <h3 class="title"><a name=
3003: "selecting-the-compiler" id=
3004: "selecting-the-compiler"></a>4.2.4. Selecting
3005: the compiler</h3>
1.1 grant 3006: </div>
3007: </div>
3008: </div>
3009:
3010: <p>By default, pkgsrc will use GCC to build packages.
3011: This may be overridden by setting the following
3012: variables in /etc/mk.conf:</p>
3013:
3014: <div class="variablelist">
3015: <dl>
1.14 xtraeme 3016: <dt><span class="term"><code class=
3017: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3018:
3019: <dd>
3020: <p>This is a list of values specifying the chain
3021: of compilers to invoke when building packages.
3022: Valid values are:</p>
3023:
3024: <div class="itemizedlist">
3025: <ul type="disc">
3026: <li>
1.14 xtraeme 3027: <p><code class="varname">distcc</code>:
1.1 grant 3028: distributed C/C++ (chainable)</p>
3029: </li>
3030:
3031: <li>
1.14 xtraeme 3032: <p><code class="varname">ccache</code>:
1.1 grant 3033: compiler cache (chainable)</p>
3034: </li>
3035:
3036: <li>
1.14 xtraeme 3037: <p><code class="varname">gcc</code>: GNU
3038: C/C++ Compiler</p>
1.1 grant 3039: </li>
3040:
3041: <li>
1.14 xtraeme 3042: <p><code class="varname">mipspro</code>:
1.1 grant 3043: Silicon Graphics, Inc. MIPSpro
3044: (n32/n64)</p>
3045: </li>
3046:
3047: <li>
1.14 xtraeme 3048: <p><code class="varname">mipspro</code>:
1.1 grant 3049: Silicon Graphics, Inc. MIPSpro (o32)</p>
3050: </li>
3051:
3052: <li>
1.14 xtraeme 3053: <p><code class="varname">sunpro</code>:
1.1 grant 3054: Microsystems, Inc. WorkShip/Forte/Sun ONE
3055: Studio</p>
3056: </li>
3057: </ul>
3058: </div>
3059:
3060: <p>The default is “<span class=
1.14 xtraeme 3061: "quote"><code class=
3062: "varname">gcc</code></span>”. You can use
3063: <code class="varname">ccache</code> and/or
3064: <code class="varname">distcc</code> with an
3065: appropriate <code class=
3066: "varname">PKGSRC_COMPILER</code> setting, e.g.
3067: “<span class="quote"><code class=
3068: "varname">ccache gcc</code></span>”. This
1.1 grant 3069: variable should always be terminated with a value
3070: for a real compiler.</p>
3071: </dd>
3072:
1.14 xtraeme 3073: <dt><span class="term"><code class=
3074: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3075:
3076: <dd>
3077: <p>This specifies the minimum version of GCC to
3078: use when building packages. If the system GCC
3079: doesn't satisfy this requirement, then pkgsrc
3080: will build and install one of the GCC packages to
3081: use instead.</p>
3082: </dd>
3083: </dl>
3084: </div>
3085: </div>
3086: </div>
3087: </div>
3088:
3089: <div class="chapter" lang="en" xml:lang="en">
3090: <div class="titlepage">
3091: <div>
3092: <div>
1.38 dillo 3093: <h2 class="title"><a name="configuring" id=
3094: "configuring"></a>Chapter 5. Configuring
3095: pkgsrc</h2>
3096: </div>
3097: </div>
3098: </div>
3099:
3100: <div class="toc">
3101: <p><b>Table of Contents</b></p>
3102:
3103: <dl>
3104: <dt><span class="sect1"><a href=
3105: "#selecting-options">5.1. Selecting build
3106: options</a></span></dt>
3107: </dl>
3108: </div>
3109:
3110: <div class="sect1" lang="en" xml:lang="en">
3111: <div class="titlepage">
3112: <div>
3113: <div>
3114: <h2 class="title" style="clear: both"><a name=
3115: "selecting-options" id=
3116: "selecting-options"></a>5.1. Selecting build
3117: options</h2>
3118: </div>
3119: </div>
3120: </div>
3121:
3122: <p>Some packages have build time options, usually to
3123: select between different dependencies, enable optional
3124: support for big dependencies or enable experimental
3125: features.</p>
3126:
3127: <p>To see which options, if any, a package supports, and
3128: which options are mutually exclusive, run
3129: <span><strong class="command">make
3130: show-options</strong></span>, for example:</p>
3131: <pre class="programlisting">
3132: The following options are supported by this package:
3133: ssl Enable SSL support.
3134: Exactly one of the following gecko options is required:
3135: firefox Use firefox as gecko rendering engine.
3136: mozilla Use mozilla as gecko rendering engine.
3137: At most one of the following database options may be selected:
3138: mysql Enable support for MySQL database.
3139: pgsql Enable support for PostgreSQL database.
3140:
3141: These options are enabled by default: firefox
3142: These options are currently enabled: mozilla ssl
3143: </pre>
3144:
3145: <p>The following variables can be defined in <code class=
3146: "filename">/etc/mk.conf</code> to select which options to
3147: enable for a package: <code class=
3148: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3149: to select or disable options for all packages that
3150: support them, and <code class=
3151: "varname">PKG_OPTIONS.<em class=
3152: "replaceable"><code>pkgbase</code></em></code>, which can
3153: be used to select or disable options specifically for
3154: package <em class=
3155: "replaceable"><code>pkgbase</code></em>. Options listed
3156: in these variables are selected, options preceded by
3157: “<span class="quote">-</span>” are
3158: disabled.</p>
3159:
1.39 dillo 3160: <p>The following settings are consulted in the order
3161: given, and the last setting that selects or disables an
3162: option is used:</p>
1.38 dillo 3163:
3164: <div class="orderedlist">
3165: <ol type="1">
3166: <li>
3167: <p>the default options as suggested by the package
3168: maintainer</p>
3169: </li>
3170:
3171: <li>
3172: <p>the options implied by the settings of legacy
3173: variables (see below)</p>
3174: </li>
3175:
3176: <li>
3177: <p><code class=
3178: "varname">PKG_DEFAULT_OPTIONS</code></p>
3179: </li>
3180:
3181: <li>
3182: <p><code class="varname">PKG_OPTIONS.<em class=
3183: "replaceable"><code>pkgbase</code></em></code></p>
3184: </li>
3185: </ol>
3186: </div>
3187:
3188: <p>For groups of mutually exclusive options, the last
3189: option selected is used, all others are automatically
3190: disabled. If an option of the group is explicitly
3191: disabled, the previously selected option, if any, is
3192: used. It is an error if no option from a required group
3193: of options is selected, and building the package will
3194: fail.</p>
3195:
3196: <p>Before the options framework was introduced, build
3197: options were selected by setting a variable in
3198: <code class="filename">/etc/mk.conf</code> for each
3199: option. To ease transition to the options framework for
3200: the user, these legacy variables are converted to the
3201: appropriate options setting automatically. A warning is
3202: issued to prompt the user to update <code class=
3203: "filename">/etc/mk.conf</code> to use the options
3204: framework directly. Support for these legacy variables
3205: will be removed eventually.</p>
3206: </div>
3207: </div>
3208:
3209: <div class="chapter" lang="en" xml:lang="en">
3210: <div class="titlepage">
3211: <div>
3212: <div>
1.1 grant 3213: <h2 class="title"><a name="binary" id=
1.38 dillo 3214: "binary"></a>Chapter 6. Creating binary
1.1 grant 3215: packages</h2>
3216: </div>
3217: </div>
3218: </div>
3219:
3220: <div class="toc">
3221: <p><b>Table of Contents</b></p>
3222:
3223: <dl>
1.30 wiz 3224: <dt><span class="sect1"><a href=
1.38 dillo 3225: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3226: single binary package</a></span></dt>
1.1 grant 3227:
1.30 wiz 3228: <dt><span class="sect1"><a href=
1.38 dillo 3229: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3230: Settings for creation of binary
3231: packages</a></span></dt>
3232:
1.38 dillo 3233: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3234: a bulk build of all packages</a></span></dt>
3235:
3236: <dd>
3237: <dl>
3238: <dt><span class="sect2"><a href=
1.38 dillo 3239: "#binary.configuration">6.3.1.
1.1 grant 3240: Configuration</a></span></dt>
3241:
1.30 wiz 3242: <dt><span class="sect2"><a href=
1.38 dillo 3243: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3244: environmental considerations</a></span></dt>
1.1 grant 3245:
1.38 dillo 3246: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3247: Operation</a></span></dt>
3248:
1.30 wiz 3249: <dt><span class="sect2"><a href=
1.38 dillo 3250: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3251:
1.30 wiz 3252: <dt><span class="sect2"><a href=
1.38 dillo 3253: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3254: requirements</a></span></dt>
1.1 grant 3255:
1.30 wiz 3256: <dt><span class="sect2"><a href=
1.38 dillo 3257: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.30 wiz 3258: for chroot'ed builds</a></span></dt>
1.1 grant 3259:
1.30 wiz 3260: <dt><span class="sect2"><a href=
1.38 dillo 3261: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3262: set of packages</a></span></dt>
1.13 hubertf 3263:
3264: <dt><span class="sect2"><a href=
1.38 dillo 3265: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3266: build</a></span></dt>
1.1 grant 3267: </dl>
3268: </dd>
3269:
1.38 dillo 3270: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3271: Creating a multiple CD-ROM packages
3272: collection</a></span></dt>
3273:
3274: <dd>
3275: <dl>
1.30 wiz 3276: <dt><span class="sect2"><a href=
1.38 dillo 3277: "#cdpack-example">6.4.1. Example of
1.30 wiz 3278: cdpack</a></span></dt>
1.1 grant 3279: </dl>
3280: </dd>
3281: </dl>
3282: </div>
3283:
3284: <div class="sect1" lang="en" xml:lang="en">
3285: <div class="titlepage">
3286: <div>
3287: <div>
3288: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3289: "building-a-single-binary-package" id=
1.38 dillo 3290: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3291: a single binary package</h2>
1.1 grant 3292: </div>
3293: </div>
3294: </div>
3295:
3296: <p>Once you have built and installed a package, you can
3297: create a <span class="emphasis"><em>binary
3298: package</em></span> which can be installed on another
3299: system with <a href=
3300: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3301: <span class="citerefentry"><span class=
3302: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3303: having to build the same package on a group of hosts and
3304: wasting CPU time. It also provides a simple means for
3305: others to install your package, should you distribute
3306: it.</p>
3307:
3308: <p>To create a binary package, change into the
1.14 xtraeme 3309: appropriate directory in pkgsrc, and run
3310: <span><strong class="command">make
3311: package</strong></span>:</p>
1.1 grant 3312: <pre class="screen">
1.14 xtraeme 3313: <code class="prompt">#</code> <strong class=
3314: "userinput"><code>cd misc/figlet</code></strong>
3315: <code class="prompt">#</code> <strong class=
3316: "userinput"><code>make package</code></strong>
1.1 grant 3317: </pre>
3318:
3319: <p>This will build and install your package (if not
3320: already done), and then build a binary package from what
1.14 xtraeme 3321: was installed. You can then use the <span><strong class=
3322: "command">pkg_*</strong></span> tools to manipulate it.
3323: Binary packages are created by default in <code class=
3324: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3325: gzipped tar file. See <a href="#logs.package" title=
3326: "B.2. Packaging figlet">Section B.2,
3327: “Packaging figlet”</a> for a continuation of
3328: the above <a xmlns=
3329: "http://www.w3.org/TR/xhtml1/transitional" href=
3330: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 3331: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 3332:
3333: <p>See <a href="#submit" title=
1.38 dillo 3334: "Chapter 17. Submitting and Committing">Chapter
3335: 17, <i>Submitting and Committing</i></a> for information
1.1 grant 3336: on how to submit such a binary package.</p>
3337: </div>
3338:
3339: <div class="sect1" lang="en" xml:lang="en">
3340: <div class="titlepage">
3341: <div>
3342: <div>
3343: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3344: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3345: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3346: for creation of binary packages</h2>
3347: </div>
3348: </div>
3349: </div>
3350:
3351: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3352: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3353: “Other helpful targets”</a>.</p>
3354: </div>
3355:
3356: <div class="sect1" lang="en" xml:lang="en">
3357: <div class="titlepage">
3358: <div>
3359: <div>
3360: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3361: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
1.1 grant 3362: bulk build of all packages</h2>
3363: </div>
3364: </div>
3365: </div>
3366:
3367: <p>If you want to get a full set of precompiled binary
3368: packages, this section describes how to get them. Beware
3369: that the bulk build will remove all currently installed
1.23 wiz 3370: packages from your system! Having an FTP server
3371: configured either on the machine doing the bulk builds or
3372: on a nearby NFS server can help to make the packages
3373: available to everyone. See <a href=
1.1 grant 3374: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3375: <span class="citerefentry"><span class=
3376: "refentrytitle">ftpd</span>(8)</span></a> for more
3377: information. If you use a remote NFS server's storage, be
3378: sure to not actually compile on NFS storage, as this
3379: slows things down a lot.</p>
3380:
3381: <div class="sect2" lang="en" xml:lang="en">
3382: <div class="titlepage">
3383: <div>
3384: <div>
3385: <h3 class="title"><a name="binary.configuration"
3386: id=
1.38 dillo 3387: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3388: </div>
3389: </div>
3390: </div>
3391:
3392: <div class="sect3" lang="en" xml:lang="en">
3393: <div class="titlepage">
3394: <div>
3395: <div>
3396: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3397: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3398: </div>
3399: </div>
3400: </div>
3401:
1.23 wiz 3402: <p>You may want to set variables in <code class=
1.14 xtraeme 3403: "filename">/etc/mk.conf</code>. Look at <code class=
3404: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3405: details of the default settings. You will want to
1.14 xtraeme 3406: ensure that <code class=
3407: "varname">ACCEPTABLE_LICENSES</code> meet your local
3408: policy. As used in this example, <code class=
3409: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3410: "emphasis"><em>all</em></span> licenses.</p>
3411: <pre class="programlisting">
3412: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3413: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3414: BSDSRCDIR= /usr/src
3415: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3416: OBJHOSTNAME?= yes # use work.`hostname`
3417: FAILOVER_FETCH= yes # insist on the correct checksum
3418: PKG_DEVELOPER?= yes
3419: _ACCEPTABLE= yes
3420: </pre>
3421: </div>
3422:
3423: <div class="sect3" lang="en" xml:lang="en">
3424: <div class="titlepage">
3425: <div>
3426: <div>
1.30 wiz 3427: <h4 class="title"><a name="build.conf" id=
1.38 dillo 3428: "build.conf"></a>6.3.1.2. <code class=
1.14 xtraeme 3429: "filename">build.conf</code></h4>
1.1 grant 3430: </div>
3431: </div>
3432: </div>
3433:
1.14 xtraeme 3434: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3435: copy <code class="filename">build.conf-example</code>
3436: to <code class="filename">build.conf</code> and edit
3437: it, following the comments in that file. This is the
1.1 grant 3438: config file that determines where log files are
3439: generated after the build, where to mail the build
1.23 wiz 3440: report to, where your pkgsrc tree is located and the
3441: user to which user to <a href=
1.1 grant 3442: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3443: <span class="citerefentry"><span class=
1.23 wiz 3444: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3445: <span><strong class="command">cvs
3446: update</strong></span>.</p>
1.1 grant 3447: </div>
3448:
3449: <div class="sect3" lang="en" xml:lang="en">
3450: <div class="titlepage">
3451: <div>
3452: <div>
1.30 wiz 3453: <h4 class="title"><a name="pre-build.local" id=
1.38 dillo 3454: "pre-build.local"></a>6.3.1.3. <code class="filename">
1.30 wiz 3455: pre-build.local</code></h4>
1.1 grant 3456: </div>
3457: </div>
3458: </div>
3459:
3460: <p>It is possible to configure the bulk build to
3461: perform certain site specific tasks at the end of the
1.14 xtraeme 3462: pre-build stage. If the file <code class=
3463: "filename">pre-build.local</code> exists in
1.23 wiz 3464: <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24 wiz 3465: will be executed (as a <a href=
3466: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3467: <span class="citerefentry"><span class=
3468: "refentrytitle">sh</span>(1)</span></a> script) at
3469: the end of the usual pre-build stage. An example use
3470: of <code class="filename">pre-build.local</code> is
3471: to have the line:</p>
1.1 grant 3472: <pre class="screen">
1.14 xtraeme 3473: <code class="prompt">#</code> <strong class=
3474: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3475: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3476: </pre>
3477:
3478: <p>to prevent the system from trying to build a
3479: particular package which requires nearly 3 GB of disk
3480: space.</p>
3481: </div>
3482: </div>
3483:
3484: <div class="sect2" lang="en" xml:lang="en">
3485: <div class="titlepage">
3486: <div>
3487: <div>
1.30 wiz 3488: <h3 class="title"><a name=
3489: "other-environmental-considerations" id=
1.38 dillo 3490: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 3491: environmental considerations</h3>
1.1 grant 3492: </div>
3493: </div>
3494: </div>
3495:
1.14 xtraeme 3496: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3497: completely deleted at the start of bulk builds, make
3498: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3499: drop it into <code class=
3500: "filename">/usr/local/bin</code> (and adjust your login
3501: shell in the passwd file), or (re-)install it via
3502: <a href=
1.1 grant 3503: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3504: <span class="citerefentry"><span class=
3505: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3506: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3507: login after a reboot (remember that your current
3508: process won't die if the package is removed, you just
3509: can't start any new instances of the shell any more).
3510: Also, if you use NetBSD earlier than 1.5, or you still
3511: want to use the pkgsrc version of ssh for some reason,
3512: be sure to install ssh before starting it from
1.14 xtraeme 3513: <code class="filename">rc.local</code>:</p>
1.1 grant 3514: <pre class="programlisting">
3515: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3516: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3517: /usr/pkg/etc/rc.d/sshd
3518: fi
3519: </pre>
3520:
3521: <p>Not doing so will result in you being not able to
3522: log in via ssh after the bulk build is finished or if
3523: the machine gets rebooted or crashes. You have been
3524: warned! :)</p>
3525: </div>
3526:
3527: <div class="sect2" lang="en" xml:lang="en">
3528: <div class="titlepage">
3529: <div>
3530: <div>
1.30 wiz 3531: <h3 class="title"><a name="operation" id=
1.38 dillo 3532: "operation"></a>6.3.3. Operation</h3>
1.1 grant 3533: </div>
3534: </div>
3535: </div>
3536:
3537: <p>Make sure you don't need any of the packages still
3538: installed.</p>
3539:
3540: <div class="warning" style=
3541: "margin-left: 0.5in; margin-right: 0.5in;">
3542: <h3 class="title">Warning</h3>
3543:
3544: <p>During the bulk build, <span class=
3545: "emphasis"><em>all packages will be
3546: removed!</em></span></p>
3547: </div>
3548:
3549: <p>Be sure to remove all other things that might
3550: interfere with builds, like some libs installed in
1.14 xtraeme 3551: <code class="filename">/usr/local</code>, etc. then
3552: become root and type:</p>
1.1 grant 3553: <pre class="screen">
1.14 xtraeme 3554: <code class="prompt">#</code> <strong class=
3555: "userinput"><code>cd /usr/pkgsrc</code></strong>
3556: <code class="prompt">#</code> <strong class=
3557: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3558: </pre>
3559:
3560: <p>If for some reason your last build didn't complete
3561: (power failure, system panic, ...), you can continue it
3562: by running:</p>
3563: <pre class="screen">
1.14 xtraeme 3564: <code class="prompt">#</code> <strong class=
3565: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3566: </pre>
3567:
3568: <p>At the end of the bulk build, you will get a summary
3569: via mail, and find build logs in the directory
1.14 xtraeme 3570: specified by <code class="varname">FTP</code> in the
3571: <code class="filename">build.conf</code> file.</p>
1.1 grant 3572: </div>
3573:
3574: <div class="sect2" lang="en" xml:lang="en">
3575: <div class="titlepage">
3576: <div>
3577: <div>
1.30 wiz 3578: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 3579: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 3580: </div>
3581: </div>
3582: </div>
3583:
3584: <p>The bulk builds consist of three steps:</p>
3585:
3586: <div class="variablelist">
3587: <dl>
3588: <dt><span class="term">1. pre-build</span></dt>
3589:
3590: <dd>
3591: <p>The script updates your pkgsrc tree via
3592: (anon)cvs, then cleans out any broken distfiles,
3593: and removes all packages installed.</p>
3594: </dd>
3595:
3596: <dt><span class="term">2. the bulk
3597: build</span></dt>
3598:
3599: <dd>
3600: <p>This is basically “<span class=
3601: "quote">make bulk-package</span>” with an
3602: optimised order in which packages will be built.
3603: Packages that don't require other packages will
3604: be built first, and packages with many
3605: dependencies will be built later.</p>
3606: </dd>
3607:
3608: <dt><span class="term">3. post-build</span></dt>
3609:
3610: <dd>
3611: <p>Generates a report that's placed in the
1.14 xtraeme 3612: directory specified in the <code class=
3613: "filename">build.conf</code> file named
3614: <code class="filename">broken.html</code>, a
3615: short version of that report will also be mailed
3616: to the build's admin.</p>
1.1 grant 3617: </dd>
3618: </dl>
3619: </div>
3620:
3621: <p>During the build, a list of broken packages will be
1.14 xtraeme 3622: compiled in <code class=
3623: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3624: "filename">.../.broken.${MACHINE}</code> if
3625: <code class="varname">OBJMACHINE</code> is set),
3626: individual build logs of broken builds can be found in
3627: the package's directory. These files are used by the
3628: bulk-targets to mark broken builds to not waste time
3629: trying to rebuild them, and they can be used to debug
3630: these broken package builds later.</p>
1.1 grant 3631: </div>
3632:
3633: <div class="sect2" lang="en" xml:lang="en">
3634: <div class="titlepage">
3635: <div>
3636: <div>
1.30 wiz 3637: <h3 class="title"><a name=
3638: "disk-space-requirements" id=
1.38 dillo 3639: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 3640: space requirements</h3>
1.1 grant 3641: </div>
3642: </div>
3643: </div>
3644:
3645: <p>Currently, roughly the following requirements are
3646: valid for NetBSD 2.0/i386:</p>
3647:
3648: <div class="itemizedlist">
3649: <ul type="disc">
3650: <li>
3651: <p>10 GB - distfiles (NFS ok)</p>
3652: </li>
3653:
3654: <li>
3655: <p>8 GB - full set of all binaries (NFS ok)</p>
3656: </li>
3657:
3658: <li>
3659: <p>5 GB - temp space for compiling (local disk
3660: recommended)</p>
3661: </li>
3662: </ul>
3663: </div>
3664:
3665: <p>Note that all pkgs will be de-installed as soon as
3666: they are turned into a binary package, and that sources
3667: are removed, so there is no excessively huge demand to
3668: disk space. Afterwards, if the package is needed again,
3669: it will be installed via <a href=
3670: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3671: <span class="citerefentry"><span class=
3672: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3673: building again, so there are no cycles wasted by
3674: recompiling.</p>
3675: </div>
3676:
3677: <div class="sect2" lang="en" xml:lang="en">
3678: <div class="titlepage">
3679: <div>
3680: <div>
1.30 wiz 3681: <h3 class="title"><a name="setting-up-a-sandbox"
1.38 dillo 3682: id="setting-up-a-sandbox"></a>6.3.6. Setting
1.30 wiz 3683: up a sandbox for chroot'ed builds</h3>
1.1 grant 3684: </div>
3685: </div>
3686: </div>
3687:
1.12 agc 3688: <p>If you don't want all the packages nuked from a
3689: machine (rendering it useless for anything but pkg
1.23 wiz 3690: compiling), there is the possibility of doing the
3691: package bulk build inside a chroot environment.</p>
1.12 agc 3692:
3693: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3694: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3695: done by using null mounts, or manually.</p>
3696:
1.14 xtraeme 3697: <p>There is a shell script called <code class=
3698: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3699: set up the sandbox environment using null mounts. It
3700: will also create a script called <code class=
3701: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3702: environment, which will allow the null mounts to be
1.14 xtraeme 3703: activated using the <span><strong class=
3704: "command">sandbox mount</strong></span> command and
3705: deactivated using the <span><strong class=
3706: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3707:
3708: <p>To set up a sandbox environment by hand, after
3709: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3710: doing a <span><strong class="command">make distribution
3711: DESTDIR=/usr/sandbox</strong></span> in <code class=
3712: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3713: items are present and properly configured:</p>
1.1 grant 3714:
3715: <div class="procedure">
3716: <ol type="1">
3717: <li>
3718: <p>Kernel</p>
3719: <pre class="screen">
1.14 xtraeme 3720: <code class="prompt">#</code> <strong class=
3721: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3722: </pre>
3723: </li>
3724:
3725: <li>
1.14 xtraeme 3726: <p><code class="filename">/dev/*</code></p>
1.1 grant 3727: <pre class="screen">
1.14 xtraeme 3728: <code class="prompt">#</code> <strong class=
3729: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3730: </pre>
3731: </li>
3732:
3733: <li>
1.14 xtraeme 3734: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3735: (for <a xmlns=
3736: "http://www.w3.org/TR/xhtml1/transitional" href=
3737: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3738: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3739: <pre class="screen">
1.14 xtraeme 3740: <code class="prompt">#</code> <strong class=
3741: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3742: </pre>
3743: </li>
3744:
3745: <li>
3746: <p>Working(!) mail config (hostname,
3747: sendmail.cf):</p>
3748: <pre class="screen">
1.14 xtraeme 3749: <code class="prompt">#</code> <strong class=
3750: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3751: </pre>
3752: </li>
3753:
3754: <li>
1.14 xtraeme 3755: <p><code class="filename">/etc/localtime</code>
3756: (for <a xmlns=
1.1 grant 3757: "http://www.w3.org/TR/xhtml1/transitional" href=
3758: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3759: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3760: <pre class="screen">
1.14 xtraeme 3761: <code class="prompt">#</code> <strong class=
3762: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3763: </pre>
3764: </li>
3765:
3766: <li>
1.14 xtraeme 3767: <p><code class="filename">/usr/src</code> (system
1.1 grant 3768: sources, for <a xmlns=
3769: "http://www.w3.org/TR/xhtml1/transitional" href=
3770: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3771: class="pkgname">sysutils/aperture</a>, <a xmlns=
3772: "http://www.w3.org/TR/xhtml1/transitional" href=
3773: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3774: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3775: <pre class="screen">
1.14 xtraeme 3776: <code class="prompt">#</code> <strong class=
3777: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3778: <code class="prompt">#</code> <strong class=
1.23 wiz 3779: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 3780: </pre>
3781: </li>
3782:
3783: <li>
1.14 xtraeme 3784: <p>Create <code class=
3785: "filename">/var/db/pkg</code> (not part of
3786: default install):</p>
1.1 grant 3787: <pre class="screen">
1.14 xtraeme 3788: <code class="prompt">#</code> <strong class=
3789: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3790: </pre>
3791: </li>
3792:
3793: <li>
1.14 xtraeme 3794: <p>Create <code class="filename">/usr/pkg</code>
3795: (not part of default install):</p>
1.1 grant 3796: <pre class="screen">
1.14 xtraeme 3797: <code class="prompt">#</code> <strong class=
3798: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3799: </pre>
3800: </li>
3801:
3802: <li>
1.14 xtraeme 3803: <p>Checkout pkgsrc via cvs into <code class=
3804: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3805: <pre class="screen">
1.14 xtraeme 3806: <code class="prompt">#</code> <strong class=
3807: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3808: <code class="prompt">#</code> <strong class=
3809: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3810: </pre>
3811:
3812: <p>Do not mount/link this to the copy of your
3813: pkgsrc tree you do development in, as this will
3814: likely cause problems!</p>
3815: </li>
3816:
3817: <li>
1.14 xtraeme 3818: <p>Make <code class=
3819: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3820: and <code class="filename">.../distfiles</code>
3821: point somewhere appropriate. NFS- and/or
3822: nullfs-mounts may come in handy!</p>
1.1 grant 3823: </li>
3824:
3825: <li>
1.14 xtraeme 3826: <p>Edit <code class=
3827: "filename">/etc/mk.conf</code>, see <a href=
3828: "#binary.mk.conf" title=
1.38 dillo 3829: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 3830: “/etc/mk.conf”</a>.</p>
3831: </li>
3832:
3833: <li>
1.14 xtraeme 3834: <p>Adjust <code class=
3835: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3836: needs.</p>
3837: </li>
3838:
3839: <li>
1.14 xtraeme 3840: <p>If you have set <code class=
3841: "varname">CVS_USER</code> in <code class=
3842: "filename">build.conf</code>, make sure that
3843: account exists and can do a <span><strong class=
3844: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3845: properly!</p>
3846: </li>
3847: </ol>
3848: </div>
3849:
3850: <p>When the chroot sandbox is setup, you can start the
3851: build with the following steps:</p>
3852: <pre class="screen">
1.14 xtraeme 3853: <code class="prompt">#</code> <strong class=
3854: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3855: <code class="prompt">#</code> <strong class=
3856: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3857: </pre>
3858:
3859: <p>This will just jump inside the sandbox and start
3860: building. At the end of the build, mail will be sent
3861: with the results of the build. Created binary pkgs will
1.14 xtraeme 3862: be in <code class=
3863: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3864: (wherever that points/mounts to/from).</p>
3865: </div>
3866:
3867: <div class="sect2" lang="en" xml:lang="en">
3868: <div class="titlepage">
3869: <div>
3870: <div>
1.30 wiz 3871: <h3 class="title"><a name=
3872: "building-a-partial-set" id=
1.38 dillo 3873: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 3874: a partial set of packages</h3>
1.1 grant 3875: </div>
3876: </div>
3877: </div>
3878:
3879: <p>In addition to building a complete set of all
1.14 xtraeme 3880: packages in pkgsrc, the <code class=
3881: "filename">pkgsrc/mk/bulk/build</code> script may be
3882: used to build a subset of the packages contained in
3883: pkgsrc. By setting defining <code class=
3884: "varname">SPECIFIC_PKGS</code> in <code class=
3885: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3886:
3887: <div class="itemizedlist">
3888: <ul type="disc">
3889: <li>
3890: <p>SITE_SPECIFIC_PKGS</p>
3891: </li>
3892:
3893: <li>
3894: <p>HOST_SPECIFIC_PKGS</p>
3895: </li>
3896:
3897: <li>
3898: <p>GROUP_SPECIFIC_PKGS</p>
3899: </li>
3900:
3901: <li>
3902: <p>USER_SPECIFIC_PKGS</p>
3903: </li>
3904: </ul>
3905: </div>
3906:
3907: <p>will define the set of packages which should be
3908: built. The bulk build code will also include any
3909: packages which are needed as dependencies for the
3910: explicitly listed packages.</p>
3911:
3912: <p>One use of this is to do a bulk build with
1.14 xtraeme 3913: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3914: sandbox periodically to have a complete set of the
3915: binary packages needed for your site available without
3916: the overhead of building extra packages that are not
3917: needed.</p>
3918: </div>
1.13 hubertf 3919:
3920: <div class="sect2" lang="en" xml:lang="en">
3921: <div class="titlepage">
3922: <div>
3923: <div>
3924: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 3925: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 3926: of a bulk build</h3>
3927: </div>
3928: </div>
3929: </div>
3930:
3931: <p>This section describes how pkgsrc developers can
3932: upload binary pkgs built by bulk builds to
3933: ftp.NetBSD.org.</p>
3934:
1.17 sketch 3935: <p>If you would like to automatically create checksum
3936: files for the binary packages you intend to upload,
3937: remember to set <code class="varname">MKSUMS=yes</code>
3938: in your <code class=
3939: "filename">mk/bulk/build.conf</code>.</p>
3940:
3941: <p>If you would like to PGP sign the checksum files
3942: (highly recommended!), remember to set <code class=
3943: "varname">SIGN_AS=username@NetBSD.org</code> in your
3944: <code class="filename">mk/bulk/build.conf</code>. This
1.23 wiz 3945: will prompt you for your GPG password to sign the files
1.17 sketch 3946: before uploading everything.</p>
3947:
3948: <p>Then, make sure that you have <code class=
1.14 xtraeme 3949: "varname">RSYNC_DST</code> set properly in your
3950: <code class="filename">mk/bulk/build.conf</code> file,
3951: i.e. adjust it to something like one of the
3952: following:</p>
1.13 hubertf 3953: <pre class="screen">
3954: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3955: </pre>
3956:
1.23 wiz 3957: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 3958: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3959: ftp.NetBSD.org is different from <code class=
3960: "varname">CVS_USER</code>, write your login directly
3961: into the variable, e.g. my local account is "feyrer",
3962: but for my login "hubertf", I use:</p>
1.13 hubertf 3963: <pre class="screen">
3964: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3965: </pre>
3966:
1.14 xtraeme 3967: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3968: directory is used here to allow "closing" the directory
3969: during upload. To do so, run the following command on
3970: ftp.NetBSD.org next:</p>
3971: <pre class="screen">
1.14 xtraeme 3972: nbftp% <strong class=
3973: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3974: </pre>
3975:
1.14 xtraeme 3976: <p>Please note that <code class=
3977: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3978: appropriate for packages for the NetBSD operating
3979: system. Binary packages for other operating systems
1.14 xtraeme 3980: should go into <code class=
3981: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3982:
3983: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 3984: needs to be set up. This example shows how to setup
1.13 hubertf 3985: temporary keys for the root account <span class=
3986: "emphasis"><em>inside the sandbox</em></span> (assuming
3987: that no keys should be present there usually):</p>
3988: <pre class="screen">
1.14 xtraeme 3989: <code class="prompt">#</code> <strong class=
3990: "userinput"><code>chroot /usr/sandbox</code></strong>
3991: chroot-<code class="prompt">#</code> <strong class=
3992: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3993: chroot-<code class="prompt">#</code> <strong class=
3994: "userinput"><code>ssh-keygen -t dsa</code></strong>
3995: chroot-<code class="prompt">#</code> <strong class=
3996: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 3997: </pre>
3998:
1.14 xtraeme 3999: <p>Now take the output of <code class=
4000: "filename">id-dsa.pub</code> and append it to your
4001: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 4002: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 4003: the upload is done!</p>
1.13 hubertf 4004:
4005: <p>Next, test if your ssh connection really works:</p>
4006: <pre class="screen">
1.14 xtraeme 4007: chroot-<code class="prompt">#</code> <strong class=
4008: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4009: </pre>
4010:
4011: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4012:
4013: <p>Now after all this works, you can exit the sandbox
4014: and start the upload:</p>
4015: <pre class="screen">
1.14 xtraeme 4016: chroot-<code class="prompt">#</code> <strong class=
4017: "userinput"><code>exit</code></strong>
4018: <code class="prompt">#</code> <strong class=
4019: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4020: <code class="prompt">#</code> <strong class=
4021: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4022: </pre>
4023:
4024: <p>The upload process may take quite some time. Use
1.24 wiz 4025: <a href=
4026: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4027: <span class="citerefentry"><span class=
4028: "refentrytitle">ls</span>(1)</span></a> or <a href=
4029: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4030: <span class="citerefentry"><span class=
4031: "refentrytitle">du</span>(1)</span></a> on the FTP
4032: server to monitor progress of the upload. The upload
4033: script will take care of not uploading restricted
4034: packages and putting vulnerable packages into the
4035: <code class="filename">vulnerable</code>
4036: subdirectory.</p>
1.13 hubertf 4037:
4038: <p>After the upload has ended, first thing is to revoke
4039: ssh access:</p>
4040: <pre class="screen">
1.14 xtraeme 4041: nbftp% <strong class=
4042: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4043: Gdd:x!
4044: </pre>
4045:
4046: <p>Use whatever is needed to remove the key you've
4047: entered before! Last, move the uploaded packages out of
1.14 xtraeme 4048: the <code class="filename">upload</code> directory to
4049: have them accessible to everyone:</p>
1.13 hubertf 4050: <pre class="screen">
1.14 xtraeme 4051: nbftp% <strong class=
4052: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4053: nbftp% <strong class=
4054: "userinput"><code>mv upload/* .</code></strong>
4055: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4056: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4057: </pre>
4058: </div>
1.1 grant 4059: </div>
4060:
4061: <div class="sect1" lang="en" xml:lang="en">
4062: <div class="titlepage">
4063: <div>
4064: <div>
4065: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4066: "creating-cdroms" id=
1.38 dillo 4067: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4068: CD-ROM packages collection</h2>
1.1 grant 4069: </div>
4070: </div>
4071: </div>
4072:
4073: <p>After your pkgsrc bulk-build has completed, you may
4074: wish to create a CD-ROM set of the resulting binary
4075: packages to assist in installing packages on other
4076: machines. The <a xmlns=
4077: "http://www.w3.org/TR/xhtml1/transitional" href=
4078: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 4079: class="pkgname">pkgtools/cdpack</a> package provides a
4080: simple tool for creating the ISO 9660 images.
4081: <span><strong class="command">cdpack</strong></span>
4082: arranges the packages on the CD-ROMs in a way that keeps
4083: all the dependencies for given package on the same CD as
4084: that package.</p>
1.1 grant 4085:
4086: <div class="sect2" lang="en" xml:lang="en">
4087: <div class="titlepage">
4088: <div>
4089: <div>
1.30 wiz 4090: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4091: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4092: cdpack</h3>
4093: </div>
4094: </div>
4095: </div>
4096:
4097: <p>Complete documentation for cdpack is found in the
4098: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 4099: that the binary packages are left in <code class=
4100: "filename">/usr/pkgsrc/packages/All</code> and that
4101: sufficient disk space exists in <code class=
4102: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4103: <pre class="screen">
1.14 xtraeme 4104: <code class="prompt">#</code> <strong class=
4105: "userinput"><code>mkdir /u2/images</code></strong>
4106: <code class="prompt">#</code> <strong class=
4107: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4108: <code class="prompt">#</code> <strong class=
4109: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4110: </pre>
4111:
4112: <p>If you wish to include a common set of files
1.14 xtraeme 4113: (<code class="filename">COPYRIGHT</code>, <code class=
4114: "filename">README</code>, etc.) on each CD in the
1.1 grant 4115: collection, then you need to create a directory which
4116: contains these files. e.g.</p>
4117: <pre class="screen">
1.14 xtraeme 4118: <code class="prompt">#</code> <strong class=
4119: "userinput"><code>mkdir /tmp/common</code></strong>
4120: <code class="prompt">#</code> <strong class=
4121: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4122: <code class="prompt">#</code> <strong class=
4123: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4124: <code class="prompt">#</code> <strong class=
4125: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4126: <code class="prompt">#</code> <strong class=
4127: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4128: <code class="prompt">#</code> <strong class=
4129: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4130: <code class="prompt">#</code> <strong class=
4131: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4132: </pre>
4133:
4134: <p>Now create the images:</p>
4135: <pre class="screen">
1.14 xtraeme 4136: <code class="prompt">#</code> <strong class=
4137: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4138: </pre>
4139:
1.14 xtraeme 4140: <p>Each image will contain <code class=
4141: "filename">README</code>, <code class=
4142: "filename">COPYING</code>, and <code class=
4143: "filename">bin/myscript</code> in their root
1.1 grant 4144: directories.</p>
4145: </div>
4146: </div>
4147: </div>
4148:
4149: <div class="chapter" lang="en" xml:lang="en">
4150: <div class="titlepage">
4151: <div>
4152: <div>
4153: <h2 class="title"><a name="faq" id=
1.38 dillo 4154: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4155: Questions</h2>
4156: </div>
4157: </div>
4158: </div>
4159:
4160: <div class="toc">
4161: <p><b>Table of Contents</b></p>
4162:
4163: <dl>
1.30 wiz 4164: <dt><span class="sect1"><a href=
1.38 dillo 4165: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4166: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4167:
1.38 dillo 4168: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4169: Where's the pkgviews documentation?</a></span></dt>
4170:
1.38 dillo 4171: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4172: Utilities for package management
4173: (pkgtools)</a></span></dt>
4174:
1.38 dillo 4175: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4176: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4177:
1.30 wiz 4178: <dt><span class="sect1"><a href=
1.38 dillo 4179: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4180: fetching distfiles?</a></span></dt>
1.14 xtraeme 4181:
1.30 wiz 4182: <dt><span class="sect1"><a href=
1.38 dillo 4183: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4184: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4185:
1.30 wiz 4186: <dt><span class="sect1"><a href=
1.38 dillo 4187: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4188: from pkgsrc?</a></span></dt>
1.1 grant 4189:
1.30 wiz 4190: <dt><span class="sect1"><a href=
1.38 dillo 4191: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4192: behind a firewall</a></span></dt>
1.1 grant 4193:
1.38 dillo 4194: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4195: do I tell <span><strong class="command">make
4196: fetch</strong></span> to do passive
4197: FTP?</a></span></dt>
1.1 grant 4198:
1.30 wiz 4199: <dt><span class="sect1"><a href=
1.38 dillo 4200: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4201: distfiles at once</a></span></dt>
1.1 grant 4202:
1.30 wiz 4203: <dt><span class="sect1"><a href=
1.38 dillo 4204: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4205: “<span class="quote">Don't know how to make
1.14 xtraeme 4206: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4207: mean?</a></span></dt>
4208:
1.30 wiz 4209: <dt><span class="sect1"><a href=
1.38 dillo 4210: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4211: “<span class="quote">Could not find
1.14 xtraeme 4212: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4213:
1.30 wiz 4214: <dt><span class="sect1"><a href=
1.38 dillo 4215: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4216: pkgsrc</a></span></dt>
1.1 grant 4217:
1.38 dillo 4218: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4219: do I change the location of configuration
4220: files?</a></span></dt>
1.1 grant 4221:
1.38 dillo 4222: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4223: Automated security checks</a></span></dt>
4224: </dl>
4225: </div>
4226:
4227: <p>This section contains hints, tips & tricks on
4228: special things in pkgsrc that we didn't find a better place
4229: for in the previous chapters, and it contains items for
4230: both pkgsrc users and developers.</p>
4231:
4232: <div class="sect1" lang="en" xml:lang="en">
4233: <div class="titlepage">
4234: <div>
4235: <div>
4236: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4237: "mailing-list-pointers" id=
1.38 dillo 4238: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4239: mailing lists for pkg-related discussion?</h2>
1.1 grant 4240: </div>
4241: </div>
4242: </div>
4243:
1.18 xtraeme 4244: <p>The following mailing lists may be of interest to
4245: pkgsrc users:</p>
4246:
4247: <div class="itemizedlist">
4248: <ul type="disc">
4249: <li>
4250: <p><a href=
4251: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4252: target="_top">pkgsrc-bugs</a>: A list where problem
4253: reports related to pkgsrc are sent and
4254: discussed.</p>
1.18 xtraeme 4255: </li>
4256:
4257: <li>
4258: <p><a href=
4259: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4260: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4261: results of pkgsrc bulk builds are sent and
1.34 wiz 4262: discussed.</p>
1.18 xtraeme 4263: </li>
4264:
4265: <li>
4266: <p><a href=
4267: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4268: target="_top">pkgsrc-changes</a>: A list where all
4269: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4270: </li>
4271:
4272: <li>
4273: <p><a href=
4274: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4275: target="_top">tech-pkg</a>: A general discussion
4276: list for all things related to pkgsrc.</p>
1.18 xtraeme 4277: </li>
4278: </ul>
4279: </div>
4280:
4281: <p>To subscribe, do:</p>
1.1 grant 4282: <pre class="programlisting">
1.18 xtraeme 4283: <code class="prompt">%</code> echo subscribe <em class=
4284: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4285: </pre>
4286:
1.18 xtraeme 4287: <p>Archives for all these mailing lists are available
4288: from <a href="http://mail-index.NetBSD.org/" target=
4289: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4290: </div>
4291:
4292: <div class="sect1" lang="en" xml:lang="en">
4293: <div class="titlepage">
4294: <div>
4295: <div>
4296: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4297: "pkgviews-docs" id=
1.38 dillo 4298: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4299: documentation?</h2>
1.1 grant 4300: </div>
4301: </div>
4302: </div>
4303:
4304: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 4305: find a pkgviews User's guide in <code class=
4306: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4307: </div>
4308:
4309: <div class="sect1" lang="en" xml:lang="en">
4310: <div class="titlepage">
4311: <div>
4312: <div>
4313: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4314: "faq-pkgtools" id=
1.38 dillo 4315: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4316: management (pkgtools)</h2>
1.1 grant 4317: </div>
4318: </div>
4319: </div>
4320:
1.14 xtraeme 4321: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 4322: directory pkgtools contains a number of useful utilities
4323: for both users and developers of pkgsrc. This section
4324: attempts only to make the reader aware of the utilities
4325: and when they might be useful, and not to duplicate the
4326: documentation that comes with each package.</p>
4327:
4328: <p>Utilities used by pkgsrc (automatically installed when
4329: needed):</p>
4330:
4331: <div class="itemizedlist">
4332: <ul type="disc">
4333: <li>
4334: <p><a xmlns=
4335: "http://www.w3.org/TR/xhtml1/transitional" href=
4336: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.34 wiz 4337: class="pkgname">pkgtools/x11-links</a>: Symlinks
4338: for use by buildlink.</p>
1.1 grant 4339: </li>
4340: </ul>
4341: </div>
4342:
4343: <p>OS tool augmentation (automatically installed when
4344: needed):</p>
4345:
4346: <div class="itemizedlist">
4347: <ul type="disc">
4348: <li>
4349: <p><a xmlns=
4350: "http://www.w3.org/TR/xhtml1/transitional" href=
4351: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.34 wiz 4352: class="pkgname">pkgtools/digest</a>: Calculates
4353: various kinds of checksums (including SHA1).</p>
1.1 grant 4354: </li>
4355:
4356: <li>
4357: <p><a xmlns=
4358: "http://www.w3.org/TR/xhtml1/transitional" href=
4359: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27 rillig 4360: class="pkgname">pkgtools/libnbcompat</a>:
1.34 wiz 4361: Compatibility library for pkgsrc tools.</p>
1.1 grant 4362: </li>
4363:
4364: <li>
4365: <p><a xmlns=
4366: "http://www.w3.org/TR/xhtml1/transitional" href=
4367: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.34 wiz 4368: class="pkgname">pkgtools/mtree</a>: Installed on
4369: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4370: </li>
4371:
4372: <li>
4373: <p><a xmlns=
4374: "http://www.w3.org/TR/xhtml1/transitional" href=
4375: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4376: class="pkgname">pkgtools/pkg_install</a>:
1.34 wiz 4377: Up-to-date replacement for <code class=
4378: "filename">/usr/sbin/pkg_install</code>, or for use
4379: on operating systems where pkg_install is not
4380: present.</p>
1.1 grant 4381: </li>
4382: </ul>
4383: </div>
4384:
4385: <p>Utilities used by pkgsrc (not automatically
4386: installed):</p>
4387:
4388: <div class="itemizedlist">
4389: <ul type="disc">
4390: <li>
4391: <p><a xmlns=
4392: "http://www.w3.org/TR/xhtml1/transitional" href=
4393: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34 wiz 4394: class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20 ben 4395: binary package from an already-installed package.
1.34 wiz 4396: Used by <span><strong class="command">make
4397: replace</strong></span> to save the old
4398: package.</p>
1.1 grant 4399: </li>
4400:
4401: <li>
4402: <p><a xmlns=
4403: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4404: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34 wiz 4405: class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20 ben 4406: functionality to pkgsrc, allowing it to fetch
4407: distfiles from multiple locations. It currently
4408: supports the following methods: multiple CD-ROMs
4409: and network FTP/HTTP connections.</p>
1.5 hubertf 4410: </li>
4411:
4412: <li>
4413: <p><a xmlns=
4414: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4415: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 4416: class="pkgname">pkgtools/xpkgwedge</a>: Put X11
4417: packages someplace else (enabled by default).</p>
1.1 grant 4418: </li>
1.5 hubertf 4419:
4420: <li>
4421: <p><a xmlns=
4422: "http://www.w3.org/TR/xhtml1/transitional" href=
4423: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34 wiz 4424: class="pkgname">devel/cpuflags</a>: Determine the
4425: best compiler flags to optimise code for your
1.20 ben 4426: current CPU and compiler.</p>
1.5 hubertf 4427: </li>
1.1 grant 4428: </ul>
4429: </div>
4430:
4431: <p>Utilities for keeping track of installed packages,
4432: being up to date, etc:</p>
4433:
4434: <div class="itemizedlist">
4435: <ul type="disc">
4436: <li>
4437: <p><a xmlns=
4438: "http://www.w3.org/TR/xhtml1/transitional" href=
4439: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34 wiz 4440: class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27 rillig 4441: packages whose installed versions do not match the
1.34 wiz 4442: latest pkgsrc entries.</p>
1.1 grant 4443: </li>
4444:
4445: <li>
4446: <p><a xmlns=
4447: "http://www.w3.org/TR/xhtml1/transitional" href=
4448: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34 wiz 4449: class="pkgname">pkgtools/pkgdep</a>: Makes
1.20 ben 4450: dependency graphs of packages, to aid in choosing a
1.34 wiz 4451: strategy for updating.</p>
1.1 grant 4452: </li>
4453:
4454: <li>
4455: <p><a xmlns=
4456: "http://www.w3.org/TR/xhtml1/transitional" href=
4457: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34 wiz 4458: class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27 rillig 4459: graphs from the output of <a xmlns=
4460: "http://www.w3.org/TR/xhtml1/transitional" href=
4461: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
4462: class="pkgname">pkgtools/pkgdep</a> (uses
1.34 wiz 4463: graphviz).</p>
1.1 grant 4464: </li>
4465:
4466: <li>
4467: <p><a xmlns=
4468: "http://www.w3.org/TR/xhtml1/transitional" href=
4469: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34 wiz 4470: class="pkgname">pkgtools/pkglint</a>: The
1.27 rillig 4471: pkglint(1) program checks a pkgsrc entry for
4472: errors, lintpkgsrc(1) does various checks on the
4473: complete pkgsrc system.</p>
1.1 grant 4474: </li>
4475:
4476: <li>
4477: <p><a xmlns=
4478: "http://www.w3.org/TR/xhtml1/transitional" href=
4479: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34 wiz 4480: class="pkgname">pkgtools/pkgsurvey</a>: Report what
4481: packages you have installed.</p>
1.1 grant 4482: </li>
4483: </ul>
4484: </div>
4485:
4486: <p>Utilities for people maintaining or creating
4487: individual packages:</p>
4488:
4489: <div class="itemizedlist">
4490: <ul type="disc">
4491: <li>
4492: <p><a xmlns=
4493: "http://www.w3.org/TR/xhtml1/transitional" href=
4494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34 wiz 4495: class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20 ben 4496: making and maintaining patches for a package
1.34 wiz 4497: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4498: </li>
4499:
4500: <li>
4501: <p><a xmlns=
4502: "http://www.w3.org/TR/xhtml1/transitional" href=
4503: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4504: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4505: "http://www.w3.org/TR/xhtml1/transitional" href=
4506: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34 wiz 4507: class="pkgname">pkgtools/url2pkg</a>: Aids in
4508: converting to pkgsrc.</p>
1.1 grant 4509: </li>
4510:
4511: <li>
4512: <p><a xmlns=
4513: "http://www.w3.org/TR/xhtml1/transitional" href=
4514: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34 wiz 4515: class="pkgname">pkgtools/gensolpkg</a>: Convert
4516: pkgsrc to a Solaris package.</p>
1.1 grant 4517: </li>
4518: </ul>
4519: </div>
4520:
4521: <p>Utilities for people maintaining pkgsrc (or more
4522: obscure pkg utilities)</p>
4523:
4524: <div class="itemizedlist">
4525: <ul type="disc">
4526: <li>
4527: <p><a xmlns=
4528: "http://www.w3.org/TR/xhtml1/transitional" href=
4529: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34 wiz 4530: class="pkgname">pkgtools/pkgconflict</a>: Find
1.20 ben 4531: packages that conflict but aren't marked as
1.34 wiz 4532: such.</p>
1.1 grant 4533: </li>
4534:
4535: <li>
4536: <p><a xmlns=
4537: "http://www.w3.org/TR/xhtml1/transitional" href=
4538: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34 wiz 4539: class="pkgname">pkgtools/pkg_comp</a>: Build
4540: packages in a chrooted area.</p>
1.1 grant 4541: </li>
4542:
4543: <li>
4544: <p><a xmlns=
4545: "http://www.w3.org/TR/xhtml1/transitional" href=
4546: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34 wiz 4547: class="pkgname">pkgtools/libkver</a>: Spoof kernel
4548: version for chrooted cross builds.</p>
1.1 grant 4549: </li>
4550: </ul>
4551: </div>
4552: </div>
4553:
4554: <div class="sect1" lang="en" xml:lang="en">
4555: <div class="titlepage">
4556: <div>
4557: <div>
4558: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4559: "non-root-pkgsrc" id=
1.38 dillo 4560: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 4561: as non-root</h2>
1.1 grant 4562: </div>
4563: </div>
4564: </div>
4565:
4566: <p>If you want to use pkgsrc as non-root user, you can
4567: set some variables to make pkgsrc work under these
1.33 jmmv 4568: conditions. At the very least, you need to set
4569: <code class="varname">UNPRIVILEGED</code> to
4570: “<span class="quote">yes</span>”; this will
4571: turn on unprivileged mode and set multiple related
4572: variables to allow installation of packages as
4573: non-root.</p>
4574:
4575: <p>In case the defaults are not enough, you may want to
4576: tune some other variables used. For example, if the
4577: automatic user/group detection leads to incorrect values
4578: (or not the ones you would like to use), you can change
4579: them by setting <code class=
4580: "varname">UNPRIVILEGED_USER</code> and <code class=
4581: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
4582:
4583: <p>As regards bootstrapping, please note that the
4584: <span><strong class="command">bootstrap</strong></span>
4585: script will ease non-root configuration when given the
4586: “<span class=
4587: "quote">--ignore-user-check</span>” flag, as it
4588: will choose and use multiple default directories under
4589: <code class="filename">~/pkg</code> as the installation
4590: targets. These directories can be overriden by the
4591: “<span class="quote">--prefix</span>” flag
4592: provided by the script, as well as some others that allow
4593: finer tuning of the tree layout.</p>
1.14 xtraeme 4594: </div>
4595:
4596: <div class="sect1" lang="en" xml:lang="en">
4597: <div class="titlepage">
4598: <div>
4599: <div>
4600: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4601: "resume-transfers" id=
1.38 dillo 4602: "resume-transfers"></a>7.5. How to resume
1.30 wiz 4603: transfers when fetching distfiles?</h2>
1.14 xtraeme 4604: </div>
4605: </div>
4606: </div>
4607:
1.15 xtraeme 4608: <p>By default resuming transfers in pkgsrc is disabled,
4609: but you can enable this feature by adding the option
4610: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4611: into <code class="filename">/etc/mk.conf</code>. If,
4612: during a fetch step, an incomplete distfile is found,
4613: pkgsrc will try to resume it.</p>
4614:
4615: <p>You can also use a different program than the default
1.24 wiz 4616: <a href=
4617: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4618: <span class="citerefentry"><span class=
4619: "refentrytitle">ftp</span>(1)</span></a> by changing the
4620: <code class="varname">FETCH_CMD</code> variable. Don't
4621: forget to set <code class=
4622: "varname">FETCH_RESUME_ARGS</code> and <code class=
4623: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4624: default values.</p>
1.14 xtraeme 4625:
4626: <p>For example, if you want to use <code class=
4627: "filename">wget</code> to resume downloads, you'll have
4628: to use something like:</p>
4629: <pre class="programlisting">
1.34 wiz 4630: FETCH_CMD=wget
4631: FETCH_BEFORE_ARGS=--passive-ftp
4632: FETCH_RESUME_ARGS=-c
4633: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 4634: </pre>
1.1 grant 4635: </div>
4636:
4637: <div class="sect1" lang="en" xml:lang="en">
4638: <div class="titlepage">
4639: <div>
4640: <div>
4641: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4642: "XFree86-from-pkgsrc" id=
1.38 dillo 4643: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 4644: install/use XFree86 from pkgsrc?</h2>
4645: </div>
4646: </div>
4647: </div>
4648:
4649: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4650: system's own X11 (<code class=
4651: "filename">/usr/X11R6</code>, <code class=
4652: "filename">/usr/openwin</code>, ...), you will have to
4653: add the following line into <code class=
1.15 xtraeme 4654: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4655: <pre class="programlisting">
1.34 wiz 4656: X11_TYPE=XFree86
1.1 grant 4657: </pre>
4658: </div>
4659:
4660: <div class="sect1" lang="en" xml:lang="en">
4661: <div class="titlepage">
4662: <div>
4663: <div>
4664: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4665: "x.org-from-pkgsrc" id=
1.38 dillo 4666: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 4667: install/use X.org from pkgsrc?</h2>
4668: </div>
4669: </div>
4670: </div>
4671:
4672: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4673: system's own X11 (<code class=
4674: "filename">/usr/X11R6</code>, <code class=
4675: "filename">/usr/openwin</code>, ...) you will have to add
4676: the following line into <code class=
1.15 xtraeme 4677: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4678: <pre class="programlisting">
1.34 wiz 4679: X11_TYPE=xorg
1.1 grant 4680: </pre>
4681: </div>
4682:
4683: <div class="sect1" lang="en" xml:lang="en">
4684: <div class="titlepage">
4685: <div>
4686: <div>
4687: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4688: "fetch-behind-firewall" id=
1.38 dillo 4689: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 4690: files from behind a firewall</h2>
1.1 grant 4691: </div>
4692: </div>
4693: </div>
4694:
4695: <p>If you are sitting behind a firewall which does not
4696: allow direct connections to Internet hosts (i.e.
4697: non-NAT), you may specify the relevant proxy hosts. This
4698: is done using an environment variable in the form of a
4699: URL e.g. in Amdahl, the machine “<span class=
4700: "quote">orpheus.amdahl.com</span>” is one of the
4701: firewalls, and it uses port 80 as the proxy port number.
4702: So the proxy environment variables are:</p>
4703: <pre class="programlisting">
1.34 wiz 4704: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 4705: http_proxy=http://orpheus.amdahl.com:80/
4706: </pre>
4707: </div>
4708:
4709: <div class="sect1" lang="en" xml:lang="en">
4710: <div class="titlepage">
4711: <div>
4712: <div>
4713: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4714: "passive-ftp" id="passive-ftp"></a>7.9. How do
1.30 wiz 4715: I tell <span><strong class="command">make
1.14 xtraeme 4716: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4717: </div>
4718: </div>
4719: </div>
4720:
4721: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4722: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4723: <code class="varname">FETCH_CMD</code> is assigned the
4724: first available command from the following list:</p>
1.34 wiz 4725:
4726: <div class="itemizedlist">
4727: <ul type="disc">
4728: <li>
4729: <p><code class=
4730: "filename">${LOCALBASE}/bin/ftp</code></p>
4731: </li>
4732:
4733: <li>
4734: <p><code class="filename">/usr/bin/ftp</code></p>
4735: </li>
4736: </ul>
4737: </div>
1.1 grant 4738:
4739: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4740: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4741: automatically tries passive connections first, and falls
4742: back to active connections if the server refuses to do
4743: passive. For the other tools, add the following to your
1.14 xtraeme 4744: <code class="filename">/etc/mk.conf</code> file:
4745: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4746:
1.14 xtraeme 4747: <p>Having that option present will prevent <code class=
4748: "filename">/usr/bin/ftp</code> from falling back to
4749: active transfers.</p>
1.1 grant 4750: </div>
4751:
4752: <div class="sect1" lang="en" xml:lang="en">
4753: <div class="titlepage">
4754: <div>
4755: <div>
4756: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4757: "fetching-all-distfiles" id=
1.38 dillo 4758: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 4759: fetch all distfiles at once</h2>
4760: </div>
4761: </div>
4762: </div>
4763:
4764: <p>You would like to download all the distfiles in a
4765: single batch from work or university, where you can't run
1.14 xtraeme 4766: a <span><strong class="command">make
4767: fetch</strong></span>. There is an archive of distfiles
4768: on <a href=
1.1 grant 4769: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4770: target="_top">ftp.NetBSD.org</a>, but downloading the
4771: entire directory may not be appropriate.</p>
4772:
1.14 xtraeme 4773: <p>The answer here is to do a <span><strong class=
4774: "command">make fetch-list</strong></span> in <code class=
4775: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4776: subdirectories, carry the resulting list to your machine
1.23 wiz 4777: at work/school and use it there. If you don't have a
1.24 wiz 4778: NetBSD-compatible <a href=
4779: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4780: <span class="citerefentry"><span class=
4781: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4782: at work, don't forget to set <code class=
4783: "varname">FETCH_CMD</code> to something that fetches a
4784: URL:</p>
1.1 grant 4785:
4786: <p>At home:</p>
4787: <pre class="screen">
1.14 xtraeme 4788: <code class="prompt">%</code> <strong class=
4789: "userinput"><code>cd /usr/pkgsrc</code></strong>
4790: <code class="prompt">%</code> <strong class=
4791: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4792: <code class="prompt">%</code> <strong class=
4793: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4794: </pre>
4795:
4796: <p>At work:</p>
4797: <pre class="screen">
1.14 xtraeme 4798: <code class="prompt">%</code> <strong class=
4799: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4800: </pre>
4801:
1.14 xtraeme 4802: <p>then tar up <code class=
4803: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4804:
4805: <p>If you have a machine running NetBSD, and you want to
4806: get <span class="emphasis"><em>all</em></span> distfiles
4807: (even ones that aren't for your machine architecture),
4808: you can do so by using the above-mentioned
1.14 xtraeme 4809: <span><strong class="command">make
4810: fetch-list</strong></span> approach, or fetch the
4811: distfiles directly by running:</p>
1.1 grant 4812: <pre class="screen">
1.14 xtraeme 4813: <code class="prompt">%</code> <strong class=
4814: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4815: </pre>
4816:
1.14 xtraeme 4817: <p>If you even decide to ignore <code class=
4818: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4819: can get everything by running:</p>
1.1 grant 4820: <pre class="screen">
1.14 xtraeme 4821: <code class="prompt">%</code> <strong class=
4822: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4823: </pre>
4824: </div>
4825:
4826: <div class="sect1" lang="en" xml:lang="en">
4827: <div class="titlepage">
4828: <div>
4829: <div>
4830: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4831: "tmac.andoc-missing" id=
1.38 dillo 4832: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 4833: “<span class="quote">Don't know how to make
4834: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4835: </div>
4836: </div>
4837: </div>
4838:
4839: <p>When compiling the <a xmlns=
4840: "http://www.w3.org/TR/xhtml1/transitional" href=
4841: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4842: class="pkgname">pkgtools/pkg_install</a> package, you get
4843: the error from make that it doesn't know how to make
4844: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4845: This indicates that you don't have installed the
1.23 wiz 4846: “<span class="quote">text</span>” set (nroff,
4847: ...) from the NetBSD base distribution on your machine.
4848: It is recommended to do that to format manpages.</p>
1.1 grant 4849:
4850: <p>In the case of the <a xmlns=
4851: "http://www.w3.org/TR/xhtml1/transitional" href=
4852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4853: class="pkgname">pkgtools/pkg_install</a> package, you can
4854: get away with setting <code class=
4855: "varname">NOMAN=YES</code> either in the environment or
4856: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4857: </div>
4858:
4859: <div class="sect1" lang="en" xml:lang="en">
4860: <div class="titlepage">
4861: <div>
4862: <div>
4863: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4864: "bsd.own.mk-missing" id=
1.38 dillo 4865: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 4866: “<span class="quote">Could not find
4867: bsd.own.mk</span>” mean?</h2>
4868: </div>
4869: </div>
4870: </div>
4871:
1.14 xtraeme 4872: <p>You didn't install the compiler set, <code class=
4873: "filename">comp.tgz</code>, when you installed your
4874: NetBSD machine. Please get it and install it, by
4875: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4876: <pre class="screen">
1.14 xtraeme 4877: <code class="prompt">#</code> <strong class=
4878: "userinput"><code>cd /</code></strong>
4879: <code class="prompt">#</code> <strong class=
4880: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4881: </pre>
4882:
1.14 xtraeme 4883: <p><code class="filename">comp.tgz</code> is part of
4884: every NetBSD release. Get the one that corresponds to
4885: your release (determine via <span><strong class=
4886: "command">uname -r</strong></span>).</p>
1.1 grant 4887: </div>
4888:
4889: <div class="sect1" lang="en" xml:lang="en">
4890: <div class="titlepage">
4891: <div>
4892: <div>
4893: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4894: "using-sudo-with-pkgsrc" id=
1.38 dillo 4895: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 4896: 'sudo' with pkgsrc</h2>
4897: </div>
4898: </div>
4899: </div>
4900:
4901: <p>When installing packages as non-root user and using
1.24 wiz 4902: the just-in-time <a href=
4903: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4904: <span class="citerefentry"><span class=
4905: "refentrytitle">su</span>(1)</span></a> feature of
4906: pkgsrc, it can become annoying to type in the root
4907: password for each required package installed. To avoid
4908: this, the sudo package can be used, which does password
4909: caching over a limited time. To use it, install sudo
4910: (either as binary package or from <a xmlns=
4911: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4912: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4913: class="pkgname">security/sudo</a>) and then put the
4914: following into your <code class=
4915: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4916: <pre class="programlisting">
1.34 wiz 4917: .if exists(${LOCALBASE}/bin/sudo)
4918: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
4919: .endif
1.1 grant 4920: </pre>
4921: </div>
4922:
4923: <div class="sect1" lang="en" xml:lang="en">
4924: <div class="titlepage">
4925: <div>
4926: <div>
4927: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4928: "faq.conf" id="faq.conf"></a>7.14. How do I
1.35 jmmv 4929: change the location of configuration files?</h2>
1.1 grant 4930: </div>
4931: </div>
4932: </div>
4933:
1.35 jmmv 4934: <p>As the system administrator, you can choose where
4935: configuration files are installed. The default settings
4936: make all these files go into <code class=
4937: "filename">${PREFIX}/etc</code> or some of its
4938: subdirectories; this may be suboptimal depending on your
4939: expectations (e.g., a read-only, NFS-exported
4940: <code class="varname">PREFIX</code> with a need of
4941: per-machine configuration of the provided packages).</p>
4942:
4943: <p>In order to change the defaults, you can modify the
4944: <code class="varname">PKG_SYSCONFBASE</code> variable (in
4945: <code class="filename">/etc/mk.conf</code>) to point to
4946: your preferred configuration directory; some common
4947: examples include <code class="filename">/etc</code> or
4948: <code class="filename">/etc/pkg</code>.</p>
4949:
4950: <p>Furthermore, you can change this value on a
4951: per-package basis by setting the <code class=
4952: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4953: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
4954: value usually matches the name of the package you would
4955: like to modify, that is, the contents of <code class=
4956: "varname">PKGBASE</code>.</p>
1.1 grant 4957:
1.35 jmmv 4958: <p>Note that, after changing these settings, you must
4959: rebuild and reinstall any affected packages.</p>
1.1 grant 4960: </div>
4961:
4962: <div class="sect1" lang="en" xml:lang="en">
4963: <div class="titlepage">
4964: <div>
4965: <div>
4966: <h2 class="title" style="clear: both"><a name=
4967: "audit-packages" id=
1.38 dillo 4968: "audit-packages"></a>7.15. Automated security
1.1 grant 4969: checks</h2>
4970: </div>
4971: </div>
4972: </div>
4973:
4974: <p>Please be aware that there can often be bugs in
4975: third-party software, and some of these bugs can leave a
4976: machine vulnerable to exploitation by attackers. In an
4977: effort to lessen the exposure, the NetBSD packages team
4978: maintains a database of known-exploits to packages which
4979: have at one time been included in pkgsrc. The database
4980: can be downloaded automatically, and a security audit of
4981: all packages installed on a system can take place. To do
4982: this, install the <a xmlns=
4983: "http://www.w3.org/TR/xhtml1/transitional" href=
4984: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4985: class="pkgname">security/audit-packages</a> package. It
4986: has two components:</p>
1.1 grant 4987:
4988: <div class="orderedlist">
4989: <ol type="1">
4990: <li>
1.34 wiz 4991: <p><span><strong class=
4992: "command">download-vulnerability-list</strong></span>,
1.1 grant 4993: an easy way to download a list of the security
4994: vulnerabilities information. This list is kept up
4995: to date by the NetBSD security officer and the
4996: NetBSD packages team, and is distributed from the
4997: NetBSD ftp server:</p>
4998:
4999: <p><a href=
5000: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5001: target=
5002: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5003: </li>
5004:
5005: <li>
1.34 wiz 5006: <p><span><strong class=
5007: "command">audit-packages</strong></span>, an easy
5008: way to audit the current machine, checking each
1.1 grant 5009: vulnerability which is known. If a vulnerable
5010: package is installed, it will be shown by output to
5011: stdout, including a description of the type of
5012: vulnerability, and a URL containing more
5013: information.</p>
5014: </li>
5015: </ol>
5016: </div>
5017:
1.23 wiz 5018: <p>Use of the <a xmlns=
5019: "http://www.w3.org/TR/xhtml1/transitional" href=
5020: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
5021: class="pkgname">security/audit-packages</a> package is
5022: strongly recommended! After “<span class=
5023: "quote">audit-packages</span>” is installed, please
5024: read the package's message, which you can get by running
5025: <strong class="userinput"><code>pkg_info -D
5026: audit-package</code></strong>.</p>
1.1 grant 5027: </div>
5028: </div>
5029: </div>
5030:
5031: <div class="part" lang="en" xml:lang="en">
5032: <div class="titlepage">
5033: <div>
5034: <div>
5035: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 5036: "developers-guide"></a>The pkgsrc developer's
5037: guide</h1>
1.1 grant 5038: </div>
5039: </div>
5040: </div>
5041:
5042: <div class="toc">
5043: <p><b>Table of Contents</b></p>
5044:
5045: <dl>
1.38 dillo 5046: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5047: Package components - files, directories and
5048: contents</a></span></dt>
5049:
5050: <dd>
5051: <dl>
5052: <dt><span class="sect1"><a href=
1.38 dillo 5053: "#components.Makefile">8.1. <code class=
1.27 rillig 5054: "filename">Makefile</code></a></span></dt>
5055:
5056: <dt><span class="sect1"><a href=
1.38 dillo 5057: "#components.distinfo">8.2. <code class=
1.27 rillig 5058: "filename">distinfo</code></a></span></dt>
5059:
5060: <dt><span class="sect1"><a href=
1.38 dillo 5061: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5062:
1.30 wiz 5063: <dt><span class="sect1"><a href=
1.38 dillo 5064: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5065: files</a></span></dt>
1.27 rillig 5066:
5067: <dt><span class="sect1"><a href=
1.38 dillo 5068: "#components.optional">8.5. Optional
1.27 rillig 5069: files</a></span></dt>
5070:
1.38 dillo 5071: <dt><span class="sect1"><a href="#work-dir">8.6.
1.27 rillig 5072: <code class="filename">work*</code></a></span></dt>
5073:
1.38 dillo 5074: <dt><span class="sect1"><a href="#files-dir">8.7.
1.27 rillig 5075: <code class="filename">files/*</code></a></span></dt>
5076: </dl>
5077: </dd>
5078:
1.38 dillo 5079: <dt><span class="chapter"><a href="#makefile">9.
1.25 rillig 5080: Programming in <code class=
5081: "filename">Makefile</code>s</a></span></dt>
5082:
5083: <dd>
5084: <dl>
5085: <dt><span class="sect1"><a href=
1.38 dillo 5086: "#makefile.variables">9.1. <code class=
1.25 rillig 5087: "filename">Makefile</code> variables</a></span></dt>
5088:
1.27 rillig 5089: <dd>
5090: <dl>
5091: <dt><span class="sect2"><a href=
1.38 dillo 5092: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5093: conventions</a></span></dt>
5094: </dl>
5095: </dd>
5096:
1.38 dillo 5097: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5098: Code snippets</a></span></dt>
5099:
5100: <dd>
5101: <dl>
5102: <dt><span class="sect2"><a href=
1.38 dillo 5103: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5104: list</a></span></dt>
5105:
5106: <dt><span class="sect2"><a href=
1.38 dillo 5107: "#converting-internal-to-external">9.2.2.
1.30 wiz 5108: Converting an internal list into an external
5109: list</a></span></dt>
1.25 rillig 5110:
5111: <dt><span class="sect2"><a href=
1.38 dillo 5112: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5113: variables to a shell command</a></span></dt>
1.27 rillig 5114:
5115: <dt><span class="sect2"><a href=
1.38 dillo 5116: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5117: guideline</a></span></dt>
5118:
5119: <dt><span class="sect2"><a href=
1.38 dillo 5120: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5121: a bug in BSD Make</a></span></dt>
1.25 rillig 5122: </dl>
5123: </dd>
5124: </dl>
5125: </dd>
5126:
1.38 dillo 5127: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5128: issues</a></span></dt>
5129:
5130: <dd>
5131: <dl>
1.38 dillo 5132: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5133: ID</a></span></dt>
5134:
1.30 wiz 5135: <dt><span class="sect1"><a href=
1.38 dillo 5136: "#automatic-plist-generation">10.2. Semi-automatic
1.30 wiz 5137: <code class="filename">PLIST</code>
1.14 xtraeme 5138: generation</a></span></dt>
1.1 grant 5139:
1.38 dillo 5140: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5141: Tweaking output of <span><strong class="command">make
5142: print-PLIST</strong></span></a></span></dt>
1.1 grant 5143:
1.38 dillo 5144: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5145: Variable substitution in PLIST</a></span></dt>
5146:
1.30 wiz 5147: <dt><span class="sect1"><a href=
1.38 dillo 5148: "#manpage-compression">10.5.
1.1 grant 5149: Manpage-compression</a></span></dt>
5150:
1.30 wiz 5151: <dt><span class="sect1"><a href=
1.38 dillo 5152: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5153: <code class=
1.14 xtraeme 5154: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5155:
1.30 wiz 5156: <dt><span class="sect1"><a href=
1.38 dillo 5157: "#platform-specific-plist">10.7. Platform specific
5158: and differing PLISTs</a></span></dt>
1.1 grant 5159:
5160: <dt><span class="sect1"><a href=
1.38 dillo 5161: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5162: packages</a></span></dt>
5163: </dl>
5164: </dd>
5165:
1.38 dillo 5166: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5167: Buildlink methodology</a></span></dt>
5168:
5169: <dd>
5170: <dl>
1.30 wiz 5171: <dt><span class="sect1"><a href=
1.38 dillo 5172: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5173: to use buildlink3</a></span></dt>
1.1 grant 5174:
1.30 wiz 5175: <dt><span class="sect1"><a href=
1.38 dillo 5176: "#creating-buildlink3.mk">11.2. Writing <code class=
1.30 wiz 5177: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5178:
5179: <dd>
5180: <dl>
5181: <dt><span class="sect2"><a href=
1.38 dillo 5182: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5183: buildlink3.mk file</a></span></dt>
1.1 grant 5184:
5185: <dt><span class="sect2"><a href=
1.38 dillo 5186: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5187: <code class=
5188: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5189: <code>pkg</code></em></code> in <code class=
5190: "filename">buildlink3.mk</code>
1.1 grant 5191: files</a></span></dt>
5192: </dl>
5193: </dd>
5194:
1.30 wiz 5195: <dt><span class="sect1"><a href=
1.38 dillo 5196: "#writing-builtin.mk">11.3. Writing <code class=
1.30 wiz 5197: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5198:
5199: <dd>
5200: <dl>
5201: <dt><span class="sect2"><a href=
1.38 dillo 5202: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30 wiz 5203: <code class="filename">builtin.mk</code>
5204: file</a></span></dt>
1.1 grant 5205:
5206: <dt><span class="sect2"><a href=
1.38 dillo 5207: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5208: preferences for native or pkgsrc
5209: software</a></span></dt>
1.1 grant 5210: </dl>
5211: </dd>
5212: </dl>
5213: </dd>
5214:
1.38 dillo 5215: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5216: pkginstall framework</a></span></dt>
5217:
5218: <dd>
5219: <dl>
5220: <dt><span class="sect1"><a href=
1.38 dillo 5221: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5222: directories outside the installation
5223: prefix</a></span></dt>
5224:
5225: <dd>
5226: <dl>
5227: <dt><span class="sect2"><a href=
1.38 dillo 5228: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5229: manipulation</a></span></dt>
5230:
5231: <dt><span class="sect2"><a href=
1.38 dillo 5232: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5233: manipulation</a></span></dt>
5234: </dl>
5235: </dd>
5236:
1.38 dillo 5237: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5238: Configuration files</a></span></dt>
5239:
5240: <dd>
5241: <dl>
5242: <dt><span class="sect2"><a href=
1.38 dillo 5243: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5244: "varname">PKG_SYSCONFDIR</code> is
5245: set</a></span></dt>
5246:
5247: <dt><span class="sect2"><a href=
1.38 dillo 5248: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 5249: software were configuration files
5250: are</a></span></dt>
5251:
5252: <dt><span class="sect2"><a href=
1.38 dillo 5253: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5254: installations</a></span></dt>
5255:
5256: <dt><span class="sect2"><a href=
1.38 dillo 5257: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5258: of configuration files</a></span></dt>
5259: </dl>
5260: </dd>
5261:
1.38 dillo 5262: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5263: System startup scripts</a></span></dt>
5264:
5265: <dd>
5266: <dl>
5267: <dt><span class="sect2"><a href=
1.38 dillo 5268: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5269: of system startup scripts</a></span></dt>
5270: </dl>
5271: </dd>
5272:
5273: <dt><span class="sect1"><a href=
1.38 dillo 5274: "#users-and-groups">12.4. System users and
1.35 jmmv 5275: groups</a></span></dt>
5276:
1.38 dillo 5277: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5278: System shells</a></span></dt>
5279:
5280: <dd>
5281: <dl>
5282: <dt><span class="sect2"><a href=
1.38 dillo 5283: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5284: configuration files</a></span></dt>
5285: </dl>
5286: </dd>
5287: </dl>
5288: </dd>
5289:
1.38 dillo 5290: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5291: handling</a></span></dt>
5292:
5293: <dd>
5294: <dl>
1.30 wiz 5295: <dt><span class="sect1"><a href=
1.38 dillo 5296: "#global-default-options">13.1. Global default
1.30 wiz 5297: options</a></span></dt>
1.1 grant 5298:
1.30 wiz 5299: <dt><span class="sect1"><a href=
1.38 dillo 5300: "#converting-to-options">13.2. Converting packages to
1.30 wiz 5301: use <code class=
1.14 xtraeme 5302: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5303: </dl>
5304: </dd>
5305:
1.38 dillo 5306: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5307: process</a></span></dt>
5308:
5309: <dd>
5310: <dl>
1.38 dillo 5311: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5312: Program location</a></span></dt>
5313:
1.38 dillo 5314: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5315: Main targets</a></span></dt>
5316:
5317: <dt><span class="sect1"><a href=
1.38 dillo 5318: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5319: targets</a></span></dt>
5320: </dl>
5321: </dd>
5322:
1.38 dillo 5323: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5324: fixes for packages</a></span></dt>
5325:
5326: <dd>
5327: <dl>
1.30 wiz 5328: <dt><span class="sect1"><a href=
1.38 dillo 5329: "#general-operation">15.1. General
1.30 wiz 5330: operation</a></span></dt>
1.1 grant 5331:
5332: <dd>
5333: <dl>
5334: <dt><span class="sect2"><a href=
1.38 dillo 5335: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5336: pull in variables from
5337: /etc/mk.conf</a></span></dt>
1.1 grant 5338:
5339: <dt><span class="sect2"><a href=
1.38 dillo 5340: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5341: to install documentation</a></span></dt>
5342:
5343: <dt><span class="sect2"><a href=
1.38 dillo 5344: "#restricted-packages">15.1.3. Restricted
1.1 grant 5345: packages</a></span></dt>
5346:
5347: <dt><span class="sect2"><a href=
1.38 dillo 5348: "#dependencies">15.1.4. Handling
1.1 grant 5349: dependencies</a></span></dt>
5350:
5351: <dt><span class="sect2"><a href=
1.38 dillo 5352: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5353: other packages</a></span></dt>
5354:
5355: <dt><span class="sect2"><a href=
1.38 dillo 5356: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5357: cannot or should not be built</a></span></dt>
1.1 grant 5358:
5359: <dt><span class="sect2"><a href=
1.38 dillo 5360: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 5361: should not be deleted, once
5362: installed</a></span></dt>
1.1 grant 5363:
5364: <dt><span class="sect2"><a href=
1.38 dillo 5365: "#security-handling">15.1.8. Handling packages
1.1 grant 5366: with security problems</a></span></dt>
5367:
5368: <dt><span class="sect2"><a href=
1.38 dillo 5369: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 5370: bugs</a></span></dt>
5371:
5372: <dt><span class="sect2"><a href=
1.38 dillo 5373: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 5374: incrementing versions when fixing an existing
1.1 grant 5375: package</a></span></dt>
5376:
5377: <dt><span class="sect2"><a href=
1.38 dillo 5378: "#portability-of-packages">15.1.11. Portability
1.30 wiz 5379: of packages</a></span></dt>
1.1 grant 5380: </dl>
5381: </dd>
5382:
1.30 wiz 5383: <dt><span class="sect1"><a href=
1.38 dillo 5384: "#downloading-issues">15.2. Possible downloading
1.30 wiz 5385: issues</a></span></dt>
1.1 grant 5386:
5387: <dd>
5388: <dl>
5389: <dt><span class="sect2"><a href=
1.38 dillo 5390: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 5391: distfiles aren't available for plain
1.1 grant 5392: downloading</a></span></dt>
5393:
5394: <dt><span class="sect2"><a href=
1.38 dillo 5395: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 5396: handle modified distfiles with the 'old'
5397: name</a></span></dt>
1.1 grant 5398: </dl>
5399: </dd>
5400:
1.30 wiz 5401: <dt><span class="sect1"><a href=
1.38 dillo 5402: "#configuration-gotchas">15.3. Configuration
1.30 wiz 5403: gotchas</a></span></dt>
1.1 grant 5404:
5405: <dd>
5406: <dl>
5407: <dt><span class="sect2"><a href=
1.38 dillo 5408: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 5409: libtool</a></span></dt>
5410:
5411: <dt><span class="sect2"><a href=
1.38 dillo 5412: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 5413: packages that already support
5414: libtool</a></span></dt>
5415:
5416: <dt><span class="sect2"><a href=
1.38 dillo 5417: "#autoconf-automake">15.3.3. GNU
1.1 grant 5418: Autoconf/Automake</a></span></dt>
5419: </dl>
5420: </dd>
5421:
1.30 wiz 5422: <dt><span class="sect1"><a href=
1.38 dillo 5423: "#building-considerations">15.4. Building
1.30 wiz 5424: considerations</a></span></dt>
1.1 grant 5425:
5426: <dd>
5427: <dl>
5428: <dt><span class="sect2"><a href=
1.38 dillo 5429: "#cpp-defines">15.4.1. CPP
1.30 wiz 5430: defines</a></span></dt>
1.1 grant 5431: </dl>
5432: </dd>
5433:
1.30 wiz 5434: <dt><span class="sect1"><a href=
1.38 dillo 5435: "#package-specific-actions">15.5. Package specific
1.30 wiz 5436: actions</a></span></dt>
1.1 grant 5437:
5438: <dd>
5439: <dl>
5440: <dt><span class="sect2"><a href=
1.38 dillo 5441: "#user-interaction">15.5.1. User
1.2 hubertf 5442: interaction</a></span></dt>
1.1 grant 5443:
5444: <dt><span class="sect2"><a href=
1.38 dillo 5445: "#handling-licenses">15.5.2. Handling
1.1 grant 5446: licenses</a></span></dt>
5447:
5448: <dt><span class="sect2"><a href=
1.38 dillo 5449: "#installing-score-files">15.5.3. Installing
1.30 wiz 5450: score files</a></span></dt>
1.1 grant 5451:
5452: <dt><span class="sect2"><a href=
1.38 dillo 5453: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 5454: scripts</a></span></dt>
5455:
5456: <dt><span class="sect2"><a href=
1.38 dillo 5457: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 5458: hardcoded paths to other
5459: interpreters</a></span></dt>
1.1 grant 5460:
5461: <dt><span class="sect2"><a href=
1.38 dillo 5462: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 5463: modules</a></span></dt>
5464:
5465: <dt><span class="sect2"><a href=
1.38 dillo 5466: "#faq.info-files">15.5.7. Packages installing
1.1 grant 5467: info files</a></span></dt>
5468:
5469: <dt><span class="sect2"><a href=
1.38 dillo 5470: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 5471: GConf2 data files</a></span></dt>
1.1 grant 5472:
5473: <dt><span class="sect2"><a href=
1.38 dillo 5474: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 5475: installing scrollkeeper data
5476: files</a></span></dt>
1.1 grant 5477:
5478: <dt><span class="sect2"><a href=
1.38 dillo 5479: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 5480: fonts</a></span></dt>
5481:
5482: <dt><span class="sect2"><a href=
1.38 dillo 5483: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 5484: modules</a></span></dt>
5485:
5486: <dt><span class="sect2"><a href=
1.38 dillo 5487: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 5488: SGML or XML data</a></span></dt>
1.1 grant 5489:
5490: <dt><span class="sect2"><a href=
1.38 dillo 5491: "#mime-database">15.5.13. Packages installing
1.1 grant 5492: extensions to the MIME database</a></span></dt>
5493:
5494: <dt><span class="sect2"><a href=
1.38 dillo 5495: "#intltool">15.5.14. Packages using
1.1 grant 5496: intltool</a></span></dt>
1.18 xtraeme 5497:
5498: <dt><span class="sect2"><a href=
1.38 dillo 5499: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 5500: startup scripts</a></span></dt>
1.1 grant 5501: </dl>
5502: </dd>
5503:
1.30 wiz 5504: <dt><span class="sect1"><a href=
1.38 dillo 5505: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 5506: author</a></span></dt>
1.1 grant 5507: </dl>
5508: </dd>
5509:
1.38 dillo 5510: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 5511: Debugging</a></span></dt>
5512:
1.38 dillo 5513: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 5514: Submitting and Committing</a></span></dt>
5515:
5516: <dd>
5517: <dl>
1.30 wiz 5518: <dt><span class="sect1"><a href=
1.38 dillo 5519: "#submitting-your-package">17.1. Submitting your
1.30 wiz 5520: packages</a></span></dt>
1.1 grant 5521:
1.30 wiz 5522: <dt><span class="sect1"><a href=
1.38 dillo 5523: "#committing-importing">17.2. Committing: Importing a
1.30 wiz 5524: package into CVS</a></span></dt>
1.1 grant 5525:
1.30 wiz 5526: <dt><span class="sect1"><a href=
1.38 dillo 5527: "#updating-package">17.3. Updating a package to a
1.30 wiz 5528: newer version</a></span></dt>
1.1 grant 5529:
1.30 wiz 5530: <dt><span class="sect1"><a href=
1.38 dillo 5531: "#moving-package">17.4. Moving a package in
1.30 wiz 5532: pkgsrc</a></span></dt>
1.1 grant 5533: </dl>
5534: </dd>
5535: </dl>
5536: </div>
5537:
5538: <div class="chapter" lang="en" xml:lang="en">
5539: <div class="titlepage">
5540: <div>
5541: <div>
1.27 rillig 5542: <h2 class="title"><a name="components" id=
1.38 dillo 5543: "components"></a>Chapter 8. Package
1.27 rillig 5544: components - files, directories and contents</h2>
1.25 rillig 5545: </div>
5546: </div>
5547: </div>
5548:
5549: <div class="toc">
5550: <p><b>Table of Contents</b></p>
5551:
5552: <dl>
5553: <dt><span class="sect1"><a href=
1.38 dillo 5554: "#components.Makefile">8.1. <code class=
1.27 rillig 5555: "filename">Makefile</code></a></span></dt>
5556:
5557: <dt><span class="sect1"><a href=
1.38 dillo 5558: "#components.distinfo">8.2. <code class=
1.27 rillig 5559: "filename">distinfo</code></a></span></dt>
5560:
5561: <dt><span class="sect1"><a href=
1.38 dillo 5562: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 5563:
1.30 wiz 5564: <dt><span class="sect1"><a href=
1.38 dillo 5565: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5566: files</a></span></dt>
1.25 rillig 5567:
1.27 rillig 5568: <dt><span class="sect1"><a href=
1.38 dillo 5569: "#components.optional">8.5. Optional
1.27 rillig 5570: files</a></span></dt>
1.25 rillig 5571:
1.38 dillo 5572: <dt><span class="sect1"><a href="#work-dir">8.6.
1.27 rillig 5573: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5574:
1.38 dillo 5575: <dt><span class="sect1"><a href="#files-dir">8.7.
1.27 rillig 5576: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5577: </dl>
5578: </div>
5579:
1.27 rillig 5580: <p>Whenever you're preparing a package, there are a number
5581: of files involved which are described in the following
5582: sections.</p>
1.25 rillig 5583:
5584: <div class="sect1" lang="en" xml:lang="en">
5585: <div class="titlepage">
5586: <div>
5587: <div>
5588: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5589: "components.Makefile" id=
1.38 dillo 5590: "components.Makefile"></a>8.1. <code class=
1.27 rillig 5591: "filename">Makefile</code></h2>
1.25 rillig 5592: </div>
5593: </div>
5594: </div>
5595:
1.27 rillig 5596: <p>Building, installation and creation of a binary
5597: package are all controlled by the package's <code class=
5598: "filename">Makefile</code>. The <code class=
5599: "filename">Makefile</code> describes various things about
5600: a package, for example from where to get it, how to
5601: configure, build, and install it.</p>
5602:
5603: <p>A package <code class="filename">Makefile</code>
5604: contains several sections that describe the package.</p>
1.25 rillig 5605:
1.27 rillig 5606: <p>In the first section there are the following
5607: variables, which should appear exactly in the order given
5608: here.</p>
1.25 rillig 5609:
5610: <div class="itemizedlist">
5611: <ul type="disc">
5612: <li>
1.27 rillig 5613: <p><code class="varname">DISTNAME</code> is the
5614: basename of the distribution file to be downloaded
5615: from the package's website.</p>
5616: </li>
5617:
5618: <li>
5619: <p><code class="varname">PKGNAME</code> is the name
5620: of the package, as used by pkgsrc. You only need to
5621: provide it if it differs from DISTNAME. Usually it
5622: is the directory name together with the version
5623: number. It must match the regular expression
5624: <code class=
5625: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5626: that is, it starts with a letter or digit, and
5627: contains only letters, digits, dashes, underscores,
5628: dots and plus signs.</p>
1.25 rillig 5629: </li>
5630:
5631: <li>
1.27 rillig 5632: <p><code class="varname">CATEGORIES</code> is a
5633: list of categories which the package fits in. You
5634: can choose any of the top-level directories of
5635: pkgsrc for it.</p>
1.25 rillig 5636: </li>
5637:
5638: <li>
1.27 rillig 5639: <p><code class="varname">MASTER_SITES</code> is a
5640: list of URLs where the distribution files can be
5641: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5642: </li>
5643: </ul>
5644: </div>
5645:
1.27 rillig 5646: <p>The second section contains the following
5647: variables.</p>
1.25 rillig 5648:
1.27 rillig 5649: <div class="itemizedlist">
5650: <ul type="disc">
5651: <li>
5652: <p><code class="varname">MAINTAINER</code> is the
5653: mail address of the package's maintainer, which is
5654: the person you can contact when the package does
5655: not work.</p>
5656: </li>
1.25 rillig 5657:
1.27 rillig 5658: <li>
5659: <p><code class="varname">HOMEPAGE</code> is a URL
5660: where users can find more information about the
1.23 wiz 5661: package.</p>
5662: </li>
1.1 grant 5663:
1.23 wiz 5664: <li>
5665: <p><code class="varname">COMMENT</code> is a
5666: one-line comment about the purpose of the
5667: package.</p>
5668: </li>
5669: </ul>
5670: </div>
1.1 grant 5671:
1.14 xtraeme 5672: <p>The <code class="varname">MASTER_SITES</code> may be
5673: set to one of the predefined sites:</p>
1.1 grant 5674: <pre class="programlisting">
5675: ${MASTER_SITE_APACHE}
1.27 rillig 5676: ${MASTER_SITE_BACKUP}
5677: ${MASTER_SITE_CYGWIN}
1.1 grant 5678: ${MASTER_SITE_DEBIAN}
1.27 rillig 5679: ${MASTER_SITE_FREEBSD}
5680: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5681: ${MASTER_SITE_GNOME}
5682: ${MASTER_SITE_GNU}
5683: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5684: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5685: ${MASTER_SITE_MOZILLA}
1.27 rillig 5686: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5687: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5688: ${MASTER_SITE_R_CRAN}
1.1 grant 5689: ${MASTER_SITE_SOURCEFORGE}
5690: ${MASTER_SITE_SUNSITE}
5691: ${MASTER_SITE_SUSE}
5692: ${MASTER_SITE_TEX_CTAN}
5693: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5694: ${MASTER_SITE_XEMACS}
5695:
1.1 grant 5696: </pre>
5697:
5698: <p>If one of these predefined sites is chosen, you may
5699: require the ability to specify a subdirectory of that
5700: site. Since these macros may expand to more than one
5701: actual site, you <span class=
5702: "emphasis"><em>must</em></span> use the following
5703: construct to specify a subdirectory:</p>
5704: <pre class="programlisting">
5705: ${MASTER_SITE_GNU:=subdirectory/name/}
5706: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5707: </pre>
5708:
5709: <p>Note the trailing slash after the subdirectory
5710: name.</p>
5711:
5712: <div class="note" style=
5713: "margin-left: 0.5in; margin-right: 0.5in;">
5714: <h3 class="title">Note</h3>
5715:
1.14 xtraeme 5716: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5717: been deprecated and <span class="emphasis"><em>should
5718: no longer be used</em></span>.</p>
1.1 grant 5719: </div>
5720:
1.14 xtraeme 5721: <p>If the package has multiple <code class=
5722: "varname">DISTFILES</code> or multiple <code class=
5723: "varname">PATCHFILES</code> from different sites, set
5724: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5725: where file “<span class="quote">foo</span>”
5726: may be found. “<span class=
5727: "quote">foo</span>” includes the suffix, e.g.</p>
5728: <pre class="programlisting">
5729: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5730: DISTFILES+= foo-file.tar.gz
5731: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5732: http://www.somewhereelse.com/mirror/somehow/
5733: </pre>
5734:
1.14 xtraeme 5735: <p>Note that the normal default setting of <code class=
5736: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5737: want to add to it (rather than replace it), as you
5738: usually would.</p>
5739:
5740: <p>Currently the following values are available for
1.14 xtraeme 5741: <code class="varname">CATEGORIES</code>. If more than one
5742: is used, they need to be separated by spaces:</p>
1.1 grant 5743: <pre class="programlisting">
5744: archivers cross geography meta-pkgs security
5745: audio databases graphics misc shells
5746: benchmarks devel ham multimedia sysutils
5747: biology editors inputmethod net textproc
5748: cad emulators lang news time
5749: chat finance mail parallel wm
5750: comms fonts math pkgtools www
5751: converters games mbone print x11
5752: </pre>
5753:
5754: <p>Please pay attention to the following gotchas:</p>
5755:
5756: <div class="itemizedlist">
5757: <ul type="disc">
5758: <li>
1.14 xtraeme 5759: <p>Add <code class="varname">MANCOMPRESSED</code>
5760: if manpages are installed in compressed form by the
5761: package; see comment in <code class=
5762: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5763: </li>
5764:
5765: <li>
1.14 xtraeme 5766: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5767: with “<span class=
5768: "quote">${PREFIX}</span>” in all files (see
5769: patches, below).</p>
5770: </li>
5771:
5772: <li>
5773: <p>If the package installs any info files, see
5774: <a href="#faq.info-files" title=
1.38 dillo 5775: "15.5.7. Packages installing info files">Section
5776: 15.5.7, “Packages installing info
1.1 grant 5777: files”</a>.</p>
5778: </li>
5779:
5780: <li>
1.14 xtraeme 5781: <p>Set <code class="varname">MAINTAINER</code> to
5782: be yourself. If you really can't maintain the
5783: package for future updates, set it to <code class=
1.1 grant 5784: "email"><<a href=
1.14 xtraeme 5785: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5786: </li>
5787:
5788: <li>
5789: <p>If a home page for the software in question
1.14 xtraeme 5790: exists, add the variable <code class=
5791: "varname">HOMEPAGE</code> right after <code class=
5792: "varname">MAINTAINER</code>. The value of this
1.1 grant 5793: variable should be the URL for the home page.</p>
5794: </li>
5795:
5796: <li>
1.14 xtraeme 5797: <p>Be sure to set the <code class=
5798: "varname">COMMENT</code> variable to a short
1.1 grant 5799: description of the package, not containing the
5800: pkg's name.</p>
5801: </li>
5802: </ul>
5803: </div>
5804: </div>
5805:
5806: <div class="sect1" lang="en" xml:lang="en">
5807: <div class="titlepage">
5808: <div>
5809: <div>
5810: <h2 class="title" style="clear: both"><a name=
5811: "components.distinfo" id=
1.38 dillo 5812: "components.distinfo"></a>8.2. <code class=
1.14 xtraeme 5813: "filename">distinfo</code></h2>
1.1 grant 5814: </div>
5815: </div>
5816: </div>
5817:
5818: <p>Most important, the mandatory message digest, or
5819: checksum, of all the distfiles needed for the package to
5820: compile, confirming they match the original file
5821: distributed by the author. This ensures that the distfile
5822: retrieved from the Internet has not been corrupted during
5823: transfer or altered by a malign force to introduce a
1.14 xtraeme 5824: security hole. It is generated using the
5825: <span><strong class="command">make
5826: makesum</strong></span> command. The digest algorithm
5827: used was, at one stage, md5, but that was felt lacking
5828: compared to sha1, and so sha1 is now the default
1.1 grant 5829: algorithm. The distfile size is also generated and stored
5830: in new distinfo files. The <a xmlns=
5831: "http://www.w3.org/TR/xhtml1/transitional" href=
5832: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5833: class="pkgname">pkgtools/digest</a> utility calculates
5834: all of the digests in the distinfo file, and it provides
5835: various different algorithms. At the current time, the
5836: algorithms provided are: <span class=
5837: "emphasis"><em>md5</em></span>, <span class=
5838: "emphasis"><em>rmd160</em></span>, <span class=
5839: "emphasis"><em>sha1</em></span>, <span class=
5840: "emphasis"><em>sha256</em></span>, <span class=
5841: "emphasis"><em>sha384</em></span> and <span class=
5842: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5843:
5844: <p>Some packages have different sets of distfiles on a
5845: per architecture basis, for example <a xmlns=
5846: "http://www.w3.org/TR/xhtml1/transitional" href=
5847: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5848: class="pkgname">www/navigator</a>). These are kept in the
5849: same distinfo file and care should be taken when
5850: upgrading such a package to ensure distfile information
5851: is not lost.</p>
1.1 grant 5852:
5853: <p>The message digest/checksum for all the official
1.14 xtraeme 5854: patches found in the <code class=
5855: "filename">patches/</code> directory (see <a href=
5856: "#components.patches" title=
1.38 dillo 5857: "8.3. patches/*">Section 8.3,
1.1 grant 5858: “patches/*”</a>) for the package is also
1.14 xtraeme 5859: stored in the <code class="filename">distinfo</code>
5860: file. This is a message digest/checksum of all lines in
5861: the patch file except the NetBSD RCS Id. This file is
5862: generated by invoking <span><strong class="command">make
5863: makepatchsum</strong></span> (or <span><strong class=
5864: "command">make mps</strong></span> if you're in a
5865: hurry).</p>
1.1 grant 5866: </div>
5867:
5868: <div class="sect1" lang="en" xml:lang="en">
5869: <div class="titlepage">
5870: <div>
5871: <div>
5872: <h2 class="title" style="clear: both"><a name=
5873: "components.patches" id=
1.38 dillo 5874: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 5875: </div>
5876: </div>
5877: </div>
5878:
5879: <p>This directory contains files that are used by the
5880: <a href=
5881: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5882: <span class="citerefentry"><span class=
5883: "refentrytitle">patch</span>(1)</span></a> command to
5884: modify the sources as distributed in the distribution
5885: file into a form that will compile and run perfectly on
5886: NetBSD. The files are applied successively in alphabetic
5887: order (as returned by a shell “<span class=
5888: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5889: <code class="filename">patch-aa</code> is applied before
5890: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5891:
1.14 xtraeme 5892: <p>The <code class="filename">patch-*</code> files should
5893: be in <span><strong class="command">diff
5894: -bu</strong></span> format, and apply without a fuzz to
5895: avoid problems. (To force patches to apply with fuzz you
5896: can set <code class=
5897: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5898: not put changes for more than one file into a single
5899: patch-file, as this will make future modifications more
5900: difficult.</p>
5901:
5902: <p>Similar, a file should be patched at most once, not
5903: several times by several different patches. If a file
5904: needs several patches, they should be combined into one
5905: file.</p>
5906:
5907: <p>One important thing to mention is to pay attention
5908: that no RCS IDs get stored in the patch files, as these
5909: will cause problems when later checked into the NetBSD
1.14 xtraeme 5910: CVS tree. Use the <span><strong class=
5911: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5912: "http://www.w3.org/TR/xhtml1/transitional" href=
5913: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5914: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5915: these problems.</p>
1.1 grant 5916:
5917: <p>For even more automation, we recommend using
1.14 xtraeme 5918: <span><strong class="command">mkpatches</strong></span>
5919: from the same package to make a whole set of patches. You
5920: just have to backup files before you edit them to
5921: <code class="filename">filename.orig</code>, e.g. with
5922: <span><strong class="command">cp -p filename
5923: filename.orig</strong></span> or, easier, by using
5924: <span><strong class="command">pkgvi</strong></span> again
5925: from the same package. If you upgrade a package this way,
5926: you can easily compare the new set of patches with the
5927: previously existing one with <span><strong class=
5928: "command">patchdiff</strong></span>.</p>
1.1 grant 5929:
5930: <p>When you have finished a package, remember to generate
5931: the checksums for the patch files by using the
1.14 xtraeme 5932: <span><strong class="command">make
5933: makepatchsum</strong></span> command, see <a href=
5934: "#components.distinfo" title=
1.38 dillo 5935: "8.2. distinfo">Section 8.2,
1.14 xtraeme 5936: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5937:
5938: <p>Patch files that are distributed by the author or
1.14 xtraeme 5939: other maintainers can be listed in <code class=
5940: "varname">$PATCHFILES</code>.</p>
1.1 grant 5941:
5942: <p>If it is desired to store any patches that should not
5943: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5944: pkgsrc tree in the <code class=
5945: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5946: tree there is expected to have the same
5947: “<span class="quote">category/package</span>”
5948: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5949: stored inside these dirs (also known as <code class=
5950: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5951: you want to keep a private patch for <code class=
5952: "filename">pkgsrc/graphics/png</code>, keep it in
5953: <code class=
5954: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5955: files in the named directory are expected to be patch
1.1 grant 5956: files, and <span class="emphasis"><em>they are applied
5957: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5958: </div>
5959:
5960: <div class="sect1" lang="en" xml:lang="en">
5961: <div class="titlepage">
5962: <div>
5963: <div>
5964: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5965: "other-mandatory-files" id=
1.38 dillo 5966: "other-mandatory-files"></a>8.4. Other
1.27 rillig 5967: mandatory files</h2>
5968: </div>
5969: </div>
5970: </div>
5971:
5972: <div class="variablelist">
5973: <dl>
5974: <dt><span class="term"><code class=
5975: "filename">DESCR</code></span></dt>
5976:
5977: <dd>
5978: <p>A multi-line description of the piece of
5979: software. This should include any credits where
5980: they are due. Please bear in mind that others do
5981: not share your sense of humour (or spelling
5982: idiosyncrasies), and that others will read
5983: everything that you write here.</p>
5984: </dd>
5985:
5986: <dt><span class="term"><code class=
5987: "filename">PLIST</code></span></dt>
5988:
5989: <dd>
5990: <p>This file governs the files that are installed
5991: on your system: all the binaries, manual pages,
5992: etc. There are other directives which may be
5993: entered in this file, to control the creation and
5994: deletion of directories, and the location of
5995: inserted files. See <a href="#plist" title=
1.38 dillo 5996: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 5997: <i>PLIST issues</i></a> for more information.</p>
5998: </dd>
5999: </dl>
6000: </div>
6001: </div>
6002:
6003: <div class="sect1" lang="en" xml:lang="en">
6004: <div class="titlepage">
6005: <div>
6006: <div>
6007: <h2 class="title" style="clear: both"><a name=
6008: "components.optional" id=
1.38 dillo 6009: "components.optional"></a>8.5. Optional
1.27 rillig 6010: files</h2>
6011: </div>
6012: </div>
6013: </div>
6014:
6015: <div class="variablelist">
6016: <dl>
6017: <dt><span class="term"><code class=
6018: "filename">INSTALL</code></span></dt>
6019:
6020: <dd>
6021: <p>This shell script is invoked twice by <a href=
6022: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6023: <span class="citerefentry"><span class=
6024: "refentrytitle">pkg_add</span>(1)</span></a>. First
6025: time after package extraction and before files are
6026: moved in place, the second time after the files to
6027: install are moved in place. This can be used to do
6028: any custom procedures not possible with @exec
6029: commands in <code class="filename">PLIST</code>.
6030: See <a href=
6031: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6032: <span class="citerefentry"><span class=
6033: "refentrytitle">pkg_add</span>(1)</span></a> and
6034: <a href=
6035: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6036: <span class="citerefentry"><span class=
6037: "refentrytitle">pkg_create</span>(1)</span></a> for
6038: more information.</p>
6039: </dd>
6040:
6041: <dt><span class="term"><code class=
6042: "filename">DEINSTALL</code></span></dt>
6043:
6044: <dd>
6045: <p>This script is executed before and after any
6046: files are removed. It is this script's
6047: responsibility to clean up any additional messy
6048: details around the package's installation, since
6049: all pkg_delete knows is how to delete the files
6050: created in the original distribution. See <a href=
6051: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6052: <span class="citerefentry"><span class=
6053: "refentrytitle">pkg_delete</span>(1)</span></a> and
6054: <a href=
6055: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6056: <span class="citerefentry"><span class=
6057: "refentrytitle">pkg_create</span>(1)</span></a> for
6058: more information.</p>
6059: </dd>
6060:
6061: <dt><span class="term"><code class=
6062: "filename">MESSAGE</code></span></dt>
6063:
6064: <dd>
6065: <p>Display this file after installation of the
6066: package. Useful for things like legal notices on
6067: almost-free software and hints for updating config
6068: files after installing modules for apache, PHP etc.
6069: Please note that you can modify variables in it
6070: easily by using <code class=
6071: "varname">MESSAGE_SUBST</code> in the package's
6072: <code class="filename">Makefile</code>:</p>
6073: <pre class="programlisting">
6074: MESSAGE_SUBST+= SOMEVAR="somevalue"
6075: </pre>
6076:
6077: <p>replaces "${SOMEVAR}" with “<span class=
6078: "quote">somevalue</span>” in <code class=
6079: "filename">MESSAGE</code>.</p>
6080: </dd>
6081: </dl>
6082: </div>
6083: </div>
6084:
6085: <div class="sect1" lang="en" xml:lang="en">
6086: <div class="titlepage">
6087: <div>
6088: <div>
6089: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6090: "work-dir" id="work-dir"></a>8.6. <code class=
1.27 rillig 6091: "filename">work*</code></h2>
6092: </div>
6093: </div>
6094: </div>
6095:
6096: <p>When you type <span><strong class=
6097: "command">make</strong></span> the distribution files are
6098: unpacked into this directory. It can be removed by
6099: running <span><strong class="command">make
6100: clean</strong></span>. Besides the sources, this
6101: directory is also used to keep various timestamp
6102: files.</p>
6103:
6104: <p>If a package doesn't create a subdirectory for itself
6105: (like GNU software does, for instance), but extracts
6106: itself in the current directory, you should set
6107: <code class="varname">WRKSRC</code> accordingly, e.g.
6108: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6109: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
6110: class="pkgname">editors/sam</a> again, but the quick
6111: answer is:</p>
6112: <pre class="programlisting">
6113: WRKSRC= ${WRKDIR}
6114: </pre>
6115:
6116: <p>Please note that the old <code class=
6117: "varname">NO_WRKSUBDIR</code> has been deprecated and
6118: should not be used. Also, if your package doesn't create
6119: a subdir with the name of <code class=
6120: "varname">DISTNAME</code> but some different name, set
6121: <code class="varname">WRKSRC</code> to point to the
6122: proper name in <code class="filename">${WRKDIR}</code>.
6123: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6124: href=
6125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6126: class="pkgname">lang/tcl</a> and <a xmlns=
6127: "http://www.w3.org/TR/xhtml1/transitional" href=
6128: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6129: class="pkgname">x11/tk</a> for examples, and here is
6130: another one:</p>
6131: <pre class="programlisting">
6132: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6133: </pre>
6134:
6135: <p>The name of the working directory created by pkgsrc is
6136: <code class="filename">work</code> by default. If the
6137: same pkgsrc tree should be used on several different
6138: platforms, the variable <code class=
6139: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
6140: attach the platform to the directory name, e.g.
6141: <code class="filename">work.i386</code> or <code class=
6142: "filename">work.sparc</code>.</p>
6143: </div>
6144:
6145: <div class="sect1" lang="en" xml:lang="en">
6146: <div class="titlepage">
6147: <div>
6148: <div>
6149: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6150: "files-dir" id=
1.38 dillo 6151: "files-dir"></a>8.7. <code class=
1.27 rillig 6152: "filename">files/*</code></h2>
6153: </div>
6154: </div>
6155: </div>
6156:
6157: <p>If you have any files that you wish to be placed in
6158: the package prior to configuration or building, you could
6159: place these files here and use a “<span class=
6160: "quote">${CP}</span>” command in the
6161: “<span class="quote">pre-configure</span>”
6162: target to achieve this. Alternatively, you could simply
6163: diff the file against <code class=
6164: "filename">/dev/null</code> and use the patch mechanism
6165: to manage the creation of this file.</p>
6166: </div>
6167: </div>
6168:
6169: <div class="chapter" lang="en" xml:lang="en">
6170: <div class="titlepage">
6171: <div>
6172: <div>
6173: <h2 class="title"><a name="makefile" id=
1.38 dillo 6174: "makefile"></a>Chapter 9. Programming in
1.27 rillig 6175: <code class="filename">Makefile</code>s</h2>
6176: </div>
6177: </div>
6178: </div>
6179:
6180: <div class="toc">
6181: <p><b>Table of Contents</b></p>
6182:
6183: <dl>
6184: <dt><span class="sect1"><a href=
1.38 dillo 6185: "#makefile.variables">9.1. <code class=
1.27 rillig 6186: "filename">Makefile</code> variables</a></span></dt>
6187:
6188: <dd>
6189: <dl>
6190: <dt><span class="sect2"><a href=
1.38 dillo 6191: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6192: conventions</a></span></dt>
6193: </dl>
6194: </dd>
6195:
1.38 dillo 6196: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6197: Code snippets</a></span></dt>
6198:
6199: <dd>
6200: <dl>
1.30 wiz 6201: <dt><span class="sect2"><a href=
1.38 dillo 6202: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6203: list</a></span></dt>
1.27 rillig 6204:
1.30 wiz 6205: <dt><span class="sect2"><a href=
1.38 dillo 6206: "#converting-internal-to-external">9.2.2.
1.27 rillig 6207: Converting an internal list into an external
6208: list</a></span></dt>
6209:
1.30 wiz 6210: <dt><span class="sect2"><a href=
1.38 dillo 6211: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6212: variables to a shell command</a></span></dt>
1.27 rillig 6213:
1.30 wiz 6214: <dt><span class="sect2"><a href=
1.38 dillo 6215: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6216: guideline</a></span></dt>
1.27 rillig 6217:
1.30 wiz 6218: <dt><span class="sect2"><a href=
1.38 dillo 6219: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6220: bug in BSD Make</a></span></dt>
1.27 rillig 6221: </dl>
6222: </dd>
6223: </dl>
6224: </div>
6225:
6226: <p>Pkgsrc consists of many <code class=
6227: "filename">Makefile</code> fragments, each of which forms a
6228: well-defined part of the pkgsrc system. Using the <a href=
6229: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6230: <span class="citerefentry"><span class=
6231: "refentrytitle">make</span>(1)</span></a> system as a
6232: programming language for a big system like pkgsrc requires
6233: some discipline to keep the code correct and
6234: understandable.</p>
6235:
6236: <p>The basic ingredients for <code class=
6237: "filename">Makefile</code> programming are variables (which
6238: are actually macros) and shell commands. Among these shell
6239: commands may even be more complex ones like <a href=
6240: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6241: <span class="citerefentry"><span class=
6242: "refentrytitle">awk</span>(1)</span></a> programs. To make
6243: sure that every shell command runs as intended it is
6244: necessary to quote all variables correctly when they are
6245: used.</p>
6246:
6247: <p>This chapter describes some patterns, that appear quite
6248: often in <code class="filename">Makefile</code>s, including
6249: the pitfalls that come along with them.</p>
6250:
6251: <div class="sect1" lang="en" xml:lang="en">
6252: <div class="titlepage">
6253: <div>
6254: <div>
6255: <h2 class="title" style="clear: both"><a name=
6256: "makefile.variables" id=
1.38 dillo 6257: "makefile.variables"></a>9.1. <code class=
1.27 rillig 6258: "filename">Makefile</code> variables</h2>
6259: </div>
6260: </div>
6261: </div>
6262:
6263: <p><code class="filename">Makefile</code> variables
6264: contain strings that can be processed using the five
6265: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6266: which are described in the <a href=
6267: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6268: <span class="citerefentry"><span class=
6269: "refentrytitle">make</span>(1)</span></a> man page.</p>
6270:
6271: <p>When a variable's value is parsed from a <code class=
6272: "filename">Makefile</code>, the hash character ``#'' and
6273: the backslash character ``\'' are handled specially. If a
6274: backslash is followed by a newline, any whitespace
6275: immediately in front of the backslash, the backslash, the
6276: newline, and any whitespace immediately behind the
6277: newline are replaced with a single space. A backspace
6278: character and an immediately following hash character are
6279: replaced with a single hash character. Otherwise the
6280: backslash is passed as is. In a variable assignment, any
6281: hash character that is not preceded by a backslash starts
6282: a comment that continues upto the end of the logical
6283: line.</p>
6284:
6285: <p><span class="emphasis"><em>Note:</em></span> Because
6286: of this parsing algorithm the only way to create a
6287: variable consisting of a single backslash is using the
6288: ``!='' operator, for example: <code class=
6289: "varname">BACKSLASH!=echo "\\"</code>.</p>
6290:
6291: <p>So far for defining variables. The other thing you can
6292: do with variables is evaluating them. A variable is
6293: evaluated when it is part of the right side of the ``:=''
6294: or the ``!='' operator, or directly before executing a
6295: shell command which the variable is part of. In all other
6296: cases <a href=
6297: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6298: <span class="citerefentry"><span class=
6299: "refentrytitle">make</span>(1)</span></a> performs lazy
6300: evaluation, that is, variables are not evaluated until
6301: there's no other way. The ``modifiers'' mentioned in the
6302: man page also evaluate the variable.</p>
6303:
6304: <p>Some of the modifiers split the string into words and
6305: then operate on the words, others operate on the string
6306: as a whole. When a string is splitted into words, it is
6307: splitted as you would expect it from <a href=
6308: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6309: <span class="citerefentry"><span class=
6310: "refentrytitle">sh</span>(1)</span></a>.</p>
6311:
6312: <p>No rule without exception—the
6313: <span><strong class="command">.for</strong></span> loop
6314: does not follow the shell quoting rules but splits at
6315: sequences of whitespace.</p>
6316:
6317: <p>There are several types of variables that should be
6318: handled differently. Strings and two types of lists.</p>
6319:
6320: <div class="itemizedlist">
6321: <ul type="disc">
6322: <li>
6323: <p><span class="emphasis"><em>Strings</em></span>
6324: can contain arbitrary characters. Nevertheless you
6325: should restrict yourself to only using printable
6326: characters. Examples are <code class=
6327: "varname">PREFIX</code> and <code class=
6328: "varname">COMMENT</code>.</p>
6329: </li>
6330:
6331: <li>
6332: <p><span class="emphasis"><em>Internal
6333: lists</em></span> are lists that are never exported
6334: to any shell command. Their elements are separated
6335: by whitespace. Therefore the elements themselves
6336: cannot have embedded whitespace. Any other
6337: characters are allowed. Internal lists can be used
6338: in <span><strong class=
6339: "command">.for</strong></span> loops. Examples are
6340: <code class="varname">DEPENDS</code> and
6341: <code class="varname">BUILD_DEPENDS</code>.</p>
6342: </li>
6343:
6344: <li>
6345: <p><span class="emphasis"><em>External
6346: lists</em></span> are lists that may be exported to
6347: a shell command. Their elements can contain any
6348: characters, including whitespace. That's why they
6349: cannot be used in <span><strong class=
6350: "command">.for</strong></span> loops. Examples are
6351: <code class="varname">DISTFILES</code> and
6352: <code class="varname">MASTER_SITES</code>.</p>
6353: </li>
6354: </ul>
6355: </div>
6356:
6357: <div class="sect2" lang="en" xml:lang="en">
6358: <div class="titlepage">
6359: <div>
6360: <div>
6361: <h3 class="title"><a name=
6362: "makefile.variables.names" id=
1.38 dillo 6363: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 6364: conventions</h3>
6365: </div>
6366: </div>
6367: </div>
6368:
6369: <div class="itemizedlist">
6370: <ul type="disc">
6371: <li>
6372: <p>All variable names starting with an underscore
6373: are reserved for use by the pkgsrc
6374: infrastructure. They shall not be used by package
6375: <code class="filename">Makefile</code>s.</p>
6376: </li>
6377:
6378: <li>
6379: <p>In <span><strong class=
6380: "command">.for</strong></span> loops you should
6381: use lowercase variable names for the iteration
6382: variables.</p>
6383: </li>
6384:
6385: <li>
6386: <p>All list variables should have a ``plural''
6387: name, e.g. <code class=
6388: "varname">PKG_OPTIONS</code> or <code class=
6389: "varname">DISTFILES</code>.</p>
6390: </li>
6391: </ul>
6392: </div>
6393: </div>
6394: </div>
6395:
6396: <div class="sect1" lang="en" xml:lang="en">
6397: <div class="titlepage">
6398: <div>
6399: <div>
6400: <h2 class="title" style="clear: both"><a name=
6401: "makefile.code" id=
1.38 dillo 6402: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 6403: </div>
6404: </div>
6405: </div>
6406:
6407: <p>This section presents you with some code snippets you
6408: should use in your own code. If you don't find anything
6409: appropriate here, you should test your code and add it
6410: here.</p>
6411:
6412: <div class="sect2" lang="en" xml:lang="en">
6413: <div class="titlepage">
6414: <div>
6415: <div>
1.30 wiz 6416: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 6417: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 6418: a list</h3>
1.27 rillig 6419: </div>
6420: </div>
6421: </div>
6422: <pre class="programlisting">
6423: STRING= foo * bar `date`
6424: INT_LIST= # empty
6425: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6426: EXT_LIST= # empty
6427: ANOTHER_EXT_LIST= a=b c=d
6428:
6429: INT_LIST+= ${STRING} # 1
6430: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6431: EXT_LIST+= ${STRING:Q} # 3
6432: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6433:
6434: </pre>
6435:
6436: <p>When you add a string to an external list (example
6437: 3), it must be quoted. In all other cases, you must not
6438: add a quoting level. You must not merge internal and
6439: external lists, unless you are sure that all entries
6440: are correctly interpreted in both lists.</p>
6441: </div>
6442:
6443: <div class="sect2" lang="en" xml:lang="en">
6444: <div class="titlepage">
6445: <div>
6446: <div>
1.30 wiz 6447: <h3 class="title"><a name=
6448: "converting-internal-to-external" id=
1.38 dillo 6449: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 6450: an internal list into an external list</h3>
1.27 rillig 6451: </div>
6452: </div>
6453: </div>
6454: <pre class="programlisting">
6455: EXT_LIST= # empty
6456: .for i in ${INT_LIST}
6457: EXT_LIST+= ${i:Q}""
6458: .endfor
6459:
6460: </pre>
6461:
6462: <p>This code converts the internal list <code class=
6463: "varname">INT_LIST</code> into the external list
6464: <code class="varname">EXT_LIST</code>. As the elements
6465: of an internal list are unquoted they must be quoted
6466: here. The reason for appending <code class=
6467: "varname">""</code> is explained below.</p>
6468: </div>
1.1 grant 6469:
1.27 rillig 6470: <div class="sect2" lang="en" xml:lang="en">
6471: <div class="titlepage">
1.1 grant 6472: <div>
1.27 rillig 6473: <div>
1.30 wiz 6474: <h3 class="title"><a name=
6475: "passing-variable-to-shell" id=
1.38 dillo 6476: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 6477: variables to a shell command</h3>
1.27 rillig 6478: </div>
1.1 grant 6479: </div>
6480: </div>
1.27 rillig 6481: <pre class="programlisting">
6482: STRING= foo bar < > * `date` $$HOME ' "
6483: EXT_LIST= string=${STRING:Q} x=second\ item
6484:
6485: all:
6486: echo ${STRING} # 1
6487: echo "${STRING}" # 2
6488: echo "${STRING:Q}" # 3
6489: echo ${STRING:Q} # 4
6490: echo x${STRING:Q} | sed 1s,.,, # 5
6491: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6492:
6493: </pre>
6494:
6495: <p>Example 1 leads to a syntax error in the shell, as
6496: the characters are just copied.</p>
6497:
6498: <p>Example 2 leads to a syntax error too, and if you
6499: leave out the last " character from <code class=
6500: "varname">${STRING}</code>, <a href=
6501: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6502: <span class="citerefentry"><span class=
6503: "refentrytitle">date</span>(1)</span></a> will be
6504: executed. The <code class="varname">$HOME</code> shell
6505: variable would be evaluated, too.</p>
6506:
6507: <p>Example 3 outputs each space character preceded by a
6508: backslash (or not), depending on the implementation of
6509: the <a href=
6510: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6511: <span class="citerefentry"><span class=
6512: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6513:
1.27 rillig 6514: <p>Example 4 handles correctly every string that does
6515: not start with a dash. In that case, the result depends
6516: on the implementation of the <a href=
6517: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6518: <span class="citerefentry"><span class=
6519: "refentrytitle">echo</span>(1)</span></a> command. As
6520: long as you can guarantee that your input does not
6521: start with a dash this form is appropriate.</p>
1.1 grant 6522:
1.27 rillig 6523: <p>Example 5 handles even the case of a leading dash
6524: correctly.</p>
1.1 grant 6525:
1.27 rillig 6526: <p>The <code class="varname">EXT_LIST</code> does not
6527: need to be quoted because the quoting has already be
6528: done when adding elements to the list.</p>
1.1 grant 6529:
1.27 rillig 6530: <p>As internal lists shall not be passed to the shell,
6531: there is no example for it.</p>
1.1 grant 6532: </div>
6533:
1.27 rillig 6534: <div class="sect2" lang="en" xml:lang="en">
6535: <div class="titlepage">
1.1 grant 6536: <div>
1.27 rillig 6537: <div>
1.30 wiz 6538: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 6539: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 6540: guideline</h3>
6541: </div>
1.1 grant 6542: </div>
6543: </div>
6544:
1.27 rillig 6545: <p>There are many possible sources of wrongly quoted
6546: variables. This section lists some of the commonly
6547: known ones.</p>
1.1 grant 6548:
1.27 rillig 6549: <div class="itemizedlist">
6550: <ul type="disc">
6551: <li>
6552: <p>Whenever you use the value of a list, think
6553: about what happens to leading or trailing
6554: whitespace. If the list is a well-formed shell
6555: expression you can apply the <code class=
6556: "varname">:M*</code> modifier to strip leading
6557: and trailing whitespace from each word. The
6558: <code class="varname">:M</code> operator first
6559: splits its argument according to the rules of the
6560: shell, and then creates a new list consisting of
6561: all words that match the shell glob expression
6562: <code class="varname">*</code>, that is: all. One
6563: class of situations where this is needed is when
6564: adding a variable like <code class=
6565: "varname">CPPFLAGS</code> to <code class=
6566: "varname">CONFIGURE_ARGS</code>. If the configure
6567: script invokes other configure scripts it strips
6568: the leading and trailing whitespace from the
6569: variable and then passes it to the other
6570: configure scripts. But these configure scripts
6571: expect the (child) <code class=
6572: "varname">CPPFLAGS</code> variable to be the same
6573: as the parent <code class=
6574: "varname">CPPFLAGS</code>. That's why we better
6575: pass the <code class="varname">CPPFLAGS</code>
6576: value properly trimmed. And here is how we do
6577: it:</p>
6578: <pre class="programlisting">
6579: CPPFLAGS= # empty
6580: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6581: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6582:
1.27 rillig 6583: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6584:
1.27 rillig 6585: all:
6586: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6587: echo x${CONFIGURE_ARGS}x # properly trimmed
6588:
6589: </pre>
6590: </li>
1.1 grant 6591:
1.27 rillig 6592: <li>
6593: <p>The example above contains one bug: The
6594: <code class="varname">${PREFIX}</code> is a
6595: properly quoted shell expression, but there is
6596: the C compiler after it, which also expects a
6597: properly quoted string (this time in C syntax).
6598: The version above is therefore only correct if
6599: <code class="varname">${PREFIX}</code> does not
6600: have embedded backslashes or double quotes. If
6601: you want to allow these, you have to add another
6602: layer of quoting to each variable that is used as
6603: a C string literal. You cannot use the
6604: <code class="varname">:Q</code> operator for it,
6605: as this operator only works for the shell.</p>
6606: </li>
1.1 grant 6607:
1.27 rillig 6608: <li>
6609: <p>Whenever a variable can be empty the
6610: <code class="varname">:Q</code> operator can have
6611: surprising results. Here are two completely
6612: different cases which can be solved with the same
6613: trick.</p>
6614: <pre class="programlisting">
6615: EMPTY= # empty
6616: empty_test:
6617: for i in a ${EMPTY:Q} c; do \
6618: echo "$$i"; \
6619: done
6620:
6621: for_test:
6622: .for i in a:\ a:\test.txt
6623: echo ${i:Q}
6624: echo "foo"
6625: .endfor
6626:
1.1 grant 6627: </pre>
6628:
1.27 rillig 6629: <p>The first example will only print two of the
6630: three lines we might have expected. This is
6631: because <code class="varname">${EMPTY:Q}</code>
6632: expands to the empty string, which the shell
6633: cannot see. The workaround is to write
6634: <code class="varname">${EMPTY:Q}""</code>. This
6635: pattern can be often found as <code class=
6636: "varname">${TEST} -z ${VAR:Q}</code> or as
6637: <code class="varname">${TEST} -f
6638: ${FNAME:Q}</code> (both of these are wrong).</p>
6639:
6640: <p>The second example will only print three lines
6641: instead of four. The first line looks like
6642: <code class="varname">a:\ echo foo</code>. This
6643: is because the backslash of the value
6644: <code class="varname">a:\</code> is interpreted
6645: as a line-continuation by <a href=
6646: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6647: <span class="citerefentry"><span class=
6648: "refentrytitle">make</span>(1)</span></a>, which
6649: makes the second line the arguments of the
6650: <a href=
6651: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6652: <span class="citerefentry"><span class=
6653: "refentrytitle">echo</span>(1)</span></a> command
6654: from the first line. To avoid this, write
6655: <code class="varname">${i:Q}""</code>.</p>
6656: </li>
6657: </ul>
6658: </div>
1.1 grant 6659: </div>
6660:
1.27 rillig 6661: <div class="sect2" lang="en" xml:lang="en">
6662: <div class="titlepage">
1.1 grant 6663: <div>
1.27 rillig 6664: <div>
1.30 wiz 6665: <h3 class="title"><a name=
6666: "bsd-make-bug-workaround" id=
1.38 dillo 6667: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 6668: for a bug in BSD Make</h3>
1.27 rillig 6669: </div>
1.1 grant 6670: </div>
6671: </div>
6672:
1.27 rillig 6673: <p>The pkgsrc bmake program does not handle the
6674: following assignment correctly. In case <code class=
6675: "varname">_othervar_</code> contains a ``-'' character,
6676: one of the closing braces is included in <code class=
6677: "varname">${VAR}</code> after this code executes.</p>
6678: <pre class="programlisting">
6679: VAR:= ${VAR:N${_othervar_:C/-//}}
6680:
1.1 grant 6681: </pre>
6682:
1.27 rillig 6683: <p>For a more complex code snippet and a workaround,
6684: see the package <a xmlns=
6685: "http://www.w3.org/TR/xhtml1/transitional" href=
6686: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6687: class="pkgname">regress/make-quoting</a>, testcase
6688: <code class="varname">bug1</code>.</p>
1.1 grant 6689: </div>
6690: </div>
6691: </div>
6692:
6693: <div class="chapter" lang="en" xml:lang="en">
6694: <div class="titlepage">
6695: <div>
6696: <div>
6697: <h2 class="title"><a name="plist" id=
1.38 dillo 6698: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 6699: </div>
6700: </div>
6701: </div>
6702:
6703: <div class="toc">
6704: <p><b>Table of Contents</b></p>
6705:
6706: <dl>
1.38 dillo 6707: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6708: ID</a></span></dt>
6709:
1.30 wiz 6710: <dt><span class="sect1"><a href=
1.38 dillo 6711: "#automatic-plist-generation">10.2. Semi-automatic
1.30 wiz 6712: <code class="filename">PLIST</code>
1.14 xtraeme 6713: generation</a></span></dt>
1.1 grant 6714:
1.38 dillo 6715: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6716: Tweaking output of <span><strong class="command">make
6717: print-PLIST</strong></span></a></span></dt>
1.1 grant 6718:
1.38 dillo 6719: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6720: Variable substitution in PLIST</a></span></dt>
6721:
1.30 wiz 6722: <dt><span class="sect1"><a href=
1.38 dillo 6723: "#manpage-compression">10.5.
1.1 grant 6724: Manpage-compression</a></span></dt>
6725:
1.38 dillo 6726: <dt><span class="sect1"><a href=
6727: "#using-PLIST_SRC">10.6. Changing PLIST source with
6728: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6729:
1.30 wiz 6730: <dt><span class="sect1"><a href=
1.38 dillo 6731: "#platform-specific-plist">10.7. Platform specific and
1.30 wiz 6732: differing PLISTs</a></span></dt>
1.1 grant 6733:
1.38 dillo 6734: <dt><span class="sect1"><a href=
6735: "#faq.common-dirs">10.8. Sharing directories between
6736: packages</a></span></dt>
1.1 grant 6737: </dl>
6738: </div>
6739:
1.14 xtraeme 6740: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6741: package's “<span class="quote">packing
6742: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6743: package (relative to the <code class=
6744: "filename">${PREFIX}</code> directory it's been installed
6745: in) plus some additional statements - see the <a href=
1.1 grant 6746: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6747: <span class="citerefentry"><span class=
6748: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6749: a full list. This chapter addresses some issues that need
1.14 xtraeme 6750: attention when dealing with the <code class=
6751: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6752:
6753: <div class="sect1" lang="en" xml:lang="en">
6754: <div class="titlepage">
6755: <div>
6756: <div>
6757: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6758: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 6759: </div>
6760: </div>
6761: </div>
6762:
6763: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6764: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6765: <pre class="programlisting">
1.17 sketch 6766: @comment $NetBSD$
1.1 grant 6767: </pre>
6768: </div>
6769:
6770: <div class="sect1" lang="en" xml:lang="en">
6771: <div class="titlepage">
6772: <div>
6773: <div>
6774: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6775: "automatic-plist-generation" id=
1.38 dillo 6776: "automatic-plist-generation"></a>10.2. Semi-automatic
1.14 xtraeme 6777: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6778: </div>
6779: </div>
6780: </div>
6781:
1.14 xtraeme 6782: <p>You can use the <span><strong class="command">make
6783: print-PLIST</strong></span> command to output a PLIST
6784: that matches any new files since the package was
6785: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 6786: "14.3. Other helpful targets">Section 14.3,
1.1 grant 6787: “Other helpful targets”</a> for more
6788: information on this target.</p>
6789: </div>
6790:
6791: <div class="sect1" lang="en" xml:lang="en">
6792: <div class="titlepage">
6793: <div>
6794: <div>
6795: <h2 class="title" style="clear: both"><a name=
6796: "print-PLIST" id=
1.38 dillo 6797: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 6798: <span><strong class="command">make
6799: print-PLIST</strong></span></h2>
1.1 grant 6800: </div>
6801: </div>
6802: </div>
6803:
6804: <p>If you have used any of the *-dirs packages, as
6805: explained in <a href="#faq.common-dirs" title=
1.38 dillo 6806: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 6807: “Sharing directories between packages”</a>,
1.14 xtraeme 6808: you may have noticed that <span><strong class=
6809: "command">make print-PLIST</strong></span> outputs a set
6810: of <code class="varname">@comment</code>s instead of real
6811: <code class="varname">@dirrm</code> lines. You can also
6812: do this for specific directories and files, so that the
6813: results of that command are very close to reality. This
6814: helps <span class="emphasis"><em>a lot</em></span> during
6815: the update of packages.</p>
6816:
6817: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6818: variable takes a set of AWK patterns and actions that are
6819: used to filter the output of print-PLIST. You can
6820: <span class="emphasis"><em>append</em></span> any chunk
6821: of AWK scripting you like to it, but be careful with
1.1 grant 6822: quoting.</p>
6823:
1.14 xtraeme 6824: <p>For example, to get all files inside the <code class=
6825: "filename">libdata/foo</code> directory removed from the
1.1 grant 6826: resulting PLIST:</p>
6827: <pre class="programlisting">
6828: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6829:
6830: </pre>
6831:
1.14 xtraeme 6832: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6833: lines referring to a specific (shared) directory
1.14 xtraeme 6834: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6835: <pre class="programlisting">
6836: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6837:
6838: </pre>
6839: </div>
6840:
6841: <div class="sect1" lang="en" xml:lang="en">
6842: <div class="titlepage">
6843: <div>
6844: <div>
6845: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6846: "plist.misc" id=
6847: "plist.misc"></a>10.4. Variable substitution
6848: in PLIST</h2>
1.1 grant 6849: </div>
6850: </div>
6851: </div>
6852:
6853: <p>A number of variables are substituted automatically in
6854: PLISTs when a package is installed on a system. This
6855: includes the following variables:</p>
6856:
6857: <div class="variablelist">
6858: <dl>
1.14 xtraeme 6859: <dt><span class="term"><code class=
6860: "varname">${MACHINE_ARCH}</code>, <code class=
6861: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6862:
6863: <dd>
6864: <p>Some packages like emacs and perl embed
6865: information about which architecture they were
6866: built on into the pathnames where they install
6867: their file. To handle this case, PLIST will be
6868: preprocessed before actually used, and the symbol
1.14 xtraeme 6869: “<span class="quote"><code class=
6870: "varname">${MACHINE_ARCH}</code></span>” will
6871: be replaced by what <span><strong class=
6872: "command">uname -p</strong></span> gives. The same
6873: is done if the string <code class=
6874: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6875: PLIST somewhere - use this on packages that have
6876: GNU autoconf created configure scripts.</p>
1.1 grant 6877:
6878: <div class="note" style=
6879: "margin-left: 0.5in; margin-right: 0.5in;">
6880: <h3 class="title">Legacy note</h3>
6881:
6882: <p>There used to be a symbol “<span class=
1.14 xtraeme 6883: "quote"><code class=
6884: "varname">$ARCH</code></span>” that was
6885: replaced by the output of <span><strong class=
6886: "command">uname -m</strong></span>, but that's no
1.1 grant 6887: longer supported and has been removed.</p>
6888: </div>
6889: </dd>
6890:
1.14 xtraeme 6891: <dt><span class="term"><code class=
6892: "varname">${OPSYS}</code>, <code class=
6893: "varname">${LOWER_OPSYS}</code>, <code class=
6894: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6895:
6896: <dd>
6897: <p>Some packages want to embed the OS name and
6898: version into some paths. To do this, use these
1.14 xtraeme 6899: variables in the <code class=
6900: "filename">PLIST</code>:</p>
1.1 grant 6901:
6902: <div class="itemizedlist">
6903: <ul type="disc">
6904: <li>
1.14 xtraeme 6905: <p><code class="varname">${OPSYS}</code> -
6906: output of “<span class=
6907: "quote"><span><strong class="command">uname
6908: -s</strong></span></span>”</p>
1.1 grant 6909: </li>
6910:
6911: <li>
1.14 xtraeme 6912: <p><code class=
6913: "varname">${LOWER_OPSYS}</code> - lowercase
6914: common name (eg. “<span class=
6915: "quote">solaris</span>”)</p>
1.1 grant 6916: </li>
6917:
6918: <li>
1.14 xtraeme 6919: <p><code class="varname">${OS_VERSION}</code>
6920: - “<span class=
6921: "quote"><span><strong class="command">uname
6922: -r</strong></span></span>”</p>
1.1 grant 6923: </li>
6924: </ul>
6925: </div>
6926: </dd>
6927:
1.14 xtraeme 6928: <dt><span class="term"><code class=
6929: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6930:
6931: <dd>
6932: <p>Packages that install locale files should list
6933: them in the PLIST as “<span class=
6934: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6935: instead of “<span class=
6936: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6937: This properly handles the fact that different
6938: operating systems expect locale files to be either
1.14 xtraeme 6939: in <code class="filename">share</code> or
6940: <code class="filename">lib</code> by default.</p>
1.1 grant 6941: </dd>
6942: </dl>
6943: </div>
6944:
6945: <p>For a complete list of values which are replaced by
1.14 xtraeme 6946: default, please look in <code class=
6947: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6948: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6949:
6950: <p>If you want to change other variables not listed
6951: above, you can add variables and their expansions to this
1.14 xtraeme 6952: variable in the following way, similar to <code class=
6953: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6954: "#components.optional" title=
1.38 dillo 6955: "8.5. Optional files">Section 8.5,
1.1 grant 6956: “Optional files”</a>):</p>
6957: <pre class="programlisting">
6958: PLIST_SUBST+= SOMEVAR="somevalue"
6959: </pre>
6960:
6961: <p>This replaces all occurrences of “<span class=
6962: "quote">${SOMEVAR}</span>” in the PLIST with
6963: “<span class="quote">somevalue</span>”.</p>
6964: </div>
6965:
6966: <div class="sect1" lang="en" xml:lang="en">
6967: <div class="titlepage">
6968: <div>
6969: <div>
6970: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6971: "manpage-compression" id=
1.38 dillo 6972: "manpage-compression"></a>10.5. Manpage-compression</h2>
1.1 grant 6973: </div>
6974: </div>
6975: </div>
6976:
6977: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6978: <code class="varname">MANZ</code> is set (in <code class=
6979: "filename">bsd.own.mk</code>), and uncompressed
6980: otherwise. To handle this in the <code class=
6981: "filename">PLIST</code> file, the suffix
6982: “<span class="quote">.gz</span>” is
6983: appended/removed automatically for manpages according to
6984: <code class="varname">MANZ</code> and <code class=
6985: "varname">MANCOMPRESSED</code> being set or not, see
6986: above for details. This modification of the <code class=
6987: "filename">PLIST</code> file is done on a copy of it, not
6988: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6989: </div>
6990:
6991: <div class="sect1" lang="en" xml:lang="en">
6992: <div class="titlepage">
6993: <div>
6994: <div>
6995: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6996: "using-PLIST_SRC" id=
1.38 dillo 6997: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 6998: source with <code class=
1.14 xtraeme 6999: "varname">PLIST_SRC</code></h2>
1.1 grant 7000: </div>
7001: </div>
7002: </div>
7003:
1.14 xtraeme 7004: <p>To use one or more files as source for the
7005: <code class="filename">PLIST</code> used in generating
7006: the binary package, set the variable <code class=
7007: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7008: The files are later concatenated using <a href=
7009: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7010: <span class="citerefentry"><span class=
7011: "refentrytitle">cat</span>(1)</span></a>, and order of
7012: things is important.</p>
1.1 grant 7013: </div>
7014:
7015: <div class="sect1" lang="en" xml:lang="en">
7016: <div class="titlepage">
7017: <div>
7018: <div>
7019: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7020: "platform-specific-plist" id=
1.38 dillo 7021: "platform-specific-plist"></a>10.7. Platform
1.1 grant 7022: specific and differing PLISTs</h2>
7023: </div>
7024: </div>
7025: </div>
7026:
7027: <p>Some packages decide to install a different set of
7028: files based on the operating system being used. These
7029: differences can be automatically handled by using the
7030: following files:</p>
7031:
7032: <div class="itemizedlist">
7033: <ul type="disc">
7034: <li>
1.14 xtraeme 7035: <p><code class="filename">PLIST.common</code></p>
1.1 grant 7036: </li>
7037:
7038: <li>
1.14 xtraeme 7039: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 7040: </li>
7041:
7042: <li>
1.14 xtraeme 7043: <p><code class=
1.21 ben 7044: "filename">PLIST.${MACHINE_ARCH}</code></p>
7045: </li>
7046:
7047: <li>
7048: <p><code class=
7049: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7050: </li>
7051:
7052: <li>
7053: <p><code class=
1.14 xtraeme 7054: "filename">PLIST.common_end</code></p>
1.1 grant 7055: </li>
7056: </ul>
7057: </div>
7058: </div>
7059:
7060: <div class="sect1" lang="en" xml:lang="en">
7061: <div class="titlepage">
7062: <div>
7063: <div>
7064: <h2 class="title" style="clear: both"><a name=
7065: "faq.common-dirs" id=
1.38 dillo 7066: "faq.common-dirs"></a>10.8. Sharing
7067: directories between packages</h2>
1.1 grant 7068: </div>
7069: </div>
7070: </div>
7071:
7072: <p>A “<span class="quote">shared
7073: directory</span>” is a directory where multiple
7074: (and unrelated) packages install files. These directories
7075: are problematic because you have to add special tricks in
7076: the PLIST to conditionally remove them, or have some
7077: centralized package handle them.</p>
7078:
7079: <p>Within pkgsrc, you'll find both approaches. If a
7080: directory is shared by a few unrelated packages, it's
7081: often not worth to add an extra package to remove it.
7082: Therefore, one simply does:</p>
7083: <pre class="programlisting">
7084: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
7085:
7086: </pre>
7087:
7088: <p>in the PLISTs of all affected packages, instead of the
7089: regular "@dirrm" line.</p>
7090:
7091: <p>However, if the directory is shared across many
7092: packages, two different solutions are available:</p>
7093:
7094: <div class="orderedlist">
7095: <ol type="1">
7096: <li>
7097: <p>If the packages have a common dependency, the
7098: directory can be removed in that. For example, see
7099: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7100: href=
7101: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 7102: class="pkgname">textproc/scrollkeeper</a>, which
7103: removes the shared directory <code class=
7104: "filename">share/omf</code>.</p>
1.1 grant 7105: </li>
7106:
7107: <li>
7108: <p>If the packages using the directory are not
7109: related at all (they have no common dependencies),
7110: a *-dirs package is used.</p>
7111: </li>
7112: </ol>
7113: </div>
7114:
7115: <p>From now on, we'll discuss the second solution. To get
7116: an idea of the *-dirs packages available, issue:</p>
7117: <pre class="programlisting">
1.14 xtraeme 7118: <code class="prompt">%</code> cd .../pkgsrc
7119: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7120:
7121: </pre>
7122:
7123: <p>Their use from other packages is very simple. The
1.14 xtraeme 7124: <code class="varname">USE_DIRS</code> variable takes a
7125: list of package names (without the “<span class=
1.1 grant 7126: "quote">-dirs</span>” part) together with the
7127: required version number (always pick the latest one when
1.34 wiz 7128: writing new packages).</p>
1.1 grant 7129:
7130: <p>For example, if a package installs files under
1.14 xtraeme 7131: <code class="filename">share/applications</code>, it
7132: should have the following line in it:</p>
1.1 grant 7133: <pre class="programlisting">
7134: USE_DIRS+= xdg-1.1
7135:
7136: </pre>
7137:
1.14 xtraeme 7138: <p>After regenerating the PLIST using
7139: <span><strong class="command">make
7140: print-PLIST</strong></span>, you should get the right
7141: (commented out) lines.</p>
1.1 grant 7142:
1.14 xtraeme 7143: <p>Note that, even if your package is using <code class=
7144: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7145: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 7146: part and pkgsrc (in particular, <code class=
7147: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7148: </div>
7149: </div>
7150:
7151: <div class="chapter" lang="en" xml:lang="en">
7152: <div class="titlepage">
7153: <div>
7154: <div>
7155: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7156: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7157: methodology</h2>
7158: </div>
7159: </div>
7160: </div>
7161:
7162: <div class="toc">
7163: <p><b>Table of Contents</b></p>
7164:
7165: <dl>
1.30 wiz 7166: <dt><span class="sect1"><a href=
1.38 dillo 7167: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7168: to use buildlink3</a></span></dt>
1.1 grant 7169:
1.30 wiz 7170: <dt><span class="sect1"><a href=
1.38 dillo 7171: "#creating-buildlink3.mk">11.2. Writing <code class=
1.30 wiz 7172: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7173:
7174: <dd>
7175: <dl>
1.25 rillig 7176: <dt><span class="sect2"><a href=
1.38 dillo 7177: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7178: buildlink3.mk file</a></span></dt>
1.1 grant 7179:
1.25 rillig 7180: <dt><span class="sect2"><a href=
1.38 dillo 7181: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7182: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7183: "replaceable"><code>pkg</code></em></code> in
7184: <code class="filename">buildlink3.mk</code>
1.1 grant 7185: files</a></span></dt>
7186: </dl>
7187: </dd>
7188:
1.30 wiz 7189: <dt><span class="sect1"><a href=
1.38 dillo 7190: "#writing-builtin.mk">11.3. Writing <code class=
1.30 wiz 7191: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7192:
7193: <dd>
7194: <dl>
1.25 rillig 7195: <dt><span class="sect2"><a href=
1.38 dillo 7196: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30 wiz 7197: <code class="filename">builtin.mk</code>
7198: file</a></span></dt>
1.1 grant 7199:
1.25 rillig 7200: <dt><span class="sect2"><a href=
1.38 dillo 7201: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7202: preferences for native or pkgsrc
7203: software</a></span></dt>
1.1 grant 7204: </dl>
7205: </dd>
7206: </dl>
7207: </div>
7208:
7209: <p>Buildlink is a framework in pkgsrc that controls what
7210: headers and libraries are seen by a package's configure and
7211: build processes. This is implemented in a two step
7212: process:</p>
7213:
7214: <div class="orderedlist">
7215: <ol type="1">
7216: <li>
7217: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7218: into <code class="varname">BUILDLINK_DIR</code>,
7219: which by default is a subdirectory of <code class=
7220: "varname">WRKDIR</code>.</p>
1.1 grant 7221: </li>
7222:
7223: <li>
7224: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7225: the normal compiler tools that translate <code class=
7226: "option">-I${LOCALBASE}/include</code> and
7227: <code class="option">-L${LOCALBASE}/lib</code> into
7228: references to <code class=
7229: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7230: also make native compiler on some operating systems
7231: look like GCC, so that packages that expect GCC won't
7232: require modifications to build with those native
7233: compilers.</p>
1.1 grant 7234: </li>
7235: </ol>
7236: </div>
7237:
7238: <p>This normalizes the environment in which a package is
7239: built so that the package may be built consistently despite
7240: what other software may be installed. Please note that the
1.14 xtraeme 7241: normal system header and library paths, e.g. <code class=
7242: "filename">/usr/include</code>, <code class=
7243: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7244: buildlink3 is designed to insulate the package build from
7245: non-system-supplied software.</p>
7246:
7247: <div class="sect1" lang="en" xml:lang="en">
7248: <div class="titlepage">
7249: <div>
7250: <div>
7251: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7252: "converting-to-buildlink3" id=
1.38 dillo 7253: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 7254: packages to use buildlink3</h2>
1.1 grant 7255: </div>
7256: </div>
7257: </div>
7258:
7259: <p>The process of converting packages to use the
7260: buildlink3 framework (“<span class=
7261: "quote">bl3ifying</span>”) is fairly
7262: straightforward. The things to keep in mind are:</p>
7263:
7264: <div class="orderedlist">
7265: <ol type="1">
7266: <li>
7267: <p>Ensure that the build always calls the wrapper
7268: scripts instead of the actual toolchain. Some
7269: packages are tricky, and the only way to know for
1.14 xtraeme 7270: sure is the check <code class=
7271: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7272: wrappers are being invoked.</p>
7273: </li>
7274:
7275: <li>
1.14 xtraeme 7276: <p>Don't override <code class=
7277: "varname">PREFIX</code> from within the package
7278: Makefile, e.g. Java VMs, standalone shells, etc.,
7279: because the code to symlink files into <code class=
7280: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7281: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7282: <em class=
7283: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7284: </li>
7285:
7286: <li>
7287: <p>Remember that <span class=
1.14 xtraeme 7288: "emphasis"><em>only</em></span> the <code class=
7289: "filename">buildlink3.mk</code> files that you list
1.1 grant 7290: in a package's Makefile are added as dependencies
7291: for that package.</p>
7292: </li>
7293: </ol>
7294: </div>
7295:
7296: <p>If a dependency on a particular package is required
7297: for its libraries and headers, then we replace:</p>
7298: <pre class="programlisting">
1.27 rillig 7299: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7300: </pre>
7301:
7302: <p>with</p>
7303: <pre class="programlisting">
7304: .include "../../category/foo/buildlink3.mk"
7305: </pre>
7306:
1.14 xtraeme 7307: <p>There are several <code class=
7308: "filename">buildlink3.mk</code> files in <code class=
7309: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7310: issues:</p>
7311:
7312: <div class="itemizedlist">
7313: <ul type="disc">
7314: <li>
1.14 xtraeme 7315: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7316: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7317: implementation based on the values of <code class=
7318: "varname">BDB_ACCEPTED</code> and <code class=
7319: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7320: </li>
7321:
7322: <li>
1.14 xtraeme 7323: <p><code class=
7324: "filename">curses.buildlink3.mk</code> If the
7325: system comes with neither Curses nor NCurses, this
7326: will take care to install the <a xmlns=
7327: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7328: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7329: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7330: </li>
7331:
7332: <li>
1.14 xtraeme 7333: <p><code class="filename">krb5.buildlink3.mk</code>
7334: uses the value of <code class=
7335: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7336: adding a dependency on Heimdal or MIT-krb5 for
7337: packages that require a Kerberos 5
7338: implementation.</p>
7339: </li>
7340:
7341: <li>
1.14 xtraeme 7342: <p><code class=
7343: "filename">motif.buildlink3.mk</code> checks for a
7344: system-provided Motif installation or adds a
7345: dependency on <a xmlns=
1.1 grant 7346: "http://www.w3.org/TR/xhtml1/transitional" href=
7347: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7348: class="pkgname">x11/lesstif</a> or <a xmlns=
7349: "http://www.w3.org/TR/xhtml1/transitional" href=
7350: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7351: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7352: </li>
7353:
7354: <li>
1.14 xtraeme 7355: <p><code class=
7356: "filename">ossaudio.buildlink3.mk</code> defines
7357: several variables that may be used by packages that
7358: use the Open Sound System (OSS) API;</p>
1.1 grant 7359: </li>
7360:
7361: <li>
1.14 xtraeme 7362: <p><code class=
7363: "filename">pgsql.buildlink3.mk</code> will accept
7364: either Postgres 7.3 or 7.4, whichever is found
7365: installed. See the file for more information.</p>
1.1 grant 7366: </li>
7367:
7368: <li>
1.14 xtraeme 7369: <p><code class=
7370: "filename">pthread.buildlink3.mk</code> uses the
7371: value of <code class="varname">PTHREAD_OPTS</code>
7372: and checks for native pthreads or adds a dependency
7373: on <a xmlns=
1.1 grant 7374: "http://www.w3.org/TR/xhtml1/transitional" href=
7375: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7376: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7377: </li>
7378:
7379: <li>
1.14 xtraeme 7380: <p><code class="filename">xaw.buildlink3.mk</code>
7381: uses the value of <code class=
7382: "varname">XAW_TYPE</code> to choose a particular
7383: Athena widgets library.</p>
1.1 grant 7384: </li>
7385: </ul>
7386: </div>
7387:
1.14 xtraeme 7388: <p>The comments in those <code class=
7389: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7390: complete description of how to use them properly.</p>
7391: </div>
7392:
7393: <div class="sect1" lang="en" xml:lang="en">
7394: <div class="titlepage">
7395: <div>
7396: <div>
7397: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7398: "creating-buildlink3.mk" id=
1.38 dillo 7399: "creating-buildlink3.mk"></a>11.2. Writing
1.14 xtraeme 7400: <code class="filename">buildlink3.mk</code>
7401: files</h2>
1.1 grant 7402: </div>
7403: </div>
7404: </div>
7405:
1.14 xtraeme 7406: <p>A package's <code class=
7407: "filename">buildlink3.mk</code> file is included by
7408: Makefiles to indicate the need to compile and link
7409: against header files and libraries provided by the
7410: package. A <code class="filename">buildlink3.mk</code>
7411: file should always provide enough information to add the
7412: correct type of dependency relationship and include any
7413: other <code class="filename">buildlink3.mk</code> files
7414: that it needs to find headers and libraries that it needs
7415: in turn.</p>
1.1 grant 7416:
1.14 xtraeme 7417: <p>To generate an initial <code class=
7418: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7419: Rene Hexel's <a xmlns=
7420: "http://www.w3.org/TR/xhtml1/transitional" href=
7421: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7422: class="pkgname">pkgtools/createbuildlink</a> package is
7423: highly recommended. For most packages, the following
7424: command will generate a good starting point for
7425: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7426: <pre class="screen">
1.14 xtraeme 7427: <code class="prompt">%</code> <strong class=
7428: "userinput"><code>cd pkgsrc/<em class=
7429: "replaceable"><code>category</code></em>/<em class=
7430: "replaceable"><code>pkgdir</code></em>
7431: <code class=
7432: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7433: </pre>
7434:
7435: <div class="sect2" lang="en" xml:lang="en">
7436: <div class="titlepage">
7437: <div>
7438: <div>
1.30 wiz 7439: <h3 class="title"><a name="anatomy-of-bl3" id=
1.38 dillo 7440: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 7441: buildlink3.mk file</h3>
1.1 grant 7442: </div>
7443: </div>
7444: </div>
7445:
1.14 xtraeme 7446: <p>The following real-life example <code class=
7447: "filename">buildlink3.mk</code> is taken from
7448: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7449: <pre class="programlisting">
1.17 sketch 7450: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7451:
7452: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7453: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7454:
7455: .if !empty(BUILDLINK_DEPTH:M+)
7456: BUILDLINK_DEPENDS+= tiff
7457: .endif
7458:
7459: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7460: BUILDLINK_PACKAGES+= tiff
7461:
7462: .if !empty(TIFF_BUILDLINK3_MK:M+)
7463: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7464: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7465: .endif # TIFF_BUILDLINK3_MK
7466:
7467: .include "../../devel/zlib/buildlink3.mk"
7468: .include "../../graphics/jpeg/buildlink3.mk"
7469:
7470: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7471: </pre>
7472:
1.14 xtraeme 7473: <p>The header and footer manipulate <code class=
7474: "varname">BUILDLINK_DEPTH</code>, which is common
7475: across all <code class="filename">buildlink3.mk</code>
7476: files and is used to track at what depth we are
7477: including <code class="filename">buildlink3.mk</code>
7478: files.</p>
1.1 grant 7479:
7480: <p>The first section controls if the dependency on
1.14 xtraeme 7481: <em class="replaceable"><code>pkg</code></em> is added.
7482: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7483: global list of packages for which dependencies are
7484: added by buildlink3.</p>
7485:
7486: <p>The second section advises pkgsrc that the
1.14 xtraeme 7487: <code class="filename">buildlink3.mk</code> file for
7488: <em class="replaceable"><code>pkg</code></em> has been
7489: included at some point. <code class=
7490: "varname">BUILDLINK_PACKAGES</code> is the global list
7491: of packages for which <code class=
7492: "filename">buildlink3.mk</code> files have been
7493: included. It must <span class=
7494: "emphasis"><em>always</em></span> be appended to within
7495: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7496:
7497: <p>The third section is protected from multiple
1.14 xtraeme 7498: inclusion and controls how the dependency on <em class=
7499: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7500: important variables are set in the section:</p>
7501:
7502: <div class="itemizedlist">
7503: <ul type="disc">
7504: <li>
1.14 xtraeme 7505: <p><code class=
7506: "varname">BUILDLINK_DEPENDS.<em class=
7507: "replaceable"><code>pkg</code></em></code> is the
7508: actual dependency recorded in the installed
7509: package; this should always be set using
7510: <span><strong class="command">+=</strong></span>
7511: to ensure that we're appending to any
7512: pre-existing list of values. This variable should
7513: be set to the first version of the package that
7514: had the last change in the major number of a
7515: shared library or that had a major API
7516: change.</p>
1.1 grant 7517: </li>
7518:
7519: <li>
1.14 xtraeme 7520: <p><code class=
7521: "varname">BUILDLINK_PKGSRCDIR.<em class=
7522: "replaceable"><code>pkg</code></em></code> is the
7523: location of the <em class=
7524: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7525: directory;</p>
7526: </li>
7527:
7528: <li>
1.14 xtraeme 7529: <p><code class=
7530: "varname">BUILDLINK_DEPMETHOD.<em class=
7531: "replaceable"><code>pkg</code></em></code> (not
7532: shown above) controls whether we use <code class=
7533: "varname">BUILD_DEPENDS</code> or <code class=
7534: "varname">DEPENDS</code> to add the dependency on
7535: <em class="replaceable"><code>pkg</code></em>.
7536: The build dependency is selected by setting
7537: <code class=
7538: "varname">BUILDLINK_DEPMETHOD.<em class=
7539: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7540: “<span class="quote">build</span>”.
7541: By default, the full dependency is used.</p>
7542: </li>
7543:
7544: <li>
1.14 xtraeme 7545: <p><code class=
7546: "varname">BUILDLINK_INCDIRS.<em class=
7547: "replaceable"><code>pkg</code></em></code> and
7548: <code class=
7549: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7550: <code>pkg</code></em></code> (not shown above)
7551: are lists of subdirectories of <code class=
7552: "filename">${BUILDLINK_PREFIX.<em class=
7553: "replaceable"><code>pkg</code></em>}</code> to
7554: add to the header and library search paths. These
1.1 grant 7555: default to “<span class=
7556: "quote">include</span>” and
7557: “<span class="quote">lib</span>”
7558: respectively.</p>
7559: </li>
7560:
7561: <li>
1.14 xtraeme 7562: <p><code class=
7563: "varname">BUILDLINK_CPPFLAGS.<em class=
7564: "replaceable"><code>pkg</code></em></code> (not
7565: shown above) is the list of preprocessor flags to
7566: add to <code class="varname">CPPFLAGS</code>,
7567: which are passed on to the configure and build
7568: phases. The “<span class=
7569: "quote">-I</span>” option should be avoided
7570: and instead be handled using <code class=
7571: "varname">BUILDLINK_INCDIRS.<em class=
7572: "replaceable"><code>pkg</code></em></code> as
7573: above.</p>
1.1 grant 7574: </li>
7575: </ul>
7576: </div>
7577:
7578: <p>The following variables are all optionally defined
7579: within this second section (protected against multiple
7580: inclusion) and control which package files are
1.14 xtraeme 7581: symlinked into <code class=
7582: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7583: are transformed during the symlinking:</p>
7584:
7585: <div class="itemizedlist">
7586: <ul type="disc">
7587: <li>
1.14 xtraeme 7588: <p><code class=
7589: "varname">BUILDLINK_FILES.<em class=
7590: "replaceable"><code>pkg</code></em></code> (not
7591: shown above) is a shell glob pattern relative to
7592: <code class=
7593: "filename">${BUILDLINK_PREFIX.<em class=
7594: "replaceable"><code>pkg</code></em>}</code> to be
7595: symlinked into <code class=
7596: "filename">${BUILDLINK_DIR}</code>, e.g.
7597: <code class="filename">include/*.h</code>.</p>
1.1 grant 7598: </li>
7599:
7600: <li>
1.14 xtraeme 7601: <p><code class=
7602: "varname">BUILDLINK_FILES_CMD.<em class=
7603: "replaceable"><code>pkg</code></em></code> (not
7604: shown above) is a shell pipeline that outputs to
7605: stdout a list of files relative to <code class=
7606: "filename">${BUILDLINK_PREFIX.<em class=
7607: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7608: resulting files are to be symlinked into
1.14 xtraeme 7609: <code class="filename">${BUILDLINK_DIR}</code>.
7610: By default, this takes the <code class=
7611: "filename">+CONTENTS</code> of a <em class=
7612: "replaceable"><code>pkg</code></em> and filters
7613: it through <code class=
7614: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7615: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7616: </li>
7617:
7618: <li>
1.14 xtraeme 7619: <p><code class=
7620: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7621: "replaceable"><code>pkg</code></em></code> (not
7622: shown above) is a filter command that filters
7623: <code class="filename">+CONTENTS</code> input
7624: into a list of files relative to <code class=
7625: "filename">${BUILDLINK_PREFIX.<em class=
7626: "replaceable"><code>pkg</code></em>}</code> on
7627: stdout. By default for overwrite packages,
7628: <code class=
7629: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7630: "replaceable"><code>pkg</code></em></code>
7631: outputs the contents of the <code class=
7632: "filename">include</code> and <code class=
7633: "filename">lib</code> directories in the package
7634: <code class="filename">+CONTENTS</code>, and for
7635: pkgviews packages, it outputs any libtool
7636: archives in <code class="filename">lib</code>
1.1 grant 7637: directories.</p>
7638: </li>
7639:
7640: <li>
1.14 xtraeme 7641: <p><code class=
7642: "varname">BUILDLINK_TRANSFORM.<em class=
7643: "replaceable"><code>pkg</code></em></code> (not
7644: shown above) is a list of sed arguments used to
1.1 grant 7645: transform the name of the source filename into a
1.14 xtraeme 7646: destination filename, e.g. <span><strong class=
1.1 grant 7647: "command">-e
1.14 xtraeme 7648: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7649: </li>
7650: </ul>
7651: </div>
7652:
1.14 xtraeme 7653: <p>The last section includes any <code class=
7654: "filename">buildlink3.mk</code> needed for <em class=
7655: "replaceable"><code>pkg</code></em>'s library
7656: dependencies. Including these <code class=
7657: "filename">buildlink3.mk</code> files means that the
7658: headers and libraries for these dependencies are also
7659: symlinked into <code class=
7660: "filename">${BUILDLINK_DIR}</code> whenever the
7661: <em class="replaceable"><code>pkg</code></em>
7662: <code class="filename">buildlink3.mk</code> file is
7663: included.</p>
1.1 grant 7664: </div>
7665:
7666: <div class="sect2" lang="en" xml:lang="en">
7667: <div class="titlepage">
7668: <div>
7669: <div>
1.30 wiz 7670: <h3 class="title"><a name=
7671: "updating-buildlink-depends" id=
1.38 dillo 7672: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 7673: <code class=
7674: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7675: <code>pkg</code></em></code> in <code class=
7676: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7677: </div>
7678: </div>
7679: </div>
7680:
7681: <p>There are two situations that require increasing the
1.14 xtraeme 7682: dependency listed in <code class=
7683: "varname">BUILDLINK_DEPENDS.<em class=
7684: "replaceable"><code>pkg</code></em></code> after a
7685: package update:</p>
1.1 grant 7686:
7687: <div class="orderedlist">
7688: <ol type="1">
7689: <li>
7690: <p>if the sonames (major number of the library
7691: version) of any installed shared libraries
7692: change;</p>
7693: </li>
7694:
7695: <li>
7696: <p>if the API or interface to the header files
7697: change.</p>
7698: </li>
7699: </ol>
7700: </div>
7701:
1.14 xtraeme 7702: <p>In these cases, <code class=
7703: "varname">BUILDLINK_DEPENDS.<em class=
7704: "replaceable"><code>pkg</code></em></code> should be
7705: adjusted to require at least the new package version.
7706: In some cases, the packages that depend on this new
7707: version may need their <code class=
7708: "varname">PKGREVISION</code>s increased and, if they
7709: have <code class="filename">buildlink3.mk</code> files,
7710: their <code class=
7711: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7712: pkg</code></em></code> adjusted, too. This is needed so
7713: that binary packages made using it will require the
7714: correct package dependency and not settle for an older
7715: one which will not contain the necessary shared
7716: libraries.</p>
1.1 grant 7717:
7718: <p>Please take careful consideration before adjusting
1.14 xtraeme 7719: <code class="varname">BUILDLINK_DEPENDS.<em class=
7720: "replaceable"><code>pkg</code></em></code> as we don't
7721: want to cause unneeded package deletions and rebuilds.
7722: In many cases, new versions of packages work just fine
7723: with older dependencies. See <a href="#dependencies"
1.38 dillo 7724: title="15.1.4. Handling dependencies">Section
7725: 15.1.4, “Handling dependencies”</a> for
1.36 wiz 7726: more information about dependencies on other packages,
1.25 rillig 7727: including the <code class=
7728: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7729: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7730: </div>
7731: </div>
7732:
7733: <div class="sect1" lang="en" xml:lang="en">
7734: <div class="titlepage">
7735: <div>
7736: <div>
7737: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7738: "writing-builtin.mk" id=
1.38 dillo 7739: "writing-builtin.mk"></a>11.3. Writing
1.14 xtraeme 7740: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7741: </div>
7742: </div>
7743: </div>
7744:
7745: <p>Some packages in pkgsrc install headers and libraries
7746: that coincide with headers and libraries present in the
1.14 xtraeme 7747: base system. Aside from a <code class=
7748: "filename">buildlink3.mk</code> file, these packages
7749: should also include a <code class=
7750: "filename">builtin.mk</code> file that includes the
7751: necessary checks to decide whether using the built-in
7752: software or the pkgsrc software is appropriate.</p>
1.1 grant 7753:
7754: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7755: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7756:
7757: <div class="orderedlist">
7758: <ol type="1">
7759: <li>
1.14 xtraeme 7760: <p>It should set <code class=
7761: "varname">USE_BUILTIN.<em class=
7762: "replaceable"><code>pkg</code></em></code> to
7763: either “<span class="quote">yes</span>”
7764: or “<span class="quote">no</span>”
7765: after it is included.</p>
1.1 grant 7766: </li>
7767:
7768: <li>
7769: <p>It should <span class=
7770: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7771: <code class="varname">USE_BUILTIN.<em class=
7772: "replaceable"><code>pkg</code></em></code> which is
7773: already set before the <code class=
7774: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7775: </li>
7776:
7777: <li>
7778: <p>It should be written to allow multiple
7779: inclusion. This is <span class=
7780: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7781: careful attention to <code class=
7782: "filename">Makefile</code> coding.</p>
1.1 grant 7783: </li>
7784: </ol>
7785: </div>
7786:
7787: <div class="sect2" lang="en" xml:lang="en">
7788: <div class="titlepage">
7789: <div>
7790: <div>
1.30 wiz 7791: <h3 class="title"><a name="anatomy-of-builtin.mk"
7792: id=
1.38 dillo 7793: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.30 wiz 7794: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7795: file</h3>
1.1 grant 7796: </div>
7797: </div>
7798: </div>
7799:
7800: <p>The following is the recommended template for
7801: builtin.mk files:</p>
7802: <pre class="programlisting">
7803: .if !defined(IS_BUILTIN.foo)
7804: #
7805: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7806: # genuinely exists in the system or not.
7807: #
7808: IS_BUILTIN.foo?= no
7809:
7810: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7811: # version can be determined.
7812: #
7813: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7814: BUILTIN_PKG.foo?= foo-1.0
7815: . endif
7816: .endif # IS_BUILTIN.foo
7817:
7818: .if !defined(USE_BUILTIN.foo)
7819: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7820: . if defined(BUILTIN_PKG.foo)
7821: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7822: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7823: USE_BUILTIN.foo!= \
7824: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7825: ${ECHO} "yes"; \
7826: else \
7827: ${ECHO} "no"; \
7828: fi
7829: . endif
7830: . endfor
7831: . endif
7832: .endif # USE_BUILTIN.foo
7833:
7834: CHECK_BUILTIN.foo?= no
7835: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7836: #
7837: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7838: # "yes" or "no".
7839: #
7840: .endif # CHECK_BUILTIN.foo
7841:
7842: </pre>
7843:
1.14 xtraeme 7844: <p>The first section sets <code class=
7845: "varname">IS_BUILTIN.<em class=
7846: "replaceable"><code>pkg</code></em></code> depending on
7847: if <em class="replaceable"><code>pkg</code></em> really
7848: exists in the base system. This should not be a base
7849: system software with similar functionality to
7850: <em class="replaceable"><code>pkg</code></em>; it
7851: should only be “<span class=
7852: "quote">yes</span>” if the actual package is
7853: included as part of the base system. This variable is
7854: only used internally within the <code class=
7855: "filename">builtin.mk</code> file.</p>
7856:
7857: <p>The second section sets <code class=
7858: "varname">BUILTIN_PKG.<em class=
7859: "replaceable"><code>pkg</code></em></code> to the
7860: version of <em class=
7861: "replaceable"><code>pkg</code></em> in the base system
7862: if it exists (if <code class=
7863: "varname">IS_BUILTIN.<em class=
7864: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7865: “<span class="quote">yes</span>”). This
1.14 xtraeme 7866: variable is only used internally within the
7867: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7868:
1.14 xtraeme 7869: <p>The third section sets <code class=
7870: "varname">USE_BUILTIN.<em class=
7871: "replaceable"><code>pkg</code></em></code> and is
7872: <span class="emphasis"><em>required</em></span> in all
7873: <code class="filename">builtin.mk</code> files. The
7874: code in this section must make the determination
7875: whether the built-in software is adequate to satisfy
7876: the dependencies listed in <code class=
7877: "varname">BUILDLINK_DEPENDS.<em class=
7878: "replaceable"><code>pkg</code></em></code>. This is
7879: typically done by comparing <code class=
7880: "varname">BUILTIN_PKG.<em class=
7881: "replaceable"><code>pkg</code></em></code> against each
7882: of the dependencies in <code class=
7883: "varname">BUILDLINK_DEPENDS.<em class=
7884: "replaceable"><code>pkg</code></em></code>.
7885: <code class="varname">USE_BUILTIN.<em class=
7886: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7887: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7888: value by the end of the <code class=
7889: "filename">builtin.mk</code> file. Note that
7890: <code class="varname">USE_BUILTIN.<em class=
7891: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7892: “<span class="quote">yes</span>” even if
1.14 xtraeme 7893: <code class="varname">IS_BUILTIN.<em class=
7894: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7895: “<span class="quote">no</span>” because we
7896: may make the determination that the built-in version of
7897: the software is similar enough to be used as a
7898: replacement.</p>
7899:
1.14 xtraeme 7900: <p>The last section is guarded by <code class=
7901: "varname">CHECK_BUILTIN.<em class=
7902: "replaceable"><code>pkg</code></em></code>, and
7903: includes code that uses the value of <code class=
7904: "varname">USE_BUILTIN.<em class=
7905: "replaceable"><code>pkg</code></em></code> set in the
7906: previous section. This typically includes, e.g., adding
1.1 grant 7907: additional dependency restrictions and listing
1.14 xtraeme 7908: additional files to symlink into <code class=
7909: "filename">${BUILDLINK_DIR}</code> (via <code class=
7910: "varname">BUILDLINK_FILES.<em class=
7911: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7912: </div>
7913:
7914: <div class="sect2" lang="en" xml:lang="en">
7915: <div class="titlepage">
7916: <div>
7917: <div>
1.30 wiz 7918: <h3 class="title"><a name=
7919: "native-or-pkgsrc-preference" id=
1.38 dillo 7920: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 7921: preferences for native or pkgsrc software</h3>
1.1 grant 7922: </div>
7923: </div>
7924: </div>
7925:
7926: <p>When building packages, it's possible to choose
7927: whether to set a global preference for using either the
7928: built-in (native) version or the pkgsrc version of
7929: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7930: setting <code class="varname">PREFER_PKGSRC</code> and
7931: <code class="varname">PREFER_NATIVE</code>. These
7932: variables take values of either “<span class=
1.1 grant 7933: "quote">yes</span>”, “<span class=
7934: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7935: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7936: to use the pkgsrc versions of software, while
7937: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7938: to use the built-in versions. Preferences are
7939: determined by the most specific instance of the package
7940: in either <code class="varname">PREFER_PKGSRC</code> or
7941: <code class="varname">PREFER_NATIVE</code>. If a
7942: package is specified in neither or in both variables,
7943: then <code class="varname">PREFER_PKGSRC</code> has
7944: precedence over <code class=
7945: "varname">PREFER_NATIVE</code>. For example, to require
7946: using pkgsrc versions of software for all but the most
7947: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7948: <pre class="programlisting">
7949: PREFER_PKGSRC= yes
7950: PREFER_NATIVE= getopt skey tcp_wrappers
7951:
7952: </pre>
7953:
7954: <p>A package <span class=
1.14 xtraeme 7955: "emphasis"><em>must</em></span> have a <code class=
7956: "filename">builtin.mk</code> file to be listed in
7957: <code class="varname">PREFER_NATIVE</code>, otherwise
7958: it is simply ignored in that list.</p>
1.1 grant 7959: </div>
7960: </div>
7961: </div>
7962:
7963: <div class="chapter" lang="en" xml:lang="en">
7964: <div class="titlepage">
7965: <div>
7966: <div>
1.35 jmmv 7967: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 7968: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 7969: framework</h2>
1.1 grant 7970: </div>
7971: </div>
7972: </div>
7973:
7974: <div class="toc">
7975: <p><b>Table of Contents</b></p>
7976:
7977: <dl>
1.30 wiz 7978: <dt><span class="sect1"><a href=
1.38 dillo 7979: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 7980: directories outside the installation
7981: prefix</a></span></dt>
7982:
7983: <dd>
7984: <dl>
7985: <dt><span class="sect2"><a href=
1.38 dillo 7986: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 7987: manipulation</a></span></dt>
7988:
7989: <dt><span class="sect2"><a href=
1.38 dillo 7990: "#files-outside-prefix">12.1.2. File
1.35 jmmv 7991: manipulation</a></span></dt>
7992: </dl>
7993: </dd>
7994:
1.38 dillo 7995: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 7996: Configuration files</a></span></dt>
7997:
7998: <dd>
7999: <dl>
8000: <dt><span class="sect2"><a href=
1.38 dillo 8001: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8002: "varname">PKG_SYSCONFDIR</code> is
8003: set</a></span></dt>
8004:
8005: <dt><span class="sect2"><a href=
1.38 dillo 8006: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 8007: software were configuration files
8008: are</a></span></dt>
8009:
8010: <dt><span class="sect2"><a href=
1.38 dillo 8011: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8012: installations</a></span></dt>
8013:
8014: <dt><span class="sect2"><a href=
1.38 dillo 8015: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8016: configuration files</a></span></dt>
8017: </dl>
8018: </dd>
8019:
1.38 dillo 8020: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8021: System startup scripts</a></span></dt>
8022:
8023: <dd>
8024: <dl>
8025: <dt><span class="sect2"><a href=
1.38 dillo 8026: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8027: of system startup scripts</a></span></dt>
8028: </dl>
8029: </dd>
1.1 grant 8030:
1.30 wiz 8031: <dt><span class="sect1"><a href=
1.38 dillo 8032: "#users-and-groups">12.4. System users and
1.35 jmmv 8033: groups</a></span></dt>
8034:
1.38 dillo 8035: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8036: shells</a></span></dt>
8037:
8038: <dd>
8039: <dl>
8040: <dt><span class="sect2"><a href=
1.38 dillo 8041: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8042: configuration files</a></span></dt>
8043: </dl>
8044: </dd>
1.1 grant 8045: </dl>
8046: </div>
8047:
1.35 jmmv 8048: <p>This chapter describes the framework known as
8049: <code class="literal">pkginstall</code>, whose key features
8050: are:</p>
8051:
8052: <div class="itemizedlist">
8053: <ul type="disc">
8054: <li>
8055: <p>Generic installation and manipulation of
8056: directories and files outside the pkgsrc-handled
8057: tree, <code class="varname">LOCALBASE</code>.</p>
8058: </li>
8059:
8060: <li>
8061: <p>Automatic handling of configuration files during
8062: installation, provided that packages are correctly
8063: designed.</p>
8064: </li>
8065:
8066: <li>
8067: <p>Generation and installation of system startup
8068: scripts.</p>
8069: </li>
8070:
8071: <li>
8072: <p>Registration of system users and groups.</p>
8073: </li>
8074:
8075: <li>
8076: <p>Registration of system shells.</p>
8077: </li>
8078: </ul>
8079: </div>
8080:
8081: <p>The following sections inspect each of the above points
8082: in detail. Note that, in order to use any of the described
8083: functionalities, you must add the following to your
8084: package's <code class="filename">Makefile</code>:</p>
8085: <pre class="programlisting">
8086: USE_PKGINSTALL=YES
8087: </pre>
8088:
8089: <p>You may be thinking that many of the things described
8090: here could be easily done with simple code in the package's
8091: post-installation target (<code class=
8092: "literal">post-install</code>). <span class=
8093: "emphasis"><em>This is incorrect</em></span>, as the code
8094: in them is only executed when building from source.
8095: Machines using binary packages could not benefit from it at
8096: all (as the code itself could be unavailable). Therefore,
8097: the only way to achieve any of the items described above is
8098: by means of the installation scripts, which are
8099: automatically generated by pkginstall.</p>
1.1 grant 8100:
8101: <div class="sect1" lang="en" xml:lang="en">
8102: <div class="titlepage">
8103: <div>
8104: <div>
8105: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 8106: "files-and-dirs-outside-prefix" id=
1.38 dillo 8107: "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35 jmmv 8108: directories outside the installation prefix</h2>
1.1 grant 8109: </div>
8110: </div>
8111: </div>
8112:
1.35 jmmv 8113: <p>As you already know, the <code class=
8114: "filename">PLIST</code> file holds a list of files and
8115: directories that belong to a package. The names used in
8116: it are relative to the installation prefix (<code class=
8117: "filename">${PREFIX}</code>), which means that it cannot
8118: register files outside this directory (absolute path
8119: names are not allowed). Despite this restriction, some
8120: packages need to install files outside this location;
8121: e.g., under <code class="filename">${VARBASE}</code> or
8122: <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
8123:
8124: <p>The only way to achieve this is to create such files
8125: during installation time by using the installation
8126: scripts. These scripts can run arbitrary commands, so
8127: they have the potential to create and manage files
8128: anywhere in the filesystem. Here is where pkginstall
8129: comes into play: it provides generic scripts to abstract
8130: the manipulation of such files and directories based on
8131: variables set in the package's <code class=
8132: "filename">Makefile</code>. The rest of this section
8133: describes which these variables are.</p>
1.1 grant 8134:
1.35 jmmv 8135: <div class="sect2" lang="en" xml:lang="en">
8136: <div class="titlepage">
1.1 grant 8137: <div>
1.35 jmmv 8138: <div>
8139: <h3 class="title"><a name="dirs-outside-prefix"
1.38 dillo 8140: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8141: manipulation</h3>
8142: </div>
1.1 grant 8143: </div>
8144: </div>
8145:
1.35 jmmv 8146: <p>The following variables can be set to request the
8147: creation of directories anywhere in the filesystem:</p>
1.27 rillig 8148:
1.35 jmmv 8149: <div class="itemizedlist">
8150: <ul type="disc">
8151: <li>
8152: <p><code class="varname">MAKE_DIRS</code> and
8153: <code class="varname">OWN_DIRS</code> contain a
8154: list of directories that should be created and
8155: should attempt to be destroyed by the
8156: installation scripts. The difference between the
8157: two is that the latter prompts the administrator
8158: to remove any directories that may be left after
8159: deinstallation (because they were not empty),
8160: while the former does not.</p>
8161: </li>
1.1 grant 8162:
1.35 jmmv 8163: <li>
8164: <p><code class="varname">MAKE_DIRS_PERMS</code>
8165: and <code class="varname">OWN_DIRS_PERMS</code>
8166: contain a list of tuples describing which
8167: directories should be created and should attempt
8168: to be destroyed by the installation scripts. Each
8169: tuple holds the following values, separated by
8170: spaces: the directory name, its owner, its group
8171: and its numerical mode. For example:</p>
8172: <pre class="programlisting">
8173: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8174: </pre>
1.1 grant 8175:
1.35 jmmv 8176: <p>The difference between the two is exactly the
8177: same as their non-<code class=
8178: "varname">PERMS</code> counterparts.</p>
8179: </li>
8180: </ul>
8181: </div>
8182: </div>
8183:
8184: <div class="sect2" lang="en" xml:lang="en">
8185: <div class="titlepage">
8186: <div>
8187: <div>
8188: <h3 class="title"><a name="files-outside-prefix"
1.38 dillo 8189: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 8190: manipulation</h3>
8191: </div>
8192: </div>
8193: </div>
8194:
8195: <p>Creating non-empty files outside the installation
8196: prefix is tricky because the <code class=
8197: "filename">PLIST</code> forces all files to be inside
8198: it. To overcome this problem, the only solution is to
8199: extract the file in the known place (i.e., inside the
8200: installation prefix) and copy it to the appropriate
8201: location during installation (done by the installation
8202: scripts generated by pkginstall). We will call the
8203: former the <span class="emphasis"><em>master
8204: file</em></span> in the following paragraphs, which
8205: describe the variables that can be used to
8206: automatically and consistently handle files outside the
8207: installation prefix:</p>
8208:
8209: <div class="itemizedlist">
8210: <ul type="disc">
8211: <li>
8212: <p><code class="varname">CONF_FILES</code> and
8213: <code class="varname">SUPPORT_FILES</code> are
8214: pairs of master and target files. During
8215: installation time, the master file is copied to
8216: the target one if and only if the latter does not
8217: exist. Upon deinstallation, the target file is
8218: removed provided that it was not modified by the
8219: installation.</p>
8220:
8221: <p>The difference between the two is that the
8222: latter prompts the administrator to remove any
8223: files that may be left after deinstallation
8224: (because they were not empty), while the former
8225: does not.</p>
8226: </li>
8227:
8228: <li>
8229: <p><code class="varname">CONF_FILES_PERMS</code>
8230: and <code class=
8231: "varname">SUPPORT_FILES_PERMS</code> contain
8232: tuples describing master files as well as their
8233: target locations. For each of them, it also
8234: specifies their owner, their group and their
8235: numeric permissions, in this order. For
8236: example:</p>
8237: <pre class="programlisting">
8238: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
8239: </pre>
8240:
8241: <p>The difference between the two is exactly the
8242: same as their non-<code class=
8243: "varname">PERMS</code> counterparts.</p>
8244: </li>
8245: </ul>
8246: </div>
8247: </div>
8248: </div>
8249:
8250: <div class="sect1" lang="en" xml:lang="en">
8251: <div class="titlepage">
8252: <div>
8253: <div>
8254: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8255: "conf-files" id="conf-files"></a>12.2.
1.35 jmmv 8256: Configuration files</h2>
8257: </div>
8258: </div>
8259: </div>
8260:
8261: <p>Configuration files are special in the sense that they
8262: are installed in their own specific directory,
8263: <code class="varname">PKG_SYSCONFDIR</code>, and need
8264: special treatment during installation (most of which is
8265: automated by pkginstall). The main concept you must bear
1.36 wiz 8266: in mind is that files marked as configuration files are
1.35 jmmv 8267: automatically copied to the right place (somewhere inside
8268: <code class="varname">PKG_SYSCONFDIR</code>) during
8269: installation <span class="emphasis"><em>if and only
8270: if</em></span> they didn't exist before. Similarly, they
8271: will not be removed if they have local modifications.
1.36 wiz 8272: This ensures that administrators never lose any custom
1.35 jmmv 8273: changes they may have made.</p>
8274:
8275: <div class="sect2" lang="en" xml:lang="en">
8276: <div class="titlepage">
8277: <div>
8278: <div>
8279: <h3 class="title"><a name="conf-files-sysconfdir"
1.38 dillo 8280: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 8281: <code class="varname">PKG_SYSCONFDIR</code> is
8282: set</h3>
8283: </div>
8284: </div>
8285: </div>
8286:
8287: <p>As said before, the <code class=
8288: "varname">PKG_SYSCONFDIR</code> variable specifies
8289: where configuration files shall be installed. Its
8290: contents are set based upon the following
8291: variables:</p>
8292:
8293: <div class="itemizedlist">
8294: <ul type="disc">
8295: <li>
8296: <p><code class="varname">PKG_SYSCONFBASE</code>:
8297: The configuration's root directory. Defaults to
8298: <code class="filename">${PREFIX}/etc</code>
1.36 wiz 8299: although it may be overridden by the user to
8300: point to his preferred location (e.g.,
8301: <code class="filename">/etc</code>, <code class=
1.35 jmmv 8302: "filename">/etc/pkg</code>, etc.). Packages must
8303: not use it directly.</p>
8304: </li>
8305:
8306: <li>
8307: <p><code class=
8308: "varname">PKG_SYSCONFSUBDIR</code>: A
8309: subdirectory of <code class=
8310: "varname">PKG_SYSCONFBASE</code> under which the
8311: configuration files for the package being built
8312: shall be installed. The definition of this
8313: variable only makes sense in the package's
8314: <code class="filename">Makefile</code> (i.e., it
8315: is not user customizable).</p>
8316:
8317: <p>As an example, consider the Apache package,
8318: <a xmlns=
8319: "http://www.w3.org/TR/xhtml1/transitional" href=
8320: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
8321: class="pkgname">www/apache2</a>, which places its
8322: configuration files under the <code class=
8323: "filename">httpd/</code> subdirectory of
8324: <code class="varname">PKG_SYSCONFBASE</code>.
8325: This should be set in the package Makefile.</p>
8326: </li>
8327:
8328: <li>
8329: <p><code class="varname">PKG_SYSCONFVAR</code>:
8330: Specifies the name of the variable that holds
8331: this package's configuration directory (if
8332: different from <code class=
8333: "varname">PKG_SYSCONFBASE</code>). It defaults to
8334: <code class="varname">PKGBASE</code>'s value, and
8335: is always prefixed with <code class=
8336: "literal">PKG_SYSCONFDIR</code>.</p>
8337: </li>
8338:
8339: <li>
8340: <p><code class=
8341: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
8342: Holds the directory where the configuration files
8343: for the package identified by <code class=
8344: "varname">PKG_SYSCONFVAR</code>'s shall be
8345: placed.</p>
8346: </li>
8347: </ul>
8348: </div>
8349:
8350: <p>Based on the above variables, pkginstall determines
8351: the value of <code class=
8352: "varname">PKG_SYSCONFDIR</code>, which is the
8353: <span class="emphasis"><em>only</em></span> variable
8354: that can be used within a package to refer to its
8355: configuration directory. The algorithm used to set its
8356: value is basically the following:</p>
8357:
8358: <div class="orderedlist">
8359: <ol type="1">
8360: <li>
8361: <p>If <code class=
8362: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
8363: is set, its value is used.</p>
8364: </li>
8365:
8366: <li>
8367: <p>If the previous variable is not defined but
8368: <code class="varname">PKG_SYSCONFSUBDIR</code> is
8369: set in the package's <code class=
8370: "filename">Makefile</code>, the resulting value
8371: is <code class=
8372: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
8373: </li>
8374:
8375: <li>
8376: <p>Otherwise, it is set to <code class=
8377: "filename">${PKG_SYSCONFBASE}</code>.</p>
8378: </li>
8379: </ol>
8380: </div>
8381:
8382: <p>It is worth mentioning that <code class=
8383: "filename">${PKG_SYSCONFDIR}</code> is automatically
8384: added to <code class="filename">OWN_DIRS</code>. See
8385: <a href="#dirs-outside-prefix" title=
1.38 dillo 8386: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 8387: “Directory manipulation”</a> what this
8388: means.</p>
8389: </div>
8390:
8391: <div class="sect2" lang="en" xml:lang="en">
8392: <div class="titlepage">
8393: <div>
8394: <div>
8395: <h3 class="title"><a name="conf-files-configure"
1.38 dillo 8396: id="conf-files-configure"></a>12.2.2. Telling the
1.35 jmmv 8397: software were configuration files are</h3>
8398: </div>
8399: </div>
8400: </div>
8401:
8402: <p>Given that pkgsrc (and users!) expect configuration
8403: files to be in a known place, you need to teach each
1.36 wiz 8404: package where it shall install its files. In some cases
1.35 jmmv 8405: you will have to patch the package Makefiles to achieve
8406: it. If you are lucky, though, it may be as easy as
8407: passing an extra flag to the configuration script; this
8408: is the case of GNU Autoconf generated files:</p>
8409: <pre class="programlisting">
8410: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
8411: </pre>
8412:
8413: <p>Note that this specifies where the package has to
8414: <span class="emphasis"><em>look for</em></span> its
8415: configuration files, not where they will be originally
8416: installed (although the difference is never explicit,
8417: unfortunately).</p>
8418: </div>
8419:
8420: <div class="sect2" lang="en" xml:lang="en">
8421: <div class="titlepage">
8422: <div>
8423: <div>
8424: <h3 class="title"><a name="conf-files-patching"
1.38 dillo 8425: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 8426: installations</h3>
8427: </div>
8428: </div>
8429: </div>
8430:
8431: <p>As said before, pkginstall automatically handles
8432: configuration files. This means that <span class=
8433: "strong"><strong>the packages themselves must not touch
8434: the contents of <code class=
8435: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 8436: directly</strong></span>. Bad news is that many
8437: software installation scripts will, out of the box,
8438: mess with the contents of that directory. So what is
8439: the correct procedure to fix this issue?</p>
1.35 jmmv 8440:
8441: <p>You must teach the package (usually by manually
8442: patching it) to install any configuration files under
8443: the examples hierarchy, <code class=
8444: "filename">share/examples/${PKGBASE}/</code>. This way,
8445: the <code class="filename">PLIST</code> registers them
8446: and the administrator always has the original copies
8447: available.</p>
8448:
8449: <p>Once the required configuration files are in place
8450: (i.e., under the examples hierarchy), the pkginstall
8451: framework can use them as master copies during the
8452: package installation to update what is in <code class=
8453: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
8454: the variables <code class="varname">CONF_FILES</code>
8455: and <code class="varname">CONF_FILES_PERMS</code> are
8456: used. Check out <a href="#files-outside-prefix" title=
1.38 dillo 8457: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 8458: “File manipulation”</a> for information
8459: about their syntax and their purpose. Here is an
8460: example, taken from the <a xmlns=
8461: "http://www.w3.org/TR/xhtml1/transitional" href=
8462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
8463: class="pkgname">mail/mutt</a> package:</p>
8464: <pre class="programlisting">
8465: EGDIR= ${PREFIX}/share/doc/mutt/samples
8466: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
8467: </pre>
8468:
8469: <p>Note that the <code class="varname">EGDIR</code>
8470: variable is specific to that package and has no meaning
8471: outside it.</p>
8472: </div>
8473:
8474: <div class="sect2" lang="en" xml:lang="en">
8475: <div class="titlepage">
8476: <div>
8477: <div>
8478: <h3 class="title"><a name="conf-files-disable"
1.38 dillo 8479: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 8480: handling of configuration files</h3>
8481: </div>
8482: </div>
8483: </div>
8484:
8485: <p>The automatic copying of config files can be toggled
8486: by setting the environment variable <code class=
8487: "varname">PKG_CONFIG</code> prior to package
8488: installation.</p>
8489: </div>
8490: </div>
8491:
8492: <div class="sect1" lang="en" xml:lang="en">
8493: <div class="titlepage">
8494: <div>
8495: <div>
8496: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8497: "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35 jmmv 8498: startup scripts</h2>
8499: </div>
8500: </div>
8501: </div>
8502:
8503: <p>System startup scripts are special files because they
8504: must be installed in a place known by the underlying OS,
8505: usually outside the installation prefix. Therefore, the
8506: same rules described in <a href=
8507: "#files-and-dirs-outside-prefix" title=
1.38 dillo 8508: "12.1. Files and directories outside the installation prefix">
8509: Section 12.1, “Files and directories outside the
1.35 jmmv 8510: installation prefix”</a> apply, and the same
8511: solutions can be used. However, pkginstall provides a
1.36 wiz 8512: special mechanism to handle these files.</p>
1.35 jmmv 8513:
8514: <p>In order to provide system startup scripts, the
8515: package has to:</p>
8516:
8517: <div class="orderedlist">
8518: <ol type="1">
8519: <li>
8520: <p>Store the script inside <code class=
8521: "filename">${FILESDIR}</code>, with the
8522: <code class="literal">.sh</code> suffix appended.
8523: Considering the <a xmlns=
8524: "http://www.w3.org/TR/xhtml1/transitional" href=
8525: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
8526: class="pkgname">print/cups</a> package as an
1.36 wiz 8527: example, it has a <code class=
1.35 jmmv 8528: "filename">cupsd.sh</code> in its files
8529: directory.</p>
8530: </li>
8531:
8532: <li>
8533: <p>Tell pkginstall to handle it, appending the name
8534: of the script, without its extension, to the
8535: <code class="varname">RCD_SCRIPTS</code> variable.
8536: Continuing the previous example:</p>
8537: <pre class="programlisting">
8538: RCD_SCRIPTS+= cupsd
8539: </pre>
8540: </li>
8541: </ol>
8542: </div>
8543:
8544: <p>Once this is done, pkginstall will do the following
8545: steps for each script in an automated fashion:</p>
8546:
8547: <div class="orderedlist">
8548: <ol type="1">
8549: <li>
8550: <p>Process the file found in the files directory
8551: applying all the substitutions described in the
8552: <code class="filename">FILES_SUBST</code>
8553: variable.</p>
8554: </li>
8555:
8556: <li>
8557: <p>Copy the script from the files directory to the
8558: examples hierarchy, <code class=
8559: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 8560: Note that this master file must be explicitly
1.35 jmmv 8561: registered in the <code class=
8562: "filename">PLIST</code>.</p>
8563: </li>
8564:
8565: <li>
8566: <p>Add code to the installation scripts to copy the
8567: startup script from the examples hierarchy into the
8568: system-wide startup scripts directory.</p>
8569: </li>
8570: </ol>
8571: </div>
8572:
8573: <div class="sect2" lang="en" xml:lang="en">
8574: <div class="titlepage">
8575: <div>
8576: <div>
8577: <h3 class="title"><a name="rcd-scripts-disable"
1.38 dillo 8578: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 8579: handling of system startup scripts</h3>
8580: </div>
8581: </div>
8582: </div>
8583:
8584: <p>The automatic copying of config files can be toggled
8585: by setting the environment variable <code class=
8586: "varname">PKG_RCD_SCRIPTS</code> prior to package
8587: installation. Note that the scripts will be always
8588: copied inside the examples hierarchy, <code class=
8589: "filename">${PREFIX}/share/examples/rc.d/</code>, no
8590: matter what the value of this variable is.</p>
8591: </div>
8592: </div>
8593:
8594: <div class="sect1" lang="en" xml:lang="en">
8595: <div class="titlepage">
8596: <div>
8597: <div>
8598: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8599: "users-and-groups" id="users-and-groups"></a>12.4.
1.35 jmmv 8600: System users and groups</h2>
8601: </div>
8602: </div>
8603: </div>
8604:
8605: <p>If a package needs to create special users and/or
8606: groups during installation, it can do so by using the
8607: pkginstall framework.</p>
8608:
8609: <p>Users can be created by adding entries to the
8610: <code class="varname">PKG_USERS</code> variable. Each
8611: entry has the following syntax, which mimics <code class=
8612: "filename">/etc/passwd</code>:</p>
8613: <pre class="programlisting">
8614: user:group[:[userid][:[descr][:[home][:shell]]]]
8615: </pre>
8616:
8617: <p>Only the user and group are required; everything else
8618: is optional, but the colons must be in the right places
8619: when specifying optional bits. By default, a new user
8620: will have home directory <code class=
8621: "filename">/nonexistent</code>, and login shell
8622: <code class="filename">/sbin/nologin</code> unless they
8623: are specified as part of the user element. Note that if
8624: the description contains spaces, then spaces should be
8625: double backslash-escaped, as in:</p>
8626: <pre class="programlisting">
8627: foo:foogrp::The\\ Foomister
8628: </pre>
8629:
8630: <p>Similarly, groups can be created using the
8631: <code class="varname">PKG_GROUPS</code> variable, whose
8632: syntax is:</p>
8633: <pre class="programlisting">
8634: group[:groupid]
8635: </pre>
8636:
8637: <p>As before, only the group name is required; the
8638: numeric identifier is optional.</p>
8639: </div>
8640:
8641: <div class="sect1" lang="en" xml:lang="en">
8642: <div class="titlepage">
8643: <div>
8644: <div>
8645: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8646: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 8647: </div>
8648: </div>
8649: </div>
8650:
8651: <p>Packages that install system shells should register
8652: them in the shell database, <code class=
8653: "filename">/etc/shells</code>, to make things easier to
8654: the administrator. This must be done from the
8655: installation scripts to keep binary packages working on
8656: any system. pkginstall provides an easy way to accomplish
8657: this task.</p>
8658:
8659: <p>When a package provides a shell interpreter, it has to
8660: set the <code class="varname">PKG_SHELL</code> variable
8661: to its absolute file name. This will add some hooks to
8662: the installation scripts to handle it. Consider the
8663: following example, taken from <a xmlns=
8664: "http://www.w3.org/TR/xhtml1/transitional" href=
8665: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
8666: class="pkgname">shells/zsh</a>:</p>
8667: <pre class="programlisting">
8668: USE_PKGINSTALL= YES
8669: PKG_SHELL= ${PREFIX}/bin/zsh
8670: </pre>
8671:
8672: <div class="sect2" lang="en" xml:lang="en">
8673: <div class="titlepage">
8674: <div>
8675: <div>
8676: <h3 class="title"><a name="shells-disable" id=
1.38 dillo 8677: "shells-disable"></a>12.5.1. Disabling handling
1.35 jmmv 8678: of configuration files</h3>
8679: </div>
8680: </div>
8681: </div>
8682:
8683: <p>The automatic registration of shell interpreters can
8684: be disabled by the administrator by setting the
8685: <code class="filename">PKG_REGISTER_SHELLS</code>
8686: environment variable to <code class=
8687: "literal">NO</code>.</p>
8688: </div>
8689: </div>
8690: </div>
8691:
8692: <div class="chapter" lang="en" xml:lang="en">
8693: <div class="titlepage">
8694: <div>
8695: <div>
8696: <h2 class="title"><a name="options" id=
1.38 dillo 8697: "options"></a>Chapter 13. Options
1.35 jmmv 8698: handling</h2>
8699: </div>
8700: </div>
8701: </div>
8702:
8703: <div class="toc">
8704: <p><b>Table of Contents</b></p>
8705:
8706: <dl>
8707: <dt><span class="sect1"><a href=
1.38 dillo 8708: "#global-default-options">13.1. Global default
1.35 jmmv 8709: options</a></span></dt>
8710:
8711: <dt><span class="sect1"><a href=
1.38 dillo 8712: "#converting-to-options">13.2. Converting packages to
1.35 jmmv 8713: use <code class=
8714: "filename">bsd.options.mk</code></a></span></dt>
8715: </dl>
8716: </div>
8717:
8718: <p>Many packages have the ability to be built to support
8719: different sets of features. <code class=
8720: "filename">bsd.options.mk</code> is a framework in pkgsrc
8721: that provides generic handling of those options that
8722: determine different ways in which the packages can be
8723: built. It's possible for the user to specify exactly which
8724: sets of options will be built into a package or to allow a
8725: set of global default options apply.</p>
8726:
8727: <div class="sect1" lang="en" xml:lang="en">
8728: <div class="titlepage">
8729: <div>
8730: <div>
8731: <h2 class="title" style="clear: both"><a name=
8732: "global-default-options" id=
1.38 dillo 8733: "global-default-options"></a>13.1. Global
1.35 jmmv 8734: default options</h2>
8735: </div>
8736: </div>
8737: </div>
8738:
8739: <p>Global default options are listed in <code class=
8740: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
8741: the options that should be built into every package if
8742: that option is supported. This variable should be set in
8743: <code class="filename">/etc/mk.conf</code>.</p>
8744: </div>
8745:
8746: <div class="sect1" lang="en" xml:lang="en">
8747: <div class="titlepage">
8748: <div>
8749: <div>
8750: <h2 class="title" style="clear: both"><a name=
8751: "converting-to-options" id=
1.38 dillo 8752: "converting-to-options"></a>13.2. Converting
1.35 jmmv 8753: packages to use <code class=
8754: "filename">bsd.options.mk</code></h2>
8755: </div>
8756: </div>
8757: </div>
8758:
8759: <p>The following example shows how <code class=
8760: "filename">bsd.options.mk</code> should be used by the
8761: hypothetical ``wibble'' package, either in the package
8762: <code class="filename">Makefile</code>, or in a file,
8763: e.g. <code class="filename">options.mk</code>, that is
8764: included by the main package <code class=
8765: "filename">Makefile</code>.</p>
8766: <pre class="programlisting">
1.37 dillo 8767: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
8768: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
8769: PKG_OPTIONAL_GROUPS= database
8770: PKG_GROUP.database= mysql pgsql
8771: PKG_SUGGESTED_OPTIONS= wibble-foo
8772: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
8773: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
8774:
8775: .include "../../mk/bsd.prefs.mk"
8776:
8777: # this package was previously named wibble2
8778: .if defined(PKG_OPTIONS.wibble2)
8779: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.40 ! dillo 8780: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37 dillo 8781: .endif
1.35 jmmv 8782:
8783: .include "../../mk/bsd.options.mk"
8784:
8785: # Package-specific option-handling
8786:
8787: ###
1.37 dillo 8788: ### FOO support
8789: ###
8790: .if !empty(PKG_OPTIONS:Mwibble-foo)
8791: CONFIGURE_ARGS+= --enable-foo
8792: .endif
8793:
8794: ###
1.35 jmmv 8795: ### LDAP support
8796: ###
8797: .if !empty(PKG_OPTIONS:Mldap)
8798: . include "../../databases/openldap/buildlink3.mk"
1.37 dillo 8799: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35 jmmv 8800: .endif
1.1 grant 8801:
8802: ###
1.37 dillo 8803: ### database support
1.1 grant 8804: ###
1.37 dillo 8805: .if !empty(PKG_OPTIONS:Mmysql)
8806: . include "../../mk/mysql.buildlink3.mk"
8807: .endif
8808: .if !empty(PKG_OPTIONS:Mpgsql)
8809: . include "../../mk/pgsql.buildlink3.mk"
1.1 grant 8810: .endif
8811: </pre>
8812:
1.28 rillig 8813: <p>The first section contains the information about which
8814: build options are supported by the package, and any
1.1 grant 8815: default options settings if needed.</p>
8816:
8817: <div class="orderedlist">
8818: <ol type="1">
8819: <li>
1.14 xtraeme 8820: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 8821: the name of the <a href=
1.1 grant 8822: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8823: <span class="citerefentry"><span class=
1.27 rillig 8824: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 8825: that the user can set to override the default
8826: options. It should be set to “<span class=
8827: "quote">PKG_OPTIONS.<em class=
1.38 dillo 8828: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 8829: </li>
8830:
8831: <li>
1.14 xtraeme 8832: <p><code class=
8833: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 8834: build options supported by the package.</p>
8835: </li>
8836:
8837: <li>
8838: <p><code class=
8839: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
8840: list of names of groups of mutually exclusive
8841: options. The options in each group are listed in
8842: <code class="varname">PKG_OPTIONS_GROUP.<em class=
8843: "replaceable"><code>groupname</code></em></code>.
8844: The most specific setting of any option from the
8845: group takes precedence over all other options in
8846: the group. Options from the groups will be
8847: automatically added to <code class=
8848: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
8849: </li>
8850:
8851: <li>
8852: <p><code class=
8853: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
8854: like <code class=
8855: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
8856: building the packages will fail if no option from
8857: the group is selected.</p>
1.1 grant 8858: </li>
8859:
8860: <li>
1.27 rillig 8861: <p><code class=
8862: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
8863: build options which are enabled by default.</p>
8864: </li>
8865:
8866: <li>
1.37 dillo 8867: <p><code class=
8868: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
8869: of “<span class="quote"><em class=
8870: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
8871: <code>option</code></em></span>” pairs that
8872: map legacy <code class=
8873: "filename">/etc/mk.conf</code> variables to their
8874: option counterparts. Pairs should be added with
8875: “<span class="quote">+=</span>” to keep
8876: the listing of global legacy variables. A warning
8877: will be issued if the user uses a legacy
8878: variable.</p>
8879: </li>
1.1 grant 8880:
1.37 dillo 8881: <li>
8882: <p><code class=
8883: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
8884: of “<span class="quote"><em class=
8885: "replaceable"><code>old-option</code></em>:<em class="replaceable">
8886: <code>new-option</code></em></span>” pairs
8887: that map options that have been renamed to their
8888: new counterparts. Pairs should be added with
8889: “<span class="quote">+=</span>” to keep
8890: the listing of global legacy options. A warning
8891: will be issued if the user uses a legacy
8892: option.</p>
8893: </li>
1.1 grant 8894:
1.37 dillo 8895: <li>
8896: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
8897: is a list of options implied by deprecated
8898: variables used. This can be used for cases that
8899: neither <code class=
8900: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
8901: <code class=
8902: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
8903: handle, e. g. when <code class=
8904: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 8905: </li>
8906:
8907: <li>
1.37 dillo 8908: <p><code class=
8909: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
8910: a list of warnings about deprecated variables or
8911: options used, and what to use instead.</p>
1.1 grant 8912: </li>
1.28 rillig 8913: </ol>
1.1 grant 8914: </div>
8915:
1.37 dillo 8916: <p>A package should never modify <code class=
8917: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
8918: named in <code class="varname">PKG_OPTIONS_VAR</code>.
8919: These are strictly user-settable. To suggest a default
8920: set of options, use <code class=
8921: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
8922:
8923: <p><code class="varname">PKG_OPTIONS_VAR</code> and at
8924: least one of <code class=
8925: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
8926: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
8927: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
8928: must be defined before including <code class=
8929: "filename">bsd.options.mk</code>.</p>
8930:
8931: <p>After the inclusion of <code class=
8932: "filename">bsd.options.mk</code>, the variable
1.28 rillig 8933: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 8934: list of selected build options, properly filtered to
1.28 rillig 8935: remove unsupported and duplicate options.</p>
8936:
1.1 grant 8937: <p>The remaining sections contain the logic that is
1.37 dillo 8938: specific to each option. The correct way to check for an
8939: option is to check whether it is listed in <code class=
8940: "varname">PKG_OPTIONS</code>:</p>
8941: <pre class="programlisting">
8942: .if !empty(PKG_OPTIONS:M<em class=
8943: "replaceable"><code>option</code></em>)
8944: </pre>
8945:
8946: <p>If another package already has an option with the same
8947: meaning, use the same name. For options applicable to
8948: multiple packages (like enabling support for a library),
8949: use short option names (like the name of the library).
8950: For options specific to this package, prefix the name
8951: with <code class="varname"><em class=
8952: "replaceable"><code>pkgname</code></em>-</code>. Document
8953: the option and its meaning in <code class=
8954: "filename">mk/defaults/options.description</code>.</p>
1.1 grant 8955: </div>
8956: </div>
8957:
8958: <div class="chapter" lang="en" xml:lang="en">
8959: <div class="titlepage">
8960: <div>
8961: <div>
8962: <h2 class="title"><a name="build" id=
1.38 dillo 8963: "build"></a>Chapter 14. The build
1.1 grant 8964: process</h2>
8965: </div>
8966: </div>
8967: </div>
8968:
8969: <div class="toc">
8970: <p><b>Table of Contents</b></p>
8971:
8972: <dl>
1.38 dillo 8973: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 8974: Program location</a></span></dt>
8975:
1.38 dillo 8976: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 8977: Main targets</a></span></dt>
1.1 grant 8978:
8979: <dt><span class="sect1"><a href=
1.38 dillo 8980: "#build.helpful-targets">14.3. Other helpful
1.1 grant 8981: targets</a></span></dt>
8982: </dl>
8983: </div>
8984:
8985: <p>The basic steps for building a program are always the
8986: same. First the program's source (<span class=
8987: "emphasis"><em>distfile</em></span>) must be brought to the
8988: local system and then extracted. After any patches to
8989: compile properly on NetBSD are applied, the software can be
8990: configured, then built (usually by compiling), and finally
8991: the generated binaries, etc. can be put into place on the
8992: system. These are exactly the steps performed by the NetBSD
8993: package system, which is implemented as a series of targets
1.14 xtraeme 8994: in a central Makefile, <code class=
8995: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 8996:
8997: <div class="sect1" lang="en" xml:lang="en">
8998: <div class="titlepage">
8999: <div>
9000: <div>
9001: <h2 class="title" style="clear: both"><a name=
9002: "build.prefix" id=
1.38 dillo 9003: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9004: </div>
9005: </div>
9006: </div>
9007:
9008: <p>Before outlining the process performed by the NetBSD
9009: package system in the next section, here's a brief
9010: discussion on where programs are installed, and which
9011: variables influence this.</p>
9012:
1.14 xtraeme 9013: <p>The automatic variable <code class=
9014: "varname">PREFIX</code> indicates where all files of the
9015: final program shall be installed. It is usually set to
9016: <code class="varname">LOCALBASE</code> (<code class=
9017: "filename">/usr/pkg</code>), or <code class=
9018: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9019: “<span class="quote">cross</span>” category.
1.14 xtraeme 9020: The value of <code class="varname">PREFIX</code> needs to
9021: be put into the various places in the program's source
9022: where paths to these files are encoded. See <a href=
1.1 grant 9023: "#components.patches" title=
1.38 dillo 9024: "8.3. patches/*">Section 8.3,
1.1 grant 9025: “patches/*”</a> and <a href="#fixes.libtool"
9026: title=
1.38 dillo 9027: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9028: “Shared libraries - libtool”</a> for more
9029: details.</p>
9030:
9031: <p>When choosing which of these variables to use, follow
9032: the following rules:</p>
9033:
9034: <div class="itemizedlist">
9035: <ul type="disc">
9036: <li>
1.14 xtraeme 9037: <p><code class="varname">PREFIX</code> always
9038: points to the location where the current pkg will
9039: be installed. When referring to a pkg's own
1.1 grant 9040: installation path, use “<span class=
9041: "quote">${PREFIX}</span>”.</p>
9042: </li>
9043:
9044: <li>
1.14 xtraeme 9045: <p><code class="varname">LOCALBASE</code> is where
9046: all non-X11 pkgs are installed. If you need to
1.1 grant 9047: construct a -I or -L argument to the compiler to
9048: find includes and libraries installed by another
9049: non-X11 pkg, use “<span class=
9050: "quote">${LOCALBASE}</span>”.</p>
9051: </li>
9052:
9053: <li>
1.14 xtraeme 9054: <p><code class="varname">X11BASE</code> is where
9055: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9056: installed. When looking for <span class=
9057: "emphasis"><em>standard</em></span> X11 includes
9058: (not those installed by a pkg), use
9059: “<span class=
9060: "quote">${X11BASE}</span>”.</p>
9061: </li>
9062:
9063: <li>
9064: <p>X11 based are special in that they may be
1.14 xtraeme 9065: installed in either <code class=
9066: "varname">X11BASE</code> or <code class=
9067: "varname">LOCALBASE</code>.</p>
1.1 grant 9068:
9069: <p>Usually, X11 packages should be installed under
1.14 xtraeme 9070: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 9071: possible. Note that you will need to include
9072: <code class=
9073: "filename">../../mk/x11.buildlink3.mk</code> in
9074: them to request the presence of X11 and to get the
9075: right compilation flags.</p>
1.1 grant 9076:
9077: <p>Even though, there are some packages that cannot
1.14 xtraeme 9078: be installed under <code class=
9079: "varname">LOCALBASE</code>: those that come with
1.1 grant 9080: app-defaults files. These packages are special and
1.14 xtraeme 9081: they must be placed under <code class=
9082: "varname">X11BASE</code>. To accomplish this, set
9083: either <code class="varname">USE_X11BASE</code> or
9084: <code class="varname">USE_IMAKE</code> in your
1.1 grant 9085: package.</p>
9086:
1.34 wiz 9087: <p>Some notes: If you need to find includes or
1.14 xtraeme 9088: libraries installed by a pkg that has <code class=
9089: "varname">USE_IMAKE</code> or <code class=
9090: "varname">USE_X11BASE</code> in its pkg
9091: <code class="filename">Makefile</code>, you need to
1.34 wiz 9092: look in <span class="emphasis"><em>both</em></span>
1.14 xtraeme 9093: <code class="filename">${X11BASE}</code> and
9094: <code class="filename">${LOCALBASE}</code>. To
9095: force installation of all X11 packages in
9096: <code class="varname">LOCALBASE</code>, the
9097: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9098: href=
1.1 grant 9099: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 9100: class="pkgname">pkgtools/xpkgwedge</a> package is
9101: enabled by default.</p>
1.1 grant 9102: </li>
9103:
9104: <li>
1.14 xtraeme 9105: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 9106: used to refer to the installed location of an X11
1.14 xtraeme 9107: package. <code class="varname">X11PREFIX</code>
9108: will be set to <code class="varname">X11BASE</code>
9109: if xpkgwedge is not installed, and to <code class=
9110: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 9111: installed.</p>
9112: </li>
9113:
9114: <li>
9115: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 9116: have some packages installed in <code class=
9117: "varname">X11BASE</code> and some in <code class=
9118: "varname">LOCALBASE</code>. To determine the prefix
9119: of an installed package, the <code class=
9120: "varname">EVAL_PREFIX</code> definition can be
9121: used. It takes pairs in the format
9122: “<span class=
1.1 grant 9123: "quote">DIRNAME=<package></span>”, and
1.24 wiz 9124: the <a href=
9125: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9126: <span class="citerefentry"><span class=
9127: "refentrytitle">make</span>(1)</span></a> variable
9128: <code class="varname">DIRNAME</code> will be set to
9129: the prefix of the installed package
9130: <package>, or “<span class=
1.1 grant 9131: "quote">${X11PREFIX}</span>” if the package
9132: is not installed.</p>
9133:
9134: <p>This is best illustrated by example.</p>
9135:
1.14 xtraeme 9136: <p>The following lines are taken from <code class=
9137: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 9138: <pre class="programlisting">
1.14 xtraeme 9139: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 9140: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
9141: --with-gtk-prefix="${GTKDIR}" \
9142: --enable-multibyte
9143: </pre>
9144:
9145: <p>Specific defaults can be defined for the
1.14 xtraeme 9146: packages evaluated using <code class=
9147: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 9148: of the form:</p>
9149: <pre class="programlisting">
9150: GTKDIR_DEFAULT= ${LOCALBASE}
9151: </pre>
9152:
1.14 xtraeme 9153: <p>where <code class="varname">GTKDIR</code>
1.1 grant 9154: corresponds to the first definition in the
1.14 xtraeme 9155: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 9156: </li>
9157:
9158: <li>
1.14 xtraeme 9159: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 9160: packages should install files according to <a href=
9161: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
9162: <span class="citerefentry"><span class=
9163: "refentrytitle">hier</span>(7)</span></a>, with the
9164: exception that manual pages go into <code class=
9165: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 9166: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 9167: </li>
9168: </ul>
9169: </div>
9170: </div>
9171:
9172: <div class="sect1" lang="en" xml:lang="en">
9173: <div class="titlepage">
9174: <div>
9175: <div>
9176: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9177: "main-targets" id=
1.38 dillo 9178: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 9179: </div>
9180: </div>
9181: </div>
9182:
9183: <p>The main targets used during the build process defined
1.14 xtraeme 9184: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 9185:
9186: <div class="variablelist">
9187: <dl>
9188: <dt><span class="term">fetch</span></dt>
9189:
9190: <dd>
9191: <p>This will check if the file(s) given in the
1.14 xtraeme 9192: variables <code class="varname">DISTFILES</code>
9193: and <code class="varname">PATCHFILES</code> (as
9194: defined in the package's Makefile) are present on
9195: the local system in <code class=
9196: "filename">/usr/pkgsrc/distfiles</code>. If they
9197: are not present, an attempt will be made to fetch
9198: them using commands of the form:</p>
1.1 grant 9199: <pre class="programlisting">
9200: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
9201: </pre>
9202:
9203: <p>where ${site} varies through several
1.14 xtraeme 9204: possibilities in turn: first, <code class=
9205: "varname">MASTER_SITE_OVERRIDE</code> is tried,
9206: then the sites specified in either <code class=
9207: "varname">SITES_file</code> if defined, else
9208: <code class="varname">MASTER_SITES</code> or
9209: <code class="varname">PATCH_SITES</code>, as
9210: applies, then finally the value of <code class=
9211: "varname">MASTER_SITE_BACKUP</code>. The order of
9212: all except the first can be optionally sorted by
9213: the user, via setting either <code class=
9214: "varname">MASTER_SORT_AWK</code> or <code class=
9215: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 9216: </dd>
9217:
9218: <dt><span class="term">checksum</span></dt>
9219:
9220: <dd>
9221: <p>After the distfile(s) are fetched, their
9222: checksum is generated and compared with the
9223: checksums stored in the distinfo file. If the
9224: checksums don't match, the build is aborted. This
9225: is to ensure the same distfile is used for
9226: building, and that the distfile wasn't changed,
9227: e.g. by some malign force, deliberately changed
9228: distfiles on the master distribution site or
9229: network lossage.</p>
9230: </dd>
9231:
9232: <dt><span class="term">extract</span></dt>
9233:
9234: <dd>
9235: <p>When the distfiles are present on the local
9236: system, they need to be extracted, as they are
9237: usually in the form of some compressed archive
1.14 xtraeme 9238: format, most commonly <code class=
9239: "filename">.tar.gz</code>.</p>
1.1 grant 9240:
9241: <p>If only some of the distfiles need to be
9242: uncompressed, the files to be uncompressed should
1.14 xtraeme 9243: be put into <code class=
9244: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 9245:
1.14 xtraeme 9246: <p>If the distfiles are not in <code class=
9247: "filename">.tar.gz</code> format, they can be
9248: extracted by setting either <code class=
9249: "varname">EXTRACT_SUFX</code>, or <code class=
9250: "varname">EXTRACT_CMD</code>, <code class=
9251: "varname">EXTRACT_BEFORE_ARGS</code> and
9252: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
9253: the former case, pkgsrc knows how to extract a
9254: number of suffixes (<code class=
9255: "filename">.tar.gz</code>, <code class=
9256: "filename">.tgz</code>, <code class=
9257: "filename">.tar.gz2</code>, <code class=
9258: "filename">.tbz</code>, <code class=
9259: "filename">.tar.Z</code>, <code class=
9260: "filename">.tar</code>, <code class=
9261: "filename">.shar.gz</code>, <code class=
9262: "filename">.shar.bz2</code>, <code class=
9263: "filename">.shar.Z</code>, <code class=
9264: "filename">.shar</code>, <code class=
9265: "filename">.Z</code>, <code class=
9266: "filename">.bz2</code> and <code class=
9267: "filename">.gz</code>; see the definition of the
9268: various <code class="varname">DECOMPRESS_CMD</code>
9269: variables <code class="filename">bsd.pkg.mk</code>
9270: for a complete list). Here's an example on how to
9271: use the other variables for a program that comes
9272: with a compressed shell archive whose name ends in
9273: <code class="filename">.msg.gz</code>:</p>
1.1 grant 9274: <pre class="programlisting">
9275: EXTRACT_SUFX= .msg.gz
9276: EXTRACT_CMD= zcat
9277: EXTRACT_BEFORE_ARGS=
9278: EXTRACT_AFTER_ARGS= |sh
9279: </pre>
9280: </dd>
9281:
9282: <dt><span class="term">patch</span></dt>
9283:
9284: <dd>
9285: <p>After extraction, all the patches named by the
1.14 xtraeme 9286: <code class="varname">PATCHFILES</code>, those
9287: present in the patches subdirectory of the package
9288: as well as in $LOCALPATCHES/$PKGPATH (e.g.
9289: <code class=
9290: "filename">/usr/local/patches/graphics/png</code>)
9291: are applied. Patchfiles ending in <code class=
9292: "filename">.Z</code> or <code class=
9293: "filename">.gz</code> are uncompressed before they
9294: are applied, files ending in <code class=
9295: "filename">.orig</code> or <code class=
9296: "filename">.rej</code> are ignored. Any special
1.24 wiz 9297: options to <a href=
9298: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9299: <span class="citerefentry"><span class=
9300: "refentrytitle">patch</span>(1)</span></a> can be
9301: handed in <code class=
1.14 xtraeme 9302: "varname">PATCH_DIST_ARGS</code>. See <a href=
9303: "#components.patches" title=
1.38 dillo 9304: "8.3. patches/*">Section 8.3,
1.1 grant 9305: “patches/*”</a> for more details.</p>
9306:
1.24 wiz 9307: <p>By default <a href=
9308: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9309: <span class="citerefentry"><span class=
9310: "refentrytitle">patch</span>(1)</span></a> is given
9311: special args to make it fail if the patches apply
9312: with some lines of fuzz. Please fix (regen) the
9313: patches so that they apply cleanly. The rationale
9314: behind this is that patches that don't apply
9315: cleanly may end up being applied in the wrong
9316: place, and cause severe harm there.</p>
1.1 grant 9317: </dd>
9318:
9319: <dt><span class="term">configure</span></dt>
9320:
9321: <dd>
9322: <p>Most pieces of software need information on the
9323: header files, system calls, and library routines
9324: which are available in NetBSD. This is the process
9325: known as configuration, and is usually automated.
9326: In most cases, a script is supplied with the
9327: source, and its invocation results in generation of
9328: header files, Makefiles, etc.</p>
9329:
9330: <p>If the program's distfile contains its own
9331: configure script, this can be invoked by setting
1.14 xtraeme 9332: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 9333: configure script is a GNU autoconf script,
1.14 xtraeme 9334: <code class="varname">GNU_CONFIGURE</code> should
9335: be specified instead. In either case, any arguments
9336: to the configure script can be specified in the
9337: <code class="varname">CONFIGURE_ARGS</code>
9338: variable, and the configure script's name can be
9339: set in <code class=
9340: "varname">CONFIGURE_SCRIPT</code> if it differs
9341: from the default “<span class=
1.1 grant 9342: "quote">configure</span>”. Here's an example
9343: from the <a xmlns=
9344: "http://www.w3.org/TR/xhtml1/transitional" href=
9345: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 9346: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 9347: <pre class="programlisting">
9348: HAS_CONFIGURE= yes
9349: CONFIGURE_SCRIPT= Configure
9350: CONFIGURE_ARGS+= netbsd13
9351: </pre>
9352:
9353: <p>If the program uses an Imakefile for
9354: configuration, the appropriate steps can be invoked
1.14 xtraeme 9355: by setting <code class="varname">USE_IMAKE</code>
9356: to “<span class="quote">YES</span>”.
9357: (If you only want the package installed in
9358: <code class="varname">$X11PREFIX</code> but xmkmf
9359: not being run, set <code class=
9360: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 9361: </dd>
9362:
9363: <dt><span class="term">build</span></dt>
9364:
9365: <dd>
9366: <p>Once configuration has taken place, the software
1.14 xtraeme 9367: will be built by invoking <code class=
9368: "varname">$MAKE_PROGRAM</code> on <code class=
9369: "varname">$MAKEFILE</code> with <code class=
9370: "varname">$BUILD_TARGET</code> as the target to
9371: build. The default <code class=
9372: "varname">MAKE_PROGRAM</code> is
9373: “<span class="quote">gmake</span>” if
1.29 rillig 9374: <code class="varname">USE_TOOLS</code> contains
9375: “<span class="quote">gmake</span>”,
1.1 grant 9376: “<span class="quote">make</span>”
1.14 xtraeme 9377: otherwise. <code class="varname">MAKEFILE</code> is
9378: set to “<span class=
1.1 grant 9379: "quote">Makefile</span>” by default, and
1.14 xtraeme 9380: <code class="varname">BUILD_TARGET</code> defaults
9381: to “<span class="quote">all</span>”.
9382: Any of these variables can be set in the package's
1.1 grant 9383: Makefile to change the default build process.</p>
9384: </dd>
9385:
9386: <dt><span class="term">install</span></dt>
9387:
9388: <dd>
9389: <p>Once the build stage has completed, the final
9390: step is to install the software in public
9391: directories, so users can access the programs and
1.14 xtraeme 9392: files. As in the build-target, <code class=
9393: "varname">$MAKE_PROGRAM</code> is invoked on
9394: <code class="varname">$MAKEFILE</code> here, but
9395: with the <code class=
9396: "varname">$INSTALL_TARGET</code> instead, the
9397: latter defaulting to “<span class=
9398: "quote">install</span>” (plus
9399: “<span class=
9400: "quote">install.man</span>”, if <code class=
9401: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 9402: </dd>
9403: </dl>
9404: </div>
9405:
9406: <p>If no target is specified, the default is
9407: “<span class="quote">build</span>”. If a
9408: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 9409: e.g. <span><strong class="command">make
9410: build</strong></span> will also perform the equivalent
9411: of:</p>
1.1 grant 9412: <pre class="programlisting">
9413: make fetch
9414: make checksum
9415: make extract
9416: make patch
9417: make configure
9418: make build
9419: </pre>
9420: </div>
9421:
9422: <div class="sect1" lang="en" xml:lang="en">
9423: <div class="titlepage">
9424: <div>
9425: <div>
9426: <h2 class="title" style="clear: both"><a name=
9427: "build.helpful-targets" id=
1.38 dillo 9428: "build.helpful-targets"></a>14.3. Other
1.1 grant 9429: helpful targets</h2>
9430: </div>
9431: </div>
9432: </div>
9433:
9434: <div class="variablelist">
9435: <dl>
9436: <dt><span class="term">pre/post-*</span></dt>
9437:
9438: <dd>
9439: <p>For any of the main targets described in the
9440: previous section, two auxiliary targets exist with
9441: “<span class="quote">pre-</span>” and
9442: “<span class="quote">post-</span>” used
9443: as a prefix for the main target's name. These
9444: targets are invoked before and after the main
9445: target is called, allowing extra configuration or
9446: installation steps be performed from a package's
9447: Makefile, for example, which a program's configure
9448: script or install target omitted.</p>
9449: </dd>
9450:
9451: <dt><span class="term">do-*</span></dt>
9452:
9453: <dd>
9454: <p>Should one of the main targets do the wrong
9455: thing, and should there be no variable to fix this,
9456: you can redefine it with the do-* target. (Note
9457: that redefining the target itself instead of the
9458: do-* target is a bad idea, as the pre-* and post-*
9459: targets won't be called anymore, etc.) You will not
9460: usually need to do this.</p>
9461: </dd>
9462:
9463: <dt><span class="term">reinstall</span></dt>
9464:
9465: <dd>
1.14 xtraeme 9466: <p>If you did a <span><strong class="command">make
9467: install</strong></span> and you noticed some file
9468: was not installed properly, you can repeat the
1.1 grant 9469: installation with this target, which will ignore
9470: the “<span class="quote">already
9471: installed</span>” flag.</p>
9472: </dd>
9473:
9474: <dt><span class="term">deinstall</span></dt>
9475:
9476: <dd>
1.24 wiz 9477: <p>This target does a <a href=
9478: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9479: <span class="citerefentry"><span class=
9480: "refentrytitle">pkg_delete</span>(1)</span></a> in
9481: the current directory, effectively de-installing
9482: the package. The following variables can be used to
9483: tune the behaviour:</p>
1.1 grant 9484:
9485: <div class="variablelist">
9486: <dl>
1.14 xtraeme 9487: <dt><span class="term"><code class=
9488: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 9489:
9490: <dd>
9491: <p>Add a "-v" to the <a href=
9492: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9493: <span class="citerefentry"><span class=
9494: "refentrytitle">pkg_delete</span>(1)</span></a>
9495: command.</p>
9496: </dd>
9497:
1.14 xtraeme 9498: <dt><span class="term"><code class=
9499: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 9500:
9501: <dd>
9502: <p>Remove all packages that require (depend
9503: on) the given package. This can be used to
9504: remove any packages that may have been pulled
9505: in by a given package, e.g. if
1.14 xtraeme 9506: <span><strong class="command">make deinstall
9507: DEINSTALLDEPENDS=1</strong></span> is done in
9508: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 9509: this is likely to remove whole KDE. Works by
9510: adding “<span class=
9511: "quote">-R</span>” to the <a href=
9512: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9513: <span class="citerefentry"><span class=
9514: "refentrytitle">pkg_delete</span>(1)</span></a>
9515: command line.</p>
9516: </dd>
9517: </dl>
9518: </div>
9519: </dd>
9520:
9521: <dt><span class="term">update</span></dt>
9522:
9523: <dd>
9524: <p>This target causes the current package to be
9525: updated to the latest version. The package and all
9526: depending packages first get de-installed, then
9527: current versions of the corresponding packages get
9528: compiled and installed. This is similar to manually
9529: noting which packages are currently installed, then
1.14 xtraeme 9530: performing a series of <span><strong class=
9531: "command">make deinstall</strong></span> and
9532: <span><strong class="command">make
9533: install</strong></span> (or whatever <code class=
9534: "varname">UPDATE_TARGET</code> is set to) for these
9535: packages.</p>
1.1 grant 9536:
9537: <p>You can use the “<span class=
9538: "quote">update</span>” target to resume
1.14 xtraeme 9539: package updating in case a previous
9540: <span><strong class="command">make
9541: update</strong></span> was interrupted for some
9542: reason. However, in this case, make sure you don't
9543: call <span><strong class="command">make
9544: clean</strong></span> or otherwise remove the list
9545: of dependent packages in <code class=
9546: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 9547: ability to automatically update the current package
9548: along with the dependent packages you have
9549: installed.</p>
9550:
1.14 xtraeme 9551: <p>Resuming an interrupted <span><strong class=
9552: "command">make update</strong></span> will only
9553: work as long as the package tree remains unchanged.
9554: If the source code for one of the packages to be
9555: updated has been changed, resuming
9556: <span><strong class="command">make
9557: update</strong></span> will most certainly
9558: fail!</p>
1.1 grant 9559:
9560: <p>The following variables can be used either on
1.14 xtraeme 9561: the command line or in <code class=
9562: "filename">/etc/mk.conf</code> to alter the
9563: behaviour of <span><strong class="command">make
9564: update</strong></span>:</p>
1.1 grant 9565:
9566: <div class="variablelist">
9567: <dl>
1.14 xtraeme 9568: <dt><span class="term"><code class=
9569: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 9570:
9571: <dd>
9572: <p>Install target to recursively use for the
9573: updated package and the dependent packages.
1.14 xtraeme 9574: Defaults to <code class=
9575: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 9576: “<span class=
9577: "quote">install</span>” otherwise for
1.14 xtraeme 9578: <span><strong class="command">make
9579: update</strong></span>. e.g.
9580: <span><strong class="command">make update
9581: UPDATE_TARGET=package</strong></span></p>
1.1 grant 9582: </dd>
9583:
1.14 xtraeme 9584: <dt><span class="term"><code class=
9585: "varname">NOCLEAN</code></span></dt>
1.1 grant 9586:
9587: <dd>
9588: <p>Don't clean up after updating. Useful if
9589: you want to leave the work sources of the
9590: updated packages around for inspection or
9591: other purposes. Be sure you eventually clean
9592: up the source tree (see the
9593: “<span class=
9594: "quote">clean-update</span>” target
9595: below) or you may run into troubles with old
9596: source code still lying around on your next
1.14 xtraeme 9597: <span><strong class=
9598: "command">make</strong></span> or
9599: <span><strong class="command">make
9600: update</strong></span>.</p>
1.1 grant 9601: </dd>
9602:
1.14 xtraeme 9603: <dt><span class="term"><code class=
9604: "varname">REINSTALL</code></span></dt>
1.1 grant 9605:
9606: <dd>
9607: <p>Deinstall each package before installing
1.14 xtraeme 9608: (making <code class=
9609: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 9610: necessary if the “<span class=
9611: "quote">clean-update</span>” target
9612: (see below) was called after interrupting a
1.14 xtraeme 9613: running <span><strong class="command">make
9614: update</strong></span>.</p>
1.1 grant 9615: </dd>
9616:
1.14 xtraeme 9617: <dt><span class="term"><code class=
9618: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 9619:
9620: <dd>
9621: <p>Allows you to disable recursion and
9622: hardcode the target for packages. The default
9623: is “<span class=
9624: "quote">update</span>” for the update
9625: target, facilitating a recursive update of
1.14 xtraeme 9626: prerequisite packages. Only set <code class=
9627: "varname">DEPENDS_TARGET</code> if you want
9628: to disable recursive updates. Use
9629: <code class="varname">UPDATE_TARGET</code>
9630: instead to just set a specific target for
9631: each package to be installed during
9632: <span><strong class="command">make
9633: update</strong></span> (see above).</p>
1.1 grant 9634: </dd>
9635: </dl>
9636: </div>
9637: </dd>
9638:
9639: <dt><span class="term">clean-update</span></dt>
9640:
9641: <dd>
9642: <p>Clean the source tree for all packages that
1.14 xtraeme 9643: would get updated if <span><strong class=
9644: "command">make update</strong></span> was called
9645: from the current directory. This target should not
9646: be used if the current package (or any of its
9647: depending packages) have already been de-installed
9648: (e.g., after calling <span><strong class=
9649: "command">make update</strong></span>) or you may
9650: lose some packages you intended to update. As a
9651: rule of thumb: only use this target <span class=
9652: "emphasis"><em>before</em></span> the first time
9653: you run <span><strong class="command">make
9654: update</strong></span> and only if you have a dirty
9655: package tree (e.g., if you used <code class=
9656: "varname">NOCLEAN</code>).</p>
1.1 grant 9657:
9658: <p>If you unsure about whether your tree is clean
1.14 xtraeme 9659: you can either perform a <span><strong class=
9660: "command">make clean</strong></span> at the top of
9661: the tree, or use the following sequence of commands
1.1 grant 9662: from the directory of the package you want to
9663: update (<span class=
9664: "emphasis"><em>before</em></span> running
1.14 xtraeme 9665: <span><strong class="command">make
9666: update</strong></span> for the first time,
9667: otherwise you lose all the packages you wanted to
9668: update!):</p>
1.1 grant 9669: <pre class="screen">
1.14 xtraeme 9670: <code class="prompt">#</code> <strong class=
9671: "userinput"><code>make clean-update</code></strong>
9672: <code class="prompt">#</code> <strong class=
9673: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
9674: <code class="prompt">#</code> <strong class=
9675: "userinput"><code>make update</code></strong>
1.1 grant 9676: </pre>
9677:
9678: <p>The following variables can be used either on
1.14 xtraeme 9679: the command line or in <code class=
9680: "filename">/etc/mk.conf</code> to alter the
9681: behaviour of <span><strong class="command">make
9682: clean-update</strong></span>:</p>
1.1 grant 9683:
9684: <div class="variablelist">
9685: <dl>
1.14 xtraeme 9686: <dt><span class="term"><code class=
9687: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 9688:
9689: <dd>
1.14 xtraeme 9690: <p>After <span><strong class="command">make
9691: clean</strong></span>, do not reconstruct the
9692: list of directories to update for this
9693: package. Only use this if
9694: <span><strong class="command">make
9695: update</strong></span> successfully installed
9696: all packages you wanted to update. Normally,
9697: this is done automatically on
9698: <span><strong class="command">make
9699: update</strong></span>, but may have been
9700: suppressed by the <code class=
9701: "varname">NOCLEAN</code> variable (see
1.1 grant 9702: above).</p>
9703: </dd>
9704: </dl>
9705: </div>
9706: </dd>
9707:
9708: <dt><span class="term">info</span></dt>
9709:
9710: <dd>
9711: <p>This target invokes <a href=
9712: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9713: <span class="citerefentry"><span class=
9714: "refentrytitle">pkg_info</span>(1)</span></a> for
9715: the current package. You can use this to check
9716: which version of a package is installed.</p>
9717: </dd>
9718:
9719: <dt><span class="term">readme</span></dt>
9720:
9721: <dd>
1.14 xtraeme 9722: <p>This target generates a <code class=
9723: "filename">README.html</code> file, which can be
1.1 grant 9724: viewed using a browser such as <a xmlns=
9725: "http://www.w3.org/TR/xhtml1/transitional" href=
9726: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 9727: class="pkgname">www/mozilla</a> or <a xmlns=
9728: "http://www.w3.org/TR/xhtml1/transitional" href=
9729: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
9730: class="pkgname">www/links</a>. The generated files
9731: contain references to any packages which are in the
9732: <code class="varname">PACKAGES</code> directory on
9733: the local host. The generated files can be made to
9734: refer to URLs based on <code class=
9735: "varname">FTP_PKG_URL_HOST</code> and <code class=
9736: "varname">FTP_PKG_URL_DIR</code>. For example, if I
9737: wanted to generate <code class=
9738: "filename">README.html</code> files which pointed
9739: to binary packages on the local machine, in the
9740: directory <code class=
9741: "filename">/usr/packages</code>, set <code class=
9742: "varname">FTP_PKG_URL_HOST=file://localhost</code>
9743: and <code class=
9744: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
9745: <code class="varname">${PACKAGES}</code> directory
9746: and its subdirectories will be searched for all the
9747: binary packages.</p>
1.1 grant 9748: </dd>
9749:
9750: <dt><span class="term">readme-all</span></dt>
9751:
9752: <dd>
1.14 xtraeme 9753: <p>Use this target to create a file <code class=
9754: "filename">README-all.html</code> which contains a
1.1 grant 9755: list of all packages currently available in the
9756: NetBSD Packages Collection, together with the
9757: category they belong to and a short description.
1.14 xtraeme 9758: This file is compiled from the <code class=
9759: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 9760: sure to run this <span class=
1.14 xtraeme 9761: "emphasis"><em>after</em></span> a
9762: <span><strong class="command">make
9763: readme</strong></span>.</p>
1.1 grant 9764: </dd>
9765:
9766: <dt><span class="term">cdrom-readme</span></dt>
9767:
9768: <dd>
9769: <p>This is very much the same as the
9770: “<span class="quote">readme</span>”
9771: target (see above), but is to be used when
9772: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 9773: This target also produces <code class=
9774: "filename">README.html</code> files, and can be
9775: made to refer to URLs based on <code class=
9776: "varname">CDROM_PKG_URL_HOST</code> and
9777: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 9778: </dd>
9779:
9780: <dt><span class="term">show-distfiles</span></dt>
9781:
9782: <dd>
9783: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 9784: are needed to build the package. (<code class=
9785: "varname">DISTFILES</code> and <code class=
9786: "varname">PATCHFILES</code>, but not <code class=
9787: "filename">patches/*</code>)</p>
1.1 grant 9788: </dd>
9789:
9790: <dt><span class="term">show-downlevel</span></dt>
9791:
9792: <dd>
9793: <p>This target shows nothing if the package is not
9794: installed. If a version of this package is
9795: installed, but is not the version provided in this
9796: version of pkgsrc, then a warning message is
9797: displayed. This target can be used to show which of
9798: your installed packages are downlevel, and so the
9799: old versions can be deleted, and the current ones
9800: added.</p>
9801: </dd>
9802:
9803: <dt><span class="term">show-pkgsrc-dir</span></dt>
9804:
9805: <dd>
9806: <p>This target shows the directory in the pkgsrc
9807: hierarchy from which the package can be built and
9808: installed. This may not be the same directory as
9809: the one from which the package was installed. This
9810: target is intended to be used by people who may
9811: wish to upgrade many packages on a single host, and
9812: can be invoked from the top-level pkgsrc Makefile
9813: by using the “<span class=
9814: "quote">show-host-specific-pkgs</span>”
9815: target.</p>
9816: </dd>
9817:
9818: <dt><span class=
9819: "term">show-installed-depends</span></dt>
9820:
9821: <dd>
9822: <p>This target shows which installed packages match
1.14 xtraeme 9823: the current package's <code class=
9824: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 9825: dependencies are causing build problems.</p>
9826: </dd>
9827:
9828: <dt><span class="term">check-shlibs</span></dt>
9829:
9830: <dd>
9831: <p>After a package is installed, check all its
9832: binaries and (on ELF platforms) shared libraries to
9833: see if they find the shared libs they need. Run by
1.14 xtraeme 9834: default if <code class=
9835: "varname">PKG_DEVELOPER</code> is set in
9836: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 9837: </dd>
9838:
9839: <dt><span class="term">print-PLIST</span></dt>
9840:
9841: <dd>
9842: <p>After a “<span class="quote">make
9843: install</span>” from a new or upgraded pkg,
9844: this prints out an attempt to generate a new
1.14 xtraeme 9845: <code class="filename">PLIST</code> from a
9846: <span><strong class="command">find -newer
9847: work/.extract_done</strong></span>. An attempt is
9848: made to care for shared libs etc., but it is
1.1 grant 9849: <span class="emphasis"><em>strongly</em></span>
9850: recommended to review the result before putting it
1.14 xtraeme 9851: into <code class="filename">PLIST</code>. On
9852: upgrades, it's useful to diff the output of this
9853: command against an already existing <code class=
9854: "filename">PLIST</code> file.</p>
1.1 grant 9855:
1.24 wiz 9856: <p>If the package installs files via <a href=
9857: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
9858: <span class="citerefentry"><span class=
9859: "refentrytitle">tar</span>(1)</span></a> or other
9860: methods that don't update file access times, be
9861: sure to add these files manually to your
1.14 xtraeme 9862: <code class="filename">PLIST</code>, as the
1.1 grant 9863: “<span class="quote">find
9864: -newer</span>” command used by this target
9865: won't catch them!</p>
9866:
9867: <p>See <a href="#print-PLIST" title=
1.38 dillo 9868: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 9869: “Tweaking output of <span><strong class=
9870: "command">make
9871: print-PLIST</strong></span>”</a> for more
9872: information on this target.</p>
1.1 grant 9873: </dd>
9874:
9875: <dt><span class="term">bulk-package</span></dt>
9876:
9877: <dd>
9878: <p>Used to do bulk builds. If an appropriate binary
9879: package already exists, no action is taken. If not,
9880: this target will compile, install and package it
1.14 xtraeme 9881: (and it's depends, if <code class=
9882: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 9883: <a href="#binary.configuration" title=
1.38 dillo 9884: "6.3.1. Configuration">Section 6.3.1,
1.1 grant 9885: “Configuration”</a>. After creating the
9886: binary package, the sources, the just-installed
9887: package and it's required packages are removed,
9888: preserving free disk space.</p>
9889:
9890: <p><span class="emphasis"><em>Beware that this
9891: target may deinstall all packages installed on a
9892: system!</em></span></p>
9893: </dd>
9894:
9895: <dt><span class="term">bulk-install</span></dt>
9896:
9897: <dd>
9898: <p>Used during bulk-installs to install required
9899: packages. If an upto-date binary package is
9900: available, it will be installed via <a href=
9901: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9902: <span class="citerefentry"><span class=
9903: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 9904: not, <span><strong class="command">make
9905: bulk-package</strong></span> will be executed, but
9906: the installed binary not be removed.</p>
1.1 grant 9907:
9908: <p>A binary package is considered
9909: “<span class="quote">upto-date</span>”
9910: to be installed via <a href=
9911: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9912: <span class="citerefentry"><span class=
9913: "refentrytitle">pkg_add</span>(1)</span></a>
9914: if:</p>
9915:
9916: <div class="itemizedlist">
9917: <ul type="disc">
9918: <li>
1.14 xtraeme 9919: <p>None of the package's files (<code class=
9920: "filename">Makefile</code>, ...) were
9921: modified since it was built.</p>
1.1 grant 9922: </li>
9923:
9924: <li>
9925: <p>None of the package's required (binary)
9926: packages were modified since it was
9927: built.</p>
9928: </li>
9929: </ul>
9930: </div>
9931:
9932: <p><span class="emphasis"><em>Beware that this
9933: target may deinstall all packages installed on a
9934: system!</em></span></p>
9935: </dd>
9936: </dl>
9937: </div>
9938: </div>
9939: </div>
9940:
9941: <div class="chapter" lang="en" xml:lang="en">
9942: <div class="titlepage">
9943: <div>
9944: <div>
9945: <h2 class="title"><a name="fixes" id=
1.38 dillo 9946: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 9947: packages</h2>
9948: </div>
9949: </div>
9950: </div>
9951:
9952: <div class="toc">
9953: <p><b>Table of Contents</b></p>
9954:
9955: <dl>
1.30 wiz 9956: <dt><span class="sect1"><a href=
1.38 dillo 9957: "#general-operation">15.1. General
1.30 wiz 9958: operation</a></span></dt>
1.1 grant 9959:
9960: <dd>
9961: <dl>
9962: <dt><span class="sect2"><a href=
1.38 dillo 9963: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 9964: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 9965:
9966: <dt><span class="sect2"><a href=
1.38 dillo 9967: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 9968: install documentation</a></span></dt>
9969:
9970: <dt><span class="sect2"><a href=
1.38 dillo 9971: "#restricted-packages">15.1.3. Restricted
1.1 grant 9972: packages</a></span></dt>
9973:
9974: <dt><span class="sect2"><a href=
1.38 dillo 9975: "#dependencies">15.1.4. Handling
1.1 grant 9976: dependencies</a></span></dt>
9977:
9978: <dt><span class="sect2"><a href=
1.38 dillo 9979: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 9980: packages</a></span></dt>
9981:
9982: <dt><span class="sect2"><a href=
1.38 dillo 9983: "#not-building-packages">15.1.6. Packages that
1.30 wiz 9984: cannot or should not be built</a></span></dt>
1.1 grant 9985:
9986: <dt><span class="sect2"><a href=
1.38 dillo 9987: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 9988: should not be deleted, once
9989: installed</a></span></dt>
1.1 grant 9990:
9991: <dt><span class="sect2"><a href=
1.38 dillo 9992: "#security-handling">15.1.8. Handling packages with
1.1 grant 9993: security problems</a></span></dt>
9994:
9995: <dt><span class="sect2"><a href=
1.38 dillo 9996: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 9997: bugs</a></span></dt>
9998:
9999: <dt><span class="sect2"><a href=
1.38 dillo 10000: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10001: incrementing versions when fixing an existing
1.1 grant 10002: package</a></span></dt>
10003:
10004: <dt><span class="sect2"><a href=
1.38 dillo 10005: "#portability-of-packages">15.1.11. Portability of
1.1 grant 10006: packages</a></span></dt>
10007: </dl>
10008: </dd>
10009:
1.30 wiz 10010: <dt><span class="sect1"><a href=
1.38 dillo 10011: "#downloading-issues">15.2. Possible downloading
1.30 wiz 10012: issues</a></span></dt>
1.1 grant 10013:
10014: <dd>
10015: <dl>
10016: <dt><span class="sect2"><a href=
1.38 dillo 10017: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 10018: distfiles aren't available for plain
1.1 grant 10019: downloading</a></span></dt>
10020:
10021: <dt><span class="sect2"><a href=
1.38 dillo 10022: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 10023: handle modified distfiles with the 'old'
10024: name</a></span></dt>
1.1 grant 10025: </dl>
10026: </dd>
10027:
1.30 wiz 10028: <dt><span class="sect1"><a href=
1.38 dillo 10029: "#configuration-gotchas">15.3. Configuration
1.30 wiz 10030: gotchas</a></span></dt>
1.1 grant 10031:
10032: <dd>
10033: <dl>
10034: <dt><span class="sect2"><a href=
1.38 dillo 10035: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 10036: libtool</a></span></dt>
10037:
10038: <dt><span class="sect2"><a href=
1.38 dillo 10039: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 10040: packages that already support
10041: libtool</a></span></dt>
1.1 grant 10042:
10043: <dt><span class="sect2"><a href=
1.38 dillo 10044: "#autoconf-automake">15.3.3. GNU
1.1 grant 10045: Autoconf/Automake</a></span></dt>
10046: </dl>
10047: </dd>
10048:
1.30 wiz 10049: <dt><span class="sect1"><a href=
1.38 dillo 10050: "#building-considerations">15.4. Building
1.30 wiz 10051: considerations</a></span></dt>
1.1 grant 10052:
10053: <dd>
10054: <dl>
10055: <dt><span class="sect2"><a href=
1.38 dillo 10056: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1 grant 10057: </dl>
10058: </dd>
10059:
1.30 wiz 10060: <dt><span class="sect1"><a href=
1.38 dillo 10061: "#package-specific-actions">15.5. Package specific
1.30 wiz 10062: actions</a></span></dt>
1.1 grant 10063:
10064: <dd>
10065: <dl>
10066: <dt><span class="sect2"><a href=
1.38 dillo 10067: "#user-interaction">15.5.1. User
1.2 hubertf 10068: interaction</a></span></dt>
1.1 grant 10069:
10070: <dt><span class="sect2"><a href=
1.38 dillo 10071: "#handling-licenses">15.5.2. Handling
1.1 grant 10072: licenses</a></span></dt>
10073:
10074: <dt><span class="sect2"><a href=
1.38 dillo 10075: "#installing-score-files">15.5.3. Installing score
1.1 grant 10076: files</a></span></dt>
10077:
10078: <dt><span class="sect2"><a href=
1.38 dillo 10079: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 10080: scripts</a></span></dt>
10081:
10082: <dt><span class="sect2"><a href=
1.38 dillo 10083: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 10084: paths to other interpreters</a></span></dt>
1.1 grant 10085:
10086: <dt><span class="sect2"><a href=
1.38 dillo 10087: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 10088: modules</a></span></dt>
10089:
10090: <dt><span class="sect2"><a href=
1.38 dillo 10091: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 10092: files</a></span></dt>
10093:
10094: <dt><span class="sect2"><a href=
1.38 dillo 10095: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 10096: GConf2 data files</a></span></dt>
1.1 grant 10097:
10098: <dt><span class="sect2"><a href=
1.38 dillo 10099: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 10100: installing scrollkeeper data files</a></span></dt>
1.1 grant 10101:
10102: <dt><span class="sect2"><a href=
1.38 dillo 10103: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 10104: fonts</a></span></dt>
10105:
10106: <dt><span class="sect2"><a href=
1.38 dillo 10107: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 10108: modules</a></span></dt>
10109:
10110: <dt><span class="sect2"><a href=
1.38 dillo 10111: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 10112: or XML data</a></span></dt>
1.1 grant 10113:
10114: <dt><span class="sect2"><a href=
1.38 dillo 10115: "#mime-database">15.5.13. Packages installing
1.1 grant 10116: extensions to the MIME database</a></span></dt>
10117:
10118: <dt><span class="sect2"><a href=
1.38 dillo 10119: "#intltool">15.5.14. Packages using
1.1 grant 10120: intltool</a></span></dt>
1.18 xtraeme 10121:
10122: <dt><span class="sect2"><a href=
1.38 dillo 10123: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 10124: startup scripts</a></span></dt>
1.1 grant 10125: </dl>
10126: </dd>
10127:
1.30 wiz 10128: <dt><span class="sect1"><a href=
1.38 dillo 10129: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 10130: author</a></span></dt>
1.1 grant 10131: </dl>
10132: </div>
10133:
10134: <div class="sect1" lang="en" xml:lang="en">
10135: <div class="titlepage">
10136: <div>
10137: <div>
10138: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10139: "general-operation" id=
1.38 dillo 10140: "general-operation"></a>15.1. General
1.1 grant 10141: operation</h2>
10142: </div>
10143: </div>
10144: </div>
10145:
10146: <div class="sect2" lang="en" xml:lang="en">
10147: <div class="titlepage">
10148: <div>
10149: <div>
1.30 wiz 10150: <h3 class="title"><a name=
10151: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 10152: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 10153: to pull in variables from /etc/mk.conf</h3>
1.1 grant 10154: </div>
10155: </div>
10156: </div>
10157:
10158: <p>The problem with package-defined variables that can
1.14 xtraeme 10159: be overridden via <code class="varname">MAKECONF</code>
10160: or <code class="filename">/etc/mk.conf</code> is that
10161: <a href=
1.1 grant 10162: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10163: <span class="citerefentry"><span class=
10164: "refentrytitle">make</span>(1)</span></a> expands a
10165: variable as it is used, but evaluates preprocessor like
10166: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 10167: So, to use any variable (which may be set in
10168: <code class="filename">/etc/mk.conf</code>) in one of
10169: the .if* statements, the file <code class=
10170: "filename">/etc/mk.conf</code> must be included before
1.1 grant 10171: that .if* statement.</p>
10172:
10173: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 10174: including <code class="filename">/etc/mk.conf</code>,
10175: should it exist, or <code class=
10176: "varname">MAKECONF</code>, should it exist, include the
10177: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
10178: file in the package Makefile before any
10179: preprocessor-like .if, .ifdef, or .ifndef
10180: statements:</p>
1.1 grant 10181: <pre class="programlisting">
10182: .include "../../mk/bsd.prefs.mk"
10183:
10184: .if defined(USE_MENUS)
10185: ...
10186: .endif
10187: </pre>
10188:
1.14 xtraeme 10189: <p>If you wish to set the <code class=
10190: "varname">CFLAGS</code> variable in <code class=
10191: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 10192: use:</p>
10193: <pre class="programlisting">
10194: CFLAGS+= -your -flags
10195: </pre>
10196:
1.14 xtraeme 10197: <p>Using <code class="varname">CFLAGS=</code> (i.e.
10198: without the “<span class="quote">+</span>”)
10199: may lead to problems with packages that need to add
10200: their own flags. Also, you may want to take a look at
10201: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 10202: href=
10203: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 10204: class="pkgname">devel/cpuflags</a> package if you're
10205: interested in optimization for the current CPU.</p>
1.1 grant 10206: </div>
10207:
10208: <div class="sect2" lang="en" xml:lang="en">
10209: <div class="titlepage">
10210: <div>
10211: <div>
1.31 wiz 10212: <h3 class="title"><a name=
10213: "where-to-install-documentation" id=
1.38 dillo 10214: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 10215: to install documentation</h3>
10216: </div>
10217: </div>
10218: </div>
10219:
10220: <p>Documentation should be installed into <code class=
10221: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
10222: <code class=
10223: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
10224: latter includes the version number of the package).</p>
10225: </div>
10226:
10227: <div class="sect2" lang="en" xml:lang="en">
10228: <div class="titlepage">
10229: <div>
10230: <div>
1.30 wiz 10231: <h3 class="title"><a name="restricted-packages"
10232: id=
1.38 dillo 10233: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 10234: packages</h3>
10235: </div>
10236: </div>
10237: </div>
10238:
10239: <p>Some licenses restrict how software may be
10240: re-distributed. In order to satisfy these restrictions,
10241: the package system defines five make variables that can
10242: be set to note these restrictions:</p>
10243:
10244: <div class="itemizedlist">
10245: <ul type="disc">
10246: <li>
1.14 xtraeme 10247: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 10248:
10249: <p>This variable should be set whenever a
10250: restriction exists (regardless of its kind). Set
10251: this variable to a string containing the reason
10252: for the restriction.</p>
10253: </li>
10254:
10255: <li>
1.14 xtraeme 10256: <p><code class=
10257: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 10258:
10259: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 10260: variable to <code class=
10261: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10262: package may not be included on a CD-ROM.</p>
10263: </li>
10264:
10265: <li>
1.14 xtraeme 10266: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 10267:
10268: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 10269: Set this variable to <code class=
10270: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10271: package may not not be made available on the
10272: Internet.</p>
10273: </li>
10274:
10275: <li>
1.14 xtraeme 10276: <p><code class=
10277: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 10278:
10279: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 10280: this variable to <code class=
10281: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10282: of the source code or other distfile(s) is not
10283: allowed on CD-ROMs.</p>
10284: </li>
10285:
10286: <li>
1.14 xtraeme 10287: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 10288:
10289: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 10290: variable to <code class=
10291: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10292: of the source code or other distfile(s) via the
10293: Internet is not allowed.</p>
10294: </li>
10295: </ul>
10296: </div>
10297:
1.14 xtraeme 10298: <p>Please note that the use of <code class=
10299: "varname">NO_PACKAGE</code>, <code class=
10300: "varname">IGNORE</code>, <code class=
10301: "varname">NO_CDROM</code>, or other generic make
1.1 grant 10302: variables to denote restrictions is deprecated, because
10303: they unconditionally prevent users from generating
10304: binary packages!</p>
10305: </div>
10306:
10307: <div class="sect2" lang="en" xml:lang="en">
10308: <div class="titlepage">
10309: <div>
10310: <div>
10311: <h3 class="title"><a name="dependencies" id=
1.38 dillo 10312: "dependencies"></a>15.1.4. Handling
1.1 grant 10313: dependencies</h3>
10314: </div>
10315: </div>
10316: </div>
10317:
10318: <p>Your package may depend on some other package being
10319: present - and there are various ways of expressing this
1.14 xtraeme 10320: dependency. pkgsrc supports the <code class=
10321: "varname">BUILD_DEPENDS</code> and <code class=
10322: "varname">DEPENDS</code> definitions, as well as
10323: dependencies via <code class=
10324: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 10325: way to handle dependencies, and which uses the
10326: variables named above. See <a href="#buildlink" title=
1.38 dillo 10327: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 10328: <i>Buildlink methodology</i></a> for more
10329: information.</p>
10330:
10331: <p>The basic difference between the two variables is as
1.14 xtraeme 10332: follows: The <code class="varname">DEPENDS</code>
1.1 grant 10333: definition registers that pre-requisite in the binary
10334: package so it will be pulled in when the binary package
1.14 xtraeme 10335: is later installed, whilst the <code class=
10336: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 10337: marking a dependency that is only needed for building
10338: the package.</p>
10339:
10340: <p>This means that if you only need a package present
10341: whilst you are building, it should be noted as a
1.14 xtraeme 10342: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 10343:
1.14 xtraeme 10344: <p>The format for a <code class=
10345: "varname">BUILD_DEPENDS</code> and a <code class=
10346: "varname">DEPENDS</code> definition is:</p>
1.1 grant 10347: <pre class="programlisting">
10348: <pre-req-package-name>:../../<category>/<pre-req-package>
10349: </pre>
10350:
10351: <p>Please note that the “<span class=
10352: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 10353: any of the wildcard version numbers recognized by
1.1 grant 10354: <a href=
10355: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10356: <span class="citerefentry"><span class=
10357: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
10358:
10359: <div class="orderedlist">
10360: <ol type="1">
10361: <li>
10362: <p>If your package needs another package's
10363: binaries or libraries to build or run, and if
1.14 xtraeme 10364: that package has a <code class=
10365: "filename">buildlink3.mk</code> file available,
10366: use it:</p>
1.1 grant 10367: <pre class="programlisting">
10368: .include "../../graphics/jpeg/buildlink3.mk"
10369:
10370: </pre>
10371: </li>
10372:
10373: <li>
10374: <p>If your package needs to use another package
1.14 xtraeme 10375: to build itself and there is no <code class=
10376: "filename">buildlink3.mk</code> file available,
10377: use the <code class=
10378: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 10379: <pre class="programlisting">
10380: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
10381: </pre>
10382: </li>
10383:
10384: <li>
10385: <p>If your package needs a library with which to
1.14 xtraeme 10386: link and again there is no <code class=
10387: "filename">buildlink3.mk</code> file available,
10388: this is specified using the <code class=
10389: "varname">DEPENDS</code> definition. An example
10390: of this is the <a xmlns=
1.1 grant 10391: "http://www.w3.org/TR/xhtml1/transitional" href=
10392: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10393: class="pkgname">print/lyx</a> package, which uses
10394: the xpm library, version 3.4j to build:</p>
1.1 grant 10395: <pre class="programlisting">
10396: DEPENDS+= xpm-3.4j:../../graphics/xpm
10397: </pre>
10398:
10399: <p>You can also use wildcards in package
10400: dependences:</p>
10401: <pre class="programlisting">
10402: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
10403: </pre>
10404:
10405: <p>Note that such wildcard dependencies are
10406: retained when creating binary packages. The
10407: dependency is checked when installing the binary
10408: package and any package which matches the pattern
10409: will be used. Wildcard dependencies should be
10410: used with care.</p>
10411:
10412: <p>The “<span class=
10413: "quote">-[0-9]*</span>” should be used
10414: instead of “<span class=
10415: "quote">-*</span>” to avoid potentially
10416: ambiguous matches such as “<span class=
10417: "quote">tk-postgresql</span>” matching a
10418: “<span class="quote">tk-*</span>”
1.14 xtraeme 10419: <code class="varname">DEPENDS</code>.</p>
1.1 grant 10420:
10421: <p>Wildcards can also be used to specify that a
10422: package will only build against a certain minimum
10423: version of a pre-requisite:</p>
10424: <pre class="programlisting">
10425: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
10426: </pre>
10427:
10428: <p>This means that the package will build against
10429: version 3.5.4 of the tiff library or newer. Such
10430: a dependency may be warranted if, for example,
10431: the API of the library has changed with version
10432: 3.5.4 and a package would not compile against an
10433: earlier version of tiff.</p>
10434:
10435: <p>Please note that such dependencies should only
10436: be updated if a package requires a newer
10437: pre-requisite, but not to denote recommendations
10438: such as security updates or ABI changes that do
10439: not prevent a package from building correctly.
10440: Such recommendations can be expressed using
1.14 xtraeme 10441: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 10442: <pre class="programlisting">
10443: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
10444: </pre>
10445:
1.14 xtraeme 10446: <p>In addition to the above <code class=
10447: "varname">DEPENDS</code> line, this denotes that
1.1 grant 10448: while a package will build against
10449: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 10450: recommended. <code class=
10451: "varname">RECOMMENDED</code> entries will be
10452: turned into dependencies unless explicitly
10453: ignored (in which case a warning will be
1.36 wiz 10454: printed).</p>
10455:
10456: <p>To ignore these dependency recommendations and
10457: just use the required <code class=
10458: "varname">DEPENDS</code>, set <code class=
10459: "varname">IGNORE_RECOMMENDED=YES</code>. This may
10460: make it easier and faster to update packages
10461: built using pkgsrc, since older compatible
10462: dependencies can continue to be used. This is
10463: useful for people who watch their rebuilds very
10464: carefully; it is not very good as a
10465: general-purpose hammer. If you use it, you need
10466: to be mindful of possible ABI changes, including
10467: those from the underlying OS.</p>
10468:
10469: <p>Packages that are built with recommendations
10470: ignored may not be uploaded to ftp.NetBSD.org by
10471: developers and should not be used across
10472: different systems that may have different
10473: versions of binary packages installed.</p>
1.1 grant 10474:
10475: <p>For security fixes, please update the package
10476: vulnerabilities file as well as setting
1.14 xtraeme 10477: <code class="varname">RECOMMENDED</code>, see
1.1 grant 10478: <a href="#security-handling" title=
1.38 dillo 10479: "15.1.8. Handling packages with security problems">
10480: Section 15.1.8, “Handling packages with
1.1 grant 10481: security problems”</a> for more
10482: information.</p>
10483: </li>
10484:
10485: <li>
10486: <p>If your package needs some executable to be
1.17 sketch 10487: able to run correctly and if there's no
1.14 xtraeme 10488: <code class="filename">buildlink3.mk</code> file,
10489: this is specified using the <code class=
10490: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 10491: "http://www.w3.org/TR/xhtml1/transitional" href=
10492: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10493: class="pkgname">print/lyx</a> package needs to be
10494: able to execute the latex binary from the teTeX
10495: package when it runs, and that is specified:</p>
1.1 grant 10496: <pre class="programlisting">
10497: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
10498: </pre>
10499:
10500: <p>The comment about wildcard dependencies from
10501: previous paragraph applies here, too.</p>
10502: </li>
10503: </ol>
10504: </div>
10505:
10506: <p>If your package needs files from another package to
10507: build, see the first part of the “<span class=
10508: "quote">do-configure</span>” target <a xmlns=
10509: "http://www.w3.org/TR/xhtml1/transitional" href=
10510: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 10511: class="pkgname">print/ghostscript5</a> package (it
10512: relies on the jpeg sources being present in source form
10513: during the build):</p>
1.1 grant 10514: <pre class="programlisting">
10515: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
10516: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
10517: fi
10518: </pre>
10519:
10520: <p>If you build any other packages that way, please
10521: make sure the working files are deleted too when this
10522: package's working files are cleaned up. The easiest way
10523: to do so is by adding a pre-clean target:</p>
10524: <pre class="programlisting">
10525: pre-clean:
10526: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
10527: </pre>
10528:
1.14 xtraeme 10529: <p>Please also note the <code class=
10530: "varname">BUILD_USES_MSGFMT</code> and <code class=
10531: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
10532: which are provided as convenience definitions. The
1.24 wiz 10533: former works out whether <a href=
10534: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
10535: <span class="citerefentry"><span class=
10536: "refentrytitle">msgfmt</span>(1)</span></a> is part of
10537: the base system, and, if it isn't, installs the
10538: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10539: href=
1.1 grant 10540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 10541: class="pkgname">devel/gettext</a> package. The latter
10542: adds a build dependency on either an installed version
10543: of an older gettext package, or if it isn't, installs
10544: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10545: href=
10546: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
10547: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 10548: </div>
10549:
10550: <div class="sect2" lang="en" xml:lang="en">
10551: <div class="titlepage">
10552: <div>
10553: <div>
1.30 wiz 10554: <h3 class="title"><a name="conflicts" id=
1.38 dillo 10555: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 10556: with other packages</h3>
10557: </div>
10558: </div>
10559: </div>
10560:
10561: <p>Your package may conflict with other packages a user
10562: might already have installed on his system, e.g. if
10563: your package installs the same set of files like
10564: another package in our pkgsrc tree.</p>
10565:
1.14 xtraeme 10566: <p>In this case you can set <code class=
10567: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 10568: packages (including version string) your package
10569: conflicts with.</p>
10570:
10571: <p>For example <a xmlns=
10572: "http://www.w3.org/TR/xhtml1/transitional" href=
10573: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 10574: class="pkgname">x11/Xaw3d</a> and <a xmlns=
10575: "http://www.w3.org/TR/xhtml1/transitional" href=
10576: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
10577: class="pkgname">x11/Xaw-Xpm</a> install provide the
10578: same shared library, thus you set in <code class=
10579: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 10580: <pre class="programlisting">
10581: CONFLICTS= Xaw-Xpm-[0-9]*
10582: </pre>
10583:
1.14 xtraeme 10584: <p>and in <code class=
10585: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 10586: <pre class="programlisting">
10587: CONFLICTS= Xaw3d-[0-9]*
10588: </pre>
10589:
10590: <p>Packages will automatically conflict with other
10591: packages with the name prefix and a different version
10592: string. “<span class=
10593: "quote">Xaw3d-1.5</span>” e.g. will automatically
10594: conflict with the older version “<span class=
10595: "quote">Xaw3d-1.3</span>”.</p>
10596: </div>
10597:
10598: <div class="sect2" lang="en" xml:lang="en">
10599: <div class="titlepage">
10600: <div>
10601: <div>
1.30 wiz 10602: <h3 class="title"><a name="not-building-packages"
10603: id=
1.38 dillo 10604: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 10605: that cannot or should not be built</h3>
1.1 grant 10606: </div>
10607: </div>
10608: </div>
10609:
10610: <p>There are several reasons why a package might be
10611: instructed to not build under certain circumstances. If
10612: the package builds and runs on most platforms, the
1.14 xtraeme 10613: exceptions should be noted with <code class=
10614: "varname">NOT_FOR_PLATFORM</code>. If the package
10615: builds and runs on a small handful of platforms, set
10616: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
10617: If the package should be skipped (for example, because
10618: it provides functionality already provided by the
10619: system), set <code class=
10620: "varname">PKG_SKIP_REASON</code> to a descriptive
10621: message. If the package should fail because some
10622: preconditions are not met, set <code class=
10623: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 10624: message.</p>
10625:
1.14 xtraeme 10626: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 10627: because it didn't provide enough information to
10628: determine whether the build should fail.</p>
10629: </div>
10630:
10631: <div class="sect2" lang="en" xml:lang="en">
10632: <div class="titlepage">
10633: <div>
10634: <div>
1.30 wiz 10635: <h3 class="title"><a name="undeletable-packages"
10636: id=
1.38 dillo 10637: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 10638: which should not be deleted, once installed</h3>
1.1 grant 10639: </div>
10640: </div>
10641: </div>
10642:
10643: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 10644: has been installed, the <code class=
10645: "varname">PKG_PRESERVE</code> definition should be set
10646: in the package Makefile. This will be carried into any
1.1 grant 10647: binary package that is made from this pkgsrc entry. A
10648: “<span class="quote">preserved</span>”
10649: package will not be deleted using <a href=
10650: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10651: <span class="citerefentry"><span class=
10652: "refentrytitle">pkg_delete</span>(1)</span></a> unless
10653: the “<span class="quote">-f</span>” option
10654: is used.</p>
10655: </div>
10656:
10657: <div class="sect2" lang="en" xml:lang="en">
10658: <div class="titlepage">
10659: <div>
10660: <div>
10661: <h3 class="title"><a name="security-handling" id=
1.38 dillo 10662: "security-handling"></a>15.1.8. Handling
1.1 grant 10663: packages with security problems</h3>
10664: </div>
10665: </div>
10666: </div>
10667:
10668: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 10669: in <code class=
10670: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 10671: and after the commit of that file, it should be copied
1.14 xtraeme 10672: to both <code class=
10673: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
10674: and <code class=
10675: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
10676: on ftp.NetBSD.org using <code class=
10677: "filename">localsrc/security/advisories/Makefile</code>.
10678: In addition, if a <code class=
10679: "filename">buildlink3.mk</code> file exists for an
10680: affected package, bumping <code class=
10681: "varname">PKGREVISION</code> and creating a
10682: corresponding <code class=
10683: "varname">BUILDLINK_RECOMMENDED.<em class=
10684: "replaceable"><code>pkg</code></em></code> entry should
10685: be considered. See <a href="#buildlink" title=
1.38 dillo 10686: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 10687: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 10688: about writing <code class=
10689: "filename">buildlink3.mk</code> files and <code class=
10690: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 10691:
10692: <p>Also, if the fix should be applied to the stable
10693: pkgsrc branch, be sure to submit a pullup request!</p>
10694: </div>
10695:
10696: <div class="sect2" lang="en" xml:lang="en">
10697: <div class="titlepage">
10698: <div>
10699: <div>
1.30 wiz 10700: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 10701: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 10702: compiler bugs</h3>
10703: </div>
10704: </div>
10705: </div>
10706:
10707: <p>Some source files trigger bugs in the compiler,
10708: based on combinations of compiler version and
10709: architecture and almost always relation to optimisation
10710: being enabled. Common symptoms are gcc internal errors
10711: or never finishing compiling a file.</p>
10712:
10713: <p>Typically a workaround involves testing the
1.14 xtraeme 10714: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 10715: version, disabling optimisation for that
1.14 xtraeme 10716: file/<code class="varname">MACHINE_ARCH</code>/compiler
10717: combination, and documenting it in <code class=
10718: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 10719: number of examples!</p>
10720: </div>
10721:
10722: <div class="sect2" lang="en" xml:lang="en">
10723: <div class="titlepage">
10724: <div>
10725: <div>
1.30 wiz 10726: <h3 class="title"><a name="bumping-pkgrevision"
1.38 dillo 10727: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 10728: handle incrementing versions when fixing an
10729: existing package</h3>
1.1 grant 10730: </div>
10731: </div>
10732: </div>
10733:
10734: <p>When making fixes to an existing package it can be
1.14 xtraeme 10735: useful to change the version number in <code class=
10736: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 10737: future versions by the original author, a
10738: “<span class="quote">nb1</span>”,
10739: “<span class="quote">nb2</span>”, ...
10740: suffix can be used on package versions by setting
1.14 xtraeme 10741: <code class="varname">PKGREVISION=1</code> (2, ...).
10742: The “<span class="quote">nb</span>” is
10743: treated like a “<span class=
10744: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 10745: <pre class="programlisting">
10746: DISTNAME= foo-17.42
10747: PKGREVISION= 9
10748: </pre>
10749:
1.14 xtraeme 10750: <p>will result in a <code class=
10751: "varname">PKGNAME</code> of “<span class=
1.1 grant 10752: "quote">foo-17.42nb9</span>”.</p>
10753:
10754: <p>When a new release of the package is released, the
1.14 xtraeme 10755: <code class="varname">PKGREVISION</code> should be
10756: removed. e.g. on a new minor release of the above
10757: package, things should be like:</p>
1.1 grant 10758: <pre class="programlisting">
10759: DISTNAME= foo-17.43
10760: </pre>
10761: </div>
10762:
10763: <div class="sect2" lang="en" xml:lang="en">
10764: <div class="titlepage">
10765: <div>
10766: <div>
1.30 wiz 10767: <h3 class="title"><a name=
10768: "portability-of-packages" id=
1.38 dillo 10769: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 10770: of packages</h3>
1.1 grant 10771: </div>
10772: </div>
10773: </div>
10774:
10775: <p>One appealing feature of pkgsrc is that it runs on
10776: many different platforms. As a result, it is important
10777: to ensure, where possible, that packages in pkgsrc are
10778: portable. There are some particular details you should
10779: pay attention to while working on pkgsrc.</p>
10780:
10781: <div class="sect3" lang="en" xml:lang="en">
10782: <div class="titlepage">
10783: <div>
10784: <div>
1.30 wiz 10785: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 10786: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 10787: ${INSTALL_DATA_DIR}, ...</h4>
10788: </div>
10789: </div>
10790: </div>
10791:
1.14 xtraeme 10792: <p>The BSD-compatible <span><strong class=
10793: "command">install</strong></span> supplied with some
1.1 grant 10794: operating systems will not perform more than one
10795: operation at a time. As such, you should call
10796: “<span class="quote">${INSTALL}</span>”,
10797: etc. like this:</p>
10798: <pre class="programlisting">
10799: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
10800: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
10801: </pre>
10802: </div>
10803: </div>
10804: </div>
10805:
10806: <div class="sect1" lang="en" xml:lang="en">
10807: <div class="titlepage">
10808: <div>
10809: <div>
10810: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10811: "downloading-issues" id=
1.38 dillo 10812: "downloading-issues"></a>15.2. Possible
1.1 grant 10813: downloading issues</h2>
10814: </div>
10815: </div>
10816: </div>
10817:
10818: <div class="sect2" lang="en" xml:lang="en">
10819: <div class="titlepage">
10820: <div>
10821: <div>
1.30 wiz 10822: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 10823: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 10824: whose distfiles aren't available for plain
1.1 grant 10825: downloading</h3>
10826: </div>
10827: </div>
10828: </div>
10829:
10830: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 10831: set <code class="varname">DYNAMIC_MASTER_SITES</code>
10832: and a <span><strong class="command">make
10833: fetch</strong></span> will call <code class=
10834: "filename">files/getsite.sh</code> with the name of
10835: each file to download as an argument, expecting it to
10836: output the URL of the directory from which to download
10837: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10838: href=
1.1 grant 10839: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 10840: class="pkgname">graphics/ns-cult3d</a> is an example of
10841: this usage.</p>
1.1 grant 10842:
10843: <p>If the download can't be automated, because the user
10844: must submit personal information to apply for a
10845: password, or must pay for the source, or whatever, you
1.14 xtraeme 10846: can set <code class="varname">_FETCH_MESSAGE</code> to
10847: a macro which displays a message explaining the
10848: situation. <code class="varname">_FETCH_MESSAGE</code>
10849: must be executable shell commands, not just a message.
10850: (Generally, it executes <code class=
10851: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 10852: following packages use this: <a xmlns=
10853: "http://www.w3.org/TR/xhtml1/transitional" href=
10854: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 10855: class="pkgname">audio/realplayer</a>, <a xmlns=
10856: "http://www.w3.org/TR/xhtml1/transitional" href=
10857: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
10858: class="pkgname">cad/simian</a>, <a xmlns=
10859: "http://www.w3.org/TR/xhtml1/transitional" href=
10860: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
10861: class="pkgname">devel/ipv6socket</a>, <a xmlns=
10862: "http://www.w3.org/TR/xhtml1/transitional" href=
10863: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
10864: class="pkgname">emulators/vmware-module</a>, <a xmlns=
10865: "http://www.w3.org/TR/xhtml1/transitional" href=
10866: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
10867: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
10868: "http://www.w3.org/TR/xhtml1/transitional" href=
10869: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
10870: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
10871: "http://www.w3.org/TR/xhtml1/transitional" href=
10872: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
10873: class="pkgname">www/ap-aolserver</a>, <a xmlns=
10874: "http://www.w3.org/TR/xhtml1/transitional" href=
10875: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
10876: class="pkgname">www/openacs</a>. Try to be consistent
10877: with them.</p>
1.1 grant 10878: </div>
10879:
10880: <div class="sect2" lang="en" xml:lang="en">
10881: <div class="titlepage">
10882: <div>
10883: <div>
1.30 wiz 10884: <h3 class="title"><a name=
10885: "modified-distfiles-same-name" id=
1.38 dillo 10886: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 10887: to handle modified distfiles with the 'old'
10888: name</h3>
1.1 grant 10889: </div>
10890: </div>
10891: </div>
10892:
10893: <p>Sometimes authors of a software package make some
10894: modifications after the software was released, and they
10895: put up a new distfile without changing the package's
10896: version number. If a package is already in pkgsrc at
1.32 wiz 10897: that time, the checksum will no longer match. The
10898: contents of the new distfile should be compared against
10899: the old one before changing anything, to make sure the
10900: distfile was really updated on purpose, and that no
10901: trojan horse or so crept in. Then, the correct way to
10902: work around this is to set <code class=
10903: "varname">DIST_SUBDIR</code> to a unique directory
10904: name, usually based on <code class=
10905: "varname">PKGNAME_NOREV</code>. In case this happens
10906: more often, <code class="varname">PKGNAME</code> can be
10907: used (thus including the <code class=
10908: "filename">nbX</code> suffix) or a date stamp can be
10909: appended, like <code class=
10910: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
10911: forget regenerating the <code class=
10912: "filename">distinfo</code> file after that, since it
10913: contains the <code class="varname">DIST_SUBDIR</code>
10914: path in the filenames. Furthermore, a mail to the
10915: package's authors seems appropriate telling them that
10916: changing distfiles after releases without changing the
10917: file names is not good practice.</p>
1.1 grant 10918: </div>
10919: </div>
10920:
10921: <div class="sect1" lang="en" xml:lang="en">
10922: <div class="titlepage">
10923: <div>
10924: <div>
10925: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10926: "configuration-gotchas" id=
1.38 dillo 10927: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 10928: gotchas</h2>
10929: </div>
10930: </div>
10931: </div>
10932:
10933: <div class="sect2" lang="en" xml:lang="en">
10934: <div class="titlepage">
10935: <div>
10936: <div>
10937: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 10938: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 10939: - libtool</h3>
10940: </div>
10941: </div>
10942: </div>
10943:
10944: <p>pkgsrc supports many different machines, with
10945: different object formats like a.out and ELF, and
10946: varying abilities to do shared library and dynamic
10947: loading at all. To accompany this, varying commands and
10948: options have to be passed to the compiler, linker, etc.
10949: to get the Right Thing, which can be pretty annoying
10950: especially if you don't have all the machines at your
10951: hand to test things. The <a xmlns=
10952: "http://www.w3.org/TR/xhtml1/transitional" href=
10953: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 10954: class="pkgname">devel/libtool</a> pkg can help here, as
10955: it just “<span class="quote">knows</span>”
10956: how to build both static and dynamic libraries from a
10957: set of source files, thus being platform
10958: independent.</p>
1.1 grant 10959:
10960: <p>Here's how to use libtool in a pkg in seven simple
10961: steps:</p>
10962:
10963: <div class="orderedlist">
10964: <ol type="1">
10965: <li>
1.14 xtraeme 10966: <p>Add <code class=
10967: "varname">USE_LIBTOOL=yes</code> to the package
10968: Makefile.</p>
1.1 grant 10969: </li>
10970:
10971: <li>
10972: <p>For library objects, use “<span class=
10973: "quote">${LIBTOOL} --mode=compile
10974: ${CC}</span>” in place of
10975: “<span class="quote">${CC}</span>”.
10976: You could even add it to the definition of
1.14 xtraeme 10977: <code class="varname">CC</code>, if only
10978: libraries are being built in a given Makefile.
10979: This one command will build both PIC and non-PIC
10980: library objects, so you need not have separate
10981: shared and non-shared library rules.</p>
1.1 grant 10982: </li>
10983:
10984: <li>
10985: <p>For the linking of the library, remove any
10986: “<span class="quote">ar</span>”,
10987: “<span class="quote">ranlib</span>”,
10988: and “<span class="quote">ld
10989: -Bshareable</span>” commands, and instead
10990: use:</p>
10991: <pre class="programlisting">
10992: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
10993: </pre>
10994:
10995: <p>Note that the library is changed to have a
1.14 xtraeme 10996: <code class="filename">.la</code> extension, and
10997: the objects are changed to have a <code class=
10998: "filename">.lo</code> extension. Change
10999: <code class="varname">OBJS</code> as necessary.
11000: This automatically creates all of the
11001: <code class="filename">.a</code>, <code class=
11002: "filename">.so.major.minor</code>, and ELF
11003: symlinks (if necessary) in the build directory.
11004: Be sure to include “<span class=
1.1 grant 11005: "quote">-version-info</span>”, especially
11006: when major and minor are zero, as libtool will
11007: otherwise strip off the shared library
11008: version.</p>
11009:
11010: <p>From the libtool manual:</p>
11011: <pre class="programlisting">
11012: So, libtool library versions are described by three integers:
11013:
11014: CURRENT
11015: The most recent interface number that this library implements.
11016:
11017: REVISION
11018: The implementation number of the CURRENT interface.
11019:
11020: AGE
11021: The difference between the newest and oldest interfaces that this
11022: library implements. In other words, the library implements all the
11023: interface numbers in the range from number `CURRENT - AGE' to
11024: `CURRENT'.
11025:
11026: If two libraries have identical CURRENT and AGE numbers, then the
11027: dynamic linker chooses the library with the greater REVISION number.
11028: </pre>
11029:
11030: <p>The “<span class=
11031: "quote">-release</span>” option will
11032: produce different results for a.out and ELF
11033: (excluding symlinks) in only one case. An ELF
11034: library of the form “<span class=
11035: "quote">libfoo-release.so.<span class=
11036: "emphasis"><em>x</em></span>.<span class=
11037: "emphasis"><em>y</em></span></span>” will
11038: have a symlink of “<span class=
11039: "quote">libfoo.so.<span class=
11040: "emphasis"><em>x</em></span>.<span class=
11041: "emphasis"><em>y</em></span></span>” on an
11042: a.out platform. This is handled
11043: automatically.</p>
11044:
11045: <p>The “<span class="quote">-rpath
11046: argument</span>” is the install directory
11047: of the library being built.</p>
11048:
1.14 xtraeme 11049: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 11050: include only the <code class=
11051: "filename">.la</code> file, the other files will
11052: be added automatically.</p>
1.1 grant 11053: </li>
11054:
11055: <li>
1.14 xtraeme 11056: <p>When linking shared object (<code class=
11057: "filename">.so</code>) files, i.e. files that are
1.24 wiz 11058: loaded via <a href=
11059: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
11060: <span class="citerefentry"><span class=
11061: "refentrytitle">dlopen</span>(3)</span></a>, NOT
11062: shared libraries, use “<span class=
11063: "quote">-module -avoid-version</span>” to
11064: prevent them getting version tacked on.</p>
1.1 grant 11065:
1.14 xtraeme 11066: <p>The <code class="filename">PLIST</code> file
11067: gets the <code class="filename">foo.so</code>
11068: entry.</p>
1.1 grant 11069: </li>
11070:
11071: <li>
11072: <p>When linking programs that depend on these
11073: libraries <span class=
11074: "emphasis"><em>before</em></span> they are
11075: installed, preface the <a href=
11076: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
11077: <span class="citerefentry"><span class=
11078: "refentrytitle">cc</span>(1)</span></a> or
11079: <a href=
11080: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
11081: <span class="citerefentry"><span class=
11082: "refentrytitle">ld</span>(1)</span></a> line with
11083: “<span class="quote">${LIBTOOL}
11084: --mode=link</span>”, and it will find the
11085: correct libraries (static or shared), but please
11086: be aware that libtool will not allow you to
11087: specify a relative path in -L (such as
11088: “<span class=
11089: "quote">-L../somelib</span>”), because it
11090: expects you to change that argument to be the
1.14 xtraeme 11091: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 11092: <pre class="programlisting">
11093: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
11094: </pre>
11095:
11096: <p>should be changed to:</p>
11097: <pre class="programlisting">
1.14 xtraeme 11098: ${LIBTOOL} --mode=link ${CC} -o <em class=
11099: "replaceable"><code>someprog</code></em> <em class=
11100: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 11101: </pre>
11102:
11103: <p>and it will do the right thing with the
11104: libraries.</p>
11105: </li>
11106:
11107: <li>
11108: <p>When installing libraries, preface the
11109: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11110: <span class="citerefentry"><span class=
11111: "refentrytitle">install</span>(1)</span></a> or
11112: <a href=
11113: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
11114: <span class="citerefentry"><span class=
11115: "refentrytitle">cp</span>(1)</span></a> command
11116: with “<span class="quote">${LIBTOOL}
11117: --mode=install</span>”, and change the
1.14 xtraeme 11118: library name to <code class=
11119: "filename">.la</code>. e.g.</p>
1.1 grant 11120: <pre class="programlisting">
11121: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
11122: </pre>
11123:
1.14 xtraeme 11124: <p>This will install the static <code class=
11125: "filename">.a</code>, shared library, any needed
1.1 grant 11126: symlinks, and run <a href=
11127: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
11128: <span class="citerefentry"><span class=
11129: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
11130: </li>
11131:
11132: <li>
1.14 xtraeme 11133: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 11134: include only the <code class=
11135: "filename">.la</code> file (this is a change from
11136: previous behaviour).</p>
1.1 grant 11137: </li>
11138: </ol>
11139: </div>
11140: </div>
11141:
11142: <div class="sect2" lang="en" xml:lang="en">
11143: <div class="titlepage">
11144: <div>
11145: <div>
1.30 wiz 11146: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 11147: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 11148: GNU packages that already support libtool</h3>
1.1 grant 11149: </div>
11150: </div>
11151: </div>
11152:
1.14 xtraeme 11153: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
11154: the package Makefile. This will override the package's
11155: own libtool in most cases. For older libtool using
1.1 grant 11156: packages, libtool is made by ltconfig script during the
11157: do-configure step; you can check the libtool script
1.14 xtraeme 11158: location by doing <span><strong class="command">make
11159: configure; find work*/ -name
11160: libtool</strong></span>.</p>
11161:
11162: <p><code class="varname">LIBTOOL_OVERRIDE</code>
11163: specifies which libtool scripts, relative to
11164: <code class="varname">WRKSRC</code>, to override. By
11165: default, it is set to “<span class=
11166: "quote">libtool */libtool */*/libtool</span>”. If
11167: this does not match the location of the package's
11168: libtool script(s), set it as appropriate.</p>
1.13 hubertf 11169:
1.14 xtraeme 11170: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 11171: static libraries built and installed, then use
1.14 xtraeme 11172: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 11173: instead.</p>
11174:
11175: <p>If your package makes use of the platform
11176: independent library for loading dynamic shared objects,
11177: that comes with libtool (libltdl), you should include
1.22 tv 11178: devel/libltdl/buildlink3.mk.</p>
1.1 grant 11179:
11180: <p>Some packages use libtool incorrectly so that the
11181: package may not work or build in some circumstances.
11182: Some of the more common errors are:</p>
11183:
11184: <div class="itemizedlist">
11185: <ul type="disc">
11186: <li>
11187: <p>The inclusion of a shared object (-module) as
11188: a dependent library in an executable or library.
11189: This in itself isn't a problem if one of two
11190: things has been done:</p>
11191:
11192: <div class="orderedlist">
11193: <ol type="1">
11194: <li>
11195: <p>The shared object is named correctly,
1.14 xtraeme 11196: i.e. <code class=
11197: "filename">libfoo.la</code>, not
11198: <code class="filename">foo.la</code></p>
1.1 grant 11199: </li>
11200:
11201: <li>
11202: <p>The -dlopen option is used when linking
11203: an executable.</p>
11204: </li>
11205: </ol>
11206: </div>
11207: </li>
11208:
11209: <li>
11210: <p>The use of libltdl without the correct calls
11211: to initialisation routines. The function
11212: lt_dlinit() should be called and the macro
1.14 xtraeme 11213: <code class=
11214: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 11215: included in executables.</p>
11216: </li>
11217: </ul>
11218: </div>
11219: </div>
11220:
11221: <div class="sect2" lang="en" xml:lang="en">
11222: <div class="titlepage">
11223: <div>
11224: <div>
1.30 wiz 11225: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 11226: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 11227: Autoconf/Automake</h3>
11228: </div>
11229: </div>
11230: </div>
11231:
11232: <p>If a package needs GNU autoconf or automake to be
11233: executed to regenerate the configure script and
11234: Makefile.in makefile templates, then they should be
1.35 jmmv 11235: executed in a pre-configure target.</p>
1.1 grant 11236:
11237: <p>For packages that need only autoconf:</p>
11238: <pre class="programlisting">
1.35 jmmv 11239: AUTOCONF_REQD= 2.50 # if default version is not good enough
11240: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 11241: ...
11242:
11243: pre-configure:
1.35 jmmv 11244: cd ${WRKSRC}; autoconf
1.1 grant 11245:
11246: ...
11247: </pre>
11248:
11249: <p>and for packages that need automake and
11250: autoconf:</p>
11251: <pre class="programlisting">
1.35 jmmv 11252: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 wiz 11253: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 11254: ...
11255:
11256: pre-configure:
11257: cd ${WRKSRC}; \
1.35 jmmv 11258: aclocal; autoheader; \
11259: automake -a --foreign -i; autoconf
1.1 grant 11260:
11261: ...
11262: </pre>
11263:
11264: <p>Packages which use GNU Automake will almost
1.35 jmmv 11265: certainly require GNU Make.</p>
1.1 grant 11266:
11267: <p>There are times when the configure process makes
11268: additional changes to the generated files, which then
11269: causes the build process to try to re-execute the
11270: automake sequence. This is prevented by touching
11271: various files in the configure stage. If this causes
1.14 xtraeme 11272: problems with your package you can set <code class=
11273: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 11274: Makefile.</p>
11275: </div>
11276: </div>
11277:
11278: <div class="sect1" lang="en" xml:lang="en">
11279: <div class="titlepage">
11280: <div>
11281: <div>
11282: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11283: "building-considerations" id=
1.38 dillo 11284: "building-considerations"></a>15.4. Building
1.1 grant 11285: considerations</h2>
11286: </div>
11287: </div>
11288: </div>
11289:
11290: <div class="sect2" lang="en" xml:lang="en">
11291: <div class="titlepage">
11292: <div>
11293: <div>
1.30 wiz 11294: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 11295: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 11296: </div>
11297: </div>
11298: </div>
11299:
11300: <p>To port an application to NetBSD, it's usually
11301: necessary for the compiler to be able to judge the
11302: system on which it's compiling, and we use definitions
11303: so that the C pre-processor can do this.</p>
11304:
11305: <p>To test whether you are working on a 4.4 BSD-derived
11306: system, you should use the BSD definition, which is
1.14 xtraeme 11307: defined in <code class=
11308: "filename"><sys/param.h></code> on said
1.1 grant 11309: systems.</p>
11310: <pre class="programlisting">
11311: #include <sys/param.h>
11312: </pre>
11313:
11314: <p>and then you can surround the BSD-specific parts of
11315: your package's C/C++ code using this conditional:</p>
11316: <pre class="programlisting">
11317: #if (defined(BSD) && BSD >= 199306)
11318: ...
11319: #endif
11320: </pre>
11321:
11322: <p>Please use the “<span class=
11323: "quote">__NetBSD__</span>” definition sparingly -
11324: it should only apply to features of NetBSD that are not
11325: present in other 4.4-lite derived BSDs.</p>
11326: </div>
11327: </div>
11328:
11329: <div class="sect1" lang="en" xml:lang="en">
11330: <div class="titlepage">
11331: <div>
11332: <div>
11333: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11334: "package-specific-actions" id=
1.38 dillo 11335: "package-specific-actions"></a>15.5. Package
1.1 grant 11336: specific actions</h2>
11337: </div>
11338: </div>
11339: </div>
11340:
11341: <div class="sect2" lang="en" xml:lang="en">
11342: <div class="titlepage">
11343: <div>
11344: <div>
1.30 wiz 11345: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 11346: "user-interaction"></a>15.5.1. User
1.2 hubertf 11347: interaction</h3>
1.1 grant 11348: </div>
11349: </div>
11350: </div>
11351:
11352: <p>Occasionally, packages require interaction from the
11353: user, and this can be in a number of ways:</p>
11354:
11355: <div class="itemizedlist">
11356: <ul type="disc">
11357: <li>
11358: <p>help in fetching the distfiles</p>
11359: </li>
11360:
11361: <li>
11362: <p>help to configure the package before it is
11363: built</p>
11364: </li>
11365:
11366: <li>
11367: <p>help during the build process</p>
11368: </li>
11369:
11370: <li>
11371: <p>help during the installation of a package</p>
11372: </li>
11373: </ul>
11374: </div>
11375:
1.14 xtraeme 11376: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 11377: definition is provided to notify the pkgsrc mechanism
11378: of an interactive stage which will be needed, and this
1.14 xtraeme 11379: should be set in the package's <code class=
11380: "filename">Makefile</code>. e.g.</p>
1.1 grant 11381: <pre class="programlisting">
11382: INTERACTIVE_STAGE= build
11383: </pre>
11384:
11385: <p>Multiple interactive stages can be specified:</p>
11386: <pre class="programlisting">
11387: INTERACTIVE_STAGE= configure install
11388: </pre>
11389: </div>
11390:
11391: <div class="sect2" lang="en" xml:lang="en">
11392: <div class="titlepage">
11393: <div>
11394: <div>
1.30 wiz 11395: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 11396: "handling-licenses"></a>15.5.2. Handling
1.1 grant 11397: licenses</h3>
11398: </div>
11399: </div>
11400: </div>
11401:
11402: <p>A package may underly a license which the user has
11403: or has not agreed to accept. Usually, packages that
11404: underly well-known Open Source licenses (e.g. the GNU
11405: Public License, GPL) won't have any special license
11406: tags added in pkgsrc which require special action by
11407: the user of such packages, but there are quite a number
11408: of other licenses out there that pkgsrc users may not
11409: be able to follow, for whatever reasons. For these
11410: cases, pkgsrc contains a mechanism to note that a
11411: package underlies a certain license, and the user has
11412: to accept the license before the package can be
11413: installed.</p>
11414:
11415: <p>Placing a certain package under a certain license
1.14 xtraeme 11416: works by setting the <code class=
11417: "varname">LICENSE</code> variable to a string
11418: identifying the license, e.g. in <a xmlns=
11419: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 11421: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 11422: <pre class="programlisting">
11423: LICENSE= graphviz-license
11424: </pre>
11425:
11426: <p>When trying to build, the user will get a notice
11427: that the package underlies a license which he hasn't
11428: accepted (yet):</p>
11429: <pre class="programlisting">
1.14 xtraeme 11430: <code class="prompt">%</code> <strong class=
11431: "userinput"><code>make</code></strong>
1.1 grant 11432: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
11433: ===> To build this package, add this line to your /etc/mk.conf:
11434: ===> ACCEPTABLE_LICENSES+=graphviz-license
11435: ===> To view the license, enter "/usr/bin/make show-license".
11436: *** Error code 1
11437: </pre>
11438:
1.14 xtraeme 11439: <p>The license can be viewed with <span><strong class=
11440: "command">make show-license</strong></span>, and if it
11441: is considered appropriate, the line printed above can
11442: be added to <code class="filename">/etc/mk.conf</code>
11443: to indicate acceptance of the particular license:</p>
1.1 grant 11444: <pre class="programlisting">
11445: ACCEPTABLE_LICENSES+=graphviz-license
11446: </pre>
11447:
11448: <p>When adding a package with a new license, the
1.14 xtraeme 11449: license text should be added to <code class=
11450: "filename">pkgsrc/licenses</code> for displaying. A
11451: list of known licenses can be seen in this directory as
11452: well as by looking at the list of (commented out)
11453: <code class="varname">ACCEPTABLE_LICENSES</code>
11454: variable settings in <code class=
11455: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 11456:
1.17 sketch 11457: <p>If there is a <span class=
1.1 grant 11458: "emphasis"><em>really</em></span> pressing need to
11459: accept all licenses at once, like when trying to
11460: download or mirror all distfiles or doing a bulk build
11461: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 11462: done by setting <code class=
11463: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 11464: </div>
11465:
11466: <div class="sect2" lang="en" xml:lang="en">
11467: <div class="titlepage">
11468: <div>
11469: <div>
1.30 wiz 11470: <h3 class="title"><a name=
11471: "installing-score-files" id=
1.38 dillo 11472: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 11473: score files</h3>
1.1 grant 11474: </div>
11475: </div>
11476: </div>
11477:
11478: <p>Certain packages, most of them in the games
11479: category, install a score file that allows all users on
11480: the system to record their highscores. In order for
11481: this to work, the binaries need to be installed setgid
11482: and the score files owned by the appropriate group
11483: and/or owner (traditionally the "games" user/group).
11484: The following variables, documented in more detail in
1.14 xtraeme 11485: <code class="filename">mk/defaults/mk.conf</code>,
11486: control this behaviour: <code class=
11487: "varname">SETGIDGAME</code>, <code class=
11488: "varname">GAMEDATAMODE</code>, <code class=
11489: "varname">GAMEGRP</code>, <code class=
11490: "varname">GAMEMODE</code>, <code class=
11491: "varname">GAMEOWN</code>.</p>
1.1 grant 11492:
11493: <p>Note that per default, setgid installation of games
1.14 xtraeme 11494: is disabled; setting <code class=
11495: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 11496: variables accordingly.</p>
11497:
11498: <p>A package should therefor never hard code file
1.14 xtraeme 11499: ownership or access permissions but rely on
11500: <code class="varname">INSTALL_GAME</code> and
11501: <code class="varname">INSTALL_GAME_DATA</code> to set
11502: these correctly.</p>
1.1 grant 11503: </div>
11504:
11505: <div class="sect2" lang="en" xml:lang="en">
11506: <div class="titlepage">
11507: <div>
11508: <div>
1.30 wiz 11509: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 11510: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 11511: containing perl scripts</h3>
1.1 grant 11512: </div>
11513: </div>
11514: </div>
11515:
11516: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 11517: set <code class="varname">REPLACE_PERL</code> to ensure
11518: that the proper interpreter path is set. <code class=
11519: "varname">REPLACE_PERL</code> should contain a list of
11520: scripts, relative to <code class=
11521: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 11522: </div>
11523:
11524: <div class="sect2" lang="en" xml:lang="en">
11525: <div class="titlepage">
11526: <div>
11527: <div>
1.30 wiz 11528: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 11529: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 11530: hardcoded paths to other interpreters</h3>
11531: </div>
11532: </div>
11533: </div>
11534:
11535: <p>Your package may also contain scripts with hardcoded
11536: paths to other interpreters besides (or as well as)
11537: perl. To correct the full pathname to the script
11538: interpreter, you need to set the following definitions
1.14 xtraeme 11539: in your <code class="filename">Makefile</code> (we
11540: shall use <span><strong class=
11541: "command">tclsh</strong></span> in this example):</p>
1.1 grant 11542: <pre class="programlisting">
11543: REPLACE_INTERPRETER+= tcl
11544: _REPLACE.tcl.old= .*/bin/tclsh
11545: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
11546: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
11547: relative to ${WRKSRC}, just as in REPLACE_PERL
11548: </pre>
11549: </div>
11550:
11551: <div class="sect2" lang="en" xml:lang="en">
11552: <div class="titlepage">
11553: <div>
11554: <div>
1.30 wiz 11555: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 11556: "perl-modules"></a>15.5.6. Packages
1.30 wiz 11557: installing perl modules</h3>
1.1 grant 11558: </div>
11559: </div>
11560: </div>
11561:
11562: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 11563: include the Makefile fragment <code class=
11564: "filename">../../lang/perl5/module.mk</code>. It
11565: provides a <span><strong class=
11566: "command">do-configure</strong></span> target for the
11567: standard perl configuration for such modules as well as
11568: various hooks to tune this configuration. See comments
11569: in this file for details.</p>
1.1 grant 11570:
11571: <p>Perl5 modules will install into different places
11572: depending on the version of perl used during the build
11573: process. To address this, pkgsrc will append lines to
1.14 xtraeme 11574: the <code class="filename">PLIST</code> corresponding
11575: to the files listed in the installed <code class=
11576: "filename">.packlist</code> file generated by most
11577: perl5 modules. This is invoked by defining <code class=
11578: "varname">PERL5_PACKLIST</code> to a space-separated
11579: list of paths to packlist files, e.g.:</p>
1.1 grant 11580: <pre class="programlisting">
11581: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
11582: </pre>
11583:
1.14 xtraeme 11584: <p>The variables <code class=
11585: "varname">PERL5_SITELIB</code>, <code class=
11586: "varname">PERL5_SITEARCH</code>, and <code class=
11587: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 11588: locations in which perl5 modules may be installed, and
11589: may be used by perl5 packages that don't have a
11590: packlist. These three variables are also substituted
1.14 xtraeme 11591: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 11592: </div>
11593:
11594: <div class="sect2" lang="en" xml:lang="en">
11595: <div class="titlepage">
11596: <div>
11597: <div>
11598: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 11599: "faq.info-files"></a>15.5.7. Packages
1.1 grant 11600: installing info files</h3>
11601: </div>
11602: </div>
11603: </div>
11604:
11605: <p>Some packages install info files or use the
11606: “<span class="quote">makeinfo</span>” or
11607: “<span class="quote">install-info</span>”
11608: commands. Each of the info files:</p>
11609:
11610: <div class="itemizedlist">
11611: <ul type="disc">
11612: <li>
11613: <p>is considered to be installed in the directory
1.14 xtraeme 11614: <code class=
11615: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 11616: </li>
11617:
11618: <li>
11619: <p>is registered in the Info directory file
1.14 xtraeme 11620: <code class=
11621: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 11622: </li>
11623:
11624: <li>
11625: <p>and must be listed as a filename in the
1.14 xtraeme 11626: <code class="varname">INFO_FILES</code> variable
11627: in the package Makefile.</p>
1.1 grant 11628: </li>
11629: </ul>
11630: </div>
11631:
1.14 xtraeme 11632: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 11633: “<span class="quote">info</span>” and can
1.14 xtraeme 11634: be overridden in the package Makefile. <code class=
11635: "filename">INSTALL</code> and <code class=
11636: "filename">DEINSTALL</code> scripts will be generated
11637: to handle registration of the info files in the Info
1.1 grant 11638: directory file. The “<span class=
11639: "quote">install-info</span>” command used for the
11640: info files registration is either provided by the
11641: system, or by a special purpose package automatically
11642: added as dependency if needed.</p>
11643:
11644: <p>A package which needs the “<span class=
11645: "quote">makeinfo</span>” command at build time
1.14 xtraeme 11646: must define the variable <code class=
11647: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 11648: minimum version of the “<span class=
11649: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 11650: should be noted with the <code class=
11651: "varname">TEXINFO_REQD</code> variable in the package
11652: <code class="filename">Makefile</code>. By default, a
1.1 grant 11653: minimum version of 3.12 is required. If the system does
1.14 xtraeme 11654: not provide a <span><strong class=
11655: "command">makeinfo</strong></span> command or if it
11656: does not match the required minimum, a build dependency
11657: on the <a xmlns=
11658: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11659: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 11660: class="pkgname">devel/gtexinfo</a> package will be
11661: added automatically.</p>
1.1 grant 11662:
11663: <p>The build and installation process of the software
11664: provided by the package should not use the
1.14 xtraeme 11665: <span><strong class=
11666: "command">install-info</strong></span> command as the
11667: registration of info files is the task of the package
11668: <code class="filename">INSTALL</code> script, and it
11669: must use the appropriate <span><strong class=
11670: "command">makeinfo</strong></span> command.</p>
1.1 grant 11671:
11672: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 11673: creates overriding scripts for the <span><strong class=
11674: "command">install-info</strong></span> and
11675: <span><strong class="command">makeinfo</strong></span>
11676: commands in a directory listed early in <code class=
11677: "varname">PATH</code>.</p>
1.1 grant 11678:
1.14 xtraeme 11679: <p>The script overriding <span><strong class=
11680: "command">install-info</strong></span> has no effect
11681: except the logging of a message. The script overriding
11682: <span><strong class="command">makeinfo</strong></span>
11683: logs a message and according to the value of
11684: <code class="varname">USE_MAKEINFO</code> and
11685: <code class="varname">TEXINFO_REQD</code> either run
11686: the appropriate <span><strong class=
11687: "command">makeinfo</strong></span> command or exit on
11688: error.</p>
1.1 grant 11689: </div>
11690:
11691: <div class="sect2" lang="en" xml:lang="en">
11692: <div class="titlepage">
11693: <div>
11694: <div>
1.30 wiz 11695: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 11696: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 11697: installing GConf2 data files</h3>
1.1 grant 11698: </div>
11699: </div>
11700: </div>
11701:
1.14 xtraeme 11702: <p>If a package installs <code class=
11703: "filename">.schemas</code> or <code class=
11704: "filename">.entries</code> files, used by GConf2, you
1.1 grant 11705: need to take some extra steps to make sure they get
11706: registered in the database:</p>
11707:
11708: <div class="orderedlist">
11709: <ol type="1">
11710: <li>
1.14 xtraeme 11711: <p>Include <code class=
11712: "filename">../../devel/GConf2/schemas.mk</code>
11713: instead of its <code class=
11714: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11715: care of rebuilding the GConf2 database at
11716: installation and deinstallation time, and tells
11717: the package where to install GConf2 data files
11718: using some standard configure arguments. It also
11719: disallows any access to the database directly
11720: from the package.</p>
11721: </li>
11722:
11723: <li>
11724: <p>Ensure that the package installs its
1.14 xtraeme 11725: <code class="filename">.schemas</code> files
11726: under <code class=
11727: "filename">${PREFIX}/share/gconf/schemas</code>.
11728: If they get installed under <code class=
11729: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 11730: manually patch the package.</p>
11731: </li>
11732:
11733: <li>
11734: <p>Check the PLIST and remove any entries under
11735: the etc/gconf directory, as they will be handled
11736: automatically. See <a href="#faq.conf" title=
1.38 dillo 11737: "7.14. How do I change the location of configuration files?">
11738: Section 7.14, “How do I change the
1.35 jmmv 11739: location of configuration files?”</a> for
11740: more information.</p>
1.1 grant 11741: </li>
11742:
11743: <li>
1.14 xtraeme 11744: <p>Define the <code class=
11745: "varname">GCONF2_SCHEMAS</code> variable in your
11746: <code class="filename">Makefile</code> with a
11747: list of all <code class=
11748: "filename">.schemas</code> files installed by the
11749: package, if any. Names must not contain any
11750: directories in them.</p>
1.1 grant 11751: </li>
11752:
11753: <li>
1.14 xtraeme 11754: <p>Define the <code class=
11755: "varname">GCONF2_ENTRIES</code> variable in your
11756: <code class="filename">Makefile</code> with a
11757: list of all <code class=
11758: "filename">.entries</code> files installed by the
11759: package, if any. Names must not contain any
11760: directories in them.</p>
1.1 grant 11761: </li>
11762: </ol>
11763: </div>
11764: </div>
11765:
11766: <div class="sect2" lang="en" xml:lang="en">
11767: <div class="titlepage">
11768: <div>
11769: <div>
1.30 wiz 11770: <h3 class="title"><a name=
11771: "scrollkeeper-data-files" id=
1.38 dillo 11772: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 11773: installing scrollkeeper data files</h3>
1.1 grant 11774: </div>
11775: </div>
11776: </div>
11777:
1.14 xtraeme 11778: <p>If a package installs <code class=
11779: "filename">.omf</code> files, used by scrollkeeper, you
11780: need to take some extra steps to make sure they get
11781: registered in the database:</p>
1.1 grant 11782:
11783: <div class="orderedlist">
11784: <ol type="1">
11785: <li>
1.14 xtraeme 11786: <p>Include <code class=
11787: "filename">../../textproc/scrollkeeper/omf.mk</code>
11788: instead of its <code class=
11789: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11790: care of rebuilding the scrollkeeper database at
11791: installation and deinstallation time, and
11792: disallows any access to it directly from the
11793: package.</p>
11794: </li>
11795:
11796: <li>
11797: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11798: the <code class=
11799: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 11800: as they will be handled automatically.</p>
11801: </li>
11802:
11803: <li>
1.14 xtraeme 11804: <p>Remove the <code class=
11805: "filename">share/omf</code> directory from the
11806: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 11807: </li>
11808: </ol>
11809: </div>
11810: </div>
11811:
11812: <div class="sect2" lang="en" xml:lang="en">
11813: <div class="titlepage">
11814: <div>
11815: <div>
1.30 wiz 11816: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 11817: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 11818: X11 fonts</h3>
11819: </div>
11820: </div>
11821: </div>
11822:
11823: <p>If a package installs font files, you will need to
11824: rebuild the fonts database in the directory where they
11825: get installed at installation and deinstallation time.
1.14 xtraeme 11826: This can be automatically done by using <code class=
11827: "filename">mk/fonts.mk</code>, which you need to
11828: include in your <code class=
11829: "filename">Makefile</code>.</p>
1.1 grant 11830:
11831: <p>When the file is included, you can list the
1.14 xtraeme 11832: directories where fonts are installed in the
11833: <code class="varname">FONTS_<em class=
11834: "replaceable"><code>type</code></em>_DIRS</code>
11835: variables, where <em class=
11836: "replaceable"><code>type</code></em> can be one of
11837: “<span class="quote">TTF</span>”,
1.1 grant 11838: “<span class="quote">TYPE1</span>” or
11839: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11840: sure that the database file <code class=
11841: "filename">fonts.dir</code> is not listed in the
1.1 grant 11842: PLIST.</p>
11843:
11844: <p>Note that you should not create new directories for
11845: fonts; instead use the standard ones to avoid that the
11846: user needs to manually configure his X server to find
11847: them.</p>
11848: </div>
11849:
11850: <div class="sect2" lang="en" xml:lang="en">
11851: <div class="titlepage">
11852: <div>
11853: <div>
1.30 wiz 11854: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 11855: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 11856: installing GTK2 modules</h3>
1.1 grant 11857: </div>
11858: </div>
11859: </div>
11860:
11861: <p>If a package installs gtk2 immodules or loaders, you
11862: need to take some extra steps to get them registered in
11863: the GTK2 database properly:</p>
11864:
11865: <div class="orderedlist">
11866: <ol type="1">
11867: <li>
1.14 xtraeme 11868: <p>Include <code class=
11869: "filename">../../x11/gtk2/modules.mk</code>
11870: instead of its <code class=
11871: "filename">buildlink3.mk</code> file. This takes
11872: care of rebuilding the database at installation
11873: and deinstallation time.</p>
1.1 grant 11874: </li>
11875:
11876: <li>
1.14 xtraeme 11877: <p>Set <code class=
11878: "varname">GTK2_IMMODULES=YES</code> if your
11879: package installs GTK2 immodules.</p>
1.1 grant 11880: </li>
11881:
11882: <li>
1.14 xtraeme 11883: <p>Set <code class=
11884: "varname">GTK2_LOADERS=YES</code> if your package
11885: installs GTK2 loaders.</p>
1.1 grant 11886: </li>
11887:
11888: <li>
11889: <p>Patch the package to not touch any of the gtk2
11890: databases directly. These are:</p>
11891:
11892: <div class="itemizedlist">
11893: <ul type="disc">
11894: <li>
1.14 xtraeme 11895: <p><code class=
11896: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11897: </li>
11898:
11899: <li>
1.14 xtraeme 11900: <p><code class=
11901: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11902: </li>
11903: </ul>
11904: </div>
11905: </li>
11906:
11907: <li>
11908: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11909: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11910: directory, as they will be handled
11911: automatically.</p>
11912: </li>
11913: </ol>
11914: </div>
11915: </div>
11916:
11917: <div class="sect2" lang="en" xml:lang="en">
11918: <div class="titlepage">
11919: <div>
11920: <div>
1.30 wiz 11921: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 11922: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 11923: installing SGML or XML data</h3>
1.1 grant 11924: </div>
11925: </div>
11926: </div>
11927:
11928: <p>If a package installs SGML or XML data files that
11929: need to be registered in system-wide catalogs (like
11930: DTDs, sub-catalogs, etc.), you need to take some extra
11931: steps:</p>
11932:
11933: <div class="orderedlist">
11934: <ol type="1">
11935: <li>
1.14 xtraeme 11936: <p>Include <code class=
11937: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11938: in your <code class="filename">Makefile</code>,
11939: which takes care of registering those files in
1.1 grant 11940: system-wide catalogs at installation and
11941: deinstallation time.</p>
11942: </li>
11943:
11944: <li>
1.14 xtraeme 11945: <p>Set <code class="varname">SGML_CATALOGS</code>
11946: to the full path of any SGML catalogs installed
11947: by the package.</p>
1.1 grant 11948: </li>
11949:
11950: <li>
1.14 xtraeme 11951: <p>Set <code class="varname">XML_CATALOGS</code>
11952: to the full path of any XML catalogs installed by
1.1 grant 11953: the package.</p>
11954: </li>
11955:
11956: <li>
1.14 xtraeme 11957: <p>Set <code class="varname">SGML_ENTRIES</code>
11958: to individual entries to be added to the SGML
1.1 grant 11959: catalog. These come in groups of three strings;
11960: see xmlcatmgr(1) for more information
11961: (specifically, arguments recognized by the 'add'
11962: action). Note that you will normally not use this
11963: variable.</p>
11964: </li>
11965:
11966: <li>
1.14 xtraeme 11967: <p>Set <code class="varname">XML_ENTRIES</code>
11968: to individual entries to be added to the XML
1.1 grant 11969: catalog. These come in groups of three strings;
11970: see xmlcatmgr(1) for more information
11971: (specifically, arguments recognized by the 'add'
11972: action). Note that you will normally not use this
11973: variable.</p>
11974: </li>
11975: </ol>
11976: </div>
11977: </div>
11978:
11979: <div class="sect2" lang="en" xml:lang="en">
11980: <div class="titlepage">
11981: <div>
11982: <div>
1.30 wiz 11983: <h3 class="title"><a name="mime-database" id=
1.38 dillo 11984: "mime-database"></a>15.5.13. Packages
1.30 wiz 11985: installing extensions to the MIME database</h3>
1.1 grant 11986: </div>
11987: </div>
11988: </div>
11989:
11990: <p>If a package provides extensions to the MIME
1.14 xtraeme 11991: database by installing <code class=
11992: "filename">.xml</code> files inside <code class=
11993: "filename">${PREFIX}/share/mime/packages</code>, you
11994: need to take some extra steps to ensure that the
11995: database is kept consistent with respect to these new
11996: files:</p>
1.1 grant 11997:
11998: <div class="orderedlist">
11999: <ol type="1">
12000: <li>
1.14 xtraeme 12001: <p>Include <code class=
12002: "filename">../../databases/shared-mime-info/mimedb.mk</code>
12003: (avoid using the <code class=
12004: "filename">buildlink3.mk</code> file from this
12005: same directory, which is reserved for inclusion
12006: from other <code class=
12007: "filename">buildlink3.mk</code> files). It takes
12008: care of rebuilding the MIME database at
12009: installation and deinstallation time, and
12010: disallows any access to it directly from the
1.1 grant 12011: package.</p>
12012: </li>
12013:
12014: <li>
12015: <p>Check the PLIST and remove any entries under
1.14 xtraeme 12016: the <code class="filename">share/mime</code>
1.1 grant 12017: directory, <span class=
12018: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 12019: under <code class=
12020: "filename">share/mime/packages</code>. The former
1.1 grant 12021: are handled automatically by the
12022: update-mime-database program, but the later are
12023: package-dependent and must be removed by the
12024: package that installed them in the first
12025: place.</p>
12026: </li>
12027:
12028: <li>
1.14 xtraeme 12029: <p>Remove any <code class=
12030: "filename">share/mime/*</code> directories from
12031: the PLIST. They will be handled by the
1.1 grant 12032: shared-mime-info package.</p>
12033: </li>
12034: </ol>
12035: </div>
12036: </div>
12037:
12038: <div class="sect2" lang="en" xml:lang="en">
12039: <div class="titlepage">
12040: <div>
12041: <div>
1.30 wiz 12042: <h3 class="title"><a name="intltool" id=
1.38 dillo 12043: "intltool"></a>15.5.14. Packages using
1.1 grant 12044: intltool</h3>
12045: </div>
12046: </div>
12047: </div>
12048:
12049: <p>If a package uses intltool during its build, include
1.14 xtraeme 12050: the <code class=
12051: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 12052: file, which forces it to use the intltool package
12053: provided by pkgsrc, instead of the one bundled with the
12054: distribution file.</p>
12055:
12056: <p>This tracks intltool's build-time dependencies and
12057: uses the latest available version; this way, the
12058: package benefits of any bug fixes that may have
12059: appeared since it was released.</p>
12060: </div>
1.18 xtraeme 12061:
12062: <div class="sect2" lang="en" xml:lang="en">
12063: <div class="titlepage">
12064: <div>
12065: <div>
1.30 wiz 12066: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 12067: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 12068: installing startup scripts</h3>
1.18 xtraeme 12069: </div>
12070: </div>
12071: </div>
12072:
12073: <p>If a package contains a rc.d script, it won't be
12074: copied into the startup directory by default, but you
12075: can enable it, by adding the option <code class=
12076: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
12077: "filename">/etc/mk.conf</code>. This option will copy
12078: the scripts into <code class=
12079: "filename">/etc/rc.d</code> when a package is
12080: installed, and it will automatically remove the scripts
12081: when the package is deinstalled.</p>
12082: </div>
1.1 grant 12083: </div>
12084:
12085: <div class="sect1" lang="en" xml:lang="en">
12086: <div class="titlepage">
12087: <div>
12088: <div>
12089: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12090: "feedback-to-author" id=
1.38 dillo 12091: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 12092: author</h2>
1.1 grant 12093: </div>
12094: </div>
12095: </div>
12096:
12097: <p>If you have found any bugs in the package you make
12098: available, if you had to do special steps to make it run
12099: under NetBSD or if you enhanced the software in various
12100: other ways, be sure to report these changes back to the
12101: original author of the program! With that kind of
12102: support, the next release of the program can incorporate
12103: these fixes, and people not using the NetBSD packages
12104: system can win from your efforts.</p>
12105:
12106: <p>Support the idea of free software!</p>
12107: </div>
12108: </div>
12109:
12110: <div class="chapter" lang="en" xml:lang="en">
12111: <div class="titlepage">
12112: <div>
12113: <div>
12114: <h2 class="title"><a name="debug" id=
1.38 dillo 12115: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 12116: </div>
12117: </div>
12118: </div>
12119:
12120: <p>To check out all the gotchas when building a package,
12121: here are the steps that I do in order to get a package
12122: working. Please note this is basically the same as what was
12123: explained in the previous sections, only with some
12124: debugging aids.</p>
12125:
12126: <div class="itemizedlist">
12127: <ul type="disc">
12128: <li>
1.14 xtraeme 12129: <p>Be sure to set <code class=
12130: "varname">PKG_DEVELOPER=1</code> in <code class=
12131: "filename">/etc/mk.conf</code></p>
1.1 grant 12132: </li>
12133:
12134: <li>
12135: <p>Install <a xmlns=
12136: "http://www.w3.org/TR/xhtml1/transitional" href=
12137: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 12138: class="pkgname">pkgtools/url2pkg</a>, create a
12139: directory for a new package, change into it, then run
12140: <span><strong class=
12141: "command">url2pkg</strong></span>:</p>
1.1 grant 12142: <pre class="screen">
1.14 xtraeme 12143: <code class="prompt">%</code> <strong class=
12144: "userinput"><code>mkdir /usr/pkgsrc/<em class=
12145: "replaceable"><code>category</code></em>/<em class=
12146: "replaceable"><code>examplepkg</code></em></code></strong>
12147: <code class="prompt">%</code> <strong class=
12148: "userinput"><code>cd /usr/pkgsrc/<em class=
12149: "replaceable"><code>category</code></em>/<em class=
12150: "replaceable"><code>examplepkg</code></em></code></strong>
12151: <code class="prompt">%</code> <strong class=
12152: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 12153: </pre>
12154: </li>
12155:
12156: <li>
1.14 xtraeme 12157: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 12158: requested.</p>
12159: </li>
12160:
12161: <li>
1.14 xtraeme 12162: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 12163: file</p>
12164: </li>
12165:
12166: <li>
1.14 xtraeme 12167: <p>Run <span><strong class="command">make
12168: configure</strong></span></p>
1.1 grant 12169: </li>
12170:
12171: <li>
12172: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 12173: and the configure step to the package's <code class=
12174: "filename">Makefile</code>.</p>
1.1 grant 12175: </li>
12176:
12177: <li>
12178: <p>Make the package compile, doing multiple rounds
12179: of</p>
12180: <pre class="screen">
1.14 xtraeme 12181: <code class="prompt">%</code> <strong class=
12182: "userinput"><code>make</code></strong>
12183: <code class="prompt">%</code> <strong class=
12184: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
12185: <code class="prompt">%</code> <strong class=
12186: "userinput"><code>mkpatches</code></strong>
12187: <code class="prompt">%</code> <strong class=
12188: "userinput"><code>patchdiff</code></strong>
12189: <code class="prompt">%</code> <strong class=
12190: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
12191: <code class="prompt">%</code> <strong class=
12192: "userinput"><code>make mps</code></strong>
12193: <code class="prompt">%</code> <strong class=
12194: "userinput"><code>make clean</code></strong>
1.1 grant 12195: </pre>
12196:
12197: <p>Doing as non-root user will ensure that no files
12198: are modified that shouldn't be, especially during the
1.14 xtraeme 12199: build phase. <span><strong class=
12200: "command">mkpatches</strong></span>,
12201: <span><strong class=
12202: "command">patchdiff</strong></span> and
12203: <span><strong class="command">pkgvi</strong></span>
12204: are from the <a xmlns=
1.1 grant 12205: "http://www.w3.org/TR/xhtml1/transitional" href=
12206: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 12207: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 12208: </li>
12209:
12210: <li>
1.14 xtraeme 12211: <p>Look at the <code class=
12212: "filename">Makefile</code>, fix if necessary; see
12213: <a href="#components.Makefile" title=
1.38 dillo 12214: "8.1. Makefile">Section 8.1,
1.14 xtraeme 12215: “<code class=
12216: "filename">Makefile</code>”</a>.</p>
1.1 grant 12217: </li>
12218:
12219: <li>
1.14 xtraeme 12220: <p>Generate a <code class=
12221: "filename">PLIST</code>:</p>
1.1 grant 12222: <pre class="screen">
1.14 xtraeme 12223: <code class="prompt">#</code> <strong class=
12224: "userinput"><code>make install</code></strong>
12225: <code class="prompt">#</code> <strong class=
12226: "userinput"><code>make print-PLIST >PLIST</code></strong>
12227: <code class="prompt">#</code> <strong class=
12228: "userinput"><code>make deinstall</code></strong>
12229: <code class="prompt">#</code> <strong class=
12230: "userinput"><code>make install</code></strong>
12231: <code class="prompt">#</code> <strong class=
12232: "userinput"><code>make deinstall</code></strong>
1.1 grant 12233: </pre>
12234:
1.14 xtraeme 12235: <p>You usually need to be <code class=
12236: "username">root</code> to do this. Look if there are
1.1 grant 12237: any files left:</p>
12238: <pre class="screen">
1.14 xtraeme 12239: <code class="prompt">#</code> <strong class=
12240: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12241: </pre>
12242:
12243: <p>If this reveals any files that are missing in
1.14 xtraeme 12244: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 12245: </li>
12246:
12247: <li>
1.14 xtraeme 12248: <p>Now that the <code class="filename">PLIST</code>
12249: is OK, install the package again and make a binary
1.1 grant 12250: package:</p>
12251: <pre class="screen">
1.14 xtraeme 12252: <code class="prompt">#</code> <strong class=
12253: "userinput"><code>make reinstall</code></strong>
12254: <code class="prompt">#</code> <strong class=
12255: "userinput"><code>make package</code></strong>
1.1 grant 12256: </pre>
12257: </li>
12258:
12259: <li>
12260: <p>Delete the installed package:</p>
12261: <pre class="screen">
1.14 xtraeme 12262: <code class="prompt">#</code> <strong class=
12263: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 12264: </pre>
12265: </li>
12266:
12267: <li>
1.14 xtraeme 12268: <p>Repeat the above <span><strong class=
12269: "command">make print-PLIST</strong></span> command,
12270: which shouldn't find anything now:</p>
1.1 grant 12271: <pre class="screen">
1.14 xtraeme 12272: <code class="prompt">#</code> <strong class=
12273: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12274: </pre>
12275: </li>
12276:
12277: <li>
12278: <p>Reinstall the binary package:</p>
12279: <pre class="screen">
1.14 xtraeme 12280: <code class="prompt">#</code> <strong class=
12281: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 12282: </pre>
12283: </li>
12284:
12285: <li>
12286: <p>Play with it. Make sure everything works.</p>
12287: </li>
12288:
12289: <li>
1.14 xtraeme 12290: <p>Run <span><strong class=
12291: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 12292: "http://www.w3.org/TR/xhtml1/transitional" href=
12293: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12294: class="pkgname">pkgtools/pkglint</a>, and fix the
12295: problems it reports:</p>
1.1 grant 12296: <pre class="screen">
1.14 xtraeme 12297: <code class="prompt">#</code> <strong class=
12298: "userinput"><code>pkglint</code></strong>
1.1 grant 12299: </pre>
12300: </li>
12301:
12302: <li>
12303: <p>Submit (or commit, if you have cvs access); see
12304: <a href="#submit" title=
1.38 dillo 12305: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 12306: <i>Submitting and Committing</i></a>.</p>
12307: </li>
12308: </ul>
12309: </div>
12310: </div>
12311:
12312: <div class="chapter" lang="en" xml:lang="en">
12313: <div class="titlepage">
12314: <div>
12315: <div>
12316: <h2 class="title"><a name="submit" id=
1.38 dillo 12317: "submit"></a>Chapter 17. Submitting and
1.1 grant 12318: Committing</h2>
12319: </div>
12320: </div>
12321: </div>
12322:
12323: <div class="toc">
12324: <p><b>Table of Contents</b></p>
12325:
12326: <dl>
1.30 wiz 12327: <dt><span class="sect1"><a href=
1.38 dillo 12328: "#submitting-your-package">17.1. Submitting your
1.30 wiz 12329: packages</a></span></dt>
1.1 grant 12330:
1.30 wiz 12331: <dt><span class="sect1"><a href=
1.38 dillo 12332: "#committing-importing">17.2. Committing: Importing a
1.30 wiz 12333: package into CVS</a></span></dt>
1.1 grant 12334:
1.30 wiz 12335: <dt><span class="sect1"><a href=
1.38 dillo 12336: "#updating-package">17.3. Updating a package to a newer
1.30 wiz 12337: version</a></span></dt>
1.1 grant 12338:
1.38 dillo 12339: <dt><span class="sect1"><a href="#moving-package">17.4.
1.2 hubertf 12340: Moving a package in pkgsrc</a></span></dt>
1.1 grant 12341: </dl>
12342: </div>
12343:
12344: <div class="sect1" lang="en" xml:lang="en">
12345: <div class="titlepage">
12346: <div>
12347: <div>
12348: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12349: "submitting-your-package" id=
1.38 dillo 12350: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 12351: your packages</h2>
1.1 grant 12352: </div>
12353: </div>
12354: </div>
12355:
12356: <p>You have to separate between binary and
12357: “<span class="quote">normal</span>” (source)
12358: packages here:</p>
12359:
12360: <div class="itemizedlist">
12361: <ul type="disc">
12362: <li>
12363: <p>precompiled binary packages</p>
12364:
12365: <p>Our policy is that we accept binaries only from
12366: pkgsrc developers to guarantee that the packages
12367: don't contain any trojan horses etc. This is not to
1.13 hubertf 12368: annoy anyone but rather to protect our users!
1.1 grant 12369: You're still free to put up your home-made binary
1.13 hubertf 12370: packages and tell the world where to get them.
12371: NetBSD developers doing bulk builds and wanting to
12372: upload them please see <a href="#bulk-upload"
1.38 dillo 12373: title="6.3.8. Uploading results of a bulk build">
12374: Section 6.3.8, “Uploading results of a
1.13 hubertf 12375: bulk build”</a>.</p>
1.1 grant 12376: </li>
12377:
12378: <li>
12379: <p>packages</p>
12380:
12381: <p>First, check that your package is complete,
12382: compiles and runs well; see <a href="#debug" title=
1.38 dillo 12383: "Chapter 16. Debugging">Chapter 16,
1.1 grant 12384: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 12385: Next, generate an uuencoded gzipped <a href=
12386: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12387: <span class="citerefentry"><span class=
12388: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 12389: preferably with all files in a single directory.
1.14 xtraeme 12390: Finally, <span><strong class=
12391: "command">send-pr</strong></span> with category
1.1 grant 12392: “<span class="quote">pkg</span>”, a
12393: synopsis which includes the package name and
12394: version number, a short description of your package
12395: (contents of the COMMENT variable or DESCR file are
12396: OK) and attach the archive to your PR.</p>
12397:
12398: <p>If you want to submit several packages, please
12399: send a separate PR for each one, it's easier for us
12400: to track things that way.</p>
12401:
12402: <p>Alternatively, you can also import new packages
12403: into pkgsrc-wip (“<span class="quote">pkgsrc
12404: work-in-progress</span>”); see the homepage
12405: at <a href="http://pkgsrc-wip.sourceforge.net/"
12406: target=
12407: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
12408: details.</p>
12409: </li>
12410: </ul>
12411: </div>
12412: </div>
12413:
12414: <div class="sect1" lang="en" xml:lang="en">
12415: <div class="titlepage">
12416: <div>
12417: <div>
12418: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12419: "committing-importing" id=
1.38 dillo 12420: "committing-importing"></a>17.2. Committing:
1.30 wiz 12421: Importing a package into CVS</h2>
1.1 grant 12422: </div>
12423: </div>
12424: </div>
12425:
12426: <p>This section is only of interest for pkgsrc developers
12427: with write access to the pkgsrc repository. Please
12428: remember that cvs imports files relative to the current
12429: working directory, and that the pathname that you give
1.14 xtraeme 12430: the <span><strong class="command">cvs
12431: import</strong></span> command is so that it knows where
12432: to place the files in the repository. Newly created
12433: packages should be imported with a vendor tag of
12434: “<span class="quote">TNF</span>” and a
12435: release tag of “<span class=
12436: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 12437: <pre class="programlisting">
12438: % cd .../pkgsrc/category/pkgname
12439: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
12440: </pre>
12441:
12442: <p>Remember to move the directory from which you imported
12443: out of the way, or cvs will complain the next time you
12444: “<span class="quote">cvs update</span>” your
12445: source tree. Also don't forget to add the new package to
1.14 xtraeme 12446: the category's <code class=
12447: "filename">Makefile</code>.</p>
1.1 grant 12448:
12449: <p>The commit message of the initial import should
1.14 xtraeme 12450: include part of the <code class="filename">DESCR</code>
12451: file, so people reading the mailing lists know what the
12452: package is/does.</p>
1.1 grant 12453:
12454: <p>Please note all package updates/additions in
1.14 xtraeme 12455: <code class="filename">pkgsrc/doc/CHANGES</code>. It's
12456: very important to keep this file up to date and
12457: conforming to the existing format, because it will be
12458: used by scripts to automatically update pages on <a href=
1.1 grant 12459: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
12460: and other sites. Additionally, check the pkgsrc/doc/TODO
12461: file and remove the entry for the package you updated, in
12462: case it was mentioned there.</p>
12463:
12464: <p>For new packages, “<span class="quote">cvs
12465: import</span>” is preferred to “<span class=
12466: "quote">cvs add</span>” because the former gets
12467: everything with a single command, and provides a
12468: consistent tag.</p>
12469: </div>
12470:
12471: <div class="sect1" lang="en" xml:lang="en">
12472: <div class="titlepage">
12473: <div>
12474: <div>
12475: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12476: "updating-package" id=
1.38 dillo 12477: "updating-package"></a>17.3. Updating a
1.30 wiz 12478: package to a newer version</h2>
1.1 grant 12479: </div>
12480: </div>
12481: </div>
12482:
12483: <p>Please always put a concise, appropriate and relevant
12484: summary of the changes between old and new versions into
12485: the commit log when updating a package. There are various
12486: reasons for this:</p>
12487:
12488: <div class="itemizedlist">
12489: <ul type="disc">
12490: <li>
12491: <p>A URL is volatile, and can change over time. It
12492: may go away completely or its information may be
12493: overwritten by newer information.</p>
12494: </li>
12495:
12496: <li>
12497: <p>Having the change information between old and
12498: new versions in our CVS repository is very useful
12499: for people who use either cvs or anoncvs.</p>
12500: </li>
12501:
12502: <li>
12503: <p>Having the change information between old and
12504: new versions in our CVS repository is very useful
12505: for people who read the pkgsrc-changes mailing
12506: list, so that they can make tactical decisions
12507: about when to upgrade the package.</p>
12508: </li>
12509: </ul>
12510: </div>
12511:
1.18 xtraeme 12512: <p>Please also recognize that, just because a new version
1.1 grant 12513: of a package has been released, it should not
12514: automatically be upgraded in the CVS repository. We
12515: prefer to be conservative in the packages that are
12516: included in pkgsrc - development or beta packages are not
12517: really the best thing for most places in which pkgsrc is
12518: used. Please use your judgement about what should go into
12519: pkgsrc, and bear in mind that stability is to be
12520: preferred above new and possibly untested features.</p>
12521: </div>
12522:
12523: <div class="sect1" lang="en" xml:lang="en">
12524: <div class="titlepage">
12525: <div>
12526: <div>
12527: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12528: "moving-package" id=
1.38 dillo 12529: "moving-package"></a>17.4. Moving a package in
1.30 wiz 12530: pkgsrc</h2>
1.1 grant 12531: </div>
12532: </div>
12533: </div>
12534:
12535: <div class="orderedlist">
12536: <ol type="1">
12537: <li>
12538: <p>Make a copy of the directory somewhere else.</p>
12539: </li>
12540:
12541: <li>
12542: <p>Remove all CVS dirs.</p>
12543:
12544: <p>Alternatively to the first two steps you can
12545: also do:</p>
12546: <pre class="screen">
1.14 xtraeme 12547: <code class="prompt">%</code> <strong class=
12548: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 12549: </pre>
12550:
12551: <p>and use that for further work.</p>
12552: </li>
12553:
12554: <li>
1.14 xtraeme 12555: <p>Fix <code class="varname">CATEGORIES</code> and
12556: any <code class="varname">DEPENDS</code> paths that
12557: just did “<span class=
1.1 grant 12558: "quote">../package</span>” instead of
12559: “<span class=
12560: "quote">../../category/package</span>”.</p>
12561: </li>
12562:
12563: <li>
1.14 xtraeme 12564: <p><span><strong class="command">cvs
12565: import</strong></span> the modified package in the
12566: new place.</p>
1.1 grant 12567: </li>
12568:
12569: <li>
12570: <p>Check if any package depends on it:</p>
12571: <pre class="screen">
1.14 xtraeme 12572: <code class="prompt">%</code> <strong class=
12573: "userinput"><code>cd /usr/pkgsrc</code></strong>
12574: <code class="prompt">%</code> <strong class=
12575: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 12576: </pre>
12577: </li>
12578:
12579: <li>
12580: <p>Fix paths in packages from step 5 to point to
12581: new location.</p>
12582: </li>
12583:
12584: <li>
1.14 xtraeme 12585: <p><span><strong class="command">cvs rm
12586: (-f)</strong></span> the package at the old
12587: location.</p>
1.1 grant 12588: </li>
12589:
12590: <li>
1.14 xtraeme 12591: <p>Remove from <code class=
12592: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 12593: </li>
12594:
12595: <li>
1.14 xtraeme 12596: <p>Add to <code class=
12597: "filename">newcategory/Makefile</code>.</p>
1.1 grant 12598: </li>
12599:
12600: <li>
12601: <p>Commit the changed and removed files:</p>
12602: <pre class="screen">
1.14 xtraeme 12603: <code class="prompt">%</code> <strong class=
12604: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 12605: </pre>
12606:
12607: <p>(and any packages from step 5, of course).</p>
12608: </li>
12609: </ol>
12610: </div>
12611: </div>
12612: </div>
12613: </div>
12614:
12615: <div class="appendix" lang="en" xml:lang="en">
12616: <div class="titlepage">
12617: <div>
12618: <div>
12619: <h2 class="title"><a name="examples" id=
12620: "examples"></a>Appendix A. A simple example
12621: package: bison</h2>
12622: </div>
12623: </div>
12624: </div>
12625:
12626: <div class="toc">
12627: <p><b>Table of Contents</b></p>
12628:
12629: <dl>
1.30 wiz 12630: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 12631: files</a></span></dt>
12632:
12633: <dd>
12634: <dl>
1.30 wiz 12635: <dt><span class="sect2"><a href=
12636: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 12637:
1.30 wiz 12638: <dt><span class="sect2"><a href=
12639: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 12640:
1.30 wiz 12641: <dt><span class="sect2"><a href=
12642: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 12643:
1.30 wiz 12644: <dt><span class="sect2"><a href=
12645: "#checking-package-with-pkglint">A.1.4. Checking a
12646: package with <span><strong class=
1.14 xtraeme 12647: "command">pkglint</strong></span></a></span></dt>
1.1 grant 12648: </dl>
12649: </dd>
12650:
1.30 wiz 12651: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
12652: Steps for building, installing, packaging</a></span></dt>
1.1 grant 12653: </dl>
12654: </div>
12655:
12656: <p>We checked to find a piece of software that wasn't in the
12657: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 12658: would want to have <span><strong class=
12659: "command">bison</strong></span> when Berkeley
12660: <span><strong class="command">yacc</strong></span> is already
12661: present in the tree is beyond us, but it's useful for the
12662: purposes of this exercise.</p>
1.1 grant 12663:
12664: <div class="sect1" lang="en" xml:lang="en">
12665: <div class="titlepage">
12666: <div>
12667: <div>
12668: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12669: "example-files" id=
12670: "example-files"></a>A.1. files</h2>
1.1 grant 12671: </div>
12672: </div>
12673: </div>
12674:
12675: <div class="sect2" lang="en" xml:lang="en">
12676: <div class="titlepage">
12677: <div>
12678: <div>
1.30 wiz 12679: <h3 class="title"><a name="example-Makefile" id=
12680: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 12681: </div>
12682: </div>
12683: </div>
12684: <pre class="programlisting">
1.17 sketch 12685: # $NetBSD$
1.1 grant 12686: #
12687:
12688: DISTNAME= bison-1.25
12689: CATEGORIES= devel
12690: MASTER_SITES= ${MASTER_SITE_GNU}
12691:
12692: MAINTAINER= thorpej@NetBSD.org
12693: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
12694: COMMENT= GNU yacc clone
12695:
12696: GNU_CONFIGURE= yes
12697: INFO_FILES= bison.info
12698:
12699: .include "../../mk/bsd.pkg.mk"
12700: </pre>
12701: </div>
12702:
12703: <div class="sect2" lang="en" xml:lang="en">
12704: <div class="titlepage">
12705: <div>
12706: <div>
1.30 wiz 12707: <h3 class="title"><a name="example-descr" id=
12708: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 12709: </div>
12710: </div>
12711: </div>
12712: <pre class="programlisting">
12713: GNU version of yacc. Can make re-entrant parsers, and numerous other
12714: improvements. Why you would want this when Berkeley <a href=
12715: "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
12716: of the NetBSD source tree is beyond me.
12717: </pre>
12718: </div>
12719:
12720: <div class="sect2" lang="en" xml:lang="en">
12721: <div class="titlepage">
12722: <div>
12723: <div>
1.30 wiz 12724: <h3 class="title"><a name="example-plist" id=
12725: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 12726: </div>
12727: </div>
12728: </div>
12729: <pre class="programlisting">
1.17 sketch 12730: @comment $NetBSD$
1.1 grant 12731: bin/bison
12732: man/man1/bison.1.gz
12733: share/bison.simple
12734: share/bison.hairy
12735: </pre>
12736: </div>
12737:
12738: <div class="sect2" lang="en" xml:lang="en">
12739: <div class="titlepage">
12740: <div>
12741: <div>
1.30 wiz 12742: <h3 class="title"><a name=
12743: "checking-package-with-pkglint" id=
12744: "checking-package-with-pkglint"></a>A.1.4. Checking
12745: a package with <span><strong class=
1.14 xtraeme 12746: "command">pkglint</strong></span></h3>
1.1 grant 12747: </div>
12748: </div>
12749: </div>
12750:
12751: <p>The NetBSD package system comes with <a xmlns=
12752: "http://www.w3.org/TR/xhtml1/transitional" href=
12753: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12754: class="pkgname">pkgtools/pkglint</a> which helps to check
12755: the contents of these files. After installation it is
12756: quite easy to use, just change to the directory of the
12757: package you wish to examine and execute
12758: <span><strong class=
12759: "command">pkglint</strong></span>:</p>
1.1 grant 12760: <pre class="screen">
1.14 xtraeme 12761: <code class="prompt">$</code> <strong class=
12762: "userinput"><code>pkglint</code></strong>
1.1 grant 12763: looks fine.
12764: </pre>
12765:
12766: <p>Depending on the supplied command line arguments (see
12767: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 12768: e.g. <span><strong class="command">pkglint
12769: -v</strong></span> for a very verbose check.</p>
1.1 grant 12770: </div>
12771: </div>
12772:
12773: <div class="sect1" lang="en" xml:lang="en">
12774: <div class="titlepage">
12775: <div>
12776: <div>
12777: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12778: "steps-for-b-i-p" id=
12779: "steps-for-b-i-p"></a>A.2. Steps for building,
12780: installing, packaging</h2>
1.1 grant 12781: </div>
12782: </div>
12783: </div>
12784:
12785: <p>Create the directory where the package lives, plus any
12786: auxiliary directories:</p>
12787: <pre class="screen">
1.14 xtraeme 12788: <code class="prompt">#</code> <strong class=
12789: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
12790: <code class="prompt">#</code> <strong class=
12791: "userinput"><code>mkdir bison</code></strong>
12792: <code class="prompt">#</code> <strong class=
12793: "userinput"><code>cd bison</code></strong>
12794: <code class="prompt">#</code> <strong class=
12795: "userinput"><code>mkdir patches</code></strong>
1.1 grant 12796: </pre>
12797:
1.14 xtraeme 12798: <p>Create <code class="filename">Makefile</code>,
12799: <code class="filename">DESCR</code> and <code class=
12800: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 12801: "Chapter 8. Package components - files, directories and contents">
12802: Chapter 8, <i>Package components - files, directories and
1.1 grant 12803: contents</i></a>) then continue with fetching the
12804: distfile:</p>
12805: <pre class="screen">
1.14 xtraeme 12806: <code class="prompt">#</code> <strong class=
12807: "userinput"><code>make fetch</code></strong>
1.1 grant 12808: >> bison-1.25.tar.gz doesn't seem to exist on this system.
12809: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
12810: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12811: ftp: Error retrieving file: 500 Internal error
12812:
12813: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
12814: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12815: ftp: Error retrieving file: 500 Internal error
12816:
12817: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
12818: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12819: Successfully retrieved file.
12820: </pre>
12821:
1.14 xtraeme 12822: <p>Generate the checksum of the distfile into <code class=
12823: "filename">distinfo</code>:</p>
1.1 grant 12824: <pre class="screen">
1.14 xtraeme 12825: <code class="prompt">#</code> <strong class=
12826: "userinput"><code>make makesum</code></strong>
1.1 grant 12827: </pre>
12828:
12829: <p>Now compile:</p>
12830: <pre class="screen">
1.14 xtraeme 12831: <code class="prompt">#</code> <strong class=
12832: "userinput"><code>make</code></strong>
1.1 grant 12833: >> Checksum OK for bison-1.25.tar.gz.
12834: ===> Extracting for bison-1.25
12835: ===> Patching for bison-1.25
12836: ===> Ignoring empty patch directory
12837: ===> Configuring for bison-1.25
12838: creating cache ./config.cache
12839: checking for gcc... cc
12840: checking whether we are using GNU C... yes
12841: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12842: checking how to run the C preprocessor... cc -E
12843: checking for minix/config.h... no
12844: checking for POSIXized ISC... no
12845: checking whether cross-compiling... no
12846: checking for ANSI C header files... yes
12847: checking for string.h... yes
12848: checking for stdlib.h... yes
12849: checking for memory.h... yes
12850: checking for working const... yes
12851: checking for working alloca.h... no
12852: checking for alloca... yes
12853: checking for strerror... yes
12854: updating cache ./config.cache
12855: creating ./config.status
12856: creating Makefile
12857: ===> Building for bison-1.25
12858: 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
12859: 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
12860: 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
12861: 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
12862: 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
12863: 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
12864: 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
12865: 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
12866: 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
12867: 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
12868: 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
12869: 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
12870: 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
12871: 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
12872: 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
12873: 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
12874: 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
12875: 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
12876: 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
12877: 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
12878: 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
12879: 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
12880: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12881: rm -f bison.s1
12882: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12883: </pre>
12884:
12885: <p>Everything seems OK, so install the files:</p>
12886: <pre class="screen">
1.14 xtraeme 12887: <code class="prompt">#</code> <strong class=
12888: "userinput"><code>make install</code></strong>
1.1 grant 12889: >> Checksum OK for bison-1.25.tar.gz.
12890: ===> Installing for bison-1.25
12891: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12892: rm -f /usr/pkg/bin/bison
12893: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12894: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12895: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12896: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12897: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12898: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12899: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12900: ===> Registering installation for bison-1.25
12901: </pre>
12902:
12903: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12904: remove it with <span><strong class="command">pkg_delete
12905: bison</strong></span>. Should you decide that you want a
12906: binary package, do this now:</p>
1.1 grant 12907: <pre class="screen">
1.14 xtraeme 12908: <code class="prompt">#</code> <strong class=
12909: "userinput"><code>make package</code></strong>
1.1 grant 12910: >> Checksum OK for bison-1.25.tar.gz.
12911: ===> Building package for bison-1.25
12912: Creating package bison-1.25.tgz
12913: Registering depends:.
12914: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12915: </pre>
12916:
12917: <p>Now that you don't need the source and object files any
12918: more, clean up:</p>
12919: <pre class="screen">
1.14 xtraeme 12920: <code class="prompt">#</code> <strong class=
12921: "userinput"><code>make clean</code></strong>
1.1 grant 12922: ===> Cleaning for bison-1.25
12923: </pre>
12924: </div>
12925: </div>
12926:
12927: <div class="appendix" lang="en" xml:lang="en">
12928: <div class="titlepage">
12929: <div>
12930: <div>
12931: <h2 class="title"><a name="logs" id=
12932: "logs"></a>Appendix B. Build logs</h2>
12933: </div>
12934: </div>
12935: </div>
12936:
12937: <div class="toc">
12938: <p><b>Table of Contents</b></p>
12939:
12940: <dl>
12941: <dt><span class="sect1"><a href="#logs.building">B.1.
12942: Building figlet</a></span></dt>
12943:
12944: <dt><span class="sect1"><a href="#logs.package">B.2.
12945: Packaging figlet</a></span></dt>
12946: </dl>
12947: </div>
12948:
12949: <div class="sect1" lang="en" xml:lang="en">
12950: <div class="titlepage">
12951: <div>
12952: <div>
12953: <h2 class="title" style="clear: both"><a name=
12954: "logs.building" id=
12955: "logs.building"></a>B.1. Building figlet</h2>
12956: </div>
12957: </div>
12958: </div>
12959: <pre class="screen">
1.14 xtraeme 12960: <code class="prompt">#</code> <strong class=
12961: "userinput"><code>make</code></strong>
1.1 grant 12962: ===> Checking for vulnerabilities in figlet-2.2.1nb2
12963: => figlet221.tar.gz doesn't seem to exist on this system.
12964: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
12965: => [172219 bytes]
12966: Connected to ftp.plig.net.
12967: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
12968: 331 Guest login ok, send your complete e-mail address as password.
12969: 230-You are user #5 of 500 simultaneous users allowed.
12970: 230-
12971: 230- ___ _ _ _
12972: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
12973: 230- | _| _| . |_| . | | | . |_| . | _| . |
12974: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
12975: 230- |_| |_| |___| |___|
12976: 230-
12977: 230-** Welcome to ftp.plig.org **
12978: 230-
12979: 230-Please note that all transfers from this FTP site are logged. If you
12980: 230-do not like this, please disconnect now.
12981: 230-
12982: 230-This arhive is available via
12983: 230-
12984: 230-HTTP: http://ftp.plig.org/
12985: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
12986: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
12987: 230-
12988: 230-Please email comments, bug reports and requests for packages to be
12989: 230-mirrored to ftp-admin@plig.org.
12990: 230-
12991: 230-
12992: 230 Logged in anonymously.
12993: Remote system type is UNIX.
12994: Using binary mode to transfer files.
12995: 200 Type okay.
12996: 250 "/pub" is new cwd.
12997: 250-"/pub/figlet" is new cwd.
12998: 250-
12999: 250-Welcome to the figlet archive at ftp.figlet.org
13000: 250-
13001: 250- ftp://ftp.figlet.org/pub/figlet/
13002: 250-
13003: 250-The official FIGlet web page is:
13004: 250- http://www.figlet.org/
13005: 250-
13006: 250-If you have questions, please mailto:info@figlet.org. If you want to
13007: 250-contribute a font or something else, you can email us.
13008: 250
13009: 250 "/pub/figlet/program" is new cwd.
13010: 250 "/pub/figlet/program/unix" is new cwd.
13011: local: figlet221.tar.gz remote: figlet221.tar.gz
13012: 502 Unimplemented command.
13013: 227 Entering Passive Mode (195,40,6,41,246,104)
13014: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
13015: 38% |************** | 65800 64.16 KB/s 00:01 ETA
13016: 226 Transfer completed.
13017: 172219 bytes received in 00:02 (75.99 KB/s)
13018: 221 Goodbye.
13019: => Checksum OK for figlet221.tar.gz.
13020: ===> Extracting for figlet-2.2.1nb2
13021: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
13022: ===> Patching for figlet-2.2.1nb2
13023: ===> Applying pkgsrc patches for figlet-2.2.1nb2
13024: ===> Overriding tools for figlet-2.2.1nb2
13025: ===> Creating toolchain wrappers for figlet-2.2.1nb2
13026: ===> Configuring for figlet-2.2.1nb2
13027: ===> Building for figlet-2.2.1nb2
13028: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
13029: chmod a+x figlet
13030: gcc -O2 -o chkfont chkfont.c
13031: => Unwrapping files-to-be-installed.
1.14 xtraeme 13032: <code class="prompt">#</code>
13033: <code class="prompt">#</code> <strong class=
13034: "userinput"><code>make install</code></strong>
1.1 grant 13035: ===> Checking for vulnerabilities in figlet-2.2.1nb2
13036: ===> Installing for figlet-2.2.1nb2
13037: install -d -o root -g wheel -m 755 /usr/pkg/bin
13038: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
13039: mkdir -p /usr/pkg/share/figlet
13040: cp figlet /usr/pkg/bin
13041: cp chkfont /usr/pkg/bin
13042: chmod 555 figlist showfigfonts
13043: cp figlist /usr/pkg/bin
13044: cp showfigfonts /usr/pkg/bin
13045: cp fonts/*.flf /usr/pkg/share/figlet
13046: cp fonts/*.flc /usr/pkg/share/figlet
13047: cp figlet.6 /usr/pkg/man/man6
13048: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 13049: <code class="prompt">#</code>
1.1 grant 13050: </pre>
13051: </div>
13052:
13053: <div class="sect1" lang="en" xml:lang="en">
13054: <div class="titlepage">
13055: <div>
13056: <div>
13057: <h2 class="title" style="clear: both"><a name=
13058: "logs.package" id=
13059: "logs.package"></a>B.2. Packaging figlet</h2>
13060: </div>
13061: </div>
13062: </div>
13063: <pre class="screen">
1.14 xtraeme 13064: <code class="prompt">#</code> <strong class=
13065: "userinput"><code>make package</code></strong>
1.1 grant 13066: ===> Checking for vulnerabilities in figlet-2.2.1nb2
13067: ===> Packaging figlet-2.2.1nb2
13068: ===> Building binary package for figlet-2.2.1nb2
13069: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
13070: Using SrcDir value of /usr/pkg
13071: Registering depends:.
1.14 xtraeme 13072: <code class="prompt">#</code>
1.1 grant 13073: </pre>
13074: </div>
13075: </div>
13076:
13077: <div class="appendix" lang="en" xml:lang="en">
13078: <div class="titlepage">
13079: <div>
13080: <div>
13081: <h2 class="title"><a name="ftp-layout" id=
13082: "ftp-layout"></a>Appendix C. Layout of the
13083: FTP server's package archive</h2>
13084: </div>
13085: </div>
13086: </div>
13087:
13088: <p>Layout for precompiled binary packages on
13089: ftp.NetBSD.org:</p>
13090: <pre class="programlisting">
13091: /pub/NetBSD/packages/
13092: distfiles/
13093:
13094: # Unpacked pkgsrc trees
13095: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
13096: pkgsrc-2003Q4 -> N/A
13097: pkgsrc-2004Q1/pkgsrc
13098:
13099: # pkgsrc archives
13100: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
13101: pkgsrc-2003Q4.tar.gz -> N/A
13102: pkgsrc-2004Q1.tar.gz -> N/A
13103:
13104: # Per pkgsrc-release/OS-release/arch package archives
13105: pkgsrc-2003Q4/
13106: NetBSD-1.6.2/
13107: i386/
13108: All/
13109: archivers/
13110: foo -> ../All/foo
13111: ...
13112: pkgsrc-2004Q1/
13113: NetBSD-1.6.2/
13114: i386/
13115: All/
13116: ...
13117: NetBSD-2.0/
13118: i386/
13119: All/
13120: ...
13121: SunOS-5.9/
13122: sparc/
13123: All/
13124: ...
13125: x86/
13126: All/
13127: ...
13128:
13129: # Per os-release package archive convenience links
13130: NetBSD-1.6.2 -> 1.6.2
13131: 1.6.2/
13132: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
13133: m68k/
13134: All/
13135: archivers/
13136: foo -> ../All/foo
13137: ...
13138: amiga -> m68k
13139: atari -> m68k
13140: ...
13141:
13142: 2.0 -> NetBSD-2.0 # backward compat, historic
13143: NetBSD-2.0/
13144: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
13145: SunOS-5.9/
13146: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
13147: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
13148:
13149: </pre>
13150:
13151: <p>To create:</p>
13152:
13153: <div class="orderedlist">
13154: <ol type="1">
13155: <li>
13156: <p>Run bulk build, see <a href="#bulkbuild" title=
1.38 dillo 13157: "6.3. Doing a bulk build of all packages">Section
13158: 6.3, “Doing a bulk build of all
1.1 grant 13159: packages”</a></p>
13160: </li>
13161:
13162: <li>
13163: <p>Upload /usr/pkgsrc/packages to</p>
13164: <pre class="programlisting">
13165: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 13166: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 13167: `uname -s`-`uname -r`/ # OS & version
13168: `uname -p` # architecture
13169:
13170: </pre>
13171: </li>
13172:
13173: <li>
1.14 xtraeme 13174: <p>If necessary, create a symlink <span><strong class=
13175: "command">ln -s `uname -m` `uname -p`</strong></span>
13176: (amiga -> m68k, ...)</p>
1.1 grant 13177: </li>
13178: </ol>
13179: </div>
13180: </div>
1.2 hubertf 13181:
13182: <div class="appendix" lang="en" xml:lang="en">
13183: <div class="titlepage">
13184: <div>
13185: <div>
13186: <h2 class="title"><a name="editing" id=
13187: "editing"></a>Appendix D. Editing guidelines
13188: for the pkgsrc guide</h2>
13189: </div>
13190: </div>
13191: </div>
13192:
13193: <div class="toc">
13194: <p><b>Table of Contents</b></p>
13195:
13196: <dl>
1.30 wiz 13197: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 13198: Targets</a></span></dt>
13199:
1.30 wiz 13200: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 13201: Procedure</a></span></dt>
13202: </dl>
13203: </div>
13204:
13205: <p>This section contains information on editing the pkgsrc
13206: guide itself.</p>
13207:
13208: <div class="sect1" lang="en" xml:lang="en">
13209: <div class="titlepage">
13210: <div>
13211: <div>
13212: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13213: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 13214: </div>
13215: </div>
13216: </div>
13217:
1.14 xtraeme 13218: <p>The pkgsrc guide's source code is stored in <code class=
13219: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 13220: are created from it:</p>
13221:
13222: <div class="itemizedlist">
13223: <ul type="disc">
13224: <li>
1.14 xtraeme 13225: <p><code class=
1.23 wiz 13226: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 13227: </li>
13228:
13229: <li>
1.14 xtraeme 13230: <p><code class=
13231: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 13232: </li>
13233:
13234: <li>
1.14 xtraeme 13235: <p><code class=
13236: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 13237: the documentation on the NetBSD website will be built
13238: from pkgsrc and kept up to date on the web server
13239: itself. This means you <span class=
13240: "emphasis"><em>must</em></span> make sure that your
13241: changes haven't broken the build!</p>
13242: </li>
1.6 hubertf 13243:
13244: <li>
1.14 xtraeme 13245: <p><code class=
13246: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 13247: PDF version of the pkgsrc guide.</p>
13248: </li>
13249:
13250: <li>
1.14 xtraeme 13251: <p><code class=
13252: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 13253: PostScript version of the pkgsrc guide.</p>
13254: </li>
1.2 hubertf 13255: </ul>
13256: </div>
13257: </div>
13258:
13259: <div class="sect1" lang="en" xml:lang="en">
13260: <div class="titlepage">
13261: <div>
13262: <div>
13263: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13264: "procedure" id=
13265: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 13266: </div>
13267: </div>
13268: </div>
13269:
13270: <p>The procedure to edit the pkgsrc guide is:</p>
13271:
13272: <div class="itemizedlist">
13273: <ul type="disc">
13274: <li>
1.6 hubertf 13275: <p>Make sure you have the packages needed to
13276: re-generate the pkgsrc guide (and other XML-based
13277: NetBSD documentation) installed. These are
1.11 ben 13278: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 13279: for creating the ASCII- and HTML-version, and
13280: “<span class=
1.11 ben 13281: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 13282: PostScript- and PDF version. You will need both
13283: packages installed, to make sure documentation is
13284: consistent across all formats. The packages can be
1.14 xtraeme 13285: found in <code class=
13286: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
13287: <code class=
13288: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 13289: </li>
13290:
13291: <li>
1.14 xtraeme 13292: <p>Edit the XML file(s) in <code class=
13293: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 13294: </li>
13295:
13296: <li>
1.14 xtraeme 13297: <p>Run <span><strong class="command">make extract
13298: && make do-lint</strong></span> in
13299: <code class="filename">pkgsrc/doc/guide</code> to
13300: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 13301: </li>
13302:
13303: <li>
1.14 xtraeme 13304: <p>Run <span><strong class=
13305: "command">make</strong></span> in <code class=
13306: "filename">pkgsrc/doc/guide</code> to build the HTML
13307: and ASCII version.</p>
1.2 hubertf 13308: </li>
13309:
13310: <li>
1.14 xtraeme 13311: <p>If all is well, run <span><strong class=
13312: "command">make install-doc</strong></span> to put the
13313: generated files into <code class=
13314: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 13315: </li>
13316:
13317: <li>
1.14 xtraeme 13318: <p><span><strong class="command">cvs commit
13319: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 13320: </li>
13321:
13322: <li>
1.14 xtraeme 13323: <p><span><strong class="command">cvs commit -m
13324: re-generate
13325: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 13326: </li>
1.4 hubertf 13327:
13328: <li>
13329: <p>Until the webserver on www.NetBSD.org is really
13330: updated automatically to pick up changes to the
1.14 xtraeme 13331: pkgsrc guide automatically, also run
1.18 xtraeme 13332: <span><strong class="command">make install-htdocs
1.14 xtraeme 13333: HTDOCSDIR=../../../htdocs</strong></span> (or
13334: similar, adjust <code class=
13335: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 13336: </li>
13337:
13338: <li>
1.14 xtraeme 13339: <p><span><strong class="command">cvs commit
13340: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 13341: </li>
1.2 hubertf 13342: </ul>
13343: </div>
13344: </div>
13345: </div>
1.1 grant 13346: </div>
13347: </body>
13348: </html>
CVSweb <webmaster@jp.NetBSD.org>