Annotation of pkgsrc/doc/pkgsrc.html, revision 1.42
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=
1.42 ! dillo 230: "#selecting-options">5.1. Selecting Build
! 231: Options</a></span></dt>
1.38 dillo 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.41 wiz 865: "#general-notes-for-changes">17.2. General notes
866: when adding, updating, or removing
867: packages</a></span></dt>
868:
869: <dt><span class="sect1"><a href=
870: "#committing-importing">17.3. Committing: Importing
1.30 wiz 871: a package into CVS</a></span></dt>
1.1 grant 872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.41 wiz 874: "#updating-package">17.4. Updating a package to a
1.30 wiz 875: newer version</a></span></dt>
1.1 grant 876:
1.30 wiz 877: <dt><span class="sect1"><a href=
1.41 wiz 878: "#moving-package">17.5. Moving a package in
1.30 wiz 879: pkgsrc</a></span></dt>
1.1 grant 880: </dl>
881: </dd>
882: </dl>
883: </dd>
884:
885: <dt><span class="appendix"><a href="#examples">A. A simple
886: example package: bison</a></span></dt>
887:
888: <dd>
889: <dl>
1.30 wiz 890: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 891: files</a></span></dt>
892:
893: <dd>
894: <dl>
1.30 wiz 895: <dt><span class="sect2"><a href=
896: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 897:
1.30 wiz 898: <dt><span class="sect2"><a href=
899: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 900:
1.30 wiz 901: <dt><span class="sect2"><a href=
902: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 903:
1.30 wiz 904: <dt><span class="sect2"><a href=
905: "#checking-package-with-pkglint">A.1.4. Checking a
906: package with <span><strong class=
1.14 xtraeme 907: "command">pkglint</strong></span></a></span></dt>
1.1 grant 908: </dl>
909: </dd>
910:
1.30 wiz 911: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
912: Steps for building, installing,
913: packaging</a></span></dt>
1.1 grant 914: </dl>
915: </dd>
916:
917: <dt><span class="appendix"><a href="#logs">B. Build
918: logs</a></span></dt>
919:
920: <dd>
921: <dl>
922: <dt><span class="sect1"><a href="#logs.building">B.1.
923: Building figlet</a></span></dt>
924:
925: <dt><span class="sect1"><a href="#logs.package">B.2.
926: Packaging figlet</a></span></dt>
927: </dl>
928: </dd>
929:
930: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
931: of the FTP server's package archive</a></span></dt>
1.2 hubertf 932:
933: <dt><span class="appendix"><a href="#editing">D. Editing
934: guidelines for the pkgsrc guide</a></span></dt>
935:
936: <dd>
937: <dl>
1.30 wiz 938: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 939: Targets</a></span></dt>
940:
1.30 wiz 941: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 942: Procedure</a></span></dt>
943: </dl>
944: </dd>
1.1 grant 945: </dl>
946: </div>
947:
948: <div class="chapter" lang="en" xml:lang="en">
949: <div class="titlepage">
950: <div>
951: <div>
952: <h2 class="title"><a name="introduction" id=
953: "introduction"></a>Chapter 1. Introduction</h2>
954: </div>
955: </div>
956: </div>
957:
958: <div class="toc">
959: <p><b>Table of Contents</b></p>
960:
961: <dl>
1.30 wiz 962: <dt><span class="sect1"><a href=
963: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 964:
965: <dt><span class="sect1"><a href="#overview">1.2.
966: Overview</a></span></dt>
967:
968: <dt><span class="sect1"><a href="#terminology">1.3.
969: Terminology</a></span></dt>
970:
971: <dt><span class="sect1"><a href="#typography">1.4.
972: Typography</a></span></dt>
973: </dl>
974: </div>
975:
976: <div class="sect1" lang="en" xml:lang="en">
977: <div class="titlepage">
978: <div>
979: <div>
980: <h2 class="title" style="clear: both"><a name=
1.30 wiz 981: "introduction-section" id=
982: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 983: </div>
984: </div>
985: </div>
986:
987: <p>There is a lot of software freely available for Unix
988: based systems, which usually runs on NetBSD and other
989: Unix-flavoured systems, too, sometimes with some
990: modifications. The NetBSD Packages Collection (pkgsrc)
991: incorporates any such changes necessary to make that
992: software run, and makes the installation (and
993: de-installation) of the software package easy by means of a
994: single command.</p>
995:
996: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 997: the <span><strong class="command">pkg_*</strong></span>
998: tools so that installation and de-installation, printing of
999: an inventory of all installed packages and retrieval of
1000: one-line comments or more verbose descriptions are all
1001: simple.</p>
1.1 grant 1002:
1003: <p>pkgsrc currently contains several thousand packages,
1004: including:</p>
1005:
1006: <div class="itemizedlist">
1007: <ul type="disc">
1008: <li>
1009: <p><a xmlns=
1010: "http://www.w3.org/TR/xhtml1/transitional" href=
1011: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20 ben 1012: class="pkgname">www/apache</a> - The Apache web
1013: server</p>
1.1 grant 1014: </li>
1015:
1016: <li>
1017: <p><a xmlns=
1018: "http://www.w3.org/TR/xhtml1/transitional" href=
1019: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 1020: class="pkgname">www/mozilla</a> - The Mozilla web
1021: browser</p>
1.1 grant 1022: </li>
1023:
1024: <li>
1025: <p><a xmlns=
1026: "http://www.w3.org/TR/xhtml1/transitional" href=
1027: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20 ben 1028: class="pkgname">meta-pkgs/gnome</a> - The GNOME
1029: Desktop Environment</p>
1.1 grant 1030: </li>
1031:
1032: <li>
1033: <p><a xmlns=
1034: "http://www.w3.org/TR/xhtml1/transitional" href=
1035: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20 ben 1036: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
1037: Environment</p>
1.1 grant 1038: </li>
1039: </ul>
1040: </div>
1041:
1042: <p>...just to name a few.</p>
1043:
1044: <p>pkgsrc has built-in support for handling varying
1045: dependencies, such as pthreads and X11, and extended
1046: features such as IPv6 support on a range of platforms.</p>
1047:
1048: <p>pkgsrc was derived from FreeBSD's ports system, and
1049: initially developed for NetBSD only. Since then, pkgsrc has
1050: grown a lot, and now supports the following platforms:</p>
1051:
1052: <div class="itemizedlist">
1053: <ul type="disc">
1054: <li>
1055: <p><a href="http://developer.apple.com/darwin/"
1056: target="_top">Darwin</a> (<a href=
1057: "http://www.apple.com/macosx/" target="_top">Mac OS
1058: X</a>)</p>
1059: </li>
1060:
1061: <li>
1.3 hubertf 1062: <p><a href="http://www.DragonFlyBSD.org/" target=
1063: "_top">DragonFlyBSD</a></p>
1064: </li>
1065:
1066: <li>
1.1 grant 1067: <p><a href="http://www.FreeBSD.org/" target=
1068: "_top">FreeBSD</a></p>
1069: </li>
1070:
1071: <li>
1.3 hubertf 1072: <p>Microsoft Windows, via <a href=
1073: "http://www.microsoft.com/windows/sfu/" target=
1074: "_top">Interix</a></p>
1.1 grant 1075: </li>
1076:
1077: <li>
1078: <p><a href="http://www.sgi.com/software/irix6.5/"
1079: target="_top">IRIX</a></p>
1080: </li>
1081:
1082: <li>
1083: <p><a href="http://www.linux.org/" target=
1084: "_top">Linux</a></p>
1085: </li>
1086:
1087: <li>
1088: <p><a href="http://www.NetBSD.org/" target=
1089: "_top">NetBSD</a> (of course)</p>
1090: </li>
1091:
1092: <li>
1.17 sketch 1093: <p><a href="http://h30097.www3.hp.com/" target=
1094: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1095: </li>
1096:
1097: <li>
1.1 grant 1098: <p><a href="http://www.openbsd.org/" target=
1099: "_top">OpenBSD</a></p>
1100: </li>
1101:
1102: <li>
1103: <p><a href="http://www.sun.com/solaris/" target=
1104: "_top">Solaris</a></p>
1105: </li>
1106: </ul>
1107: </div>
1108: </div>
1109:
1110: <div class="sect1" lang="en" xml:lang="en">
1111: <div class="titlepage">
1112: <div>
1113: <div>
1114: <h2 class="title" style="clear: both"><a name=
1115: "overview" id="overview"></a>1.2. Overview</h2>
1116: </div>
1117: </div>
1118: </div>
1119:
1120: <p>This document is divided into two parts. The first,
1121: <a href="#users-guide" title=
1.2 hubertf 1122: "Part I. The pkgsrc user's guide">The pkgsrc
1123: user's guide</a>, describes how one can use one of the
1124: packages in the Package Collection, either by installing a
1125: precompiled binary package, or by building one's own copy
1126: using the NetBSD package system. The second part, <a href=
1.1 grant 1127: "#developers-guide" title=
1.2 hubertf 1128: "Part II. The pkgsrc developer's guide">The
1129: pkgsrc developer's guide</a>, explains how to prepare a
1130: package so it can be easily built by other NetBSD users
1131: without knowing about the package's building details.</p>
1.1 grant 1132:
1133: <p>This document is available in various formats:</p>
1134:
1135: <div class="itemizedlist">
1136: <ul type="disc">
1137: <li>
1138: <p><a href="index.html" target="_top">HTML</a></p>
1139: </li>
1140:
1141: <li>
1142: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1143: </li>
1144:
1145: <li>
1146: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1147: </li>
1148:
1149: <li>
1150: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1151: </li>
1152: </ul>
1153: </div>
1154: </div>
1155:
1156: <div class="sect1" lang="en" xml:lang="en">
1157: <div class="titlepage">
1158: <div>
1159: <div>
1160: <h2 class="title" style="clear: both"><a name=
1161: "terminology" id=
1162: "terminology"></a>1.3. Terminology</h2>
1163: </div>
1164: </div>
1165: </div>
1166:
1167: <p>There has been a lot of talk about “<span class=
1168: "quote">ports</span>”, “<span class=
1169: "quote">packages</span>”, etc. so far. Here is a
1170: description of all the terminology used within this
1171: document.</p>
1172:
1173: <div class="variablelist">
1174: <dl>
1175: <dt><span class="term">Package</span></dt>
1176:
1177: <dd>
1178: <p>A set of files and building instructions that
1179: describe what's necessary to build a certain piece of
1180: software using pkgsrc. Packages are traditionally
1.14 xtraeme 1181: stored under <code class=
1182: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1183: </dd>
1184:
1185: <dt><span class="term">The NetBSD package
1186: system</span></dt>
1187:
1188: <dd>
1189: <p>This is the former name of “<span class=
1190: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1191: NetBSD operating system and can be bootstrapped to
1192: run on non-NetBSD operating systems as well. It
1193: handles building (compiling), installing, and
1194: removing of packages.</p>
1.1 grant 1195: </dd>
1196:
1197: <dt><span class="term">Distfile</span></dt>
1198:
1199: <dd>
1200: <p>This term describes the file or files that are
1201: provided by the author of the piece of software to
1202: distribute his work. All the changes necessary to
1203: build on NetBSD are reflected in the corresponding
1204: package. Usually the distfile is in the form of a
1205: compressed tar-archive, but other types are possible,
1.14 xtraeme 1206: too. Distfiles are usually stored below <code class=
1207: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1208: </dd>
1209:
1210: <dt><span class="term">Port</span></dt>
1211:
1212: <dd>
1213: <p>This is the term used by FreeBSD and OpenBSD
1214: people for what we call a package. In NetBSD
1215: terminology, “<span class=
1216: "quote">port</span>” refers to a different
1217: architecture.</p>
1218: </dd>
1219:
1220: <dt><span class="term">Precompiled/binary
1221: package</span></dt>
1222:
1223: <dd>
1224: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1225: distfile and stuffed together in a single
1226: <code class="filename">.tgz</code> file so it can be
1227: installed on machines of the same machine
1228: architecture without the need to recompile. Packages
1229: are usually generated in <code class=
1230: "filename">/usr/pkgsrc/packages</code>; there is also
1231: an archive on <a href=
1.1 grant 1232: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1233: "_top">ftp.NetBSD.org</a>.</p>
1234:
1235: <p>Sometimes, this is referred to by the term
1236: “<span class="quote">package</span>” too,
1237: especially in the context of precompiled
1238: packages.</p>
1239: </dd>
1240:
1241: <dt><span class="term">Program</span></dt>
1242:
1243: <dd>
1244: <p>The piece of software to be installed which will
1245: be constructed from all the files in the Distfile by
1246: the actions defined in the corresponding package.</p>
1247: </dd>
1248: </dl>
1249: </div>
1250: </div>
1251:
1252: <div class="sect1" lang="en" xml:lang="en">
1253: <div class="titlepage">
1254: <div>
1255: <div>
1256: <h2 class="title" style="clear: both"><a name=
1257: "typography" id=
1258: "typography"></a>1.4. Typography</h2>
1259: </div>
1260: </div>
1261: </div>
1262:
1263: <p>When giving examples for commands, shell prompts are
1264: used to show if the command should/can be issued as root,
1265: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1266: privileges are sufficient. We use a <code class=
1267: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1268: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1269: assuming they use the C-shell or tcsh.</p>
1.1 grant 1270: </div>
1271: </div>
1272:
1273: <div class="part" lang="en" xml:lang="en">
1274: <div class="titlepage">
1275: <div>
1276: <div>
1277: <h1 class="title"><a name="users-guide" id=
1.2 hubertf 1278: "users-guide"></a>The pkgsrc user's guide</h1>
1.1 grant 1279: </div>
1280: </div>
1281: </div>
1282:
1283: <div class="toc">
1284: <p><b>Table of Contents</b></p>
1285:
1286: <dl>
1287: <dt><span class="chapter"><a href="#getting">2. Where to
1288: get pkgsrc</a></span></dt>
1289:
1290: <dd>
1291: <dl>
1.30 wiz 1292: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1293: As tar file</a></span></dt>
1.1 grant 1294:
1.30 wiz 1295: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1296: SUP</a></span></dt>
1297:
1.30 wiz 1298: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1299: CVS</a></span></dt>
1300: </dl>
1301: </dd>
1302:
1303: <dt><span class="chapter"><a href="#platforms">3. Using
1304: pkgsrc on systems other than NetBSD</a></span></dt>
1305:
1306: <dd>
1307: <dl>
1.30 wiz 1308: <dt><span class="sect1"><a href=
1309: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1310: pkgsrc</a></span></dt>
1.1 grant 1311:
1.30 wiz 1312: <dt><span class="sect1"><a href=
1313: "#platform-specific-notes">3.2. Platform specific
1314: notes</a></span></dt>
1.1 grant 1315:
1316: <dd>
1317: <dl>
1.30 wiz 1318: <dt><span class="sect2"><a href="#darwin">3.2.1.
1319: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1320:
1.30 wiz 1321: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1322: FreeBSD</a></span></dt>
1.22 tv 1323:
1.30 wiz 1324: <dt><span class="sect2"><a href="#interix">3.2.3.
1325: Interix</a></span></dt>
1.1 grant 1326:
1.30 wiz 1327: <dt><span class="sect2"><a href="#irix">3.2.4.
1328: IRIX</a></span></dt>
1.1 grant 1329:
1.30 wiz 1330: <dt><span class="sect2"><a href="#linux">3.2.5.
1331: Linux</a></span></dt>
1.1 grant 1332:
1.30 wiz 1333: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1334: OpenBSD</a></span></dt>
1.1 grant 1335:
1.30 wiz 1336: <dt><span class="sect2"><a href="#solaris">3.2.7.
1337: Solaris</a></span></dt>
1.1 grant 1338: </dl>
1339: </dd>
1340: </dl>
1341: </dd>
1342:
1343: <dt><span class="chapter"><a href="#using">4. Using
1344: pkgsrc</a></span></dt>
1345:
1346: <dd>
1347: <dl>
1348: <dt><span class="sect1"><a href=
1349: "#getting-started">4.1. Working with binary
1350: packages</a></span></dt>
1351:
1352: <dd>
1353: <dl>
1354: <dt><span class="sect2"><a href=
1.30 wiz 1355: "#where-to-get-binary-packages">4.1.1. Where to
1356: get binary packages</a></span></dt>
1.1 grant 1357:
1358: <dt><span class="sect2"><a href=
1.30 wiz 1359: "#how-to-use-binary-packages">4.1.2. How to use
1360: binary packages</a></span></dt>
1.1 grant 1361:
1362: <dt><span class="sect2"><a href=
1.30 wiz 1363: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1364: warning</a></span></dt>
1365: </dl>
1366: </dd>
1367:
1.30 wiz 1368: <dt><span class="sect1"><a href=
1369: "#building-packages-from-source">4.2. Building
1370: packages from source</a></span></dt>
1.1 grant 1371:
1372: <dd>
1373: <dl>
1374: <dt><span class="sect2"><a href=
1.30 wiz 1375: "#requirements">4.2.1.
1376: Requirements</a></span></dt>
1.1 grant 1377:
1378: <dt><span class="sect2"><a href=
1.30 wiz 1379: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1380: distfiles</a></span></dt>
1381:
1382: <dt><span class="sect2"><a href=
1.30 wiz 1383: "#how-to-build-and-install">4.2.3. How to build
1384: and install</a></span></dt>
1.1 grant 1385:
1386: <dt><span class="sect2"><a href=
1.30 wiz 1387: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1388: compiler</a></span></dt>
1389: </dl>
1390: </dd>
1391: </dl>
1392: </dd>
1393:
1.38 dillo 1394: <dt><span class="chapter"><a href="#configuring">5.
1395: Configuring pkgsrc</a></span></dt>
1396:
1397: <dd>
1398: <dl>
1399: <dt><span class="sect1"><a href=
1.42 ! dillo 1400: "#selecting-options">5.1. Selecting Build
! 1401: Options</a></span></dt>
1.38 dillo 1402: </dl>
1403: </dd>
1404:
1405: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1406: binary packages</a></span></dt>
1407:
1408: <dd>
1409: <dl>
1.30 wiz 1410: <dt><span class="sect1"><a href=
1.38 dillo 1411: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1412: single binary package</a></span></dt>
1.1 grant 1413:
1.30 wiz 1414: <dt><span class="sect1"><a href=
1.38 dillo 1415: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1416: Settings for creation of binary
1417: packages</a></span></dt>
1418:
1.38 dillo 1419: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1420: Doing a bulk build of all packages</a></span></dt>
1421:
1422: <dd>
1423: <dl>
1424: <dt><span class="sect2"><a href=
1.38 dillo 1425: "#binary.configuration">6.3.1.
1.1 grant 1426: Configuration</a></span></dt>
1427:
1428: <dt><span class="sect2"><a href=
1.38 dillo 1429: "#other-environmental-considerations">6.3.2.
1.30 wiz 1430: Other environmental
1.1 grant 1431: considerations</a></span></dt>
1432:
1433: <dt><span class="sect2"><a href=
1.38 dillo 1434: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1435:
1436: <dt><span class="sect2"><a href=
1.38 dillo 1437: "#what-it-does">6.3.4. What it
1.30 wiz 1438: does</a></span></dt>
1.1 grant 1439:
1440: <dt><span class="sect2"><a href=
1.38 dillo 1441: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1442: requirements</a></span></dt>
1443:
1444: <dt><span class="sect2"><a href=
1.38 dillo 1445: "#setting-up-a-sandbox">6.3.6. Setting up a
1.30 wiz 1446: sandbox for chroot'ed builds</a></span></dt>
1.1 grant 1447:
1448: <dt><span class="sect2"><a href=
1.38 dillo 1449: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1450: partial set of packages</a></span></dt>
1.13 hubertf 1451:
1452: <dt><span class="sect2"><a href=
1.38 dillo 1453: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1454: build</a></span></dt>
1.1 grant 1455: </dl>
1456: </dd>
1457:
1.30 wiz 1458: <dt><span class="sect1"><a href=
1.38 dillo 1459: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1460: packages collection</a></span></dt>
1.1 grant 1461:
1462: <dd>
1463: <dl>
1464: <dt><span class="sect2"><a href=
1.38 dillo 1465: "#cdpack-example">6.4.1. Example of
1.1 grant 1466: cdpack</a></span></dt>
1467: </dl>
1468: </dd>
1469: </dl>
1470: </dd>
1471:
1.38 dillo 1472: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1473: Asked Questions</a></span></dt>
1474:
1475: <dd>
1476: <dl>
1.30 wiz 1477: <dt><span class="sect1"><a href=
1.38 dillo 1478: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1479: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1480:
1.38 dillo 1481: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1482: Where's the pkgviews documentation?</a></span></dt>
1483:
1.38 dillo 1484: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1485: Utilities for package management
1486: (pkgtools)</a></span></dt>
1487:
1.30 wiz 1488: <dt><span class="sect1"><a href=
1.38 dillo 1489: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1490: non-root</a></span></dt>
1.1 grant 1491:
1.30 wiz 1492: <dt><span class="sect1"><a href=
1.38 dillo 1493: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1494: fetching distfiles?</a></span></dt>
1.14 xtraeme 1495:
1.30 wiz 1496: <dt><span class="sect1"><a href=
1.38 dillo 1497: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1498: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1499:
1.30 wiz 1500: <dt><span class="sect1"><a href=
1.38 dillo 1501: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1502: from pkgsrc?</a></span></dt>
1.1 grant 1503:
1.30 wiz 1504: <dt><span class="sect1"><a href=
1.38 dillo 1505: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1506: behind a firewall</a></span></dt>
1.1 grant 1507:
1.38 dillo 1508: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1509: How do I tell <span><strong class="command">make
1.14 xtraeme 1510: fetch</strong></span> to do passive
1.1 grant 1511: FTP?</a></span></dt>
1512:
1.30 wiz 1513: <dt><span class="sect1"><a href=
1.38 dillo 1514: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1515: distfiles at once</a></span></dt>
1.1 grant 1516:
1.30 wiz 1517: <dt><span class="sect1"><a href=
1.38 dillo 1518: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1519: “<span class="quote">Don't know how to make
1520: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1521: mean?</a></span></dt>
1.13 hubertf 1522:
1.30 wiz 1523: <dt><span class="sect1"><a href=
1.38 dillo 1524: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1525: “<span class="quote">Could not find
1.14 xtraeme 1526: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1527:
1.30 wiz 1528: <dt><span class="sect1"><a href=
1.38 dillo 1529: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1530: pkgsrc</a></span></dt>
1.1 grant 1531:
1.38 dillo 1532: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1533: do I change the location of configuration
1534: files?</a></span></dt>
1.1 grant 1535:
1536: <dt><span class="sect1"><a href=
1.38 dillo 1537: "#audit-packages">7.15. Automated security
1.1 grant 1538: checks</a></span></dt>
1539: </dl>
1540: </dd>
1541: </dl>
1542: </div>
1543:
1544: <div class="chapter" lang="en" xml:lang="en">
1545: <div class="titlepage">
1546: <div>
1547: <div>
1548: <h2 class="title"><a name="getting" id=
1549: "getting"></a>Chapter 2. Where to get
1550: pkgsrc</h2>
1551: </div>
1552: </div>
1553: </div>
1554:
1555: <div class="toc">
1556: <p><b>Table of Contents</b></p>
1557:
1558: <dl>
1.30 wiz 1559: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1560: tar file</a></span></dt>
1561:
1.30 wiz 1562: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1563: SUP</a></span></dt>
1564:
1.30 wiz 1565: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1566: CVS</a></span></dt>
1567: </dl>
1568: </div>
1569:
1570: <p>There are three ways to get pkgsrc. Either as a tar
1571: file, via SUP, or via CVS. All three ways are described
1572: here.</p>
1573:
1574: <div class="sect1" lang="en" xml:lang="en">
1575: <div class="titlepage">
1576: <div>
1577: <div>
1578: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1579: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1.1 grant 1580: file</h2>
1581: </div>
1582: </div>
1583: </div>
1584:
1585: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1586: file from <a href=
1.11 ben 1587: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1588: target="_top">ftp.NetBSD.org</a> and unpack it into
1589: <code class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1590: </div>
1591:
1592: <div class="sect1" lang="en" xml:lang="en">
1593: <div class="titlepage">
1594: <div>
1595: <div>
1596: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1597: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1598: </div>
1599: </div>
1600: </div>
1601:
1602: <p>As an alternative to the tar file, you can get pkgsrc
1603: via the Software Update Protocol, SUP. To do so, make
1604: sure your supfile has a line</p>
1605: <pre class="programlisting">
1606: release=pkgsrc
1607: </pre>
1608:
1.14 xtraeme 1609: <p>in it, see the examples in <code class=
1610: "filename">/usr/share/examples/supfiles</code>, and that
1611: the <code class="filename">/usr/pkgsrc</code> directory
1612: exists. Then, simply run <span><strong class=
1613: "command">sup -v <em class=
1614: "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1615: </div>
1616:
1617: <div class="sect1" lang="en" xml:lang="en">
1618: <div class="titlepage">
1619: <div>
1620: <div>
1621: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1622: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1623: </div>
1624: </div>
1625: </div>
1626:
1627: <p>To get pkgsrc via CVS, make sure you have
1628: “<span class="quote">cvs</span>” installed.
1.27 rillig 1629: To do an initial (full) checkout of pkgsrc, do the
1630: following steps:</p>
1.1 grant 1631: <pre class="screen">
1.14 xtraeme 1632: <code class="prompt">%</code> <strong class=
1633: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1634: <code class="prompt">%</code> <strong class=
1635: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1636: <code class="prompt">%</code> <strong class=
1637: "userinput"><code>cd /usr</code></strong>
1638: <code class="prompt">%</code> <strong class=
1639: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1640: </pre>
1641:
1642: <p>This will create the <code class=
1643: "filename">pkgsrc</code> directory in your <code class=
1644: "filename">/usr</code>, and all the package source will
1645: be stored under <code class=
1646: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1647: initial checkout, make sure you have <code class=
1648: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1649: <pre class="screen">
1.14 xtraeme 1650: <code class="prompt">%</code> <strong class=
1651: "userinput"><code>cd /usr/pkgsrc</code></strong>
1652: <code class="prompt">%</code> <strong class=
1653: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1654: </pre>
1655:
1656: <p>Please also note that it is possible to have multiple
1657: copies of the pkgsrc hierarchy in use at any one time -
1658: all work is done relatively within the pkgsrc tree.</p>
1659: </div>
1660: </div>
1661:
1662: <div class="chapter" lang="en" xml:lang="en">
1663: <div class="titlepage">
1664: <div>
1665: <div>
1666: <h2 class="title"><a name="platforms" id=
1667: "platforms"></a>Chapter 3. Using pkgsrc on
1668: systems other than NetBSD</h2>
1669: </div>
1670: </div>
1671: </div>
1672:
1673: <div class="toc">
1674: <p><b>Table of Contents</b></p>
1675:
1676: <dl>
1.30 wiz 1677: <dt><span class="sect1"><a href=
1678: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1679: pkgsrc</a></span></dt>
1.1 grant 1680:
1.30 wiz 1681: <dt><span class="sect1"><a href=
1682: "#platform-specific-notes">3.2. Platform specific
1683: notes</a></span></dt>
1.1 grant 1684:
1685: <dd>
1686: <dl>
1.30 wiz 1687: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1688: Darwin (Mac OS X)</a></span></dt>
1689:
1.30 wiz 1690: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1691: FreeBSD</a></span></dt>
1692:
1.30 wiz 1693: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1694: Interix</a></span></dt>
1695:
1.30 wiz 1696: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1697: IRIX</a></span></dt>
1698:
1.30 wiz 1699: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1700: Linux</a></span></dt>
1701:
1.30 wiz 1702: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1703: OpenBSD</a></span></dt>
1704:
1.30 wiz 1705: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1706: Solaris</a></span></dt>
1707: </dl>
1708: </dd>
1709: </dl>
1710: </div>
1711:
1712: <div class="sect1" lang="en" xml:lang="en">
1713: <div class="titlepage">
1714: <div>
1715: <div>
1716: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1717: "bootstrapping-pkgsrc" id=
1718: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1719: pkgsrc</h2>
1.1 grant 1720: </div>
1721: </div>
1722: </div>
1723:
1.27 rillig 1724: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1725: bootstrap kit to build the required tools to use pkgsrc
1726: on your platform. Besides support for native NetBSD,
1727: pkgsrc and the bootstrap kit have support for the
1728: following operating systems:</p>
1729:
1730: <div class="itemizedlist">
1731: <ul type="disc">
1732: <li>
1733: <p>Darwin (Mac OS X)</p>
1734: </li>
1735:
1736: <li>
1.16 grant 1737: <p>DragonFlyBSD</p>
1738: </li>
1739:
1740: <li>
1.1 grant 1741: <p>FreeBSD</p>
1742: </li>
1743:
1744: <li>
1745: <p>Interix (Windows 2000, XP, 2003)</p>
1746: </li>
1747:
1748: <li>
1749: <p>IRIX</p>
1750: </li>
1751:
1752: <li>
1753: <p>Linux</p>
1754: </li>
1755:
1756: <li>
1757: <p>OpenBSD</p>
1758: </li>
1759:
1760: <li>
1761: <p>Solaris</p>
1762: </li>
1.16 grant 1763:
1764: <li>
1765: <p>Tru64 (Digital UNIX/OSF1)</p>
1766: </li>
1.1 grant 1767: </ul>
1768: </div>
1769:
1770: <p>Support for other platforms is under development.</p>
1771:
1772: <p>Installing the bootstrap kit should be as simple
1773: as:</p>
1774: <pre class="screen">
1.14 xtraeme 1775: <code class="prompt">#</code> <strong class=
1776: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1777: <code class="prompt">#</code> <strong class=
1778: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1779: <code class="prompt">#</code> <strong class=
1780: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1781: </pre>
1782:
1783: <p>See <a href="#getting" title=
1784: "Chapter 2. Where to get pkgsrc">Chapter 2,
1785: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1786: pkgsrc before bootstrapping. The given
1787: <span><strong class="command">bootstrap</strong></span>
1788: command will use the defaults of <code class=
1789: "filename">/usr/pkg</code> for the <span class=
1790: "emphasis"><em>prefix</em></span> where programs will be
1791: installed in, and <code class=
1792: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1793: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1794: However, these can also be set using command-line
1.27 rillig 1795: arguments.</p>
1.1 grant 1796:
1797: <p>Binary packages for the pkgsrc tools and an initial
1798: set of packages is available for supported platforms. An
1799: up-to-date list of these can be found on <a href=
1800: "http://www.pkgsrc.org/" target=
1801: "_top">www.pkgsrc.org</a>.</p>
1802: </div>
1803:
1804: <div class="sect1" lang="en" xml:lang="en">
1805: <div class="titlepage">
1806: <div>
1807: <div>
1808: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1809: "platform-specific-notes" id=
1810: "platform-specific-notes"></a>3.2. Platform
1.1 grant 1811: specific notes</h2>
1812: </div>
1813: </div>
1814: </div>
1815:
1816: <p>Here are some platform-specific notes you should be
1817: aware of.</p>
1818:
1819: <div class="sect2" lang="en" xml:lang="en">
1820: <div class="titlepage">
1821: <div>
1822: <div>
1.30 wiz 1823: <h3 class="title"><a name="darwin" id=
1824: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1825: </div>
1826: </div>
1827: </div>
1828:
1829: <p>Darwin 5.x and 6.x are supported. There are two
1830: methods of using pkgsrc on Mac OS X, by using a
1831: <a href="#platform.osx-image" title=
1832: "3.2.1.1. Using a disk image">disk image</a>, or a
1833: <a href="#platform.osx-ufs" title=
1834: "3.2.1.2. Using a UFS partition">UFS
1835: partition</a>.</p>
1836:
1837: <p>Before you start, you will need to download and
1838: install the Mac OS X Developer Tools from Apple's
1839: Developer Connection. See <a href=
1840: "http://developer.apple.com/macosx/" target=
1841: "_top">http://developer.apple.com/macosx/</a> for
1842: details. Also, make sure you install X11 for Mac OS X
1843: and the X11 SDK from <a href=
1844: "http://www.apple.com/macosx/x11/download/" target=
1845: "_top">http://www.apple.com/macosx/x11/download/</a> if
1846: you intend to build packages that use the X11 Window
1847: System.</p>
1848:
1849: <p>If you already have a UFS partition, or have a spare
1850: partition that you can format as UFS, it is recommended
1851: to use that instead of the disk image. It'll be
1852: somewhat faster and will mount automatically at boot
1853: time, where you must manually mount a disk image.</p>
1854:
1855: <div class="note" style=
1856: "margin-left: 0.5in; margin-right: 0.5in;">
1857: <h3 class="title">Note</h3>
1858:
1859: <p>You cannot use a HFS+ file system for pkgsrc,
1860: because pkgsrc currently requires the filesystem to
1861: be case-sensitive, and HFS+ is not.</p>
1862: </div>
1863:
1864: <div class="sect3" lang="en" xml:lang="en">
1865: <div class="titlepage">
1866: <div>
1867: <div>
1868: <h4 class="title"><a name="platform.osx-image"
1869: id="platform.osx-image"></a>3.2.1.1. Using
1870: a disk image</h4>
1871: </div>
1872: </div>
1873: </div>
1874:
1875: <p>Create the disk image:</p>
1876: <pre class="screen">
1.14 xtraeme 1877: <code class="prompt">#</code> <strong class=
1878: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1879: <code class="prompt">#</code> <strong class=
1880: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1881: <code class="prompt">#</code> <strong class=
1882: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1883: <code class="prompt">#</code> <strong class=
1884: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1885: </pre>
1886:
1887: <p>That's it!</p>
1888: </div>
1889:
1890: <div class="sect3" lang="en" xml:lang="en">
1891: <div class="titlepage">
1892: <div>
1893: <div>
1894: <h4 class="title"><a name="platform.osx-ufs"
1895: id="platform.osx-ufs"></a>3.2.1.2. Using a
1896: UFS partition</h4>
1897: </div>
1898: </div>
1899: </div>
1900:
1.14 xtraeme 1901: <p>By default, <code class="filename">/usr</code>
1902: will be on your root file system, normally HFS+. It
1903: is possible to use the default <span class=
1904: "emphasis"><em>prefix</em></span> of <code class=
1905: "filename">/usr/pkg</code> by symlinking <code class=
1906: "filename">/usr/pkg</code> to a directory on a UFS
1907: file system. Obviously, another symlink is required
1908: if you want to place the package database directory
1909: outside the <span class=
1910: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1911: <pre class="screen">
1.14 xtraeme 1912: <code class="prompt">#</code> <strong class=
1.22 tv 1913: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1914: </pre>
1915:
1916: <p>If you created your partitions at the time of
1917: installing Mac OS X and formatted the target
1918: partition as UFS, it should automatically mount on
1.14 xtraeme 1919: <code class="filename">/Volumes/<volume
1920: name></code> when the machine boots. If you are
1.1 grant 1921: (re)formatting a partition as UFS, you need to ensure
1922: that the partition map correctly reflects
1923: “<span class="quote">Apple_UFS</span>”
1924: and not “<span class=
1925: "quote">Apple_HFS</span>”.</p>
1926:
1927: <p>The problem is that none of the disk tools will
1928: let you touch a disk that is booted from. You can
1929: unmount the partition, but even if you newfs it, the
1930: partition type will be incorrect and the automounter
1931: won't mount it. It can be mounted manually, but it
1932: won't appear in Finder.</p>
1933:
1934: <p>You'll need to boot off of the OS X Installation
1935: (User) CD. When the Installation program starts, go
1936: up to the menu and select Disk Utility. Now, you will
1937: be able to select the partition you want to be UFS,
1938: and Format it Apple UFS. Quit the Disk Utility, quit
1939: the installer which will reboot your machine. The new
1940: UFS file system will appear in Finder.</p>
1941:
1942: <p>Be aware that the permissions on the new file
1943: system will be writable by root only.</p>
1944:
1945: <p>This note is as of 10.2 (Jaguar) and applies to
1946: earlier versions. Hopefully Apple will fix Disk
1947: Utility in 10.3 (Panther).</p>
1948: </div>
1949: </div>
1950:
1951: <div class="sect2" lang="en" xml:lang="en">
1952: <div class="titlepage">
1953: <div>
1954: <div>
1.30 wiz 1955: <h3 class="title"><a name="freebsd" id=
1956: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 1957: </div>
1958: </div>
1959: </div>
1960:
1961: <p>FreeBSD 4.7 and 5.0 have been tested and are
1962: supported, other versions may work.</p>
1963:
1964: <p>Care should be taken so that the tools that this kit
1965: installs do not conflict with the FreeBSD userland
1966: tools. There are several steps:</p>
1967:
1968: <div class="orderedlist">
1969: <ol type="1">
1970: <li>
1971: <p>FreeBSD stores its ports pkg database in
1.14 xtraeme 1972: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 1973: therefore recommended that you choose a different
1.14 xtraeme 1974: location (e.g. <code class=
1975: "filename">/usr/pkgdb</code>) by using the
1.1 grant 1976: --pkgdbdir option to the bootstrap script.</p>
1977: </li>
1978:
1979: <li>
1980: <p>If you do not intend to use the FreeBSD ports
1981: tools, it's probably a good idea to move them out
1982: of the way to avoid confusion, e.g.</p>
1983: <pre class="screen">
1.14 xtraeme 1984: <code class="prompt">#</code> <strong class=
1985: "userinput"><code>cd /usr/sbin</code></strong>
1986: <code class="prompt">#</code> <strong class=
1987: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
1988: <code class="prompt">#</code> <strong class=
1989: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
1990: <code class="prompt">#</code> <strong class=
1991: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
1992: <code class="prompt">#</code> <strong class=
1993: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 1994: </pre>
1995: </li>
1996:
1997: <li>
1.14 xtraeme 1998: <p>An example <code class=
1999: "filename">/etc/mk.conf</code> file will be
2000: placed in <code class=
2001: "filename">/etc/mk.conf.example</code> file when
2002: you use the bootstrap script.</p>
1.1 grant 2003: </li>
2004: </ol>
2005: </div>
2006: </div>
2007:
2008: <div class="sect2" lang="en" xml:lang="en">
2009: <div class="titlepage">
2010: <div>
2011: <div>
1.30 wiz 2012: <h3 class="title"><a name="interix" id=
2013: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2014: </div>
2015: </div>
2016: </div>
2017:
2018: <p>Interix is a POSIX compatible subsystem for the
2019: Windows NT kernel, providing a Unix-like environment
2020: with a tighter kernel integration than available with
2021: Cygwin. It is part of the Windows Services for Unix
2022: package, available for free for any licensed copy of
1.22 tv 2023: Windows 2000, XP (not including XP Home), or 2003. SFU
2024: can be downloaded from <a href=
2025: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2026: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2027:
2028: <p>Services for Unix 3.5, current as of this writing,
2029: has been tested. 3.0 or 3.1 may work, but are not
2030: officially supported. (The main difference in 3.0/3.1
2031: is lack of pthreads.)</p>
2032:
2033: <div class="sect3" lang="en" xml:lang="en">
2034: <div class="titlepage">
2035: <div>
2036: <div>
2037: <h4 class="title"><a name=
2038: "platform.interix-sfu-install" id=
2039: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2040: installing Interix/SFU</h4>
1.1 grant 2041: </div>
2042: </div>
2043: </div>
2044:
2045: <p>At an absolute minimum, the following packages
2046: must be installed from the Windows Services for Unix
2047: 3.5 distribution in order to use pkgsrc:</p>
2048:
2049: <div class="itemizedlist">
2050: <ul type="disc">
2051: <li>
2052: <p>Utilities -> Base Utilities</p>
2053: </li>
2054:
2055: <li>
2056: <p>Interix GNU Components -> (all)</p>
2057: </li>
2058:
2059: <li>
2060: <p>Remote Connectivity</p>
2061: </li>
2062:
2063: <li>
2064: <p>Interix SDK</p>
2065: </li>
2066: </ul>
2067: </div>
2068:
2069: <p>When using pkgsrc on Interix, DO NOT install the
2070: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2071: without shared module support, installed to
2072: /usr/local, and will only cause confusion. Instead,
2073: install Perl 5.8 from pkgsrc (or from a binary
2074: package).</p>
2075:
2076: <p>The Remote Connectivity subcomponent "Windows
2077: Remote Shell Service" does not need to be installed,
2078: but Remote Connectivity itself should be installed in
2079: order to have a working inetd.</p>
2080:
2081: <p>Finally, during installation you may be asked
2082: whether to enable setuid behavior for Interix
2083: programs, and whether to make pathnames default to
2084: case-sensitive. Setuid should be enabled, and
2085: case-sensitivity MUST be enabled. (Without
2086: case-sensitivity, a large number of packages
2087: including perl will not build.)</p>
2088: </div>
2089:
2090: <div class="sect3" lang="en" xml:lang="en">
2091: <div class="titlepage">
2092: <div>
2093: <div>
2094: <h4 class="title"><a name=
2095: "platform.interix-sfu-postinstall" id=
2096: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2097: to do if Interix/SFU is already installed</h4>
2098: </div>
2099: </div>
2100: </div>
2101:
2102: <p>If SFU is already installed and you wish to alter
2103: these settings to work with pkgsrc, note the
2104: following things.</p>
2105:
2106: <div class="itemizedlist">
2107: <ul type="disc">
2108: <li>
2109: <p>To uninstall UNIX Perl, use Add/Remove
2110: Programs, select Microsoft Windows Services for
2111: UNIX, then click Change. In the installer,
2112: choose Add or Remove, then uncheck
2113: Utilities->UNIX Perl.</p>
2114: </li>
2115:
2116: <li>
2117: <p>To enable case-sensitivity for the
2118: filesystem, run REGEDIT.EXE, and change the
2119: following registry key:</p>
2120:
2121: <p>
2122: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2123: Manager\kernel</p>
2124:
2125: <p>Set the DWORD value "obcaseinsensitive" to
2126: 0; then reboot.</p>
2127: </li>
2128:
2129: <li>
2130: <p>To enable setuid binaries (optional), run
2131: REGEDIT.EXE, and change the following registry
2132: key:</p>
2133:
2134: <p>
2135: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2136: for UNIX</p>
2137:
2138: <p>Set the DWORD value "EnableSetuidBinaries"
2139: to 1; then reboot.</p>
2140: </li>
2141: </ul>
2142: </div>
2143: </div>
2144:
2145: <div class="sect3" lang="en" xml:lang="en">
2146: <div class="titlepage">
2147: <div>
2148: <div>
2149: <h4 class="title"><a name=
2150: "platform.interix-notes" id=
2151: "platform.interix-notes"></a>3.2.3.3. Important
2152: notes for using pkgsrc</h4>
2153: </div>
2154: </div>
2155: </div>
2156:
2157: <p>The package imanager (either the pkgsrc "su" user,
2158: or the user running "pkg_add") must be a member of
2159: the local Administrators group. Such a user must also
2160: be used to run the bootstrap. This is slightly
2161: relaxed from the normal pkgsrc requirement of
2162: "root".</p>
2163:
2164: <p>The package manager should use a umask of 002.
2165: "make install" will automatically complain if this is
2166: not the case. This ensures that directories written
2167: in /var/db/pkg are Administrators-group
2168: writeable.</p>
2169:
2170: <p>The popular Interix binary packages from
2171: http://www.interopsystems.com/ use an older version
2172: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2173: used in conjunction with pkgsrc. If you choose to use
2174: them at the same time as the pkgsrc packages, ensure
2175: that you use the proper pkg_* tools for each type of
2176: binary package.</p>
1.22 tv 2177:
2178: <p>The TERM setting used for DOS-type console windows
2179: (including those invoked by the csh and ksh startup
2180: shortcuts) is "interix". Most systems don't have a
2181: termcap/terminfo entry for it, but the following
2182: .termcap entry provides adequate emulation in most
2183: cases:</p>
2184: <pre class="programlisting">
2185: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
2186: </pre>
1.1 grant 2187: </div>
2188: </div>
2189:
2190: <div class="sect2" lang="en" xml:lang="en">
2191: <div class="titlepage">
2192: <div>
2193: <div>
1.30 wiz 2194: <h3 class="title"><a name="irix" id=
2195: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2196: </div>
2197: </div>
2198: </div>
2199:
2200: <p>You will need a working C compiler, either gcc or
2201: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2202: the <code class="varname">CC</code> environment
2203: variable according to your preference. If you do not
2204: have a license for the MIPSpro compiler suite, you can
1.1 grant 2205: download a gcc tardist file from <a href=
2206: "http://freeware.sgi.com/" target=
2207: "_top">http://freeware.sgi.com/</a>.</p>
2208:
2209: <p>Please note that you will need IRIX 6.5.17 or
2210: higher, as this is the earliest version of IRIX
1.24 wiz 2211: providing support for <a href=
2212: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2213: <span class="citerefentry"><span class=
2214: "refentrytitle">if_indextoname</span>(3)</span></a>,
2215: <a href=
2216: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2217: <span class="citerefentry"><span class=
2218: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2219: etc.</p>
1.1 grant 2220:
1.27 rillig 2221: <p>At this point in time, pkgsrc only supports one ABI
2222: at a time. That is, you can not switch between the old
2223: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2224: you start out using "abi=n32", that's what all your
2225: packages will be built with.</p>
1.1 grant 2226:
2227: <p>Therefore, please make sure that you have no
1.14 xtraeme 2228: conflicting <code class="varname">CFLAGS</code> in your
2229: environment or the <code class=
2230: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2231: that you do not try to link n32 object files with lib64
1.14 xtraeme 2232: or vice versa. Check your <code class=
2233: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2234:
2235: <p>If you have the actual pkgsrc tree mounted via NFS
2236: from a different host, please make sure to set
1.14 xtraeme 2237: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2238: directory, as it appears that IRIX linker occasionally
2239: runs into issues when trying to link over a network
2240: mounted filesystem.</p>
2241:
2242: <p>The bootstrapping process should set all the right
2243: options for programs such as imake(1), but you may want
2244: to set some options depending on your local setup.
1.14 xtraeme 2245: Please see <code class=
2246: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2247: course, your compiler's man pages for details.</p>
1.22 tv 2248:
2249: <p>If you are using SGI's MIPSPro compiler, please
2250: set</p>
2251: <pre class="programlisting">
2252: PKGSRC_COMPILER=mipspro
2253: </pre>
2254:
2255: <p>in <code class="filename">/etc/mk.conf</code>.
2256: Otherwise, pkgsrc will assume you are using gcc and may
2257: end up passing invalid flags to the compiler. Note that
2258: bootstrap should create an appropriate <code class=
2259: "filename">mk.conf.example</code> by default.</p>
2260:
2261: <p>If you have both the MIPSPro compiler chain
2262: installed as well as gcc, but want to make sure that
2263: MIPRPro is used, please set your <code class=
2264: "varname">PATH</code> to <span class=
2265: "emphasis"><em>not</em></span> include the location of
2266: gcc (often <code class=
2267: "filename">/usr/freeware/bin</code>), and (important)
2268: pass the '--preserve-path' flag.</p>
1.1 grant 2269: </div>
2270:
2271: <div class="sect2" lang="en" xml:lang="en">
2272: <div class="titlepage">
2273: <div>
2274: <div>
1.30 wiz 2275: <h3 class="title"><a name="linux" id=
2276: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2277: </div>
2278: </div>
2279: </div>
2280:
2281: <p>Some versions of Linux (for example Debian
2282: GNU/Linux) need either libtermcap or libcurses
2283: (libncurses). Installing the distributions
2284: libncurses-dev package (or equivalent) should fix the
2285: problem.</p>
2286:
2287: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2288: and icc (Intel C++ Compiler). gcc is the default. icc
2289: 8.0 and 8.1 on i386 have been tested.</p>
2290:
2291: <p>To bootstrap using icc, assuming the default icc
2292: installation directory:</p>
2293: <pre class="programlisting">
2294: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2295: ac_cv___attribute__=yes ./bootstrap
2296: </pre>
2297:
2298: <div class="note" style=
2299: "margin-left: 0.5in; margin-right: 0.5in;">
2300: <h3 class="title">Note</h3>
2301:
2302: <p>icc 8.1 needs the `-i-static' argument instead of
2303: -static-libcxa.</p>
2304: </div>
2305:
2306: <p>icc supports __attribute__, but the GNU configure
2307: test uses a nested function, which icc does not
2308: support. #undef'ing __attribute__ has the unfortunate
2309: side-effect of breaking many of the Linux header files,
2310: which cannot be compiled properly without
2311: __attribute__. The test must be overridden so that
2312: __attribute__ is assumed supported by the compiler.</p>
2313:
2314: <p>After bootstrapping, you should set <code class=
2315: "varname">PKGSRC_COMPILER</code> in <code class=
2316: "filename">/etc/mk.conf</code>:</p>
2317: <pre class="programlisting">
2318: PKGSRC_COMPILER=icc
2319: </pre>
2320:
2321: <p>The default installation directory for icc is
2322: <code class="filename">/opt/intel_cc_80</code>, which
2323: is also the pkgsrc default. If you have installed it
2324: into a different directory, set <code class=
2325: "varname">ICCBASE</code> in <code class=
2326: "filename">/etc/mk.conf</code>:</p>
2327: <pre class="programlisting">
2328: ICCBASE=/opt/icc
2329: </pre>
2330:
2331: <p>pkgsrc uses the static linking method of the runtime
2332: libraries provided by icc, so binaries can be run on
2333: other systems which do not have the shared libraries
2334: installed.</p>
2335:
2336: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2337: the <a href=
2338: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2339: <span class="citerefentry"><span class=
2340: "refentrytitle">ld</span>(1)</span></a> command run
2341: when linking a C++ shared library and records it,
2342: throwing away the -Bstatic and -Bdynamic options
2343: interspersed between the libraries. This means that
2344: libtool-linked C++ shared libraries will have a runtime
2345: dependency on the icc libraries until this is fixed in
2346: libtool.</p>
1.22 tv 2347: </div>
2348:
2349: <div class="sect2" lang="en" xml:lang="en">
2350: <div class="titlepage">
2351: <div>
2352: <div>
1.30 wiz 2353: <h3 class="title"><a name="openbsd" id=
2354: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2355: </div>
2356: </div>
2357: </div>
2358:
2359: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2360:
2361: <p>Care should be taken so that the tools that this kit
2362: installs do not conflict with the OpenBSD userland
2363: tools. There are several steps:</p>
2364:
2365: <div class="orderedlist">
2366: <ol type="1">
2367: <li>
2368: <p>OpenBSD stores its ports pkg database in
1.14 xtraeme 2369: <code class="filename">/var/db/pkg</code>. It is
1.1 grant 2370: therefore recommended that you choose a different
1.14 xtraeme 2371: location (e.g. <code class=
2372: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2373: --pkgdbdir option to the bootstrap script.</p>
2374: </li>
2375:
2376: <li>
2377: <p>If you do not intend to use the OpenBSD ports
2378: tools, it's probably a good idea to move them out
2379: of the way to avoid confusion, e.g.</p>
2380: <pre class="screen">
1.14 xtraeme 2381: <code class="prompt">#</code> <strong class=
2382: "userinput"><code>cd /usr/sbin</code></strong>
2383: <code class="prompt">#</code> <strong class=
2384: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2385: <code class="prompt">#</code> <strong class=
2386: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2387: <code class="prompt">#</code> <strong class=
2388: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2389: <code class="prompt">#</code> <strong class=
2390: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2391: </pre>
2392: </li>
2393:
2394: <li>
1.14 xtraeme 2395: <p>An example <code class=
2396: "filename">/etc/mk.conf</code> file will be
2397: placed in <code class=
2398: "filename">/etc/mk.conf.example</code> file when
2399: you use the bootstrap script. OpenBSD's make
2400: program uses <code class=
2401: "filename">/etc/mk.conf</code> as well. You can
1.1 grant 2402: work around this by enclosing all the pkgsrc
2403: specific parts of the file with:</p>
2404: <pre class="programlisting">
2405: .ifdef BSD_PKG_MK
1.11 ben 2406: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1 grant 2407: .else
2408: # OpenBSD stuff
2409: .endif
2410: </pre>
2411: </li>
2412: </ol>
2413: </div>
2414: </div>
2415:
2416: <div class="sect2" lang="en" xml:lang="en">
2417: <div class="titlepage">
2418: <div>
2419: <div>
1.30 wiz 2420: <h3 class="title"><a name="solaris" id=
2421: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2422: </div>
2423: </div>
2424: </div>
2425:
2426: <p>Solaris 2.6 through 9 are supported on both x86 and
2427: sparc. You will need a working C compiler. Both gcc
2428: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2429:
2430: <p>The following packages are required on Solaris 8 for
2431: the bootstrap process and to build packages.</p>
2432:
2433: <div class="itemizedlist">
2434: <ul type="disc">
2435: <li>
2436: <p>SUNWsprot</p>
2437: </li>
2438:
2439: <li>
2440: <p>SUNWarc</p>
2441: </li>
2442:
2443: <li>
2444: <p>SUNWbtool</p>
2445: </li>
2446:
2447: <li>
2448: <p>SUNWtoo</p>
2449: </li>
2450:
2451: <li>
2452: <p>SUNWlibm</p>
2453: </li>
2454: </ul>
2455: </div>
2456:
2457: <p>Please note the use of GNU binutils on Solaris is
2458: <span class="emphasis"><em>not</em></span>
2459: supported.</p>
2460:
2461: <div class="sect3" lang="en" xml:lang="en">
2462: <div class="titlepage">
2463: <div>
2464: <div>
1.30 wiz 2465: <h4 class="title"><a name="solaris-gcc-note"
2466: id="solaris-gcc-note"></a>3.2.7.1. If you
2467: are using gcc</h4>
1.1 grant 2468: </div>
2469: </div>
2470: </div>
2471:
2472: <p>It makes life much simpler if you only use the
2473: same gcc consistently for building all packages.</p>
2474:
2475: <p>It is recommended that an external gcc be used
2476: only for bootstrapping, then either build gcc from
2477: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2478: href=
2479: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20 ben 2480: class="pkgname">lang/gcc</a> or install a binary gcc
2481: package, then remove gcc used during
2482: bootstrapping.</p>
1.1 grant 2483:
2484: <p>Binary packages of gcc can be found through
2485: <a href=
2486: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2487: target=
2488: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2489: </div>
2490:
2491: <div class="sect3" lang="en" xml:lang="en">
2492: <div class="titlepage">
2493: <div>
2494: <div>
1.30 wiz 2495: <h4 class="title"><a name=
2496: "solaris-sun-workshop-note" id=
2497: "solaris-sun-workshop-note"></a>3.2.7.2. If
2498: you are using Sun WorkShop</h4>
1.1 grant 2499: </div>
2500: </div>
2501: </div>
2502:
2503: <p>You will need at least the following packages
2504: installed (from WorkShop 5.0)</p>
2505:
2506: <div class="itemizedlist">
2507: <ul type="disc">
2508: <li>
2509: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2510: </li>
2511:
2512: <li>
2513: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2514: </li>
2515:
2516: <li>
2517: <p>SPROild - Sun WorkShop Incremental
2518: Linker</p>
2519: </li>
2520:
2521: <li>
2522: <p>SPROlang - Sun WorkShop Compilers common
2523: components</p>
2524: </li>
2525: </ul>
2526: </div>
2527:
1.14 xtraeme 2528: <p>You should set <code class="varname">CC</code>,
2529: <code class="varname">CXX</code> and optionally,
2530: <code class="varname">CPP</code> in <code class=
2531: "filename">/etc/mk.conf</code>, eg.</p>
1.1 grant 2532: <pre class="programlisting">
1.27 rillig 2533: CC= cc
1.1 grant 2534: CXX= CC
2535: CPP= /usr/ccs/lib/cpp
2536: </pre>
2537:
2538: <p>You may also want to build 64-bit binaries,
2539: eg.</p>
2540: <pre class="programlisting">
2541: CFLAGS= -xtarget=ultra -xarch=v9
2542: </pre>
2543:
2544: <p>Whichever compiler you use, please ensure the
2545: compiler tools and your $prefix are in your
1.14 xtraeme 2546: <code class="varname">PATH</code>. This includes
2547: <code class="filename">/usr/ccs/{bin,lib}</code> and
2548: eg. <code class=
2549: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2550: </div>
2551: </div>
2552: </div>
2553: </div>
2554:
2555: <div class="chapter" lang="en" xml:lang="en">
2556: <div class="titlepage">
2557: <div>
2558: <div>
2559: <h2 class="title"><a name="using" id=
2560: "using"></a>Chapter 4. Using pkgsrc</h2>
2561: </div>
2562: </div>
2563: </div>
2564:
2565: <div class="toc">
2566: <p><b>Table of Contents</b></p>
2567:
2568: <dl>
2569: <dt><span class="sect1"><a href="#getting-started">4.1.
2570: Working with binary packages</a></span></dt>
2571:
2572: <dd>
2573: <dl>
1.30 wiz 2574: <dt><span class="sect2"><a href=
2575: "#where-to-get-binary-packages">4.1.1. Where to get
2576: binary packages</a></span></dt>
1.1 grant 2577:
1.30 wiz 2578: <dt><span class="sect2"><a href=
2579: "#how-to-use-binary-packages">4.1.2. How to use
2580: binary packages</a></span></dt>
1.1 grant 2581:
1.30 wiz 2582: <dt><span class="sect2"><a href=
2583: "#a-word-of-warning">4.1.3. A word of
2584: warning</a></span></dt>
1.1 grant 2585: </dl>
2586: </dd>
2587:
1.30 wiz 2588: <dt><span class="sect1"><a href=
2589: "#building-packages-from-source">4.2. Building packages
2590: from source</a></span></dt>
1.1 grant 2591:
2592: <dd>
2593: <dl>
1.30 wiz 2594: <dt><span class="sect2"><a href=
2595: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2596:
1.30 wiz 2597: <dt><span class="sect2"><a href=
2598: "#fetching-distfiles">4.2.2. Fetching
2599: distfiles</a></span></dt>
1.1 grant 2600:
1.30 wiz 2601: <dt><span class="sect2"><a href=
2602: "#how-to-build-and-install">4.2.3. How to build and
2603: install</a></span></dt>
1.1 grant 2604:
1.30 wiz 2605: <dt><span class="sect2"><a href=
2606: "#selecting-the-compiler">4.2.4. Selecting the
2607: compiler</a></span></dt>
1.1 grant 2608: </dl>
2609: </dd>
2610: </dl>
2611: </div>
2612:
2613: <div class="sect1" lang="en" xml:lang="en">
2614: <div class="titlepage">
2615: <div>
2616: <div>
2617: <h2 class="title" style="clear: both"><a name=
2618: "getting-started" id=
2619: "getting-started"></a>4.1. Working with binary
2620: packages</h2>
2621: </div>
2622: </div>
2623: </div>
2624:
2625: <p>This section describes how to find, retrieve and
2626: install a precompiled binary package that someone else
2627: already prepared for your type of machine.</p>
2628:
2629: <div class="sect2" lang="en" xml:lang="en">
2630: <div class="titlepage">
2631: <div>
2632: <div>
1.30 wiz 2633: <h3 class="title"><a name=
2634: "where-to-get-binary-packages" id=
2635: "where-to-get-binary-packages"></a>4.1.1. Where
2636: to get binary packages</h3>
1.1 grant 2637: </div>
2638: </div>
2639: </div>
2640:
2641: <p>Precompiled packages are stored on ftp.NetBSD.org
1.14 xtraeme 2642: and its mirrors in the directory <code class=
1.27 rillig 2643: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2644: for anonymous FTP access. <code class=
2645: "varname">OSVERSION</code> is the NetBSD version
2646: (<span><strong class="command">uname
2647: -r</strong></span>), <code class="varname">ARCH</code>
2648: is the architecture (<span><strong class=
2649: "command">uname -p</strong></span>). In that directory,
2650: there is a subdirectory for each category plus a
2651: subdirectory <code class="filename">All</code> which
2652: includes the actual binaries in <code class=
2653: "filename">.tgz</code> files. The category
2654: subdirectories use symbolic links to those files (this
2655: is the same directory layout as in <code class=
1.14 xtraeme 2656: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2657:
2658: <p>This same directory layout applies for CDROM
2659: distributions, only that the directory may be rooted
1.14 xtraeme 2660: somewhere else, probably somewhere below <code class=
2661: "filename">/cdrom</code>. Please consult your CDROMs
1.1 grant 2662: documentation for the exact location.</p>
2663: </div>
2664:
2665: <div class="sect2" lang="en" xml:lang="en">
2666: <div class="titlepage">
2667: <div>
2668: <div>
1.30 wiz 2669: <h3 class="title"><a name=
2670: "how-to-use-binary-packages" id=
2671: "how-to-use-binary-packages"></a>4.1.2. How
2672: to use binary packages</h3>
1.1 grant 2673: </div>
2674: </div>
2675: </div>
2676:
2677: <p>If you have the files on a CDROM or downloaded them
1.23 wiz 2678: to your hard disk, you can install them with the
1.27 rillig 2679: following command (be sure to <span><strong class=
1.14 xtraeme 2680: "command">su</strong></span> to root first):</p>
1.1 grant 2681: <pre class="screen">
1.14 xtraeme 2682: <code class="prompt">#</code> <strong class=
2683: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2684: </pre>
2685:
2686: <p>If you have FTP access and you don't want to
2687: download the packages via FTP prior to installation,
1.14 xtraeme 2688: you can do this automatically by giving
2689: <span><strong class="command">pkg_add</strong></span>
2690: an FTP URL:</p>
1.1 grant 2691: <pre class="screen">
1.14 xtraeme 2692: <code class="prompt">#</code> <strong class=
1.27 rillig 2693: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2694: </pre>
2695:
1.27 rillig 2696: <p>Note that any prerequisite packages needed to run
2697: the package in question will be installed, too,
1.1 grant 2698: assuming they are present where you install from.</p>
2699:
1.23 wiz 2700: <p>To save some typing, you can set the <code class=
2701: "varname">PKG_PATH</code> environment variable to a
2702: semicolon separated list of paths (including remote
2703: URLs); trailing slashes are not allowed.</p>
2704:
2705: <p>Additionally to the <code class=
2706: "filename">All</code> directory there exists a
2707: <code class="filename">vulnerable</code> directory to
2708: which binary packages with known vulnerabilities are
2709: moved, since removing them could cause missing
2710: dependencies. To use these packages, add the
2711: <code class="filename">vulnerable</code> directory to
2712: your <code class="varname">PKG_PATH</code>. However,
2713: you should run <a xmlns=
2714: "http://www.w3.org/TR/xhtml1/transitional" href=
2715: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
2716: class="pkgname">security/audit-packages</a> regularly,
2717: and especially after installing new packages, and
2718: verify that the vulnerabilities are acceptable for your
2719: configuration. An example <code class=
2720: "varname">PKG_PATH</code> would be: <code class=
1.27 rillig 2721: "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 2722: Please note that semicolon (';') is a shell
2723: meta-character, so you'll probably have to quote
2724: it.</p>
2725:
1.1 grant 2726: <p>After you've installed packages, be sure to have
1.27 rillig 2727: <code class="filename">/usr/pkg/bin</code> and
2728: <code class="filename">/usr/pkg/sbin</code> in your
1.14 xtraeme 2729: <code class="varname">PATH</code> so you can actually
2730: start the just installed program.</p>
1.1 grant 2731: </div>
2732:
2733: <div class="sect2" lang="en" xml:lang="en">
2734: <div class="titlepage">
2735: <div>
2736: <div>
1.30 wiz 2737: <h3 class="title"><a name="a-word-of-warning" id=
2738: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 2739: warning</h3>
2740: </div>
2741: </div>
2742: </div>
2743:
2744: <p>Please pay very careful attention to the warnings
2745: expressed in the <a href=
2746: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2747: <span class="citerefentry"><span class=
2748: "refentrytitle">pkg_add</span>(1)</span></a> manual
2749: page about the inherent dangers of installing binary
2750: packages which you did not create yourself, and the
2751: security holes that can be introduced onto your system
2752: by indiscriminate adding of such files.</p>
2753: </div>
2754: </div>
2755:
2756: <div class="sect1" lang="en" xml:lang="en">
2757: <div class="titlepage">
2758: <div>
2759: <div>
2760: <h2 class="title" style="clear: both"><a name=
1.30 wiz 2761: "building-packages-from-source" id=
2762: "building-packages-from-source"></a>4.2. Building
1.1 grant 2763: packages from source</h2>
2764: </div>
2765: </div>
2766: </div>
2767:
2768: <p>This assumes that the package is already in pkgsrc. If
2769: it is not, see <a href="#developers-guide" title=
1.2 hubertf 2770: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 2771: “The pkgsrc developer's guide”</a> for
2772: instructions how to create your own packages.</p>
1.1 grant 2773:
2774: <div class="sect2" lang="en" xml:lang="en">
2775: <div class="titlepage">
2776: <div>
2777: <div>
1.30 wiz 2778: <h3 class="title"><a name="requirements" id=
2779: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 2780: </div>
2781: </div>
2782: </div>
2783:
2784: <p>To build packages from source on a NetBSD system the
2785: “<span class="quote">comp</span>” and the
2786: “<span class="quote">text</span>”
2787: distribution sets must be installed. If you want to
2788: build X11 related packages the “<span class=
2789: "quote">xbase</span>” and “<span class=
2790: "quote">xcomp</span>” distribution sets are
2791: required, too.</p>
2792: </div>
2793:
2794: <div class="sect2" lang="en" xml:lang="en">
2795: <div class="titlepage">
2796: <div>
2797: <div>
1.30 wiz 2798: <h3 class="title"><a name="fetching-distfiles"
2799: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 2800: distfiles</h3>
2801: </div>
2802: </div>
2803: </div>
2804:
1.27 rillig 2805: <p>The first step for building a package is downloading
2806: the distfiles (i.e. the unmodified source). If they
2807: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 2808: automatically.</p>
2809:
2810: <p>You can overwrite some of the major distribution
2811: sites to fit to sites that are close to your own. Have
1.14 xtraeme 2812: a look at <code class=
2813: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 2814: some examples — in particular, look for the
1.14 xtraeme 2815: <code class="varname">MASTER_SORT</code>, <code class=
2816: "varname">MASTER_SORT_REGEX</code> and <code class=
2817: "varname">INET_COUNTRY</code> definitions. This may
2818: save some of your bandwidth and time.</p>
1.1 grant 2819:
2820: <p>You can change these settings either in your shell's
2821: environment, or, if you want to keep the settings, by
1.14 xtraeme 2822: editing the <code class="filename">/etc/mk.conf</code>
1.1 grant 2823: file, and adding the definitions there.</p>
2824:
2825: <p>If you don't have a permanent Internet connection
2826: and you want to know which files to download,
1.14 xtraeme 2827: <span><strong class="command">make
2828: fetch-list</strong></span> will tell you what you'll
2829: need. Put these distfiles into <code class=
2830: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 2831: </div>
2832:
2833: <div class="sect2" lang="en" xml:lang="en">
2834: <div class="titlepage">
2835: <div>
2836: <div>
1.30 wiz 2837: <h3 class="title"><a name=
2838: "how-to-build-and-install" id=
2839: "how-to-build-and-install"></a>4.2.3. How to
2840: build and install</h3>
1.1 grant 2841: </div>
2842: </div>
2843: </div>
2844:
2845: <p>Assuming that the distfile has been fetched (see
2846: previous section), become root and change into the
1.14 xtraeme 2847: relevant directory and running <span><strong class=
2848: "command">make</strong></span>. For example, type</p>
1.1 grant 2849: <pre class="screen">
1.14 xtraeme 2850: <code class="prompt">%</code> <strong class=
2851: "userinput"><code>cd misc/figlet</code></strong>
2852: <code class="prompt">%</code> <strong class=
2853: "userinput"><code>make</code></strong>
1.1 grant 2854: </pre>
2855:
2856: <p>at the shell prompt to build the various components
2857: of the package, and</p>
2858: <pre class="screen">
1.14 xtraeme 2859: <code class="prompt">#</code> <strong class=
2860: "userinput"><code>make install</code></strong>
1.1 grant 2861: </pre>
2862:
2863: <p>to install the various components into the correct
2864: places on your system. Installing the package on your
2865: system requires you to be root. However, pkgsrc has a
2866: <span class="emphasis"><em>just-in-time-su</em></span>
2867: feature, which allows you to only become root for the
2868: actual installation step</p>
2869:
2870: <p>Taking the figlet utility as an example, we can
2871: install it on our system by building as shown in
2872: <a href="#logs" title=
2873: "Appendix B. Build logs">Appendix B, <i>Build
2874: logs</i></a>.</p>
2875:
2876: <p>The program is installed under the default root of
1.14 xtraeme 2877: the packages tree - <code class=
2878: "filename">/usr/pkg</code>. Should this not conform to
2879: your tastes, set the <code class=
2880: "varname">LOCALBASE</code> variable in your
1.1 grant 2881: environment, and it will use that value as the root of
1.14 xtraeme 2882: your packages tree. So, to use <code class=
2883: "filename">/usr/local</code>, set <code class=
2884: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 2885: environment. Please note that you should use a
2886: directory which is dedicated to packages and not shared
1.14 xtraeme 2887: with other programs (ie, do not try and use
2888: <code class="varname">LOCALBASE=/usr</code>). Also, you
2889: should not try to add any of your own files or
2890: directories (such as <code class=
2891: "filename">src/</code>, <code class=
2892: "filename">obj/</code>, or <code class=
2893: "filename">pkgsrc/</code>) below the <code class=
2894: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 2895: possible conflicts between programs and other files
2896: installed by the package system and whatever else may
2897: have been installed there.</p>
2898:
1.14 xtraeme 2899: <p>Some packages look in <code class=
2900: "filename">/etc/mk.conf</code> to alter some
1.1 grant 2901: configuration options at build time. Have a look at
1.14 xtraeme 2902: <code class=
2903: "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
2904: overview of what will be set there by default.
2905: Environment variables such as <code class=
2906: "varname">LOCALBASE</code> can be set in <code class=
2907: "filename">/etc/mk.conf</code> to save having to
2908: remember to set them each time you want to use
2909: pkgsrc.</p>
1.1 grant 2910:
2911: <p>Occasionally, people want to “<span class=
2912: "quote">look under the covers</span>” to see what
2913: is going on when a package is building or being
2914: installed. This may be for debugging purposes, or out
2915: of simple curiosity. A number of utility values have
2916: been added to help with this.</p>
2917:
2918: <div class="orderedlist">
2919: <ol type="1">
2920: <li>
2921: <p>If you invoke the <a href=
2922: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2923: <span class="citerefentry"><span class=
2924: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 2925: with <code class=
2926: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
2927: amount of information will be displayed. For
2928: example,</p>
1.1 grant 2929: <pre class="screen">
1.14 xtraeme 2930: <strong class=
2931: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 2932: </pre>
2933:
2934: <p>will show all the commands that are invoked,
2935: up to and including the “<span class=
2936: "quote">patch</span>” stage.</p>
2937: </li>
2938:
2939: <li>
2940: <p>If you want to know the value of a certain
1.22 tv 2941: <a href=
2942: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2943: <span class="citerefentry"><span class=
2944: "refentrytitle">make</span>(1)</span></a>
2945: definition, then the <code class=
1.14 xtraeme 2946: "varname">VARNAME</code> definition should be
2947: used, in conjunction with the show-var target.
2948: e.g. to show the expansion of the <a href=
1.1 grant 2949: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
2950: <span class="citerefentry"><span class=
2951: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 2952: variable <code class=
1.22 tv 2953: "varname">LOCALBASE</code>:</p>
1.1 grant 2954: <pre class="screen">
1.14 xtraeme 2955: <code class="prompt">%</code> <strong class=
2956: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 2957: /usr/pkg
1.14 xtraeme 2958: <code class="prompt">%</code>
1.1 grant 2959:
2960: </pre>
2961: </li>
2962: </ol>
2963: </div>
2964:
2965: <p>If you want to install a binary package that you've
2966: either created yourself (see next section), that you
2967: put into pkgsrc/packages manually or that is located on
1.8 wiz 2968: a remote FTP server, you can use the "bin-install"
1.1 grant 2969: target. This target will install a binary package - if
2970: available - via <a href=
2971: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2972: <span class="citerefentry"><span class=
2973: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 2974: <span><strong class="command">make
2975: package</strong></span>. The list of remote FTP sites
2976: searched is kept in the variable <code class=
2977: "varname">BINPKG_SITES</code>, which defaults to
2978: ftp.NetBSD.org. Any flags that should be added to
2979: <a href=
1.1 grant 2980: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
2981: <span class="citerefentry"><span class=
2982: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 2983: into <code class="varname">BIN_INSTALL_FLAGS</code>.
2984: See <code class=
2985: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
2986: details.</p>
1.1 grant 2987:
2988: <p>A final word of warning: If you setup a system that
1.14 xtraeme 2989: has a non-standard setting for <code class=
2990: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 2991: any packages are installed, as you can not use several
2992: directories for the same purpose. Doing so will result
2993: in pkgsrc not being able to properly detect your
2994: installed packages, and fail miserably. Note also that
2995: precompiled binary packages are usually built with the
1.14 xtraeme 2996: default <code class="varname">LOCALBASE</code> of
2997: <code class="filename">/usr/pkg</code>, and that you
2998: should <span class="emphasis"><em>not</em></span>
2999: install any if you use a non-standard <code class=
3000: "varname">LOCALBASE</code>.</p>
1.1 grant 3001: </div>
3002:
3003: <div class="sect2" lang="en" xml:lang="en">
3004: <div class="titlepage">
3005: <div>
3006: <div>
1.30 wiz 3007: <h3 class="title"><a name=
3008: "selecting-the-compiler" id=
3009: "selecting-the-compiler"></a>4.2.4. Selecting
3010: the compiler</h3>
1.1 grant 3011: </div>
3012: </div>
3013: </div>
3014:
3015: <p>By default, pkgsrc will use GCC to build packages.
3016: This may be overridden by setting the following
3017: variables in /etc/mk.conf:</p>
3018:
3019: <div class="variablelist">
3020: <dl>
1.14 xtraeme 3021: <dt><span class="term"><code class=
3022: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3023:
3024: <dd>
3025: <p>This is a list of values specifying the chain
3026: of compilers to invoke when building packages.
3027: Valid values are:</p>
3028:
3029: <div class="itemizedlist">
3030: <ul type="disc">
3031: <li>
1.14 xtraeme 3032: <p><code class="varname">distcc</code>:
1.1 grant 3033: distributed C/C++ (chainable)</p>
3034: </li>
3035:
3036: <li>
1.14 xtraeme 3037: <p><code class="varname">ccache</code>:
1.1 grant 3038: compiler cache (chainable)</p>
3039: </li>
3040:
3041: <li>
1.14 xtraeme 3042: <p><code class="varname">gcc</code>: GNU
3043: C/C++ Compiler</p>
1.1 grant 3044: </li>
3045:
3046: <li>
1.14 xtraeme 3047: <p><code class="varname">mipspro</code>:
1.1 grant 3048: Silicon Graphics, Inc. MIPSpro
3049: (n32/n64)</p>
3050: </li>
3051:
3052: <li>
1.14 xtraeme 3053: <p><code class="varname">mipspro</code>:
1.1 grant 3054: Silicon Graphics, Inc. MIPSpro (o32)</p>
3055: </li>
3056:
3057: <li>
1.14 xtraeme 3058: <p><code class="varname">sunpro</code>:
1.1 grant 3059: Microsystems, Inc. WorkShip/Forte/Sun ONE
3060: Studio</p>
3061: </li>
3062: </ul>
3063: </div>
3064:
3065: <p>The default is “<span class=
1.14 xtraeme 3066: "quote"><code class=
3067: "varname">gcc</code></span>”. You can use
3068: <code class="varname">ccache</code> and/or
3069: <code class="varname">distcc</code> with an
3070: appropriate <code class=
3071: "varname">PKGSRC_COMPILER</code> setting, e.g.
3072: “<span class="quote"><code class=
3073: "varname">ccache gcc</code></span>”. This
1.1 grant 3074: variable should always be terminated with a value
3075: for a real compiler.</p>
3076: </dd>
3077:
1.14 xtraeme 3078: <dt><span class="term"><code class=
3079: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3080:
3081: <dd>
3082: <p>This specifies the minimum version of GCC to
3083: use when building packages. If the system GCC
3084: doesn't satisfy this requirement, then pkgsrc
3085: will build and install one of the GCC packages to
3086: use instead.</p>
3087: </dd>
3088: </dl>
3089: </div>
3090: </div>
3091: </div>
3092: </div>
3093:
3094: <div class="chapter" lang="en" xml:lang="en">
3095: <div class="titlepage">
3096: <div>
3097: <div>
1.38 dillo 3098: <h2 class="title"><a name="configuring" id=
3099: "configuring"></a>Chapter 5. Configuring
3100: pkgsrc</h2>
3101: </div>
3102: </div>
3103: </div>
3104:
3105: <div class="toc">
3106: <p><b>Table of Contents</b></p>
3107:
3108: <dl>
3109: <dt><span class="sect1"><a href=
1.42 ! dillo 3110: "#selecting-options">5.1. Selecting Build
! 3111: Options</a></span></dt>
1.38 dillo 3112: </dl>
3113: </div>
3114:
3115: <div class="sect1" lang="en" xml:lang="en">
3116: <div class="titlepage">
3117: <div>
3118: <div>
3119: <h2 class="title" style="clear: both"><a name=
3120: "selecting-options" id=
1.42 ! dillo 3121: "selecting-options"></a>5.1. Selecting Build
! 3122: Options</h2>
1.38 dillo 3123: </div>
3124: </div>
3125: </div>
3126:
3127: <p>Some packages have build time options, usually to
3128: select between different dependencies, enable optional
3129: support for big dependencies or enable experimental
3130: features.</p>
3131:
3132: <p>To see which options, if any, a package supports, and
3133: which options are mutually exclusive, run
3134: <span><strong class="command">make
3135: show-options</strong></span>, for example:</p>
3136: <pre class="programlisting">
3137: The following options are supported by this package:
3138: ssl Enable SSL support.
3139: Exactly one of the following gecko options is required:
3140: firefox Use firefox as gecko rendering engine.
3141: mozilla Use mozilla as gecko rendering engine.
3142: At most one of the following database options may be selected:
3143: mysql Enable support for MySQL database.
3144: pgsql Enable support for PostgreSQL database.
3145:
3146: These options are enabled by default: firefox
3147: These options are currently enabled: mozilla ssl
3148: </pre>
3149:
3150: <p>The following variables can be defined in <code class=
3151: "filename">/etc/mk.conf</code> to select which options to
3152: enable for a package: <code class=
3153: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3154: to select or disable options for all packages that
3155: support them, and <code class=
3156: "varname">PKG_OPTIONS.<em class=
3157: "replaceable"><code>pkgbase</code></em></code>, which can
3158: be used to select or disable options specifically for
3159: package <em class=
3160: "replaceable"><code>pkgbase</code></em>. Options listed
3161: in these variables are selected, options preceded by
3162: “<span class="quote">-</span>” are
3163: disabled.</p>
3164:
1.39 dillo 3165: <p>The following settings are consulted in the order
3166: given, and the last setting that selects or disables an
3167: option is used:</p>
1.38 dillo 3168:
3169: <div class="orderedlist">
3170: <ol type="1">
3171: <li>
3172: <p>the default options as suggested by the package
3173: maintainer</p>
3174: </li>
3175:
3176: <li>
3177: <p>the options implied by the settings of legacy
3178: variables (see below)</p>
3179: </li>
3180:
3181: <li>
3182: <p><code class=
3183: "varname">PKG_DEFAULT_OPTIONS</code></p>
3184: </li>
3185:
3186: <li>
3187: <p><code class="varname">PKG_OPTIONS.<em class=
3188: "replaceable"><code>pkgbase</code></em></code></p>
3189: </li>
3190: </ol>
3191: </div>
3192:
3193: <p>For groups of mutually exclusive options, the last
3194: option selected is used, all others are automatically
3195: disabled. If an option of the group is explicitly
3196: disabled, the previously selected option, if any, is
3197: used. It is an error if no option from a required group
3198: of options is selected, and building the package will
3199: fail.</p>
3200:
3201: <p>Before the options framework was introduced, build
3202: options were selected by setting a variable in
3203: <code class="filename">/etc/mk.conf</code> for each
3204: option. To ease transition to the options framework for
3205: the user, these legacy variables are converted to the
3206: appropriate options setting automatically. A warning is
3207: issued to prompt the user to update <code class=
3208: "filename">/etc/mk.conf</code> to use the options
3209: framework directly. Support for these legacy variables
3210: will be removed eventually.</p>
3211: </div>
3212: </div>
3213:
3214: <div class="chapter" lang="en" xml:lang="en">
3215: <div class="titlepage">
3216: <div>
3217: <div>
1.1 grant 3218: <h2 class="title"><a name="binary" id=
1.38 dillo 3219: "binary"></a>Chapter 6. Creating binary
1.1 grant 3220: packages</h2>
3221: </div>
3222: </div>
3223: </div>
3224:
3225: <div class="toc">
3226: <p><b>Table of Contents</b></p>
3227:
3228: <dl>
1.30 wiz 3229: <dt><span class="sect1"><a href=
1.38 dillo 3230: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3231: single binary package</a></span></dt>
1.1 grant 3232:
1.30 wiz 3233: <dt><span class="sect1"><a href=
1.38 dillo 3234: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3235: Settings for creation of binary
3236: packages</a></span></dt>
3237:
1.38 dillo 3238: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3239: a bulk build of all packages</a></span></dt>
3240:
3241: <dd>
3242: <dl>
3243: <dt><span class="sect2"><a href=
1.38 dillo 3244: "#binary.configuration">6.3.1.
1.1 grant 3245: Configuration</a></span></dt>
3246:
1.30 wiz 3247: <dt><span class="sect2"><a href=
1.38 dillo 3248: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3249: environmental considerations</a></span></dt>
1.1 grant 3250:
1.38 dillo 3251: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3252: Operation</a></span></dt>
3253:
1.30 wiz 3254: <dt><span class="sect2"><a href=
1.38 dillo 3255: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3256:
1.30 wiz 3257: <dt><span class="sect2"><a href=
1.38 dillo 3258: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3259: requirements</a></span></dt>
1.1 grant 3260:
1.30 wiz 3261: <dt><span class="sect2"><a href=
1.38 dillo 3262: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.30 wiz 3263: for chroot'ed builds</a></span></dt>
1.1 grant 3264:
1.30 wiz 3265: <dt><span class="sect2"><a href=
1.38 dillo 3266: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3267: set of packages</a></span></dt>
1.13 hubertf 3268:
3269: <dt><span class="sect2"><a href=
1.38 dillo 3270: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3271: build</a></span></dt>
1.1 grant 3272: </dl>
3273: </dd>
3274:
1.38 dillo 3275: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3276: Creating a multiple CD-ROM packages
3277: collection</a></span></dt>
3278:
3279: <dd>
3280: <dl>
1.30 wiz 3281: <dt><span class="sect2"><a href=
1.38 dillo 3282: "#cdpack-example">6.4.1. Example of
1.30 wiz 3283: cdpack</a></span></dt>
1.1 grant 3284: </dl>
3285: </dd>
3286: </dl>
3287: </div>
3288:
3289: <div class="sect1" lang="en" xml:lang="en">
3290: <div class="titlepage">
3291: <div>
3292: <div>
3293: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3294: "building-a-single-binary-package" id=
1.38 dillo 3295: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3296: a single binary package</h2>
1.1 grant 3297: </div>
3298: </div>
3299: </div>
3300:
3301: <p>Once you have built and installed a package, you can
3302: create a <span class="emphasis"><em>binary
3303: package</em></span> which can be installed on another
3304: system with <a href=
3305: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3306: <span class="citerefentry"><span class=
3307: "refentrytitle">pkg_add</span>(1)</span></a> This saves
3308: having to build the same package on a group of hosts and
3309: wasting CPU time. It also provides a simple means for
3310: others to install your package, should you distribute
3311: it.</p>
3312:
3313: <p>To create a binary package, change into the
1.14 xtraeme 3314: appropriate directory in pkgsrc, and run
3315: <span><strong class="command">make
3316: package</strong></span>:</p>
1.1 grant 3317: <pre class="screen">
1.14 xtraeme 3318: <code class="prompt">#</code> <strong class=
3319: "userinput"><code>cd misc/figlet</code></strong>
3320: <code class="prompt">#</code> <strong class=
3321: "userinput"><code>make package</code></strong>
1.1 grant 3322: </pre>
3323:
3324: <p>This will build and install your package (if not
3325: already done), and then build a binary package from what
1.14 xtraeme 3326: was installed. You can then use the <span><strong class=
3327: "command">pkg_*</strong></span> tools to manipulate it.
3328: Binary packages are created by default in <code class=
3329: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3330: gzipped tar file. See <a href="#logs.package" title=
3331: "B.2. Packaging figlet">Section B.2,
3332: “Packaging figlet”</a> for a continuation of
3333: the above <a xmlns=
3334: "http://www.w3.org/TR/xhtml1/transitional" href=
3335: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20 ben 3336: class="pkgname">misc/figlet</a> example.</p>
1.1 grant 3337:
3338: <p>See <a href="#submit" title=
1.38 dillo 3339: "Chapter 17. Submitting and Committing">Chapter
3340: 17, <i>Submitting and Committing</i></a> for information
1.1 grant 3341: on how to submit such a binary package.</p>
3342: </div>
3343:
3344: <div class="sect1" lang="en" xml:lang="en">
3345: <div class="titlepage">
3346: <div>
3347: <div>
3348: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3349: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3350: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3351: for creation of binary packages</h2>
3352: </div>
3353: </div>
3354: </div>
3355:
3356: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3357: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3358: “Other helpful targets”</a>.</p>
3359: </div>
3360:
3361: <div class="sect1" lang="en" xml:lang="en">
3362: <div class="titlepage">
3363: <div>
3364: <div>
3365: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3366: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
1.1 grant 3367: bulk build of all packages</h2>
3368: </div>
3369: </div>
3370: </div>
3371:
3372: <p>If you want to get a full set of precompiled binary
3373: packages, this section describes how to get them. Beware
3374: that the bulk build will remove all currently installed
1.23 wiz 3375: packages from your system! Having an FTP server
3376: configured either on the machine doing the bulk builds or
3377: on a nearby NFS server can help to make the packages
3378: available to everyone. See <a href=
1.1 grant 3379: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3380: <span class="citerefentry"><span class=
3381: "refentrytitle">ftpd</span>(8)</span></a> for more
3382: information. If you use a remote NFS server's storage, be
3383: sure to not actually compile on NFS storage, as this
3384: slows things down a lot.</p>
3385:
3386: <div class="sect2" lang="en" xml:lang="en">
3387: <div class="titlepage">
3388: <div>
3389: <div>
3390: <h3 class="title"><a name="binary.configuration"
3391: id=
1.38 dillo 3392: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3393: </div>
3394: </div>
3395: </div>
3396:
3397: <div class="sect3" lang="en" xml:lang="en">
3398: <div class="titlepage">
3399: <div>
3400: <div>
3401: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3402: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3403: </div>
3404: </div>
3405: </div>
3406:
1.23 wiz 3407: <p>You may want to set variables in <code class=
1.14 xtraeme 3408: "filename">/etc/mk.conf</code>. Look at <code class=
3409: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3410: details of the default settings. You will want to
1.14 xtraeme 3411: ensure that <code class=
3412: "varname">ACCEPTABLE_LICENSES</code> meet your local
3413: policy. As used in this example, <code class=
3414: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3415: "emphasis"><em>all</em></span> licenses.</p>
3416: <pre class="programlisting">
3417: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3418: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3419: BSDSRCDIR= /usr/src
3420: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3421: OBJHOSTNAME?= yes # use work.`hostname`
3422: FAILOVER_FETCH= yes # insist on the correct checksum
3423: PKG_DEVELOPER?= yes
3424: _ACCEPTABLE= yes
3425: </pre>
3426: </div>
3427:
3428: <div class="sect3" lang="en" xml:lang="en">
3429: <div class="titlepage">
3430: <div>
3431: <div>
1.30 wiz 3432: <h4 class="title"><a name="build.conf" id=
1.38 dillo 3433: "build.conf"></a>6.3.1.2. <code class=
1.14 xtraeme 3434: "filename">build.conf</code></h4>
1.1 grant 3435: </div>
3436: </div>
3437: </div>
3438:
1.14 xtraeme 3439: <p>In <code class="filename">pkgsrc/mk/bulk</code>,
3440: copy <code class="filename">build.conf-example</code>
3441: to <code class="filename">build.conf</code> and edit
3442: it, following the comments in that file. This is the
1.1 grant 3443: config file that determines where log files are
3444: generated after the build, where to mail the build
1.23 wiz 3445: report to, where your pkgsrc tree is located and the
3446: user to which user to <a href=
1.1 grant 3447: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3448: <span class="citerefentry"><span class=
1.23 wiz 3449: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3450: <span><strong class="command">cvs
3451: update</strong></span>.</p>
1.1 grant 3452: </div>
3453:
3454: <div class="sect3" lang="en" xml:lang="en">
3455: <div class="titlepage">
3456: <div>
3457: <div>
1.30 wiz 3458: <h4 class="title"><a name="pre-build.local" id=
1.38 dillo 3459: "pre-build.local"></a>6.3.1.3. <code class="filename">
1.30 wiz 3460: pre-build.local</code></h4>
1.1 grant 3461: </div>
3462: </div>
3463: </div>
3464:
3465: <p>It is possible to configure the bulk build to
3466: perform certain site specific tasks at the end of the
1.14 xtraeme 3467: pre-build stage. If the file <code class=
3468: "filename">pre-build.local</code> exists in
1.23 wiz 3469: <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24 wiz 3470: will be executed (as a <a href=
3471: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3472: <span class="citerefentry"><span class=
3473: "refentrytitle">sh</span>(1)</span></a> script) at
3474: the end of the usual pre-build stage. An example use
3475: of <code class="filename">pre-build.local</code> is
3476: to have the line:</p>
1.1 grant 3477: <pre class="screen">
1.14 xtraeme 3478: <code class="prompt">#</code> <strong class=
3479: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 3480: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 3481: </pre>
3482:
3483: <p>to prevent the system from trying to build a
3484: particular package which requires nearly 3 GB of disk
3485: space.</p>
3486: </div>
3487: </div>
3488:
3489: <div class="sect2" lang="en" xml:lang="en">
3490: <div class="titlepage">
3491: <div>
3492: <div>
1.30 wiz 3493: <h3 class="title"><a name=
3494: "other-environmental-considerations" id=
1.38 dillo 3495: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 3496: environmental considerations</h3>
1.1 grant 3497: </div>
3498: </div>
3499: </div>
3500:
1.14 xtraeme 3501: <p>As <code class="filename">/usr/pkg</code> will be
1.1 grant 3502: completely deleted at the start of bulk builds, make
3503: sure your login shell is placed somewhere else. Either
1.14 xtraeme 3504: drop it into <code class=
3505: "filename">/usr/local/bin</code> (and adjust your login
3506: shell in the passwd file), or (re-)install it via
3507: <a href=
1.1 grant 3508: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3509: <span class="citerefentry"><span class=
3510: "refentrytitle">pkg_add</span>(1)</span></a> from
1.14 xtraeme 3511: <code class="filename">/etc/rc.local</code>, so you can
1.1 grant 3512: login after a reboot (remember that your current
3513: process won't die if the package is removed, you just
3514: can't start any new instances of the shell any more).
3515: Also, if you use NetBSD earlier than 1.5, or you still
3516: want to use the pkgsrc version of ssh for some reason,
3517: be sure to install ssh before starting it from
1.14 xtraeme 3518: <code class="filename">rc.local</code>:</p>
1.1 grant 3519: <pre class="programlisting">
3520: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
3521: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
3522: /usr/pkg/etc/rc.d/sshd
3523: fi
3524: </pre>
3525:
3526: <p>Not doing so will result in you being not able to
3527: log in via ssh after the bulk build is finished or if
3528: the machine gets rebooted or crashes. You have been
3529: warned! :)</p>
3530: </div>
3531:
3532: <div class="sect2" lang="en" xml:lang="en">
3533: <div class="titlepage">
3534: <div>
3535: <div>
1.30 wiz 3536: <h3 class="title"><a name="operation" id=
1.38 dillo 3537: "operation"></a>6.3.3. Operation</h3>
1.1 grant 3538: </div>
3539: </div>
3540: </div>
3541:
3542: <p>Make sure you don't need any of the packages still
3543: installed.</p>
3544:
3545: <div class="warning" style=
3546: "margin-left: 0.5in; margin-right: 0.5in;">
3547: <h3 class="title">Warning</h3>
3548:
3549: <p>During the bulk build, <span class=
3550: "emphasis"><em>all packages will be
3551: removed!</em></span></p>
3552: </div>
3553:
3554: <p>Be sure to remove all other things that might
3555: interfere with builds, like some libs installed in
1.14 xtraeme 3556: <code class="filename">/usr/local</code>, etc. then
3557: become root and type:</p>
1.1 grant 3558: <pre class="screen">
1.14 xtraeme 3559: <code class="prompt">#</code> <strong class=
3560: "userinput"><code>cd /usr/pkgsrc</code></strong>
3561: <code class="prompt">#</code> <strong class=
3562: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 3563: </pre>
3564:
3565: <p>If for some reason your last build didn't complete
3566: (power failure, system panic, ...), you can continue it
3567: by running:</p>
3568: <pre class="screen">
1.14 xtraeme 3569: <code class="prompt">#</code> <strong class=
3570: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 3571: </pre>
3572:
3573: <p>At the end of the bulk build, you will get a summary
3574: via mail, and find build logs in the directory
1.14 xtraeme 3575: specified by <code class="varname">FTP</code> in the
3576: <code class="filename">build.conf</code> file.</p>
1.1 grant 3577: </div>
3578:
3579: <div class="sect2" lang="en" xml:lang="en">
3580: <div class="titlepage">
3581: <div>
3582: <div>
1.30 wiz 3583: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 3584: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 3585: </div>
3586: </div>
3587: </div>
3588:
3589: <p>The bulk builds consist of three steps:</p>
3590:
3591: <div class="variablelist">
3592: <dl>
3593: <dt><span class="term">1. pre-build</span></dt>
3594:
3595: <dd>
3596: <p>The script updates your pkgsrc tree via
3597: (anon)cvs, then cleans out any broken distfiles,
3598: and removes all packages installed.</p>
3599: </dd>
3600:
3601: <dt><span class="term">2. the bulk
3602: build</span></dt>
3603:
3604: <dd>
3605: <p>This is basically “<span class=
3606: "quote">make bulk-package</span>” with an
3607: optimised order in which packages will be built.
3608: Packages that don't require other packages will
3609: be built first, and packages with many
3610: dependencies will be built later.</p>
3611: </dd>
3612:
3613: <dt><span class="term">3. post-build</span></dt>
3614:
3615: <dd>
3616: <p>Generates a report that's placed in the
1.14 xtraeme 3617: directory specified in the <code class=
3618: "filename">build.conf</code> file named
3619: <code class="filename">broken.html</code>, a
3620: short version of that report will also be mailed
3621: to the build's admin.</p>
1.1 grant 3622: </dd>
3623: </dl>
3624: </div>
3625:
3626: <p>During the build, a list of broken packages will be
1.14 xtraeme 3627: compiled in <code class=
3628: "filename">/usr/pkgsrc/.broken</code> (or <code class=
3629: "filename">.../.broken.${MACHINE}</code> if
3630: <code class="varname">OBJMACHINE</code> is set),
3631: individual build logs of broken builds can be found in
3632: the package's directory. These files are used by the
3633: bulk-targets to mark broken builds to not waste time
3634: trying to rebuild them, and they can be used to debug
3635: these broken package builds later.</p>
1.1 grant 3636: </div>
3637:
3638: <div class="sect2" lang="en" xml:lang="en">
3639: <div class="titlepage">
3640: <div>
3641: <div>
1.30 wiz 3642: <h3 class="title"><a name=
3643: "disk-space-requirements" id=
1.38 dillo 3644: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 3645: space requirements</h3>
1.1 grant 3646: </div>
3647: </div>
3648: </div>
3649:
3650: <p>Currently, roughly the following requirements are
3651: valid for NetBSD 2.0/i386:</p>
3652:
3653: <div class="itemizedlist">
3654: <ul type="disc">
3655: <li>
3656: <p>10 GB - distfiles (NFS ok)</p>
3657: </li>
3658:
3659: <li>
3660: <p>8 GB - full set of all binaries (NFS ok)</p>
3661: </li>
3662:
3663: <li>
3664: <p>5 GB - temp space for compiling (local disk
3665: recommended)</p>
3666: </li>
3667: </ul>
3668: </div>
3669:
3670: <p>Note that all pkgs will be de-installed as soon as
3671: they are turned into a binary package, and that sources
3672: are removed, so there is no excessively huge demand to
3673: disk space. Afterwards, if the package is needed again,
3674: it will be installed via <a href=
3675: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3676: <span class="citerefentry"><span class=
3677: "refentrytitle">pkg_add</span>(1)</span></a> instead of
3678: building again, so there are no cycles wasted by
3679: recompiling.</p>
3680: </div>
3681:
3682: <div class="sect2" lang="en" xml:lang="en">
3683: <div class="titlepage">
3684: <div>
3685: <div>
1.30 wiz 3686: <h3 class="title"><a name="setting-up-a-sandbox"
1.38 dillo 3687: id="setting-up-a-sandbox"></a>6.3.6. Setting
1.30 wiz 3688: up a sandbox for chroot'ed builds</h3>
1.1 grant 3689: </div>
3690: </div>
3691: </div>
3692:
1.12 agc 3693: <p>If you don't want all the packages nuked from a
3694: machine (rendering it useless for anything but pkg
1.23 wiz 3695: compiling), there is the possibility of doing the
3696: package bulk build inside a chroot environment.</p>
1.12 agc 3697:
3698: <p>The first step is to set up a chroot sandbox, e.g.
1.14 xtraeme 3699: <code class="filename">/usr/sandbox</code>. This can be
1.12 agc 3700: done by using null mounts, or manually.</p>
3701:
1.14 xtraeme 3702: <p>There is a shell script called <code class=
3703: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
3704: set up the sandbox environment using null mounts. It
3705: will also create a script called <code class=
3706: "filename">sandbox</code> in the root of the sandbox
1.12 agc 3707: environment, which will allow the null mounts to be
1.14 xtraeme 3708: activated using the <span><strong class=
3709: "command">sandbox mount</strong></span> command and
3710: deactivated using the <span><strong class=
3711: "command">sandbox umount</strong></span> command.</p>
1.12 agc 3712:
3713: <p>To set up a sandbox environment by hand, after
3714: extracting all the sets from a NetBSD installation or
1.14 xtraeme 3715: doing a <span><strong class="command">make distribution
3716: DESTDIR=/usr/sandbox</strong></span> in <code class=
3717: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 3718: items are present and properly configured:</p>
1.1 grant 3719:
3720: <div class="procedure">
3721: <ol type="1">
3722: <li>
3723: <p>Kernel</p>
3724: <pre class="screen">
1.14 xtraeme 3725: <code class="prompt">#</code> <strong class=
3726: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 3727: </pre>
3728: </li>
3729:
3730: <li>
1.14 xtraeme 3731: <p><code class="filename">/dev/*</code></p>
1.1 grant 3732: <pre class="screen">
1.14 xtraeme 3733: <code class="prompt">#</code> <strong class=
3734: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 3735: </pre>
3736: </li>
3737:
3738: <li>
1.14 xtraeme 3739: <p><code class="filename">/etc/resolv.conf</code>
1.1 grant 3740: (for <a xmlns=
3741: "http://www.w3.org/TR/xhtml1/transitional" href=
3742: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3743: class="pkgname">security/smtpd</a> and mail):</p>
1.1 grant 3744: <pre class="screen">
1.14 xtraeme 3745: <code class="prompt">#</code> <strong class=
3746: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 3747: </pre>
3748: </li>
3749:
3750: <li>
3751: <p>Working(!) mail config (hostname,
3752: sendmail.cf):</p>
3753: <pre class="screen">
1.14 xtraeme 3754: <code class="prompt">#</code> <strong class=
3755: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 3756: </pre>
3757: </li>
3758:
3759: <li>
1.14 xtraeme 3760: <p><code class="filename">/etc/localtime</code>
3761: (for <a xmlns=
1.1 grant 3762: "http://www.w3.org/TR/xhtml1/transitional" href=
3763: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20 ben 3764: class="pkgname">security/smtpd</a>):</p>
1.1 grant 3765: <pre class="screen">
1.14 xtraeme 3766: <code class="prompt">#</code> <strong class=
3767: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 3768: </pre>
3769: </li>
3770:
3771: <li>
1.14 xtraeme 3772: <p><code class="filename">/usr/src</code> (system
1.1 grant 3773: sources, for <a xmlns=
3774: "http://www.w3.org/TR/xhtml1/transitional" href=
3775: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20 ben 3776: class="pkgname">sysutils/aperture</a>, <a xmlns=
3777: "http://www.w3.org/TR/xhtml1/transitional" href=
3778: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
3779: class="pkgname">net/ppp-mppe</a>):</p>
1.1 grant 3780: <pre class="screen">
1.14 xtraeme 3781: <code class="prompt">#</code> <strong class=
3782: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
3783: <code class="prompt">#</code> <strong class=
1.23 wiz 3784: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 3785: </pre>
3786: </li>
3787:
3788: <li>
1.14 xtraeme 3789: <p>Create <code class=
3790: "filename">/var/db/pkg</code> (not part of
3791: default install):</p>
1.1 grant 3792: <pre class="screen">
1.14 xtraeme 3793: <code class="prompt">#</code> <strong class=
3794: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 3795: </pre>
3796: </li>
3797:
3798: <li>
1.14 xtraeme 3799: <p>Create <code class="filename">/usr/pkg</code>
3800: (not part of default install):</p>
1.1 grant 3801: <pre class="screen">
1.14 xtraeme 3802: <code class="prompt">#</code> <strong class=
3803: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 3804: </pre>
3805: </li>
3806:
3807: <li>
1.14 xtraeme 3808: <p>Checkout pkgsrc via cvs into <code class=
3809: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 3810: <pre class="screen">
1.14 xtraeme 3811: <code class="prompt">#</code> <strong class=
3812: "userinput"><code>cd /usr/sandbox/usr</code></strong>
3813: <code class="prompt">#</code> <strong class=
3814: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 3815: </pre>
3816:
3817: <p>Do not mount/link this to the copy of your
3818: pkgsrc tree you do development in, as this will
3819: likely cause problems!</p>
3820: </li>
3821:
3822: <li>
1.14 xtraeme 3823: <p>Make <code class=
3824: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
3825: and <code class="filename">.../distfiles</code>
3826: point somewhere appropriate. NFS- and/or
3827: nullfs-mounts may come in handy!</p>
1.1 grant 3828: </li>
3829:
3830: <li>
1.14 xtraeme 3831: <p>Edit <code class=
3832: "filename">/etc/mk.conf</code>, see <a href=
3833: "#binary.mk.conf" title=
1.38 dillo 3834: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 3835: “/etc/mk.conf”</a>.</p>
3836: </li>
3837:
3838: <li>
1.14 xtraeme 3839: <p>Adjust <code class=
3840: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 3841: needs.</p>
3842: </li>
3843:
3844: <li>
1.14 xtraeme 3845: <p>If you have set <code class=
3846: "varname">CVS_USER</code> in <code class=
3847: "filename">build.conf</code>, make sure that
3848: account exists and can do a <span><strong class=
3849: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 3850: properly!</p>
3851: </li>
3852: </ol>
3853: </div>
3854:
3855: <p>When the chroot sandbox is setup, you can start the
3856: build with the following steps:</p>
3857: <pre class="screen">
1.14 xtraeme 3858: <code class="prompt">#</code> <strong class=
3859: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
3860: <code class="prompt">#</code> <strong class=
3861: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 3862: </pre>
3863:
3864: <p>This will just jump inside the sandbox and start
3865: building. At the end of the build, mail will be sent
3866: with the results of the build. Created binary pkgs will
1.14 xtraeme 3867: be in <code class=
3868: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 3869: (wherever that points/mounts to/from).</p>
3870: </div>
3871:
3872: <div class="sect2" lang="en" xml:lang="en">
3873: <div class="titlepage">
3874: <div>
3875: <div>
1.30 wiz 3876: <h3 class="title"><a name=
3877: "building-a-partial-set" id=
1.38 dillo 3878: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 3879: a partial set of packages</h3>
1.1 grant 3880: </div>
3881: </div>
3882: </div>
3883:
3884: <p>In addition to building a complete set of all
1.14 xtraeme 3885: packages in pkgsrc, the <code class=
3886: "filename">pkgsrc/mk/bulk/build</code> script may be
3887: used to build a subset of the packages contained in
3888: pkgsrc. By setting defining <code class=
3889: "varname">SPECIFIC_PKGS</code> in <code class=
3890: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 3891:
3892: <div class="itemizedlist">
3893: <ul type="disc">
3894: <li>
3895: <p>SITE_SPECIFIC_PKGS</p>
3896: </li>
3897:
3898: <li>
3899: <p>HOST_SPECIFIC_PKGS</p>
3900: </li>
3901:
3902: <li>
3903: <p>GROUP_SPECIFIC_PKGS</p>
3904: </li>
3905:
3906: <li>
3907: <p>USER_SPECIFIC_PKGS</p>
3908: </li>
3909: </ul>
3910: </div>
3911:
3912: <p>will define the set of packages which should be
3913: built. The bulk build code will also include any
3914: packages which are needed as dependencies for the
3915: explicitly listed packages.</p>
3916:
3917: <p>One use of this is to do a bulk build with
1.14 xtraeme 3918: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 3919: sandbox periodically to have a complete set of the
3920: binary packages needed for your site available without
3921: the overhead of building extra packages that are not
3922: needed.</p>
3923: </div>
1.13 hubertf 3924:
3925: <div class="sect2" lang="en" xml:lang="en">
3926: <div class="titlepage">
3927: <div>
3928: <div>
3929: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 3930: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 3931: of a bulk build</h3>
3932: </div>
3933: </div>
3934: </div>
3935:
3936: <p>This section describes how pkgsrc developers can
3937: upload binary pkgs built by bulk builds to
3938: ftp.NetBSD.org.</p>
3939:
1.17 sketch 3940: <p>If you would like to automatically create checksum
3941: files for the binary packages you intend to upload,
3942: remember to set <code class="varname">MKSUMS=yes</code>
3943: in your <code class=
3944: "filename">mk/bulk/build.conf</code>.</p>
3945:
3946: <p>If you would like to PGP sign the checksum files
3947: (highly recommended!), remember to set <code class=
3948: "varname">SIGN_AS=username@NetBSD.org</code> in your
3949: <code class="filename">mk/bulk/build.conf</code>. This
1.23 wiz 3950: will prompt you for your GPG password to sign the files
1.17 sketch 3951: before uploading everything.</p>
3952:
3953: <p>Then, make sure that you have <code class=
1.14 xtraeme 3954: "varname">RSYNC_DST</code> set properly in your
3955: <code class="filename">mk/bulk/build.conf</code> file,
3956: i.e. adjust it to something like one of the
3957: following:</p>
1.13 hubertf 3958: <pre class="screen">
3959: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3960: </pre>
3961:
1.23 wiz 3962: <p>Please use appropviate values for "pkgsrc-200xQy",
1.13 hubertf 3963: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 3964: ftp.NetBSD.org is different from <code class=
3965: "varname">CVS_USER</code>, write your login directly
3966: into the variable, e.g. my local account is "feyrer",
3967: but for my login "hubertf", I use:</p>
1.13 hubertf 3968: <pre class="screen">
3969: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
3970: </pre>
3971:
1.14 xtraeme 3972: <p>A separate <code class="filename">upload</code>
1.13 hubertf 3973: directory is used here to allow "closing" the directory
3974: during upload. To do so, run the following command on
3975: ftp.NetBSD.org next:</p>
3976: <pre class="screen">
1.14 xtraeme 3977: nbftp% <strong class=
3978: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 3979: </pre>
3980:
1.14 xtraeme 3981: <p>Please note that <code class=
3982: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 3983: appropriate for packages for the NetBSD operating
3984: system. Binary packages for other operating systems
1.14 xtraeme 3985: should go into <code class=
3986: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 3987:
3988: <p>Before uploading the binary pkgs, ssh authentication
1.23 wiz 3989: needs to be set up. This example shows how to setup
1.13 hubertf 3990: temporary keys for the root account <span class=
3991: "emphasis"><em>inside the sandbox</em></span> (assuming
3992: that no keys should be present there usually):</p>
3993: <pre class="screen">
1.14 xtraeme 3994: <code class="prompt">#</code> <strong class=
3995: "userinput"><code>chroot /usr/sandbox</code></strong>
3996: chroot-<code class="prompt">#</code> <strong class=
3997: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
3998: chroot-<code class="prompt">#</code> <strong class=
3999: "userinput"><code>ssh-keygen -t dsa</code></strong>
4000: chroot-<code class="prompt">#</code> <strong class=
4001: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4002: </pre>
4003:
1.14 xtraeme 4004: <p>Now take the output of <code class=
4005: "filename">id-dsa.pub</code> and append it to your
4006: <code class="filename">~/.ssh/authorized_keys</code>
1.17 sketch 4007: file on ftp.NetBSD.org. You can remove the key after
1.14 xtraeme 4008: the upload is done!</p>
1.13 hubertf 4009:
4010: <p>Next, test if your ssh connection really works:</p>
4011: <pre class="screen">
1.14 xtraeme 4012: chroot-<code class="prompt">#</code> <strong class=
4013: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4014: </pre>
4015:
4016: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4017:
4018: <p>Now after all this works, you can exit the sandbox
4019: and start the upload:</p>
4020: <pre class="screen">
1.14 xtraeme 4021: chroot-<code class="prompt">#</code> <strong class=
4022: "userinput"><code>exit</code></strong>
4023: <code class="prompt">#</code> <strong class=
4024: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4025: <code class="prompt">#</code> <strong class=
4026: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4027: </pre>
4028:
4029: <p>The upload process may take quite some time. Use
1.24 wiz 4030: <a href=
4031: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4032: <span class="citerefentry"><span class=
4033: "refentrytitle">ls</span>(1)</span></a> or <a href=
4034: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4035: <span class="citerefentry"><span class=
4036: "refentrytitle">du</span>(1)</span></a> on the FTP
4037: server to monitor progress of the upload. The upload
4038: script will take care of not uploading restricted
4039: packages and putting vulnerable packages into the
4040: <code class="filename">vulnerable</code>
4041: subdirectory.</p>
1.13 hubertf 4042:
4043: <p>After the upload has ended, first thing is to revoke
4044: ssh access:</p>
4045: <pre class="screen">
1.14 xtraeme 4046: nbftp% <strong class=
4047: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4048: Gdd:x!
4049: </pre>
4050:
4051: <p>Use whatever is needed to remove the key you've
4052: entered before! Last, move the uploaded packages out of
1.14 xtraeme 4053: the <code class="filename">upload</code> directory to
4054: have them accessible to everyone:</p>
1.13 hubertf 4055: <pre class="screen">
1.14 xtraeme 4056: nbftp% <strong class=
4057: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4058: nbftp% <strong class=
4059: "userinput"><code>mv upload/* .</code></strong>
4060: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4061: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4062: </pre>
4063: </div>
1.1 grant 4064: </div>
4065:
4066: <div class="sect1" lang="en" xml:lang="en">
4067: <div class="titlepage">
4068: <div>
4069: <div>
4070: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4071: "creating-cdroms" id=
1.38 dillo 4072: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4073: CD-ROM packages collection</h2>
1.1 grant 4074: </div>
4075: </div>
4076: </div>
4077:
4078: <p>After your pkgsrc bulk-build has completed, you may
4079: wish to create a CD-ROM set of the resulting binary
4080: packages to assist in installing packages on other
4081: machines. The <a xmlns=
4082: "http://www.w3.org/TR/xhtml1/transitional" href=
4083: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20 ben 4084: class="pkgname">pkgtools/cdpack</a> package provides a
4085: simple tool for creating the ISO 9660 images.
4086: <span><strong class="command">cdpack</strong></span>
4087: arranges the packages on the CD-ROMs in a way that keeps
4088: all the dependencies for given package on the same CD as
4089: that package.</p>
1.1 grant 4090:
4091: <div class="sect2" lang="en" xml:lang="en">
4092: <div class="titlepage">
4093: <div>
4094: <div>
1.30 wiz 4095: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4096: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4097: cdpack</h3>
4098: </div>
4099: </div>
4100: </div>
4101:
4102: <p>Complete documentation for cdpack is found in the
4103: cdpack(1) manpage. The following short example assumes
1.14 xtraeme 4104: that the binary packages are left in <code class=
4105: "filename">/usr/pkgsrc/packages/All</code> and that
4106: sufficient disk space exists in <code class=
4107: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4108: <pre class="screen">
1.14 xtraeme 4109: <code class="prompt">#</code> <strong class=
4110: "userinput"><code>mkdir /u2/images</code></strong>
4111: <code class="prompt">#</code> <strong class=
4112: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4113: <code class="prompt">#</code> <strong class=
4114: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4115: </pre>
4116:
4117: <p>If you wish to include a common set of files
1.14 xtraeme 4118: (<code class="filename">COPYRIGHT</code>, <code class=
4119: "filename">README</code>, etc.) on each CD in the
1.1 grant 4120: collection, then you need to create a directory which
4121: contains these files. e.g.</p>
4122: <pre class="screen">
1.14 xtraeme 4123: <code class="prompt">#</code> <strong class=
4124: "userinput"><code>mkdir /tmp/common</code></strong>
4125: <code class="prompt">#</code> <strong class=
4126: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4127: <code class="prompt">#</code> <strong class=
4128: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4129: <code class="prompt">#</code> <strong class=
4130: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4131: <code class="prompt">#</code> <strong class=
4132: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4133: <code class="prompt">#</code> <strong class=
4134: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4135: <code class="prompt">#</code> <strong class=
4136: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4137: </pre>
4138:
4139: <p>Now create the images:</p>
4140: <pre class="screen">
1.14 xtraeme 4141: <code class="prompt">#</code> <strong class=
4142: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4143: </pre>
4144:
1.14 xtraeme 4145: <p>Each image will contain <code class=
4146: "filename">README</code>, <code class=
4147: "filename">COPYING</code>, and <code class=
4148: "filename">bin/myscript</code> in their root
1.1 grant 4149: directories.</p>
4150: </div>
4151: </div>
4152: </div>
4153:
4154: <div class="chapter" lang="en" xml:lang="en">
4155: <div class="titlepage">
4156: <div>
4157: <div>
4158: <h2 class="title"><a name="faq" id=
1.38 dillo 4159: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4160: Questions</h2>
4161: </div>
4162: </div>
4163: </div>
4164:
4165: <div class="toc">
4166: <p><b>Table of Contents</b></p>
4167:
4168: <dl>
1.30 wiz 4169: <dt><span class="sect1"><a href=
1.38 dillo 4170: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4171: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4172:
1.38 dillo 4173: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4174: Where's the pkgviews documentation?</a></span></dt>
4175:
1.38 dillo 4176: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4177: Utilities for package management
4178: (pkgtools)</a></span></dt>
4179:
1.38 dillo 4180: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4181: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4182:
1.30 wiz 4183: <dt><span class="sect1"><a href=
1.38 dillo 4184: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4185: fetching distfiles?</a></span></dt>
1.14 xtraeme 4186:
1.30 wiz 4187: <dt><span class="sect1"><a href=
1.38 dillo 4188: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4189: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4190:
1.30 wiz 4191: <dt><span class="sect1"><a href=
1.38 dillo 4192: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4193: from pkgsrc?</a></span></dt>
1.1 grant 4194:
1.30 wiz 4195: <dt><span class="sect1"><a href=
1.38 dillo 4196: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4197: behind a firewall</a></span></dt>
1.1 grant 4198:
1.38 dillo 4199: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4200: do I tell <span><strong class="command">make
4201: fetch</strong></span> to do passive
4202: FTP?</a></span></dt>
1.1 grant 4203:
1.30 wiz 4204: <dt><span class="sect1"><a href=
1.38 dillo 4205: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4206: distfiles at once</a></span></dt>
1.1 grant 4207:
1.30 wiz 4208: <dt><span class="sect1"><a href=
1.38 dillo 4209: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4210: “<span class="quote">Don't know how to make
1.14 xtraeme 4211: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4212: mean?</a></span></dt>
4213:
1.30 wiz 4214: <dt><span class="sect1"><a href=
1.38 dillo 4215: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4216: “<span class="quote">Could not find
1.14 xtraeme 4217: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4218:
1.30 wiz 4219: <dt><span class="sect1"><a href=
1.38 dillo 4220: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4221: pkgsrc</a></span></dt>
1.1 grant 4222:
1.38 dillo 4223: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4224: do I change the location of configuration
4225: files?</a></span></dt>
1.1 grant 4226:
1.38 dillo 4227: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4228: Automated security checks</a></span></dt>
4229: </dl>
4230: </div>
4231:
4232: <p>This section contains hints, tips & tricks on
4233: special things in pkgsrc that we didn't find a better place
4234: for in the previous chapters, and it contains items for
4235: both pkgsrc users and developers.</p>
4236:
4237: <div class="sect1" lang="en" xml:lang="en">
4238: <div class="titlepage">
4239: <div>
4240: <div>
4241: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4242: "mailing-list-pointers" id=
1.38 dillo 4243: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4244: mailing lists for pkg-related discussion?</h2>
1.1 grant 4245: </div>
4246: </div>
4247: </div>
4248:
1.18 xtraeme 4249: <p>The following mailing lists may be of interest to
4250: pkgsrc users:</p>
4251:
4252: <div class="itemizedlist">
4253: <ul type="disc">
4254: <li>
4255: <p><a href=
4256: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4257: target="_top">pkgsrc-bugs</a>: A list where problem
4258: reports related to pkgsrc are sent and
4259: discussed.</p>
1.18 xtraeme 4260: </li>
4261:
4262: <li>
4263: <p><a href=
4264: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4265: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4266: results of pkgsrc bulk builds are sent and
1.34 wiz 4267: discussed.</p>
1.18 xtraeme 4268: </li>
4269:
4270: <li>
4271: <p><a href=
4272: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4273: target="_top">pkgsrc-changes</a>: A list where all
4274: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4275: </li>
4276:
4277: <li>
4278: <p><a href=
4279: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4280: target="_top">tech-pkg</a>: A general discussion
4281: list for all things related to pkgsrc.</p>
1.18 xtraeme 4282: </li>
4283: </ul>
4284: </div>
4285:
4286: <p>To subscribe, do:</p>
1.1 grant 4287: <pre class="programlisting">
1.18 xtraeme 4288: <code class="prompt">%</code> echo subscribe <em class=
4289: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4290: </pre>
4291:
1.18 xtraeme 4292: <p>Archives for all these mailing lists are available
4293: from <a href="http://mail-index.NetBSD.org/" target=
4294: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4295: </div>
4296:
4297: <div class="sect1" lang="en" xml:lang="en">
4298: <div class="titlepage">
4299: <div>
4300: <div>
4301: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4302: "pkgviews-docs" id=
1.38 dillo 4303: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4304: documentation?</h2>
1.1 grant 4305: </div>
4306: </div>
4307: </div>
4308:
4309: <p>Pkgviews is tightly integrated with buildlink. You can
1.14 xtraeme 4310: find a pkgviews User's guide in <code class=
4311: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4312: </div>
4313:
4314: <div class="sect1" lang="en" xml:lang="en">
4315: <div class="titlepage">
4316: <div>
4317: <div>
4318: <h2 class="title" style="clear: both"><a name=
1.5 hubertf 4319: "faq-pkgtools" id=
1.38 dillo 4320: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4321: management (pkgtools)</h2>
1.1 grant 4322: </div>
4323: </div>
4324: </div>
4325:
1.14 xtraeme 4326: <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1 grant 4327: directory pkgtools contains a number of useful utilities
4328: for both users and developers of pkgsrc. This section
4329: attempts only to make the reader aware of the utilities
4330: and when they might be useful, and not to duplicate the
4331: documentation that comes with each package.</p>
4332:
4333: <p>Utilities used by pkgsrc (automatically installed when
4334: needed):</p>
4335:
4336: <div class="itemizedlist">
4337: <ul type="disc">
4338: <li>
4339: <p><a xmlns=
4340: "http://www.w3.org/TR/xhtml1/transitional" href=
4341: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.34 wiz 4342: class="pkgname">pkgtools/x11-links</a>: Symlinks
4343: for use by buildlink.</p>
1.1 grant 4344: </li>
4345: </ul>
4346: </div>
4347:
4348: <p>OS tool augmentation (automatically installed when
4349: needed):</p>
4350:
4351: <div class="itemizedlist">
4352: <ul type="disc">
4353: <li>
4354: <p><a xmlns=
4355: "http://www.w3.org/TR/xhtml1/transitional" href=
4356: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.34 wiz 4357: class="pkgname">pkgtools/digest</a>: Calculates
4358: various kinds of checksums (including SHA1).</p>
1.1 grant 4359: </li>
4360:
4361: <li>
4362: <p><a xmlns=
4363: "http://www.w3.org/TR/xhtml1/transitional" href=
4364: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27 rillig 4365: class="pkgname">pkgtools/libnbcompat</a>:
1.34 wiz 4366: Compatibility library for pkgsrc tools.</p>
1.1 grant 4367: </li>
4368:
4369: <li>
4370: <p><a xmlns=
4371: "http://www.w3.org/TR/xhtml1/transitional" href=
4372: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.34 wiz 4373: class="pkgname">pkgtools/mtree</a>: Installed on
4374: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4375: </li>
4376:
4377: <li>
4378: <p><a xmlns=
4379: "http://www.w3.org/TR/xhtml1/transitional" href=
4380: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4381: class="pkgname">pkgtools/pkg_install</a>:
1.34 wiz 4382: Up-to-date replacement for <code class=
4383: "filename">/usr/sbin/pkg_install</code>, or for use
4384: on operating systems where pkg_install is not
4385: present.</p>
1.1 grant 4386: </li>
4387: </ul>
4388: </div>
4389:
4390: <p>Utilities used by pkgsrc (not automatically
4391: installed):</p>
4392:
4393: <div class="itemizedlist">
4394: <ul type="disc">
4395: <li>
4396: <p><a xmlns=
4397: "http://www.w3.org/TR/xhtml1/transitional" href=
4398: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34 wiz 4399: class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20 ben 4400: binary package from an already-installed package.
1.34 wiz 4401: Used by <span><strong class="command">make
4402: replace</strong></span> to save the old
4403: package.</p>
1.1 grant 4404: </li>
4405:
4406: <li>
4407: <p><a xmlns=
4408: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4409: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34 wiz 4410: class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20 ben 4411: functionality to pkgsrc, allowing it to fetch
4412: distfiles from multiple locations. It currently
4413: supports the following methods: multiple CD-ROMs
4414: and network FTP/HTTP connections.</p>
1.5 hubertf 4415: </li>
4416:
4417: <li>
4418: <p><a xmlns=
4419: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4420: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 4421: class="pkgname">pkgtools/xpkgwedge</a>: Put X11
4422: packages someplace else (enabled by default).</p>
1.1 grant 4423: </li>
1.5 hubertf 4424:
4425: <li>
4426: <p><a xmlns=
4427: "http://www.w3.org/TR/xhtml1/transitional" href=
4428: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34 wiz 4429: class="pkgname">devel/cpuflags</a>: Determine the
4430: best compiler flags to optimise code for your
1.20 ben 4431: current CPU and compiler.</p>
1.5 hubertf 4432: </li>
1.1 grant 4433: </ul>
4434: </div>
4435:
4436: <p>Utilities for keeping track of installed packages,
4437: being up to date, etc:</p>
4438:
4439: <div class="itemizedlist">
4440: <ul type="disc">
4441: <li>
4442: <p><a xmlns=
4443: "http://www.w3.org/TR/xhtml1/transitional" href=
4444: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34 wiz 4445: class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27 rillig 4446: packages whose installed versions do not match the
1.34 wiz 4447: latest pkgsrc entries.</p>
1.1 grant 4448: </li>
4449:
4450: <li>
4451: <p><a xmlns=
4452: "http://www.w3.org/TR/xhtml1/transitional" href=
4453: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34 wiz 4454: class="pkgname">pkgtools/pkgdep</a>: Makes
1.20 ben 4455: dependency graphs of packages, to aid in choosing a
1.34 wiz 4456: strategy for updating.</p>
1.1 grant 4457: </li>
4458:
4459: <li>
4460: <p><a xmlns=
4461: "http://www.w3.org/TR/xhtml1/transitional" href=
4462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34 wiz 4463: class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27 rillig 4464: graphs from the output of <a xmlns=
4465: "http://www.w3.org/TR/xhtml1/transitional" href=
4466: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
4467: class="pkgname">pkgtools/pkgdep</a> (uses
1.34 wiz 4468: graphviz).</p>
1.1 grant 4469: </li>
4470:
4471: <li>
4472: <p><a xmlns=
4473: "http://www.w3.org/TR/xhtml1/transitional" href=
4474: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34 wiz 4475: class="pkgname">pkgtools/pkglint</a>: The
1.27 rillig 4476: pkglint(1) program checks a pkgsrc entry for
4477: errors, lintpkgsrc(1) does various checks on the
4478: complete pkgsrc system.</p>
1.1 grant 4479: </li>
4480:
4481: <li>
4482: <p><a xmlns=
4483: "http://www.w3.org/TR/xhtml1/transitional" href=
4484: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34 wiz 4485: class="pkgname">pkgtools/pkgsurvey</a>: Report what
4486: packages you have installed.</p>
1.1 grant 4487: </li>
4488: </ul>
4489: </div>
4490:
4491: <p>Utilities for people maintaining or creating
4492: individual packages:</p>
4493:
4494: <div class="itemizedlist">
4495: <ul type="disc">
4496: <li>
4497: <p><a xmlns=
4498: "http://www.w3.org/TR/xhtml1/transitional" href=
4499: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34 wiz 4500: class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20 ben 4501: making and maintaining patches for a package
1.34 wiz 4502: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 4503: </li>
4504:
4505: <li>
4506: <p><a xmlns=
4507: "http://www.w3.org/TR/xhtml1/transitional" href=
4508: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20 ben 4509: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
4510: "http://www.w3.org/TR/xhtml1/transitional" href=
4511: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34 wiz 4512: class="pkgname">pkgtools/url2pkg</a>: Aids in
4513: converting to pkgsrc.</p>
1.1 grant 4514: </li>
4515:
4516: <li>
4517: <p><a xmlns=
4518: "http://www.w3.org/TR/xhtml1/transitional" href=
4519: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34 wiz 4520: class="pkgname">pkgtools/gensolpkg</a>: Convert
4521: pkgsrc to a Solaris package.</p>
1.1 grant 4522: </li>
4523: </ul>
4524: </div>
4525:
4526: <p>Utilities for people maintaining pkgsrc (or more
4527: obscure pkg utilities)</p>
4528:
4529: <div class="itemizedlist">
4530: <ul type="disc">
4531: <li>
4532: <p><a xmlns=
4533: "http://www.w3.org/TR/xhtml1/transitional" href=
4534: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34 wiz 4535: class="pkgname">pkgtools/pkgconflict</a>: Find
1.20 ben 4536: packages that conflict but aren't marked as
1.34 wiz 4537: such.</p>
1.1 grant 4538: </li>
4539:
4540: <li>
4541: <p><a xmlns=
4542: "http://www.w3.org/TR/xhtml1/transitional" href=
4543: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34 wiz 4544: class="pkgname">pkgtools/pkg_comp</a>: Build
4545: packages in a chrooted area.</p>
1.1 grant 4546: </li>
4547:
4548: <li>
4549: <p><a xmlns=
4550: "http://www.w3.org/TR/xhtml1/transitional" href=
4551: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34 wiz 4552: class="pkgname">pkgtools/libkver</a>: Spoof kernel
4553: version for chrooted cross builds.</p>
1.1 grant 4554: </li>
4555: </ul>
4556: </div>
4557: </div>
4558:
4559: <div class="sect1" lang="en" xml:lang="en">
4560: <div class="titlepage">
4561: <div>
4562: <div>
4563: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4564: "non-root-pkgsrc" id=
1.38 dillo 4565: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 4566: as non-root</h2>
1.1 grant 4567: </div>
4568: </div>
4569: </div>
4570:
4571: <p>If you want to use pkgsrc as non-root user, you can
4572: set some variables to make pkgsrc work under these
1.33 jmmv 4573: conditions. At the very least, you need to set
4574: <code class="varname">UNPRIVILEGED</code> to
4575: “<span class="quote">yes</span>”; this will
4576: turn on unprivileged mode and set multiple related
4577: variables to allow installation of packages as
4578: non-root.</p>
4579:
4580: <p>In case the defaults are not enough, you may want to
4581: tune some other variables used. For example, if the
4582: automatic user/group detection leads to incorrect values
4583: (or not the ones you would like to use), you can change
4584: them by setting <code class=
4585: "varname">UNPRIVILEGED_USER</code> and <code class=
4586: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
4587:
4588: <p>As regards bootstrapping, please note that the
4589: <span><strong class="command">bootstrap</strong></span>
4590: script will ease non-root configuration when given the
4591: “<span class=
4592: "quote">--ignore-user-check</span>” flag, as it
4593: will choose and use multiple default directories under
4594: <code class="filename">~/pkg</code> as the installation
4595: targets. These directories can be overriden by the
4596: “<span class="quote">--prefix</span>” flag
4597: provided by the script, as well as some others that allow
4598: finer tuning of the tree layout.</p>
1.14 xtraeme 4599: </div>
4600:
4601: <div class="sect1" lang="en" xml:lang="en">
4602: <div class="titlepage">
4603: <div>
4604: <div>
4605: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4606: "resume-transfers" id=
1.38 dillo 4607: "resume-transfers"></a>7.5. How to resume
1.30 wiz 4608: transfers when fetching distfiles?</h2>
1.14 xtraeme 4609: </div>
4610: </div>
4611: </div>
4612:
1.15 xtraeme 4613: <p>By default resuming transfers in pkgsrc is disabled,
4614: but you can enable this feature by adding the option
4615: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
4616: into <code class="filename">/etc/mk.conf</code>. If,
4617: during a fetch step, an incomplete distfile is found,
4618: pkgsrc will try to resume it.</p>
4619:
4620: <p>You can also use a different program than the default
1.24 wiz 4621: <a href=
4622: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4623: <span class="citerefentry"><span class=
4624: "refentrytitle">ftp</span>(1)</span></a> by changing the
4625: <code class="varname">FETCH_CMD</code> variable. Don't
4626: forget to set <code class=
4627: "varname">FETCH_RESUME_ARGS</code> and <code class=
4628: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
4629: default values.</p>
1.14 xtraeme 4630:
4631: <p>For example, if you want to use <code class=
4632: "filename">wget</code> to resume downloads, you'll have
4633: to use something like:</p>
4634: <pre class="programlisting">
1.34 wiz 4635: FETCH_CMD=wget
4636: FETCH_BEFORE_ARGS=--passive-ftp
4637: FETCH_RESUME_ARGS=-c
4638: FETCH_OUTPUT_ARGS=-O
1.14 xtraeme 4639: </pre>
1.1 grant 4640: </div>
4641:
4642: <div class="sect1" lang="en" xml:lang="en">
4643: <div class="titlepage">
4644: <div>
4645: <div>
4646: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4647: "XFree86-from-pkgsrc" id=
1.38 dillo 4648: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 4649: install/use XFree86 from pkgsrc?</h2>
4650: </div>
4651: </div>
4652: </div>
4653:
4654: <p>If you want to use XFree86 from pkgsrc instead of your
1.14 xtraeme 4655: system's own X11 (<code class=
4656: "filename">/usr/X11R6</code>, <code class=
4657: "filename">/usr/openwin</code>, ...), you will have to
4658: add the following line into <code class=
1.15 xtraeme 4659: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4660: <pre class="programlisting">
1.34 wiz 4661: X11_TYPE=XFree86
1.1 grant 4662: </pre>
4663: </div>
4664:
4665: <div class="sect1" lang="en" xml:lang="en">
4666: <div class="titlepage">
4667: <div>
4668: <div>
4669: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4670: "x.org-from-pkgsrc" id=
1.38 dillo 4671: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 4672: install/use X.org from pkgsrc?</h2>
4673: </div>
4674: </div>
4675: </div>
4676:
4677: <p>If you want to use X.org from pkgsrc instead of your
1.14 xtraeme 4678: system's own X11 (<code class=
4679: "filename">/usr/X11R6</code>, <code class=
4680: "filename">/usr/openwin</code>, ...) you will have to add
4681: the following line into <code class=
1.15 xtraeme 4682: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4683: <pre class="programlisting">
1.34 wiz 4684: X11_TYPE=xorg
1.1 grant 4685: </pre>
4686: </div>
4687:
4688: <div class="sect1" lang="en" xml:lang="en">
4689: <div class="titlepage">
4690: <div>
4691: <div>
4692: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4693: "fetch-behind-firewall" id=
1.38 dillo 4694: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 4695: files from behind a firewall</h2>
1.1 grant 4696: </div>
4697: </div>
4698: </div>
4699:
4700: <p>If you are sitting behind a firewall which does not
4701: allow direct connections to Internet hosts (i.e.
4702: non-NAT), you may specify the relevant proxy hosts. This
4703: is done using an environment variable in the form of a
4704: URL e.g. in Amdahl, the machine “<span class=
4705: "quote">orpheus.amdahl.com</span>” is one of the
4706: firewalls, and it uses port 80 as the proxy port number.
4707: So the proxy environment variables are:</p>
4708: <pre class="programlisting">
1.34 wiz 4709: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1 grant 4710: http_proxy=http://orpheus.amdahl.com:80/
4711: </pre>
4712: </div>
4713:
4714: <div class="sect1" lang="en" xml:lang="en">
4715: <div class="titlepage">
4716: <div>
4717: <div>
4718: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4719: "passive-ftp" id="passive-ftp"></a>7.9. How do
1.30 wiz 4720: I tell <span><strong class="command">make
1.14 xtraeme 4721: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 4722: </div>
4723: </div>
4724: </div>
4725:
4726: <p>This depends on which utility is used to retrieve
1.14 xtraeme 4727: distfiles. From <code class="filename">bsd.pkg.mk</code>,
4728: <code class="varname">FETCH_CMD</code> is assigned the
4729: first available command from the following list:</p>
1.34 wiz 4730:
4731: <div class="itemizedlist">
4732: <ul type="disc">
4733: <li>
4734: <p><code class=
4735: "filename">${LOCALBASE}/bin/ftp</code></p>
4736: </li>
4737:
4738: <li>
4739: <p><code class="filename">/usr/bin/ftp</code></p>
4740: </li>
4741: </ul>
4742: </div>
1.1 grant 4743:
4744: <p>On a default NetBSD installation, this will be
1.14 xtraeme 4745: <code class="filename">/usr/bin/ftp</code>, which
1.1 grant 4746: automatically tries passive connections first, and falls
4747: back to active connections if the server refuses to do
4748: passive. For the other tools, add the following to your
1.14 xtraeme 4749: <code class="filename">/etc/mk.conf</code> file:
4750: <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 4751:
1.14 xtraeme 4752: <p>Having that option present will prevent <code class=
4753: "filename">/usr/bin/ftp</code> from falling back to
4754: active transfers.</p>
1.1 grant 4755: </div>
4756:
4757: <div class="sect1" lang="en" xml:lang="en">
4758: <div class="titlepage">
4759: <div>
4760: <div>
4761: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4762: "fetching-all-distfiles" id=
1.38 dillo 4763: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 4764: fetch all distfiles at once</h2>
4765: </div>
4766: </div>
4767: </div>
4768:
4769: <p>You would like to download all the distfiles in a
4770: single batch from work or university, where you can't run
1.14 xtraeme 4771: a <span><strong class="command">make
4772: fetch</strong></span>. There is an archive of distfiles
4773: on <a href=
1.1 grant 4774: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
4775: target="_top">ftp.NetBSD.org</a>, but downloading the
4776: entire directory may not be appropriate.</p>
4777:
1.14 xtraeme 4778: <p>The answer here is to do a <span><strong class=
4779: "command">make fetch-list</strong></span> in <code class=
4780: "filename">/usr/pkgsrc</code> or one of it's
1.1 grant 4781: subdirectories, carry the resulting list to your machine
1.23 wiz 4782: at work/school and use it there. If you don't have a
1.24 wiz 4783: NetBSD-compatible <a href=
4784: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
4785: <span class="citerefentry"><span class=
4786: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
4787: at work, don't forget to set <code class=
4788: "varname">FETCH_CMD</code> to something that fetches a
4789: URL:</p>
1.1 grant 4790:
4791: <p>At home:</p>
4792: <pre class="screen">
1.14 xtraeme 4793: <code class="prompt">%</code> <strong class=
4794: "userinput"><code>cd /usr/pkgsrc</code></strong>
4795: <code class="prompt">%</code> <strong class=
4796: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
4797: <code class="prompt">%</code> <strong class=
4798: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 4799: </pre>
4800:
4801: <p>At work:</p>
4802: <pre class="screen">
1.14 xtraeme 4803: <code class="prompt">%</code> <strong class=
4804: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 4805: </pre>
4806:
1.14 xtraeme 4807: <p>then tar up <code class=
4808: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 4809:
4810: <p>If you have a machine running NetBSD, and you want to
4811: get <span class="emphasis"><em>all</em></span> distfiles
4812: (even ones that aren't for your machine architecture),
4813: you can do so by using the above-mentioned
1.14 xtraeme 4814: <span><strong class="command">make
4815: fetch-list</strong></span> approach, or fetch the
4816: distfiles directly by running:</p>
1.1 grant 4817: <pre class="screen">
1.14 xtraeme 4818: <code class="prompt">%</code> <strong class=
4819: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 4820: </pre>
4821:
1.14 xtraeme 4822: <p>If you even decide to ignore <code class=
4823: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
4824: can get everything by running:</p>
1.1 grant 4825: <pre class="screen">
1.14 xtraeme 4826: <code class="prompt">%</code> <strong class=
4827: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 4828: </pre>
4829: </div>
4830:
4831: <div class="sect1" lang="en" xml:lang="en">
4832: <div class="titlepage">
4833: <div>
4834: <div>
4835: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4836: "tmac.andoc-missing" id=
1.38 dillo 4837: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 4838: “<span class="quote">Don't know how to make
4839: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
4840: </div>
4841: </div>
4842: </div>
4843:
4844: <p>When compiling the <a xmlns=
4845: "http://www.w3.org/TR/xhtml1/transitional" href=
4846: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4847: class="pkgname">pkgtools/pkg_install</a> package, you get
4848: the error from make that it doesn't know how to make
4849: <code class="filename">/usr/share/tmac/tmac.andoc</code>?
4850: This indicates that you don't have installed the
1.23 wiz 4851: “<span class="quote">text</span>” set (nroff,
4852: ...) from the NetBSD base distribution on your machine.
4853: It is recommended to do that to format manpages.</p>
1.1 grant 4854:
4855: <p>In the case of the <a xmlns=
4856: "http://www.w3.org/TR/xhtml1/transitional" href=
4857: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20 ben 4858: class="pkgname">pkgtools/pkg_install</a> package, you can
4859: get away with setting <code class=
4860: "varname">NOMAN=YES</code> either in the environment or
4861: in <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 4862: </div>
4863:
4864: <div class="sect1" lang="en" xml:lang="en">
4865: <div class="titlepage">
4866: <div>
4867: <div>
4868: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4869: "bsd.own.mk-missing" id=
1.38 dillo 4870: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 4871: “<span class="quote">Could not find
4872: bsd.own.mk</span>” mean?</h2>
4873: </div>
4874: </div>
4875: </div>
4876:
1.14 xtraeme 4877: <p>You didn't install the compiler set, <code class=
4878: "filename">comp.tgz</code>, when you installed your
4879: NetBSD machine. Please get it and install it, by
4880: extracting it in <code class="filename">/</code>:</p>
1.1 grant 4881: <pre class="screen">
1.14 xtraeme 4882: <code class="prompt">#</code> <strong class=
4883: "userinput"><code>cd /</code></strong>
4884: <code class="prompt">#</code> <strong class=
4885: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 4886: </pre>
4887:
1.14 xtraeme 4888: <p><code class="filename">comp.tgz</code> is part of
4889: every NetBSD release. Get the one that corresponds to
4890: your release (determine via <span><strong class=
4891: "command">uname -r</strong></span>).</p>
1.1 grant 4892: </div>
4893:
4894: <div class="sect1" lang="en" xml:lang="en">
4895: <div class="titlepage">
4896: <div>
4897: <div>
4898: <h2 class="title" style="clear: both"><a name=
1.30 wiz 4899: "using-sudo-with-pkgsrc" id=
1.38 dillo 4900: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 4901: 'sudo' with pkgsrc</h2>
4902: </div>
4903: </div>
4904: </div>
4905:
4906: <p>When installing packages as non-root user and using
1.24 wiz 4907: the just-in-time <a href=
4908: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
4909: <span class="citerefentry"><span class=
4910: "refentrytitle">su</span>(1)</span></a> feature of
4911: pkgsrc, it can become annoying to type in the root
4912: password for each required package installed. To avoid
4913: this, the sudo package can be used, which does password
4914: caching over a limited time. To use it, install sudo
4915: (either as binary package or from <a xmlns=
4916: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 4917: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20 ben 4918: class="pkgname">security/sudo</a>) and then put the
4919: following into your <code class=
4920: "filename">/etc/mk.conf</code>:</p>
1.1 grant 4921: <pre class="programlisting">
1.34 wiz 4922: .if exists(${LOCALBASE}/bin/sudo)
4923: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
4924: .endif
1.1 grant 4925: </pre>
4926: </div>
4927:
4928: <div class="sect1" lang="en" xml:lang="en">
4929: <div class="titlepage">
4930: <div>
4931: <div>
4932: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4933: "faq.conf" id="faq.conf"></a>7.14. How do I
1.35 jmmv 4934: change the location of configuration files?</h2>
1.1 grant 4935: </div>
4936: </div>
4937: </div>
4938:
1.35 jmmv 4939: <p>As the system administrator, you can choose where
4940: configuration files are installed. The default settings
4941: make all these files go into <code class=
4942: "filename">${PREFIX}/etc</code> or some of its
4943: subdirectories; this may be suboptimal depending on your
4944: expectations (e.g., a read-only, NFS-exported
4945: <code class="varname">PREFIX</code> with a need of
4946: per-machine configuration of the provided packages).</p>
4947:
4948: <p>In order to change the defaults, you can modify the
4949: <code class="varname">PKG_SYSCONFBASE</code> variable (in
4950: <code class="filename">/etc/mk.conf</code>) to point to
4951: your preferred configuration directory; some common
4952: examples include <code class="filename">/etc</code> or
4953: <code class="filename">/etc/pkg</code>.</p>
4954:
4955: <p>Furthermore, you can change this value on a
4956: per-package basis by setting the <code class=
4957: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
4958: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
4959: value usually matches the name of the package you would
4960: like to modify, that is, the contents of <code class=
4961: "varname">PKGBASE</code>.</p>
1.1 grant 4962:
1.35 jmmv 4963: <p>Note that, after changing these settings, you must
4964: rebuild and reinstall any affected packages.</p>
1.1 grant 4965: </div>
4966:
4967: <div class="sect1" lang="en" xml:lang="en">
4968: <div class="titlepage">
4969: <div>
4970: <div>
4971: <h2 class="title" style="clear: both"><a name=
4972: "audit-packages" id=
1.38 dillo 4973: "audit-packages"></a>7.15. Automated security
1.1 grant 4974: checks</h2>
4975: </div>
4976: </div>
4977: </div>
4978:
4979: <p>Please be aware that there can often be bugs in
4980: third-party software, and some of these bugs can leave a
4981: machine vulnerable to exploitation by attackers. In an
4982: effort to lessen the exposure, the NetBSD packages team
4983: maintains a database of known-exploits to packages which
4984: have at one time been included in pkgsrc. The database
4985: can be downloaded automatically, and a security audit of
4986: all packages installed on a system can take place. To do
4987: this, install the <a xmlns=
4988: "http://www.w3.org/TR/xhtml1/transitional" href=
4989: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20 ben 4990: class="pkgname">security/audit-packages</a> package. It
4991: has two components:</p>
1.1 grant 4992:
4993: <div class="orderedlist">
4994: <ol type="1">
4995: <li>
1.34 wiz 4996: <p><span><strong class=
4997: "command">download-vulnerability-list</strong></span>,
1.1 grant 4998: an easy way to download a list of the security
4999: vulnerabilities information. This list is kept up
5000: to date by the NetBSD security officer and the
5001: NetBSD packages team, and is distributed from the
5002: NetBSD ftp server:</p>
5003:
5004: <p><a href=
5005: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5006: target=
5007: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5008: </li>
5009:
5010: <li>
1.34 wiz 5011: <p><span><strong class=
5012: "command">audit-packages</strong></span>, an easy
5013: way to audit the current machine, checking each
1.1 grant 5014: vulnerability which is known. If a vulnerable
5015: package is installed, it will be shown by output to
5016: stdout, including a description of the type of
5017: vulnerability, and a URL containing more
5018: information.</p>
5019: </li>
5020: </ol>
5021: </div>
5022:
1.23 wiz 5023: <p>Use of the <a xmlns=
5024: "http://www.w3.org/TR/xhtml1/transitional" href=
5025: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
5026: class="pkgname">security/audit-packages</a> package is
5027: strongly recommended! After “<span class=
5028: "quote">audit-packages</span>” is installed, please
5029: read the package's message, which you can get by running
5030: <strong class="userinput"><code>pkg_info -D
5031: audit-package</code></strong>.</p>
1.1 grant 5032: </div>
5033: </div>
5034: </div>
5035:
5036: <div class="part" lang="en" xml:lang="en">
5037: <div class="titlepage">
5038: <div>
5039: <div>
5040: <h1 class="title"><a name="developers-guide" id=
1.2 hubertf 5041: "developers-guide"></a>The pkgsrc developer's
5042: guide</h1>
1.1 grant 5043: </div>
5044: </div>
5045: </div>
5046:
5047: <div class="toc">
5048: <p><b>Table of Contents</b></p>
5049:
5050: <dl>
1.38 dillo 5051: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5052: Package components - files, directories and
5053: contents</a></span></dt>
5054:
5055: <dd>
5056: <dl>
5057: <dt><span class="sect1"><a href=
1.38 dillo 5058: "#components.Makefile">8.1. <code class=
1.27 rillig 5059: "filename">Makefile</code></a></span></dt>
5060:
5061: <dt><span class="sect1"><a href=
1.38 dillo 5062: "#components.distinfo">8.2. <code class=
1.27 rillig 5063: "filename">distinfo</code></a></span></dt>
5064:
5065: <dt><span class="sect1"><a href=
1.38 dillo 5066: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5067:
1.30 wiz 5068: <dt><span class="sect1"><a href=
1.38 dillo 5069: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5070: files</a></span></dt>
1.27 rillig 5071:
5072: <dt><span class="sect1"><a href=
1.38 dillo 5073: "#components.optional">8.5. Optional
1.27 rillig 5074: files</a></span></dt>
5075:
1.38 dillo 5076: <dt><span class="sect1"><a href="#work-dir">8.6.
1.27 rillig 5077: <code class="filename">work*</code></a></span></dt>
5078:
1.38 dillo 5079: <dt><span class="sect1"><a href="#files-dir">8.7.
1.27 rillig 5080: <code class="filename">files/*</code></a></span></dt>
5081: </dl>
5082: </dd>
5083:
1.38 dillo 5084: <dt><span class="chapter"><a href="#makefile">9.
1.25 rillig 5085: Programming in <code class=
5086: "filename">Makefile</code>s</a></span></dt>
5087:
5088: <dd>
5089: <dl>
5090: <dt><span class="sect1"><a href=
1.38 dillo 5091: "#makefile.variables">9.1. <code class=
1.25 rillig 5092: "filename">Makefile</code> variables</a></span></dt>
5093:
1.27 rillig 5094: <dd>
5095: <dl>
5096: <dt><span class="sect2"><a href=
1.38 dillo 5097: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5098: conventions</a></span></dt>
5099: </dl>
5100: </dd>
5101:
1.38 dillo 5102: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5103: Code snippets</a></span></dt>
5104:
5105: <dd>
5106: <dl>
5107: <dt><span class="sect2"><a href=
1.38 dillo 5108: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5109: list</a></span></dt>
5110:
5111: <dt><span class="sect2"><a href=
1.38 dillo 5112: "#converting-internal-to-external">9.2.2.
1.30 wiz 5113: Converting an internal list into an external
5114: list</a></span></dt>
1.25 rillig 5115:
5116: <dt><span class="sect2"><a href=
1.38 dillo 5117: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5118: variables to a shell command</a></span></dt>
1.27 rillig 5119:
5120: <dt><span class="sect2"><a href=
1.38 dillo 5121: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5122: guideline</a></span></dt>
5123:
5124: <dt><span class="sect2"><a href=
1.38 dillo 5125: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5126: a bug in BSD Make</a></span></dt>
1.25 rillig 5127: </dl>
5128: </dd>
5129: </dl>
5130: </dd>
5131:
1.38 dillo 5132: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5133: issues</a></span></dt>
5134:
5135: <dd>
5136: <dl>
1.38 dillo 5137: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5138: ID</a></span></dt>
5139:
1.30 wiz 5140: <dt><span class="sect1"><a href=
1.38 dillo 5141: "#automatic-plist-generation">10.2. Semi-automatic
1.30 wiz 5142: <code class="filename">PLIST</code>
1.14 xtraeme 5143: generation</a></span></dt>
1.1 grant 5144:
1.38 dillo 5145: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5146: Tweaking output of <span><strong class="command">make
5147: print-PLIST</strong></span></a></span></dt>
1.1 grant 5148:
1.38 dillo 5149: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5150: Variable substitution in PLIST</a></span></dt>
5151:
1.30 wiz 5152: <dt><span class="sect1"><a href=
1.38 dillo 5153: "#manpage-compression">10.5.
1.1 grant 5154: Manpage-compression</a></span></dt>
5155:
1.30 wiz 5156: <dt><span class="sect1"><a href=
1.38 dillo 5157: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5158: <code class=
1.14 xtraeme 5159: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5160:
1.30 wiz 5161: <dt><span class="sect1"><a href=
1.38 dillo 5162: "#platform-specific-plist">10.7. Platform specific
5163: and differing PLISTs</a></span></dt>
1.1 grant 5164:
5165: <dt><span class="sect1"><a href=
1.38 dillo 5166: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5167: packages</a></span></dt>
5168: </dl>
5169: </dd>
5170:
1.38 dillo 5171: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5172: Buildlink methodology</a></span></dt>
5173:
5174: <dd>
5175: <dl>
1.30 wiz 5176: <dt><span class="sect1"><a href=
1.38 dillo 5177: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5178: to use buildlink3</a></span></dt>
1.1 grant 5179:
1.30 wiz 5180: <dt><span class="sect1"><a href=
1.38 dillo 5181: "#creating-buildlink3.mk">11.2. Writing <code class=
1.30 wiz 5182: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5183:
5184: <dd>
5185: <dl>
5186: <dt><span class="sect2"><a href=
1.38 dillo 5187: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5188: buildlink3.mk file</a></span></dt>
1.1 grant 5189:
5190: <dt><span class="sect2"><a href=
1.38 dillo 5191: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5192: <code class=
5193: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5194: <code>pkg</code></em></code> in <code class=
5195: "filename">buildlink3.mk</code>
1.1 grant 5196: files</a></span></dt>
5197: </dl>
5198: </dd>
5199:
1.30 wiz 5200: <dt><span class="sect1"><a href=
1.38 dillo 5201: "#writing-builtin.mk">11.3. Writing <code class=
1.30 wiz 5202: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5203:
5204: <dd>
5205: <dl>
5206: <dt><span class="sect2"><a href=
1.38 dillo 5207: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30 wiz 5208: <code class="filename">builtin.mk</code>
5209: file</a></span></dt>
1.1 grant 5210:
5211: <dt><span class="sect2"><a href=
1.38 dillo 5212: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5213: preferences for native or pkgsrc
5214: software</a></span></dt>
1.1 grant 5215: </dl>
5216: </dd>
5217: </dl>
5218: </dd>
5219:
1.38 dillo 5220: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5221: pkginstall framework</a></span></dt>
5222:
5223: <dd>
5224: <dl>
5225: <dt><span class="sect1"><a href=
1.38 dillo 5226: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5227: directories outside the installation
5228: prefix</a></span></dt>
5229:
5230: <dd>
5231: <dl>
5232: <dt><span class="sect2"><a href=
1.38 dillo 5233: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5234: manipulation</a></span></dt>
5235:
5236: <dt><span class="sect2"><a href=
1.38 dillo 5237: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5238: manipulation</a></span></dt>
5239: </dl>
5240: </dd>
5241:
1.38 dillo 5242: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5243: Configuration files</a></span></dt>
5244:
5245: <dd>
5246: <dl>
5247: <dt><span class="sect2"><a href=
1.38 dillo 5248: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5249: "varname">PKG_SYSCONFDIR</code> is
5250: set</a></span></dt>
5251:
5252: <dt><span class="sect2"><a href=
1.38 dillo 5253: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 5254: software were configuration files
5255: are</a></span></dt>
5256:
5257: <dt><span class="sect2"><a href=
1.38 dillo 5258: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5259: installations</a></span></dt>
5260:
5261: <dt><span class="sect2"><a href=
1.38 dillo 5262: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5263: of configuration files</a></span></dt>
5264: </dl>
5265: </dd>
5266:
1.38 dillo 5267: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5268: System startup scripts</a></span></dt>
5269:
5270: <dd>
5271: <dl>
5272: <dt><span class="sect2"><a href=
1.38 dillo 5273: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5274: of system startup scripts</a></span></dt>
5275: </dl>
5276: </dd>
5277:
5278: <dt><span class="sect1"><a href=
1.38 dillo 5279: "#users-and-groups">12.4. System users and
1.35 jmmv 5280: groups</a></span></dt>
5281:
1.38 dillo 5282: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5283: System shells</a></span></dt>
5284:
5285: <dd>
5286: <dl>
5287: <dt><span class="sect2"><a href=
1.38 dillo 5288: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5289: configuration files</a></span></dt>
5290: </dl>
5291: </dd>
5292: </dl>
5293: </dd>
5294:
1.38 dillo 5295: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5296: handling</a></span></dt>
5297:
5298: <dd>
5299: <dl>
1.30 wiz 5300: <dt><span class="sect1"><a href=
1.38 dillo 5301: "#global-default-options">13.1. Global default
1.30 wiz 5302: options</a></span></dt>
1.1 grant 5303:
1.30 wiz 5304: <dt><span class="sect1"><a href=
1.38 dillo 5305: "#converting-to-options">13.2. Converting packages to
1.30 wiz 5306: use <code class=
1.14 xtraeme 5307: "filename">bsd.options.mk</code></a></span></dt>
1.1 grant 5308: </dl>
5309: </dd>
5310:
1.38 dillo 5311: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5312: process</a></span></dt>
5313:
5314: <dd>
5315: <dl>
1.38 dillo 5316: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5317: Program location</a></span></dt>
5318:
1.38 dillo 5319: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5320: Main targets</a></span></dt>
5321:
5322: <dt><span class="sect1"><a href=
1.38 dillo 5323: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5324: targets</a></span></dt>
5325: </dl>
5326: </dd>
5327:
1.38 dillo 5328: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5329: fixes for packages</a></span></dt>
5330:
5331: <dd>
5332: <dl>
1.30 wiz 5333: <dt><span class="sect1"><a href=
1.38 dillo 5334: "#general-operation">15.1. General
1.30 wiz 5335: operation</a></span></dt>
1.1 grant 5336:
5337: <dd>
5338: <dl>
5339: <dt><span class="sect2"><a href=
1.38 dillo 5340: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5341: pull in variables from
5342: /etc/mk.conf</a></span></dt>
1.1 grant 5343:
5344: <dt><span class="sect2"><a href=
1.38 dillo 5345: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5346: to install documentation</a></span></dt>
5347:
5348: <dt><span class="sect2"><a href=
1.38 dillo 5349: "#restricted-packages">15.1.3. Restricted
1.1 grant 5350: packages</a></span></dt>
5351:
5352: <dt><span class="sect2"><a href=
1.38 dillo 5353: "#dependencies">15.1.4. Handling
1.1 grant 5354: dependencies</a></span></dt>
5355:
5356: <dt><span class="sect2"><a href=
1.38 dillo 5357: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5358: other packages</a></span></dt>
5359:
5360: <dt><span class="sect2"><a href=
1.38 dillo 5361: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5362: cannot or should not be built</a></span></dt>
1.1 grant 5363:
5364: <dt><span class="sect2"><a href=
1.38 dillo 5365: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 5366: should not be deleted, once
5367: installed</a></span></dt>
1.1 grant 5368:
5369: <dt><span class="sect2"><a href=
1.38 dillo 5370: "#security-handling">15.1.8. Handling packages
1.1 grant 5371: with security problems</a></span></dt>
5372:
5373: <dt><span class="sect2"><a href=
1.38 dillo 5374: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 5375: bugs</a></span></dt>
5376:
5377: <dt><span class="sect2"><a href=
1.38 dillo 5378: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 5379: incrementing versions when fixing an existing
1.1 grant 5380: package</a></span></dt>
5381:
5382: <dt><span class="sect2"><a href=
1.38 dillo 5383: "#portability-of-packages">15.1.11. Portability
1.30 wiz 5384: of packages</a></span></dt>
1.1 grant 5385: </dl>
5386: </dd>
5387:
1.30 wiz 5388: <dt><span class="sect1"><a href=
1.38 dillo 5389: "#downloading-issues">15.2. Possible downloading
1.30 wiz 5390: issues</a></span></dt>
1.1 grant 5391:
5392: <dd>
5393: <dl>
5394: <dt><span class="sect2"><a href=
1.38 dillo 5395: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 5396: distfiles aren't available for plain
1.1 grant 5397: downloading</a></span></dt>
5398:
5399: <dt><span class="sect2"><a href=
1.38 dillo 5400: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 5401: handle modified distfiles with the 'old'
5402: name</a></span></dt>
1.1 grant 5403: </dl>
5404: </dd>
5405:
1.30 wiz 5406: <dt><span class="sect1"><a href=
1.38 dillo 5407: "#configuration-gotchas">15.3. Configuration
1.30 wiz 5408: gotchas</a></span></dt>
1.1 grant 5409:
5410: <dd>
5411: <dl>
5412: <dt><span class="sect2"><a href=
1.38 dillo 5413: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 5414: libtool</a></span></dt>
5415:
5416: <dt><span class="sect2"><a href=
1.38 dillo 5417: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 5418: packages that already support
5419: libtool</a></span></dt>
5420:
5421: <dt><span class="sect2"><a href=
1.38 dillo 5422: "#autoconf-automake">15.3.3. GNU
1.1 grant 5423: Autoconf/Automake</a></span></dt>
5424: </dl>
5425: </dd>
5426:
1.30 wiz 5427: <dt><span class="sect1"><a href=
1.38 dillo 5428: "#building-considerations">15.4. Building
1.30 wiz 5429: considerations</a></span></dt>
1.1 grant 5430:
5431: <dd>
5432: <dl>
5433: <dt><span class="sect2"><a href=
1.38 dillo 5434: "#cpp-defines">15.4.1. CPP
1.30 wiz 5435: defines</a></span></dt>
1.1 grant 5436: </dl>
5437: </dd>
5438:
1.30 wiz 5439: <dt><span class="sect1"><a href=
1.38 dillo 5440: "#package-specific-actions">15.5. Package specific
1.30 wiz 5441: actions</a></span></dt>
1.1 grant 5442:
5443: <dd>
5444: <dl>
5445: <dt><span class="sect2"><a href=
1.38 dillo 5446: "#user-interaction">15.5.1. User
1.2 hubertf 5447: interaction</a></span></dt>
1.1 grant 5448:
5449: <dt><span class="sect2"><a href=
1.38 dillo 5450: "#handling-licenses">15.5.2. Handling
1.1 grant 5451: licenses</a></span></dt>
5452:
5453: <dt><span class="sect2"><a href=
1.38 dillo 5454: "#installing-score-files">15.5.3. Installing
1.30 wiz 5455: score files</a></span></dt>
1.1 grant 5456:
5457: <dt><span class="sect2"><a href=
1.38 dillo 5458: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 5459: scripts</a></span></dt>
5460:
5461: <dt><span class="sect2"><a href=
1.38 dillo 5462: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 5463: hardcoded paths to other
5464: interpreters</a></span></dt>
1.1 grant 5465:
5466: <dt><span class="sect2"><a href=
1.38 dillo 5467: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 5468: modules</a></span></dt>
5469:
5470: <dt><span class="sect2"><a href=
1.38 dillo 5471: "#faq.info-files">15.5.7. Packages installing
1.1 grant 5472: info files</a></span></dt>
5473:
5474: <dt><span class="sect2"><a href=
1.38 dillo 5475: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 5476: GConf2 data files</a></span></dt>
1.1 grant 5477:
5478: <dt><span class="sect2"><a href=
1.38 dillo 5479: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 5480: installing scrollkeeper data
5481: files</a></span></dt>
1.1 grant 5482:
5483: <dt><span class="sect2"><a href=
1.38 dillo 5484: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 5485: fonts</a></span></dt>
5486:
5487: <dt><span class="sect2"><a href=
1.38 dillo 5488: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 5489: modules</a></span></dt>
5490:
5491: <dt><span class="sect2"><a href=
1.38 dillo 5492: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 5493: SGML or XML data</a></span></dt>
1.1 grant 5494:
5495: <dt><span class="sect2"><a href=
1.38 dillo 5496: "#mime-database">15.5.13. Packages installing
1.1 grant 5497: extensions to the MIME database</a></span></dt>
5498:
5499: <dt><span class="sect2"><a href=
1.38 dillo 5500: "#intltool">15.5.14. Packages using
1.1 grant 5501: intltool</a></span></dt>
1.18 xtraeme 5502:
5503: <dt><span class="sect2"><a href=
1.38 dillo 5504: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 5505: startup scripts</a></span></dt>
1.1 grant 5506: </dl>
5507: </dd>
5508:
1.30 wiz 5509: <dt><span class="sect1"><a href=
1.38 dillo 5510: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 5511: author</a></span></dt>
1.1 grant 5512: </dl>
5513: </dd>
5514:
1.38 dillo 5515: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 5516: Debugging</a></span></dt>
5517:
1.38 dillo 5518: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 5519: Submitting and Committing</a></span></dt>
5520:
5521: <dd>
5522: <dl>
1.30 wiz 5523: <dt><span class="sect1"><a href=
1.38 dillo 5524: "#submitting-your-package">17.1. Submitting your
1.30 wiz 5525: packages</a></span></dt>
1.1 grant 5526:
1.30 wiz 5527: <dt><span class="sect1"><a href=
1.41 wiz 5528: "#general-notes-for-changes">17.2. General notes when
5529: adding, updating, or removing
5530: packages</a></span></dt>
5531:
5532: <dt><span class="sect1"><a href=
5533: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 5534: package into CVS</a></span></dt>
1.1 grant 5535:
1.30 wiz 5536: <dt><span class="sect1"><a href=
1.41 wiz 5537: "#updating-package">17.4. Updating a package to a
1.30 wiz 5538: newer version</a></span></dt>
1.1 grant 5539:
1.30 wiz 5540: <dt><span class="sect1"><a href=
1.41 wiz 5541: "#moving-package">17.5. Moving a package in
1.30 wiz 5542: pkgsrc</a></span></dt>
1.1 grant 5543: </dl>
5544: </dd>
5545: </dl>
5546: </div>
5547:
5548: <div class="chapter" lang="en" xml:lang="en">
5549: <div class="titlepage">
5550: <div>
5551: <div>
1.27 rillig 5552: <h2 class="title"><a name="components" id=
1.38 dillo 5553: "components"></a>Chapter 8. Package
1.27 rillig 5554: components - files, directories and contents</h2>
1.25 rillig 5555: </div>
5556: </div>
5557: </div>
5558:
5559: <div class="toc">
5560: <p><b>Table of Contents</b></p>
5561:
5562: <dl>
5563: <dt><span class="sect1"><a href=
1.38 dillo 5564: "#components.Makefile">8.1. <code class=
1.27 rillig 5565: "filename">Makefile</code></a></span></dt>
5566:
5567: <dt><span class="sect1"><a href=
1.38 dillo 5568: "#components.distinfo">8.2. <code class=
1.27 rillig 5569: "filename">distinfo</code></a></span></dt>
5570:
5571: <dt><span class="sect1"><a href=
1.38 dillo 5572: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 5573:
1.30 wiz 5574: <dt><span class="sect1"><a href=
1.38 dillo 5575: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5576: files</a></span></dt>
1.25 rillig 5577:
1.27 rillig 5578: <dt><span class="sect1"><a href=
1.38 dillo 5579: "#components.optional">8.5. Optional
1.27 rillig 5580: files</a></span></dt>
1.25 rillig 5581:
1.38 dillo 5582: <dt><span class="sect1"><a href="#work-dir">8.6.
1.27 rillig 5583: <code class="filename">work*</code></a></span></dt>
1.25 rillig 5584:
1.38 dillo 5585: <dt><span class="sect1"><a href="#files-dir">8.7.
1.27 rillig 5586: <code class="filename">files/*</code></a></span></dt>
1.25 rillig 5587: </dl>
5588: </div>
5589:
1.27 rillig 5590: <p>Whenever you're preparing a package, there are a number
5591: of files involved which are described in the following
5592: sections.</p>
1.25 rillig 5593:
5594: <div class="sect1" lang="en" xml:lang="en">
5595: <div class="titlepage">
5596: <div>
5597: <div>
5598: <h2 class="title" style="clear: both"><a name=
1.27 rillig 5599: "components.Makefile" id=
1.38 dillo 5600: "components.Makefile"></a>8.1. <code class=
1.27 rillig 5601: "filename">Makefile</code></h2>
1.25 rillig 5602: </div>
5603: </div>
5604: </div>
5605:
1.27 rillig 5606: <p>Building, installation and creation of a binary
5607: package are all controlled by the package's <code class=
5608: "filename">Makefile</code>. The <code class=
5609: "filename">Makefile</code> describes various things about
5610: a package, for example from where to get it, how to
5611: configure, build, and install it.</p>
5612:
5613: <p>A package <code class="filename">Makefile</code>
5614: contains several sections that describe the package.</p>
1.25 rillig 5615:
1.27 rillig 5616: <p>In the first section there are the following
5617: variables, which should appear exactly in the order given
5618: here.</p>
1.25 rillig 5619:
5620: <div class="itemizedlist">
5621: <ul type="disc">
5622: <li>
1.27 rillig 5623: <p><code class="varname">DISTNAME</code> is the
5624: basename of the distribution file to be downloaded
5625: from the package's website.</p>
5626: </li>
5627:
5628: <li>
5629: <p><code class="varname">PKGNAME</code> is the name
5630: of the package, as used by pkgsrc. You only need to
5631: provide it if it differs from DISTNAME. Usually it
5632: is the directory name together with the version
5633: number. It must match the regular expression
5634: <code class=
5635: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
5636: that is, it starts with a letter or digit, and
5637: contains only letters, digits, dashes, underscores,
5638: dots and plus signs.</p>
1.25 rillig 5639: </li>
5640:
5641: <li>
1.27 rillig 5642: <p><code class="varname">CATEGORIES</code> is a
5643: list of categories which the package fits in. You
5644: can choose any of the top-level directories of
5645: pkgsrc for it.</p>
1.25 rillig 5646: </li>
5647:
5648: <li>
1.27 rillig 5649: <p><code class="varname">MASTER_SITES</code> is a
5650: list of URLs where the distribution files can be
5651: downloaded. Each URL must end with a slash.</p>
1.25 rillig 5652: </li>
5653: </ul>
5654: </div>
5655:
1.27 rillig 5656: <p>The second section contains the following
5657: variables.</p>
1.25 rillig 5658:
1.27 rillig 5659: <div class="itemizedlist">
5660: <ul type="disc">
5661: <li>
5662: <p><code class="varname">MAINTAINER</code> is the
5663: mail address of the package's maintainer, which is
5664: the person you can contact when the package does
5665: not work.</p>
5666: </li>
1.25 rillig 5667:
1.27 rillig 5668: <li>
5669: <p><code class="varname">HOMEPAGE</code> is a URL
5670: where users can find more information about the
1.23 wiz 5671: package.</p>
5672: </li>
1.1 grant 5673:
1.23 wiz 5674: <li>
5675: <p><code class="varname">COMMENT</code> is a
5676: one-line comment about the purpose of the
5677: package.</p>
5678: </li>
5679: </ul>
5680: </div>
1.1 grant 5681:
1.14 xtraeme 5682: <p>The <code class="varname">MASTER_SITES</code> may be
5683: set to one of the predefined sites:</p>
1.1 grant 5684: <pre class="programlisting">
5685: ${MASTER_SITE_APACHE}
1.27 rillig 5686: ${MASTER_SITE_BACKUP}
5687: ${MASTER_SITE_CYGWIN}
1.1 grant 5688: ${MASTER_SITE_DEBIAN}
1.27 rillig 5689: ${MASTER_SITE_FREEBSD}
5690: ${MASTER_SITE_FREEBSD_LOCAL}
1.1 grant 5691: ${MASTER_SITE_GNOME}
5692: ${MASTER_SITE_GNU}
5693: ${MASTER_SITE_GNUSTEP}
1.9 dillo 5694: ${MASTER_SITE_IFARCHIVE}
1.1 grant 5695: ${MASTER_SITE_MOZILLA}
1.27 rillig 5696: ${MASTER_SITE_OPENOFFICE}
1.1 grant 5697: ${MASTER_SITE_PERL_CPAN}
1.27 rillig 5698: ${MASTER_SITE_R_CRAN}
1.1 grant 5699: ${MASTER_SITE_SOURCEFORGE}
5700: ${MASTER_SITE_SUNSITE}
5701: ${MASTER_SITE_SUSE}
5702: ${MASTER_SITE_TEX_CTAN}
5703: ${MASTER_SITE_XCONTRIB}
1.27 rillig 5704: ${MASTER_SITE_XEMACS}
5705:
1.1 grant 5706: </pre>
5707:
5708: <p>If one of these predefined sites is chosen, you may
5709: require the ability to specify a subdirectory of that
5710: site. Since these macros may expand to more than one
5711: actual site, you <span class=
5712: "emphasis"><em>must</em></span> use the following
5713: construct to specify a subdirectory:</p>
5714: <pre class="programlisting">
5715: ${MASTER_SITE_GNU:=subdirectory/name/}
5716: ${MASTER_SITE_SOURCEFORGE:=project_name/}
5717: </pre>
5718:
5719: <p>Note the trailing slash after the subdirectory
5720: name.</p>
5721:
5722: <div class="note" style=
5723: "margin-left: 0.5in; margin-right: 0.5in;">
5724: <h3 class="title">Note</h3>
5725:
1.14 xtraeme 5726: <p><code class="varname">MASTER_SITE_SUBDIR</code> has
5727: been deprecated and <span class="emphasis"><em>should
5728: no longer be used</em></span>.</p>
1.1 grant 5729: </div>
5730:
1.14 xtraeme 5731: <p>If the package has multiple <code class=
5732: "varname">DISTFILES</code> or multiple <code class=
5733: "varname">PATCHFILES</code> from different sites, set
5734: <code class="varname">SITES_foo</code> to a list of URI's
1.1 grant 5735: where file “<span class="quote">foo</span>”
5736: may be found. “<span class=
5737: "quote">foo</span>” includes the suffix, e.g.</p>
5738: <pre class="programlisting">
5739: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5740: DISTFILES+= foo-file.tar.gz
5741: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
5742: http://www.somewhereelse.com/mirror/somehow/
5743: </pre>
5744:
1.14 xtraeme 5745: <p>Note that the normal default setting of <code class=
5746: "varname">DISTFILES</code> must be made explicit if you
1.1 grant 5747: want to add to it (rather than replace it), as you
5748: usually would.</p>
5749:
5750: <p>Currently the following values are available for
1.14 xtraeme 5751: <code class="varname">CATEGORIES</code>. If more than one
5752: is used, they need to be separated by spaces:</p>
1.1 grant 5753: <pre class="programlisting">
5754: archivers cross geography meta-pkgs security
5755: audio databases graphics misc shells
5756: benchmarks devel ham multimedia sysutils
5757: biology editors inputmethod net textproc
5758: cad emulators lang news time
5759: chat finance mail parallel wm
5760: comms fonts math pkgtools www
5761: converters games mbone print x11
5762: </pre>
5763:
5764: <p>Please pay attention to the following gotchas:</p>
5765:
5766: <div class="itemizedlist">
5767: <ul type="disc">
5768: <li>
1.14 xtraeme 5769: <p>Add <code class="varname">MANCOMPRESSED</code>
5770: if manpages are installed in compressed form by the
5771: package; see comment in <code class=
5772: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 5773: </li>
5774:
5775: <li>
1.14 xtraeme 5776: <p>Replace <code class="filename">/usr/local</code>
1.1 grant 5777: with “<span class=
5778: "quote">${PREFIX}</span>” in all files (see
5779: patches, below).</p>
5780: </li>
5781:
5782: <li>
5783: <p>If the package installs any info files, see
5784: <a href="#faq.info-files" title=
1.38 dillo 5785: "15.5.7. Packages installing info files">Section
5786: 15.5.7, “Packages installing info
1.1 grant 5787: files”</a>.</p>
5788: </li>
5789:
5790: <li>
1.14 xtraeme 5791: <p>Set <code class="varname">MAINTAINER</code> to
5792: be yourself. If you really can't maintain the
5793: package for future updates, set it to <code class=
1.1 grant 5794: "email"><<a href=
1.14 xtraeme 5795: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.1 grant 5796: </li>
5797:
5798: <li>
5799: <p>If a home page for the software in question
1.14 xtraeme 5800: exists, add the variable <code class=
5801: "varname">HOMEPAGE</code> right after <code class=
5802: "varname">MAINTAINER</code>. The value of this
1.1 grant 5803: variable should be the URL for the home page.</p>
5804: </li>
5805:
5806: <li>
1.14 xtraeme 5807: <p>Be sure to set the <code class=
5808: "varname">COMMENT</code> variable to a short
1.1 grant 5809: description of the package, not containing the
5810: pkg's name.</p>
5811: </li>
5812: </ul>
5813: </div>
5814: </div>
5815:
5816: <div class="sect1" lang="en" xml:lang="en">
5817: <div class="titlepage">
5818: <div>
5819: <div>
5820: <h2 class="title" style="clear: both"><a name=
5821: "components.distinfo" id=
1.38 dillo 5822: "components.distinfo"></a>8.2. <code class=
1.14 xtraeme 5823: "filename">distinfo</code></h2>
1.1 grant 5824: </div>
5825: </div>
5826: </div>
5827:
5828: <p>Most important, the mandatory message digest, or
5829: checksum, of all the distfiles needed for the package to
5830: compile, confirming they match the original file
5831: distributed by the author. This ensures that the distfile
5832: retrieved from the Internet has not been corrupted during
5833: transfer or altered by a malign force to introduce a
1.14 xtraeme 5834: security hole. It is generated using the
5835: <span><strong class="command">make
5836: makesum</strong></span> command. The digest algorithm
5837: used was, at one stage, md5, but that was felt lacking
5838: compared to sha1, and so sha1 is now the default
1.1 grant 5839: algorithm. The distfile size is also generated and stored
5840: in new distinfo files. The <a xmlns=
5841: "http://www.w3.org/TR/xhtml1/transitional" href=
5842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20 ben 5843: class="pkgname">pkgtools/digest</a> utility calculates
5844: all of the digests in the distinfo file, and it provides
5845: various different algorithms. At the current time, the
5846: algorithms provided are: <span class=
5847: "emphasis"><em>md5</em></span>, <span class=
5848: "emphasis"><em>rmd160</em></span>, <span class=
5849: "emphasis"><em>sha1</em></span>, <span class=
5850: "emphasis"><em>sha256</em></span>, <span class=
5851: "emphasis"><em>sha384</em></span> and <span class=
5852: "emphasis"><em>sha512</em></span>.</p>
1.1 grant 5853:
5854: <p>Some packages have different sets of distfiles on a
5855: per architecture basis, for example <a xmlns=
5856: "http://www.w3.org/TR/xhtml1/transitional" href=
5857: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20 ben 5858: class="pkgname">www/navigator</a>). These are kept in the
5859: same distinfo file and care should be taken when
5860: upgrading such a package to ensure distfile information
5861: is not lost.</p>
1.1 grant 5862:
5863: <p>The message digest/checksum for all the official
1.14 xtraeme 5864: patches found in the <code class=
5865: "filename">patches/</code> directory (see <a href=
5866: "#components.patches" title=
1.38 dillo 5867: "8.3. patches/*">Section 8.3,
1.1 grant 5868: “patches/*”</a>) for the package is also
1.14 xtraeme 5869: stored in the <code class="filename">distinfo</code>
5870: file. This is a message digest/checksum of all lines in
5871: the patch file except the NetBSD RCS Id. This file is
5872: generated by invoking <span><strong class="command">make
5873: makepatchsum</strong></span> (or <span><strong class=
5874: "command">make mps</strong></span> if you're in a
5875: hurry).</p>
1.1 grant 5876: </div>
5877:
5878: <div class="sect1" lang="en" xml:lang="en">
5879: <div class="titlepage">
5880: <div>
5881: <div>
5882: <h2 class="title" style="clear: both"><a name=
5883: "components.patches" id=
1.38 dillo 5884: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 5885: </div>
5886: </div>
5887: </div>
5888:
5889: <p>This directory contains files that are used by the
5890: <a href=
5891: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
5892: <span class="citerefentry"><span class=
5893: "refentrytitle">patch</span>(1)</span></a> command to
5894: modify the sources as distributed in the distribution
5895: file into a form that will compile and run perfectly on
5896: NetBSD. The files are applied successively in alphabetic
5897: order (as returned by a shell “<span class=
5898: "quote">patches/patch-*</span>” glob expansion), so
1.14 xtraeme 5899: <code class="filename">patch-aa</code> is applied before
5900: <code class="filename">patch-ab</code>, etc.</p>
1.1 grant 5901:
1.14 xtraeme 5902: <p>The <code class="filename">patch-*</code> files should
5903: be in <span><strong class="command">diff
5904: -bu</strong></span> format, and apply without a fuzz to
5905: avoid problems. (To force patches to apply with fuzz you
5906: can set <code class=
5907: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 5908: not put changes for more than one file into a single
5909: patch-file, as this will make future modifications more
5910: difficult.</p>
5911:
5912: <p>Similar, a file should be patched at most once, not
5913: several times by several different patches. If a file
5914: needs several patches, they should be combined into one
5915: file.</p>
5916:
5917: <p>One important thing to mention is to pay attention
5918: that no RCS IDs get stored in the patch files, as these
5919: will cause problems when later checked into the NetBSD
1.14 xtraeme 5920: CVS tree. Use the <span><strong class=
5921: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 5922: "http://www.w3.org/TR/xhtml1/transitional" href=
5923: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 5924: class="pkgname">pkgtools/pkgdiff</a> package to avoid
5925: these problems.</p>
1.1 grant 5926:
5927: <p>For even more automation, we recommend using
1.14 xtraeme 5928: <span><strong class="command">mkpatches</strong></span>
5929: from the same package to make a whole set of patches. You
5930: just have to backup files before you edit them to
5931: <code class="filename">filename.orig</code>, e.g. with
5932: <span><strong class="command">cp -p filename
5933: filename.orig</strong></span> or, easier, by using
5934: <span><strong class="command">pkgvi</strong></span> again
5935: from the same package. If you upgrade a package this way,
5936: you can easily compare the new set of patches with the
5937: previously existing one with <span><strong class=
5938: "command">patchdiff</strong></span>.</p>
1.1 grant 5939:
5940: <p>When you have finished a package, remember to generate
5941: the checksums for the patch files by using the
1.14 xtraeme 5942: <span><strong class="command">make
5943: makepatchsum</strong></span> command, see <a href=
5944: "#components.distinfo" title=
1.38 dillo 5945: "8.2. distinfo">Section 8.2,
1.14 xtraeme 5946: “<code class="filename">distinfo</code>”</a>.</p>
1.1 grant 5947:
5948: <p>Patch files that are distributed by the author or
1.14 xtraeme 5949: other maintainers can be listed in <code class=
5950: "varname">$PATCHFILES</code>.</p>
1.1 grant 5951:
5952: <p>If it is desired to store any patches that should not
5953: be committed into pkgsrc, they can be kept outside the
1.14 xtraeme 5954: pkgsrc tree in the <code class=
5955: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 5956: tree there is expected to have the same
5957: “<span class="quote">category/package</span>”
5958: structure as pkgsrc, and patches are expected to be
1.14 xtraeme 5959: stored inside these dirs (also known as <code class=
5960: "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
5961: you want to keep a private patch for <code class=
5962: "filename">pkgsrc/graphics/png</code>, keep it in
5963: <code class=
5964: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
5965: files in the named directory are expected to be patch
1.1 grant 5966: files, and <span class="emphasis"><em>they are applied
5967: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 5968: </div>
5969:
5970: <div class="sect1" lang="en" xml:lang="en">
5971: <div class="titlepage">
5972: <div>
5973: <div>
5974: <h2 class="title" style="clear: both"><a name=
1.30 wiz 5975: "other-mandatory-files" id=
1.38 dillo 5976: "other-mandatory-files"></a>8.4. Other
1.27 rillig 5977: mandatory files</h2>
5978: </div>
5979: </div>
5980: </div>
5981:
5982: <div class="variablelist">
5983: <dl>
5984: <dt><span class="term"><code class=
5985: "filename">DESCR</code></span></dt>
5986:
5987: <dd>
5988: <p>A multi-line description of the piece of
5989: software. This should include any credits where
5990: they are due. Please bear in mind that others do
5991: not share your sense of humour (or spelling
5992: idiosyncrasies), and that others will read
5993: everything that you write here.</p>
5994: </dd>
5995:
5996: <dt><span class="term"><code class=
5997: "filename">PLIST</code></span></dt>
5998:
5999: <dd>
6000: <p>This file governs the files that are installed
6001: on your system: all the binaries, manual pages,
6002: etc. There are other directives which may be
6003: entered in this file, to control the creation and
6004: deletion of directories, and the location of
6005: inserted files. See <a href="#plist" title=
1.38 dillo 6006: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6007: <i>PLIST issues</i></a> for more information.</p>
6008: </dd>
6009: </dl>
6010: </div>
6011: </div>
6012:
6013: <div class="sect1" lang="en" xml:lang="en">
6014: <div class="titlepage">
6015: <div>
6016: <div>
6017: <h2 class="title" style="clear: both"><a name=
6018: "components.optional" id=
1.38 dillo 6019: "components.optional"></a>8.5. Optional
1.27 rillig 6020: files</h2>
6021: </div>
6022: </div>
6023: </div>
6024:
6025: <div class="variablelist">
6026: <dl>
6027: <dt><span class="term"><code class=
6028: "filename">INSTALL</code></span></dt>
6029:
6030: <dd>
6031: <p>This shell script is invoked twice by <a href=
6032: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6033: <span class="citerefentry"><span class=
6034: "refentrytitle">pkg_add</span>(1)</span></a>. First
6035: time after package extraction and before files are
6036: moved in place, the second time after the files to
6037: install are moved in place. This can be used to do
6038: any custom procedures not possible with @exec
6039: commands in <code class="filename">PLIST</code>.
6040: See <a href=
6041: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6042: <span class="citerefentry"><span class=
6043: "refentrytitle">pkg_add</span>(1)</span></a> and
6044: <a href=
6045: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6046: <span class="citerefentry"><span class=
6047: "refentrytitle">pkg_create</span>(1)</span></a> for
6048: more information.</p>
6049: </dd>
6050:
6051: <dt><span class="term"><code class=
6052: "filename">DEINSTALL</code></span></dt>
6053:
6054: <dd>
6055: <p>This script is executed before and after any
6056: files are removed. It is this script's
6057: responsibility to clean up any additional messy
6058: details around the package's installation, since
6059: all pkg_delete knows is how to delete the files
6060: created in the original distribution. See <a href=
6061: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6062: <span class="citerefentry"><span class=
6063: "refentrytitle">pkg_delete</span>(1)</span></a> and
6064: <a href=
6065: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6066: <span class="citerefentry"><span class=
6067: "refentrytitle">pkg_create</span>(1)</span></a> for
6068: more information.</p>
6069: </dd>
6070:
6071: <dt><span class="term"><code class=
6072: "filename">MESSAGE</code></span></dt>
6073:
6074: <dd>
6075: <p>Display this file after installation of the
6076: package. Useful for things like legal notices on
6077: almost-free software and hints for updating config
6078: files after installing modules for apache, PHP etc.
6079: Please note that you can modify variables in it
6080: easily by using <code class=
6081: "varname">MESSAGE_SUBST</code> in the package's
6082: <code class="filename">Makefile</code>:</p>
6083: <pre class="programlisting">
6084: MESSAGE_SUBST+= SOMEVAR="somevalue"
6085: </pre>
6086:
6087: <p>replaces "${SOMEVAR}" with “<span class=
6088: "quote">somevalue</span>” in <code class=
6089: "filename">MESSAGE</code>.</p>
6090: </dd>
6091: </dl>
6092: </div>
6093: </div>
6094:
6095: <div class="sect1" lang="en" xml:lang="en">
6096: <div class="titlepage">
6097: <div>
6098: <div>
6099: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6100: "work-dir" id="work-dir"></a>8.6. <code class=
1.27 rillig 6101: "filename">work*</code></h2>
6102: </div>
6103: </div>
6104: </div>
6105:
6106: <p>When you type <span><strong class=
6107: "command">make</strong></span> the distribution files are
6108: unpacked into this directory. It can be removed by
6109: running <span><strong class="command">make
6110: clean</strong></span>. Besides the sources, this
6111: directory is also used to keep various timestamp
6112: files.</p>
6113:
6114: <p>If a package doesn't create a subdirectory for itself
6115: (like GNU software does, for instance), but extracts
6116: itself in the current directory, you should set
6117: <code class="varname">WRKSRC</code> accordingly, e.g.
6118: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
6119: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
6120: class="pkgname">editors/sam</a> again, but the quick
6121: answer is:</p>
6122: <pre class="programlisting">
6123: WRKSRC= ${WRKDIR}
6124: </pre>
6125:
6126: <p>Please note that the old <code class=
6127: "varname">NO_WRKSUBDIR</code> has been deprecated and
6128: should not be used. Also, if your package doesn't create
6129: a subdir with the name of <code class=
6130: "varname">DISTNAME</code> but some different name, set
6131: <code class="varname">WRKSRC</code> to point to the
6132: proper name in <code class="filename">${WRKDIR}</code>.
6133: See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
6134: href=
6135: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6136: class="pkgname">lang/tcl</a> and <a xmlns=
6137: "http://www.w3.org/TR/xhtml1/transitional" href=
6138: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6139: class="pkgname">x11/tk</a> for examples, and here is
6140: another one:</p>
6141: <pre class="programlisting">
6142: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
6143: </pre>
6144:
6145: <p>The name of the working directory created by pkgsrc is
6146: <code class="filename">work</code> by default. If the
6147: same pkgsrc tree should be used on several different
6148: platforms, the variable <code class=
6149: "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
6150: attach the platform to the directory name, e.g.
6151: <code class="filename">work.i386</code> or <code class=
6152: "filename">work.sparc</code>.</p>
6153: </div>
6154:
6155: <div class="sect1" lang="en" xml:lang="en">
6156: <div class="titlepage">
6157: <div>
6158: <div>
6159: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6160: "files-dir" id=
1.38 dillo 6161: "files-dir"></a>8.7. <code class=
1.27 rillig 6162: "filename">files/*</code></h2>
6163: </div>
6164: </div>
6165: </div>
6166:
6167: <p>If you have any files that you wish to be placed in
6168: the package prior to configuration or building, you could
6169: place these files here and use a “<span class=
6170: "quote">${CP}</span>” command in the
6171: “<span class="quote">pre-configure</span>”
6172: target to achieve this. Alternatively, you could simply
6173: diff the file against <code class=
6174: "filename">/dev/null</code> and use the patch mechanism
6175: to manage the creation of this file.</p>
6176: </div>
6177: </div>
6178:
6179: <div class="chapter" lang="en" xml:lang="en">
6180: <div class="titlepage">
6181: <div>
6182: <div>
6183: <h2 class="title"><a name="makefile" id=
1.38 dillo 6184: "makefile"></a>Chapter 9. Programming in
1.27 rillig 6185: <code class="filename">Makefile</code>s</h2>
6186: </div>
6187: </div>
6188: </div>
6189:
6190: <div class="toc">
6191: <p><b>Table of Contents</b></p>
6192:
6193: <dl>
6194: <dt><span class="sect1"><a href=
1.38 dillo 6195: "#makefile.variables">9.1. <code class=
1.27 rillig 6196: "filename">Makefile</code> variables</a></span></dt>
6197:
6198: <dd>
6199: <dl>
6200: <dt><span class="sect2"><a href=
1.38 dillo 6201: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6202: conventions</a></span></dt>
6203: </dl>
6204: </dd>
6205:
1.38 dillo 6206: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6207: Code snippets</a></span></dt>
6208:
6209: <dd>
6210: <dl>
1.30 wiz 6211: <dt><span class="sect2"><a href=
1.38 dillo 6212: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6213: list</a></span></dt>
1.27 rillig 6214:
1.30 wiz 6215: <dt><span class="sect2"><a href=
1.38 dillo 6216: "#converting-internal-to-external">9.2.2.
1.27 rillig 6217: Converting an internal list into an external
6218: list</a></span></dt>
6219:
1.30 wiz 6220: <dt><span class="sect2"><a href=
1.38 dillo 6221: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6222: variables to a shell command</a></span></dt>
1.27 rillig 6223:
1.30 wiz 6224: <dt><span class="sect2"><a href=
1.38 dillo 6225: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6226: guideline</a></span></dt>
1.27 rillig 6227:
1.30 wiz 6228: <dt><span class="sect2"><a href=
1.38 dillo 6229: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6230: bug in BSD Make</a></span></dt>
1.27 rillig 6231: </dl>
6232: </dd>
6233: </dl>
6234: </div>
6235:
6236: <p>Pkgsrc consists of many <code class=
6237: "filename">Makefile</code> fragments, each of which forms a
6238: well-defined part of the pkgsrc system. Using the <a href=
6239: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6240: <span class="citerefentry"><span class=
6241: "refentrytitle">make</span>(1)</span></a> system as a
6242: programming language for a big system like pkgsrc requires
6243: some discipline to keep the code correct and
6244: understandable.</p>
6245:
6246: <p>The basic ingredients for <code class=
6247: "filename">Makefile</code> programming are variables (which
6248: are actually macros) and shell commands. Among these shell
6249: commands may even be more complex ones like <a href=
6250: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6251: <span class="citerefentry"><span class=
6252: "refentrytitle">awk</span>(1)</span></a> programs. To make
6253: sure that every shell command runs as intended it is
6254: necessary to quote all variables correctly when they are
6255: used.</p>
6256:
6257: <p>This chapter describes some patterns, that appear quite
6258: often in <code class="filename">Makefile</code>s, including
6259: the pitfalls that come along with them.</p>
6260:
6261: <div class="sect1" lang="en" xml:lang="en">
6262: <div class="titlepage">
6263: <div>
6264: <div>
6265: <h2 class="title" style="clear: both"><a name=
6266: "makefile.variables" id=
1.38 dillo 6267: "makefile.variables"></a>9.1. <code class=
1.27 rillig 6268: "filename">Makefile</code> variables</h2>
6269: </div>
6270: </div>
6271: </div>
6272:
6273: <p><code class="filename">Makefile</code> variables
6274: contain strings that can be processed using the five
6275: operators ``='', ``+='', ``?='', ``:='', and ``!='',
6276: which are described in the <a href=
6277: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6278: <span class="citerefentry"><span class=
6279: "refentrytitle">make</span>(1)</span></a> man page.</p>
6280:
6281: <p>When a variable's value is parsed from a <code class=
6282: "filename">Makefile</code>, the hash character ``#'' and
6283: the backslash character ``\'' are handled specially. If a
6284: backslash is followed by a newline, any whitespace
6285: immediately in front of the backslash, the backslash, the
6286: newline, and any whitespace immediately behind the
6287: newline are replaced with a single space. A backspace
6288: character and an immediately following hash character are
6289: replaced with a single hash character. Otherwise the
6290: backslash is passed as is. In a variable assignment, any
6291: hash character that is not preceded by a backslash starts
6292: a comment that continues upto the end of the logical
6293: line.</p>
6294:
6295: <p><span class="emphasis"><em>Note:</em></span> Because
6296: of this parsing algorithm the only way to create a
6297: variable consisting of a single backslash is using the
6298: ``!='' operator, for example: <code class=
6299: "varname">BACKSLASH!=echo "\\"</code>.</p>
6300:
6301: <p>So far for defining variables. The other thing you can
6302: do with variables is evaluating them. A variable is
6303: evaluated when it is part of the right side of the ``:=''
6304: or the ``!='' operator, or directly before executing a
6305: shell command which the variable is part of. In all other
6306: cases <a href=
6307: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6308: <span class="citerefentry"><span class=
6309: "refentrytitle">make</span>(1)</span></a> performs lazy
6310: evaluation, that is, variables are not evaluated until
6311: there's no other way. The ``modifiers'' mentioned in the
6312: man page also evaluate the variable.</p>
6313:
6314: <p>Some of the modifiers split the string into words and
6315: then operate on the words, others operate on the string
6316: as a whole. When a string is splitted into words, it is
6317: splitted as you would expect it from <a href=
6318: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
6319: <span class="citerefentry"><span class=
6320: "refentrytitle">sh</span>(1)</span></a>.</p>
6321:
6322: <p>No rule without exception—the
6323: <span><strong class="command">.for</strong></span> loop
6324: does not follow the shell quoting rules but splits at
6325: sequences of whitespace.</p>
6326:
6327: <p>There are several types of variables that should be
6328: handled differently. Strings and two types of lists.</p>
6329:
6330: <div class="itemizedlist">
6331: <ul type="disc">
6332: <li>
6333: <p><span class="emphasis"><em>Strings</em></span>
6334: can contain arbitrary characters. Nevertheless you
6335: should restrict yourself to only using printable
6336: characters. Examples are <code class=
6337: "varname">PREFIX</code> and <code class=
6338: "varname">COMMENT</code>.</p>
6339: </li>
6340:
6341: <li>
6342: <p><span class="emphasis"><em>Internal
6343: lists</em></span> are lists that are never exported
6344: to any shell command. Their elements are separated
6345: by whitespace. Therefore the elements themselves
6346: cannot have embedded whitespace. Any other
6347: characters are allowed. Internal lists can be used
6348: in <span><strong class=
6349: "command">.for</strong></span> loops. Examples are
6350: <code class="varname">DEPENDS</code> and
6351: <code class="varname">BUILD_DEPENDS</code>.</p>
6352: </li>
6353:
6354: <li>
6355: <p><span class="emphasis"><em>External
6356: lists</em></span> are lists that may be exported to
6357: a shell command. Their elements can contain any
6358: characters, including whitespace. That's why they
6359: cannot be used in <span><strong class=
6360: "command">.for</strong></span> loops. Examples are
6361: <code class="varname">DISTFILES</code> and
6362: <code class="varname">MASTER_SITES</code>.</p>
6363: </li>
6364: </ul>
6365: </div>
6366:
6367: <div class="sect2" lang="en" xml:lang="en">
6368: <div class="titlepage">
6369: <div>
6370: <div>
6371: <h3 class="title"><a name=
6372: "makefile.variables.names" id=
1.38 dillo 6373: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 6374: conventions</h3>
6375: </div>
6376: </div>
6377: </div>
6378:
6379: <div class="itemizedlist">
6380: <ul type="disc">
6381: <li>
6382: <p>All variable names starting with an underscore
6383: are reserved for use by the pkgsrc
6384: infrastructure. They shall not be used by package
6385: <code class="filename">Makefile</code>s.</p>
6386: </li>
6387:
6388: <li>
6389: <p>In <span><strong class=
6390: "command">.for</strong></span> loops you should
6391: use lowercase variable names for the iteration
6392: variables.</p>
6393: </li>
6394:
6395: <li>
6396: <p>All list variables should have a ``plural''
6397: name, e.g. <code class=
6398: "varname">PKG_OPTIONS</code> or <code class=
6399: "varname">DISTFILES</code>.</p>
6400: </li>
6401: </ul>
6402: </div>
6403: </div>
6404: </div>
6405:
6406: <div class="sect1" lang="en" xml:lang="en">
6407: <div class="titlepage">
6408: <div>
6409: <div>
6410: <h2 class="title" style="clear: both"><a name=
6411: "makefile.code" id=
1.38 dillo 6412: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 6413: </div>
6414: </div>
6415: </div>
6416:
6417: <p>This section presents you with some code snippets you
6418: should use in your own code. If you don't find anything
6419: appropriate here, you should test your code and add it
6420: here.</p>
6421:
6422: <div class="sect2" lang="en" xml:lang="en">
6423: <div class="titlepage">
6424: <div>
6425: <div>
1.30 wiz 6426: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 6427: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 6428: a list</h3>
1.27 rillig 6429: </div>
6430: </div>
6431: </div>
6432: <pre class="programlisting">
6433: STRING= foo * bar `date`
6434: INT_LIST= # empty
6435: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
6436: EXT_LIST= # empty
6437: ANOTHER_EXT_LIST= a=b c=d
6438:
6439: INT_LIST+= ${STRING} # 1
6440: INT_LIST+= ${ANOTHER_INT_LIST} # 2
6441: EXT_LIST+= ${STRING:Q} # 3
6442: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
6443:
6444: </pre>
6445:
6446: <p>When you add a string to an external list (example
6447: 3), it must be quoted. In all other cases, you must not
6448: add a quoting level. You must not merge internal and
6449: external lists, unless you are sure that all entries
6450: are correctly interpreted in both lists.</p>
6451: </div>
6452:
6453: <div class="sect2" lang="en" xml:lang="en">
6454: <div class="titlepage">
6455: <div>
6456: <div>
1.30 wiz 6457: <h3 class="title"><a name=
6458: "converting-internal-to-external" id=
1.38 dillo 6459: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 6460: an internal list into an external list</h3>
1.27 rillig 6461: </div>
6462: </div>
6463: </div>
6464: <pre class="programlisting">
6465: EXT_LIST= # empty
6466: .for i in ${INT_LIST}
6467: EXT_LIST+= ${i:Q}""
6468: .endfor
6469:
6470: </pre>
6471:
6472: <p>This code converts the internal list <code class=
6473: "varname">INT_LIST</code> into the external list
6474: <code class="varname">EXT_LIST</code>. As the elements
6475: of an internal list are unquoted they must be quoted
6476: here. The reason for appending <code class=
6477: "varname">""</code> is explained below.</p>
6478: </div>
1.1 grant 6479:
1.27 rillig 6480: <div class="sect2" lang="en" xml:lang="en">
6481: <div class="titlepage">
1.1 grant 6482: <div>
1.27 rillig 6483: <div>
1.30 wiz 6484: <h3 class="title"><a name=
6485: "passing-variable-to-shell" id=
1.38 dillo 6486: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 6487: variables to a shell command</h3>
1.27 rillig 6488: </div>
1.1 grant 6489: </div>
6490: </div>
1.27 rillig 6491: <pre class="programlisting">
6492: STRING= foo bar < > * `date` $$HOME ' "
6493: EXT_LIST= string=${STRING:Q} x=second\ item
6494:
6495: all:
6496: echo ${STRING} # 1
6497: echo "${STRING}" # 2
6498: echo "${STRING:Q}" # 3
6499: echo ${STRING:Q} # 4
6500: echo x${STRING:Q} | sed 1s,.,, # 5
6501: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
6502:
6503: </pre>
6504:
6505: <p>Example 1 leads to a syntax error in the shell, as
6506: the characters are just copied.</p>
6507:
6508: <p>Example 2 leads to a syntax error too, and if you
6509: leave out the last " character from <code class=
6510: "varname">${STRING}</code>, <a href=
6511: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
6512: <span class="citerefentry"><span class=
6513: "refentrytitle">date</span>(1)</span></a> will be
6514: executed. The <code class="varname">$HOME</code> shell
6515: variable would be evaluated, too.</p>
6516:
6517: <p>Example 3 outputs each space character preceded by a
6518: backslash (or not), depending on the implementation of
6519: the <a href=
6520: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6521: <span class="citerefentry"><span class=
6522: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 6523:
1.27 rillig 6524: <p>Example 4 handles correctly every string that does
6525: not start with a dash. In that case, the result depends
6526: on the implementation of the <a href=
6527: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6528: <span class="citerefentry"><span class=
6529: "refentrytitle">echo</span>(1)</span></a> command. As
6530: long as you can guarantee that your input does not
6531: start with a dash this form is appropriate.</p>
1.1 grant 6532:
1.27 rillig 6533: <p>Example 5 handles even the case of a leading dash
6534: correctly.</p>
1.1 grant 6535:
1.27 rillig 6536: <p>The <code class="varname">EXT_LIST</code> does not
6537: need to be quoted because the quoting has already be
6538: done when adding elements to the list.</p>
1.1 grant 6539:
1.27 rillig 6540: <p>As internal lists shall not be passed to the shell,
6541: there is no example for it.</p>
1.1 grant 6542: </div>
6543:
1.27 rillig 6544: <div class="sect2" lang="en" xml:lang="en">
6545: <div class="titlepage">
1.1 grant 6546: <div>
1.27 rillig 6547: <div>
1.30 wiz 6548: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 6549: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 6550: guideline</h3>
6551: </div>
1.1 grant 6552: </div>
6553: </div>
6554:
1.27 rillig 6555: <p>There are many possible sources of wrongly quoted
6556: variables. This section lists some of the commonly
6557: known ones.</p>
1.1 grant 6558:
1.27 rillig 6559: <div class="itemizedlist">
6560: <ul type="disc">
6561: <li>
6562: <p>Whenever you use the value of a list, think
6563: about what happens to leading or trailing
6564: whitespace. If the list is a well-formed shell
6565: expression you can apply the <code class=
6566: "varname">:M*</code> modifier to strip leading
6567: and trailing whitespace from each word. The
6568: <code class="varname">:M</code> operator first
6569: splits its argument according to the rules of the
6570: shell, and then creates a new list consisting of
6571: all words that match the shell glob expression
6572: <code class="varname">*</code>, that is: all. One
6573: class of situations where this is needed is when
6574: adding a variable like <code class=
6575: "varname">CPPFLAGS</code> to <code class=
6576: "varname">CONFIGURE_ARGS</code>. If the configure
6577: script invokes other configure scripts it strips
6578: the leading and trailing whitespace from the
6579: variable and then passes it to the other
6580: configure scripts. But these configure scripts
6581: expect the (child) <code class=
6582: "varname">CPPFLAGS</code> variable to be the same
6583: as the parent <code class=
6584: "varname">CPPFLAGS</code>. That's why we better
6585: pass the <code class="varname">CPPFLAGS</code>
6586: value properly trimmed. And here is how we do
6587: it:</p>
6588: <pre class="programlisting">
6589: CPPFLAGS= # empty
6590: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
6591: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 6592:
1.27 rillig 6593: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 6594:
1.27 rillig 6595: all:
6596: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
6597: echo x${CONFIGURE_ARGS}x # properly trimmed
6598:
6599: </pre>
6600: </li>
1.1 grant 6601:
1.27 rillig 6602: <li>
6603: <p>The example above contains one bug: The
6604: <code class="varname">${PREFIX}</code> is a
6605: properly quoted shell expression, but there is
6606: the C compiler after it, which also expects a
6607: properly quoted string (this time in C syntax).
6608: The version above is therefore only correct if
6609: <code class="varname">${PREFIX}</code> does not
6610: have embedded backslashes or double quotes. If
6611: you want to allow these, you have to add another
6612: layer of quoting to each variable that is used as
6613: a C string literal. You cannot use the
6614: <code class="varname">:Q</code> operator for it,
6615: as this operator only works for the shell.</p>
6616: </li>
1.1 grant 6617:
1.27 rillig 6618: <li>
6619: <p>Whenever a variable can be empty the
6620: <code class="varname">:Q</code> operator can have
6621: surprising results. Here are two completely
6622: different cases which can be solved with the same
6623: trick.</p>
6624: <pre class="programlisting">
6625: EMPTY= # empty
6626: empty_test:
6627: for i in a ${EMPTY:Q} c; do \
6628: echo "$$i"; \
6629: done
6630:
6631: for_test:
6632: .for i in a:\ a:\test.txt
6633: echo ${i:Q}
6634: echo "foo"
6635: .endfor
6636:
1.1 grant 6637: </pre>
6638:
1.27 rillig 6639: <p>The first example will only print two of the
6640: three lines we might have expected. This is
6641: because <code class="varname">${EMPTY:Q}</code>
6642: expands to the empty string, which the shell
6643: cannot see. The workaround is to write
6644: <code class="varname">${EMPTY:Q}""</code>. This
6645: pattern can be often found as <code class=
6646: "varname">${TEST} -z ${VAR:Q}</code> or as
6647: <code class="varname">${TEST} -f
6648: ${FNAME:Q}</code> (both of these are wrong).</p>
6649:
6650: <p>The second example will only print three lines
6651: instead of four. The first line looks like
6652: <code class="varname">a:\ echo foo</code>. This
6653: is because the backslash of the value
6654: <code class="varname">a:\</code> is interpreted
6655: as a line-continuation by <a href=
6656: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6657: <span class="citerefentry"><span class=
6658: "refentrytitle">make</span>(1)</span></a>, which
6659: makes the second line the arguments of the
6660: <a href=
6661: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
6662: <span class="citerefentry"><span class=
6663: "refentrytitle">echo</span>(1)</span></a> command
6664: from the first line. To avoid this, write
6665: <code class="varname">${i:Q}""</code>.</p>
6666: </li>
6667: </ul>
6668: </div>
1.1 grant 6669: </div>
6670:
1.27 rillig 6671: <div class="sect2" lang="en" xml:lang="en">
6672: <div class="titlepage">
1.1 grant 6673: <div>
1.27 rillig 6674: <div>
1.30 wiz 6675: <h3 class="title"><a name=
6676: "bsd-make-bug-workaround" id=
1.38 dillo 6677: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 6678: for a bug in BSD Make</h3>
1.27 rillig 6679: </div>
1.1 grant 6680: </div>
6681: </div>
6682:
1.27 rillig 6683: <p>The pkgsrc bmake program does not handle the
6684: following assignment correctly. In case <code class=
6685: "varname">_othervar_</code> contains a ``-'' character,
6686: one of the closing braces is included in <code class=
6687: "varname">${VAR}</code> after this code executes.</p>
6688: <pre class="programlisting">
6689: VAR:= ${VAR:N${_othervar_:C/-//}}
6690:
1.1 grant 6691: </pre>
6692:
1.27 rillig 6693: <p>For a more complex code snippet and a workaround,
6694: see the package <a xmlns=
6695: "http://www.w3.org/TR/xhtml1/transitional" href=
6696: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
6697: class="pkgname">regress/make-quoting</a>, testcase
6698: <code class="varname">bug1</code>.</p>
1.1 grant 6699: </div>
6700: </div>
6701: </div>
6702:
6703: <div class="chapter" lang="en" xml:lang="en">
6704: <div class="titlepage">
6705: <div>
6706: <div>
6707: <h2 class="title"><a name="plist" id=
1.38 dillo 6708: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 6709: </div>
6710: </div>
6711: </div>
6712:
6713: <div class="toc">
6714: <p><b>Table of Contents</b></p>
6715:
6716: <dl>
1.38 dillo 6717: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 6718: ID</a></span></dt>
6719:
1.30 wiz 6720: <dt><span class="sect1"><a href=
1.38 dillo 6721: "#automatic-plist-generation">10.2. Semi-automatic
1.30 wiz 6722: <code class="filename">PLIST</code>
1.14 xtraeme 6723: generation</a></span></dt>
1.1 grant 6724:
1.38 dillo 6725: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 6726: Tweaking output of <span><strong class="command">make
6727: print-PLIST</strong></span></a></span></dt>
1.1 grant 6728:
1.38 dillo 6729: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 6730: Variable substitution in PLIST</a></span></dt>
6731:
1.30 wiz 6732: <dt><span class="sect1"><a href=
1.38 dillo 6733: "#manpage-compression">10.5.
1.1 grant 6734: Manpage-compression</a></span></dt>
6735:
1.38 dillo 6736: <dt><span class="sect1"><a href=
6737: "#using-PLIST_SRC">10.6. Changing PLIST source with
6738: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6739:
1.30 wiz 6740: <dt><span class="sect1"><a href=
1.38 dillo 6741: "#platform-specific-plist">10.7. Platform specific and
1.30 wiz 6742: differing PLISTs</a></span></dt>
1.1 grant 6743:
1.38 dillo 6744: <dt><span class="sect1"><a href=
6745: "#faq.common-dirs">10.8. Sharing directories between
6746: packages</a></span></dt>
1.1 grant 6747: </dl>
6748: </div>
6749:
1.14 xtraeme 6750: <p>The <code class="filename">PLIST</code> file contains a
1.1 grant 6751: package's “<span class="quote">packing
6752: list</span>”, i.e. a list of files that belong to the
1.14 xtraeme 6753: package (relative to the <code class=
6754: "filename">${PREFIX}</code> directory it's been installed
6755: in) plus some additional statements - see the <a href=
1.1 grant 6756: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6757: <span class="citerefentry"><span class=
6758: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
6759: a full list. This chapter addresses some issues that need
1.14 xtraeme 6760: attention when dealing with the <code class=
6761: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 6762:
6763: <div class="sect1" lang="en" xml:lang="en">
6764: <div class="titlepage">
6765: <div>
6766: <div>
6767: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6768: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 6769: </div>
6770: </div>
6771: </div>
6772:
6773: <p>Be sure to add a RCS ID line as the first thing in any
1.14 xtraeme 6774: <code class="filename">PLIST</code> file you write:</p>
1.1 grant 6775: <pre class="programlisting">
1.17 sketch 6776: @comment $NetBSD$
1.1 grant 6777: </pre>
6778: </div>
6779:
6780: <div class="sect1" lang="en" xml:lang="en">
6781: <div class="titlepage">
6782: <div>
6783: <div>
6784: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6785: "automatic-plist-generation" id=
1.38 dillo 6786: "automatic-plist-generation"></a>10.2. Semi-automatic
1.14 xtraeme 6787: <code class="filename">PLIST</code> generation</h2>
1.1 grant 6788: </div>
6789: </div>
6790: </div>
6791:
1.14 xtraeme 6792: <p>You can use the <span><strong class="command">make
6793: print-PLIST</strong></span> command to output a PLIST
6794: that matches any new files since the package was
6795: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 6796: "14.3. Other helpful targets">Section 14.3,
1.1 grant 6797: “Other helpful targets”</a> for more
6798: information on this target.</p>
6799: </div>
6800:
6801: <div class="sect1" lang="en" xml:lang="en">
6802: <div class="titlepage">
6803: <div>
6804: <div>
6805: <h2 class="title" style="clear: both"><a name=
6806: "print-PLIST" id=
1.38 dillo 6807: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 6808: <span><strong class="command">make
6809: print-PLIST</strong></span></h2>
1.1 grant 6810: </div>
6811: </div>
6812: </div>
6813:
6814: <p>If you have used any of the *-dirs packages, as
6815: explained in <a href="#faq.common-dirs" title=
1.38 dillo 6816: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 6817: “Sharing directories between packages”</a>,
1.14 xtraeme 6818: you may have noticed that <span><strong class=
6819: "command">make print-PLIST</strong></span> outputs a set
6820: of <code class="varname">@comment</code>s instead of real
6821: <code class="varname">@dirrm</code> lines. You can also
6822: do this for specific directories and files, so that the
6823: results of that command are very close to reality. This
6824: helps <span class="emphasis"><em>a lot</em></span> during
6825: the update of packages.</p>
6826:
6827: <p>The <code class="varname">PRINT_PLIST_AWK</code>
6828: variable takes a set of AWK patterns and actions that are
6829: used to filter the output of print-PLIST. You can
6830: <span class="emphasis"><em>append</em></span> any chunk
6831: of AWK scripting you like to it, but be careful with
1.1 grant 6832: quoting.</p>
6833:
1.14 xtraeme 6834: <p>For example, to get all files inside the <code class=
6835: "filename">libdata/foo</code> directory removed from the
1.1 grant 6836: resulting PLIST:</p>
6837: <pre class="programlisting">
6838: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
6839:
6840: </pre>
6841:
1.14 xtraeme 6842: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 6843: lines referring to a specific (shared) directory
1.14 xtraeme 6844: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 6845: <pre class="programlisting">
6846: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
6847:
6848: </pre>
6849: </div>
6850:
6851: <div class="sect1" lang="en" xml:lang="en">
6852: <div class="titlepage">
6853: <div>
6854: <div>
6855: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6856: "plist.misc" id=
6857: "plist.misc"></a>10.4. Variable substitution
6858: in PLIST</h2>
1.1 grant 6859: </div>
6860: </div>
6861: </div>
6862:
6863: <p>A number of variables are substituted automatically in
6864: PLISTs when a package is installed on a system. This
6865: includes the following variables:</p>
6866:
6867: <div class="variablelist">
6868: <dl>
1.14 xtraeme 6869: <dt><span class="term"><code class=
6870: "varname">${MACHINE_ARCH}</code>, <code class=
6871: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 6872:
6873: <dd>
6874: <p>Some packages like emacs and perl embed
6875: information about which architecture they were
6876: built on into the pathnames where they install
6877: their file. To handle this case, PLIST will be
6878: preprocessed before actually used, and the symbol
1.14 xtraeme 6879: “<span class="quote"><code class=
6880: "varname">${MACHINE_ARCH}</code></span>” will
6881: be replaced by what <span><strong class=
6882: "command">uname -p</strong></span> gives. The same
6883: is done if the string <code class=
6884: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
6885: PLIST somewhere - use this on packages that have
6886: GNU autoconf created configure scripts.</p>
1.1 grant 6887:
6888: <div class="note" style=
6889: "margin-left: 0.5in; margin-right: 0.5in;">
6890: <h3 class="title">Legacy note</h3>
6891:
6892: <p>There used to be a symbol “<span class=
1.14 xtraeme 6893: "quote"><code class=
6894: "varname">$ARCH</code></span>” that was
6895: replaced by the output of <span><strong class=
6896: "command">uname -m</strong></span>, but that's no
1.1 grant 6897: longer supported and has been removed.</p>
6898: </div>
6899: </dd>
6900:
1.14 xtraeme 6901: <dt><span class="term"><code class=
6902: "varname">${OPSYS}</code>, <code class=
6903: "varname">${LOWER_OPSYS}</code>, <code class=
6904: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 6905:
6906: <dd>
6907: <p>Some packages want to embed the OS name and
6908: version into some paths. To do this, use these
1.14 xtraeme 6909: variables in the <code class=
6910: "filename">PLIST</code>:</p>
1.1 grant 6911:
6912: <div class="itemizedlist">
6913: <ul type="disc">
6914: <li>
1.14 xtraeme 6915: <p><code class="varname">${OPSYS}</code> -
6916: output of “<span class=
6917: "quote"><span><strong class="command">uname
6918: -s</strong></span></span>”</p>
1.1 grant 6919: </li>
6920:
6921: <li>
1.14 xtraeme 6922: <p><code class=
6923: "varname">${LOWER_OPSYS}</code> - lowercase
6924: common name (eg. “<span class=
6925: "quote">solaris</span>”)</p>
1.1 grant 6926: </li>
6927:
6928: <li>
1.14 xtraeme 6929: <p><code class="varname">${OS_VERSION}</code>
6930: - “<span class=
6931: "quote"><span><strong class="command">uname
6932: -r</strong></span></span>”</p>
1.1 grant 6933: </li>
6934: </ul>
6935: </div>
6936: </dd>
6937:
1.14 xtraeme 6938: <dt><span class="term"><code class=
6939: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 6940:
6941: <dd>
6942: <p>Packages that install locale files should list
6943: them in the PLIST as “<span class=
6944: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
6945: instead of “<span class=
6946: "quote">share/locale/de/LC_MESSAGES/...</span>”.
6947: This properly handles the fact that different
6948: operating systems expect locale files to be either
1.14 xtraeme 6949: in <code class="filename">share</code> or
6950: <code class="filename">lib</code> by default.</p>
1.1 grant 6951: </dd>
6952: </dl>
6953: </div>
6954:
6955: <p>For a complete list of values which are replaced by
1.14 xtraeme 6956: default, please look in <code class=
6957: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 6958: "emphasis"><em>PLIST_SUBST</em></span>).</p>
6959:
6960: <p>If you want to change other variables not listed
6961: above, you can add variables and their expansions to this
1.14 xtraeme 6962: variable in the following way, similar to <code class=
6963: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 6964: "#components.optional" title=
1.38 dillo 6965: "8.5. Optional files">Section 8.5,
1.1 grant 6966: “Optional files”</a>):</p>
6967: <pre class="programlisting">
6968: PLIST_SUBST+= SOMEVAR="somevalue"
6969: </pre>
6970:
6971: <p>This replaces all occurrences of “<span class=
6972: "quote">${SOMEVAR}</span>” in the PLIST with
6973: “<span class="quote">somevalue</span>”.</p>
6974: </div>
6975:
6976: <div class="sect1" lang="en" xml:lang="en">
6977: <div class="titlepage">
6978: <div>
6979: <div>
6980: <h2 class="title" style="clear: both"><a name=
1.30 wiz 6981: "manpage-compression" id=
1.38 dillo 6982: "manpage-compression"></a>10.5. Manpage-compression</h2>
1.1 grant 6983: </div>
6984: </div>
6985: </div>
6986:
6987: <p>Manpages should be installed in compressed form if
1.14 xtraeme 6988: <code class="varname">MANZ</code> is set (in <code class=
6989: "filename">bsd.own.mk</code>), and uncompressed
6990: otherwise. To handle this in the <code class=
6991: "filename">PLIST</code> file, the suffix
6992: “<span class="quote">.gz</span>” is
6993: appended/removed automatically for manpages according to
6994: <code class="varname">MANZ</code> and <code class=
6995: "varname">MANCOMPRESSED</code> being set or not, see
6996: above for details. This modification of the <code class=
6997: "filename">PLIST</code> file is done on a copy of it, not
6998: <code class="filename">PLIST</code> itself.</p>
1.1 grant 6999: </div>
7000:
7001: <div class="sect1" lang="en" xml:lang="en">
7002: <div class="titlepage">
7003: <div>
7004: <div>
7005: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7006: "using-PLIST_SRC" id=
1.38 dillo 7007: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7008: source with <code class=
1.14 xtraeme 7009: "varname">PLIST_SRC</code></h2>
1.1 grant 7010: </div>
7011: </div>
7012: </div>
7013:
1.14 xtraeme 7014: <p>To use one or more files as source for the
7015: <code class="filename">PLIST</code> used in generating
7016: the binary package, set the variable <code class=
7017: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7018: The files are later concatenated using <a href=
7019: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7020: <span class="citerefentry"><span class=
7021: "refentrytitle">cat</span>(1)</span></a>, and order of
7022: things is important.</p>
1.1 grant 7023: </div>
7024:
7025: <div class="sect1" lang="en" xml:lang="en">
7026: <div class="titlepage">
7027: <div>
7028: <div>
7029: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7030: "platform-specific-plist" id=
1.38 dillo 7031: "platform-specific-plist"></a>10.7. Platform
1.1 grant 7032: specific and differing PLISTs</h2>
7033: </div>
7034: </div>
7035: </div>
7036:
7037: <p>Some packages decide to install a different set of
7038: files based on the operating system being used. These
7039: differences can be automatically handled by using the
7040: following files:</p>
7041:
7042: <div class="itemizedlist">
7043: <ul type="disc">
7044: <li>
1.14 xtraeme 7045: <p><code class="filename">PLIST.common</code></p>
1.1 grant 7046: </li>
7047:
7048: <li>
1.14 xtraeme 7049: <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1 grant 7050: </li>
7051:
7052: <li>
1.14 xtraeme 7053: <p><code class=
1.21 ben 7054: "filename">PLIST.${MACHINE_ARCH}</code></p>
7055: </li>
7056:
7057: <li>
7058: <p><code class=
7059: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7060: </li>
7061:
7062: <li>
7063: <p><code class=
1.14 xtraeme 7064: "filename">PLIST.common_end</code></p>
1.1 grant 7065: </li>
7066: </ul>
7067: </div>
7068: </div>
7069:
7070: <div class="sect1" lang="en" xml:lang="en">
7071: <div class="titlepage">
7072: <div>
7073: <div>
7074: <h2 class="title" style="clear: both"><a name=
7075: "faq.common-dirs" id=
1.38 dillo 7076: "faq.common-dirs"></a>10.8. Sharing
7077: directories between packages</h2>
1.1 grant 7078: </div>
7079: </div>
7080: </div>
7081:
7082: <p>A “<span class="quote">shared
7083: directory</span>” is a directory where multiple
7084: (and unrelated) packages install files. These directories
7085: are problematic because you have to add special tricks in
7086: the PLIST to conditionally remove them, or have some
7087: centralized package handle them.</p>
7088:
7089: <p>Within pkgsrc, you'll find both approaches. If a
7090: directory is shared by a few unrelated packages, it's
7091: often not worth to add an extra package to remove it.
7092: Therefore, one simply does:</p>
7093: <pre class="programlisting">
7094: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
7095:
7096: </pre>
7097:
7098: <p>in the PLISTs of all affected packages, instead of the
7099: regular "@dirrm" line.</p>
7100:
7101: <p>However, if the directory is shared across many
7102: packages, two different solutions are available:</p>
7103:
7104: <div class="orderedlist">
7105: <ol type="1">
7106: <li>
7107: <p>If the packages have a common dependency, the
7108: directory can be removed in that. For example, see
7109: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7110: href=
7111: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20 ben 7112: class="pkgname">textproc/scrollkeeper</a>, which
7113: removes the shared directory <code class=
7114: "filename">share/omf</code>.</p>
1.1 grant 7115: </li>
7116:
7117: <li>
7118: <p>If the packages using the directory are not
7119: related at all (they have no common dependencies),
7120: a *-dirs package is used.</p>
7121: </li>
7122: </ol>
7123: </div>
7124:
7125: <p>From now on, we'll discuss the second solution. To get
7126: an idea of the *-dirs packages available, issue:</p>
7127: <pre class="programlisting">
1.14 xtraeme 7128: <code class="prompt">%</code> cd .../pkgsrc
7129: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7130:
7131: </pre>
7132:
7133: <p>Their use from other packages is very simple. The
1.14 xtraeme 7134: <code class="varname">USE_DIRS</code> variable takes a
7135: list of package names (without the “<span class=
1.1 grant 7136: "quote">-dirs</span>” part) together with the
7137: required version number (always pick the latest one when
1.34 wiz 7138: writing new packages).</p>
1.1 grant 7139:
7140: <p>For example, if a package installs files under
1.14 xtraeme 7141: <code class="filename">share/applications</code>, it
7142: should have the following line in it:</p>
1.1 grant 7143: <pre class="programlisting">
7144: USE_DIRS+= xdg-1.1
7145:
7146: </pre>
7147:
1.14 xtraeme 7148: <p>After regenerating the PLIST using
7149: <span><strong class="command">make
7150: print-PLIST</strong></span>, you should get the right
7151: (commented out) lines.</p>
1.1 grant 7152:
1.14 xtraeme 7153: <p>Note that, even if your package is using <code class=
7154: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7155: *-x11-dirs packages. Just specify the name without that
1.14 xtraeme 7156: part and pkgsrc (in particular, <code class=
7157: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7158: </div>
7159: </div>
7160:
7161: <div class="chapter" lang="en" xml:lang="en">
7162: <div class="titlepage">
7163: <div>
7164: <div>
7165: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7166: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7167: methodology</h2>
7168: </div>
7169: </div>
7170: </div>
7171:
7172: <div class="toc">
7173: <p><b>Table of Contents</b></p>
7174:
7175: <dl>
1.30 wiz 7176: <dt><span class="sect1"><a href=
1.38 dillo 7177: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7178: to use buildlink3</a></span></dt>
1.1 grant 7179:
1.30 wiz 7180: <dt><span class="sect1"><a href=
1.38 dillo 7181: "#creating-buildlink3.mk">11.2. Writing <code class=
1.30 wiz 7182: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7183:
7184: <dd>
7185: <dl>
1.25 rillig 7186: <dt><span class="sect2"><a href=
1.38 dillo 7187: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7188: buildlink3.mk file</a></span></dt>
1.1 grant 7189:
1.25 rillig 7190: <dt><span class="sect2"><a href=
1.38 dillo 7191: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7192: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7193: "replaceable"><code>pkg</code></em></code> in
7194: <code class="filename">buildlink3.mk</code>
1.1 grant 7195: files</a></span></dt>
7196: </dl>
7197: </dd>
7198:
1.30 wiz 7199: <dt><span class="sect1"><a href=
1.38 dillo 7200: "#writing-builtin.mk">11.3. Writing <code class=
1.30 wiz 7201: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7202:
7203: <dd>
7204: <dl>
1.25 rillig 7205: <dt><span class="sect2"><a href=
1.38 dillo 7206: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30 wiz 7207: <code class="filename">builtin.mk</code>
7208: file</a></span></dt>
1.1 grant 7209:
1.25 rillig 7210: <dt><span class="sect2"><a href=
1.38 dillo 7211: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7212: preferences for native or pkgsrc
7213: software</a></span></dt>
1.1 grant 7214: </dl>
7215: </dd>
7216: </dl>
7217: </div>
7218:
7219: <p>Buildlink is a framework in pkgsrc that controls what
7220: headers and libraries are seen by a package's configure and
7221: build processes. This is implemented in a two step
7222: process:</p>
7223:
7224: <div class="orderedlist">
7225: <ol type="1">
7226: <li>
7227: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7228: into <code class="varname">BUILDLINK_DIR</code>,
7229: which by default is a subdirectory of <code class=
7230: "varname">WRKDIR</code>.</p>
1.1 grant 7231: </li>
7232:
7233: <li>
7234: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7235: the normal compiler tools that translate <code class=
7236: "option">-I${LOCALBASE}/include</code> and
7237: <code class="option">-L${LOCALBASE}/lib</code> into
7238: references to <code class=
7239: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7240: also make native compiler on some operating systems
7241: look like GCC, so that packages that expect GCC won't
7242: require modifications to build with those native
7243: compilers.</p>
1.1 grant 7244: </li>
7245: </ol>
7246: </div>
7247:
7248: <p>This normalizes the environment in which a package is
7249: built so that the package may be built consistently despite
7250: what other software may be installed. Please note that the
1.14 xtraeme 7251: normal system header and library paths, e.g. <code class=
7252: "filename">/usr/include</code>, <code class=
7253: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 7254: buildlink3 is designed to insulate the package build from
7255: non-system-supplied software.</p>
7256:
7257: <div class="sect1" lang="en" xml:lang="en">
7258: <div class="titlepage">
7259: <div>
7260: <div>
7261: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7262: "converting-to-buildlink3" id=
1.38 dillo 7263: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 7264: packages to use buildlink3</h2>
1.1 grant 7265: </div>
7266: </div>
7267: </div>
7268:
7269: <p>The process of converting packages to use the
7270: buildlink3 framework (“<span class=
7271: "quote">bl3ifying</span>”) is fairly
7272: straightforward. The things to keep in mind are:</p>
7273:
7274: <div class="orderedlist">
7275: <ol type="1">
7276: <li>
7277: <p>Ensure that the build always calls the wrapper
7278: scripts instead of the actual toolchain. Some
7279: packages are tricky, and the only way to know for
1.14 xtraeme 7280: sure is the check <code class=
7281: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 7282: wrappers are being invoked.</p>
7283: </li>
7284:
7285: <li>
1.14 xtraeme 7286: <p>Don't override <code class=
7287: "varname">PREFIX</code> from within the package
7288: Makefile, e.g. Java VMs, standalone shells, etc.,
7289: because the code to symlink files into <code class=
7290: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 7291: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 7292: <em class=
7293: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 7294: </li>
7295:
7296: <li>
7297: <p>Remember that <span class=
1.14 xtraeme 7298: "emphasis"><em>only</em></span> the <code class=
7299: "filename">buildlink3.mk</code> files that you list
1.1 grant 7300: in a package's Makefile are added as dependencies
7301: for that package.</p>
7302: </li>
7303: </ol>
7304: </div>
7305:
7306: <p>If a dependency on a particular package is required
7307: for its libraries and headers, then we replace:</p>
7308: <pre class="programlisting">
1.27 rillig 7309: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 7310: </pre>
7311:
7312: <p>with</p>
7313: <pre class="programlisting">
7314: .include "../../category/foo/buildlink3.mk"
7315: </pre>
7316:
1.14 xtraeme 7317: <p>There are several <code class=
7318: "filename">buildlink3.mk</code> files in <code class=
7319: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 7320: issues:</p>
7321:
7322: <div class="itemizedlist">
7323: <ul type="disc">
7324: <li>
1.14 xtraeme 7325: <p><code class="filename">bdb.buildlink3.mk</code>
1.1 grant 7326: chooses either the native or a pkgsrc Berkeley DB
1.14 xtraeme 7327: implementation based on the values of <code class=
7328: "varname">BDB_ACCEPTED</code> and <code class=
7329: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 7330: </li>
7331:
7332: <li>
1.14 xtraeme 7333: <p><code class=
7334: "filename">curses.buildlink3.mk</code> If the
7335: system comes with neither Curses nor NCurses, this
7336: will take care to install the <a xmlns=
7337: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 7338: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20 ben 7339: class="pkgname">devel/ncurses</a> package.</p>
1.1 grant 7340: </li>
7341:
7342: <li>
1.14 xtraeme 7343: <p><code class="filename">krb5.buildlink3.mk</code>
7344: uses the value of <code class=
7345: "varname">KRB5_ACCEPTED</code> to choose between
1.1 grant 7346: adding a dependency on Heimdal or MIT-krb5 for
7347: packages that require a Kerberos 5
7348: implementation.</p>
7349: </li>
7350:
7351: <li>
1.14 xtraeme 7352: <p><code class=
7353: "filename">motif.buildlink3.mk</code> checks for a
7354: system-provided Motif installation or adds a
7355: dependency on <a xmlns=
1.1 grant 7356: "http://www.w3.org/TR/xhtml1/transitional" href=
7357: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20 ben 7358: class="pkgname">x11/lesstif</a> or <a xmlns=
7359: "http://www.w3.org/TR/xhtml1/transitional" href=
7360: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
7361: class="pkgname">x11/openmotif</a>;</p>
1.1 grant 7362: </li>
7363:
7364: <li>
1.14 xtraeme 7365: <p><code class=
7366: "filename">ossaudio.buildlink3.mk</code> defines
7367: several variables that may be used by packages that
7368: use the Open Sound System (OSS) API;</p>
1.1 grant 7369: </li>
7370:
7371: <li>
1.14 xtraeme 7372: <p><code class=
7373: "filename">pgsql.buildlink3.mk</code> will accept
7374: either Postgres 7.3 or 7.4, whichever is found
7375: installed. See the file for more information.</p>
1.1 grant 7376: </li>
7377:
7378: <li>
1.14 xtraeme 7379: <p><code class=
7380: "filename">pthread.buildlink3.mk</code> uses the
7381: value of <code class="varname">PTHREAD_OPTS</code>
7382: and checks for native pthreads or adds a dependency
7383: on <a xmlns=
1.1 grant 7384: "http://www.w3.org/TR/xhtml1/transitional" href=
7385: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20 ben 7386: class="pkgname">devel/pth</a> as needed;</p>
1.1 grant 7387: </li>
7388:
7389: <li>
1.14 xtraeme 7390: <p><code class="filename">xaw.buildlink3.mk</code>
7391: uses the value of <code class=
7392: "varname">XAW_TYPE</code> to choose a particular
7393: Athena widgets library.</p>
1.1 grant 7394: </li>
7395: </ul>
7396: </div>
7397:
1.14 xtraeme 7398: <p>The comments in those <code class=
7399: "filename">buildlink3.mk</code> files provide a more
1.1 grant 7400: complete description of how to use them properly.</p>
7401: </div>
7402:
7403: <div class="sect1" lang="en" xml:lang="en">
7404: <div class="titlepage">
7405: <div>
7406: <div>
7407: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7408: "creating-buildlink3.mk" id=
1.38 dillo 7409: "creating-buildlink3.mk"></a>11.2. Writing
1.14 xtraeme 7410: <code class="filename">buildlink3.mk</code>
7411: files</h2>
1.1 grant 7412: </div>
7413: </div>
7414: </div>
7415:
1.14 xtraeme 7416: <p>A package's <code class=
7417: "filename">buildlink3.mk</code> file is included by
7418: Makefiles to indicate the need to compile and link
7419: against header files and libraries provided by the
7420: package. A <code class="filename">buildlink3.mk</code>
7421: file should always provide enough information to add the
7422: correct type of dependency relationship and include any
7423: other <code class="filename">buildlink3.mk</code> files
7424: that it needs to find headers and libraries that it needs
7425: in turn.</p>
1.1 grant 7426:
1.14 xtraeme 7427: <p>To generate an initial <code class=
7428: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 7429: Rene Hexel's <a xmlns=
7430: "http://www.w3.org/TR/xhtml1/transitional" href=
7431: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20 ben 7432: class="pkgname">pkgtools/createbuildlink</a> package is
7433: highly recommended. For most packages, the following
7434: command will generate a good starting point for
7435: <code class="filename">buildlink3.mk</code> files:</p>
1.1 grant 7436: <pre class="screen">
1.14 xtraeme 7437: <code class="prompt">%</code> <strong class=
7438: "userinput"><code>cd pkgsrc/<em class=
7439: "replaceable"><code>category</code></em>/<em class=
7440: "replaceable"><code>pkgdir</code></em>
7441: <code class=
7442: "prompt">%</code> createbuildlink -3 >buildlink3.mk</code></strong>
1.1 grant 7443: </pre>
7444:
7445: <div class="sect2" lang="en" xml:lang="en">
7446: <div class="titlepage">
7447: <div>
7448: <div>
1.30 wiz 7449: <h3 class="title"><a name="anatomy-of-bl3" id=
1.38 dillo 7450: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 7451: buildlink3.mk file</h3>
1.1 grant 7452: </div>
7453: </div>
7454: </div>
7455:
1.14 xtraeme 7456: <p>The following real-life example <code class=
7457: "filename">buildlink3.mk</code> is taken from
7458: <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 7459: <pre class="programlisting">
1.17 sketch 7460: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 7461:
7462: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
7463: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
7464:
7465: .if !empty(BUILDLINK_DEPTH:M+)
7466: BUILDLINK_DEPENDS+= tiff
7467: .endif
7468:
7469: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
7470: BUILDLINK_PACKAGES+= tiff
7471:
7472: .if !empty(TIFF_BUILDLINK3_MK:M+)
7473: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
7474: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
7475: .endif # TIFF_BUILDLINK3_MK
7476:
7477: .include "../../devel/zlib/buildlink3.mk"
7478: .include "../../graphics/jpeg/buildlink3.mk"
7479:
7480: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
7481: </pre>
7482:
1.14 xtraeme 7483: <p>The header and footer manipulate <code class=
7484: "varname">BUILDLINK_DEPTH</code>, which is common
7485: across all <code class="filename">buildlink3.mk</code>
7486: files and is used to track at what depth we are
7487: including <code class="filename">buildlink3.mk</code>
7488: files.</p>
1.1 grant 7489:
7490: <p>The first section controls if the dependency on
1.14 xtraeme 7491: <em class="replaceable"><code>pkg</code></em> is added.
7492: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 7493: global list of packages for which dependencies are
7494: added by buildlink3.</p>
7495:
7496: <p>The second section advises pkgsrc that the
1.14 xtraeme 7497: <code class="filename">buildlink3.mk</code> file for
7498: <em class="replaceable"><code>pkg</code></em> has been
7499: included at some point. <code class=
7500: "varname">BUILDLINK_PACKAGES</code> is the global list
7501: of packages for which <code class=
7502: "filename">buildlink3.mk</code> files have been
7503: included. It must <span class=
7504: "emphasis"><em>always</em></span> be appended to within
7505: a <code class="filename">buildlink3.mk</code> file.</p>
1.1 grant 7506:
7507: <p>The third section is protected from multiple
1.14 xtraeme 7508: inclusion and controls how the dependency on <em class=
7509: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 7510: important variables are set in the section:</p>
7511:
7512: <div class="itemizedlist">
7513: <ul type="disc">
7514: <li>
1.14 xtraeme 7515: <p><code class=
7516: "varname">BUILDLINK_DEPENDS.<em class=
7517: "replaceable"><code>pkg</code></em></code> is the
7518: actual dependency recorded in the installed
7519: package; this should always be set using
7520: <span><strong class="command">+=</strong></span>
7521: to ensure that we're appending to any
7522: pre-existing list of values. This variable should
7523: be set to the first version of the package that
7524: had the last change in the major number of a
7525: shared library or that had a major API
7526: change.</p>
1.1 grant 7527: </li>
7528:
7529: <li>
1.14 xtraeme 7530: <p><code class=
7531: "varname">BUILDLINK_PKGSRCDIR.<em class=
7532: "replaceable"><code>pkg</code></em></code> is the
7533: location of the <em class=
7534: "replaceable"><code>pkg</code></em> pkgsrc
1.1 grant 7535: directory;</p>
7536: </li>
7537:
7538: <li>
1.14 xtraeme 7539: <p><code class=
7540: "varname">BUILDLINK_DEPMETHOD.<em class=
7541: "replaceable"><code>pkg</code></em></code> (not
7542: shown above) controls whether we use <code class=
7543: "varname">BUILD_DEPENDS</code> or <code class=
7544: "varname">DEPENDS</code> to add the dependency on
7545: <em class="replaceable"><code>pkg</code></em>.
7546: The build dependency is selected by setting
7547: <code class=
7548: "varname">BUILDLINK_DEPMETHOD.<em class=
7549: "replaceable"><code>pkg</code></em></code> to
1.1 grant 7550: “<span class="quote">build</span>”.
7551: By default, the full dependency is used.</p>
7552: </li>
7553:
7554: <li>
1.14 xtraeme 7555: <p><code class=
7556: "varname">BUILDLINK_INCDIRS.<em class=
7557: "replaceable"><code>pkg</code></em></code> and
7558: <code class=
7559: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
7560: <code>pkg</code></em></code> (not shown above)
7561: are lists of subdirectories of <code class=
7562: "filename">${BUILDLINK_PREFIX.<em class=
7563: "replaceable"><code>pkg</code></em>}</code> to
7564: add to the header and library search paths. These
1.1 grant 7565: default to “<span class=
7566: "quote">include</span>” and
7567: “<span class="quote">lib</span>”
7568: respectively.</p>
7569: </li>
7570:
7571: <li>
1.14 xtraeme 7572: <p><code class=
7573: "varname">BUILDLINK_CPPFLAGS.<em class=
7574: "replaceable"><code>pkg</code></em></code> (not
7575: shown above) is the list of preprocessor flags to
7576: add to <code class="varname">CPPFLAGS</code>,
7577: which are passed on to the configure and build
7578: phases. The “<span class=
7579: "quote">-I</span>” option should be avoided
7580: and instead be handled using <code class=
7581: "varname">BUILDLINK_INCDIRS.<em class=
7582: "replaceable"><code>pkg</code></em></code> as
7583: above.</p>
1.1 grant 7584: </li>
7585: </ul>
7586: </div>
7587:
7588: <p>The following variables are all optionally defined
7589: within this second section (protected against multiple
7590: inclusion) and control which package files are
1.14 xtraeme 7591: symlinked into <code class=
7592: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 7593: are transformed during the symlinking:</p>
7594:
7595: <div class="itemizedlist">
7596: <ul type="disc">
7597: <li>
1.14 xtraeme 7598: <p><code class=
7599: "varname">BUILDLINK_FILES.<em class=
7600: "replaceable"><code>pkg</code></em></code> (not
7601: shown above) is a shell glob pattern relative to
7602: <code class=
7603: "filename">${BUILDLINK_PREFIX.<em class=
7604: "replaceable"><code>pkg</code></em>}</code> to be
7605: symlinked into <code class=
7606: "filename">${BUILDLINK_DIR}</code>, e.g.
7607: <code class="filename">include/*.h</code>.</p>
1.1 grant 7608: </li>
7609:
7610: <li>
1.14 xtraeme 7611: <p><code class=
7612: "varname">BUILDLINK_FILES_CMD.<em class=
7613: "replaceable"><code>pkg</code></em></code> (not
7614: shown above) is a shell pipeline that outputs to
7615: stdout a list of files relative to <code class=
7616: "filename">${BUILDLINK_PREFIX.<em class=
7617: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 7618: resulting files are to be symlinked into
1.14 xtraeme 7619: <code class="filename">${BUILDLINK_DIR}</code>.
7620: By default, this takes the <code class=
7621: "filename">+CONTENTS</code> of a <em class=
7622: "replaceable"><code>pkg</code></em> and filters
7623: it through <code class=
7624: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
7625: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 7626: </li>
7627:
7628: <li>
1.14 xtraeme 7629: <p><code class=
7630: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7631: "replaceable"><code>pkg</code></em></code> (not
7632: shown above) is a filter command that filters
7633: <code class="filename">+CONTENTS</code> input
7634: into a list of files relative to <code class=
7635: "filename">${BUILDLINK_PREFIX.<em class=
7636: "replaceable"><code>pkg</code></em>}</code> on
7637: stdout. By default for overwrite packages,
7638: <code class=
7639: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
7640: "replaceable"><code>pkg</code></em></code>
7641: outputs the contents of the <code class=
7642: "filename">include</code> and <code class=
7643: "filename">lib</code> directories in the package
7644: <code class="filename">+CONTENTS</code>, and for
7645: pkgviews packages, it outputs any libtool
7646: archives in <code class="filename">lib</code>
1.1 grant 7647: directories.</p>
7648: </li>
7649:
7650: <li>
1.14 xtraeme 7651: <p><code class=
7652: "varname">BUILDLINK_TRANSFORM.<em class=
7653: "replaceable"><code>pkg</code></em></code> (not
7654: shown above) is a list of sed arguments used to
1.1 grant 7655: transform the name of the source filename into a
1.14 xtraeme 7656: destination filename, e.g. <span><strong class=
1.1 grant 7657: "command">-e
1.14 xtraeme 7658: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 7659: </li>
7660: </ul>
7661: </div>
7662:
1.14 xtraeme 7663: <p>The last section includes any <code class=
7664: "filename">buildlink3.mk</code> needed for <em class=
7665: "replaceable"><code>pkg</code></em>'s library
7666: dependencies. Including these <code class=
7667: "filename">buildlink3.mk</code> files means that the
7668: headers and libraries for these dependencies are also
7669: symlinked into <code class=
7670: "filename">${BUILDLINK_DIR}</code> whenever the
7671: <em class="replaceable"><code>pkg</code></em>
7672: <code class="filename">buildlink3.mk</code> file is
7673: included.</p>
1.1 grant 7674: </div>
7675:
7676: <div class="sect2" lang="en" xml:lang="en">
7677: <div class="titlepage">
7678: <div>
7679: <div>
1.30 wiz 7680: <h3 class="title"><a name=
7681: "updating-buildlink-depends" id=
1.38 dillo 7682: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 7683: <code class=
7684: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
7685: <code>pkg</code></em></code> in <code class=
7686: "filename">buildlink3.mk</code> files</h3>
1.1 grant 7687: </div>
7688: </div>
7689: </div>
7690:
7691: <p>There are two situations that require increasing the
1.14 xtraeme 7692: dependency listed in <code class=
7693: "varname">BUILDLINK_DEPENDS.<em class=
7694: "replaceable"><code>pkg</code></em></code> after a
7695: package update:</p>
1.1 grant 7696:
7697: <div class="orderedlist">
7698: <ol type="1">
7699: <li>
7700: <p>if the sonames (major number of the library
7701: version) of any installed shared libraries
7702: change;</p>
7703: </li>
7704:
7705: <li>
7706: <p>if the API or interface to the header files
7707: change.</p>
7708: </li>
7709: </ol>
7710: </div>
7711:
1.14 xtraeme 7712: <p>In these cases, <code class=
7713: "varname">BUILDLINK_DEPENDS.<em class=
7714: "replaceable"><code>pkg</code></em></code> should be
7715: adjusted to require at least the new package version.
7716: In some cases, the packages that depend on this new
7717: version may need their <code class=
7718: "varname">PKGREVISION</code>s increased and, if they
7719: have <code class="filename">buildlink3.mk</code> files,
7720: their <code class=
7721: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
7722: pkg</code></em></code> adjusted, too. This is needed so
7723: that binary packages made using it will require the
7724: correct package dependency and not settle for an older
7725: one which will not contain the necessary shared
7726: libraries.</p>
1.1 grant 7727:
7728: <p>Please take careful consideration before adjusting
1.14 xtraeme 7729: <code class="varname">BUILDLINK_DEPENDS.<em class=
7730: "replaceable"><code>pkg</code></em></code> as we don't
7731: want to cause unneeded package deletions and rebuilds.
7732: In many cases, new versions of packages work just fine
7733: with older dependencies. See <a href="#dependencies"
1.38 dillo 7734: title="15.1.4. Handling dependencies">Section
7735: 15.1.4, “Handling dependencies”</a> for
1.36 wiz 7736: more information about dependencies on other packages,
1.25 rillig 7737: including the <code class=
7738: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
7739: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 7740: </div>
7741: </div>
7742:
7743: <div class="sect1" lang="en" xml:lang="en">
7744: <div class="titlepage">
7745: <div>
7746: <div>
7747: <h2 class="title" style="clear: both"><a name=
1.30 wiz 7748: "writing-builtin.mk" id=
1.38 dillo 7749: "writing-builtin.mk"></a>11.3. Writing
1.14 xtraeme 7750: <code class="filename">builtin.mk</code> files</h2>
1.1 grant 7751: </div>
7752: </div>
7753: </div>
7754:
7755: <p>Some packages in pkgsrc install headers and libraries
7756: that coincide with headers and libraries present in the
1.14 xtraeme 7757: base system. Aside from a <code class=
7758: "filename">buildlink3.mk</code> file, these packages
7759: should also include a <code class=
7760: "filename">builtin.mk</code> file that includes the
7761: necessary checks to decide whether using the built-in
7762: software or the pkgsrc software is appropriate.</p>
1.1 grant 7763:
7764: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 7765: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 7766:
7767: <div class="orderedlist">
7768: <ol type="1">
7769: <li>
1.14 xtraeme 7770: <p>It should set <code class=
7771: "varname">USE_BUILTIN.<em class=
7772: "replaceable"><code>pkg</code></em></code> to
7773: either “<span class="quote">yes</span>”
7774: or “<span class="quote">no</span>”
7775: after it is included.</p>
1.1 grant 7776: </li>
7777:
7778: <li>
7779: <p>It should <span class=
7780: "emphasis"><em>not</em></span> override any
1.14 xtraeme 7781: <code class="varname">USE_BUILTIN.<em class=
7782: "replaceable"><code>pkg</code></em></code> which is
7783: already set before the <code class=
7784: "filename">builtin.mk</code> file is included.</p>
1.1 grant 7785: </li>
7786:
7787: <li>
7788: <p>It should be written to allow multiple
7789: inclusion. This is <span class=
7790: "emphasis"><em>very</em></span> important and takes
1.14 xtraeme 7791: careful attention to <code class=
7792: "filename">Makefile</code> coding.</p>
1.1 grant 7793: </li>
7794: </ol>
7795: </div>
7796:
7797: <div class="sect2" lang="en" xml:lang="en">
7798: <div class="titlepage">
7799: <div>
7800: <div>
1.30 wiz 7801: <h3 class="title"><a name="anatomy-of-builtin.mk"
7802: id=
1.38 dillo 7803: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.30 wiz 7804: of a <code class="filename">builtin.mk</code>
1.14 xtraeme 7805: file</h3>
1.1 grant 7806: </div>
7807: </div>
7808: </div>
7809:
7810: <p>The following is the recommended template for
7811: builtin.mk files:</p>
7812: <pre class="programlisting">
7813: .if !defined(IS_BUILTIN.foo)
7814: #
7815: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
7816: # genuinely exists in the system or not.
7817: #
7818: IS_BUILTIN.foo?= no
7819:
7820: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
7821: # version can be determined.
7822: #
7823: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
7824: BUILTIN_PKG.foo?= foo-1.0
7825: . endif
7826: .endif # IS_BUILTIN.foo
7827:
7828: .if !defined(USE_BUILTIN.foo)
7829: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
7830: . if defined(BUILTIN_PKG.foo)
7831: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
7832: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
7833: USE_BUILTIN.foo!= \
7834: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
7835: ${ECHO} "yes"; \
7836: else \
7837: ${ECHO} "no"; \
7838: fi
7839: . endif
7840: . endfor
7841: . endif
7842: .endif # USE_BUILTIN.foo
7843:
7844: CHECK_BUILTIN.foo?= no
7845: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
7846: #
7847: # Here we place code that depends on whether USE_BUILTIN.foo is set to
7848: # "yes" or "no".
7849: #
7850: .endif # CHECK_BUILTIN.foo
7851:
7852: </pre>
7853:
1.14 xtraeme 7854: <p>The first section sets <code class=
7855: "varname">IS_BUILTIN.<em class=
7856: "replaceable"><code>pkg</code></em></code> depending on
7857: if <em class="replaceable"><code>pkg</code></em> really
7858: exists in the base system. This should not be a base
7859: system software with similar functionality to
7860: <em class="replaceable"><code>pkg</code></em>; it
7861: should only be “<span class=
7862: "quote">yes</span>” if the actual package is
7863: included as part of the base system. This variable is
7864: only used internally within the <code class=
7865: "filename">builtin.mk</code> file.</p>
7866:
7867: <p>The second section sets <code class=
7868: "varname">BUILTIN_PKG.<em class=
7869: "replaceable"><code>pkg</code></em></code> to the
7870: version of <em class=
7871: "replaceable"><code>pkg</code></em> in the base system
7872: if it exists (if <code class=
7873: "varname">IS_BUILTIN.<em class=
7874: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7875: “<span class="quote">yes</span>”). This
1.14 xtraeme 7876: variable is only used internally within the
7877: <code class="filename">builtin.mk</code> file.</p>
1.1 grant 7878:
1.14 xtraeme 7879: <p>The third section sets <code class=
7880: "varname">USE_BUILTIN.<em class=
7881: "replaceable"><code>pkg</code></em></code> and is
7882: <span class="emphasis"><em>required</em></span> in all
7883: <code class="filename">builtin.mk</code> files. The
7884: code in this section must make the determination
7885: whether the built-in software is adequate to satisfy
7886: the dependencies listed in <code class=
7887: "varname">BUILDLINK_DEPENDS.<em class=
7888: "replaceable"><code>pkg</code></em></code>. This is
7889: typically done by comparing <code class=
7890: "varname">BUILTIN_PKG.<em class=
7891: "replaceable"><code>pkg</code></em></code> against each
7892: of the dependencies in <code class=
7893: "varname">BUILDLINK_DEPENDS.<em class=
7894: "replaceable"><code>pkg</code></em></code>.
7895: <code class="varname">USE_BUILTIN.<em class=
7896: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 7897: "emphasis"><em>must</em></span> be set to the correct
1.14 xtraeme 7898: value by the end of the <code class=
7899: "filename">builtin.mk</code> file. Note that
7900: <code class="varname">USE_BUILTIN.<em class=
7901: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 7902: “<span class="quote">yes</span>” even if
1.14 xtraeme 7903: <code class="varname">IS_BUILTIN.<em class=
7904: "replaceable"><code>pkg</code></em></code> is
1.1 grant 7905: “<span class="quote">no</span>” because we
7906: may make the determination that the built-in version of
7907: the software is similar enough to be used as a
7908: replacement.</p>
7909:
1.14 xtraeme 7910: <p>The last section is guarded by <code class=
7911: "varname">CHECK_BUILTIN.<em class=
7912: "replaceable"><code>pkg</code></em></code>, and
7913: includes code that uses the value of <code class=
7914: "varname">USE_BUILTIN.<em class=
7915: "replaceable"><code>pkg</code></em></code> set in the
7916: previous section. This typically includes, e.g., adding
1.1 grant 7917: additional dependency restrictions and listing
1.14 xtraeme 7918: additional files to symlink into <code class=
7919: "filename">${BUILDLINK_DIR}</code> (via <code class=
7920: "varname">BUILDLINK_FILES.<em class=
7921: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 7922: </div>
7923:
7924: <div class="sect2" lang="en" xml:lang="en">
7925: <div class="titlepage">
7926: <div>
7927: <div>
1.30 wiz 7928: <h3 class="title"><a name=
7929: "native-or-pkgsrc-preference" id=
1.38 dillo 7930: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 7931: preferences for native or pkgsrc software</h3>
1.1 grant 7932: </div>
7933: </div>
7934: </div>
7935:
7936: <p>When building packages, it's possible to choose
7937: whether to set a global preference for using either the
7938: built-in (native) version or the pkgsrc version of
7939: software to satisfy a dependency. This is controlled by
1.14 xtraeme 7940: setting <code class="varname">PREFER_PKGSRC</code> and
7941: <code class="varname">PREFER_NATIVE</code>. These
7942: variables take values of either “<span class=
1.1 grant 7943: "quote">yes</span>”, “<span class=
7944: "quote">no</span>”, or a list of packages.
1.14 xtraeme 7945: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
7946: to use the pkgsrc versions of software, while
7947: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
7948: to use the built-in versions. Preferences are
7949: determined by the most specific instance of the package
7950: in either <code class="varname">PREFER_PKGSRC</code> or
7951: <code class="varname">PREFER_NATIVE</code>. If a
7952: package is specified in neither or in both variables,
7953: then <code class="varname">PREFER_PKGSRC</code> has
7954: precedence over <code class=
7955: "varname">PREFER_NATIVE</code>. For example, to require
7956: using pkgsrc versions of software for all but the most
7957: basic bits on a NetBSD system, you can set:</p>
1.1 grant 7958: <pre class="programlisting">
7959: PREFER_PKGSRC= yes
7960: PREFER_NATIVE= getopt skey tcp_wrappers
7961:
7962: </pre>
7963:
7964: <p>A package <span class=
1.14 xtraeme 7965: "emphasis"><em>must</em></span> have a <code class=
7966: "filename">builtin.mk</code> file to be listed in
7967: <code class="varname">PREFER_NATIVE</code>, otherwise
7968: it is simply ignored in that list.</p>
1.1 grant 7969: </div>
7970: </div>
7971: </div>
7972:
7973: <div class="chapter" lang="en" xml:lang="en">
7974: <div class="titlepage">
7975: <div>
7976: <div>
1.35 jmmv 7977: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 7978: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 7979: framework</h2>
1.1 grant 7980: </div>
7981: </div>
7982: </div>
7983:
7984: <div class="toc">
7985: <p><b>Table of Contents</b></p>
7986:
7987: <dl>
1.30 wiz 7988: <dt><span class="sect1"><a href=
1.38 dillo 7989: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 7990: directories outside the installation
7991: prefix</a></span></dt>
7992:
7993: <dd>
7994: <dl>
7995: <dt><span class="sect2"><a href=
1.38 dillo 7996: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 7997: manipulation</a></span></dt>
7998:
7999: <dt><span class="sect2"><a href=
1.38 dillo 8000: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8001: manipulation</a></span></dt>
8002: </dl>
8003: </dd>
8004:
1.38 dillo 8005: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8006: Configuration files</a></span></dt>
8007:
8008: <dd>
8009: <dl>
8010: <dt><span class="sect2"><a href=
1.38 dillo 8011: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8012: "varname">PKG_SYSCONFDIR</code> is
8013: set</a></span></dt>
8014:
8015: <dt><span class="sect2"><a href=
1.38 dillo 8016: "#conf-files-configure">12.2.2. Telling the
1.35 jmmv 8017: software were configuration files
8018: are</a></span></dt>
8019:
8020: <dt><span class="sect2"><a href=
1.38 dillo 8021: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8022: installations</a></span></dt>
8023:
8024: <dt><span class="sect2"><a href=
1.38 dillo 8025: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8026: configuration files</a></span></dt>
8027: </dl>
8028: </dd>
8029:
1.38 dillo 8030: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8031: System startup scripts</a></span></dt>
8032:
8033: <dd>
8034: <dl>
8035: <dt><span class="sect2"><a href=
1.38 dillo 8036: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8037: of system startup scripts</a></span></dt>
8038: </dl>
8039: </dd>
1.1 grant 8040:
1.30 wiz 8041: <dt><span class="sect1"><a href=
1.38 dillo 8042: "#users-and-groups">12.4. System users and
1.35 jmmv 8043: groups</a></span></dt>
8044:
1.38 dillo 8045: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8046: shells</a></span></dt>
8047:
8048: <dd>
8049: <dl>
8050: <dt><span class="sect2"><a href=
1.38 dillo 8051: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8052: configuration files</a></span></dt>
8053: </dl>
8054: </dd>
1.1 grant 8055: </dl>
8056: </div>
8057:
1.35 jmmv 8058: <p>This chapter describes the framework known as
8059: <code class="literal">pkginstall</code>, whose key features
8060: are:</p>
8061:
8062: <div class="itemizedlist">
8063: <ul type="disc">
8064: <li>
8065: <p>Generic installation and manipulation of
8066: directories and files outside the pkgsrc-handled
8067: tree, <code class="varname">LOCALBASE</code>.</p>
8068: </li>
8069:
8070: <li>
8071: <p>Automatic handling of configuration files during
8072: installation, provided that packages are correctly
8073: designed.</p>
8074: </li>
8075:
8076: <li>
8077: <p>Generation and installation of system startup
8078: scripts.</p>
8079: </li>
8080:
8081: <li>
8082: <p>Registration of system users and groups.</p>
8083: </li>
8084:
8085: <li>
8086: <p>Registration of system shells.</p>
8087: </li>
8088: </ul>
8089: </div>
8090:
8091: <p>The following sections inspect each of the above points
8092: in detail. Note that, in order to use any of the described
8093: functionalities, you must add the following to your
8094: package's <code class="filename">Makefile</code>:</p>
8095: <pre class="programlisting">
8096: USE_PKGINSTALL=YES
8097: </pre>
8098:
8099: <p>You may be thinking that many of the things described
8100: here could be easily done with simple code in the package's
8101: post-installation target (<code class=
8102: "literal">post-install</code>). <span class=
8103: "emphasis"><em>This is incorrect</em></span>, as the code
8104: in them is only executed when building from source.
8105: Machines using binary packages could not benefit from it at
8106: all (as the code itself could be unavailable). Therefore,
8107: the only way to achieve any of the items described above is
8108: by means of the installation scripts, which are
8109: automatically generated by pkginstall.</p>
1.1 grant 8110:
8111: <div class="sect1" lang="en" xml:lang="en">
8112: <div class="titlepage">
8113: <div>
8114: <div>
8115: <h2 class="title" style="clear: both"><a name=
1.35 jmmv 8116: "files-and-dirs-outside-prefix" id=
1.38 dillo 8117: "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35 jmmv 8118: directories outside the installation prefix</h2>
1.1 grant 8119: </div>
8120: </div>
8121: </div>
8122:
1.35 jmmv 8123: <p>As you already know, the <code class=
8124: "filename">PLIST</code> file holds a list of files and
8125: directories that belong to a package. The names used in
8126: it are relative to the installation prefix (<code class=
8127: "filename">${PREFIX}</code>), which means that it cannot
8128: register files outside this directory (absolute path
8129: names are not allowed). Despite this restriction, some
8130: packages need to install files outside this location;
8131: e.g., under <code class="filename">${VARBASE}</code> or
8132: <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
8133:
8134: <p>The only way to achieve this is to create such files
8135: during installation time by using the installation
8136: scripts. These scripts can run arbitrary commands, so
8137: they have the potential to create and manage files
8138: anywhere in the filesystem. Here is where pkginstall
8139: comes into play: it provides generic scripts to abstract
8140: the manipulation of such files and directories based on
8141: variables set in the package's <code class=
8142: "filename">Makefile</code>. The rest of this section
8143: describes which these variables are.</p>
1.1 grant 8144:
1.35 jmmv 8145: <div class="sect2" lang="en" xml:lang="en">
8146: <div class="titlepage">
1.1 grant 8147: <div>
1.35 jmmv 8148: <div>
8149: <h3 class="title"><a name="dirs-outside-prefix"
1.38 dillo 8150: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8151: manipulation</h3>
8152: </div>
1.1 grant 8153: </div>
8154: </div>
8155:
1.35 jmmv 8156: <p>The following variables can be set to request the
8157: creation of directories anywhere in the filesystem:</p>
1.27 rillig 8158:
1.35 jmmv 8159: <div class="itemizedlist">
8160: <ul type="disc">
8161: <li>
8162: <p><code class="varname">MAKE_DIRS</code> and
8163: <code class="varname">OWN_DIRS</code> contain a
8164: list of directories that should be created and
8165: should attempt to be destroyed by the
8166: installation scripts. The difference between the
8167: two is that the latter prompts the administrator
8168: to remove any directories that may be left after
8169: deinstallation (because they were not empty),
8170: while the former does not.</p>
8171: </li>
1.1 grant 8172:
1.35 jmmv 8173: <li>
8174: <p><code class="varname">MAKE_DIRS_PERMS</code>
8175: and <code class="varname">OWN_DIRS_PERMS</code>
8176: contain a list of tuples describing which
8177: directories should be created and should attempt
8178: to be destroyed by the installation scripts. Each
8179: tuple holds the following values, separated by
8180: spaces: the directory name, its owner, its group
8181: and its numerical mode. For example:</p>
8182: <pre class="programlisting">
8183: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
8184: </pre>
1.1 grant 8185:
1.35 jmmv 8186: <p>The difference between the two is exactly the
8187: same as their non-<code class=
8188: "varname">PERMS</code> counterparts.</p>
8189: </li>
8190: </ul>
8191: </div>
8192: </div>
8193:
8194: <div class="sect2" lang="en" xml:lang="en">
8195: <div class="titlepage">
8196: <div>
8197: <div>
8198: <h3 class="title"><a name="files-outside-prefix"
1.38 dillo 8199: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 8200: manipulation</h3>
8201: </div>
8202: </div>
8203: </div>
8204:
8205: <p>Creating non-empty files outside the installation
8206: prefix is tricky because the <code class=
8207: "filename">PLIST</code> forces all files to be inside
8208: it. To overcome this problem, the only solution is to
8209: extract the file in the known place (i.e., inside the
8210: installation prefix) and copy it to the appropriate
8211: location during installation (done by the installation
8212: scripts generated by pkginstall). We will call the
8213: former the <span class="emphasis"><em>master
8214: file</em></span> in the following paragraphs, which
8215: describe the variables that can be used to
8216: automatically and consistently handle files outside the
8217: installation prefix:</p>
8218:
8219: <div class="itemizedlist">
8220: <ul type="disc">
8221: <li>
8222: <p><code class="varname">CONF_FILES</code> and
8223: <code class="varname">SUPPORT_FILES</code> are
8224: pairs of master and target files. During
8225: installation time, the master file is copied to
8226: the target one if and only if the latter does not
8227: exist. Upon deinstallation, the target file is
8228: removed provided that it was not modified by the
8229: installation.</p>
8230:
8231: <p>The difference between the two is that the
8232: latter prompts the administrator to remove any
8233: files that may be left after deinstallation
8234: (because they were not empty), while the former
8235: does not.</p>
8236: </li>
8237:
8238: <li>
8239: <p><code class="varname">CONF_FILES_PERMS</code>
8240: and <code class=
8241: "varname">SUPPORT_FILES_PERMS</code> contain
8242: tuples describing master files as well as their
8243: target locations. For each of them, it also
8244: specifies their owner, their group and their
8245: numeric permissions, in this order. For
8246: example:</p>
8247: <pre class="programlisting">
8248: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
8249: </pre>
8250:
8251: <p>The difference between the two is exactly the
8252: same as their non-<code class=
8253: "varname">PERMS</code> counterparts.</p>
8254: </li>
8255: </ul>
8256: </div>
8257: </div>
8258: </div>
8259:
8260: <div class="sect1" lang="en" xml:lang="en">
8261: <div class="titlepage">
8262: <div>
8263: <div>
8264: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8265: "conf-files" id="conf-files"></a>12.2.
1.35 jmmv 8266: Configuration files</h2>
8267: </div>
8268: </div>
8269: </div>
8270:
8271: <p>Configuration files are special in the sense that they
8272: are installed in their own specific directory,
8273: <code class="varname">PKG_SYSCONFDIR</code>, and need
8274: special treatment during installation (most of which is
8275: automated by pkginstall). The main concept you must bear
1.36 wiz 8276: in mind is that files marked as configuration files are
1.35 jmmv 8277: automatically copied to the right place (somewhere inside
8278: <code class="varname">PKG_SYSCONFDIR</code>) during
8279: installation <span class="emphasis"><em>if and only
8280: if</em></span> they didn't exist before. Similarly, they
8281: will not be removed if they have local modifications.
1.36 wiz 8282: This ensures that administrators never lose any custom
1.35 jmmv 8283: changes they may have made.</p>
8284:
8285: <div class="sect2" lang="en" xml:lang="en">
8286: <div class="titlepage">
8287: <div>
8288: <div>
8289: <h3 class="title"><a name="conf-files-sysconfdir"
1.38 dillo 8290: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 8291: <code class="varname">PKG_SYSCONFDIR</code> is
8292: set</h3>
8293: </div>
8294: </div>
8295: </div>
8296:
8297: <p>As said before, the <code class=
8298: "varname">PKG_SYSCONFDIR</code> variable specifies
8299: where configuration files shall be installed. Its
8300: contents are set based upon the following
8301: variables:</p>
8302:
8303: <div class="itemizedlist">
8304: <ul type="disc">
8305: <li>
8306: <p><code class="varname">PKG_SYSCONFBASE</code>:
8307: The configuration's root directory. Defaults to
8308: <code class="filename">${PREFIX}/etc</code>
1.36 wiz 8309: although it may be overridden by the user to
8310: point to his preferred location (e.g.,
8311: <code class="filename">/etc</code>, <code class=
1.35 jmmv 8312: "filename">/etc/pkg</code>, etc.). Packages must
8313: not use it directly.</p>
8314: </li>
8315:
8316: <li>
8317: <p><code class=
8318: "varname">PKG_SYSCONFSUBDIR</code>: A
8319: subdirectory of <code class=
8320: "varname">PKG_SYSCONFBASE</code> under which the
8321: configuration files for the package being built
8322: shall be installed. The definition of this
8323: variable only makes sense in the package's
8324: <code class="filename">Makefile</code> (i.e., it
8325: is not user customizable).</p>
8326:
8327: <p>As an example, consider the Apache package,
8328: <a xmlns=
8329: "http://www.w3.org/TR/xhtml1/transitional" href=
8330: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
8331: class="pkgname">www/apache2</a>, which places its
8332: configuration files under the <code class=
8333: "filename">httpd/</code> subdirectory of
8334: <code class="varname">PKG_SYSCONFBASE</code>.
8335: This should be set in the package Makefile.</p>
8336: </li>
8337:
8338: <li>
8339: <p><code class="varname">PKG_SYSCONFVAR</code>:
8340: Specifies the name of the variable that holds
8341: this package's configuration directory (if
8342: different from <code class=
8343: "varname">PKG_SYSCONFBASE</code>). It defaults to
8344: <code class="varname">PKGBASE</code>'s value, and
8345: is always prefixed with <code class=
8346: "literal">PKG_SYSCONFDIR</code>.</p>
8347: </li>
8348:
8349: <li>
8350: <p><code class=
8351: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
8352: Holds the directory where the configuration files
8353: for the package identified by <code class=
8354: "varname">PKG_SYSCONFVAR</code>'s shall be
8355: placed.</p>
8356: </li>
8357: </ul>
8358: </div>
8359:
8360: <p>Based on the above variables, pkginstall determines
8361: the value of <code class=
8362: "varname">PKG_SYSCONFDIR</code>, which is the
8363: <span class="emphasis"><em>only</em></span> variable
8364: that can be used within a package to refer to its
8365: configuration directory. The algorithm used to set its
8366: value is basically the following:</p>
8367:
8368: <div class="orderedlist">
8369: <ol type="1">
8370: <li>
8371: <p>If <code class=
8372: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
8373: is set, its value is used.</p>
8374: </li>
8375:
8376: <li>
8377: <p>If the previous variable is not defined but
8378: <code class="varname">PKG_SYSCONFSUBDIR</code> is
8379: set in the package's <code class=
8380: "filename">Makefile</code>, the resulting value
8381: is <code class=
8382: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
8383: </li>
8384:
8385: <li>
8386: <p>Otherwise, it is set to <code class=
8387: "filename">${PKG_SYSCONFBASE}</code>.</p>
8388: </li>
8389: </ol>
8390: </div>
8391:
8392: <p>It is worth mentioning that <code class=
8393: "filename">${PKG_SYSCONFDIR}</code> is automatically
8394: added to <code class="filename">OWN_DIRS</code>. See
8395: <a href="#dirs-outside-prefix" title=
1.38 dillo 8396: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 8397: “Directory manipulation”</a> what this
8398: means.</p>
8399: </div>
8400:
8401: <div class="sect2" lang="en" xml:lang="en">
8402: <div class="titlepage">
8403: <div>
8404: <div>
8405: <h3 class="title"><a name="conf-files-configure"
1.38 dillo 8406: id="conf-files-configure"></a>12.2.2. Telling the
1.35 jmmv 8407: software were configuration files are</h3>
8408: </div>
8409: </div>
8410: </div>
8411:
8412: <p>Given that pkgsrc (and users!) expect configuration
8413: files to be in a known place, you need to teach each
1.36 wiz 8414: package where it shall install its files. In some cases
1.35 jmmv 8415: you will have to patch the package Makefiles to achieve
8416: it. If you are lucky, though, it may be as easy as
8417: passing an extra flag to the configuration script; this
8418: is the case of GNU Autoconf generated files:</p>
8419: <pre class="programlisting">
8420: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
8421: </pre>
8422:
8423: <p>Note that this specifies where the package has to
8424: <span class="emphasis"><em>look for</em></span> its
8425: configuration files, not where they will be originally
8426: installed (although the difference is never explicit,
8427: unfortunately).</p>
8428: </div>
8429:
8430: <div class="sect2" lang="en" xml:lang="en">
8431: <div class="titlepage">
8432: <div>
8433: <div>
8434: <h3 class="title"><a name="conf-files-patching"
1.38 dillo 8435: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 8436: installations</h3>
8437: </div>
8438: </div>
8439: </div>
8440:
8441: <p>As said before, pkginstall automatically handles
8442: configuration files. This means that <span class=
8443: "strong"><strong>the packages themselves must not touch
8444: the contents of <code class=
8445: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 8446: directly</strong></span>. Bad news is that many
8447: software installation scripts will, out of the box,
8448: mess with the contents of that directory. So what is
8449: the correct procedure to fix this issue?</p>
1.35 jmmv 8450:
8451: <p>You must teach the package (usually by manually
8452: patching it) to install any configuration files under
8453: the examples hierarchy, <code class=
8454: "filename">share/examples/${PKGBASE}/</code>. This way,
8455: the <code class="filename">PLIST</code> registers them
8456: and the administrator always has the original copies
8457: available.</p>
8458:
8459: <p>Once the required configuration files are in place
8460: (i.e., under the examples hierarchy), the pkginstall
8461: framework can use them as master copies during the
8462: package installation to update what is in <code class=
8463: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
8464: the variables <code class="varname">CONF_FILES</code>
8465: and <code class="varname">CONF_FILES_PERMS</code> are
8466: used. Check out <a href="#files-outside-prefix" title=
1.38 dillo 8467: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 8468: “File manipulation”</a> for information
8469: about their syntax and their purpose. Here is an
8470: example, taken from the <a xmlns=
8471: "http://www.w3.org/TR/xhtml1/transitional" href=
8472: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
8473: class="pkgname">mail/mutt</a> package:</p>
8474: <pre class="programlisting">
8475: EGDIR= ${PREFIX}/share/doc/mutt/samples
8476: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
8477: </pre>
8478:
8479: <p>Note that the <code class="varname">EGDIR</code>
8480: variable is specific to that package and has no meaning
8481: outside it.</p>
8482: </div>
8483:
8484: <div class="sect2" lang="en" xml:lang="en">
8485: <div class="titlepage">
8486: <div>
8487: <div>
8488: <h3 class="title"><a name="conf-files-disable"
1.38 dillo 8489: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 8490: handling of configuration files</h3>
8491: </div>
8492: </div>
8493: </div>
8494:
8495: <p>The automatic copying of config files can be toggled
8496: by setting the environment variable <code class=
8497: "varname">PKG_CONFIG</code> prior to package
8498: installation.</p>
8499: </div>
8500: </div>
8501:
8502: <div class="sect1" lang="en" xml:lang="en">
8503: <div class="titlepage">
8504: <div>
8505: <div>
8506: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8507: "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35 jmmv 8508: startup scripts</h2>
8509: </div>
8510: </div>
8511: </div>
8512:
8513: <p>System startup scripts are special files because they
8514: must be installed in a place known by the underlying OS,
8515: usually outside the installation prefix. Therefore, the
8516: same rules described in <a href=
8517: "#files-and-dirs-outside-prefix" title=
1.38 dillo 8518: "12.1. Files and directories outside the installation prefix">
8519: Section 12.1, “Files and directories outside the
1.35 jmmv 8520: installation prefix”</a> apply, and the same
8521: solutions can be used. However, pkginstall provides a
1.36 wiz 8522: special mechanism to handle these files.</p>
1.35 jmmv 8523:
8524: <p>In order to provide system startup scripts, the
8525: package has to:</p>
8526:
8527: <div class="orderedlist">
8528: <ol type="1">
8529: <li>
8530: <p>Store the script inside <code class=
8531: "filename">${FILESDIR}</code>, with the
8532: <code class="literal">.sh</code> suffix appended.
8533: Considering the <a xmlns=
8534: "http://www.w3.org/TR/xhtml1/transitional" href=
8535: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
8536: class="pkgname">print/cups</a> package as an
1.36 wiz 8537: example, it has a <code class=
1.35 jmmv 8538: "filename">cupsd.sh</code> in its files
8539: directory.</p>
8540: </li>
8541:
8542: <li>
8543: <p>Tell pkginstall to handle it, appending the name
8544: of the script, without its extension, to the
8545: <code class="varname">RCD_SCRIPTS</code> variable.
8546: Continuing the previous example:</p>
8547: <pre class="programlisting">
8548: RCD_SCRIPTS+= cupsd
8549: </pre>
8550: </li>
8551: </ol>
8552: </div>
8553:
8554: <p>Once this is done, pkginstall will do the following
8555: steps for each script in an automated fashion:</p>
8556:
8557: <div class="orderedlist">
8558: <ol type="1">
8559: <li>
8560: <p>Process the file found in the files directory
8561: applying all the substitutions described in the
8562: <code class="filename">FILES_SUBST</code>
8563: variable.</p>
8564: </li>
8565:
8566: <li>
8567: <p>Copy the script from the files directory to the
8568: examples hierarchy, <code class=
8569: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 8570: Note that this master file must be explicitly
1.35 jmmv 8571: registered in the <code class=
8572: "filename">PLIST</code>.</p>
8573: </li>
8574:
8575: <li>
8576: <p>Add code to the installation scripts to copy the
8577: startup script from the examples hierarchy into the
8578: system-wide startup scripts directory.</p>
8579: </li>
8580: </ol>
8581: </div>
8582:
8583: <div class="sect2" lang="en" xml:lang="en">
8584: <div class="titlepage">
8585: <div>
8586: <div>
8587: <h3 class="title"><a name="rcd-scripts-disable"
1.38 dillo 8588: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 8589: handling of system startup scripts</h3>
8590: </div>
8591: </div>
8592: </div>
8593:
8594: <p>The automatic copying of config files can be toggled
8595: by setting the environment variable <code class=
8596: "varname">PKG_RCD_SCRIPTS</code> prior to package
8597: installation. Note that the scripts will be always
8598: copied inside the examples hierarchy, <code class=
8599: "filename">${PREFIX}/share/examples/rc.d/</code>, no
8600: matter what the value of this variable is.</p>
8601: </div>
8602: </div>
8603:
8604: <div class="sect1" lang="en" xml:lang="en">
8605: <div class="titlepage">
8606: <div>
8607: <div>
8608: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8609: "users-and-groups" id="users-and-groups"></a>12.4.
1.35 jmmv 8610: System users and groups</h2>
8611: </div>
8612: </div>
8613: </div>
8614:
8615: <p>If a package needs to create special users and/or
8616: groups during installation, it can do so by using the
8617: pkginstall framework.</p>
8618:
8619: <p>Users can be created by adding entries to the
8620: <code class="varname">PKG_USERS</code> variable. Each
8621: entry has the following syntax, which mimics <code class=
8622: "filename">/etc/passwd</code>:</p>
8623: <pre class="programlisting">
8624: user:group[:[userid][:[descr][:[home][:shell]]]]
8625: </pre>
8626:
8627: <p>Only the user and group are required; everything else
8628: is optional, but the colons must be in the right places
8629: when specifying optional bits. By default, a new user
8630: will have home directory <code class=
8631: "filename">/nonexistent</code>, and login shell
8632: <code class="filename">/sbin/nologin</code> unless they
8633: are specified as part of the user element. Note that if
8634: the description contains spaces, then spaces should be
8635: double backslash-escaped, as in:</p>
8636: <pre class="programlisting">
8637: foo:foogrp::The\\ Foomister
8638: </pre>
8639:
8640: <p>Similarly, groups can be created using the
8641: <code class="varname">PKG_GROUPS</code> variable, whose
8642: syntax is:</p>
8643: <pre class="programlisting">
8644: group[:groupid]
8645: </pre>
8646:
8647: <p>As before, only the group name is required; the
8648: numeric identifier is optional.</p>
8649: </div>
8650:
8651: <div class="sect1" lang="en" xml:lang="en">
8652: <div class="titlepage">
8653: <div>
8654: <div>
8655: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8656: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 8657: </div>
8658: </div>
8659: </div>
8660:
8661: <p>Packages that install system shells should register
8662: them in the shell database, <code class=
8663: "filename">/etc/shells</code>, to make things easier to
8664: the administrator. This must be done from the
8665: installation scripts to keep binary packages working on
8666: any system. pkginstall provides an easy way to accomplish
8667: this task.</p>
8668:
8669: <p>When a package provides a shell interpreter, it has to
8670: set the <code class="varname">PKG_SHELL</code> variable
8671: to its absolute file name. This will add some hooks to
8672: the installation scripts to handle it. Consider the
8673: following example, taken from <a xmlns=
8674: "http://www.w3.org/TR/xhtml1/transitional" href=
8675: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
8676: class="pkgname">shells/zsh</a>:</p>
8677: <pre class="programlisting">
8678: USE_PKGINSTALL= YES
8679: PKG_SHELL= ${PREFIX}/bin/zsh
8680: </pre>
8681:
8682: <div class="sect2" lang="en" xml:lang="en">
8683: <div class="titlepage">
8684: <div>
8685: <div>
8686: <h3 class="title"><a name="shells-disable" id=
1.38 dillo 8687: "shells-disable"></a>12.5.1. Disabling handling
1.35 jmmv 8688: of configuration files</h3>
8689: </div>
8690: </div>
8691: </div>
8692:
8693: <p>The automatic registration of shell interpreters can
8694: be disabled by the administrator by setting the
8695: <code class="filename">PKG_REGISTER_SHELLS</code>
8696: environment variable to <code class=
8697: "literal">NO</code>.</p>
8698: </div>
8699: </div>
8700: </div>
8701:
8702: <div class="chapter" lang="en" xml:lang="en">
8703: <div class="titlepage">
8704: <div>
8705: <div>
8706: <h2 class="title"><a name="options" id=
1.38 dillo 8707: "options"></a>Chapter 13. Options
1.35 jmmv 8708: handling</h2>
8709: </div>
8710: </div>
8711: </div>
8712:
8713: <div class="toc">
8714: <p><b>Table of Contents</b></p>
8715:
8716: <dl>
8717: <dt><span class="sect1"><a href=
1.38 dillo 8718: "#global-default-options">13.1. Global default
1.35 jmmv 8719: options</a></span></dt>
8720:
8721: <dt><span class="sect1"><a href=
1.38 dillo 8722: "#converting-to-options">13.2. Converting packages to
1.35 jmmv 8723: use <code class=
8724: "filename">bsd.options.mk</code></a></span></dt>
8725: </dl>
8726: </div>
8727:
8728: <p>Many packages have the ability to be built to support
8729: different sets of features. <code class=
8730: "filename">bsd.options.mk</code> is a framework in pkgsrc
8731: that provides generic handling of those options that
8732: determine different ways in which the packages can be
8733: built. It's possible for the user to specify exactly which
8734: sets of options will be built into a package or to allow a
8735: set of global default options apply.</p>
8736:
8737: <div class="sect1" lang="en" xml:lang="en">
8738: <div class="titlepage">
8739: <div>
8740: <div>
8741: <h2 class="title" style="clear: both"><a name=
8742: "global-default-options" id=
1.38 dillo 8743: "global-default-options"></a>13.1. Global
1.35 jmmv 8744: default options</h2>
8745: </div>
8746: </div>
8747: </div>
8748:
8749: <p>Global default options are listed in <code class=
8750: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
8751: the options that should be built into every package if
8752: that option is supported. This variable should be set in
8753: <code class="filename">/etc/mk.conf</code>.</p>
8754: </div>
8755:
8756: <div class="sect1" lang="en" xml:lang="en">
8757: <div class="titlepage">
8758: <div>
8759: <div>
8760: <h2 class="title" style="clear: both"><a name=
8761: "converting-to-options" id=
1.38 dillo 8762: "converting-to-options"></a>13.2. Converting
1.35 jmmv 8763: packages to use <code class=
8764: "filename">bsd.options.mk</code></h2>
8765: </div>
8766: </div>
8767: </div>
8768:
8769: <p>The following example shows how <code class=
8770: "filename">bsd.options.mk</code> should be used by the
8771: hypothetical ``wibble'' package, either in the package
8772: <code class="filename">Makefile</code>, or in a file,
8773: e.g. <code class="filename">options.mk</code>, that is
8774: included by the main package <code class=
8775: "filename">Makefile</code>.</p>
8776: <pre class="programlisting">
1.37 dillo 8777: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
8778: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
8779: PKG_OPTIONAL_GROUPS= database
8780: PKG_GROUP.database= mysql pgsql
8781: PKG_SUGGESTED_OPTIONS= wibble-foo
8782: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
8783: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
8784:
8785: .include "../../mk/bsd.prefs.mk"
8786:
8787: # this package was previously named wibble2
8788: .if defined(PKG_OPTIONS.wibble2)
8789: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
1.40 dillo 8790: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37 dillo 8791: .endif
1.35 jmmv 8792:
8793: .include "../../mk/bsd.options.mk"
8794:
8795: # Package-specific option-handling
8796:
8797: ###
1.37 dillo 8798: ### FOO support
8799: ###
8800: .if !empty(PKG_OPTIONS:Mwibble-foo)
8801: CONFIGURE_ARGS+= --enable-foo
8802: .endif
8803:
8804: ###
1.35 jmmv 8805: ### LDAP support
8806: ###
8807: .if !empty(PKG_OPTIONS:Mldap)
8808: . include "../../databases/openldap/buildlink3.mk"
1.37 dillo 8809: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35 jmmv 8810: .endif
1.1 grant 8811:
8812: ###
1.37 dillo 8813: ### database support
1.1 grant 8814: ###
1.37 dillo 8815: .if !empty(PKG_OPTIONS:Mmysql)
8816: . include "../../mk/mysql.buildlink3.mk"
8817: .endif
8818: .if !empty(PKG_OPTIONS:Mpgsql)
8819: . include "../../mk/pgsql.buildlink3.mk"
1.1 grant 8820: .endif
8821: </pre>
8822:
1.28 rillig 8823: <p>The first section contains the information about which
8824: build options are supported by the package, and any
1.1 grant 8825: default options settings if needed.</p>
8826:
8827: <div class="orderedlist">
8828: <ol type="1">
8829: <li>
1.14 xtraeme 8830: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 8831: the name of the <a href=
1.1 grant 8832: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
8833: <span class="citerefentry"><span class=
1.27 rillig 8834: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 8835: that the user can set to override the default
8836: options. It should be set to “<span class=
8837: "quote">PKG_OPTIONS.<em class=
1.38 dillo 8838: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 8839: </li>
8840:
8841: <li>
1.14 xtraeme 8842: <p><code class=
8843: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 8844: build options supported by the package.</p>
8845: </li>
8846:
8847: <li>
8848: <p><code class=
8849: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
8850: list of names of groups of mutually exclusive
8851: options. The options in each group are listed in
8852: <code class="varname">PKG_OPTIONS_GROUP.<em class=
8853: "replaceable"><code>groupname</code></em></code>.
8854: The most specific setting of any option from the
8855: group takes precedence over all other options in
8856: the group. Options from the groups will be
8857: automatically added to <code class=
8858: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
8859: </li>
8860:
8861: <li>
8862: <p><code class=
8863: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
8864: like <code class=
8865: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
8866: building the packages will fail if no option from
8867: the group is selected.</p>
1.1 grant 8868: </li>
8869:
8870: <li>
1.27 rillig 8871: <p><code class=
8872: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
8873: build options which are enabled by default.</p>
8874: </li>
8875:
8876: <li>
1.37 dillo 8877: <p><code class=
8878: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
8879: of “<span class="quote"><em class=
8880: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
8881: <code>option</code></em></span>” pairs that
8882: map legacy <code class=
8883: "filename">/etc/mk.conf</code> variables to their
8884: option counterparts. Pairs should be added with
8885: “<span class="quote">+=</span>” to keep
8886: the listing of global legacy variables. A warning
8887: will be issued if the user uses a legacy
8888: variable.</p>
8889: </li>
1.1 grant 8890:
1.37 dillo 8891: <li>
8892: <p><code class=
8893: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
8894: of “<span class="quote"><em class=
8895: "replaceable"><code>old-option</code></em>:<em class="replaceable">
8896: <code>new-option</code></em></span>” pairs
8897: that map options that have been renamed to their
8898: new counterparts. Pairs should be added with
8899: “<span class="quote">+=</span>” to keep
8900: the listing of global legacy options. A warning
8901: will be issued if the user uses a legacy
8902: option.</p>
8903: </li>
1.1 grant 8904:
1.37 dillo 8905: <li>
8906: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
8907: is a list of options implied by deprecated
8908: variables used. This can be used for cases that
8909: neither <code class=
8910: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
8911: <code class=
8912: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
8913: handle, e. g. when <code class=
8914: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 8915: </li>
8916:
8917: <li>
1.37 dillo 8918: <p><code class=
8919: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
8920: a list of warnings about deprecated variables or
8921: options used, and what to use instead.</p>
1.1 grant 8922: </li>
1.28 rillig 8923: </ol>
1.1 grant 8924: </div>
8925:
1.37 dillo 8926: <p>A package should never modify <code class=
8927: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
8928: named in <code class="varname">PKG_OPTIONS_VAR</code>.
8929: These are strictly user-settable. To suggest a default
8930: set of options, use <code class=
8931: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
8932:
1.42 ! dillo 8933: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
! 8934: defined before including <code class=
! 8935: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 8936: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
8937: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
8938: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.42 ! dillo 8939: are defined (as can happen with platform specific options
! 8940: if none of them is supported on the current platform),
! 8941: <code class="varname">PKG_OPTIONS</code> is set to the
! 8942: empty list and the package is otherwise treated as not
! 8943: using the options framework.</p>
1.37 dillo 8944:
8945: <p>After the inclusion of <code class=
8946: "filename">bsd.options.mk</code>, the variable
1.28 rillig 8947: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 8948: list of selected build options, properly filtered to
1.28 rillig 8949: remove unsupported and duplicate options.</p>
8950:
1.1 grant 8951: <p>The remaining sections contain the logic that is
1.37 dillo 8952: specific to each option. The correct way to check for an
8953: option is to check whether it is listed in <code class=
8954: "varname">PKG_OPTIONS</code>:</p>
8955: <pre class="programlisting">
8956: .if !empty(PKG_OPTIONS:M<em class=
8957: "replaceable"><code>option</code></em>)
8958: </pre>
8959:
8960: <p>If another package already has an option with the same
8961: meaning, use the same name. For options applicable to
8962: multiple packages (like enabling support for a library),
8963: use short option names (like the name of the library).
8964: For options specific to this package, prefix the name
8965: with <code class="varname"><em class=
8966: "replaceable"><code>pkgname</code></em>-</code>. Document
8967: the option and its meaning in <code class=
8968: "filename">mk/defaults/options.description</code>.</p>
1.1 grant 8969: </div>
8970: </div>
8971:
8972: <div class="chapter" lang="en" xml:lang="en">
8973: <div class="titlepage">
8974: <div>
8975: <div>
8976: <h2 class="title"><a name="build" id=
1.38 dillo 8977: "build"></a>Chapter 14. The build
1.1 grant 8978: process</h2>
8979: </div>
8980: </div>
8981: </div>
8982:
8983: <div class="toc">
8984: <p><b>Table of Contents</b></p>
8985:
8986: <dl>
1.38 dillo 8987: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 8988: Program location</a></span></dt>
8989:
1.38 dillo 8990: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 8991: Main targets</a></span></dt>
1.1 grant 8992:
8993: <dt><span class="sect1"><a href=
1.38 dillo 8994: "#build.helpful-targets">14.3. Other helpful
1.1 grant 8995: targets</a></span></dt>
8996: </dl>
8997: </div>
8998:
8999: <p>The basic steps for building a program are always the
9000: same. First the program's source (<span class=
9001: "emphasis"><em>distfile</em></span>) must be brought to the
9002: local system and then extracted. After any patches to
9003: compile properly on NetBSD are applied, the software can be
9004: configured, then built (usually by compiling), and finally
9005: the generated binaries, etc. can be put into place on the
9006: system. These are exactly the steps performed by the NetBSD
9007: package system, which is implemented as a series of targets
1.14 xtraeme 9008: in a central Makefile, <code class=
9009: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 9010:
9011: <div class="sect1" lang="en" xml:lang="en">
9012: <div class="titlepage">
9013: <div>
9014: <div>
9015: <h2 class="title" style="clear: both"><a name=
9016: "build.prefix" id=
1.38 dillo 9017: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9018: </div>
9019: </div>
9020: </div>
9021:
9022: <p>Before outlining the process performed by the NetBSD
9023: package system in the next section, here's a brief
9024: discussion on where programs are installed, and which
9025: variables influence this.</p>
9026:
1.14 xtraeme 9027: <p>The automatic variable <code class=
9028: "varname">PREFIX</code> indicates where all files of the
9029: final program shall be installed. It is usually set to
9030: <code class="varname">LOCALBASE</code> (<code class=
9031: "filename">/usr/pkg</code>), or <code class=
9032: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9033: “<span class="quote">cross</span>” category.
1.14 xtraeme 9034: The value of <code class="varname">PREFIX</code> needs to
9035: be put into the various places in the program's source
9036: where paths to these files are encoded. See <a href=
1.1 grant 9037: "#components.patches" title=
1.38 dillo 9038: "8.3. patches/*">Section 8.3,
1.1 grant 9039: “patches/*”</a> and <a href="#fixes.libtool"
9040: title=
1.38 dillo 9041: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9042: “Shared libraries - libtool”</a> for more
9043: details.</p>
9044:
9045: <p>When choosing which of these variables to use, follow
9046: the following rules:</p>
9047:
9048: <div class="itemizedlist">
9049: <ul type="disc">
9050: <li>
1.14 xtraeme 9051: <p><code class="varname">PREFIX</code> always
9052: points to the location where the current pkg will
9053: be installed. When referring to a pkg's own
1.1 grant 9054: installation path, use “<span class=
9055: "quote">${PREFIX}</span>”.</p>
9056: </li>
9057:
9058: <li>
1.14 xtraeme 9059: <p><code class="varname">LOCALBASE</code> is where
9060: all non-X11 pkgs are installed. If you need to
1.1 grant 9061: construct a -I or -L argument to the compiler to
9062: find includes and libraries installed by another
9063: non-X11 pkg, use “<span class=
9064: "quote">${LOCALBASE}</span>”.</p>
9065: </li>
9066:
9067: <li>
1.14 xtraeme 9068: <p><code class="varname">X11BASE</code> is where
9069: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9070: installed. When looking for <span class=
9071: "emphasis"><em>standard</em></span> X11 includes
9072: (not those installed by a pkg), use
9073: “<span class=
9074: "quote">${X11BASE}</span>”.</p>
9075: </li>
9076:
9077: <li>
9078: <p>X11 based are special in that they may be
1.14 xtraeme 9079: installed in either <code class=
9080: "varname">X11BASE</code> or <code class=
9081: "varname">LOCALBASE</code>.</p>
1.1 grant 9082:
9083: <p>Usually, X11 packages should be installed under
1.14 xtraeme 9084: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 9085: possible. Note that you will need to include
9086: <code class=
9087: "filename">../../mk/x11.buildlink3.mk</code> in
9088: them to request the presence of X11 and to get the
9089: right compilation flags.</p>
1.1 grant 9090:
9091: <p>Even though, there are some packages that cannot
1.14 xtraeme 9092: be installed under <code class=
9093: "varname">LOCALBASE</code>: those that come with
1.1 grant 9094: app-defaults files. These packages are special and
1.14 xtraeme 9095: they must be placed under <code class=
9096: "varname">X11BASE</code>. To accomplish this, set
9097: either <code class="varname">USE_X11BASE</code> or
9098: <code class="varname">USE_IMAKE</code> in your
1.1 grant 9099: package.</p>
9100:
1.34 wiz 9101: <p>Some notes: If you need to find includes or
1.14 xtraeme 9102: libraries installed by a pkg that has <code class=
9103: "varname">USE_IMAKE</code> or <code class=
9104: "varname">USE_X11BASE</code> in its pkg
9105: <code class="filename">Makefile</code>, you need to
1.34 wiz 9106: look in <span class="emphasis"><em>both</em></span>
1.14 xtraeme 9107: <code class="filename">${X11BASE}</code> and
9108: <code class="filename">${LOCALBASE}</code>. To
9109: force installation of all X11 packages in
9110: <code class="varname">LOCALBASE</code>, the
9111: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
9112: href=
1.1 grant 9113: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34 wiz 9114: class="pkgname">pkgtools/xpkgwedge</a> package is
9115: enabled by default.</p>
1.1 grant 9116: </li>
9117:
9118: <li>
1.14 xtraeme 9119: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 9120: used to refer to the installed location of an X11
1.14 xtraeme 9121: package. <code class="varname">X11PREFIX</code>
9122: will be set to <code class="varname">X11BASE</code>
9123: if xpkgwedge is not installed, and to <code class=
9124: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 9125: installed.</p>
9126: </li>
9127:
9128: <li>
9129: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 9130: have some packages installed in <code class=
9131: "varname">X11BASE</code> and some in <code class=
9132: "varname">LOCALBASE</code>. To determine the prefix
9133: of an installed package, the <code class=
9134: "varname">EVAL_PREFIX</code> definition can be
9135: used. It takes pairs in the format
9136: “<span class=
1.1 grant 9137: "quote">DIRNAME=<package></span>”, and
1.24 wiz 9138: the <a href=
9139: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9140: <span class="citerefentry"><span class=
9141: "refentrytitle">make</span>(1)</span></a> variable
9142: <code class="varname">DIRNAME</code> will be set to
9143: the prefix of the installed package
9144: <package>, or “<span class=
1.1 grant 9145: "quote">${X11PREFIX}</span>” if the package
9146: is not installed.</p>
9147:
9148: <p>This is best illustrated by example.</p>
9149:
1.14 xtraeme 9150: <p>The following lines are taken from <code class=
9151: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 9152: <pre class="programlisting">
1.14 xtraeme 9153: EVAL_PREFIX+= GTKDIR=gtk+
1.1 grant 9154: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
9155: --with-gtk-prefix="${GTKDIR}" \
9156: --enable-multibyte
9157: </pre>
9158:
9159: <p>Specific defaults can be defined for the
1.14 xtraeme 9160: packages evaluated using <code class=
9161: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 9162: of the form:</p>
9163: <pre class="programlisting">
9164: GTKDIR_DEFAULT= ${LOCALBASE}
9165: </pre>
9166:
1.14 xtraeme 9167: <p>where <code class="varname">GTKDIR</code>
1.1 grant 9168: corresponds to the first definition in the
1.14 xtraeme 9169: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 9170: </li>
9171:
9172: <li>
1.14 xtraeme 9173: <p>Within <code class="filename">${PREFIX}</code>,
1.24 wiz 9174: packages should install files according to <a href=
9175: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
9176: <span class="citerefentry"><span class=
9177: "refentrytitle">hier</span>(7)</span></a>, with the
9178: exception that manual pages go into <code class=
9179: "filename">${PREFIX}/man</code>, not <code class=
1.14 xtraeme 9180: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 9181: </li>
9182: </ul>
9183: </div>
9184: </div>
9185:
9186: <div class="sect1" lang="en" xml:lang="en">
9187: <div class="titlepage">
9188: <div>
9189: <div>
9190: <h2 class="title" style="clear: both"><a name=
1.30 wiz 9191: "main-targets" id=
1.38 dillo 9192: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 9193: </div>
9194: </div>
9195: </div>
9196:
9197: <p>The main targets used during the build process defined
1.14 xtraeme 9198: in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 9199:
9200: <div class="variablelist">
9201: <dl>
9202: <dt><span class="term">fetch</span></dt>
9203:
9204: <dd>
9205: <p>This will check if the file(s) given in the
1.14 xtraeme 9206: variables <code class="varname">DISTFILES</code>
9207: and <code class="varname">PATCHFILES</code> (as
9208: defined in the package's Makefile) are present on
9209: the local system in <code class=
9210: "filename">/usr/pkgsrc/distfiles</code>. If they
9211: are not present, an attempt will be made to fetch
9212: them using commands of the form:</p>
1.1 grant 9213: <pre class="programlisting">
9214: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
9215: </pre>
9216:
9217: <p>where ${site} varies through several
1.14 xtraeme 9218: possibilities in turn: first, <code class=
9219: "varname">MASTER_SITE_OVERRIDE</code> is tried,
9220: then the sites specified in either <code class=
9221: "varname">SITES_file</code> if defined, else
9222: <code class="varname">MASTER_SITES</code> or
9223: <code class="varname">PATCH_SITES</code>, as
9224: applies, then finally the value of <code class=
9225: "varname">MASTER_SITE_BACKUP</code>. The order of
9226: all except the first can be optionally sorted by
9227: the user, via setting either <code class=
9228: "varname">MASTER_SORT_AWK</code> or <code class=
9229: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 9230: </dd>
9231:
9232: <dt><span class="term">checksum</span></dt>
9233:
9234: <dd>
9235: <p>After the distfile(s) are fetched, their
9236: checksum is generated and compared with the
9237: checksums stored in the distinfo file. If the
9238: checksums don't match, the build is aborted. This
9239: is to ensure the same distfile is used for
9240: building, and that the distfile wasn't changed,
9241: e.g. by some malign force, deliberately changed
9242: distfiles on the master distribution site or
9243: network lossage.</p>
9244: </dd>
9245:
9246: <dt><span class="term">extract</span></dt>
9247:
9248: <dd>
9249: <p>When the distfiles are present on the local
9250: system, they need to be extracted, as they are
9251: usually in the form of some compressed archive
1.14 xtraeme 9252: format, most commonly <code class=
9253: "filename">.tar.gz</code>.</p>
1.1 grant 9254:
9255: <p>If only some of the distfiles need to be
9256: uncompressed, the files to be uncompressed should
1.14 xtraeme 9257: be put into <code class=
9258: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 9259:
1.14 xtraeme 9260: <p>If the distfiles are not in <code class=
9261: "filename">.tar.gz</code> format, they can be
9262: extracted by setting either <code class=
9263: "varname">EXTRACT_SUFX</code>, or <code class=
9264: "varname">EXTRACT_CMD</code>, <code class=
9265: "varname">EXTRACT_BEFORE_ARGS</code> and
9266: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
9267: the former case, pkgsrc knows how to extract a
9268: number of suffixes (<code class=
9269: "filename">.tar.gz</code>, <code class=
9270: "filename">.tgz</code>, <code class=
9271: "filename">.tar.gz2</code>, <code class=
9272: "filename">.tbz</code>, <code class=
9273: "filename">.tar.Z</code>, <code class=
9274: "filename">.tar</code>, <code class=
9275: "filename">.shar.gz</code>, <code class=
9276: "filename">.shar.bz2</code>, <code class=
9277: "filename">.shar.Z</code>, <code class=
9278: "filename">.shar</code>, <code class=
9279: "filename">.Z</code>, <code class=
9280: "filename">.bz2</code> and <code class=
9281: "filename">.gz</code>; see the definition of the
9282: various <code class="varname">DECOMPRESS_CMD</code>
9283: variables <code class="filename">bsd.pkg.mk</code>
9284: for a complete list). Here's an example on how to
9285: use the other variables for a program that comes
9286: with a compressed shell archive whose name ends in
9287: <code class="filename">.msg.gz</code>:</p>
1.1 grant 9288: <pre class="programlisting">
9289: EXTRACT_SUFX= .msg.gz
9290: EXTRACT_CMD= zcat
9291: EXTRACT_BEFORE_ARGS=
9292: EXTRACT_AFTER_ARGS= |sh
9293: </pre>
9294: </dd>
9295:
9296: <dt><span class="term">patch</span></dt>
9297:
9298: <dd>
9299: <p>After extraction, all the patches named by the
1.14 xtraeme 9300: <code class="varname">PATCHFILES</code>, those
9301: present in the patches subdirectory of the package
9302: as well as in $LOCALPATCHES/$PKGPATH (e.g.
9303: <code class=
9304: "filename">/usr/local/patches/graphics/png</code>)
9305: are applied. Patchfiles ending in <code class=
9306: "filename">.Z</code> or <code class=
9307: "filename">.gz</code> are uncompressed before they
9308: are applied, files ending in <code class=
9309: "filename">.orig</code> or <code class=
9310: "filename">.rej</code> are ignored. Any special
1.24 wiz 9311: options to <a href=
9312: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9313: <span class="citerefentry"><span class=
9314: "refentrytitle">patch</span>(1)</span></a> can be
9315: handed in <code class=
1.14 xtraeme 9316: "varname">PATCH_DIST_ARGS</code>. See <a href=
9317: "#components.patches" title=
1.38 dillo 9318: "8.3. patches/*">Section 8.3,
1.1 grant 9319: “patches/*”</a> for more details.</p>
9320:
1.24 wiz 9321: <p>By default <a href=
9322: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
9323: <span class="citerefentry"><span class=
9324: "refentrytitle">patch</span>(1)</span></a> is given
9325: special args to make it fail if the patches apply
9326: with some lines of fuzz. Please fix (regen) the
9327: patches so that they apply cleanly. The rationale
9328: behind this is that patches that don't apply
9329: cleanly may end up being applied in the wrong
9330: place, and cause severe harm there.</p>
1.1 grant 9331: </dd>
9332:
9333: <dt><span class="term">configure</span></dt>
9334:
9335: <dd>
9336: <p>Most pieces of software need information on the
9337: header files, system calls, and library routines
9338: which are available in NetBSD. This is the process
9339: known as configuration, and is usually automated.
9340: In most cases, a script is supplied with the
9341: source, and its invocation results in generation of
9342: header files, Makefiles, etc.</p>
9343:
9344: <p>If the program's distfile contains its own
9345: configure script, this can be invoked by setting
1.14 xtraeme 9346: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 9347: configure script is a GNU autoconf script,
1.14 xtraeme 9348: <code class="varname">GNU_CONFIGURE</code> should
9349: be specified instead. In either case, any arguments
9350: to the configure script can be specified in the
9351: <code class="varname">CONFIGURE_ARGS</code>
9352: variable, and the configure script's name can be
9353: set in <code class=
9354: "varname">CONFIGURE_SCRIPT</code> if it differs
9355: from the default “<span class=
1.1 grant 9356: "quote">configure</span>”. Here's an example
9357: from the <a xmlns=
9358: "http://www.w3.org/TR/xhtml1/transitional" href=
9359: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20 ben 9360: class="pkgname">sysutils/top</a> package:</p>
1.1 grant 9361: <pre class="programlisting">
9362: HAS_CONFIGURE= yes
9363: CONFIGURE_SCRIPT= Configure
9364: CONFIGURE_ARGS+= netbsd13
9365: </pre>
9366:
9367: <p>If the program uses an Imakefile for
9368: configuration, the appropriate steps can be invoked
1.14 xtraeme 9369: by setting <code class="varname">USE_IMAKE</code>
9370: to “<span class="quote">YES</span>”.
9371: (If you only want the package installed in
9372: <code class="varname">$X11PREFIX</code> but xmkmf
9373: not being run, set <code class=
9374: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 9375: </dd>
9376:
9377: <dt><span class="term">build</span></dt>
9378:
9379: <dd>
9380: <p>Once configuration has taken place, the software
1.14 xtraeme 9381: will be built by invoking <code class=
9382: "varname">$MAKE_PROGRAM</code> on <code class=
9383: "varname">$MAKEFILE</code> with <code class=
9384: "varname">$BUILD_TARGET</code> as the target to
9385: build. The default <code class=
9386: "varname">MAKE_PROGRAM</code> is
9387: “<span class="quote">gmake</span>” if
1.29 rillig 9388: <code class="varname">USE_TOOLS</code> contains
9389: “<span class="quote">gmake</span>”,
1.1 grant 9390: “<span class="quote">make</span>”
1.14 xtraeme 9391: otherwise. <code class="varname">MAKEFILE</code> is
9392: set to “<span class=
1.1 grant 9393: "quote">Makefile</span>” by default, and
1.14 xtraeme 9394: <code class="varname">BUILD_TARGET</code> defaults
9395: to “<span class="quote">all</span>”.
9396: Any of these variables can be set in the package's
1.1 grant 9397: Makefile to change the default build process.</p>
9398: </dd>
9399:
9400: <dt><span class="term">install</span></dt>
9401:
9402: <dd>
9403: <p>Once the build stage has completed, the final
9404: step is to install the software in public
9405: directories, so users can access the programs and
1.14 xtraeme 9406: files. As in the build-target, <code class=
9407: "varname">$MAKE_PROGRAM</code> is invoked on
9408: <code class="varname">$MAKEFILE</code> here, but
9409: with the <code class=
9410: "varname">$INSTALL_TARGET</code> instead, the
9411: latter defaulting to “<span class=
9412: "quote">install</span>” (plus
9413: “<span class=
9414: "quote">install.man</span>”, if <code class=
9415: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 9416: </dd>
9417: </dl>
9418: </div>
9419:
9420: <p>If no target is specified, the default is
9421: “<span class="quote">build</span>”. If a
9422: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 9423: e.g. <span><strong class="command">make
9424: build</strong></span> will also perform the equivalent
9425: of:</p>
1.1 grant 9426: <pre class="programlisting">
9427: make fetch
9428: make checksum
9429: make extract
9430: make patch
9431: make configure
9432: make build
9433: </pre>
9434: </div>
9435:
9436: <div class="sect1" lang="en" xml:lang="en">
9437: <div class="titlepage">
9438: <div>
9439: <div>
9440: <h2 class="title" style="clear: both"><a name=
9441: "build.helpful-targets" id=
1.38 dillo 9442: "build.helpful-targets"></a>14.3. Other
1.1 grant 9443: helpful targets</h2>
9444: </div>
9445: </div>
9446: </div>
9447:
9448: <div class="variablelist">
9449: <dl>
9450: <dt><span class="term">pre/post-*</span></dt>
9451:
9452: <dd>
9453: <p>For any of the main targets described in the
9454: previous section, two auxiliary targets exist with
9455: “<span class="quote">pre-</span>” and
9456: “<span class="quote">post-</span>” used
9457: as a prefix for the main target's name. These
9458: targets are invoked before and after the main
9459: target is called, allowing extra configuration or
9460: installation steps be performed from a package's
9461: Makefile, for example, which a program's configure
9462: script or install target omitted.</p>
9463: </dd>
9464:
9465: <dt><span class="term">do-*</span></dt>
9466:
9467: <dd>
9468: <p>Should one of the main targets do the wrong
9469: thing, and should there be no variable to fix this,
9470: you can redefine it with the do-* target. (Note
9471: that redefining the target itself instead of the
9472: do-* target is a bad idea, as the pre-* and post-*
9473: targets won't be called anymore, etc.) You will not
9474: usually need to do this.</p>
9475: </dd>
9476:
9477: <dt><span class="term">reinstall</span></dt>
9478:
9479: <dd>
1.14 xtraeme 9480: <p>If you did a <span><strong class="command">make
9481: install</strong></span> and you noticed some file
9482: was not installed properly, you can repeat the
1.1 grant 9483: installation with this target, which will ignore
9484: the “<span class="quote">already
9485: installed</span>” flag.</p>
9486: </dd>
9487:
9488: <dt><span class="term">deinstall</span></dt>
9489:
9490: <dd>
1.24 wiz 9491: <p>This target does a <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> in
9495: the current directory, effectively de-installing
9496: the package. The following variables can be used to
9497: tune the behaviour:</p>
1.1 grant 9498:
9499: <div class="variablelist">
9500: <dl>
1.14 xtraeme 9501: <dt><span class="term"><code class=
9502: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 9503:
9504: <dd>
9505: <p>Add a "-v" to the <a href=
9506: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9507: <span class="citerefentry"><span class=
9508: "refentrytitle">pkg_delete</span>(1)</span></a>
9509: command.</p>
9510: </dd>
9511:
1.14 xtraeme 9512: <dt><span class="term"><code class=
9513: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 9514:
9515: <dd>
9516: <p>Remove all packages that require (depend
9517: on) the given package. This can be used to
9518: remove any packages that may have been pulled
9519: in by a given package, e.g. if
1.14 xtraeme 9520: <span><strong class="command">make deinstall
9521: DEINSTALLDEPENDS=1</strong></span> is done in
9522: <code class="filename">pkgsrc/x11/kde</code>,
1.1 grant 9523: this is likely to remove whole KDE. Works by
9524: adding “<span class=
9525: "quote">-R</span>” to the <a href=
9526: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
9527: <span class="citerefentry"><span class=
9528: "refentrytitle">pkg_delete</span>(1)</span></a>
9529: command line.</p>
9530: </dd>
9531: </dl>
9532: </div>
9533: </dd>
9534:
9535: <dt><span class="term">update</span></dt>
9536:
9537: <dd>
9538: <p>This target causes the current package to be
9539: updated to the latest version. The package and all
9540: depending packages first get de-installed, then
9541: current versions of the corresponding packages get
9542: compiled and installed. This is similar to manually
9543: noting which packages are currently installed, then
1.14 xtraeme 9544: performing a series of <span><strong class=
9545: "command">make deinstall</strong></span> and
9546: <span><strong class="command">make
9547: install</strong></span> (or whatever <code class=
9548: "varname">UPDATE_TARGET</code> is set to) for these
9549: packages.</p>
1.1 grant 9550:
9551: <p>You can use the “<span class=
9552: "quote">update</span>” target to resume
1.14 xtraeme 9553: package updating in case a previous
9554: <span><strong class="command">make
9555: update</strong></span> was interrupted for some
9556: reason. However, in this case, make sure you don't
9557: call <span><strong class="command">make
9558: clean</strong></span> or otherwise remove the list
9559: of dependent packages in <code class=
9560: "varname">WRKDIR</code>. Otherwise you lose the
1.1 grant 9561: ability to automatically update the current package
9562: along with the dependent packages you have
9563: installed.</p>
9564:
1.14 xtraeme 9565: <p>Resuming an interrupted <span><strong class=
9566: "command">make update</strong></span> will only
9567: work as long as the package tree remains unchanged.
9568: If the source code for one of the packages to be
9569: updated has been changed, resuming
9570: <span><strong class="command">make
9571: update</strong></span> will most certainly
9572: fail!</p>
1.1 grant 9573:
9574: <p>The following variables can be used either on
1.14 xtraeme 9575: the command line or in <code class=
9576: "filename">/etc/mk.conf</code> to alter the
9577: behaviour of <span><strong class="command">make
9578: update</strong></span>:</p>
1.1 grant 9579:
9580: <div class="variablelist">
9581: <dl>
1.14 xtraeme 9582: <dt><span class="term"><code class=
9583: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 9584:
9585: <dd>
9586: <p>Install target to recursively use for the
9587: updated package and the dependent packages.
1.14 xtraeme 9588: Defaults to <code class=
9589: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 9590: “<span class=
9591: "quote">install</span>” otherwise for
1.14 xtraeme 9592: <span><strong class="command">make
9593: update</strong></span>. e.g.
9594: <span><strong class="command">make update
9595: UPDATE_TARGET=package</strong></span></p>
1.1 grant 9596: </dd>
9597:
1.14 xtraeme 9598: <dt><span class="term"><code class=
9599: "varname">NOCLEAN</code></span></dt>
1.1 grant 9600:
9601: <dd>
9602: <p>Don't clean up after updating. Useful if
9603: you want to leave the work sources of the
9604: updated packages around for inspection or
9605: other purposes. Be sure you eventually clean
9606: up the source tree (see the
9607: “<span class=
9608: "quote">clean-update</span>” target
9609: below) or you may run into troubles with old
9610: source code still lying around on your next
1.14 xtraeme 9611: <span><strong class=
9612: "command">make</strong></span> or
9613: <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">REINSTALL</code></span></dt>
1.1 grant 9619:
9620: <dd>
9621: <p>Deinstall each package before installing
1.14 xtraeme 9622: (making <code class=
9623: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 9624: necessary if the “<span class=
9625: "quote">clean-update</span>” target
9626: (see below) was called after interrupting a
1.14 xtraeme 9627: running <span><strong class="command">make
9628: update</strong></span>.</p>
1.1 grant 9629: </dd>
9630:
1.14 xtraeme 9631: <dt><span class="term"><code class=
9632: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 9633:
9634: <dd>
9635: <p>Allows you to disable recursion and
9636: hardcode the target for packages. The default
9637: is “<span class=
9638: "quote">update</span>” for the update
9639: target, facilitating a recursive update of
1.14 xtraeme 9640: prerequisite packages. Only set <code class=
9641: "varname">DEPENDS_TARGET</code> if you want
9642: to disable recursive updates. Use
9643: <code class="varname">UPDATE_TARGET</code>
9644: instead to just set a specific target for
9645: each package to be installed during
9646: <span><strong class="command">make
9647: update</strong></span> (see above).</p>
1.1 grant 9648: </dd>
9649: </dl>
9650: </div>
9651: </dd>
9652:
9653: <dt><span class="term">clean-update</span></dt>
9654:
9655: <dd>
9656: <p>Clean the source tree for all packages that
1.14 xtraeme 9657: would get updated if <span><strong class=
9658: "command">make update</strong></span> was called
9659: from the current directory. This target should not
9660: be used if the current package (or any of its
9661: depending packages) have already been de-installed
9662: (e.g., after calling <span><strong class=
9663: "command">make update</strong></span>) or you may
9664: lose some packages you intended to update. As a
9665: rule of thumb: only use this target <span class=
9666: "emphasis"><em>before</em></span> the first time
9667: you run <span><strong class="command">make
9668: update</strong></span> and only if you have a dirty
9669: package tree (e.g., if you used <code class=
9670: "varname">NOCLEAN</code>).</p>
1.1 grant 9671:
9672: <p>If you unsure about whether your tree is clean
1.14 xtraeme 9673: you can either perform a <span><strong class=
9674: "command">make clean</strong></span> at the top of
9675: the tree, or use the following sequence of commands
1.1 grant 9676: from the directory of the package you want to
9677: update (<span class=
9678: "emphasis"><em>before</em></span> running
1.14 xtraeme 9679: <span><strong class="command">make
9680: update</strong></span> for the first time,
9681: otherwise you lose all the packages you wanted to
9682: update!):</p>
1.1 grant 9683: <pre class="screen">
1.14 xtraeme 9684: <code class="prompt">#</code> <strong class=
9685: "userinput"><code>make clean-update</code></strong>
9686: <code class="prompt">#</code> <strong class=
9687: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
9688: <code class="prompt">#</code> <strong class=
9689: "userinput"><code>make update</code></strong>
1.1 grant 9690: </pre>
9691:
9692: <p>The following variables can be used either on
1.14 xtraeme 9693: the command line or in <code class=
9694: "filename">/etc/mk.conf</code> to alter the
9695: behaviour of <span><strong class="command">make
9696: clean-update</strong></span>:</p>
1.1 grant 9697:
9698: <div class="variablelist">
9699: <dl>
1.14 xtraeme 9700: <dt><span class="term"><code class=
9701: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 9702:
9703: <dd>
1.14 xtraeme 9704: <p>After <span><strong class="command">make
9705: clean</strong></span>, do not reconstruct the
9706: list of directories to update for this
9707: package. Only use this if
9708: <span><strong class="command">make
9709: update</strong></span> successfully installed
9710: all packages you wanted to update. Normally,
9711: this is done automatically on
9712: <span><strong class="command">make
9713: update</strong></span>, but may have been
9714: suppressed by the <code class=
9715: "varname">NOCLEAN</code> variable (see
1.1 grant 9716: above).</p>
9717: </dd>
9718: </dl>
9719: </div>
9720: </dd>
9721:
9722: <dt><span class="term">info</span></dt>
9723:
9724: <dd>
9725: <p>This target invokes <a href=
9726: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
9727: <span class="citerefentry"><span class=
9728: "refentrytitle">pkg_info</span>(1)</span></a> for
9729: the current package. You can use this to check
9730: which version of a package is installed.</p>
9731: </dd>
9732:
9733: <dt><span class="term">readme</span></dt>
9734:
9735: <dd>
1.14 xtraeme 9736: <p>This target generates a <code class=
9737: "filename">README.html</code> file, which can be
1.1 grant 9738: viewed using a browser such as <a xmlns=
9739: "http://www.w3.org/TR/xhtml1/transitional" href=
9740: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20 ben 9741: class="pkgname">www/mozilla</a> or <a xmlns=
9742: "http://www.w3.org/TR/xhtml1/transitional" href=
9743: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
9744: class="pkgname">www/links</a>. The generated files
9745: contain references to any packages which are in the
9746: <code class="varname">PACKAGES</code> directory on
9747: the local host. The generated files can be made to
9748: refer to URLs based on <code class=
9749: "varname">FTP_PKG_URL_HOST</code> and <code class=
9750: "varname">FTP_PKG_URL_DIR</code>. For example, if I
9751: wanted to generate <code class=
9752: "filename">README.html</code> files which pointed
9753: to binary packages on the local machine, in the
9754: directory <code class=
9755: "filename">/usr/packages</code>, set <code class=
9756: "varname">FTP_PKG_URL_HOST=file://localhost</code>
9757: and <code class=
9758: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
9759: <code class="varname">${PACKAGES}</code> directory
9760: and its subdirectories will be searched for all the
9761: binary packages.</p>
1.1 grant 9762: </dd>
9763:
9764: <dt><span class="term">readme-all</span></dt>
9765:
9766: <dd>
1.14 xtraeme 9767: <p>Use this target to create a file <code class=
9768: "filename">README-all.html</code> which contains a
1.1 grant 9769: list of all packages currently available in the
9770: NetBSD Packages Collection, together with the
9771: category they belong to and a short description.
1.14 xtraeme 9772: This file is compiled from the <code class=
9773: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 9774: sure to run this <span class=
1.14 xtraeme 9775: "emphasis"><em>after</em></span> a
9776: <span><strong class="command">make
9777: readme</strong></span>.</p>
1.1 grant 9778: </dd>
9779:
9780: <dt><span class="term">cdrom-readme</span></dt>
9781:
9782: <dd>
9783: <p>This is very much the same as the
9784: “<span class="quote">readme</span>”
9785: target (see above), but is to be used when
9786: generating a pkgsrc tree to be written to a CD-ROM.
1.14 xtraeme 9787: This target also produces <code class=
9788: "filename">README.html</code> files, and can be
9789: made to refer to URLs based on <code class=
9790: "varname">CDROM_PKG_URL_HOST</code> and
9791: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 9792: </dd>
9793:
9794: <dt><span class="term">show-distfiles</span></dt>
9795:
9796: <dd>
9797: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 9798: are needed to build the package. (<code class=
9799: "varname">DISTFILES</code> and <code class=
9800: "varname">PATCHFILES</code>, but not <code class=
9801: "filename">patches/*</code>)</p>
1.1 grant 9802: </dd>
9803:
9804: <dt><span class="term">show-downlevel</span></dt>
9805:
9806: <dd>
9807: <p>This target shows nothing if the package is not
9808: installed. If a version of this package is
9809: installed, but is not the version provided in this
9810: version of pkgsrc, then a warning message is
9811: displayed. This target can be used to show which of
9812: your installed packages are downlevel, and so the
9813: old versions can be deleted, and the current ones
9814: added.</p>
9815: </dd>
9816:
9817: <dt><span class="term">show-pkgsrc-dir</span></dt>
9818:
9819: <dd>
9820: <p>This target shows the directory in the pkgsrc
9821: hierarchy from which the package can be built and
9822: installed. This may not be the same directory as
9823: the one from which the package was installed. This
9824: target is intended to be used by people who may
9825: wish to upgrade many packages on a single host, and
9826: can be invoked from the top-level pkgsrc Makefile
9827: by using the “<span class=
9828: "quote">show-host-specific-pkgs</span>”
9829: target.</p>
9830: </dd>
9831:
9832: <dt><span class=
9833: "term">show-installed-depends</span></dt>
9834:
9835: <dd>
9836: <p>This target shows which installed packages match
1.14 xtraeme 9837: the current package's <code class=
9838: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 9839: dependencies are causing build problems.</p>
9840: </dd>
9841:
9842: <dt><span class="term">check-shlibs</span></dt>
9843:
9844: <dd>
9845: <p>After a package is installed, check all its
9846: binaries and (on ELF platforms) shared libraries to
9847: see if they find the shared libs they need. Run by
1.14 xtraeme 9848: default if <code class=
9849: "varname">PKG_DEVELOPER</code> is set in
9850: <code class="filename">/etc/mk.conf</code>.</p>
1.1 grant 9851: </dd>
9852:
9853: <dt><span class="term">print-PLIST</span></dt>
9854:
9855: <dd>
9856: <p>After a “<span class="quote">make
9857: install</span>” from a new or upgraded pkg,
9858: this prints out an attempt to generate a new
1.14 xtraeme 9859: <code class="filename">PLIST</code> from a
9860: <span><strong class="command">find -newer
9861: work/.extract_done</strong></span>. An attempt is
9862: made to care for shared libs etc., but it is
1.1 grant 9863: <span class="emphasis"><em>strongly</em></span>
9864: recommended to review the result before putting it
1.14 xtraeme 9865: into <code class="filename">PLIST</code>. On
9866: upgrades, it's useful to diff the output of this
9867: command against an already existing <code class=
9868: "filename">PLIST</code> file.</p>
1.1 grant 9869:
1.24 wiz 9870: <p>If the package installs files via <a href=
9871: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
9872: <span class="citerefentry"><span class=
9873: "refentrytitle">tar</span>(1)</span></a> or other
9874: methods that don't update file access times, be
9875: sure to add these files manually to your
1.14 xtraeme 9876: <code class="filename">PLIST</code>, as the
1.1 grant 9877: “<span class="quote">find
9878: -newer</span>” command used by this target
9879: won't catch them!</p>
9880:
9881: <p>See <a href="#print-PLIST" title=
1.38 dillo 9882: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 9883: “Tweaking output of <span><strong class=
9884: "command">make
9885: print-PLIST</strong></span>”</a> for more
9886: information on this target.</p>
1.1 grant 9887: </dd>
9888:
9889: <dt><span class="term">bulk-package</span></dt>
9890:
9891: <dd>
9892: <p>Used to do bulk builds. If an appropriate binary
9893: package already exists, no action is taken. If not,
9894: this target will compile, install and package it
1.14 xtraeme 9895: (and it's depends, if <code class=
9896: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 9897: <a href="#binary.configuration" title=
1.38 dillo 9898: "6.3.1. Configuration">Section 6.3.1,
1.1 grant 9899: “Configuration”</a>. After creating the
9900: binary package, the sources, the just-installed
9901: package and it's required packages are removed,
9902: preserving free disk space.</p>
9903:
9904: <p><span class="emphasis"><em>Beware that this
9905: target may deinstall all packages installed on a
9906: system!</em></span></p>
9907: </dd>
9908:
9909: <dt><span class="term">bulk-install</span></dt>
9910:
9911: <dd>
9912: <p>Used during bulk-installs to install required
9913: packages. If an upto-date binary package is
9914: available, it will be installed via <a href=
9915: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9916: <span class="citerefentry"><span class=
9917: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 9918: not, <span><strong class="command">make
9919: bulk-package</strong></span> will be executed, but
9920: the installed binary not be removed.</p>
1.1 grant 9921:
9922: <p>A binary package is considered
9923: “<span class="quote">upto-date</span>”
9924: to be installed via <a href=
9925: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
9926: <span class="citerefentry"><span class=
9927: "refentrytitle">pkg_add</span>(1)</span></a>
9928: if:</p>
9929:
9930: <div class="itemizedlist">
9931: <ul type="disc">
9932: <li>
1.14 xtraeme 9933: <p>None of the package's files (<code class=
9934: "filename">Makefile</code>, ...) were
9935: modified since it was built.</p>
1.1 grant 9936: </li>
9937:
9938: <li>
9939: <p>None of the package's required (binary)
9940: packages were modified since it was
9941: built.</p>
9942: </li>
9943: </ul>
9944: </div>
9945:
9946: <p><span class="emphasis"><em>Beware that this
9947: target may deinstall all packages installed on a
9948: system!</em></span></p>
9949: </dd>
9950: </dl>
9951: </div>
9952: </div>
9953: </div>
9954:
9955: <div class="chapter" lang="en" xml:lang="en">
9956: <div class="titlepage">
9957: <div>
9958: <div>
9959: <h2 class="title"><a name="fixes" id=
1.38 dillo 9960: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 9961: packages</h2>
9962: </div>
9963: </div>
9964: </div>
9965:
9966: <div class="toc">
9967: <p><b>Table of Contents</b></p>
9968:
9969: <dl>
1.30 wiz 9970: <dt><span class="sect1"><a href=
1.38 dillo 9971: "#general-operation">15.1. General
1.30 wiz 9972: operation</a></span></dt>
1.1 grant 9973:
9974: <dd>
9975: <dl>
9976: <dt><span class="sect2"><a href=
1.38 dillo 9977: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 9978: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 9979:
9980: <dt><span class="sect2"><a href=
1.38 dillo 9981: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 9982: install documentation</a></span></dt>
9983:
9984: <dt><span class="sect2"><a href=
1.38 dillo 9985: "#restricted-packages">15.1.3. Restricted
1.1 grant 9986: packages</a></span></dt>
9987:
9988: <dt><span class="sect2"><a href=
1.38 dillo 9989: "#dependencies">15.1.4. Handling
1.1 grant 9990: dependencies</a></span></dt>
9991:
9992: <dt><span class="sect2"><a href=
1.38 dillo 9993: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 9994: packages</a></span></dt>
9995:
9996: <dt><span class="sect2"><a href=
1.38 dillo 9997: "#not-building-packages">15.1.6. Packages that
1.30 wiz 9998: cannot or should not be built</a></span></dt>
1.1 grant 9999:
10000: <dt><span class="sect2"><a href=
1.38 dillo 10001: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 10002: should not be deleted, once
10003: installed</a></span></dt>
1.1 grant 10004:
10005: <dt><span class="sect2"><a href=
1.38 dillo 10006: "#security-handling">15.1.8. Handling packages with
1.1 grant 10007: security problems</a></span></dt>
10008:
10009: <dt><span class="sect2"><a href=
1.38 dillo 10010: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 10011: bugs</a></span></dt>
10012:
10013: <dt><span class="sect2"><a href=
1.38 dillo 10014: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10015: incrementing versions when fixing an existing
1.1 grant 10016: package</a></span></dt>
10017:
10018: <dt><span class="sect2"><a href=
1.38 dillo 10019: "#portability-of-packages">15.1.11. Portability of
1.1 grant 10020: packages</a></span></dt>
10021: </dl>
10022: </dd>
10023:
1.30 wiz 10024: <dt><span class="sect1"><a href=
1.38 dillo 10025: "#downloading-issues">15.2. Possible downloading
1.30 wiz 10026: issues</a></span></dt>
1.1 grant 10027:
10028: <dd>
10029: <dl>
10030: <dt><span class="sect2"><a href=
1.38 dillo 10031: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 10032: distfiles aren't available for plain
1.1 grant 10033: downloading</a></span></dt>
10034:
10035: <dt><span class="sect2"><a href=
1.38 dillo 10036: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 10037: handle modified distfiles with the 'old'
10038: name</a></span></dt>
1.1 grant 10039: </dl>
10040: </dd>
10041:
1.30 wiz 10042: <dt><span class="sect1"><a href=
1.38 dillo 10043: "#configuration-gotchas">15.3. Configuration
1.30 wiz 10044: gotchas</a></span></dt>
1.1 grant 10045:
10046: <dd>
10047: <dl>
10048: <dt><span class="sect2"><a href=
1.38 dillo 10049: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 10050: libtool</a></span></dt>
10051:
10052: <dt><span class="sect2"><a href=
1.38 dillo 10053: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 10054: packages that already support
10055: libtool</a></span></dt>
1.1 grant 10056:
10057: <dt><span class="sect2"><a href=
1.38 dillo 10058: "#autoconf-automake">15.3.3. GNU
1.1 grant 10059: Autoconf/Automake</a></span></dt>
10060: </dl>
10061: </dd>
10062:
1.30 wiz 10063: <dt><span class="sect1"><a href=
1.38 dillo 10064: "#building-considerations">15.4. Building
1.30 wiz 10065: considerations</a></span></dt>
1.1 grant 10066:
10067: <dd>
10068: <dl>
10069: <dt><span class="sect2"><a href=
1.38 dillo 10070: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1 grant 10071: </dl>
10072: </dd>
10073:
1.30 wiz 10074: <dt><span class="sect1"><a href=
1.38 dillo 10075: "#package-specific-actions">15.5. Package specific
1.30 wiz 10076: actions</a></span></dt>
1.1 grant 10077:
10078: <dd>
10079: <dl>
10080: <dt><span class="sect2"><a href=
1.38 dillo 10081: "#user-interaction">15.5.1. User
1.2 hubertf 10082: interaction</a></span></dt>
1.1 grant 10083:
10084: <dt><span class="sect2"><a href=
1.38 dillo 10085: "#handling-licenses">15.5.2. Handling
1.1 grant 10086: licenses</a></span></dt>
10087:
10088: <dt><span class="sect2"><a href=
1.38 dillo 10089: "#installing-score-files">15.5.3. Installing score
1.1 grant 10090: files</a></span></dt>
10091:
10092: <dt><span class="sect2"><a href=
1.38 dillo 10093: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 10094: scripts</a></span></dt>
10095:
10096: <dt><span class="sect2"><a href=
1.38 dillo 10097: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 10098: paths to other interpreters</a></span></dt>
1.1 grant 10099:
10100: <dt><span class="sect2"><a href=
1.38 dillo 10101: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 10102: modules</a></span></dt>
10103:
10104: <dt><span class="sect2"><a href=
1.38 dillo 10105: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 10106: files</a></span></dt>
10107:
10108: <dt><span class="sect2"><a href=
1.38 dillo 10109: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 10110: GConf2 data files</a></span></dt>
1.1 grant 10111:
10112: <dt><span class="sect2"><a href=
1.38 dillo 10113: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 10114: installing scrollkeeper data files</a></span></dt>
1.1 grant 10115:
10116: <dt><span class="sect2"><a href=
1.38 dillo 10117: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 10118: fonts</a></span></dt>
10119:
10120: <dt><span class="sect2"><a href=
1.38 dillo 10121: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 10122: modules</a></span></dt>
10123:
10124: <dt><span class="sect2"><a href=
1.38 dillo 10125: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 10126: or XML data</a></span></dt>
1.1 grant 10127:
10128: <dt><span class="sect2"><a href=
1.38 dillo 10129: "#mime-database">15.5.13. Packages installing
1.1 grant 10130: extensions to the MIME database</a></span></dt>
10131:
10132: <dt><span class="sect2"><a href=
1.38 dillo 10133: "#intltool">15.5.14. Packages using
1.1 grant 10134: intltool</a></span></dt>
1.18 xtraeme 10135:
10136: <dt><span class="sect2"><a href=
1.38 dillo 10137: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 10138: startup scripts</a></span></dt>
1.1 grant 10139: </dl>
10140: </dd>
10141:
1.30 wiz 10142: <dt><span class="sect1"><a href=
1.38 dillo 10143: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 10144: author</a></span></dt>
1.1 grant 10145: </dl>
10146: </div>
10147:
10148: <div class="sect1" lang="en" xml:lang="en">
10149: <div class="titlepage">
10150: <div>
10151: <div>
10152: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10153: "general-operation" id=
1.38 dillo 10154: "general-operation"></a>15.1. General
1.1 grant 10155: operation</h2>
10156: </div>
10157: </div>
10158: </div>
10159:
10160: <div class="sect2" lang="en" xml:lang="en">
10161: <div class="titlepage">
10162: <div>
10163: <div>
1.30 wiz 10164: <h3 class="title"><a name=
10165: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 10166: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 10167: to pull in variables from /etc/mk.conf</h3>
1.1 grant 10168: </div>
10169: </div>
10170: </div>
10171:
10172: <p>The problem with package-defined variables that can
1.14 xtraeme 10173: be overridden via <code class="varname">MAKECONF</code>
10174: or <code class="filename">/etc/mk.conf</code> is that
10175: <a href=
1.1 grant 10176: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10177: <span class="citerefentry"><span class=
10178: "refentrytitle">make</span>(1)</span></a> expands a
10179: variable as it is used, but evaluates preprocessor like
10180: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 10181: So, to use any variable (which may be set in
10182: <code class="filename">/etc/mk.conf</code>) in one of
10183: the .if* statements, the file <code class=
10184: "filename">/etc/mk.conf</code> must be included before
1.1 grant 10185: that .if* statement.</p>
10186:
10187: <p>Rather than have a number of ad-hoc ways of
1.14 xtraeme 10188: including <code class="filename">/etc/mk.conf</code>,
10189: should it exist, or <code class=
10190: "varname">MAKECONF</code>, should it exist, include the
10191: <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
10192: file in the package Makefile before any
10193: preprocessor-like .if, .ifdef, or .ifndef
10194: statements:</p>
1.1 grant 10195: <pre class="programlisting">
10196: .include "../../mk/bsd.prefs.mk"
10197:
10198: .if defined(USE_MENUS)
10199: ...
10200: .endif
10201: </pre>
10202:
1.14 xtraeme 10203: <p>If you wish to set the <code class=
10204: "varname">CFLAGS</code> variable in <code class=
10205: "filename">/etc/mk.conf</code> please make sure to
1.1 grant 10206: use:</p>
10207: <pre class="programlisting">
10208: CFLAGS+= -your -flags
10209: </pre>
10210:
1.14 xtraeme 10211: <p>Using <code class="varname">CFLAGS=</code> (i.e.
10212: without the “<span class="quote">+</span>”)
10213: may lead to problems with packages that need to add
10214: their own flags. Also, you may want to take a look at
10215: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 10216: href=
10217: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20 ben 10218: class="pkgname">devel/cpuflags</a> package if you're
10219: interested in optimization for the current CPU.</p>
1.1 grant 10220: </div>
10221:
10222: <div class="sect2" lang="en" xml:lang="en">
10223: <div class="titlepage">
10224: <div>
10225: <div>
1.31 wiz 10226: <h3 class="title"><a name=
10227: "where-to-install-documentation" id=
1.38 dillo 10228: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 10229: to install documentation</h3>
10230: </div>
10231: </div>
10232: </div>
10233:
10234: <p>Documentation should be installed into <code class=
10235: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
10236: <code class=
10237: "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
10238: latter includes the version number of the package).</p>
10239: </div>
10240:
10241: <div class="sect2" lang="en" xml:lang="en">
10242: <div class="titlepage">
10243: <div>
10244: <div>
1.30 wiz 10245: <h3 class="title"><a name="restricted-packages"
10246: id=
1.38 dillo 10247: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 10248: packages</h3>
10249: </div>
10250: </div>
10251: </div>
10252:
10253: <p>Some licenses restrict how software may be
10254: re-distributed. In order to satisfy these restrictions,
10255: the package system defines five make variables that can
10256: be set to note these restrictions:</p>
10257:
10258: <div class="itemizedlist">
10259: <ul type="disc">
10260: <li>
1.14 xtraeme 10261: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 10262:
10263: <p>This variable should be set whenever a
10264: restriction exists (regardless of its kind). Set
10265: this variable to a string containing the reason
10266: for the restriction.</p>
10267: </li>
10268:
10269: <li>
1.14 xtraeme 10270: <p><code class=
10271: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 10272:
10273: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 10274: variable to <code class=
10275: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10276: package may not be included on a CD-ROM.</p>
10277: </li>
10278:
10279: <li>
1.14 xtraeme 10280: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 10281:
10282: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 10283: Set this variable to <code class=
10284: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 10285: package may not not be made available on the
10286: Internet.</p>
10287: </li>
10288:
10289: <li>
1.14 xtraeme 10290: <p><code class=
10291: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 10292:
10293: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 10294: this variable to <code class=
10295: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10296: of the source code or other distfile(s) is not
10297: allowed on CD-ROMs.</p>
10298: </li>
10299:
10300: <li>
1.14 xtraeme 10301: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 10302:
10303: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 10304: variable to <code class=
10305: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 10306: of the source code or other distfile(s) via the
10307: Internet is not allowed.</p>
10308: </li>
10309: </ul>
10310: </div>
10311:
1.14 xtraeme 10312: <p>Please note that the use of <code class=
10313: "varname">NO_PACKAGE</code>, <code class=
10314: "varname">IGNORE</code>, <code class=
10315: "varname">NO_CDROM</code>, or other generic make
1.1 grant 10316: variables to denote restrictions is deprecated, because
10317: they unconditionally prevent users from generating
10318: binary packages!</p>
10319: </div>
10320:
10321: <div class="sect2" lang="en" xml:lang="en">
10322: <div class="titlepage">
10323: <div>
10324: <div>
10325: <h3 class="title"><a name="dependencies" id=
1.38 dillo 10326: "dependencies"></a>15.1.4. Handling
1.1 grant 10327: dependencies</h3>
10328: </div>
10329: </div>
10330: </div>
10331:
10332: <p>Your package may depend on some other package being
10333: present - and there are various ways of expressing this
1.14 xtraeme 10334: dependency. pkgsrc supports the <code class=
10335: "varname">BUILD_DEPENDS</code> and <code class=
10336: "varname">DEPENDS</code> definitions, as well as
10337: dependencies via <code class=
10338: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 10339: way to handle dependencies, and which uses the
10340: variables named above. See <a href="#buildlink" title=
1.38 dillo 10341: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 10342: <i>Buildlink methodology</i></a> for more
10343: information.</p>
10344:
10345: <p>The basic difference between the two variables is as
1.14 xtraeme 10346: follows: The <code class="varname">DEPENDS</code>
1.1 grant 10347: definition registers that pre-requisite in the binary
10348: package so it will be pulled in when the binary package
1.14 xtraeme 10349: is later installed, whilst the <code class=
10350: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 10351: marking a dependency that is only needed for building
10352: the package.</p>
10353:
10354: <p>This means that if you only need a package present
10355: whilst you are building, it should be noted as a
1.14 xtraeme 10356: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 10357:
1.14 xtraeme 10358: <p>The format for a <code class=
10359: "varname">BUILD_DEPENDS</code> and a <code class=
10360: "varname">DEPENDS</code> definition is:</p>
1.1 grant 10361: <pre class="programlisting">
10362: <pre-req-package-name>:../../<category>/<pre-req-package>
10363: </pre>
10364:
10365: <p>Please note that the “<span class=
10366: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 10367: any of the wildcard version numbers recognized by
1.1 grant 10368: <a href=
10369: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10370: <span class="citerefentry"><span class=
10371: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
10372:
10373: <div class="orderedlist">
10374: <ol type="1">
10375: <li>
10376: <p>If your package needs another package's
10377: binaries or libraries to build or run, and if
1.14 xtraeme 10378: that package has a <code class=
10379: "filename">buildlink3.mk</code> file available,
10380: use it:</p>
1.1 grant 10381: <pre class="programlisting">
10382: .include "../../graphics/jpeg/buildlink3.mk"
10383:
10384: </pre>
10385: </li>
10386:
10387: <li>
10388: <p>If your package needs to use another package
1.14 xtraeme 10389: to build itself and there is no <code class=
10390: "filename">buildlink3.mk</code> file available,
10391: use the <code class=
10392: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 10393: <pre class="programlisting">
10394: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
10395: </pre>
10396: </li>
10397:
10398: <li>
10399: <p>If your package needs a library with which to
1.14 xtraeme 10400: link and again there is no <code class=
10401: "filename">buildlink3.mk</code> file available,
10402: this is specified using the <code class=
10403: "varname">DEPENDS</code> definition. An example
10404: of this is the <a xmlns=
1.1 grant 10405: "http://www.w3.org/TR/xhtml1/transitional" href=
10406: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10407: class="pkgname">print/lyx</a> package, which uses
10408: the xpm library, version 3.4j to build:</p>
1.1 grant 10409: <pre class="programlisting">
10410: DEPENDS+= xpm-3.4j:../../graphics/xpm
10411: </pre>
10412:
10413: <p>You can also use wildcards in package
10414: dependences:</p>
10415: <pre class="programlisting">
10416: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
10417: </pre>
10418:
10419: <p>Note that such wildcard dependencies are
10420: retained when creating binary packages. The
10421: dependency is checked when installing the binary
10422: package and any package which matches the pattern
10423: will be used. Wildcard dependencies should be
10424: used with care.</p>
10425:
10426: <p>The “<span class=
10427: "quote">-[0-9]*</span>” should be used
10428: instead of “<span class=
10429: "quote">-*</span>” to avoid potentially
10430: ambiguous matches such as “<span class=
10431: "quote">tk-postgresql</span>” matching a
10432: “<span class="quote">tk-*</span>”
1.14 xtraeme 10433: <code class="varname">DEPENDS</code>.</p>
1.1 grant 10434:
10435: <p>Wildcards can also be used to specify that a
10436: package will only build against a certain minimum
10437: version of a pre-requisite:</p>
10438: <pre class="programlisting">
10439: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
10440: </pre>
10441:
10442: <p>This means that the package will build against
10443: version 3.5.4 of the tiff library or newer. Such
10444: a dependency may be warranted if, for example,
10445: the API of the library has changed with version
10446: 3.5.4 and a package would not compile against an
10447: earlier version of tiff.</p>
10448:
10449: <p>Please note that such dependencies should only
10450: be updated if a package requires a newer
10451: pre-requisite, but not to denote recommendations
10452: such as security updates or ABI changes that do
10453: not prevent a package from building correctly.
10454: Such recommendations can be expressed using
1.14 xtraeme 10455: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 10456: <pre class="programlisting">
10457: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
10458: </pre>
10459:
1.14 xtraeme 10460: <p>In addition to the above <code class=
10461: "varname">DEPENDS</code> line, this denotes that
1.1 grant 10462: while a package will build against
10463: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 10464: recommended. <code class=
10465: "varname">RECOMMENDED</code> entries will be
10466: turned into dependencies unless explicitly
10467: ignored (in which case a warning will be
1.36 wiz 10468: printed).</p>
10469:
10470: <p>To ignore these dependency recommendations and
10471: just use the required <code class=
10472: "varname">DEPENDS</code>, set <code class=
10473: "varname">IGNORE_RECOMMENDED=YES</code>. This may
10474: make it easier and faster to update packages
10475: built using pkgsrc, since older compatible
10476: dependencies can continue to be used. This is
10477: useful for people who watch their rebuilds very
10478: carefully; it is not very good as a
10479: general-purpose hammer. If you use it, you need
10480: to be mindful of possible ABI changes, including
10481: those from the underlying OS.</p>
10482:
10483: <p>Packages that are built with recommendations
10484: ignored may not be uploaded to ftp.NetBSD.org by
10485: developers and should not be used across
10486: different systems that may have different
10487: versions of binary packages installed.</p>
1.1 grant 10488:
10489: <p>For security fixes, please update the package
10490: vulnerabilities file as well as setting
1.14 xtraeme 10491: <code class="varname">RECOMMENDED</code>, see
1.1 grant 10492: <a href="#security-handling" title=
1.38 dillo 10493: "15.1.8. Handling packages with security problems">
10494: Section 15.1.8, “Handling packages with
1.1 grant 10495: security problems”</a> for more
10496: information.</p>
10497: </li>
10498:
10499: <li>
10500: <p>If your package needs some executable to be
1.17 sketch 10501: able to run correctly and if there's no
1.14 xtraeme 10502: <code class="filename">buildlink3.mk</code> file,
10503: this is specified using the <code class=
10504: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 10505: "http://www.w3.org/TR/xhtml1/transitional" href=
10506: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20 ben 10507: class="pkgname">print/lyx</a> package needs to be
10508: able to execute the latex binary from the teTeX
10509: package when it runs, and that is specified:</p>
1.1 grant 10510: <pre class="programlisting">
10511: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
10512: </pre>
10513:
10514: <p>The comment about wildcard dependencies from
10515: previous paragraph applies here, too.</p>
10516: </li>
10517: </ol>
10518: </div>
10519:
10520: <p>If your package needs files from another package to
10521: build, see the first part of the “<span class=
10522: "quote">do-configure</span>” target <a xmlns=
10523: "http://www.w3.org/TR/xhtml1/transitional" href=
10524: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20 ben 10525: class="pkgname">print/ghostscript5</a> package (it
10526: relies on the jpeg sources being present in source form
10527: during the build):</p>
1.1 grant 10528: <pre class="programlisting">
10529: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
10530: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
10531: fi
10532: </pre>
10533:
10534: <p>If you build any other packages that way, please
10535: make sure the working files are deleted too when this
10536: package's working files are cleaned up. The easiest way
10537: to do so is by adding a pre-clean target:</p>
10538: <pre class="programlisting">
10539: pre-clean:
10540: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
10541: </pre>
10542:
1.14 xtraeme 10543: <p>Please also note the <code class=
10544: "varname">BUILD_USES_MSGFMT</code> and <code class=
10545: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
10546: which are provided as convenience definitions. The
1.24 wiz 10547: former works out whether <a href=
10548: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
10549: <span class="citerefentry"><span class=
10550: "refentrytitle">msgfmt</span>(1)</span></a> is part of
10551: the base system, and, if it isn't, installs the
10552: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10553: href=
1.1 grant 10554: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20 ben 10555: class="pkgname">devel/gettext</a> package. The latter
10556: adds a build dependency on either an installed version
10557: of an older gettext package, or if it isn't, installs
10558: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10559: href=
10560: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
10561: class="pkgname">devel/gettext-m4</a> package.</p>
1.1 grant 10562: </div>
10563:
10564: <div class="sect2" lang="en" xml:lang="en">
10565: <div class="titlepage">
10566: <div>
10567: <div>
1.30 wiz 10568: <h3 class="title"><a name="conflicts" id=
1.38 dillo 10569: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 10570: with other packages</h3>
10571: </div>
10572: </div>
10573: </div>
10574:
10575: <p>Your package may conflict with other packages a user
10576: might already have installed on his system, e.g. if
10577: your package installs the same set of files like
10578: another package in our pkgsrc tree.</p>
10579:
1.14 xtraeme 10580: <p>In this case you can set <code class=
10581: "varname">CONFLICTS</code> to a space separated list of
1.1 grant 10582: packages (including version string) your package
10583: conflicts with.</p>
10584:
10585: <p>For example <a xmlns=
10586: "http://www.w3.org/TR/xhtml1/transitional" href=
10587: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20 ben 10588: class="pkgname">x11/Xaw3d</a> and <a xmlns=
10589: "http://www.w3.org/TR/xhtml1/transitional" href=
10590: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
10591: class="pkgname">x11/Xaw-Xpm</a> install provide the
10592: same shared library, thus you set in <code class=
10593: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 10594: <pre class="programlisting">
10595: CONFLICTS= Xaw-Xpm-[0-9]*
10596: </pre>
10597:
1.14 xtraeme 10598: <p>and in <code class=
10599: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 10600: <pre class="programlisting">
10601: CONFLICTS= Xaw3d-[0-9]*
10602: </pre>
10603:
10604: <p>Packages will automatically conflict with other
10605: packages with the name prefix and a different version
10606: string. “<span class=
10607: "quote">Xaw3d-1.5</span>” e.g. will automatically
10608: conflict with the older version “<span class=
10609: "quote">Xaw3d-1.3</span>”.</p>
10610: </div>
10611:
10612: <div class="sect2" lang="en" xml:lang="en">
10613: <div class="titlepage">
10614: <div>
10615: <div>
1.30 wiz 10616: <h3 class="title"><a name="not-building-packages"
10617: id=
1.38 dillo 10618: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 10619: that cannot or should not be built</h3>
1.1 grant 10620: </div>
10621: </div>
10622: </div>
10623:
10624: <p>There are several reasons why a package might be
10625: instructed to not build under certain circumstances. If
10626: the package builds and runs on most platforms, the
1.14 xtraeme 10627: exceptions should be noted with <code class=
10628: "varname">NOT_FOR_PLATFORM</code>. If the package
10629: builds and runs on a small handful of platforms, set
10630: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
10631: If the package should be skipped (for example, because
10632: it provides functionality already provided by the
10633: system), set <code class=
10634: "varname">PKG_SKIP_REASON</code> to a descriptive
10635: message. If the package should fail because some
10636: preconditions are not met, set <code class=
10637: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 10638: message.</p>
10639:
1.14 xtraeme 10640: <p><code class="varname">IGNORE</code> is deprecated
1.1 grant 10641: because it didn't provide enough information to
10642: determine whether the build should fail.</p>
10643: </div>
10644:
10645: <div class="sect2" lang="en" xml:lang="en">
10646: <div class="titlepage">
10647: <div>
10648: <div>
1.30 wiz 10649: <h3 class="title"><a name="undeletable-packages"
10650: id=
1.38 dillo 10651: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 10652: which should not be deleted, once installed</h3>
1.1 grant 10653: </div>
10654: </div>
10655: </div>
10656:
10657: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 10658: has been installed, the <code class=
10659: "varname">PKG_PRESERVE</code> definition should be set
10660: in the package Makefile. This will be carried into any
1.1 grant 10661: binary package that is made from this pkgsrc entry. A
10662: “<span class="quote">preserved</span>”
10663: package will not be deleted using <a href=
10664: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10665: <span class="citerefentry"><span class=
10666: "refentrytitle">pkg_delete</span>(1)</span></a> unless
10667: the “<span class="quote">-f</span>” option
10668: is used.</p>
10669: </div>
10670:
10671: <div class="sect2" lang="en" xml:lang="en">
10672: <div class="titlepage">
10673: <div>
10674: <div>
10675: <h3 class="title"><a name="security-handling" id=
1.38 dillo 10676: "security-handling"></a>15.1.8. Handling
1.1 grant 10677: packages with security problems</h3>
10678: </div>
10679: </div>
10680: </div>
10681:
10682: <p>When a vulnerability is found, this should be noted
1.14 xtraeme 10683: in <code class=
10684: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1 grant 10685: and after the commit of that file, it should be copied
1.14 xtraeme 10686: to both <code class=
10687: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
10688: and <code class=
10689: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
10690: on ftp.NetBSD.org using <code class=
10691: "filename">localsrc/security/advisories/Makefile</code>.
10692: In addition, if a <code class=
10693: "filename">buildlink3.mk</code> file exists for an
10694: affected package, bumping <code class=
10695: "varname">PKGREVISION</code> and creating a
10696: corresponding <code class=
10697: "varname">BUILDLINK_RECOMMENDED.<em class=
10698: "replaceable"><code>pkg</code></em></code> entry should
10699: be considered. See <a href="#buildlink" title=
1.38 dillo 10700: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 10701: <i>Buildlink methodology</i></a> for more information
1.14 xtraeme 10702: about writing <code class=
10703: "filename">buildlink3.mk</code> files and <code class=
10704: "varname">BUILDLINK_*</code> definitions.</p>
1.1 grant 10705:
10706: <p>Also, if the fix should be applied to the stable
10707: pkgsrc branch, be sure to submit a pullup request!</p>
10708: </div>
10709:
10710: <div class="sect2" lang="en" xml:lang="en">
10711: <div class="titlepage">
10712: <div>
10713: <div>
1.30 wiz 10714: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 10715: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 10716: compiler bugs</h3>
10717: </div>
10718: </div>
10719: </div>
10720:
10721: <p>Some source files trigger bugs in the compiler,
10722: based on combinations of compiler version and
10723: architecture and almost always relation to optimisation
10724: being enabled. Common symptoms are gcc internal errors
10725: or never finishing compiling a file.</p>
10726:
10727: <p>Typically a workaround involves testing the
1.14 xtraeme 10728: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 10729: version, disabling optimisation for that
1.14 xtraeme 10730: file/<code class="varname">MACHINE_ARCH</code>/compiler
10731: combination, and documenting it in <code class=
10732: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 10733: number of examples!</p>
10734: </div>
10735:
10736: <div class="sect2" lang="en" xml:lang="en">
10737: <div class="titlepage">
10738: <div>
10739: <div>
1.30 wiz 10740: <h3 class="title"><a name="bumping-pkgrevision"
1.38 dillo 10741: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 10742: handle incrementing versions when fixing an
10743: existing package</h3>
1.1 grant 10744: </div>
10745: </div>
10746: </div>
10747:
10748: <p>When making fixes to an existing package it can be
1.14 xtraeme 10749: useful to change the version number in <code class=
10750: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 10751: future versions by the original author, a
10752: “<span class="quote">nb1</span>”,
10753: “<span class="quote">nb2</span>”, ...
10754: suffix can be used on package versions by setting
1.14 xtraeme 10755: <code class="varname">PKGREVISION=1</code> (2, ...).
10756: The “<span class="quote">nb</span>” is
10757: treated like a “<span class=
10758: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 10759: <pre class="programlisting">
10760: DISTNAME= foo-17.42
10761: PKGREVISION= 9
10762: </pre>
10763:
1.14 xtraeme 10764: <p>will result in a <code class=
10765: "varname">PKGNAME</code> of “<span class=
1.1 grant 10766: "quote">foo-17.42nb9</span>”.</p>
10767:
10768: <p>When a new release of the package is released, the
1.14 xtraeme 10769: <code class="varname">PKGREVISION</code> should be
10770: removed. e.g. on a new minor release of the above
10771: package, things should be like:</p>
1.1 grant 10772: <pre class="programlisting">
10773: DISTNAME= foo-17.43
10774: </pre>
10775: </div>
10776:
10777: <div class="sect2" lang="en" xml:lang="en">
10778: <div class="titlepage">
10779: <div>
10780: <div>
1.30 wiz 10781: <h3 class="title"><a name=
10782: "portability-of-packages" id=
1.38 dillo 10783: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 10784: of packages</h3>
1.1 grant 10785: </div>
10786: </div>
10787: </div>
10788:
10789: <p>One appealing feature of pkgsrc is that it runs on
10790: many different platforms. As a result, it is important
10791: to ensure, where possible, that packages in pkgsrc are
10792: portable. There are some particular details you should
10793: pay attention to while working on pkgsrc.</p>
10794:
10795: <div class="sect3" lang="en" xml:lang="en">
10796: <div class="titlepage">
10797: <div>
10798: <div>
1.30 wiz 10799: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 10800: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 10801: ${INSTALL_DATA_DIR}, ...</h4>
10802: </div>
10803: </div>
10804: </div>
10805:
1.14 xtraeme 10806: <p>The BSD-compatible <span><strong class=
10807: "command">install</strong></span> supplied with some
1.1 grant 10808: operating systems will not perform more than one
10809: operation at a time. As such, you should call
10810: “<span class="quote">${INSTALL}</span>”,
10811: etc. like this:</p>
10812: <pre class="programlisting">
10813: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
10814: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
10815: </pre>
10816: </div>
10817: </div>
10818: </div>
10819:
10820: <div class="sect1" lang="en" xml:lang="en">
10821: <div class="titlepage">
10822: <div>
10823: <div>
10824: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10825: "downloading-issues" id=
1.38 dillo 10826: "downloading-issues"></a>15.2. Possible
1.1 grant 10827: downloading issues</h2>
10828: </div>
10829: </div>
10830: </div>
10831:
10832: <div class="sect2" lang="en" xml:lang="en">
10833: <div class="titlepage">
10834: <div>
10835: <div>
1.30 wiz 10836: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 10837: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 10838: whose distfiles aren't available for plain
1.1 grant 10839: downloading</h3>
10840: </div>
10841: </div>
10842: </div>
10843:
10844: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 10845: set <code class="varname">DYNAMIC_MASTER_SITES</code>
10846: and a <span><strong class="command">make
10847: fetch</strong></span> will call <code class=
10848: "filename">files/getsite.sh</code> with the name of
10849: each file to download as an argument, expecting it to
10850: output the URL of the directory from which to download
10851: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
10852: href=
1.1 grant 10853: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20 ben 10854: class="pkgname">graphics/ns-cult3d</a> is an example of
10855: this usage.</p>
1.1 grant 10856:
10857: <p>If the download can't be automated, because the user
10858: must submit personal information to apply for a
10859: password, or must pay for the source, or whatever, you
1.14 xtraeme 10860: can set <code class="varname">_FETCH_MESSAGE</code> to
10861: a macro which displays a message explaining the
10862: situation. <code class="varname">_FETCH_MESSAGE</code>
10863: must be executable shell commands, not just a message.
10864: (Generally, it executes <code class=
10865: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 10866: following packages use this: <a xmlns=
10867: "http://www.w3.org/TR/xhtml1/transitional" href=
10868: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20 ben 10869: class="pkgname">audio/realplayer</a>, <a xmlns=
10870: "http://www.w3.org/TR/xhtml1/transitional" href=
10871: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
10872: class="pkgname">cad/simian</a>, <a xmlns=
10873: "http://www.w3.org/TR/xhtml1/transitional" href=
10874: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
10875: class="pkgname">devel/ipv6socket</a>, <a xmlns=
10876: "http://www.w3.org/TR/xhtml1/transitional" href=
10877: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
10878: class="pkgname">emulators/vmware-module</a>, <a xmlns=
10879: "http://www.w3.org/TR/xhtml1/transitional" href=
10880: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
10881: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
10882: "http://www.w3.org/TR/xhtml1/transitional" href=
10883: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
10884: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
10885: "http://www.w3.org/TR/xhtml1/transitional" href=
10886: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
10887: class="pkgname">www/ap-aolserver</a>, <a xmlns=
10888: "http://www.w3.org/TR/xhtml1/transitional" href=
10889: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
10890: class="pkgname">www/openacs</a>. Try to be consistent
10891: with them.</p>
1.1 grant 10892: </div>
10893:
10894: <div class="sect2" lang="en" xml:lang="en">
10895: <div class="titlepage">
10896: <div>
10897: <div>
1.30 wiz 10898: <h3 class="title"><a name=
10899: "modified-distfiles-same-name" id=
1.38 dillo 10900: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 10901: to handle modified distfiles with the 'old'
10902: name</h3>
1.1 grant 10903: </div>
10904: </div>
10905: </div>
10906:
10907: <p>Sometimes authors of a software package make some
10908: modifications after the software was released, and they
10909: put up a new distfile without changing the package's
10910: version number. If a package is already in pkgsrc at
1.32 wiz 10911: that time, the checksum will no longer match. The
10912: contents of the new distfile should be compared against
10913: the old one before changing anything, to make sure the
10914: distfile was really updated on purpose, and that no
10915: trojan horse or so crept in. Then, the correct way to
10916: work around this is to set <code class=
10917: "varname">DIST_SUBDIR</code> to a unique directory
10918: name, usually based on <code class=
10919: "varname">PKGNAME_NOREV</code>. In case this happens
10920: more often, <code class="varname">PKGNAME</code> can be
10921: used (thus including the <code class=
10922: "filename">nbX</code> suffix) or a date stamp can be
10923: appended, like <code class=
10924: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
10925: forget regenerating the <code class=
10926: "filename">distinfo</code> file after that, since it
10927: contains the <code class="varname">DIST_SUBDIR</code>
10928: path in the filenames. Furthermore, a mail to the
10929: package's authors seems appropriate telling them that
10930: changing distfiles after releases without changing the
10931: file names is not good practice.</p>
1.1 grant 10932: </div>
10933: </div>
10934:
10935: <div class="sect1" lang="en" xml:lang="en">
10936: <div class="titlepage">
10937: <div>
10938: <div>
10939: <h2 class="title" style="clear: both"><a name=
1.30 wiz 10940: "configuration-gotchas" id=
1.38 dillo 10941: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 10942: gotchas</h2>
10943: </div>
10944: </div>
10945: </div>
10946:
10947: <div class="sect2" lang="en" xml:lang="en">
10948: <div class="titlepage">
10949: <div>
10950: <div>
10951: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 10952: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 10953: - libtool</h3>
10954: </div>
10955: </div>
10956: </div>
10957:
10958: <p>pkgsrc supports many different machines, with
10959: different object formats like a.out and ELF, and
10960: varying abilities to do shared library and dynamic
10961: loading at all. To accompany this, varying commands and
10962: options have to be passed to the compiler, linker, etc.
10963: to get the Right Thing, which can be pretty annoying
10964: especially if you don't have all the machines at your
10965: hand to test things. The <a xmlns=
10966: "http://www.w3.org/TR/xhtml1/transitional" href=
10967: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20 ben 10968: class="pkgname">devel/libtool</a> pkg can help here, as
10969: it just “<span class="quote">knows</span>”
10970: how to build both static and dynamic libraries from a
10971: set of source files, thus being platform
10972: independent.</p>
1.1 grant 10973:
10974: <p>Here's how to use libtool in a pkg in seven simple
10975: steps:</p>
10976:
10977: <div class="orderedlist">
10978: <ol type="1">
10979: <li>
1.14 xtraeme 10980: <p>Add <code class=
10981: "varname">USE_LIBTOOL=yes</code> to the package
10982: Makefile.</p>
1.1 grant 10983: </li>
10984:
10985: <li>
10986: <p>For library objects, use “<span class=
10987: "quote">${LIBTOOL} --mode=compile
10988: ${CC}</span>” in place of
10989: “<span class="quote">${CC}</span>”.
10990: You could even add it to the definition of
1.14 xtraeme 10991: <code class="varname">CC</code>, if only
10992: libraries are being built in a given Makefile.
10993: This one command will build both PIC and non-PIC
10994: library objects, so you need not have separate
10995: shared and non-shared library rules.</p>
1.1 grant 10996: </li>
10997:
10998: <li>
10999: <p>For the linking of the library, remove any
11000: “<span class="quote">ar</span>”,
11001: “<span class="quote">ranlib</span>”,
11002: and “<span class="quote">ld
11003: -Bshareable</span>” commands, and instead
11004: use:</p>
11005: <pre class="programlisting">
11006: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
11007: </pre>
11008:
11009: <p>Note that the library is changed to have a
1.14 xtraeme 11010: <code class="filename">.la</code> extension, and
11011: the objects are changed to have a <code class=
11012: "filename">.lo</code> extension. Change
11013: <code class="varname">OBJS</code> as necessary.
11014: This automatically creates all of the
11015: <code class="filename">.a</code>, <code class=
11016: "filename">.so.major.minor</code>, and ELF
11017: symlinks (if necessary) in the build directory.
11018: Be sure to include “<span class=
1.1 grant 11019: "quote">-version-info</span>”, especially
11020: when major and minor are zero, as libtool will
11021: otherwise strip off the shared library
11022: version.</p>
11023:
11024: <p>From the libtool manual:</p>
11025: <pre class="programlisting">
11026: So, libtool library versions are described by three integers:
11027:
11028: CURRENT
11029: The most recent interface number that this library implements.
11030:
11031: REVISION
11032: The implementation number of the CURRENT interface.
11033:
11034: AGE
11035: The difference between the newest and oldest interfaces that this
11036: library implements. In other words, the library implements all the
11037: interface numbers in the range from number `CURRENT - AGE' to
11038: `CURRENT'.
11039:
11040: If two libraries have identical CURRENT and AGE numbers, then the
11041: dynamic linker chooses the library with the greater REVISION number.
11042: </pre>
11043:
11044: <p>The “<span class=
11045: "quote">-release</span>” option will
11046: produce different results for a.out and ELF
11047: (excluding symlinks) in only one case. An ELF
11048: library of the form “<span class=
11049: "quote">libfoo-release.so.<span class=
11050: "emphasis"><em>x</em></span>.<span class=
11051: "emphasis"><em>y</em></span></span>” will
11052: have a symlink of “<span class=
11053: "quote">libfoo.so.<span class=
11054: "emphasis"><em>x</em></span>.<span class=
11055: "emphasis"><em>y</em></span></span>” on an
11056: a.out platform. This is handled
11057: automatically.</p>
11058:
11059: <p>The “<span class="quote">-rpath
11060: argument</span>” is the install directory
11061: of the library being built.</p>
11062:
1.14 xtraeme 11063: <p>In the <code class="filename">PLIST</code>,
1.19 hubertf 11064: include only the <code class=
11065: "filename">.la</code> file, the other files will
11066: be added automatically.</p>
1.1 grant 11067: </li>
11068:
11069: <li>
1.14 xtraeme 11070: <p>When linking shared object (<code class=
11071: "filename">.so</code>) files, i.e. files that are
1.24 wiz 11072: loaded via <a href=
11073: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
11074: <span class="citerefentry"><span class=
11075: "refentrytitle">dlopen</span>(3)</span></a>, NOT
11076: shared libraries, use “<span class=
11077: "quote">-module -avoid-version</span>” to
11078: prevent them getting version tacked on.</p>
1.1 grant 11079:
1.14 xtraeme 11080: <p>The <code class="filename">PLIST</code> file
11081: gets the <code class="filename">foo.so</code>
11082: entry.</p>
1.1 grant 11083: </li>
11084:
11085: <li>
11086: <p>When linking programs that depend on these
11087: libraries <span class=
11088: "emphasis"><em>before</em></span> they are
11089: installed, preface the <a href=
11090: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
11091: <span class="citerefentry"><span class=
11092: "refentrytitle">cc</span>(1)</span></a> or
11093: <a href=
11094: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
11095: <span class="citerefentry"><span class=
11096: "refentrytitle">ld</span>(1)</span></a> line with
11097: “<span class="quote">${LIBTOOL}
11098: --mode=link</span>”, and it will find the
11099: correct libraries (static or shared), but please
11100: be aware that libtool will not allow you to
11101: specify a relative path in -L (such as
11102: “<span class=
11103: "quote">-L../somelib</span>”), because it
11104: expects you to change that argument to be the
1.14 xtraeme 11105: <code class="filename">.la</code> file. e.g.</p>
1.1 grant 11106: <pre class="programlisting">
11107: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
11108: </pre>
11109:
11110: <p>should be changed to:</p>
11111: <pre class="programlisting">
1.14 xtraeme 11112: ${LIBTOOL} --mode=link ${CC} -o <em class=
11113: "replaceable"><code>someprog</code></em> <em class=
11114: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 11115: </pre>
11116:
11117: <p>and it will do the right thing with the
11118: libraries.</p>
11119: </li>
11120:
11121: <li>
11122: <p>When installing libraries, preface the
11123: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
11124: <span class="citerefentry"><span class=
11125: "refentrytitle">install</span>(1)</span></a> or
11126: <a href=
11127: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
11128: <span class="citerefentry"><span class=
11129: "refentrytitle">cp</span>(1)</span></a> command
11130: with “<span class="quote">${LIBTOOL}
11131: --mode=install</span>”, and change the
1.14 xtraeme 11132: library name to <code class=
11133: "filename">.la</code>. e.g.</p>
1.1 grant 11134: <pre class="programlisting">
11135: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
11136: </pre>
11137:
1.14 xtraeme 11138: <p>This will install the static <code class=
11139: "filename">.a</code>, shared library, any needed
1.1 grant 11140: symlinks, and run <a href=
11141: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
11142: <span class="citerefentry"><span class=
11143: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
11144: </li>
11145:
11146: <li>
1.14 xtraeme 11147: <p>In your <code class="filename">PLIST</code>,
1.23 wiz 11148: include only the <code class=
11149: "filename">.la</code> file (this is a change from
11150: previous behaviour).</p>
1.1 grant 11151: </li>
11152: </ol>
11153: </div>
11154: </div>
11155:
11156: <div class="sect2" lang="en" xml:lang="en">
11157: <div class="titlepage">
11158: <div>
11159: <div>
1.30 wiz 11160: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 11161: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 11162: GNU packages that already support libtool</h3>
1.1 grant 11163: </div>
11164: </div>
11165: </div>
11166:
1.14 xtraeme 11167: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
11168: the package Makefile. This will override the package's
11169: own libtool in most cases. For older libtool using
1.1 grant 11170: packages, libtool is made by ltconfig script during the
11171: do-configure step; you can check the libtool script
1.14 xtraeme 11172: location by doing <span><strong class="command">make
11173: configure; find work*/ -name
11174: libtool</strong></span>.</p>
11175:
11176: <p><code class="varname">LIBTOOL_OVERRIDE</code>
11177: specifies which libtool scripts, relative to
11178: <code class="varname">WRKSRC</code>, to override. By
11179: default, it is set to “<span class=
11180: "quote">libtool */libtool */*/libtool</span>”. If
11181: this does not match the location of the package's
11182: libtool script(s), set it as appropriate.</p>
1.13 hubertf 11183:
1.14 xtraeme 11184: <p>If you do not need <code class="filename">*.a</code>
1.1 grant 11185: static libraries built and installed, then use
1.14 xtraeme 11186: <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1 grant 11187: instead.</p>
11188:
11189: <p>If your package makes use of the platform
11190: independent library for loading dynamic shared objects,
11191: that comes with libtool (libltdl), you should include
1.22 tv 11192: devel/libltdl/buildlink3.mk.</p>
1.1 grant 11193:
11194: <p>Some packages use libtool incorrectly so that the
11195: package may not work or build in some circumstances.
11196: Some of the more common errors are:</p>
11197:
11198: <div class="itemizedlist">
11199: <ul type="disc">
11200: <li>
11201: <p>The inclusion of a shared object (-module) as
11202: a dependent library in an executable or library.
11203: This in itself isn't a problem if one of two
11204: things has been done:</p>
11205:
11206: <div class="orderedlist">
11207: <ol type="1">
11208: <li>
11209: <p>The shared object is named correctly,
1.14 xtraeme 11210: i.e. <code class=
11211: "filename">libfoo.la</code>, not
11212: <code class="filename">foo.la</code></p>
1.1 grant 11213: </li>
11214:
11215: <li>
11216: <p>The -dlopen option is used when linking
11217: an executable.</p>
11218: </li>
11219: </ol>
11220: </div>
11221: </li>
11222:
11223: <li>
11224: <p>The use of libltdl without the correct calls
11225: to initialisation routines. The function
11226: lt_dlinit() should be called and the macro
1.14 xtraeme 11227: <code class=
11228: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 11229: included in executables.</p>
11230: </li>
11231: </ul>
11232: </div>
11233: </div>
11234:
11235: <div class="sect2" lang="en" xml:lang="en">
11236: <div class="titlepage">
11237: <div>
11238: <div>
1.30 wiz 11239: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 11240: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 11241: Autoconf/Automake</h3>
11242: </div>
11243: </div>
11244: </div>
11245:
11246: <p>If a package needs GNU autoconf or automake to be
11247: executed to regenerate the configure script and
11248: Makefile.in makefile templates, then they should be
1.35 jmmv 11249: executed in a pre-configure target.</p>
1.1 grant 11250:
11251: <p>For packages that need only autoconf:</p>
11252: <pre class="programlisting">
1.35 jmmv 11253: AUTOCONF_REQD= 2.50 # if default version is not good enough
11254: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
1.1 grant 11255: ...
11256:
11257: pre-configure:
1.35 jmmv 11258: cd ${WRKSRC}; autoconf
1.1 grant 11259:
11260: ...
11261: </pre>
11262:
11263: <p>and for packages that need automake and
11264: autoconf:</p>
11265: <pre class="programlisting">
1.35 jmmv 11266: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
1.36 wiz 11267: USE_TOOLS+= automake # use "automake14" for automake-1.4
1.1 grant 11268: ...
11269:
11270: pre-configure:
11271: cd ${WRKSRC}; \
1.35 jmmv 11272: aclocal; autoheader; \
11273: automake -a --foreign -i; autoconf
1.1 grant 11274:
11275: ...
11276: </pre>
11277:
11278: <p>Packages which use GNU Automake will almost
1.35 jmmv 11279: certainly require GNU Make.</p>
1.1 grant 11280:
11281: <p>There are times when the configure process makes
11282: additional changes to the generated files, which then
11283: causes the build process to try to re-execute the
11284: automake sequence. This is prevented by touching
11285: various files in the configure stage. If this causes
1.14 xtraeme 11286: problems with your package you can set <code class=
11287: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 11288: Makefile.</p>
11289: </div>
11290: </div>
11291:
11292: <div class="sect1" lang="en" xml:lang="en">
11293: <div class="titlepage">
11294: <div>
11295: <div>
11296: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11297: "building-considerations" id=
1.38 dillo 11298: "building-considerations"></a>15.4. Building
1.1 grant 11299: considerations</h2>
11300: </div>
11301: </div>
11302: </div>
11303:
11304: <div class="sect2" lang="en" xml:lang="en">
11305: <div class="titlepage">
11306: <div>
11307: <div>
1.30 wiz 11308: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 11309: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 11310: </div>
11311: </div>
11312: </div>
11313:
11314: <p>To port an application to NetBSD, it's usually
11315: necessary for the compiler to be able to judge the
11316: system on which it's compiling, and we use definitions
11317: so that the C pre-processor can do this.</p>
11318:
11319: <p>To test whether you are working on a 4.4 BSD-derived
11320: system, you should use the BSD definition, which is
1.14 xtraeme 11321: defined in <code class=
11322: "filename"><sys/param.h></code> on said
1.1 grant 11323: systems.</p>
11324: <pre class="programlisting">
11325: #include <sys/param.h>
11326: </pre>
11327:
11328: <p>and then you can surround the BSD-specific parts of
11329: your package's C/C++ code using this conditional:</p>
11330: <pre class="programlisting">
11331: #if (defined(BSD) && BSD >= 199306)
11332: ...
11333: #endif
11334: </pre>
11335:
11336: <p>Please use the “<span class=
11337: "quote">__NetBSD__</span>” definition sparingly -
11338: it should only apply to features of NetBSD that are not
11339: present in other 4.4-lite derived BSDs.</p>
11340: </div>
11341: </div>
11342:
11343: <div class="sect1" lang="en" xml:lang="en">
11344: <div class="titlepage">
11345: <div>
11346: <div>
11347: <h2 class="title" style="clear: both"><a name=
1.30 wiz 11348: "package-specific-actions" id=
1.38 dillo 11349: "package-specific-actions"></a>15.5. Package
1.1 grant 11350: specific actions</h2>
11351: </div>
11352: </div>
11353: </div>
11354:
11355: <div class="sect2" lang="en" xml:lang="en">
11356: <div class="titlepage">
11357: <div>
11358: <div>
1.30 wiz 11359: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 11360: "user-interaction"></a>15.5.1. User
1.2 hubertf 11361: interaction</h3>
1.1 grant 11362: </div>
11363: </div>
11364: </div>
11365:
11366: <p>Occasionally, packages require interaction from the
11367: user, and this can be in a number of ways:</p>
11368:
11369: <div class="itemizedlist">
11370: <ul type="disc">
11371: <li>
11372: <p>help in fetching the distfiles</p>
11373: </li>
11374:
11375: <li>
11376: <p>help to configure the package before it is
11377: built</p>
11378: </li>
11379:
11380: <li>
11381: <p>help during the build process</p>
11382: </li>
11383:
11384: <li>
11385: <p>help during the installation of a package</p>
11386: </li>
11387: </ul>
11388: </div>
11389:
1.14 xtraeme 11390: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 11391: definition is provided to notify the pkgsrc mechanism
11392: of an interactive stage which will be needed, and this
1.14 xtraeme 11393: should be set in the package's <code class=
11394: "filename">Makefile</code>. e.g.</p>
1.1 grant 11395: <pre class="programlisting">
11396: INTERACTIVE_STAGE= build
11397: </pre>
11398:
11399: <p>Multiple interactive stages can be specified:</p>
11400: <pre class="programlisting">
11401: INTERACTIVE_STAGE= configure install
11402: </pre>
11403: </div>
11404:
11405: <div class="sect2" lang="en" xml:lang="en">
11406: <div class="titlepage">
11407: <div>
11408: <div>
1.30 wiz 11409: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 11410: "handling-licenses"></a>15.5.2. Handling
1.1 grant 11411: licenses</h3>
11412: </div>
11413: </div>
11414: </div>
11415:
11416: <p>A package may underly a license which the user has
11417: or has not agreed to accept. Usually, packages that
11418: underly well-known Open Source licenses (e.g. the GNU
11419: Public License, GPL) won't have any special license
11420: tags added in pkgsrc which require special action by
11421: the user of such packages, but there are quite a number
11422: of other licenses out there that pkgsrc users may not
11423: be able to follow, for whatever reasons. For these
11424: cases, pkgsrc contains a mechanism to note that a
11425: package underlies a certain license, and the user has
11426: to accept the license before the package can be
11427: installed.</p>
11428:
11429: <p>Placing a certain package under a certain license
1.14 xtraeme 11430: works by setting the <code class=
11431: "varname">LICENSE</code> variable to a string
11432: identifying the license, e.g. in <a xmlns=
11433: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11434: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20 ben 11435: class="pkgname">graphics/graphviz</a>:</p>
1.1 grant 11436: <pre class="programlisting">
11437: LICENSE= graphviz-license
11438: </pre>
11439:
11440: <p>When trying to build, the user will get a notice
11441: that the package underlies a license which he hasn't
11442: accepted (yet):</p>
11443: <pre class="programlisting">
1.14 xtraeme 11444: <code class="prompt">%</code> <strong class=
11445: "userinput"><code>make</code></strong>
1.1 grant 11446: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
11447: ===> To build this package, add this line to your /etc/mk.conf:
11448: ===> ACCEPTABLE_LICENSES+=graphviz-license
11449: ===> To view the license, enter "/usr/bin/make show-license".
11450: *** Error code 1
11451: </pre>
11452:
1.14 xtraeme 11453: <p>The license can be viewed with <span><strong class=
11454: "command">make show-license</strong></span>, and if it
11455: is considered appropriate, the line printed above can
11456: be added to <code class="filename">/etc/mk.conf</code>
11457: to indicate acceptance of the particular license:</p>
1.1 grant 11458: <pre class="programlisting">
11459: ACCEPTABLE_LICENSES+=graphviz-license
11460: </pre>
11461:
11462: <p>When adding a package with a new license, the
1.14 xtraeme 11463: license text should be added to <code class=
11464: "filename">pkgsrc/licenses</code> for displaying. A
11465: list of known licenses can be seen in this directory as
11466: well as by looking at the list of (commented out)
11467: <code class="varname">ACCEPTABLE_LICENSES</code>
11468: variable settings in <code class=
11469: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 11470:
1.17 sketch 11471: <p>If there is a <span class=
1.1 grant 11472: "emphasis"><em>really</em></span> pressing need to
11473: accept all licenses at once, like when trying to
11474: download or mirror all distfiles or doing a bulk build
11475: to test if all packages in pkgsrc build, this can be
1.14 xtraeme 11476: done by setting <code class=
11477: "varname">_ACCEPTABLE=yes</code>.</p>
1.1 grant 11478: </div>
11479:
11480: <div class="sect2" lang="en" xml:lang="en">
11481: <div class="titlepage">
11482: <div>
11483: <div>
1.30 wiz 11484: <h3 class="title"><a name=
11485: "installing-score-files" id=
1.38 dillo 11486: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 11487: score files</h3>
1.1 grant 11488: </div>
11489: </div>
11490: </div>
11491:
11492: <p>Certain packages, most of them in the games
11493: category, install a score file that allows all users on
11494: the system to record their highscores. In order for
11495: this to work, the binaries need to be installed setgid
11496: and the score files owned by the appropriate group
11497: and/or owner (traditionally the "games" user/group).
11498: The following variables, documented in more detail in
1.14 xtraeme 11499: <code class="filename">mk/defaults/mk.conf</code>,
11500: control this behaviour: <code class=
11501: "varname">SETGIDGAME</code>, <code class=
11502: "varname">GAMEDATAMODE</code>, <code class=
11503: "varname">GAMEGRP</code>, <code class=
11504: "varname">GAMEMODE</code>, <code class=
11505: "varname">GAMEOWN</code>.</p>
1.1 grant 11506:
11507: <p>Note that per default, setgid installation of games
1.14 xtraeme 11508: is disabled; setting <code class=
11509: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 11510: variables accordingly.</p>
11511:
11512: <p>A package should therefor never hard code file
1.14 xtraeme 11513: ownership or access permissions but rely on
11514: <code class="varname">INSTALL_GAME</code> and
11515: <code class="varname">INSTALL_GAME_DATA</code> to set
11516: these correctly.</p>
1.1 grant 11517: </div>
11518:
11519: <div class="sect2" lang="en" xml:lang="en">
11520: <div class="titlepage">
11521: <div>
11522: <div>
1.30 wiz 11523: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 11524: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 11525: containing perl scripts</h3>
1.1 grant 11526: </div>
11527: </div>
11528: </div>
11529:
11530: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 11531: set <code class="varname">REPLACE_PERL</code> to ensure
11532: that the proper interpreter path is set. <code class=
11533: "varname">REPLACE_PERL</code> should contain a list of
11534: scripts, relative to <code class=
11535: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 11536: </div>
11537:
11538: <div class="sect2" lang="en" xml:lang="en">
11539: <div class="titlepage">
11540: <div>
11541: <div>
1.30 wiz 11542: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 11543: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 11544: hardcoded paths to other interpreters</h3>
11545: </div>
11546: </div>
11547: </div>
11548:
11549: <p>Your package may also contain scripts with hardcoded
11550: paths to other interpreters besides (or as well as)
11551: perl. To correct the full pathname to the script
11552: interpreter, you need to set the following definitions
1.14 xtraeme 11553: in your <code class="filename">Makefile</code> (we
11554: shall use <span><strong class=
11555: "command">tclsh</strong></span> in this example):</p>
1.1 grant 11556: <pre class="programlisting">
11557: REPLACE_INTERPRETER+= tcl
11558: _REPLACE.tcl.old= .*/bin/tclsh
11559: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
11560: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
11561: relative to ${WRKSRC}, just as in REPLACE_PERL
11562: </pre>
11563: </div>
11564:
11565: <div class="sect2" lang="en" xml:lang="en">
11566: <div class="titlepage">
11567: <div>
11568: <div>
1.30 wiz 11569: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 11570: "perl-modules"></a>15.5.6. Packages
1.30 wiz 11571: installing perl modules</h3>
1.1 grant 11572: </div>
11573: </div>
11574: </div>
11575:
11576: <p>Makefiles of packages providing perl5 modules should
1.14 xtraeme 11577: include the Makefile fragment <code class=
11578: "filename">../../lang/perl5/module.mk</code>. It
11579: provides a <span><strong class=
11580: "command">do-configure</strong></span> target for the
11581: standard perl configuration for such modules as well as
11582: various hooks to tune this configuration. See comments
11583: in this file for details.</p>
1.1 grant 11584:
11585: <p>Perl5 modules will install into different places
11586: depending on the version of perl used during the build
11587: process. To address this, pkgsrc will append lines to
1.14 xtraeme 11588: the <code class="filename">PLIST</code> corresponding
11589: to the files listed in the installed <code class=
11590: "filename">.packlist</code> file generated by most
11591: perl5 modules. This is invoked by defining <code class=
11592: "varname">PERL5_PACKLIST</code> to a space-separated
11593: list of paths to packlist files, e.g.:</p>
1.1 grant 11594: <pre class="programlisting">
11595: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
11596: </pre>
11597:
1.14 xtraeme 11598: <p>The variables <code class=
11599: "varname">PERL5_SITELIB</code>, <code class=
11600: "varname">PERL5_SITEARCH</code>, and <code class=
11601: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 11602: locations in which perl5 modules may be installed, and
11603: may be used by perl5 packages that don't have a
11604: packlist. These three variables are also substituted
1.14 xtraeme 11605: for in the <code class="filename">PLIST</code>.</p>
1.1 grant 11606: </div>
11607:
11608: <div class="sect2" lang="en" xml:lang="en">
11609: <div class="titlepage">
11610: <div>
11611: <div>
11612: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 11613: "faq.info-files"></a>15.5.7. Packages
1.1 grant 11614: installing info files</h3>
11615: </div>
11616: </div>
11617: </div>
11618:
11619: <p>Some packages install info files or use the
11620: “<span class="quote">makeinfo</span>” or
11621: “<span class="quote">install-info</span>”
11622: commands. Each of the info files:</p>
11623:
11624: <div class="itemizedlist">
11625: <ul type="disc">
11626: <li>
11627: <p>is considered to be installed in the directory
1.14 xtraeme 11628: <code class=
11629: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 11630: </li>
11631:
11632: <li>
11633: <p>is registered in the Info directory file
1.14 xtraeme 11634: <code class=
11635: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 11636: </li>
11637:
11638: <li>
11639: <p>and must be listed as a filename in the
1.14 xtraeme 11640: <code class="varname">INFO_FILES</code> variable
11641: in the package Makefile.</p>
1.1 grant 11642: </li>
11643: </ul>
11644: </div>
11645:
1.14 xtraeme 11646: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 11647: “<span class="quote">info</span>” and can
1.14 xtraeme 11648: be overridden in the package Makefile. <code class=
11649: "filename">INSTALL</code> and <code class=
11650: "filename">DEINSTALL</code> scripts will be generated
11651: to handle registration of the info files in the Info
1.1 grant 11652: directory file. The “<span class=
11653: "quote">install-info</span>” command used for the
11654: info files registration is either provided by the
11655: system, or by a special purpose package automatically
11656: added as dependency if needed.</p>
11657:
11658: <p>A package which needs the “<span class=
11659: "quote">makeinfo</span>” command at build time
1.14 xtraeme 11660: must define the variable <code class=
11661: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 11662: minimum version of the “<span class=
11663: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 11664: should be noted with the <code class=
11665: "varname">TEXINFO_REQD</code> variable in the package
11666: <code class="filename">Makefile</code>. By default, a
1.1 grant 11667: minimum version of 3.12 is required. If the system does
1.14 xtraeme 11668: not provide a <span><strong class=
11669: "command">makeinfo</strong></span> command or if it
11670: does not match the required minimum, a build dependency
11671: on the <a xmlns=
11672: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 11673: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20 ben 11674: class="pkgname">devel/gtexinfo</a> package will be
11675: added automatically.</p>
1.1 grant 11676:
11677: <p>The build and installation process of the software
11678: provided by the package should not use the
1.14 xtraeme 11679: <span><strong class=
11680: "command">install-info</strong></span> command as the
11681: registration of info files is the task of the package
11682: <code class="filename">INSTALL</code> script, and it
11683: must use the appropriate <span><strong class=
11684: "command">makeinfo</strong></span> command.</p>
1.1 grant 11685:
11686: <p>To achieve this goal the pkgsrc infrastructure
1.14 xtraeme 11687: creates overriding scripts for the <span><strong class=
11688: "command">install-info</strong></span> and
11689: <span><strong class="command">makeinfo</strong></span>
11690: commands in a directory listed early in <code class=
11691: "varname">PATH</code>.</p>
1.1 grant 11692:
1.14 xtraeme 11693: <p>The script overriding <span><strong class=
11694: "command">install-info</strong></span> has no effect
11695: except the logging of a message. The script overriding
11696: <span><strong class="command">makeinfo</strong></span>
11697: logs a message and according to the value of
11698: <code class="varname">USE_MAKEINFO</code> and
11699: <code class="varname">TEXINFO_REQD</code> either run
11700: the appropriate <span><strong class=
11701: "command">makeinfo</strong></span> command or exit on
11702: error.</p>
1.1 grant 11703: </div>
11704:
11705: <div class="sect2" lang="en" xml:lang="en">
11706: <div class="titlepage">
11707: <div>
11708: <div>
1.30 wiz 11709: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 11710: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 11711: installing GConf2 data files</h3>
1.1 grant 11712: </div>
11713: </div>
11714: </div>
11715:
1.14 xtraeme 11716: <p>If a package installs <code class=
11717: "filename">.schemas</code> or <code class=
11718: "filename">.entries</code> files, used by GConf2, you
1.1 grant 11719: need to take some extra steps to make sure they get
11720: registered in the database:</p>
11721:
11722: <div class="orderedlist">
11723: <ol type="1">
11724: <li>
1.14 xtraeme 11725: <p>Include <code class=
11726: "filename">../../devel/GConf2/schemas.mk</code>
11727: instead of its <code class=
11728: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11729: care of rebuilding the GConf2 database at
11730: installation and deinstallation time, and tells
11731: the package where to install GConf2 data files
11732: using some standard configure arguments. It also
11733: disallows any access to the database directly
11734: from the package.</p>
11735: </li>
11736:
11737: <li>
11738: <p>Ensure that the package installs its
1.14 xtraeme 11739: <code class="filename">.schemas</code> files
11740: under <code class=
11741: "filename">${PREFIX}/share/gconf/schemas</code>.
11742: If they get installed under <code class=
11743: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 11744: manually patch the package.</p>
11745: </li>
11746:
11747: <li>
11748: <p>Check the PLIST and remove any entries under
11749: the etc/gconf directory, as they will be handled
11750: automatically. See <a href="#faq.conf" title=
1.38 dillo 11751: "7.14. How do I change the location of configuration files?">
11752: Section 7.14, “How do I change the
1.35 jmmv 11753: location of configuration files?”</a> for
11754: more information.</p>
1.1 grant 11755: </li>
11756:
11757: <li>
1.14 xtraeme 11758: <p>Define the <code class=
11759: "varname">GCONF2_SCHEMAS</code> variable in your
11760: <code class="filename">Makefile</code> with a
11761: list of all <code class=
11762: "filename">.schemas</code> files installed by the
11763: package, if any. Names must not contain any
11764: directories in them.</p>
1.1 grant 11765: </li>
11766:
11767: <li>
1.14 xtraeme 11768: <p>Define the <code class=
11769: "varname">GCONF2_ENTRIES</code> variable in your
11770: <code class="filename">Makefile</code> with a
11771: list of all <code class=
11772: "filename">.entries</code> files installed by the
11773: package, if any. Names must not contain any
11774: directories in them.</p>
1.1 grant 11775: </li>
11776: </ol>
11777: </div>
11778: </div>
11779:
11780: <div class="sect2" lang="en" xml:lang="en">
11781: <div class="titlepage">
11782: <div>
11783: <div>
1.30 wiz 11784: <h3 class="title"><a name=
11785: "scrollkeeper-data-files" id=
1.38 dillo 11786: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 11787: installing scrollkeeper data files</h3>
1.1 grant 11788: </div>
11789: </div>
11790: </div>
11791:
1.14 xtraeme 11792: <p>If a package installs <code class=
11793: "filename">.omf</code> files, used by scrollkeeper, you
11794: need to take some extra steps to make sure they get
11795: registered in the database:</p>
1.1 grant 11796:
11797: <div class="orderedlist">
11798: <ol type="1">
11799: <li>
1.14 xtraeme 11800: <p>Include <code class=
11801: "filename">../../textproc/scrollkeeper/omf.mk</code>
11802: instead of its <code class=
11803: "filename">buildlink3.mk</code> file. This takes
1.1 grant 11804: care of rebuilding the scrollkeeper database at
11805: installation and deinstallation time, and
11806: disallows any access to it directly from the
11807: package.</p>
11808: </li>
11809:
11810: <li>
11811: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11812: the <code class=
11813: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 11814: as they will be handled automatically.</p>
11815: </li>
11816:
11817: <li>
1.14 xtraeme 11818: <p>Remove the <code class=
11819: "filename">share/omf</code> directory from the
11820: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 11821: </li>
11822: </ol>
11823: </div>
11824: </div>
11825:
11826: <div class="sect2" lang="en" xml:lang="en">
11827: <div class="titlepage">
11828: <div>
11829: <div>
1.30 wiz 11830: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 11831: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 11832: X11 fonts</h3>
11833: </div>
11834: </div>
11835: </div>
11836:
11837: <p>If a package installs font files, you will need to
11838: rebuild the fonts database in the directory where they
11839: get installed at installation and deinstallation time.
1.14 xtraeme 11840: This can be automatically done by using <code class=
11841: "filename">mk/fonts.mk</code>, which you need to
11842: include in your <code class=
11843: "filename">Makefile</code>.</p>
1.1 grant 11844:
11845: <p>When the file is included, you can list the
1.14 xtraeme 11846: directories where fonts are installed in the
11847: <code class="varname">FONTS_<em class=
11848: "replaceable"><code>type</code></em>_DIRS</code>
11849: variables, where <em class=
11850: "replaceable"><code>type</code></em> can be one of
11851: “<span class="quote">TTF</span>”,
1.1 grant 11852: “<span class="quote">TYPE1</span>” or
11853: “<span class="quote">X11</span>”. Also make
1.14 xtraeme 11854: sure that the database file <code class=
11855: "filename">fonts.dir</code> is not listed in the
1.1 grant 11856: PLIST.</p>
11857:
11858: <p>Note that you should not create new directories for
11859: fonts; instead use the standard ones to avoid that the
11860: user needs to manually configure his X server to find
11861: them.</p>
11862: </div>
11863:
11864: <div class="sect2" lang="en" xml:lang="en">
11865: <div class="titlepage">
11866: <div>
11867: <div>
1.30 wiz 11868: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 11869: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 11870: installing GTK2 modules</h3>
1.1 grant 11871: </div>
11872: </div>
11873: </div>
11874:
11875: <p>If a package installs gtk2 immodules or loaders, you
11876: need to take some extra steps to get them registered in
11877: the GTK2 database properly:</p>
11878:
11879: <div class="orderedlist">
11880: <ol type="1">
11881: <li>
1.14 xtraeme 11882: <p>Include <code class=
11883: "filename">../../x11/gtk2/modules.mk</code>
11884: instead of its <code class=
11885: "filename">buildlink3.mk</code> file. This takes
11886: care of rebuilding the database at installation
11887: and deinstallation time.</p>
1.1 grant 11888: </li>
11889:
11890: <li>
1.14 xtraeme 11891: <p>Set <code class=
11892: "varname">GTK2_IMMODULES=YES</code> if your
11893: package installs GTK2 immodules.</p>
1.1 grant 11894: </li>
11895:
11896: <li>
1.14 xtraeme 11897: <p>Set <code class=
11898: "varname">GTK2_LOADERS=YES</code> if your package
11899: installs GTK2 loaders.</p>
1.1 grant 11900: </li>
11901:
11902: <li>
11903: <p>Patch the package to not touch any of the gtk2
11904: databases directly. These are:</p>
11905:
11906: <div class="itemizedlist">
11907: <ul type="disc">
11908: <li>
1.14 xtraeme 11909: <p><code class=
11910: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 11911: </li>
11912:
11913: <li>
1.14 xtraeme 11914: <p><code class=
11915: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 11916: </li>
11917: </ul>
11918: </div>
11919: </li>
11920:
11921: <li>
11922: <p>Check the PLIST and remove any entries under
1.14 xtraeme 11923: the <code class="filename">libdata/gtk-2.0</code>
1.1 grant 11924: directory, as they will be handled
11925: automatically.</p>
11926: </li>
11927: </ol>
11928: </div>
11929: </div>
11930:
11931: <div class="sect2" lang="en" xml:lang="en">
11932: <div class="titlepage">
11933: <div>
11934: <div>
1.30 wiz 11935: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 11936: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 11937: installing SGML or XML data</h3>
1.1 grant 11938: </div>
11939: </div>
11940: </div>
11941:
11942: <p>If a package installs SGML or XML data files that
11943: need to be registered in system-wide catalogs (like
11944: DTDs, sub-catalogs, etc.), you need to take some extra
11945: steps:</p>
11946:
11947: <div class="orderedlist">
11948: <ol type="1">
11949: <li>
1.14 xtraeme 11950: <p>Include <code class=
11951: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
11952: in your <code class="filename">Makefile</code>,
11953: which takes care of registering those files in
1.1 grant 11954: system-wide catalogs at installation and
11955: deinstallation time.</p>
11956: </li>
11957:
11958: <li>
1.14 xtraeme 11959: <p>Set <code class="varname">SGML_CATALOGS</code>
11960: to the full path of any SGML catalogs installed
11961: by the package.</p>
1.1 grant 11962: </li>
11963:
11964: <li>
1.14 xtraeme 11965: <p>Set <code class="varname">XML_CATALOGS</code>
11966: to the full path of any XML catalogs installed by
1.1 grant 11967: the package.</p>
11968: </li>
11969:
11970: <li>
1.14 xtraeme 11971: <p>Set <code class="varname">SGML_ENTRIES</code>
11972: to individual entries to be added to the SGML
1.1 grant 11973: catalog. These come in groups of three strings;
11974: see xmlcatmgr(1) for more information
11975: (specifically, arguments recognized by the 'add'
11976: action). Note that you will normally not use this
11977: variable.</p>
11978: </li>
11979:
11980: <li>
1.14 xtraeme 11981: <p>Set <code class="varname">XML_ENTRIES</code>
11982: to individual entries to be added to the XML
1.1 grant 11983: catalog. These come in groups of three strings;
11984: see xmlcatmgr(1) for more information
11985: (specifically, arguments recognized by the 'add'
11986: action). Note that you will normally not use this
11987: variable.</p>
11988: </li>
11989: </ol>
11990: </div>
11991: </div>
11992:
11993: <div class="sect2" lang="en" xml:lang="en">
11994: <div class="titlepage">
11995: <div>
11996: <div>
1.30 wiz 11997: <h3 class="title"><a name="mime-database" id=
1.38 dillo 11998: "mime-database"></a>15.5.13. Packages
1.30 wiz 11999: installing extensions to the MIME database</h3>
1.1 grant 12000: </div>
12001: </div>
12002: </div>
12003:
12004: <p>If a package provides extensions to the MIME
1.14 xtraeme 12005: database by installing <code class=
12006: "filename">.xml</code> files inside <code class=
12007: "filename">${PREFIX}/share/mime/packages</code>, you
12008: need to take some extra steps to ensure that the
12009: database is kept consistent with respect to these new
12010: files:</p>
1.1 grant 12011:
12012: <div class="orderedlist">
12013: <ol type="1">
12014: <li>
1.14 xtraeme 12015: <p>Include <code class=
12016: "filename">../../databases/shared-mime-info/mimedb.mk</code>
12017: (avoid using the <code class=
12018: "filename">buildlink3.mk</code> file from this
12019: same directory, which is reserved for inclusion
12020: from other <code class=
12021: "filename">buildlink3.mk</code> files). It takes
12022: care of rebuilding the MIME database at
12023: installation and deinstallation time, and
12024: disallows any access to it directly from the
1.1 grant 12025: package.</p>
12026: </li>
12027:
12028: <li>
12029: <p>Check the PLIST and remove any entries under
1.14 xtraeme 12030: the <code class="filename">share/mime</code>
1.1 grant 12031: directory, <span class=
12032: "emphasis"><em>except</em></span> for files saved
1.14 xtraeme 12033: under <code class=
12034: "filename">share/mime/packages</code>. The former
1.1 grant 12035: are handled automatically by the
12036: update-mime-database program, but the later are
12037: package-dependent and must be removed by the
12038: package that installed them in the first
12039: place.</p>
12040: </li>
12041:
12042: <li>
1.14 xtraeme 12043: <p>Remove any <code class=
12044: "filename">share/mime/*</code> directories from
12045: the PLIST. They will be handled by the
1.1 grant 12046: shared-mime-info package.</p>
12047: </li>
12048: </ol>
12049: </div>
12050: </div>
12051:
12052: <div class="sect2" lang="en" xml:lang="en">
12053: <div class="titlepage">
12054: <div>
12055: <div>
1.30 wiz 12056: <h3 class="title"><a name="intltool" id=
1.38 dillo 12057: "intltool"></a>15.5.14. Packages using
1.1 grant 12058: intltool</h3>
12059: </div>
12060: </div>
12061: </div>
12062:
12063: <p>If a package uses intltool during its build, include
1.14 xtraeme 12064: the <code class=
12065: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 12066: file, which forces it to use the intltool package
12067: provided by pkgsrc, instead of the one bundled with the
12068: distribution file.</p>
12069:
12070: <p>This tracks intltool's build-time dependencies and
12071: uses the latest available version; this way, the
12072: package benefits of any bug fixes that may have
12073: appeared since it was released.</p>
12074: </div>
1.18 xtraeme 12075:
12076: <div class="sect2" lang="en" xml:lang="en">
12077: <div class="titlepage">
12078: <div>
12079: <div>
1.30 wiz 12080: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 12081: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 12082: installing startup scripts</h3>
1.18 xtraeme 12083: </div>
12084: </div>
12085: </div>
12086:
12087: <p>If a package contains a rc.d script, it won't be
12088: copied into the startup directory by default, but you
12089: can enable it, by adding the option <code class=
12090: "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
12091: "filename">/etc/mk.conf</code>. This option will copy
12092: the scripts into <code class=
12093: "filename">/etc/rc.d</code> when a package is
12094: installed, and it will automatically remove the scripts
12095: when the package is deinstalled.</p>
12096: </div>
1.1 grant 12097: </div>
12098:
12099: <div class="sect1" lang="en" xml:lang="en">
12100: <div class="titlepage">
12101: <div>
12102: <div>
12103: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12104: "feedback-to-author" id=
1.38 dillo 12105: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 12106: author</h2>
1.1 grant 12107: </div>
12108: </div>
12109: </div>
12110:
12111: <p>If you have found any bugs in the package you make
12112: available, if you had to do special steps to make it run
12113: under NetBSD or if you enhanced the software in various
12114: other ways, be sure to report these changes back to the
12115: original author of the program! With that kind of
12116: support, the next release of the program can incorporate
12117: these fixes, and people not using the NetBSD packages
12118: system can win from your efforts.</p>
12119:
12120: <p>Support the idea of free software!</p>
12121: </div>
12122: </div>
12123:
12124: <div class="chapter" lang="en" xml:lang="en">
12125: <div class="titlepage">
12126: <div>
12127: <div>
12128: <h2 class="title"><a name="debug" id=
1.38 dillo 12129: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 12130: </div>
12131: </div>
12132: </div>
12133:
12134: <p>To check out all the gotchas when building a package,
12135: here are the steps that I do in order to get a package
12136: working. Please note this is basically the same as what was
12137: explained in the previous sections, only with some
12138: debugging aids.</p>
12139:
12140: <div class="itemizedlist">
12141: <ul type="disc">
12142: <li>
1.14 xtraeme 12143: <p>Be sure to set <code class=
12144: "varname">PKG_DEVELOPER=1</code> in <code class=
12145: "filename">/etc/mk.conf</code></p>
1.1 grant 12146: </li>
12147:
12148: <li>
12149: <p>Install <a xmlns=
12150: "http://www.w3.org/TR/xhtml1/transitional" href=
12151: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20 ben 12152: class="pkgname">pkgtools/url2pkg</a>, create a
12153: directory for a new package, change into it, then run
12154: <span><strong class=
12155: "command">url2pkg</strong></span>:</p>
1.1 grant 12156: <pre class="screen">
1.14 xtraeme 12157: <code class="prompt">%</code> <strong class=
12158: "userinput"><code>mkdir /usr/pkgsrc/<em class=
12159: "replaceable"><code>category</code></em>/<em class=
12160: "replaceable"><code>examplepkg</code></em></code></strong>
12161: <code class="prompt">%</code> <strong class=
12162: "userinput"><code>cd /usr/pkgsrc/<em class=
12163: "replaceable"><code>category</code></em>/<em class=
12164: "replaceable"><code>examplepkg</code></em></code></strong>
12165: <code class="prompt">%</code> <strong class=
12166: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 12167: </pre>
12168: </li>
12169:
12170: <li>
1.14 xtraeme 12171: <p>Edit the <code class="filename">Makefile</code> as
1.1 grant 12172: requested.</p>
12173: </li>
12174:
12175: <li>
1.14 xtraeme 12176: <p>Fill in the <code class="filename">DESCR</code>
1.1 grant 12177: file</p>
12178: </li>
12179:
12180: <li>
1.14 xtraeme 12181: <p>Run <span><strong class="command">make
12182: configure</strong></span></p>
1.1 grant 12183: </li>
12184:
12185: <li>
12186: <p>Add any dependencies glimpsed from documentation
1.14 xtraeme 12187: and the configure step to the package's <code class=
12188: "filename">Makefile</code>.</p>
1.1 grant 12189: </li>
12190:
12191: <li>
12192: <p>Make the package compile, doing multiple rounds
12193: of</p>
12194: <pre class="screen">
1.14 xtraeme 12195: <code class="prompt">%</code> <strong class=
12196: "userinput"><code>make</code></strong>
12197: <code class="prompt">%</code> <strong class=
12198: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
12199: <code class="prompt">%</code> <strong class=
12200: "userinput"><code>mkpatches</code></strong>
12201: <code class="prompt">%</code> <strong class=
12202: "userinput"><code>patchdiff</code></strong>
12203: <code class="prompt">%</code> <strong class=
12204: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
12205: <code class="prompt">%</code> <strong class=
12206: "userinput"><code>make mps</code></strong>
12207: <code class="prompt">%</code> <strong class=
12208: "userinput"><code>make clean</code></strong>
1.1 grant 12209: </pre>
12210:
12211: <p>Doing as non-root user will ensure that no files
12212: are modified that shouldn't be, especially during the
1.14 xtraeme 12213: build phase. <span><strong class=
12214: "command">mkpatches</strong></span>,
12215: <span><strong class=
12216: "command">patchdiff</strong></span> and
12217: <span><strong class="command">pkgvi</strong></span>
12218: are from the <a xmlns=
1.1 grant 12219: "http://www.w3.org/TR/xhtml1/transitional" href=
12220: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20 ben 12221: class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1 grant 12222: </li>
12223:
12224: <li>
1.14 xtraeme 12225: <p>Look at the <code class=
12226: "filename">Makefile</code>, fix if necessary; see
12227: <a href="#components.Makefile" title=
1.38 dillo 12228: "8.1. Makefile">Section 8.1,
1.14 xtraeme 12229: “<code class=
12230: "filename">Makefile</code>”</a>.</p>
1.1 grant 12231: </li>
12232:
12233: <li>
1.14 xtraeme 12234: <p>Generate a <code class=
12235: "filename">PLIST</code>:</p>
1.1 grant 12236: <pre class="screen">
1.14 xtraeme 12237: <code class="prompt">#</code> <strong class=
12238: "userinput"><code>make install</code></strong>
12239: <code class="prompt">#</code> <strong class=
12240: "userinput"><code>make print-PLIST >PLIST</code></strong>
12241: <code class="prompt">#</code> <strong class=
12242: "userinput"><code>make deinstall</code></strong>
12243: <code class="prompt">#</code> <strong class=
12244: "userinput"><code>make install</code></strong>
12245: <code class="prompt">#</code> <strong class=
12246: "userinput"><code>make deinstall</code></strong>
1.1 grant 12247: </pre>
12248:
1.14 xtraeme 12249: <p>You usually need to be <code class=
12250: "username">root</code> to do this. Look if there are
1.1 grant 12251: any files left:</p>
12252: <pre class="screen">
1.14 xtraeme 12253: <code class="prompt">#</code> <strong class=
12254: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12255: </pre>
12256:
12257: <p>If this reveals any files that are missing in
1.14 xtraeme 12258: <code class="filename">PLIST</code>, add them.</p>
1.1 grant 12259: </li>
12260:
12261: <li>
1.14 xtraeme 12262: <p>Now that the <code class="filename">PLIST</code>
12263: is OK, install the package again and make a binary
1.1 grant 12264: package:</p>
12265: <pre class="screen">
1.14 xtraeme 12266: <code class="prompt">#</code> <strong class=
12267: "userinput"><code>make reinstall</code></strong>
12268: <code class="prompt">#</code> <strong class=
12269: "userinput"><code>make package</code></strong>
1.1 grant 12270: </pre>
12271: </li>
12272:
12273: <li>
12274: <p>Delete the installed package:</p>
12275: <pre class="screen">
1.14 xtraeme 12276: <code class="prompt">#</code> <strong class=
12277: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 12278: </pre>
12279: </li>
12280:
12281: <li>
1.14 xtraeme 12282: <p>Repeat the above <span><strong class=
12283: "command">make print-PLIST</strong></span> command,
12284: which shouldn't find anything now:</p>
1.1 grant 12285: <pre class="screen">
1.14 xtraeme 12286: <code class="prompt">#</code> <strong class=
12287: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 12288: </pre>
12289: </li>
12290:
12291: <li>
12292: <p>Reinstall the binary package:</p>
12293: <pre class="screen">
1.14 xtraeme 12294: <code class="prompt">#</code> <strong class=
12295: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 12296: </pre>
12297: </li>
12298:
12299: <li>
12300: <p>Play with it. Make sure everything works.</p>
12301: </li>
12302:
12303: <li>
1.14 xtraeme 12304: <p>Run <span><strong class=
12305: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 12306: "http://www.w3.org/TR/xhtml1/transitional" href=
12307: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12308: class="pkgname">pkgtools/pkglint</a>, and fix the
12309: problems it reports:</p>
1.1 grant 12310: <pre class="screen">
1.14 xtraeme 12311: <code class="prompt">#</code> <strong class=
12312: "userinput"><code>pkglint</code></strong>
1.1 grant 12313: </pre>
12314: </li>
12315:
12316: <li>
12317: <p>Submit (or commit, if you have cvs access); see
12318: <a href="#submit" title=
1.38 dillo 12319: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 12320: <i>Submitting and Committing</i></a>.</p>
12321: </li>
12322: </ul>
12323: </div>
12324: </div>
12325:
12326: <div class="chapter" lang="en" xml:lang="en">
12327: <div class="titlepage">
12328: <div>
12329: <div>
12330: <h2 class="title"><a name="submit" id=
1.38 dillo 12331: "submit"></a>Chapter 17. Submitting and
1.1 grant 12332: Committing</h2>
12333: </div>
12334: </div>
12335: </div>
12336:
12337: <div class="toc">
12338: <p><b>Table of Contents</b></p>
12339:
12340: <dl>
1.30 wiz 12341: <dt><span class="sect1"><a href=
1.38 dillo 12342: "#submitting-your-package">17.1. Submitting your
1.30 wiz 12343: packages</a></span></dt>
1.1 grant 12344:
1.30 wiz 12345: <dt><span class="sect1"><a href=
1.41 wiz 12346: "#general-notes-for-changes">17.2. General notes when
12347: adding, updating, or removing packages</a></span></dt>
12348:
12349: <dt><span class="sect1"><a href=
12350: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 12351: package into CVS</a></span></dt>
1.1 grant 12352:
1.30 wiz 12353: <dt><span class="sect1"><a href=
1.41 wiz 12354: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 12355: version</a></span></dt>
1.1 grant 12356:
1.41 wiz 12357: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 12358: Moving a package in pkgsrc</a></span></dt>
1.1 grant 12359: </dl>
12360: </div>
12361:
12362: <div class="sect1" lang="en" xml:lang="en">
12363: <div class="titlepage">
12364: <div>
12365: <div>
12366: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12367: "submitting-your-package" id=
1.38 dillo 12368: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 12369: your packages</h2>
1.1 grant 12370: </div>
12371: </div>
12372: </div>
12373:
12374: <p>You have to separate between binary and
12375: “<span class="quote">normal</span>” (source)
12376: packages here:</p>
12377:
12378: <div class="itemizedlist">
12379: <ul type="disc">
12380: <li>
12381: <p>precompiled binary packages</p>
12382:
12383: <p>Our policy is that we accept binaries only from
12384: pkgsrc developers to guarantee that the packages
12385: don't contain any trojan horses etc. This is not to
1.13 hubertf 12386: annoy anyone but rather to protect our users!
1.1 grant 12387: You're still free to put up your home-made binary
1.13 hubertf 12388: packages and tell the world where to get them.
12389: NetBSD developers doing bulk builds and wanting to
12390: upload them please see <a href="#bulk-upload"
1.38 dillo 12391: title="6.3.8. Uploading results of a bulk build">
12392: Section 6.3.8, “Uploading results of a
1.13 hubertf 12393: bulk build”</a>.</p>
1.1 grant 12394: </li>
12395:
12396: <li>
12397: <p>packages</p>
12398:
12399: <p>First, check that your package is complete,
12400: compiles and runs well; see <a href="#debug" title=
1.38 dillo 12401: "Chapter 16. Debugging">Chapter 16,
1.1 grant 12402: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 12403: Next, generate an uuencoded gzipped <a href=
12404: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
12405: <span class="citerefentry"><span class=
12406: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 12407: preferably with all files in a single directory.
1.14 xtraeme 12408: Finally, <span><strong class=
12409: "command">send-pr</strong></span> with category
1.1 grant 12410: “<span class="quote">pkg</span>”, a
12411: synopsis which includes the package name and
12412: version number, a short description of your package
12413: (contents of the COMMENT variable or DESCR file are
12414: OK) and attach the archive to your PR.</p>
12415:
12416: <p>If you want to submit several packages, please
12417: send a separate PR for each one, it's easier for us
12418: to track things that way.</p>
12419:
12420: <p>Alternatively, you can also import new packages
12421: into pkgsrc-wip (“<span class="quote">pkgsrc
12422: work-in-progress</span>”); see the homepage
12423: at <a href="http://pkgsrc-wip.sourceforge.net/"
12424: target=
12425: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
12426: details.</p>
12427: </li>
12428: </ul>
12429: </div>
12430: </div>
12431:
12432: <div class="sect1" lang="en" xml:lang="en">
12433: <div class="titlepage">
12434: <div>
12435: <div>
12436: <h2 class="title" style="clear: both"><a name=
1.41 wiz 12437: "general-notes-for-changes" id=
12438: "general-notes-for-changes"></a>17.2. General
12439: notes when adding, updating, or removing
12440: packages</h2>
12441: </div>
12442: </div>
12443: </div>
12444:
12445: <p>Please note all package additions, updates, moves, and
12446: removals in <code class=
12447: "filename">pkgsrc/doc/CHANGES</code>. It's very important
12448: to keep this file up to date and conforming to the
12449: existing format, because it will be used by scripts to
12450: automatically update pages on <a href=
12451: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
12452: and other sites. Additionally, check the <code class=
12453: "filename">pkgsrc/doc/TODO</code> file and remove the
12454: entry for the package you updated or removed, in case it
12455: was mentioned there.</p>
12456:
12457: <p>There is a make target that helps in creating proper
12458: <code class="filename">CHANGES</code> entries:
12459: <span><strong class="command">make
12460: changes-entry</strong></span>. It uses the optional
12461: <code class="varname">CTYPE</code> and <code class=
12462: "varname">NETBSD_LOGIN_NAME</code> variables. The general
12463: usage is to first make sure that your <code class=
12464: "filename">CHANGES</code> file is up-to-date (to avoid
12465: having to resolve conflicts later-on) and then to
12466: <span><strong class="command">cd</strong></span> to the
12467: package directory. For package updates,
12468: <span><strong class="command">make
12469: changes-entry</strong></span> is enough. For new
12470: packages, or package moves or removals, set the
12471: <code class="varname">CTYPE</code> variable on the
12472: command line to "Added", "Moved", or "Removed". You can
12473: set <code class="varname">NETBSD_LOGIN_NAME</code> in
12474: <code class="filename">/etc/mk.conf</code> if your local
12475: login name is not the same as your NetBSD login name.
12476: Don't forget to commit the changes to <code class=
12477: "filename">pkgsrc/doc/CHANGES</code>!</p>
12478: </div>
12479:
12480: <div class="sect1" lang="en" xml:lang="en">
12481: <div class="titlepage">
12482: <div>
12483: <div>
12484: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12485: "committing-importing" id=
1.41 wiz 12486: "committing-importing"></a>17.3. Committing:
1.30 wiz 12487: Importing a package into CVS</h2>
1.1 grant 12488: </div>
12489: </div>
12490: </div>
12491:
12492: <p>This section is only of interest for pkgsrc developers
12493: with write access to the pkgsrc repository. Please
12494: remember that cvs imports files relative to the current
12495: working directory, and that the pathname that you give
1.14 xtraeme 12496: the <span><strong class="command">cvs
12497: import</strong></span> command is so that it knows where
12498: to place the files in the repository. Newly created
12499: packages should be imported with a vendor tag of
12500: “<span class="quote">TNF</span>” and a
12501: release tag of “<span class=
12502: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 12503: <pre class="programlisting">
12504: % cd .../pkgsrc/category/pkgname
12505: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
12506: </pre>
12507:
12508: <p>Remember to move the directory from which you imported
12509: out of the way, or cvs will complain the next time you
12510: “<span class="quote">cvs update</span>” your
12511: source tree. Also don't forget to add the new package to
1.14 xtraeme 12512: the category's <code class=
12513: "filename">Makefile</code>.</p>
1.1 grant 12514:
12515: <p>The commit message of the initial import should
1.14 xtraeme 12516: include part of the <code class="filename">DESCR</code>
12517: file, so people reading the mailing lists know what the
12518: package is/does.</p>
1.1 grant 12519:
12520: <p>For new packages, “<span class="quote">cvs
12521: import</span>” is preferred to “<span class=
12522: "quote">cvs add</span>” because the former gets
12523: everything with a single command, and provides a
12524: consistent tag.</p>
12525: </div>
12526:
12527: <div class="sect1" lang="en" xml:lang="en">
12528: <div class="titlepage">
12529: <div>
12530: <div>
12531: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12532: "updating-package" id=
1.41 wiz 12533: "updating-package"></a>17.4. Updating a
1.30 wiz 12534: package to a newer version</h2>
1.1 grant 12535: </div>
12536: </div>
12537: </div>
12538:
12539: <p>Please always put a concise, appropriate and relevant
12540: summary of the changes between old and new versions into
12541: the commit log when updating a package. There are various
12542: reasons for this:</p>
12543:
12544: <div class="itemizedlist">
12545: <ul type="disc">
12546: <li>
12547: <p>A URL is volatile, and can change over time. It
12548: may go away completely or its information may be
12549: overwritten by newer information.</p>
12550: </li>
12551:
12552: <li>
12553: <p>Having the change information between old and
12554: new versions in our CVS repository is very useful
12555: for people who use either cvs or anoncvs.</p>
12556: </li>
12557:
12558: <li>
12559: <p>Having the change information between old and
12560: new versions in our CVS repository is very useful
12561: for people who read the pkgsrc-changes mailing
12562: list, so that they can make tactical decisions
12563: about when to upgrade the package.</p>
12564: </li>
12565: </ul>
12566: </div>
12567:
1.18 xtraeme 12568: <p>Please also recognize that, just because a new version
1.1 grant 12569: of a package has been released, it should not
12570: automatically be upgraded in the CVS repository. We
12571: prefer to be conservative in the packages that are
12572: included in pkgsrc - development or beta packages are not
12573: really the best thing for most places in which pkgsrc is
12574: used. Please use your judgement about what should go into
12575: pkgsrc, and bear in mind that stability is to be
12576: preferred above new and possibly untested features.</p>
12577: </div>
12578:
12579: <div class="sect1" lang="en" xml:lang="en">
12580: <div class="titlepage">
12581: <div>
12582: <div>
12583: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12584: "moving-package" id=
1.41 wiz 12585: "moving-package"></a>17.5. Moving a package in
1.30 wiz 12586: pkgsrc</h2>
1.1 grant 12587: </div>
12588: </div>
12589: </div>
12590:
12591: <div class="orderedlist">
12592: <ol type="1">
12593: <li>
12594: <p>Make a copy of the directory somewhere else.</p>
12595: </li>
12596:
12597: <li>
12598: <p>Remove all CVS dirs.</p>
12599:
12600: <p>Alternatively to the first two steps you can
12601: also do:</p>
12602: <pre class="screen">
1.14 xtraeme 12603: <code class="prompt">%</code> <strong class=
12604: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 12605: </pre>
12606:
12607: <p>and use that for further work.</p>
12608: </li>
12609:
12610: <li>
1.14 xtraeme 12611: <p>Fix <code class="varname">CATEGORIES</code> and
12612: any <code class="varname">DEPENDS</code> paths that
12613: just did “<span class=
1.1 grant 12614: "quote">../package</span>” instead of
12615: “<span class=
12616: "quote">../../category/package</span>”.</p>
12617: </li>
12618:
12619: <li>
1.14 xtraeme 12620: <p><span><strong class="command">cvs
12621: import</strong></span> the modified package in the
12622: new place.</p>
1.1 grant 12623: </li>
12624:
12625: <li>
12626: <p>Check if any package depends on it:</p>
12627: <pre class="screen">
1.14 xtraeme 12628: <code class="prompt">%</code> <strong class=
12629: "userinput"><code>cd /usr/pkgsrc</code></strong>
12630: <code class="prompt">%</code> <strong class=
12631: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 12632: </pre>
12633: </li>
12634:
12635: <li>
12636: <p>Fix paths in packages from step 5 to point to
12637: new location.</p>
12638: </li>
12639:
12640: <li>
1.14 xtraeme 12641: <p><span><strong class="command">cvs rm
12642: (-f)</strong></span> the package at the old
12643: location.</p>
1.1 grant 12644: </li>
12645:
12646: <li>
1.14 xtraeme 12647: <p>Remove from <code class=
12648: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 12649: </li>
12650:
12651: <li>
1.14 xtraeme 12652: <p>Add to <code class=
12653: "filename">newcategory/Makefile</code>.</p>
1.1 grant 12654: </li>
12655:
12656: <li>
12657: <p>Commit the changed and removed files:</p>
12658: <pre class="screen">
1.14 xtraeme 12659: <code class="prompt">%</code> <strong class=
12660: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 12661: </pre>
12662:
12663: <p>(and any packages from step 5, of course).</p>
12664: </li>
12665: </ol>
12666: </div>
12667: </div>
12668: </div>
12669: </div>
12670:
12671: <div class="appendix" lang="en" xml:lang="en">
12672: <div class="titlepage">
12673: <div>
12674: <div>
12675: <h2 class="title"><a name="examples" id=
12676: "examples"></a>Appendix A. A simple example
12677: package: bison</h2>
12678: </div>
12679: </div>
12680: </div>
12681:
12682: <div class="toc">
12683: <p><b>Table of Contents</b></p>
12684:
12685: <dl>
1.30 wiz 12686: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 12687: files</a></span></dt>
12688:
12689: <dd>
12690: <dl>
1.30 wiz 12691: <dt><span class="sect2"><a href=
12692: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 12693:
1.30 wiz 12694: <dt><span class="sect2"><a href=
12695: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 12696:
1.30 wiz 12697: <dt><span class="sect2"><a href=
12698: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 12699:
1.30 wiz 12700: <dt><span class="sect2"><a href=
12701: "#checking-package-with-pkglint">A.1.4. Checking a
12702: package with <span><strong class=
1.14 xtraeme 12703: "command">pkglint</strong></span></a></span></dt>
1.1 grant 12704: </dl>
12705: </dd>
12706:
1.30 wiz 12707: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
12708: Steps for building, installing, packaging</a></span></dt>
1.1 grant 12709: </dl>
12710: </div>
12711:
12712: <p>We checked to find a piece of software that wasn't in the
12713: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 12714: would want to have <span><strong class=
12715: "command">bison</strong></span> when Berkeley
12716: <span><strong class="command">yacc</strong></span> is already
12717: present in the tree is beyond us, but it's useful for the
12718: purposes of this exercise.</p>
1.1 grant 12719:
12720: <div class="sect1" lang="en" xml:lang="en">
12721: <div class="titlepage">
12722: <div>
12723: <div>
12724: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12725: "example-files" id=
12726: "example-files"></a>A.1. files</h2>
1.1 grant 12727: </div>
12728: </div>
12729: </div>
12730:
12731: <div class="sect2" lang="en" xml:lang="en">
12732: <div class="titlepage">
12733: <div>
12734: <div>
1.30 wiz 12735: <h3 class="title"><a name="example-Makefile" id=
12736: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 12737: </div>
12738: </div>
12739: </div>
12740: <pre class="programlisting">
1.17 sketch 12741: # $NetBSD$
1.1 grant 12742: #
12743:
12744: DISTNAME= bison-1.25
12745: CATEGORIES= devel
12746: MASTER_SITES= ${MASTER_SITE_GNU}
12747:
12748: MAINTAINER= thorpej@NetBSD.org
12749: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
12750: COMMENT= GNU yacc clone
12751:
12752: GNU_CONFIGURE= yes
12753: INFO_FILES= bison.info
12754:
12755: .include "../../mk/bsd.pkg.mk"
12756: </pre>
12757: </div>
12758:
12759: <div class="sect2" lang="en" xml:lang="en">
12760: <div class="titlepage">
12761: <div>
12762: <div>
1.30 wiz 12763: <h3 class="title"><a name="example-descr" id=
12764: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 12765: </div>
12766: </div>
12767: </div>
12768: <pre class="programlisting">
12769: GNU version of yacc. Can make re-entrant parsers, and numerous other
12770: improvements. Why you would want this when Berkeley <a href=
12771: "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
12772: of the NetBSD source tree is beyond me.
12773: </pre>
12774: </div>
12775:
12776: <div class="sect2" lang="en" xml:lang="en">
12777: <div class="titlepage">
12778: <div>
12779: <div>
1.30 wiz 12780: <h3 class="title"><a name="example-plist" id=
12781: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 12782: </div>
12783: </div>
12784: </div>
12785: <pre class="programlisting">
1.17 sketch 12786: @comment $NetBSD$
1.1 grant 12787: bin/bison
12788: man/man1/bison.1.gz
12789: share/bison.simple
12790: share/bison.hairy
12791: </pre>
12792: </div>
12793:
12794: <div class="sect2" lang="en" xml:lang="en">
12795: <div class="titlepage">
12796: <div>
12797: <div>
1.30 wiz 12798: <h3 class="title"><a name=
12799: "checking-package-with-pkglint" id=
12800: "checking-package-with-pkglint"></a>A.1.4. Checking
12801: a package with <span><strong class=
1.14 xtraeme 12802: "command">pkglint</strong></span></h3>
1.1 grant 12803: </div>
12804: </div>
12805: </div>
12806:
12807: <p>The NetBSD package system comes with <a xmlns=
12808: "http://www.w3.org/TR/xhtml1/transitional" href=
12809: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20 ben 12810: class="pkgname">pkgtools/pkglint</a> which helps to check
12811: the contents of these files. After installation it is
12812: quite easy to use, just change to the directory of the
12813: package you wish to examine and execute
12814: <span><strong class=
12815: "command">pkglint</strong></span>:</p>
1.1 grant 12816: <pre class="screen">
1.14 xtraeme 12817: <code class="prompt">$</code> <strong class=
12818: "userinput"><code>pkglint</code></strong>
1.1 grant 12819: looks fine.
12820: </pre>
12821:
12822: <p>Depending on the supplied command line arguments (see
12823: pkglint(1)) more verbose checks will be performed. Use
1.14 xtraeme 12824: e.g. <span><strong class="command">pkglint
12825: -v</strong></span> for a very verbose check.</p>
1.1 grant 12826: </div>
12827: </div>
12828:
12829: <div class="sect1" lang="en" xml:lang="en">
12830: <div class="titlepage">
12831: <div>
12832: <div>
12833: <h2 class="title" style="clear: both"><a name=
1.30 wiz 12834: "steps-for-b-i-p" id=
12835: "steps-for-b-i-p"></a>A.2. Steps for building,
12836: installing, packaging</h2>
1.1 grant 12837: </div>
12838: </div>
12839: </div>
12840:
12841: <p>Create the directory where the package lives, plus any
12842: auxiliary directories:</p>
12843: <pre class="screen">
1.14 xtraeme 12844: <code class="prompt">#</code> <strong class=
12845: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
12846: <code class="prompt">#</code> <strong class=
12847: "userinput"><code>mkdir bison</code></strong>
12848: <code class="prompt">#</code> <strong class=
12849: "userinput"><code>cd bison</code></strong>
12850: <code class="prompt">#</code> <strong class=
12851: "userinput"><code>mkdir patches</code></strong>
1.1 grant 12852: </pre>
12853:
1.14 xtraeme 12854: <p>Create <code class="filename">Makefile</code>,
12855: <code class="filename">DESCR</code> and <code class=
12856: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 12857: "Chapter 8. Package components - files, directories and contents">
12858: Chapter 8, <i>Package components - files, directories and
1.1 grant 12859: contents</i></a>) then continue with fetching the
12860: distfile:</p>
12861: <pre class="screen">
1.14 xtraeme 12862: <code class="prompt">#</code> <strong class=
12863: "userinput"><code>make fetch</code></strong>
1.1 grant 12864: >> bison-1.25.tar.gz doesn't seem to exist on this system.
12865: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
12866: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12867: ftp: Error retrieving file: 500 Internal error
12868:
12869: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
12870: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12871: ftp: Error retrieving file: 500 Internal error
12872:
12873: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
12874: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
12875: Successfully retrieved file.
12876: </pre>
12877:
1.14 xtraeme 12878: <p>Generate the checksum of the distfile into <code class=
12879: "filename">distinfo</code>:</p>
1.1 grant 12880: <pre class="screen">
1.14 xtraeme 12881: <code class="prompt">#</code> <strong class=
12882: "userinput"><code>make makesum</code></strong>
1.1 grant 12883: </pre>
12884:
12885: <p>Now compile:</p>
12886: <pre class="screen">
1.14 xtraeme 12887: <code class="prompt">#</code> <strong class=
12888: "userinput"><code>make</code></strong>
1.1 grant 12889: >> Checksum OK for bison-1.25.tar.gz.
12890: ===> Extracting for bison-1.25
12891: ===> Patching for bison-1.25
12892: ===> Ignoring empty patch directory
12893: ===> Configuring for bison-1.25
12894: creating cache ./config.cache
12895: checking for gcc... cc
12896: checking whether we are using GNU C... yes
12897: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
12898: checking how to run the C preprocessor... cc -E
12899: checking for minix/config.h... no
12900: checking for POSIXized ISC... no
12901: checking whether cross-compiling... no
12902: checking for ANSI C header files... yes
12903: checking for string.h... yes
12904: checking for stdlib.h... yes
12905: checking for memory.h... yes
12906: checking for working const... yes
12907: checking for working alloca.h... no
12908: checking for alloca... yes
12909: checking for strerror... yes
12910: updating cache ./config.cache
12911: creating ./config.status
12912: creating Makefile
12913: ===> Building for bison-1.25
12914: 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
12915: 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
12916: 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
12917: 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
12918: 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
12919: 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
12920: 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
12921: 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
12922: 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
12923: 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
12924: 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
12925: 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
12926: 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
12927: 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
12928: 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
12929: 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
12930: 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
12931: 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
12932: 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
12933: 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
12934: 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
12935: 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
12936: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
12937: rm -f bison.s1
12938: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
12939: </pre>
12940:
12941: <p>Everything seems OK, so install the files:</p>
12942: <pre class="screen">
1.14 xtraeme 12943: <code class="prompt">#</code> <strong class=
12944: "userinput"><code>make install</code></strong>
1.1 grant 12945: >> Checksum OK for bison-1.25.tar.gz.
12946: ===> Installing for bison-1.25
12947: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
12948: rm -f /usr/pkg/bin/bison
12949: cd /usr/pkg/share; rm -f bison.simple bison.hairy
12950: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
12951: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
12952: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
12953: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
12954: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
12955: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
12956: ===> Registering installation for bison-1.25
12957: </pre>
12958:
12959: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 12960: remove it with <span><strong class="command">pkg_delete
12961: bison</strong></span>. Should you decide that you want a
12962: binary package, do this now:</p>
1.1 grant 12963: <pre class="screen">
1.14 xtraeme 12964: <code class="prompt">#</code> <strong class=
12965: "userinput"><code>make package</code></strong>
1.1 grant 12966: >> Checksum OK for bison-1.25.tar.gz.
12967: ===> Building package for bison-1.25
12968: Creating package bison-1.25.tgz
12969: Registering depends:.
12970: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
12971: </pre>
12972:
12973: <p>Now that you don't need the source and object files any
12974: more, clean up:</p>
12975: <pre class="screen">
1.14 xtraeme 12976: <code class="prompt">#</code> <strong class=
12977: "userinput"><code>make clean</code></strong>
1.1 grant 12978: ===> Cleaning for bison-1.25
12979: </pre>
12980: </div>
12981: </div>
12982:
12983: <div class="appendix" lang="en" xml:lang="en">
12984: <div class="titlepage">
12985: <div>
12986: <div>
12987: <h2 class="title"><a name="logs" id=
12988: "logs"></a>Appendix B. Build logs</h2>
12989: </div>
12990: </div>
12991: </div>
12992:
12993: <div class="toc">
12994: <p><b>Table of Contents</b></p>
12995:
12996: <dl>
12997: <dt><span class="sect1"><a href="#logs.building">B.1.
12998: Building figlet</a></span></dt>
12999:
13000: <dt><span class="sect1"><a href="#logs.package">B.2.
13001: Packaging figlet</a></span></dt>
13002: </dl>
13003: </div>
13004:
13005: <div class="sect1" lang="en" xml:lang="en">
13006: <div class="titlepage">
13007: <div>
13008: <div>
13009: <h2 class="title" style="clear: both"><a name=
13010: "logs.building" id=
13011: "logs.building"></a>B.1. Building figlet</h2>
13012: </div>
13013: </div>
13014: </div>
13015: <pre class="screen">
1.14 xtraeme 13016: <code class="prompt">#</code> <strong class=
13017: "userinput"><code>make</code></strong>
1.1 grant 13018: ===> Checking for vulnerabilities in figlet-2.2.1nb2
13019: => figlet221.tar.gz doesn't seem to exist on this system.
13020: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
13021: => [172219 bytes]
13022: Connected to ftp.plig.net.
13023: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
13024: 331 Guest login ok, send your complete e-mail address as password.
13025: 230-You are user #5 of 500 simultaneous users allowed.
13026: 230-
13027: 230- ___ _ _ _
13028: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
13029: 230- | _| _| . |_| . | | | . |_| . | _| . |
13030: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
13031: 230- |_| |_| |___| |___|
13032: 230-
13033: 230-** Welcome to ftp.plig.org **
13034: 230-
13035: 230-Please note that all transfers from this FTP site are logged. If you
13036: 230-do not like this, please disconnect now.
13037: 230-
13038: 230-This arhive is available via
13039: 230-
13040: 230-HTTP: http://ftp.plig.org/
13041: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
13042: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
13043: 230-
13044: 230-Please email comments, bug reports and requests for packages to be
13045: 230-mirrored to ftp-admin@plig.org.
13046: 230-
13047: 230-
13048: 230 Logged in anonymously.
13049: Remote system type is UNIX.
13050: Using binary mode to transfer files.
13051: 200 Type okay.
13052: 250 "/pub" is new cwd.
13053: 250-"/pub/figlet" is new cwd.
13054: 250-
13055: 250-Welcome to the figlet archive at ftp.figlet.org
13056: 250-
13057: 250- ftp://ftp.figlet.org/pub/figlet/
13058: 250-
13059: 250-The official FIGlet web page is:
13060: 250- http://www.figlet.org/
13061: 250-
13062: 250-If you have questions, please mailto:info@figlet.org. If you want to
13063: 250-contribute a font or something else, you can email us.
13064: 250
13065: 250 "/pub/figlet/program" is new cwd.
13066: 250 "/pub/figlet/program/unix" is new cwd.
13067: local: figlet221.tar.gz remote: figlet221.tar.gz
13068: 502 Unimplemented command.
13069: 227 Entering Passive Mode (195,40,6,41,246,104)
13070: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
13071: 38% |************** | 65800 64.16 KB/s 00:01 ETA
13072: 226 Transfer completed.
13073: 172219 bytes received in 00:02 (75.99 KB/s)
13074: 221 Goodbye.
13075: => Checksum OK for figlet221.tar.gz.
13076: ===> Extracting for figlet-2.2.1nb2
13077: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
13078: ===> Patching for figlet-2.2.1nb2
13079: ===> Applying pkgsrc patches for figlet-2.2.1nb2
13080: ===> Overriding tools for figlet-2.2.1nb2
13081: ===> Creating toolchain wrappers for figlet-2.2.1nb2
13082: ===> Configuring for figlet-2.2.1nb2
13083: ===> Building for figlet-2.2.1nb2
13084: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
13085: chmod a+x figlet
13086: gcc -O2 -o chkfont chkfont.c
13087: => Unwrapping files-to-be-installed.
1.14 xtraeme 13088: <code class="prompt">#</code>
13089: <code class="prompt">#</code> <strong class=
13090: "userinput"><code>make install</code></strong>
1.1 grant 13091: ===> Checking for vulnerabilities in figlet-2.2.1nb2
13092: ===> Installing for figlet-2.2.1nb2
13093: install -d -o root -g wheel -m 755 /usr/pkg/bin
13094: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
13095: mkdir -p /usr/pkg/share/figlet
13096: cp figlet /usr/pkg/bin
13097: cp chkfont /usr/pkg/bin
13098: chmod 555 figlist showfigfonts
13099: cp figlist /usr/pkg/bin
13100: cp showfigfonts /usr/pkg/bin
13101: cp fonts/*.flf /usr/pkg/share/figlet
13102: cp fonts/*.flc /usr/pkg/share/figlet
13103: cp figlet.6 /usr/pkg/man/man6
13104: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 13105: <code class="prompt">#</code>
1.1 grant 13106: </pre>
13107: </div>
13108:
13109: <div class="sect1" lang="en" xml:lang="en">
13110: <div class="titlepage">
13111: <div>
13112: <div>
13113: <h2 class="title" style="clear: both"><a name=
13114: "logs.package" id=
13115: "logs.package"></a>B.2. Packaging figlet</h2>
13116: </div>
13117: </div>
13118: </div>
13119: <pre class="screen">
1.14 xtraeme 13120: <code class="prompt">#</code> <strong class=
13121: "userinput"><code>make package</code></strong>
1.1 grant 13122: ===> Checking for vulnerabilities in figlet-2.2.1nb2
13123: ===> Packaging figlet-2.2.1nb2
13124: ===> Building binary package for figlet-2.2.1nb2
13125: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
13126: Using SrcDir value of /usr/pkg
13127: Registering depends:.
1.14 xtraeme 13128: <code class="prompt">#</code>
1.1 grant 13129: </pre>
13130: </div>
13131: </div>
13132:
13133: <div class="appendix" lang="en" xml:lang="en">
13134: <div class="titlepage">
13135: <div>
13136: <div>
13137: <h2 class="title"><a name="ftp-layout" id=
13138: "ftp-layout"></a>Appendix C. Layout of the
13139: FTP server's package archive</h2>
13140: </div>
13141: </div>
13142: </div>
13143:
13144: <p>Layout for precompiled binary packages on
13145: ftp.NetBSD.org:</p>
13146: <pre class="programlisting">
13147: /pub/NetBSD/packages/
13148: distfiles/
13149:
13150: # Unpacked pkgsrc trees
13151: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
13152: pkgsrc-2003Q4 -> N/A
13153: pkgsrc-2004Q1/pkgsrc
13154:
13155: # pkgsrc archives
13156: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
13157: pkgsrc-2003Q4.tar.gz -> N/A
13158: pkgsrc-2004Q1.tar.gz -> N/A
13159:
13160: # Per pkgsrc-release/OS-release/arch package archives
13161: pkgsrc-2003Q4/
13162: NetBSD-1.6.2/
13163: i386/
13164: All/
13165: archivers/
13166: foo -> ../All/foo
13167: ...
13168: pkgsrc-2004Q1/
13169: NetBSD-1.6.2/
13170: i386/
13171: All/
13172: ...
13173: NetBSD-2.0/
13174: i386/
13175: All/
13176: ...
13177: SunOS-5.9/
13178: sparc/
13179: All/
13180: ...
13181: x86/
13182: All/
13183: ...
13184:
13185: # Per os-release package archive convenience links
13186: NetBSD-1.6.2 -> 1.6.2
13187: 1.6.2/
13188: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
13189: m68k/
13190: All/
13191: archivers/
13192: foo -> ../All/foo
13193: ...
13194: amiga -> m68k
13195: atari -> m68k
13196: ...
13197:
13198: 2.0 -> NetBSD-2.0 # backward compat, historic
13199: NetBSD-2.0/
13200: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
13201: SunOS-5.9/
13202: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
13203: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
13204:
13205: </pre>
13206:
13207: <p>To create:</p>
13208:
13209: <div class="orderedlist">
13210: <ol type="1">
13211: <li>
13212: <p>Run bulk build, see <a href="#bulkbuild" title=
1.38 dillo 13213: "6.3. Doing a bulk build of all packages">Section
13214: 6.3, “Doing a bulk build of all
1.1 grant 13215: packages”</a></p>
13216: </li>
13217:
13218: <li>
13219: <p>Upload /usr/pkgsrc/packages to</p>
13220: <pre class="programlisting">
13221: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13 hubertf 13222: pkgsrc-2004Q4/\ # pkgsrc-branch
1.1 grant 13223: `uname -s`-`uname -r`/ # OS & version
13224: `uname -p` # architecture
13225:
13226: </pre>
13227: </li>
13228:
13229: <li>
1.14 xtraeme 13230: <p>If necessary, create a symlink <span><strong class=
13231: "command">ln -s `uname -m` `uname -p`</strong></span>
13232: (amiga -> m68k, ...)</p>
1.1 grant 13233: </li>
13234: </ol>
13235: </div>
13236: </div>
1.2 hubertf 13237:
13238: <div class="appendix" lang="en" xml:lang="en">
13239: <div class="titlepage">
13240: <div>
13241: <div>
13242: <h2 class="title"><a name="editing" id=
13243: "editing"></a>Appendix D. Editing guidelines
13244: for the pkgsrc guide</h2>
13245: </div>
13246: </div>
13247: </div>
13248:
13249: <div class="toc">
13250: <p><b>Table of Contents</b></p>
13251:
13252: <dl>
1.30 wiz 13253: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 13254: Targets</a></span></dt>
13255:
1.30 wiz 13256: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 13257: Procedure</a></span></dt>
13258: </dl>
13259: </div>
13260:
13261: <p>This section contains information on editing the pkgsrc
13262: guide itself.</p>
13263:
13264: <div class="sect1" lang="en" xml:lang="en">
13265: <div class="titlepage">
13266: <div>
13267: <div>
13268: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13269: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 13270: </div>
13271: </div>
13272: </div>
13273:
1.14 xtraeme 13274: <p>The pkgsrc guide's source code is stored in <code class=
13275: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 13276: are created from it:</p>
13277:
13278: <div class="itemizedlist">
13279: <ul type="disc">
13280: <li>
1.14 xtraeme 13281: <p><code class=
1.23 wiz 13282: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 13283: </li>
13284:
13285: <li>
1.14 xtraeme 13286: <p><code class=
13287: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 13288: </li>
13289:
13290: <li>
1.14 xtraeme 13291: <p><code class=
13292: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 13293: the documentation on the NetBSD website will be built
13294: from pkgsrc and kept up to date on the web server
13295: itself. This means you <span class=
13296: "emphasis"><em>must</em></span> make sure that your
13297: changes haven't broken the build!</p>
13298: </li>
1.6 hubertf 13299:
13300: <li>
1.14 xtraeme 13301: <p><code class=
13302: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 13303: PDF version of the pkgsrc guide.</p>
13304: </li>
13305:
13306: <li>
1.14 xtraeme 13307: <p><code class=
13308: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 13309: PostScript version of the pkgsrc guide.</p>
13310: </li>
1.2 hubertf 13311: </ul>
13312: </div>
13313: </div>
13314:
13315: <div class="sect1" lang="en" xml:lang="en">
13316: <div class="titlepage">
13317: <div>
13318: <div>
13319: <h2 class="title" style="clear: both"><a name=
1.30 wiz 13320: "procedure" id=
13321: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 13322: </div>
13323: </div>
13324: </div>
13325:
13326: <p>The procedure to edit the pkgsrc guide is:</p>
13327:
13328: <div class="itemizedlist">
13329: <ul type="disc">
13330: <li>
1.6 hubertf 13331: <p>Make sure you have the packages needed to
13332: re-generate the pkgsrc guide (and other XML-based
13333: NetBSD documentation) installed. These are
1.11 ben 13334: “<span class="quote">netbsd-doc</span>”
1.6 hubertf 13335: for creating the ASCII- and HTML-version, and
13336: “<span class=
1.11 ben 13337: "quote">netbsd-doc-print</span>”for the
1.6 hubertf 13338: PostScript- and PDF version. You will need both
13339: packages installed, to make sure documentation is
13340: consistent across all formats. The packages can be
1.14 xtraeme 13341: found in <code class=
13342: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
13343: <code class=
13344: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 13345: </li>
13346:
13347: <li>
1.14 xtraeme 13348: <p>Edit the XML file(s) in <code class=
13349: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 13350: </li>
13351:
13352: <li>
1.14 xtraeme 13353: <p>Run <span><strong class="command">make extract
13354: && make do-lint</strong></span> in
13355: <code class="filename">pkgsrc/doc/guide</code> to
13356: check the XML syntax, and fix it if needed.</p>
1.4 hubertf 13357: </li>
13358:
13359: <li>
1.14 xtraeme 13360: <p>Run <span><strong class=
13361: "command">make</strong></span> in <code class=
13362: "filename">pkgsrc/doc/guide</code> to build the HTML
13363: and ASCII version.</p>
1.2 hubertf 13364: </li>
13365:
13366: <li>
1.14 xtraeme 13367: <p>If all is well, run <span><strong class=
13368: "command">make install-doc</strong></span> to put the
13369: generated files into <code class=
13370: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 13371: </li>
13372:
13373: <li>
1.14 xtraeme 13374: <p><span><strong class="command">cvs commit
13375: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 13376: </li>
13377:
13378: <li>
1.14 xtraeme 13379: <p><span><strong class="command">cvs commit -m
13380: re-generate
13381: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 13382: </li>
1.4 hubertf 13383:
13384: <li>
13385: <p>Until the webserver on www.NetBSD.org is really
13386: updated automatically to pick up changes to the
1.14 xtraeme 13387: pkgsrc guide automatically, also run
1.18 xtraeme 13388: <span><strong class="command">make install-htdocs
1.14 xtraeme 13389: HTDOCSDIR=../../../htdocs</strong></span> (or
13390: similar, adjust <code class=
13391: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 13392: </li>
13393:
13394: <li>
1.14 xtraeme 13395: <p><span><strong class="command">cvs commit
13396: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 13397: </li>
1.2 hubertf 13398: </ul>
13399: </div>
13400: </div>
13401: </div>
1.1 grant 13402: </div>
13403: </body>
13404: </html>
CVSweb <webmaster@jp.NetBSD.org>