Annotation of pkgsrc/doc/pkgsrc.html, revision 1.56
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.55 rillig 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">
1.55 rillig 18: <div class="book" lang="en" xml:lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.55 rillig 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>
1.48 dillo 64: <p class="copyright">Copyright © 1994-2005 The
1.1 grant 65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48 dillo 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
70: 2005/10/05 13:59:56 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>
1.51 rillig 91: <dt><span class="chapter"><a href="#introduction">1. What
92: is pkgsrc?</a></span></dt>
1.1 grant 93:
94: <dd>
95: <dl>
1.30 wiz 96: <dt><span class="sect1"><a href=
97: "#introduction-section">1.1.
1.1 grant 98: Introduction</a></span></dt>
99:
100: <dt><span class="sect1"><a href="#overview">1.2.
101: Overview</a></span></dt>
102:
103: <dt><span class="sect1"><a href="#terminology">1.3.
104: Terminology</a></span></dt>
105:
106: <dt><span class="sect1"><a href="#typography">1.4.
107: Typography</a></span></dt>
108: </dl>
109: </dd>
110:
1.46 gdt 111: <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1 grant 112: user's guide</a></span></dt>
113:
114: <dd>
115: <dl>
116: <dt><span class="chapter"><a href="#getting">2. Where
117: to get pkgsrc</a></span></dt>
118:
119: <dd>
120: <dl>
1.30 wiz 121: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1 grant 122: As tar file</a></span></dt>
123:
1.30 wiz 124: <dt><span class="sect1"><a href="#via-sup">2.2. Via
125: SUP</a></span></dt>
1.1 grant 126:
1.30 wiz 127: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
128: CVS</a></span></dt>
1.1 grant 129: </dl>
130: </dd>
131:
132: <dt><span class="chapter"><a href="#platforms">3. Using
133: pkgsrc on systems other than NetBSD</a></span></dt>
134:
135: <dd>
136: <dl>
1.30 wiz 137: <dt><span class="sect1"><a href=
138: "#bootstrapping-pkgsrc">3.1. Bootstrapping
139: pkgsrc</a></span></dt>
1.1 grant 140:
1.30 wiz 141: <dt><span class="sect1"><a href=
1.47 reed 142: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 143: notes</a></span></dt>
1.1 grant 144:
145: <dd>
146: <dl>
147: <dt><span class="sect2"><a href=
1.30 wiz 148: "#darwin">3.2.1. Darwin (Mac OS
1.1 grant 149: X)</a></span></dt>
150:
151: <dt><span class="sect2"><a href=
1.30 wiz 152: "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1 grant 153:
154: <dt><span class="sect2"><a href=
1.30 wiz 155: "#interix">3.2.3. Interix</a></span></dt>
1.1 grant 156:
1.30 wiz 157: <dt><span class="sect2"><a href="#irix">3.2.4.
158: IRIX</a></span></dt>
1.1 grant 159:
1.30 wiz 160: <dt><span class="sect2"><a href="#linux">3.2.5.
161: Linux</a></span></dt>
1.1 grant 162:
163: <dt><span class="sect2"><a href=
1.30 wiz 164: "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22 tv 165:
166: <dt><span class="sect2"><a href=
1.30 wiz 167: "#solaris">3.2.7. Solaris</a></span></dt>
1.1 grant 168: </dl>
169: </dd>
170: </dl>
171: </dd>
172:
173: <dt><span class="chapter"><a href="#using">4. Using
174: pkgsrc</a></span></dt>
175:
176: <dd>
177: <dl>
178: <dt><span class="sect1"><a href=
179: "#getting-started">4.1. Working with binary
180: packages</a></span></dt>
181:
182: <dd>
183: <dl>
184: <dt><span class="sect2"><a href=
1.30 wiz 185: "#where-to-get-binary-packages">4.1.1. Where to
186: get binary packages</a></span></dt>
1.1 grant 187:
188: <dt><span class="sect2"><a href=
1.30 wiz 189: "#how-to-use-binary-packages">4.1.2. How to use
190: binary packages</a></span></dt>
1.1 grant 191:
192: <dt><span class="sect2"><a href=
1.30 wiz 193: "#a-word-of-warning">4.1.3. A word of
1.1 grant 194: warning</a></span></dt>
195: </dl>
196: </dd>
197:
1.30 wiz 198: <dt><span class="sect1"><a href=
199: "#building-packages-from-source">4.2. Building
200: packages from source</a></span></dt>
1.1 grant 201:
202: <dd>
203: <dl>
204: <dt><span class="sect2"><a href=
1.30 wiz 205: "#requirements">4.2.1.
1.1 grant 206: Requirements</a></span></dt>
207:
208: <dt><span class="sect2"><a href=
1.30 wiz 209: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 210: distfiles</a></span></dt>
211:
212: <dt><span class="sect2"><a href=
1.30 wiz 213: "#how-to-build-and-install">4.2.3. How to build
214: and install</a></span></dt>
1.1 grant 215:
216: <dt><span class="sect2"><a href=
1.30 wiz 217: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 218: compiler</a></span></dt>
219: </dl>
220: </dd>
221: </dl>
222: </dd>
223:
1.38 dillo 224: <dt><span class="chapter"><a href="#configuring">5.
225: Configuring pkgsrc</a></span></dt>
226:
227: <dd>
228: <dl>
229: <dt><span class="sect1"><a href=
1.45 wiz 230: "#general-configuration">5.1. General
231: configuration</a></span></dt>
232:
233: <dt><span class="sect1"><a href=
234: "#variables-affecting-build">5.2. Variables
235: affecting the build process</a></span></dt>
236:
237: <dt><span class="sect1"><a href=
238: "#developer-advanced-settings">5.3.
239: Developer/advanced settings</a></span></dt>
240:
241: <dt><span class="sect1"><a href=
242: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 243: Options</a></span></dt>
1.38 dillo 244: </dl>
245: </dd>
246:
247: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 248: binary packages</a></span></dt>
249:
250: <dd>
251: <dl>
1.30 wiz 252: <dt><span class="sect1"><a href=
1.38 dillo 253: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 254: single binary package</a></span></dt>
1.1 grant 255:
1.30 wiz 256: <dt><span class="sect1"><a href=
1.38 dillo 257: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 258: Settings for creation of binary
259: packages</a></span></dt>
260:
1.38 dillo 261: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 262: Doing a bulk build of all packages</a></span></dt>
263:
264: <dd>
265: <dl>
266: <dt><span class="sect2"><a href=
1.38 dillo 267: "#binary.configuration">6.3.1.
1.1 grant 268: Configuration</a></span></dt>
269:
270: <dt><span class="sect2"><a href=
1.38 dillo 271: "#other-environmental-considerations">6.3.2.
1.30 wiz 272: Other environmental
1.1 grant 273: considerations</a></span></dt>
274:
275: <dt><span class="sect2"><a href=
1.38 dillo 276: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 277:
278: <dt><span class="sect2"><a href=
1.38 dillo 279: "#what-it-does">6.3.4. What it
1.1 grant 280: does</a></span></dt>
281:
282: <dt><span class="sect2"><a href=
1.38 dillo 283: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 284: requirements</a></span></dt>
285:
286: <dt><span class="sect2"><a href=
1.38 dillo 287: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 288: sandbox for chrooted builds</a></span></dt>
1.1 grant 289:
290: <dt><span class="sect2"><a href=
1.38 dillo 291: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 292: partial set of packages</a></span></dt>
1.13 hubertf 293:
294: <dt><span class="sect2"><a href=
1.38 dillo 295: "#bulk-upload">6.3.8. Uploading results of a
1.13 hubertf 296: bulk build</a></span></dt>
1.1 grant 297: </dl>
298: </dd>
299:
1.30 wiz 300: <dt><span class="sect1"><a href=
1.38 dillo 301: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 302: packages collection</a></span></dt>
1.1 grant 303:
304: <dd>
305: <dl>
306: <dt><span class="sect2"><a href=
1.38 dillo 307: "#cdpack-example">6.4.1. Example of
1.1 grant 308: cdpack</a></span></dt>
309: </dl>
310: </dd>
311: </dl>
312: </dd>
313:
1.38 dillo 314: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 315: Asked Questions</a></span></dt>
316:
317: <dd>
318: <dl>
1.30 wiz 319: <dt><span class="sect1"><a href=
1.38 dillo 320: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 321: lists for pkg-related discussion?</a></span></dt>
1.1 grant 322:
1.30 wiz 323: <dt><span class="sect1"><a href=
1.38 dillo 324: "#pkgviews-docs">7.2. Where's the pkgviews
1.30 wiz 325: documentation?</a></span></dt>
1.1 grant 326:
1.5 hubertf 327: <dt><span class="sect1"><a href=
1.38 dillo 328: "#faq-pkgtools">7.3. Utilities for package
1.5 hubertf 329: management (pkgtools)</a></span></dt>
1.1 grant 330:
1.30 wiz 331: <dt><span class="sect1"><a href=
1.38 dillo 332: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 333: non-root</a></span></dt>
334:
335: <dt><span class="sect1"><a href=
1.38 dillo 336: "#resume-transfers">7.5. How to resume transfers
1.30 wiz 337: when fetching distfiles?</a></span></dt>
338:
339: <dt><span class="sect1"><a href=
1.38 dillo 340: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 341: XFree86 from pkgsrc?</a></span></dt>
342:
343: <dt><span class="sect1"><a href=
1.38 dillo 344: "#x.org-from-pkgsrc">7.7. How can I install/use
1.30 wiz 345: X.org from pkgsrc?</a></span></dt>
1.1 grant 346:
1.30 wiz 347: <dt><span class="sect1"><a href=
1.38 dillo 348: "#fetch-behind-firewall">7.8. How to fetch files
1.30 wiz 349: from behind a firewall</a></span></dt>
1.1 grant 350:
1.38 dillo 351: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14 xtraeme 352: How do I tell <span><strong class="command">make
353: fetch</strong></span> to do passive
1.1 grant 354: FTP?</a></span></dt>
355:
1.30 wiz 356: <dt><span class="sect1"><a href=
1.38 dillo 357: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 358: distfiles at once</a></span></dt>
1.1 grant 359:
1.30 wiz 360: <dt><span class="sect1"><a href=
1.38 dillo 361: "#tmac.andoc-missing">7.11. What does
1.30 wiz 362: “<span class="quote">Don't know how to make
363: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 364: mean?</a></span></dt>
1.13 hubertf 365:
1.30 wiz 366: <dt><span class="sect1"><a href=
1.38 dillo 367: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 368: “<span class="quote">Could not find
1.14 xtraeme 369: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 370:
1.30 wiz 371: <dt><span class="sect1"><a href=
1.38 dillo 372: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 373: pkgsrc</a></span></dt>
1.1 grant 374:
1.38 dillo 375: <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35 jmmv 376: How do I change the location of configuration
377: files?</a></span></dt>
1.1 grant 378:
379: <dt><span class="sect1"><a href=
1.38 dillo 380: "#audit-packages">7.15. Automated security
1.1 grant 381: checks</a></span></dt>
382: </dl>
383: </dd>
384: </dl>
385: </dd>
386:
1.46 gdt 387: <dt><span class="part"><a href="#developers-guide">II. The
1.1 grant 388: pkgsrc developer's guide</a></span></dt>
389:
390: <dd>
391: <dl>
1.38 dillo 392: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 393: Package components - files, directories and
394: contents</a></span></dt>
395:
396: <dd>
397: <dl>
398: <dt><span class="sect1"><a href=
1.45 wiz 399: "#components.Makefile">8.1. <code xmlns=
400: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 401: "filename">Makefile</code></a></span></dt>
402:
403: <dt><span class="sect1"><a href=
1.45 wiz 404: "#components.distinfo">8.2. <code xmlns=
405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 406: "filename">distinfo</code></a></span></dt>
407:
408: <dt><span class="sect1"><a href=
1.38 dillo 409: "#components.patches">8.3.
1.27 rillig 410: patches/*</a></span></dt>
411:
1.30 wiz 412: <dt><span class="sect1"><a href=
1.38 dillo 413: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 414: files</a></span></dt>
1.27 rillig 415:
416: <dt><span class="sect1"><a href=
1.38 dillo 417: "#components.optional">8.5. Optional
1.27 rillig 418: files</a></span></dt>
419:
1.38 dillo 420: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 421: <code xmlns=
422: "http://www.w3.org/TR/xhtml1/transitional" class=
423: "filename">work*</code></a></span></dt>
1.27 rillig 424:
1.38 dillo 425: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 426: <code xmlns=
427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 428: "filename">files/*</code></a></span></dt>
429: </dl>
430: </dd>
431:
1.38 dillo 432: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 433: Programming in <code xmlns=
434: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 435: "filename">Makefile</code>s</a></span></dt>
436:
437: <dd>
438: <dl>
439: <dt><span class="sect1"><a href=
1.45 wiz 440: "#makefile.variables">9.1. <code xmlns=
441: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 442: "filename">Makefile</code>
443: variables</a></span></dt>
444:
1.27 rillig 445: <dd>
446: <dl>
447: <dt><span class="sect2"><a href=
1.38 dillo 448: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 449: conventions</a></span></dt>
450: </dl>
451: </dd>
452:
1.25 rillig 453: <dt><span class="sect1"><a href=
1.38 dillo 454: "#makefile.code">9.2. Code snippets</a></span></dt>
1.25 rillig 455:
456: <dd>
457: <dl>
458: <dt><span class="sect2"><a href=
1.38 dillo 459: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 460: list</a></span></dt>
461:
462: <dt><span class="sect2"><a href=
1.38 dillo 463: "#converting-internal-to-external">9.2.2.
1.30 wiz 464: Converting an internal list into an external
465: list</a></span></dt>
1.25 rillig 466:
467: <dt><span class="sect2"><a href=
1.38 dillo 468: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 469: variables to a shell command</a></span></dt>
1.27 rillig 470:
471: <dt><span class="sect2"><a href=
1.38 dillo 472: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 473: guideline</a></span></dt>
474:
475: <dt><span class="sect2"><a href=
1.38 dillo 476: "#bsd-make-bug-workaround">9.2.5. Workaround
1.30 wiz 477: for a bug in BSD Make</a></span></dt>
1.25 rillig 478: </dl>
479: </dd>
480: </dl>
481: </dd>
482:
1.38 dillo 483: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 484: issues</a></span></dt>
485:
486: <dd>
487: <dl>
1.38 dillo 488: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30 wiz 489: ID</a></span></dt>
1.1 grant 490:
1.30 wiz 491: <dt><span class="sect1"><a href=
1.38 dillo 492: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 493: <code xmlns=
494: "http://www.w3.org/TR/xhtml1/transitional" class=
495: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 496:
1.38 dillo 497: <dt><span class="sect1"><a href=
498: "#print-PLIST">10.3. Tweaking output of
499: <span><strong class="command">make
1.14 xtraeme 500: print-PLIST</strong></span></a></span></dt>
1.1 grant 501:
1.38 dillo 502: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 503: Variable substitution in PLIST</a></span></dt>
504:
1.30 wiz 505: <dt><span class="sect1"><a href=
1.48 dillo 506: "#manpage-compression">10.5. Man page
507: compression</a></span></dt>
1.1 grant 508:
1.30 wiz 509: <dt><span class="sect1"><a href=
1.38 dillo 510: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 511: <code class=
1.14 xtraeme 512: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 513:
1.30 wiz 514: <dt><span class="sect1"><a href=
1.47 reed 515: "#platform-specific-plist">10.7. Platform-specific
1.30 wiz 516: and differing PLISTs</a></span></dt>
1.1 grant 517:
518: <dt><span class="sect1"><a href=
1.38 dillo 519: "#faq.common-dirs">10.8. Sharing directories
520: between packages</a></span></dt>
1.1 grant 521: </dl>
522: </dd>
523:
1.38 dillo 524: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 525: Buildlink methodology</a></span></dt>
526:
527: <dd>
528: <dl>
1.30 wiz 529: <dt><span class="sect1"><a href=
1.38 dillo 530: "#converting-to-buildlink3">11.1. Converting
1.30 wiz 531: packages to use buildlink3</a></span></dt>
1.1 grant 532:
1.30 wiz 533: <dt><span class="sect1"><a href=
1.38 dillo 534: "#creating-buildlink3.mk">11.2. Writing
1.45 wiz 535: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
536: class="filename">buildlink3.mk</code>
1.14 xtraeme 537: files</a></span></dt>
1.1 grant 538:
539: <dd>
540: <dl>
541: <dt><span class="sect2"><a href=
1.38 dillo 542: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 543: buildlink3.mk file</a></span></dt>
1.1 grant 544:
545: <dt><span class="sect2"><a href=
1.38 dillo 546: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 547: <code class=
1.14 xtraeme 548: "varname">BUILDLINK_DEPENDS.<em class=
549: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 550: <code xmlns=
551: "http://www.w3.org/TR/xhtml1/transitional"
552: class="filename">buildlink3.mk</code>
1.1 grant 553: files</a></span></dt>
554: </dl>
555: </dd>
556:
1.30 wiz 557: <dt><span class="sect1"><a href=
1.45 wiz 558: "#writing-builtin.mk">11.3. Writing <code xmlns=
559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 560: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 561:
562: <dd>
563: <dl>
564: <dt><span class="sect2"><a href=
1.38 dillo 565: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 566: <code xmlns=
567: "http://www.w3.org/TR/xhtml1/transitional"
568: class="filename">builtin.mk</code>
1.1 grant 569: file</a></span></dt>
570:
571: <dt><span class="sect2"><a href=
1.38 dillo 572: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 573: preferences for native or pkgsrc
574: software</a></span></dt>
1.1 grant 575: </dl>
576: </dd>
577: </dl>
578: </dd>
579:
1.38 dillo 580: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 581: pkginstall framework</a></span></dt>
582:
583: <dd>
584: <dl>
585: <dt><span class="sect1"><a href=
1.38 dillo 586: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 587: directories outside the installation
588: prefix</a></span></dt>
589:
590: <dd>
591: <dl>
592: <dt><span class="sect2"><a href=
1.38 dillo 593: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 594: manipulation</a></span></dt>
595:
596: <dt><span class="sect2"><a href=
1.38 dillo 597: "#files-outside-prefix">12.1.2. File
1.35 jmmv 598: manipulation</a></span></dt>
599: </dl>
600: </dd>
601:
1.38 dillo 602: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 603: Configuration files</a></span></dt>
604:
605: <dd>
606: <dl>
607: <dt><span class="sect2"><a href=
1.38 dillo 608: "#conf-files-sysconfdir">12.2.1. How
1.35 jmmv 609: <code class="varname">PKG_SYSCONFDIR</code> is
610: set</a></span></dt>
611:
612: <dt><span class="sect2"><a href=
1.38 dillo 613: "#conf-files-configure">12.2.2. Telling the
1.47 reed 614: software where configuration files
1.35 jmmv 615: are</a></span></dt>
616:
617: <dt><span class="sect2"><a href=
1.38 dillo 618: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 619: installations</a></span></dt>
620:
621: <dt><span class="sect2"><a href=
1.38 dillo 622: "#conf-files-disable">12.2.4. Disabling
1.35 jmmv 623: handling of configuration files</a></span></dt>
624: </dl>
625: </dd>
626:
627: <dt><span class="sect1"><a href=
1.38 dillo 628: "#rcd-scripts">12.3. System startup
1.35 jmmv 629: scripts</a></span></dt>
630:
631: <dd>
632: <dl>
633: <dt><span class="sect2"><a href=
1.38 dillo 634: "#rcd-scripts-disable">12.3.1. Disabling
1.35 jmmv 635: handling of system startup
636: scripts</a></span></dt>
637: </dl>
638: </dd>
639:
640: <dt><span class="sect1"><a href=
1.38 dillo 641: "#users-and-groups">12.4. System users and
1.35 jmmv 642: groups</a></span></dt>
643:
1.38 dillo 644: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 645: System shells</a></span></dt>
646:
647: <dd>
648: <dl>
649: <dt><span class="sect2"><a href=
1.38 dillo 650: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 651: configuration files</a></span></dt>
652: </dl>
653: </dd>
654: </dl>
655: </dd>
656:
1.38 dillo 657: <dt><span class="chapter"><a href="#options">13.
1.1 grant 658: Options handling</a></span></dt>
659:
660: <dd>
661: <dl>
1.30 wiz 662: <dt><span class="sect1"><a href=
1.38 dillo 663: "#global-default-options">13.1. Global default
1.30 wiz 664: options</a></span></dt>
1.1 grant 665:
1.30 wiz 666: <dt><span class="sect1"><a href=
1.38 dillo 667: "#converting-to-options">13.2. Converting packages
1.45 wiz 668: to use <code xmlns=
669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 670: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 671:
672: <dt><span class="sect1"><a href=
673: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 674: </dl>
675: </dd>
676:
1.38 dillo 677: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 678: build process</a></span></dt>
679:
680: <dd>
681: <dl>
682: <dt><span class="sect1"><a href=
1.56 ! rillig 683: "#build.intro">14.1. Introduction</a></span></dt>
! 684:
! 685: <dt><span class="sect1"><a href=
! 686: "#build.prefix">14.2. Program
1.1 grant 687: location</a></span></dt>
688:
1.30 wiz 689: <dt><span class="sect1"><a href=
1.56 ! rillig 690: "#build.builddirs">14.3. Directories used during
! 691: the build process</a></span></dt>
! 692:
! 693: <dt><span class="sect1"><a href=
! 694: "#build.running">14.4. Running a
! 695: phase</a></span></dt>
! 696:
! 697: <dt><span class="sect1"><a href=
! 698: "#build.fetch">14.5. The <span class=
! 699: "emphasis"><em>fetch</em></span>
! 700: phase</a></span></dt>
! 701:
! 702: <dt><span class="sect1"><a href=
! 703: "#build.checksum">14.6. The <span class=
! 704: "emphasis"><em>checksum</em></span>
! 705: phase</a></span></dt>
! 706:
! 707: <dt><span class="sect1"><a href=
! 708: "#build.extract">14.7. The <span class=
! 709: "emphasis"><em>extract</em></span>
! 710: phase</a></span></dt>
! 711:
! 712: <dt><span class="sect1"><a href=
! 713: "#build.patch">14.8. The <span class=
! 714: "emphasis"><em>patch</em></span>
! 715: phase</a></span></dt>
! 716:
! 717: <dt><span class="sect1"><a href=
! 718: "#build.tools">14.9. The <span class=
! 719: "emphasis"><em>tools</em></span>
! 720: phase</a></span></dt>
! 721:
! 722: <dt><span class="sect1"><a href=
! 723: "#build.wrapper">14.10. The <span class=
! 724: "emphasis"><em>wrapper</em></span>
! 725: phase</a></span></dt>
! 726:
! 727: <dt><span class="sect1"><a href=
! 728: "#build.configure">14.11. The <span class=
! 729: "emphasis"><em>configure</em></span>
! 730: phase</a></span></dt>
! 731:
! 732: <dt><span class="sect1"><a href=
! 733: "#build.build">14.12. The <span class=
! 734: "emphasis"><em>build</em></span>
! 735: phase</a></span></dt>
! 736:
! 737: <dt><span class="sect1"><a href=
! 738: "#build.test">14.13. The <span class=
! 739: "emphasis"><em>test</em></span>
! 740: phase</a></span></dt>
! 741:
! 742: <dt><span class="sect1"><a href=
! 743: "#build.install">14.14. The <span class=
! 744: "emphasis"><em>install</em></span>
! 745: phase</a></span></dt>
1.1 grant 746:
747: <dt><span class="sect1"><a href=
1.56 ! rillig 748: "#build.package">14.15. The <span class=
! 749: "emphasis"><em>package</em></span>
! 750: phase</a></span></dt>
! 751:
! 752: <dt><span class="sect1"><a href=
! 753: "#build.helpful-targets">14.16. Other helpful
1.1 grant 754: targets</a></span></dt>
755: </dl>
756: </dd>
757:
1.55 rillig 758: <dt><span class="chapter"><a href="#fixes">15. Making
759: your package work</a></span></dt>
1.1 grant 760:
761: <dd>
762: <dl>
1.30 wiz 763: <dt><span class="sect1"><a href=
1.38 dillo 764: "#general-operation">15.1. General
1.30 wiz 765: operation</a></span></dt>
1.1 grant 766:
767: <dd>
768: <dl>
769: <dt><span class="sect2"><a href=
1.38 dillo 770: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 771: pull in variables from
772: /etc/mk.conf</a></span></dt>
1.1 grant 773:
774: <dt><span class="sect2"><a href=
1.38 dillo 775: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 776: to install documentation</a></span></dt>
777:
778: <dt><span class="sect2"><a href=
1.38 dillo 779: "#restricted-packages">15.1.3. Restricted
1.1 grant 780: packages</a></span></dt>
781:
782: <dt><span class="sect2"><a href=
1.38 dillo 783: "#dependencies">15.1.4. Handling
1.1 grant 784: dependencies</a></span></dt>
785:
786: <dt><span class="sect2"><a href=
1.38 dillo 787: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 788: other packages</a></span></dt>
789:
790: <dt><span class="sect2"><a href=
1.38 dillo 791: "#not-building-packages">15.1.6. Packages that
1.30 wiz 792: cannot or should not be built</a></span></dt>
1.1 grant 793:
794: <dt><span class="sect2"><a href=
1.38 dillo 795: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 796: should not be deleted, once
797: installed</a></span></dt>
1.1 grant 798:
799: <dt><span class="sect2"><a href=
1.38 dillo 800: "#security-handling">15.1.8. Handling packages
1.1 grant 801: with security problems</a></span></dt>
802:
803: <dt><span class="sect2"><a href=
1.38 dillo 804: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 805: bugs</a></span></dt>
806:
807: <dt><span class="sect2"><a href=
1.38 dillo 808: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 809: incrementing versions when fixing an existing
1.1 grant 810: package</a></span></dt>
811:
812: <dt><span class="sect2"><a href=
1.38 dillo 813: "#portability-of-packages">15.1.11. Portability
1.30 wiz 814: of packages</a></span></dt>
1.1 grant 815: </dl>
816: </dd>
817:
1.30 wiz 818: <dt><span class="sect1"><a href=
1.38 dillo 819: "#downloading-issues">15.2. Possible downloading
1.30 wiz 820: issues</a></span></dt>
1.1 grant 821:
822: <dd>
823: <dl>
824: <dt><span class="sect2"><a href=
1.38 dillo 825: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 826: distfiles aren't available for plain
1.1 grant 827: downloading</a></span></dt>
828:
829: <dt><span class="sect2"><a href=
1.38 dillo 830: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 831: handle modified distfiles with the 'old'
832: name</a></span></dt>
1.1 grant 833: </dl>
834: </dd>
835:
1.30 wiz 836: <dt><span class="sect1"><a href=
1.38 dillo 837: "#configuration-gotchas">15.3. Configuration
1.30 wiz 838: gotchas</a></span></dt>
1.1 grant 839:
840: <dd>
841: <dl>
842: <dt><span class="sect2"><a href=
1.38 dillo 843: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 844: libtool</a></span></dt>
845:
846: <dt><span class="sect2"><a href=
1.38 dillo 847: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 848: packages that already support
849: libtool</a></span></dt>
850:
851: <dt><span class="sect2"><a href=
1.38 dillo 852: "#autoconf-automake">15.3.3. GNU
1.1 grant 853: Autoconf/Automake</a></span></dt>
854: </dl>
855: </dd>
856:
1.30 wiz 857: <dt><span class="sect1"><a href=
1.55 rillig 858: "#fixes-build">15.4. Building the
859: package</a></span></dt>
1.1 grant 860:
861: <dd>
862: <dl>
863: <dt><span class="sect2"><a href=
1.38 dillo 864: "#cpp-defines">15.4.1. CPP
1.1 grant 865: defines</a></span></dt>
1.51 rillig 866:
867: <dt><span class="sect2"><a href=
868: "#cpp-list">15.4.2. Getting a list of CPP
869: defines</a></span></dt>
1.1 grant 870: </dl>
871: </dd>
872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.38 dillo 874: "#package-specific-actions">15.5. Package specific
1.30 wiz 875: actions</a></span></dt>
1.1 grant 876:
877: <dd>
878: <dl>
879: <dt><span class="sect2"><a href=
1.38 dillo 880: "#user-interaction">15.5.1. User
1.2 hubertf 881: interaction</a></span></dt>
1.1 grant 882:
883: <dt><span class="sect2"><a href=
1.38 dillo 884: "#handling-licenses">15.5.2. Handling
1.1 grant 885: licenses</a></span></dt>
886:
887: <dt><span class="sect2"><a href=
1.38 dillo 888: "#installing-score-files">15.5.3. Installing
1.30 wiz 889: score files</a></span></dt>
1.1 grant 890:
891: <dt><span class="sect2"><a href=
1.38 dillo 892: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 893: perl scripts</a></span></dt>
1.1 grant 894:
895: <dt><span class="sect2"><a href=
1.38 dillo 896: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 897: hardcoded paths to other
898: interpreters</a></span></dt>
1.1 grant 899:
900: <dt><span class="sect2"><a href=
1.38 dillo 901: "#perl-modules">15.5.6. Packages installing
1.30 wiz 902: perl modules</a></span></dt>
1.1 grant 903:
904: <dt><span class="sect2"><a href=
1.38 dillo 905: "#faq.info-files">15.5.7. Packages installing
1.1 grant 906: info files</a></span></dt>
907:
908: <dt><span class="sect2"><a href=
1.38 dillo 909: "#gconf2-data-files">15.5.8. Packages
1.30 wiz 910: installing GConf2 data files</a></span></dt>
1.1 grant 911:
912: <dt><span class="sect2"><a href=
1.38 dillo 913: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 914: installing scrollkeeper data
915: files</a></span></dt>
1.1 grant 916:
917: <dt><span class="sect2"><a href=
1.38 dillo 918: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 919: fonts</a></span></dt>
920:
921: <dt><span class="sect2"><a href=
1.38 dillo 922: "#gtk2-modules">15.5.11. Packages installing
1.30 wiz 923: GTK2 modules</a></span></dt>
1.1 grant 924:
925: <dt><span class="sect2"><a href=
1.38 dillo 926: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 927: SGML or XML data</a></span></dt>
1.1 grant 928:
929: <dt><span class="sect2"><a href=
1.38 dillo 930: "#mime-database">15.5.13. Packages installing
1.1 grant 931: extensions to the MIME database</a></span></dt>
932:
933: <dt><span class="sect2"><a href=
1.38 dillo 934: "#intltool">15.5.14. Packages using
1.1 grant 935: intltool</a></span></dt>
1.18 xtraeme 936:
937: <dt><span class="sect2"><a href=
1.38 dillo 938: "#startup-scripts">15.5.15. Packages installing
1.18 xtraeme 939: startup scripts</a></span></dt>
1.1 grant 940: </dl>
941: </dd>
942:
1.30 wiz 943: <dt><span class="sect1"><a href=
1.38 dillo 944: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 945: author</a></span></dt>
1.1 grant 946: </dl>
947: </dd>
948:
1.38 dillo 949: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 950: Debugging</a></span></dt>
951:
1.38 dillo 952: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 953: Submitting and Committing</a></span></dt>
954:
955: <dd>
956: <dl>
1.30 wiz 957: <dt><span class="sect1"><a href=
1.38 dillo 958: "#submitting-your-package">17.1. Submitting your
1.30 wiz 959: packages</a></span></dt>
1.1 grant 960:
1.30 wiz 961: <dt><span class="sect1"><a href=
1.41 wiz 962: "#general-notes-for-changes">17.2. General notes
963: when adding, updating, or removing
964: packages</a></span></dt>
965:
966: <dt><span class="sect1"><a href=
967: "#committing-importing">17.3. Committing: Importing
1.30 wiz 968: a package into CVS</a></span></dt>
1.1 grant 969:
1.30 wiz 970: <dt><span class="sect1"><a href=
1.41 wiz 971: "#updating-package">17.4. Updating a package to a
1.30 wiz 972: newer version</a></span></dt>
1.1 grant 973:
1.30 wiz 974: <dt><span class="sect1"><a href=
1.41 wiz 975: "#moving-package">17.5. Moving a package in
1.30 wiz 976: pkgsrc</a></span></dt>
1.1 grant 977: </dl>
978: </dd>
979: </dl>
980: </dd>
981:
1.46 gdt 982: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 983: example package: bison</a></span></dt>
984:
985: <dd>
986: <dl>
1.46 gdt 987: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 988: files</a></span></dt>
989:
990: <dd>
991: <dl>
1.30 wiz 992: <dt><span class="sect2"><a href=
1.46 gdt 993: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 994:
1.30 wiz 995: <dt><span class="sect2"><a href=
1.46 gdt 996: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 997:
1.30 wiz 998: <dt><span class="sect2"><a href=
1.46 gdt 999: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1000:
1.30 wiz 1001: <dt><span class="sect2"><a href=
1.46 gdt 1002: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1003: package with <span><strong class=
1.14 xtraeme 1004: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1005: </dl>
1006: </dd>
1007:
1.46 gdt 1008: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1009: Steps for building, installing,
1010: packaging</a></span></dt>
1.1 grant 1011: </dl>
1012: </dd>
1013:
1.46 gdt 1014: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1015: logs</a></span></dt>
1016:
1017: <dd>
1018: <dl>
1.46 gdt 1019: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1020: Building figlet</a></span></dt>
1021:
1.46 gdt 1022: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1023: Packaging figlet</a></span></dt>
1024: </dl>
1025: </dd>
1026:
1.46 gdt 1027: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1028: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1029:
1.46 gdt 1030: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1031: guidelines for the pkgsrc guide</a></span></dt>
1032:
1033: <dd>
1034: <dl>
1.46 gdt 1035: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1036: Targets</a></span></dt>
1037:
1.46 gdt 1038: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1039: Procedure</a></span></dt>
1040: </dl>
1041: </dd>
1.1 grant 1042: </dl>
1043: </div>
1044:
1.55 rillig 1045: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1046: <div class="titlepage">
1047: <div>
1048: <div>
1.55 rillig 1049: <h2 class="title"><a name="introduction" id=
1.51 rillig 1050: "introduction"></a>Chapter 1. What is
1051: pkgsrc?</h2>
1.1 grant 1052: </div>
1053: </div>
1054: </div>
1055:
1056: <div class="toc">
1057: <p><b>Table of Contents</b></p>
1058:
1059: <dl>
1.30 wiz 1060: <dt><span class="sect1"><a href=
1061: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1062:
1063: <dt><span class="sect1"><a href="#overview">1.2.
1064: Overview</a></span></dt>
1065:
1066: <dt><span class="sect1"><a href="#terminology">1.3.
1067: Terminology</a></span></dt>
1068:
1069: <dt><span class="sect1"><a href="#typography">1.4.
1070: Typography</a></span></dt>
1071: </dl>
1072: </div>
1073:
1.55 rillig 1074: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1075: <div class="titlepage">
1076: <div>
1077: <div>
1078: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1079: "introduction-section" id=
1.30 wiz 1080: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1081: </div>
1082: </div>
1083: </div>
1084:
1.47 reed 1085: <p>There is a lot of software freely available for
1086: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1087: Unix-flavoured systems, too, sometimes with some
1088: modifications. The NetBSD Packages Collection (pkgsrc)
1089: incorporates any such changes necessary to make that
1090: software run, and makes the installation (and
1091: de-installation) of the software package easy by means of a
1092: single command.</p>
1093:
1094: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1095: the <span><strong class="command">pkg_*</strong></span>
1096: tools so that installation and de-installation, printing of
1097: an inventory of all installed packages and retrieval of
1098: one-line comments or more verbose descriptions are all
1099: simple.</p>
1.1 grant 1100:
1101: <p>pkgsrc currently contains several thousand packages,
1102: including:</p>
1103:
1104: <div class="itemizedlist">
1105: <ul type="disc">
1106: <li>
1107: <p><a xmlns=
1108: "http://www.w3.org/TR/xhtml1/transitional" href=
1109: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1110: target="_top"><code xmlns="" class=
1111: "filename">www/apache</code></a> - The Apache web
1.20 ben 1112: server</p>
1.1 grant 1113: </li>
1114:
1115: <li>
1116: <p><a xmlns=
1117: "http://www.w3.org/TR/xhtml1/transitional" href=
1118: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1119: target="_top"><code xmlns="" class=
1120: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1121: browser</p>
1.1 grant 1122: </li>
1123:
1124: <li>
1125: <p><a xmlns=
1126: "http://www.w3.org/TR/xhtml1/transitional" href=
1127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1128: target="_top"><code xmlns="" class=
1129: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1130: Desktop Environment</p>
1.1 grant 1131: </li>
1132:
1133: <li>
1134: <p><a xmlns=
1135: "http://www.w3.org/TR/xhtml1/transitional" href=
1136: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1137: target="_top"><code xmlns="" class=
1138: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1139: Environment</p>
1.1 grant 1140: </li>
1141: </ul>
1142: </div>
1143:
1144: <p>...just to name a few.</p>
1145:
1146: <p>pkgsrc has built-in support for handling varying
1147: dependencies, such as pthreads and X11, and extended
1148: features such as IPv6 support on a range of platforms.</p>
1149:
1150: <p>pkgsrc was derived from FreeBSD's ports system, and
1151: initially developed for NetBSD only. Since then, pkgsrc has
1152: grown a lot, and now supports the following platforms:</p>
1153:
1154: <div class="itemizedlist">
1155: <ul type="disc">
1156: <li>
1157: <p><a href="http://developer.apple.com/darwin/"
1158: target="_top">Darwin</a> (<a href=
1159: "http://www.apple.com/macosx/" target="_top">Mac OS
1160: X</a>)</p>
1161: </li>
1162:
1163: <li>
1.3 hubertf 1164: <p><a href="http://www.DragonFlyBSD.org/" target=
1165: "_top">DragonFlyBSD</a></p>
1166: </li>
1167:
1168: <li>
1.1 grant 1169: <p><a href="http://www.FreeBSD.org/" target=
1170: "_top">FreeBSD</a></p>
1171: </li>
1172:
1173: <li>
1.3 hubertf 1174: <p>Microsoft Windows, via <a href=
1175: "http://www.microsoft.com/windows/sfu/" target=
1176: "_top">Interix</a></p>
1.1 grant 1177: </li>
1178:
1179: <li>
1180: <p><a href="http://www.sgi.com/software/irix6.5/"
1181: target="_top">IRIX</a></p>
1182: </li>
1183:
1184: <li>
1185: <p><a href="http://www.linux.org/" target=
1186: "_top">Linux</a></p>
1187: </li>
1188:
1189: <li>
1190: <p><a href="http://www.NetBSD.org/" target=
1191: "_top">NetBSD</a> (of course)</p>
1192: </li>
1193:
1194: <li>
1.17 sketch 1195: <p><a href="http://h30097.www3.hp.com/" target=
1196: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1197: </li>
1198:
1199: <li>
1.1 grant 1200: <p><a href="http://www.openbsd.org/" target=
1201: "_top">OpenBSD</a></p>
1202: </li>
1203:
1204: <li>
1205: <p><a href="http://www.sun.com/solaris/" target=
1206: "_top">Solaris</a></p>
1207: </li>
1208: </ul>
1209: </div>
1210: </div>
1211:
1.55 rillig 1212: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1213: <div class="titlepage">
1214: <div>
1215: <div>
1216: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1217: "overview" id="overview"></a>1.2. Overview</h2>
1.1 grant 1218: </div>
1219: </div>
1220: </div>
1221:
1222: <p>This document is divided into two parts. The first,
1223: <a href="#users-guide" title=
1.46 gdt 1224: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1225: user's guide</a>, describes how one can use one of the
1226: packages in the Package Collection, either by installing a
1227: precompiled binary package, or by building one's own copy
1228: using the NetBSD package system. The second part, <a href=
1.1 grant 1229: "#developers-guide" title=
1.46 gdt 1230: "Part II. The pkgsrc developer's guide">The
1231: pkgsrc developer's guide</a>, explains how to prepare a
1232: package so it can be easily built by other NetBSD users
1233: without knowing about the package's building details.</p>
1.1 grant 1234:
1235: <p>This document is available in various formats:</p>
1236:
1237: <div class="itemizedlist">
1238: <ul type="disc">
1239: <li>
1240: <p><a href="index.html" target="_top">HTML</a></p>
1241: </li>
1242:
1243: <li>
1244: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1245: </li>
1246:
1247: <li>
1248: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1249: </li>
1250:
1251: <li>
1252: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1253: </li>
1254: </ul>
1255: </div>
1256: </div>
1257:
1.55 rillig 1258: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1259: <div class="titlepage">
1260: <div>
1261: <div>
1262: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1263: "terminology" id=
1.1 grant 1264: "terminology"></a>1.3. Terminology</h2>
1265: </div>
1266: </div>
1267: </div>
1268:
1269: <p>There has been a lot of talk about “<span class=
1270: "quote">ports</span>”, “<span class=
1271: "quote">packages</span>”, etc. so far. Here is a
1272: description of all the terminology used within this
1273: document.</p>
1274:
1275: <div class="variablelist">
1276: <dl>
1277: <dt><span class="term">Package</span></dt>
1278:
1279: <dd>
1280: <p>A set of files and building instructions that
1281: describe what's necessary to build a certain piece of
1282: software using pkgsrc. Packages are traditionally
1.45 wiz 1283: stored under <code xmlns=
1284: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1285: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1286: </dd>
1287:
1288: <dt><span class="term">The NetBSD package
1289: system</span></dt>
1290:
1291: <dd>
1292: <p>This is the former name of “<span class=
1293: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1294: NetBSD operating system and can be bootstrapped to
1295: run on non-NetBSD operating systems as well. It
1296: handles building (compiling), installing, and
1297: removing of packages.</p>
1.1 grant 1298: </dd>
1299:
1300: <dt><span class="term">Distfile</span></dt>
1301:
1302: <dd>
1303: <p>This term describes the file or files that are
1304: provided by the author of the piece of software to
1305: distribute his work. All the changes necessary to
1306: build on NetBSD are reflected in the corresponding
1307: package. Usually the distfile is in the form of a
1308: compressed tar-archive, but other types are possible,
1.45 wiz 1309: too. Distfiles are usually stored below <code xmlns=
1310: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1311: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1312: </dd>
1313:
1314: <dt><span class="term">Port</span></dt>
1315:
1316: <dd>
1317: <p>This is the term used by FreeBSD and OpenBSD
1318: people for what we call a package. In NetBSD
1319: terminology, “<span class=
1320: "quote">port</span>” refers to a different
1321: architecture.</p>
1322: </dd>
1323:
1324: <dt><span class="term">Precompiled/binary
1325: package</span></dt>
1326:
1327: <dd>
1328: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1329: distfile and stuffed together in a single
1.45 wiz 1330: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1331: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1332: installed on machines of the same machine
1333: architecture without the need to recompile. Packages
1.45 wiz 1334: are usually generated in <code xmlns=
1335: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1336: "filename">/usr/pkgsrc/packages</code>; there is also
1337: an archive on <a href=
1.1 grant 1338: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1339: "_top">ftp.NetBSD.org</a>.</p>
1340:
1341: <p>Sometimes, this is referred to by the term
1342: “<span class="quote">package</span>” too,
1343: especially in the context of precompiled
1344: packages.</p>
1345: </dd>
1346:
1347: <dt><span class="term">Program</span></dt>
1348:
1349: <dd>
1350: <p>The piece of software to be installed which will
1.47 reed 1351: be constructed from all the files in the distfile by
1.1 grant 1352: the actions defined in the corresponding package.</p>
1353: </dd>
1354: </dl>
1355: </div>
1356: </div>
1357:
1.55 rillig 1358: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1359: <div class="titlepage">
1360: <div>
1361: <div>
1362: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1363: "typography" id=
1.1 grant 1364: "typography"></a>1.4. Typography</h2>
1365: </div>
1366: </div>
1367: </div>
1368:
1369: <p>When giving examples for commands, shell prompts are
1370: used to show if the command should/can be issued as root,
1371: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1372: privileges are sufficient. We use a <code class=
1373: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1374: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1375: assuming they use the C-shell or tcsh.</p>
1.1 grant 1376: </div>
1377: </div>
1378:
1.55 rillig 1379: <div class="part" lang="en" xml:lang="en">
1.1 grant 1380: <div class="titlepage">
1381: <div>
1382: <div>
1.55 rillig 1383: <h1 class="title"><a name="users-guide" id=
1.48 dillo 1384: "users-guide"></a>Part I. The pkgsrc user's
1385: guide</h1>
1.1 grant 1386: </div>
1387: </div>
1388: </div>
1389:
1390: <div class="toc">
1391: <p><b>Table of Contents</b></p>
1392:
1393: <dl>
1394: <dt><span class="chapter"><a href="#getting">2. Where to
1395: get pkgsrc</a></span></dt>
1396:
1397: <dd>
1398: <dl>
1.30 wiz 1399: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1400: As tar file</a></span></dt>
1.1 grant 1401:
1.30 wiz 1402: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1403: SUP</a></span></dt>
1404:
1.30 wiz 1405: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1406: CVS</a></span></dt>
1407: </dl>
1408: </dd>
1409:
1410: <dt><span class="chapter"><a href="#platforms">3. Using
1411: pkgsrc on systems other than NetBSD</a></span></dt>
1412:
1413: <dd>
1414: <dl>
1.30 wiz 1415: <dt><span class="sect1"><a href=
1416: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1417: pkgsrc</a></span></dt>
1.1 grant 1418:
1.30 wiz 1419: <dt><span class="sect1"><a href=
1.47 reed 1420: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1421: notes</a></span></dt>
1.1 grant 1422:
1423: <dd>
1424: <dl>
1.30 wiz 1425: <dt><span class="sect2"><a href="#darwin">3.2.1.
1426: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1427:
1.30 wiz 1428: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1429: FreeBSD</a></span></dt>
1.22 tv 1430:
1.30 wiz 1431: <dt><span class="sect2"><a href="#interix">3.2.3.
1432: Interix</a></span></dt>
1.1 grant 1433:
1.30 wiz 1434: <dt><span class="sect2"><a href="#irix">3.2.4.
1435: IRIX</a></span></dt>
1.1 grant 1436:
1.30 wiz 1437: <dt><span class="sect2"><a href="#linux">3.2.5.
1438: Linux</a></span></dt>
1.1 grant 1439:
1.30 wiz 1440: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1441: OpenBSD</a></span></dt>
1.1 grant 1442:
1.30 wiz 1443: <dt><span class="sect2"><a href="#solaris">3.2.7.
1444: Solaris</a></span></dt>
1.1 grant 1445: </dl>
1446: </dd>
1447: </dl>
1448: </dd>
1449:
1450: <dt><span class="chapter"><a href="#using">4. Using
1451: pkgsrc</a></span></dt>
1452:
1453: <dd>
1454: <dl>
1455: <dt><span class="sect1"><a href=
1456: "#getting-started">4.1. Working with binary
1457: packages</a></span></dt>
1458:
1459: <dd>
1460: <dl>
1461: <dt><span class="sect2"><a href=
1.30 wiz 1462: "#where-to-get-binary-packages">4.1.1. Where to
1463: get binary packages</a></span></dt>
1.1 grant 1464:
1465: <dt><span class="sect2"><a href=
1.30 wiz 1466: "#how-to-use-binary-packages">4.1.2. How to use
1467: binary packages</a></span></dt>
1.1 grant 1468:
1469: <dt><span class="sect2"><a href=
1.30 wiz 1470: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1471: warning</a></span></dt>
1472: </dl>
1473: </dd>
1474:
1.30 wiz 1475: <dt><span class="sect1"><a href=
1476: "#building-packages-from-source">4.2. Building
1477: packages from source</a></span></dt>
1.1 grant 1478:
1479: <dd>
1480: <dl>
1481: <dt><span class="sect2"><a href=
1.30 wiz 1482: "#requirements">4.2.1.
1483: Requirements</a></span></dt>
1.1 grant 1484:
1485: <dt><span class="sect2"><a href=
1.30 wiz 1486: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1487: distfiles</a></span></dt>
1488:
1489: <dt><span class="sect2"><a href=
1.30 wiz 1490: "#how-to-build-and-install">4.2.3. How to build
1491: and install</a></span></dt>
1.1 grant 1492:
1493: <dt><span class="sect2"><a href=
1.30 wiz 1494: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1495: compiler</a></span></dt>
1496: </dl>
1497: </dd>
1498: </dl>
1499: </dd>
1500:
1.38 dillo 1501: <dt><span class="chapter"><a href="#configuring">5.
1502: Configuring pkgsrc</a></span></dt>
1503:
1504: <dd>
1505: <dl>
1506: <dt><span class="sect1"><a href=
1.45 wiz 1507: "#general-configuration">5.1. General
1508: configuration</a></span></dt>
1509:
1510: <dt><span class="sect1"><a href=
1511: "#variables-affecting-build">5.2. Variables affecting
1512: the build process</a></span></dt>
1513:
1514: <dt><span class="sect1"><a href=
1515: "#developer-advanced-settings">5.3.
1516: Developer/advanced settings</a></span></dt>
1517:
1518: <dt><span class="sect1"><a href=
1519: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1520: Options</a></span></dt>
1.38 dillo 1521: </dl>
1522: </dd>
1523:
1524: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1525: binary packages</a></span></dt>
1526:
1527: <dd>
1528: <dl>
1.30 wiz 1529: <dt><span class="sect1"><a href=
1.38 dillo 1530: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1531: single binary package</a></span></dt>
1.1 grant 1532:
1.30 wiz 1533: <dt><span class="sect1"><a href=
1.38 dillo 1534: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1535: Settings for creation of binary
1536: packages</a></span></dt>
1537:
1.38 dillo 1538: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1539: Doing a bulk build of all packages</a></span></dt>
1540:
1541: <dd>
1542: <dl>
1543: <dt><span class="sect2"><a href=
1.38 dillo 1544: "#binary.configuration">6.3.1.
1.1 grant 1545: Configuration</a></span></dt>
1546:
1547: <dt><span class="sect2"><a href=
1.38 dillo 1548: "#other-environmental-considerations">6.3.2.
1.30 wiz 1549: Other environmental
1.1 grant 1550: considerations</a></span></dt>
1551:
1552: <dt><span class="sect2"><a href=
1.38 dillo 1553: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1554:
1555: <dt><span class="sect2"><a href=
1.38 dillo 1556: "#what-it-does">6.3.4. What it
1.30 wiz 1557: does</a></span></dt>
1.1 grant 1558:
1559: <dt><span class="sect2"><a href=
1.38 dillo 1560: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1561: requirements</a></span></dt>
1562:
1563: <dt><span class="sect2"><a href=
1.38 dillo 1564: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1565: sandbox for chrooted builds</a></span></dt>
1.1 grant 1566:
1567: <dt><span class="sect2"><a href=
1.38 dillo 1568: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1569: partial set of packages</a></span></dt>
1.13 hubertf 1570:
1571: <dt><span class="sect2"><a href=
1.38 dillo 1572: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1573: build</a></span></dt>
1.1 grant 1574: </dl>
1575: </dd>
1576:
1.30 wiz 1577: <dt><span class="sect1"><a href=
1.38 dillo 1578: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1579: packages collection</a></span></dt>
1.1 grant 1580:
1581: <dd>
1582: <dl>
1583: <dt><span class="sect2"><a href=
1.38 dillo 1584: "#cdpack-example">6.4.1. Example of
1.1 grant 1585: cdpack</a></span></dt>
1586: </dl>
1587: </dd>
1588: </dl>
1589: </dd>
1590:
1.38 dillo 1591: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1592: Asked Questions</a></span></dt>
1593:
1594: <dd>
1595: <dl>
1.30 wiz 1596: <dt><span class="sect1"><a href=
1.38 dillo 1597: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1598: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1599:
1.38 dillo 1600: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1601: Where's the pkgviews documentation?</a></span></dt>
1602:
1.38 dillo 1603: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1604: Utilities for package management
1605: (pkgtools)</a></span></dt>
1606:
1.30 wiz 1607: <dt><span class="sect1"><a href=
1.38 dillo 1608: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1609: non-root</a></span></dt>
1.1 grant 1610:
1.30 wiz 1611: <dt><span class="sect1"><a href=
1.38 dillo 1612: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1613: fetching distfiles?</a></span></dt>
1.14 xtraeme 1614:
1.30 wiz 1615: <dt><span class="sect1"><a href=
1.38 dillo 1616: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1617: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1618:
1.30 wiz 1619: <dt><span class="sect1"><a href=
1.38 dillo 1620: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1621: from pkgsrc?</a></span></dt>
1.1 grant 1622:
1.30 wiz 1623: <dt><span class="sect1"><a href=
1.38 dillo 1624: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1625: behind a firewall</a></span></dt>
1.1 grant 1626:
1.38 dillo 1627: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1628: How do I tell <span><strong class="command">make
1.14 xtraeme 1629: fetch</strong></span> to do passive
1.1 grant 1630: FTP?</a></span></dt>
1631:
1.30 wiz 1632: <dt><span class="sect1"><a href=
1.38 dillo 1633: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1634: distfiles at once</a></span></dt>
1.1 grant 1635:
1.30 wiz 1636: <dt><span class="sect1"><a href=
1.38 dillo 1637: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1638: “<span class="quote">Don't know how to make
1639: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1640: mean?</a></span></dt>
1.13 hubertf 1641:
1.30 wiz 1642: <dt><span class="sect1"><a href=
1.38 dillo 1643: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1644: “<span class="quote">Could not find
1.14 xtraeme 1645: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1646:
1.30 wiz 1647: <dt><span class="sect1"><a href=
1.38 dillo 1648: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1649: pkgsrc</a></span></dt>
1.1 grant 1650:
1.38 dillo 1651: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1652: do I change the location of configuration
1653: files?</a></span></dt>
1.1 grant 1654:
1655: <dt><span class="sect1"><a href=
1.38 dillo 1656: "#audit-packages">7.15. Automated security
1.1 grant 1657: checks</a></span></dt>
1658: </dl>
1659: </dd>
1660: </dl>
1661: </div>
1662:
1.55 rillig 1663: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1664: <div class="titlepage">
1665: <div>
1666: <div>
1.55 rillig 1667: <h2 class="title"><a name="getting" id=
1.1 grant 1668: "getting"></a>Chapter 2. Where to get
1669: pkgsrc</h2>
1670: </div>
1671: </div>
1672: </div>
1673:
1674: <div class="toc">
1675: <p><b>Table of Contents</b></p>
1676:
1677: <dl>
1.30 wiz 1678: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1679: tar file</a></span></dt>
1680:
1.30 wiz 1681: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1682: SUP</a></span></dt>
1683:
1.30 wiz 1684: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1685: CVS</a></span></dt>
1686: </dl>
1687: </div>
1688:
1689: <p>There are three ways to get pkgsrc. Either as a tar
1690: file, via SUP, or via CVS. All three ways are described
1691: here.</p>
1692:
1.55 rillig 1693: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1694: <div class="titlepage">
1695: <div>
1696: <div>
1697: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1698: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1699: file</h2>
1.1 grant 1700: </div>
1701: </div>
1702: </div>
1703:
1704: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1705: file from <a href=
1.11 ben 1706: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1707: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1708: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1709: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1710: </div>
1711:
1.55 rillig 1712: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1713: <div class="titlepage">
1714: <div>
1715: <div>
1716: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1717: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1718: </div>
1719: </div>
1720: </div>
1721:
1722: <p>As an alternative to the tar file, you can get pkgsrc
1723: via the Software Update Protocol, SUP. To do so, make
1724: sure your supfile has a line</p>
1725: <pre class="programlisting">
1.51 rillig 1726: release=pkgsrc
1.1 grant 1727: </pre>
1728:
1.45 wiz 1729: <p>in it, see the examples in <code xmlns=
1730: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1731: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1732: the <code xmlns=
1733: "http://www.w3.org/TR/xhtml1/transitional" class=
1734: "filename">/usr/pkgsrc</code> directory exists. Then,
1735: simply run <span><strong class="command">sup -v
1736: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1737: </div>
1738:
1.55 rillig 1739: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1740: <div class="titlepage">
1741: <div>
1742: <div>
1743: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1744: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1745: </div>
1746: </div>
1747: </div>
1748:
1749: <p>To get pkgsrc via CVS, make sure you have
1750: “<span class="quote">cvs</span>” installed.
1.27 rillig 1751: To do an initial (full) checkout of pkgsrc, do the
1752: following steps:</p>
1.1 grant 1753: <pre class="screen">
1.14 xtraeme 1754: <code class="prompt">%</code> <strong class=
1755: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1756: <code class="prompt">%</code> <strong class=
1757: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1758: <code class="prompt">%</code> <strong class=
1759: "userinput"><code>cd /usr</code></strong>
1760: <code class="prompt">%</code> <strong class=
1761: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1762: </pre>
1763:
1.45 wiz 1764: <p>This will create the <code xmlns=
1765: "http://www.w3.org/TR/xhtml1/transitional" class=
1766: "filename">pkgsrc</code> directory in your <code xmlns=
1767: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1768: "filename">/usr</code>, and all the package source will
1.45 wiz 1769: be stored under <code xmlns=
1770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1771: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1772: initial checkout, make sure you have <code class=
1773: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1774: <pre class="screen">
1.14 xtraeme 1775: <code class="prompt">%</code> <strong class=
1776: "userinput"><code>cd /usr/pkgsrc</code></strong>
1777: <code class="prompt">%</code> <strong class=
1778: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1779: </pre>
1780:
1781: <p>Please also note that it is possible to have multiple
1782: copies of the pkgsrc hierarchy in use at any one time -
1783: all work is done relatively within the pkgsrc tree.</p>
1784: </div>
1785: </div>
1786:
1.55 rillig 1787: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1788: <div class="titlepage">
1789: <div>
1790: <div>
1.55 rillig 1791: <h2 class="title"><a name="platforms" id=
1.1 grant 1792: "platforms"></a>Chapter 3. Using pkgsrc on
1793: systems other than NetBSD</h2>
1794: </div>
1795: </div>
1796: </div>
1797:
1798: <div class="toc">
1799: <p><b>Table of Contents</b></p>
1800:
1801: <dl>
1.30 wiz 1802: <dt><span class="sect1"><a href=
1803: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1804: pkgsrc</a></span></dt>
1.1 grant 1805:
1.30 wiz 1806: <dt><span class="sect1"><a href=
1.47 reed 1807: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1808: notes</a></span></dt>
1.1 grant 1809:
1810: <dd>
1811: <dl>
1.30 wiz 1812: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1813: Darwin (Mac OS X)</a></span></dt>
1814:
1.30 wiz 1815: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1816: FreeBSD</a></span></dt>
1817:
1.30 wiz 1818: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1819: Interix</a></span></dt>
1820:
1.30 wiz 1821: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1822: IRIX</a></span></dt>
1823:
1.30 wiz 1824: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1825: Linux</a></span></dt>
1826:
1.30 wiz 1827: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1828: OpenBSD</a></span></dt>
1829:
1.30 wiz 1830: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1831: Solaris</a></span></dt>
1832: </dl>
1833: </dd>
1834: </dl>
1835: </div>
1836:
1.55 rillig 1837: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1838: <div class="titlepage">
1839: <div>
1840: <div>
1841: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1842: "bootstrapping-pkgsrc" id=
1.30 wiz 1843: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1844: pkgsrc</h2>
1.1 grant 1845: </div>
1846: </div>
1847: </div>
1848:
1.27 rillig 1849: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1850: bootstrap kit to build the required tools to use pkgsrc
1851: on your platform. Besides support for native NetBSD,
1852: pkgsrc and the bootstrap kit have support for the
1853: following operating systems:</p>
1854:
1855: <div class="itemizedlist">
1856: <ul type="disc">
1857: <li>
1858: <p>Darwin (Mac OS X)</p>
1859: </li>
1860:
1861: <li>
1.16 grant 1862: <p>DragonFlyBSD</p>
1863: </li>
1864:
1865: <li>
1.1 grant 1866: <p>FreeBSD</p>
1867: </li>
1868:
1869: <li>
1870: <p>Interix (Windows 2000, XP, 2003)</p>
1871: </li>
1872:
1873: <li>
1874: <p>IRIX</p>
1875: </li>
1876:
1877: <li>
1878: <p>Linux</p>
1879: </li>
1880:
1881: <li>
1882: <p>OpenBSD</p>
1883: </li>
1884:
1885: <li>
1886: <p>Solaris</p>
1887: </li>
1.16 grant 1888:
1889: <li>
1890: <p>Tru64 (Digital UNIX/OSF1)</p>
1891: </li>
1.1 grant 1892: </ul>
1893: </div>
1894:
1895: <p>Support for other platforms is under development.</p>
1896:
1897: <p>Installing the bootstrap kit should be as simple
1898: as:</p>
1899: <pre class="screen">
1.14 xtraeme 1900: <code class="prompt">#</code> <strong class=
1901: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1902: <code class="prompt">#</code> <strong class=
1903: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1904: <code class="prompt">#</code> <strong class=
1905: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1906: </pre>
1907:
1908: <p>See <a href="#getting" title=
1.55 rillig 1909: "Chapter 2. Where to get pkgsrc">Chapter 2,
1.1 grant 1910: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1911: pkgsrc before bootstrapping. The given
1912: <span><strong class="command">bootstrap</strong></span>
1.45 wiz 1913: command will use the defaults of <code xmlns=
1914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1915: "filename">/usr/pkg</code> for the <span class=
1916: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1917: installed in, and <code xmlns=
1918: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1919: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1920: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1921: However, these can also be set using command-line
1.27 rillig 1922: arguments.</p>
1.1 grant 1923:
1924: <p>Binary packages for the pkgsrc tools and an initial
1925: set of packages is available for supported platforms. An
1926: up-to-date list of these can be found on <a href=
1927: "http://www.pkgsrc.org/" target=
1928: "_top">www.pkgsrc.org</a>.</p>
1.47 reed 1929:
1930: <div class="note" style=
1931: "margin-left: 0.5in; margin-right: 0.5in;">
1932: <h3 class="title">Note</h3>
1933:
1934: <p>The bootstrap installs a <span><strong class=
1935: "command">bmake</strong></span> tool. Use this
1936: <span><strong class="command">bmake</strong></span>
1937: when building via pkgsrc. For examples in this guide,
1938: use <span><strong class="command">bmake</strong></span>
1939: instead of “<span class=
1940: "quote">make</span>”.</p>
1941: </div>
1.1 grant 1942: </div>
1943:
1.55 rillig 1944: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1945: <div class="titlepage">
1946: <div>
1947: <div>
1948: <h2 class="title" style="clear: both"><a name=
1.55 rillig 1949: "platform-specific-notes" id=
1.47 reed 1950: "platform-specific-notes"></a>3.2. Platform-specific
1951: notes</h2>
1.1 grant 1952: </div>
1953: </div>
1954: </div>
1955:
1956: <p>Here are some platform-specific notes you should be
1957: aware of.</p>
1958:
1.55 rillig 1959: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 1960: <div class="titlepage">
1961: <div>
1962: <div>
1.55 rillig 1963: <h3 class="title"><a name="darwin" id=
1.30 wiz 1964: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1965: </div>
1966: </div>
1967: </div>
1968:
1969: <p>Darwin 5.x and 6.x are supported. There are two
1970: methods of using pkgsrc on Mac OS X, by using a
1971: <a href="#platform.osx-image" title=
1972: "3.2.1.1. Using a disk image">disk image</a>, or a
1973: <a href="#platform.osx-ufs" title=
1974: "3.2.1.2. Using a UFS partition">UFS
1975: partition</a>.</p>
1976:
1977: <p>Before you start, you will need to download and
1978: install the Mac OS X Developer Tools from Apple's
1979: Developer Connection. See <a href=
1980: "http://developer.apple.com/macosx/" target=
1981: "_top">http://developer.apple.com/macosx/</a> for
1982: details. Also, make sure you install X11 for Mac OS X
1983: and the X11 SDK from <a href=
1984: "http://www.apple.com/macosx/x11/download/" target=
1985: "_top">http://www.apple.com/macosx/x11/download/</a> if
1986: you intend to build packages that use the X11 Window
1987: System.</p>
1988:
1989: <p>If you already have a UFS partition, or have a spare
1990: partition that you can format as UFS, it is recommended
1991: to use that instead of the disk image. It'll be
1992: somewhat faster and will mount automatically at boot
1993: time, where you must manually mount a disk image.</p>
1994:
1995: <div class="note" style=
1996: "margin-left: 0.5in; margin-right: 0.5in;">
1997: <h3 class="title">Note</h3>
1998:
1999: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2000: because pkgsrc currently requires the file system to
1.1 grant 2001: be case-sensitive, and HFS+ is not.</p>
2002: </div>
2003:
1.55 rillig 2004: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2005: <div class="titlepage">
2006: <div>
2007: <div>
1.55 rillig 2008: <h4 class="title"><a name="platform.osx-image"
2009: id="platform.osx-image"></a>3.2.1.1. Using
2010: a disk image</h4>
1.1 grant 2011: </div>
2012: </div>
2013: </div>
2014:
2015: <p>Create the disk image:</p>
2016: <pre class="screen">
1.14 xtraeme 2017: <code class="prompt">#</code> <strong class=
2018: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2019: <code class="prompt">#</code> <strong class=
2020: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2021: <code class="prompt">#</code> <strong class=
2022: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2023: <code class="prompt">#</code> <strong class=
2024: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2025: </pre>
2026:
2027: <p>That's it!</p>
2028: </div>
2029:
1.55 rillig 2030: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2031: <div class="titlepage">
2032: <div>
2033: <div>
1.55 rillig 2034: <h4 class="title"><a name="platform.osx-ufs"
2035: id="platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2036: UFS partition</h4>
2037: </div>
2038: </div>
2039: </div>
2040:
1.45 wiz 2041: <p>By default, <code xmlns=
2042: "http://www.w3.org/TR/xhtml1/transitional" class=
2043: "filename">/usr</code> will be on your root file
2044: system, normally HFS+. It is possible to use the
2045: default <span class="emphasis"><em>prefix</em></span>
2046: of <code xmlns=
2047: "http://www.w3.org/TR/xhtml1/transitional" class=
2048: "filename">/usr/pkg</code> by symlinking <code xmlns=
2049: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2050: "filename">/usr/pkg</code> to a directory on a UFS
2051: file system. Obviously, another symlink is required
2052: if you want to place the package database directory
2053: outside the <span class=
2054: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2055: <pre class="screen">
1.14 xtraeme 2056: <code class="prompt">#</code> <strong class=
1.22 tv 2057: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 2058: </pre>
2059:
2060: <p>If you created your partitions at the time of
2061: installing Mac OS X and formatted the target
2062: partition as UFS, it should automatically mount on
1.45 wiz 2063: <code xmlns=
2064: "http://www.w3.org/TR/xhtml1/transitional" class=
2065: "filename">/Volumes/<volume name></code> when
2066: the machine boots. If you are (re)formatting a
2067: partition as UFS, you need to ensure that the
2068: partition map correctly reflects “<span class=
2069: "quote">Apple_UFS</span>” and not
2070: “<span class=
1.1 grant 2071: "quote">Apple_HFS</span>”.</p>
2072:
2073: <p>The problem is that none of the disk tools will
2074: let you touch a disk that is booted from. You can
2075: unmount the partition, but even if you newfs it, the
2076: partition type will be incorrect and the automounter
2077: won't mount it. It can be mounted manually, but it
2078: won't appear in Finder.</p>
2079:
2080: <p>You'll need to boot off of the OS X Installation
2081: (User) CD. When the Installation program starts, go
2082: up to the menu and select Disk Utility. Now, you will
2083: be able to select the partition you want to be UFS,
2084: and Format it Apple UFS. Quit the Disk Utility, quit
2085: the installer which will reboot your machine. The new
2086: UFS file system will appear in Finder.</p>
2087:
2088: <p>Be aware that the permissions on the new file
2089: system will be writable by root only.</p>
2090:
2091: <p>This note is as of 10.2 (Jaguar) and applies to
2092: earlier versions. Hopefully Apple will fix Disk
2093: Utility in 10.3 (Panther).</p>
2094: </div>
2095: </div>
2096:
1.55 rillig 2097: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2098: <div class="titlepage">
2099: <div>
2100: <div>
1.55 rillig 2101: <h3 class="title"><a name="freebsd" id=
1.30 wiz 2102: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2103: </div>
2104: </div>
2105: </div>
2106:
2107: <p>FreeBSD 4.7 and 5.0 have been tested and are
2108: supported, other versions may work.</p>
2109:
2110: <p>Care should be taken so that the tools that this kit
2111: installs do not conflict with the FreeBSD userland
2112: tools. There are several steps:</p>
2113:
2114: <div class="orderedlist">
2115: <ol type="1">
2116: <li>
2117: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2118: <code xmlns=
2119: "http://www.w3.org/TR/xhtml1/transitional" class=
2120: "filename">/var/db/pkg</code>. It is therefore
2121: recommended that you choose a different location
2122: (e.g. <code xmlns=
2123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2124: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2125: --pkgdbdir option to the bootstrap script.</p>
2126: </li>
2127:
2128: <li>
2129: <p>If you do not intend to use the FreeBSD ports
2130: tools, it's probably a good idea to move them out
2131: of the way to avoid confusion, e.g.</p>
2132: <pre class="screen">
1.14 xtraeme 2133: <code class="prompt">#</code> <strong class=
2134: "userinput"><code>cd /usr/sbin</code></strong>
2135: <code class="prompt">#</code> <strong class=
2136: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2137: <code class="prompt">#</code> <strong class=
2138: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2139: <code class="prompt">#</code> <strong class=
2140: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2141: <code class="prompt">#</code> <strong class=
2142: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2143: </pre>
2144: </li>
2145:
2146: <li>
1.45 wiz 2147: <p>An example <code xmlns=
2148: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2149: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2150: placed in <code xmlns=
2151: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2152: "filename">/etc/mk.conf.example</code> file when
2153: you use the bootstrap script.</p>
1.1 grant 2154: </li>
2155: </ol>
2156: </div>
2157: </div>
2158:
1.55 rillig 2159: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2160: <div class="titlepage">
2161: <div>
2162: <div>
1.55 rillig 2163: <h3 class="title"><a name="interix" id=
1.30 wiz 2164: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2165: </div>
2166: </div>
2167: </div>
2168:
1.47 reed 2169: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2170: Windows NT kernel, providing a Unix-like environment
2171: with a tighter kernel integration than available with
2172: Cygwin. It is part of the Windows Services for Unix
2173: package, available for free for any licensed copy of
1.22 tv 2174: Windows 2000, XP (not including XP Home), or 2003. SFU
2175: can be downloaded from <a href=
2176: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2177: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2178:
2179: <p>Services for Unix 3.5, current as of this writing,
2180: has been tested. 3.0 or 3.1 may work, but are not
2181: officially supported. (The main difference in 3.0/3.1
2182: is lack of pthreads.)</p>
2183:
1.55 rillig 2184: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2185: <div class="titlepage">
2186: <div>
2187: <div>
2188: <h4 class="title"><a name=
1.55 rillig 2189: "platform.interix-sfu-install" id=
1.1 grant 2190: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2191: installing Interix/SFU</h4>
1.1 grant 2192: </div>
2193: </div>
2194: </div>
2195:
2196: <p>At an absolute minimum, the following packages
2197: must be installed from the Windows Services for Unix
2198: 3.5 distribution in order to use pkgsrc:</p>
2199:
2200: <div class="itemizedlist">
2201: <ul type="disc">
2202: <li>
2203: <p>Utilities -> Base Utilities</p>
2204: </li>
2205:
2206: <li>
2207: <p>Interix GNU Components -> (all)</p>
2208: </li>
2209:
2210: <li>
2211: <p>Remote Connectivity</p>
2212: </li>
2213:
2214: <li>
2215: <p>Interix SDK</p>
2216: </li>
2217: </ul>
2218: </div>
2219:
2220: <p>When using pkgsrc on Interix, DO NOT install the
2221: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2222: without shared module support, installed to
2223: /usr/local, and will only cause confusion. Instead,
2224: install Perl 5.8 from pkgsrc (or from a binary
2225: package).</p>
2226:
2227: <p>The Remote Connectivity subcomponent "Windows
2228: Remote Shell Service" does not need to be installed,
2229: but Remote Connectivity itself should be installed in
2230: order to have a working inetd.</p>
2231:
1.52 tv 2232: <p>During installation you may be asked whether to
2233: enable setuid behavior for Interix programs, and
2234: whether to make pathnames default to case-sensitive.
2235: Setuid should be enabled, and case-sensitivity MUST
2236: be enabled. (Without case-sensitivity, a large number
2237: of packages including perl will not build.)</p>
2238:
2239: <p>NOTE: Newer Windows service packs change the way
2240: binary execution works (via the Data Execution
2241: Prevention feature). In order to use pkgsrc and other
2242: gcc-compiled binaries reliably, a hotfix containing
2243: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2244: (899522 or newer) must be installed. Hotfixes are
2245: available from Microsoft through a support contract;
2246: however, a NetBSD developer has made most Interix
2247: hotfixes available for personal use from <a href=
2248: "http://www.duh.org/interix/hotfixes.php" target=
2249: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2250: </div>
2251:
1.55 rillig 2252: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2253: <div class="titlepage">
2254: <div>
2255: <div>
2256: <h4 class="title"><a name=
1.55 rillig 2257: "platform.interix-sfu-postinstall" id=
1.1 grant 2258: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2259: to do if Interix/SFU is already installed</h4>
2260: </div>
2261: </div>
2262: </div>
2263:
2264: <p>If SFU is already installed and you wish to alter
2265: these settings to work with pkgsrc, note the
2266: following things.</p>
2267:
2268: <div class="itemizedlist">
2269: <ul type="disc">
2270: <li>
2271: <p>To uninstall UNIX Perl, use Add/Remove
2272: Programs, select Microsoft Windows Services for
2273: UNIX, then click Change. In the installer,
2274: choose Add or Remove, then uncheck
2275: Utilities->UNIX Perl.</p>
2276: </li>
2277:
2278: <li>
1.47 reed 2279: <p>To enable case-sensitivity for the file
2280: system, run REGEDIT.EXE, and change the
1.1 grant 2281: following registry key:</p>
2282:
2283: <p>
2284: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2285: Manager\kernel</p>
2286:
2287: <p>Set the DWORD value "obcaseinsensitive" to
2288: 0; then reboot.</p>
2289: </li>
2290:
2291: <li>
2292: <p>To enable setuid binaries (optional), run
2293: REGEDIT.EXE, and change the following registry
2294: key:</p>
2295:
2296: <p>
2297: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2298: for UNIX</p>
2299:
2300: <p>Set the DWORD value "EnableSetuidBinaries"
2301: to 1; then reboot.</p>
2302: </li>
2303: </ul>
2304: </div>
2305: </div>
2306:
1.55 rillig 2307: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2308: <div class="titlepage">
2309: <div>
2310: <div>
2311: <h4 class="title"><a name=
1.55 rillig 2312: "platform.interix-notes" id=
1.1 grant 2313: "platform.interix-notes"></a>3.2.3.3. Important
2314: notes for using pkgsrc</h4>
2315: </div>
2316: </div>
2317: </div>
2318:
1.52 tv 2319: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2320: or the user running "pkg_add") must be a member of
2321: the local Administrators group. Such a user must also
2322: be used to run the bootstrap. This is slightly
2323: relaxed from the normal pkgsrc requirement of
2324: "root".</p>
2325:
2326: <p>The package manager should use a umask of 002.
2327: "make install" will automatically complain if this is
2328: not the case. This ensures that directories written
2329: in /var/db/pkg are Administrators-group
2330: writeable.</p>
2331:
2332: <p>The popular Interix binary packages from
2333: http://www.interopsystems.com/ use an older version
2334: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2335: used in conjunction with pkgsrc. If you choose to use
2336: them at the same time as the pkgsrc packages, ensure
2337: that you use the proper pkg_* tools for each type of
2338: binary package.</p>
1.22 tv 2339:
2340: <p>The TERM setting used for DOS-type console windows
2341: (including those invoked by the csh and ksh startup
2342: shortcuts) is "interix". Most systems don't have a
2343: termcap/terminfo entry for it, but the following
2344: .termcap entry provides adequate emulation in most
2345: cases:</p>
2346: <pre class="programlisting">
1.51 rillig 2347: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2348: </pre>
1.1 grant 2349: </div>
1.52 tv 2350:
1.55 rillig 2351: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2352: <div class="titlepage">
2353: <div>
2354: <div>
2355: <h4 class="title"><a name=
1.55 rillig 2356: "platform.interix-limits" id=
1.52 tv 2357: "platform.interix-limits"></a>3.2.3.4. Limitations
2358: of the Interix platform</h4>
2359: </div>
2360: </div>
2361: </div>
2362:
2363: <p>Though Interix suffices as a familiar and flexible
2364: substitute for a full Unix-like platform, it has some
2365: drawbacks that should be noted for those desiring to
2366: make the most of Interix.</p>
2367:
2368: <div class="itemizedlist">
2369: <ul type="disc">
2370: <li>
1.54 tv 2371: <p><span class=
2372: "strong"><strong>X-Windows:</strong></span></p>
1.52 tv 2373:
2374: <p>Interix comes with the standard set of X11R6
2375: client libraries, and can run X-Windows based
2376: applications, but it does <span class=
2377: "emphasis"><em>not</em></span> come with an X
2378: server. Some options are <a href=
2379: "http://www.starnet.com/products/xwin32/"
2380: target="_top">StarNet X-Win32</a>, <a href=
2381: "http://connectivity.hummingbird.com/products/nc/exceed/"
2382: target="_top">Hummingbird Exceed</a>, and the
2383: free X-Windows server included with <a href=
2384: "http://x.cygwin.com/" target=
2385: "_top">Cygwin</a>.</p>
2386:
2387: <p>Also, StarNet Communications has graciously
2388: provided a free version of their X-Win32
2389: product that accepts connections only from
2390: localhost: <a href=
2391: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2392: target="_top">X-Win32 LX</a>, recommended by
2393: the maintainer of Interix pkgsrc support.</p>
2394: </li>
2395:
2396: <li>
1.54 tv 2397: <p><span class="strong"><strong>X-Windows
2398: acceleration:</strong></span></p>
1.52 tv 2399:
2400: <p>Because Interix runs in a completely
2401: different NT subsystem from Win32 applications,
2402: it does not currently support various X11
2403: protocol extensions for acceleration (such as
2404: MIT-SHM or DGA). Most interactive applications
2405: to a local X server will run reasonably fast,
2406: but full motion video and other graphics
2407: intensive applications may require a
2408: faster-than-expected CPU.</p>
2409: </li>
2410:
2411: <li>
1.54 tv 2412: <p><span class=
2413: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2414:
2415: <p>Interix has no native support for audio
1.53 tv 2416: output. For audio support, pkgsrc uses the
2417: <span><strong class=
1.52 tv 2418: "command">esound</strong></span> client/server
2419: audio system on Interix. Unlike on most
2420: platforms, the <a xmlns=
2421: "http://www.w3.org/TR/xhtml1/transitional"
2422: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2423: target="_top"><code xmlns="" class=
2424: "filename">audio/esound</code></a> package does
2425: <span class="emphasis"><em>not</em></span>
2426: contain the <span><strong class=
1.53 tv 2427: "command">esd</strong></span> server component.
2428: To output audio via an Interix host, the
2429: <a xmlns=
1.52 tv 2430: "http://www.w3.org/TR/xhtml1/transitional"
2431: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2432: target="_top"><code xmlns="" class=
2433: "filename">emulators/cygwin_esound</code></a>
2434: package must also be installed.</p>
2435: </li>
2436:
2437: <li>
1.54 tv 2438: <p><span class="strong"><strong>CD/DVDs, USB,
2439: and SCSI:</strong></span></p>
1.52 tv 2440:
2441: <p>Direct device access is not currently
2442: supported in Interix, so it is not currently
2443: possible to access CD/DVD drives, USB devices,
2444: or SCSI devices through non-filesystem means.
2445: Among other things, this makes it impossible to
2446: use Interix directly for CD/DVD burning.</p>
2447: </li>
2448:
2449: <li>
1.54 tv 2450: <p><span class="strong"><strong>Tape
2451: drives:</strong></span></p>
1.52 tv 2452:
2453: <p>Due to the same limitations as for CD-ROMs
2454: and SCSI devices, tape drives are also not
2455: directly accessible in Interix. However,
2456: support is in work to make tape drive access
2457: possible by using Cygwin as a bridge (similarly
2458: to audio bridged via Cygwin's esound
2459: server).</p>
2460: </li>
2461: </ul>
2462: </div>
2463: </div>
2464:
1.55 rillig 2465: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2466: <div class="titlepage">
2467: <div>
2468: <div>
2469: <h4 class="title"><a name=
1.55 rillig 2470: "platform.interix-knownissues" id=
1.52 tv 2471: "platform.interix-knownissues"></a>3.2.3.5. Known
2472: issues for pkgsrc on Interix</h4>
2473: </div>
2474: </div>
2475: </div>
2476:
2477: <p>It is not necessary, in general, to have a "root"
2478: user on the Windows system; any member of the local
2479: Administrators group will suffice. However, some
2480: packages currently assume that the user named "root"
2481: is the privileged user. To accommodate these, you may
2482: create such a user; make sure it is in the local
2483: group Administrators (or your language
2484: equivalent).</p>
2485:
2486: <p>"pkg_add" creates directories of mode 0755, not
2487: 0775, in $PKG_DBDIR. For the time being, install
2488: packages as the local Administrator (or your language
2489: equivalent), or run the following command after
2490: installing a package to work around the issue:</p>
2491: <pre class="screen">
2492: <code class="prompt">#</code> <strong class=
2493: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2494: </pre>
2495: </div>
1.1 grant 2496: </div>
2497:
1.55 rillig 2498: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2499: <div class="titlepage">
2500: <div>
2501: <div>
1.55 rillig 2502: <h3 class="title"><a name="irix" id=
1.30 wiz 2503: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2504: </div>
2505: </div>
2506: </div>
2507:
2508: <p>You will need a working C compiler, either gcc or
2509: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2510: the <code class="varname">CC</code> environment
2511: variable according to your preference. If you do not
2512: have a license for the MIPSpro compiler suite, you can
1.1 grant 2513: download a gcc tardist file from <a href=
2514: "http://freeware.sgi.com/" target=
2515: "_top">http://freeware.sgi.com/</a>.</p>
2516:
2517: <p>Please note that you will need IRIX 6.5.17 or
2518: higher, as this is the earliest version of IRIX
1.24 wiz 2519: providing support for <a href=
2520: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2521: <span class="citerefentry"><span class=
2522: "refentrytitle">if_indextoname</span>(3)</span></a>,
2523: <a href=
2524: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2525: <span class="citerefentry"><span class=
2526: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2527: etc.</p>
1.1 grant 2528:
1.27 rillig 2529: <p>At this point in time, pkgsrc only supports one ABI
2530: at a time. That is, you can not switch between the old
2531: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2532: you start out using "abi=n32", that's what all your
2533: packages will be built with.</p>
1.1 grant 2534:
2535: <p>Therefore, please make sure that you have no
1.14 xtraeme 2536: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2537: environment or the <code xmlns=
2538: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2539: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2540: that you do not try to link n32 object files with lib64
1.45 wiz 2541: or vice versa. Check your <code xmlns=
2542: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2543: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2544:
2545: <p>If you have the actual pkgsrc tree mounted via NFS
2546: from a different host, please make sure to set
1.14 xtraeme 2547: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2548: directory, as it appears that IRIX linker occasionally
1.47 reed 2549: runs into issues when trying to link over a
2550: network-mounted file system.</p>
1.1 grant 2551:
2552: <p>The bootstrapping process should set all the right
2553: options for programs such as imake(1), but you may want
2554: to set some options depending on your local setup.
1.45 wiz 2555: Please see <code xmlns=
2556: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2557: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2558: course, your compiler's man pages for details.</p>
1.22 tv 2559:
2560: <p>If you are using SGI's MIPSPro compiler, please
2561: set</p>
2562: <pre class="programlisting">
1.51 rillig 2563: PKGSRC_COMPILER= mipspro
1.22 tv 2564: </pre>
2565:
1.45 wiz 2566: <p>in <code xmlns=
2567: "http://www.w3.org/TR/xhtml1/transitional" class=
2568: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2569: assume you are using gcc and may end up passing invalid
2570: flags to the compiler. Note that bootstrap should
2571: create an appropriate <code xmlns=
2572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2573: "filename">mk.conf.example</code> by default.</p>
2574:
2575: <p>If you have both the MIPSPro compiler chain
2576: installed as well as gcc, but want to make sure that
2577: MIPRPro is used, please set your <code class=
2578: "varname">PATH</code> to <span class=
2579: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2580: gcc (often <code xmlns=
2581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2582: "filename">/usr/freeware/bin</code>), and (important)
2583: pass the '--preserve-path' flag.</p>
1.1 grant 2584: </div>
2585:
1.55 rillig 2586: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2587: <div class="titlepage">
2588: <div>
2589: <div>
1.55 rillig 2590: <h3 class="title"><a name="linux" id=
1.30 wiz 2591: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2592: </div>
2593: </div>
2594: </div>
2595:
2596: <p>Some versions of Linux (for example Debian
2597: GNU/Linux) need either libtermcap or libcurses
2598: (libncurses). Installing the distributions
2599: libncurses-dev package (or equivalent) should fix the
2600: problem.</p>
2601:
2602: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2603: and icc (Intel C++ Compiler). gcc is the default. icc
2604: 8.0 and 8.1 on i386 have been tested.</p>
2605:
2606: <p>To bootstrap using icc, assuming the default icc
2607: installation directory:</p>
2608: <pre class="programlisting">
1.51 rillig 2609: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2610: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2611: </pre>
2612:
2613: <div class="note" style=
2614: "margin-left: 0.5in; margin-right: 0.5in;">
2615: <h3 class="title">Note</h3>
2616:
2617: <p>icc 8.1 needs the `-i-static' argument instead of
2618: -static-libcxa.</p>
2619: </div>
2620:
2621: <p>icc supports __attribute__, but the GNU configure
2622: test uses a nested function, which icc does not
2623: support. #undef'ing __attribute__ has the unfortunate
2624: side-effect of breaking many of the Linux header files,
2625: which cannot be compiled properly without
2626: __attribute__. The test must be overridden so that
2627: __attribute__ is assumed supported by the compiler.</p>
2628:
2629: <p>After bootstrapping, you should set <code class=
1.45 wiz 2630: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2631: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2632: "filename">/etc/mk.conf</code>:</p>
2633: <pre class="programlisting">
1.51 rillig 2634: PKGSRC_COMPILER= icc
1.22 tv 2635: </pre>
2636:
2637: <p>The default installation directory for icc is
1.45 wiz 2638: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2639: class="filename">/opt/intel_cc_80</code>, which is also
2640: the pkgsrc default. If you have installed it into a
2641: different directory, set <code class=
2642: "varname">ICCBASE</code> in <code xmlns=
2643: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2644: "filename">/etc/mk.conf</code>:</p>
2645: <pre class="programlisting">
1.51 rillig 2646: ICCBASE= /opt/icc
1.22 tv 2647: </pre>
2648:
2649: <p>pkgsrc uses the static linking method of the runtime
2650: libraries provided by icc, so binaries can be run on
2651: other systems which do not have the shared libraries
2652: installed.</p>
2653:
2654: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2655: the <a href=
2656: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2657: <span class="citerefentry"><span class=
2658: "refentrytitle">ld</span>(1)</span></a> command run
2659: when linking a C++ shared library and records it,
2660: throwing away the -Bstatic and -Bdynamic options
2661: interspersed between the libraries. This means that
2662: libtool-linked C++ shared libraries will have a runtime
2663: dependency on the icc libraries until this is fixed in
2664: libtool.</p>
1.22 tv 2665: </div>
2666:
1.55 rillig 2667: <div class="sect2" lang="en" xml:lang="en">
1.22 tv 2668: <div class="titlepage">
2669: <div>
2670: <div>
1.55 rillig 2671: <h3 class="title"><a name="openbsd" id=
1.30 wiz 2672: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2673: </div>
2674: </div>
2675: </div>
2676:
2677: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2678:
2679: <p>Care should be taken so that the tools that this kit
2680: installs do not conflict with the OpenBSD userland
2681: tools. There are several steps:</p>
2682:
2683: <div class="orderedlist">
2684: <ol type="1">
2685: <li>
2686: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2687: <code xmlns=
2688: "http://www.w3.org/TR/xhtml1/transitional" class=
2689: "filename">/var/db/pkg</code>. It is therefore
2690: recommended that you choose a different location
2691: (e.g. <code xmlns=
2692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2693: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2694: --pkgdbdir option to the bootstrap script.</p>
2695: </li>
2696:
2697: <li>
2698: <p>If you do not intend to use the OpenBSD ports
2699: tools, it's probably a good idea to move them out
2700: of the way to avoid confusion, e.g.</p>
2701: <pre class="screen">
1.14 xtraeme 2702: <code class="prompt">#</code> <strong class=
2703: "userinput"><code>cd /usr/sbin</code></strong>
2704: <code class="prompt">#</code> <strong class=
2705: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2706: <code class="prompt">#</code> <strong class=
2707: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2708: <code class="prompt">#</code> <strong class=
2709: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2710: <code class="prompt">#</code> <strong class=
2711: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2712: </pre>
2713: </li>
2714:
2715: <li>
1.45 wiz 2716: <p>An example <code xmlns=
2717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2718: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2719: placed in <code xmlns=
2720: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2721: "filename">/etc/mk.conf.example</code> file when
2722: you use the bootstrap script. OpenBSD's make
1.45 wiz 2723: program uses <code xmlns=
2724: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2725: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2726: work around this by enclosing all the
2727: pkgsrc-specific parts of the file with:</p>
1.1 grant 2728: <pre class="programlisting">
1.51 rillig 2729: .ifdef BSD_PKG_MK
2730: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2731: .else
2732: # OpenBSD stuff
2733: .endif
1.1 grant 2734: </pre>
2735: </li>
2736: </ol>
2737: </div>
2738: </div>
2739:
1.55 rillig 2740: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2741: <div class="titlepage">
2742: <div>
2743: <div>
1.55 rillig 2744: <h3 class="title"><a name="solaris" id=
1.30 wiz 2745: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2746: </div>
2747: </div>
2748: </div>
2749:
2750: <p>Solaris 2.6 through 9 are supported on both x86 and
2751: sparc. You will need a working C compiler. Both gcc
2752: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2753:
2754: <p>The following packages are required on Solaris 8 for
2755: the bootstrap process and to build packages.</p>
2756:
2757: <div class="itemizedlist">
2758: <ul type="disc">
2759: <li>
2760: <p>SUNWsprot</p>
2761: </li>
2762:
2763: <li>
2764: <p>SUNWarc</p>
2765: </li>
2766:
2767: <li>
2768: <p>SUNWbtool</p>
2769: </li>
2770:
2771: <li>
2772: <p>SUNWtoo</p>
2773: </li>
2774:
2775: <li>
2776: <p>SUNWlibm</p>
2777: </li>
2778: </ul>
2779: </div>
2780:
2781: <p>Please note the use of GNU binutils on Solaris is
2782: <span class="emphasis"><em>not</em></span>
2783: supported.</p>
2784:
1.55 rillig 2785: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2786: <div class="titlepage">
2787: <div>
2788: <div>
1.55 rillig 2789: <h4 class="title"><a name="solaris-gcc-note"
2790: id="solaris-gcc-note"></a>3.2.7.1. If you
2791: are using gcc</h4>
1.1 grant 2792: </div>
2793: </div>
2794: </div>
2795:
2796: <p>It makes life much simpler if you only use the
2797: same gcc consistently for building all packages.</p>
2798:
2799: <p>It is recommended that an external gcc be used
2800: only for bootstrapping, then either build gcc from
2801: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2802: href=
2803: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2804: target="_top"><code xmlns="" class=
2805: "filename">lang/gcc</code></a> or install a binary
2806: gcc package, then remove gcc used during
1.20 ben 2807: bootstrapping.</p>
1.1 grant 2808:
2809: <p>Binary packages of gcc can be found through
2810: <a href=
2811: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2812: target=
2813: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2814: </div>
2815:
1.55 rillig 2816: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2817: <div class="titlepage">
2818: <div>
2819: <div>
1.30 wiz 2820: <h4 class="title"><a name=
1.55 rillig 2821: "solaris-sun-workshop-note" id=
1.30 wiz 2822: "solaris-sun-workshop-note"></a>3.2.7.2. If
2823: you are using Sun WorkShop</h4>
1.1 grant 2824: </div>
2825: </div>
2826: </div>
2827:
2828: <p>You will need at least the following packages
2829: installed (from WorkShop 5.0)</p>
2830:
2831: <div class="itemizedlist">
2832: <ul type="disc">
2833: <li>
2834: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2835: </li>
2836:
2837: <li>
2838: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2839: </li>
2840:
2841: <li>
2842: <p>SPROild - Sun WorkShop Incremental
2843: Linker</p>
2844: </li>
2845:
2846: <li>
2847: <p>SPROlang - Sun WorkShop Compilers common
2848: components</p>
2849: </li>
2850: </ul>
2851: </div>
2852:
1.14 xtraeme 2853: <p>You should set <code class="varname">CC</code>,
2854: <code class="varname">CXX</code> and optionally,
1.45 wiz 2855: <code class="varname">CPP</code> in <code xmlns=
2856: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2857: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2858: <pre class="programlisting">
1.51 rillig 2859: CC= cc
2860: CXX= CC
2861: CPP= /usr/ccs/lib/cpp
1.1 grant 2862: </pre>
2863:
2864: <p>You may also want to build 64-bit binaries,
1.47 reed 2865: e.g.:</p>
1.1 grant 2866: <pre class="programlisting">
1.51 rillig 2867: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2868: </pre>
2869:
2870: <p>Whichever compiler you use, please ensure the
2871: compiler tools and your $prefix are in your
1.14 xtraeme 2872: <code class="varname">PATH</code>. This includes
1.45 wiz 2873: <code xmlns=
2874: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2875: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2876: <code xmlns=
2877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2878: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2879: </div>
2880: </div>
2881: </div>
2882: </div>
2883:
1.55 rillig 2884: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 2885: <div class="titlepage">
2886: <div>
2887: <div>
1.55 rillig 2888: <h2 class="title"><a name="using" id=
1.1 grant 2889: "using"></a>Chapter 4. Using pkgsrc</h2>
2890: </div>
2891: </div>
2892: </div>
2893:
2894: <div class="toc">
2895: <p><b>Table of Contents</b></p>
2896:
2897: <dl>
2898: <dt><span class="sect1"><a href="#getting-started">4.1.
2899: Working with binary packages</a></span></dt>
2900:
2901: <dd>
2902: <dl>
1.30 wiz 2903: <dt><span class="sect2"><a href=
2904: "#where-to-get-binary-packages">4.1.1. Where to get
2905: binary packages</a></span></dt>
1.1 grant 2906:
1.30 wiz 2907: <dt><span class="sect2"><a href=
2908: "#how-to-use-binary-packages">4.1.2. How to use
2909: binary packages</a></span></dt>
1.1 grant 2910:
1.30 wiz 2911: <dt><span class="sect2"><a href=
2912: "#a-word-of-warning">4.1.3. A word of
2913: warning</a></span></dt>
1.1 grant 2914: </dl>
2915: </dd>
2916:
1.30 wiz 2917: <dt><span class="sect1"><a href=
2918: "#building-packages-from-source">4.2. Building packages
2919: from source</a></span></dt>
1.1 grant 2920:
2921: <dd>
2922: <dl>
1.30 wiz 2923: <dt><span class="sect2"><a href=
2924: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2925:
1.30 wiz 2926: <dt><span class="sect2"><a href=
2927: "#fetching-distfiles">4.2.2. Fetching
2928: distfiles</a></span></dt>
1.1 grant 2929:
1.30 wiz 2930: <dt><span class="sect2"><a href=
2931: "#how-to-build-and-install">4.2.3. How to build and
2932: install</a></span></dt>
1.1 grant 2933:
1.30 wiz 2934: <dt><span class="sect2"><a href=
2935: "#selecting-the-compiler">4.2.4. Selecting the
2936: compiler</a></span></dt>
1.1 grant 2937: </dl>
2938: </dd>
2939: </dl>
2940: </div>
2941:
1.55 rillig 2942: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 2943: <div class="titlepage">
2944: <div>
2945: <div>
2946: <h2 class="title" style="clear: both"><a name=
1.55 rillig 2947: "getting-started" id=
1.1 grant 2948: "getting-started"></a>4.1. Working with binary
2949: packages</h2>
2950: </div>
2951: </div>
2952: </div>
2953:
2954: <p>This section describes how to find, retrieve and
2955: install a precompiled binary package that someone else
2956: already prepared for your type of machine.</p>
2957:
1.55 rillig 2958: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2959: <div class="titlepage">
2960: <div>
2961: <div>
1.30 wiz 2962: <h3 class="title"><a name=
1.55 rillig 2963: "where-to-get-binary-packages" id=
1.30 wiz 2964: "where-to-get-binary-packages"></a>4.1.1. Where
2965: to get binary packages</h3>
1.1 grant 2966: </div>
2967: </div>
2968: </div>
2969:
2970: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2971: and its mirrors in the directory <code xmlns=
2972: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2973: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2974: for anonymous FTP access. <code class=
2975: "varname">OSVERSION</code> is the NetBSD version
2976: (<span><strong class="command">uname
2977: -r</strong></span>), <code class="varname">ARCH</code>
2978: is the architecture (<span><strong class=
2979: "command">uname -p</strong></span>). In that directory,
2980: there is a subdirectory for each category plus a
1.45 wiz 2981: subdirectory <code xmlns=
2982: "http://www.w3.org/TR/xhtml1/transitional" class=
2983: "filename">All</code> which includes the actual
2984: binaries in <code xmlns=
2985: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2986: "filename">.tgz</code> files. The category
2987: subdirectories use symbolic links to those files (this
1.45 wiz 2988: is the same directory layout as in <code xmlns=
2989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2990: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2991:
1.47 reed 2992: <p>This same directory layout applies for CD-ROM
1.1 grant 2993: distributions, only that the directory may be rooted
1.45 wiz 2994: somewhere else, probably somewhere below <code xmlns=
2995: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2996: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 2997: documentation for the exact location.</p>
2998: </div>
2999:
1.55 rillig 3000: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3001: <div class="titlepage">
3002: <div>
3003: <div>
1.30 wiz 3004: <h3 class="title"><a name=
1.55 rillig 3005: "how-to-use-binary-packages" id=
1.30 wiz 3006: "how-to-use-binary-packages"></a>4.1.2. How
3007: to use binary packages</h3>
1.1 grant 3008: </div>
3009: </div>
3010: </div>
3011:
1.47 reed 3012: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3013: to your hard disk, you can install them with the
1.27 rillig 3014: following command (be sure to <span><strong class=
1.14 xtraeme 3015: "command">su</strong></span> to root first):</p>
1.1 grant 3016: <pre class="screen">
1.14 xtraeme 3017: <code class="prompt">#</code> <strong class=
3018: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3019: </pre>
3020:
3021: <p>If you have FTP access and you don't want to
3022: download the packages via FTP prior to installation,
1.14 xtraeme 3023: you can do this automatically by giving
3024: <span><strong class="command">pkg_add</strong></span>
3025: an FTP URL:</p>
1.1 grant 3026: <pre class="screen">
1.14 xtraeme 3027: <code class="prompt">#</code> <strong class=
1.27 rillig 3028: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3029: </pre>
3030:
1.27 rillig 3031: <p>Note that any prerequisite packages needed to run
3032: the package in question will be installed, too,
1.1 grant 3033: assuming they are present where you install from.</p>
3034:
1.23 wiz 3035: <p>To save some typing, you can set the <code class=
3036: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3037: semicolon-separated list of paths (including remote
1.23 wiz 3038: URLs); trailing slashes are not allowed.</p>
3039:
1.45 wiz 3040: <p>Additionally to the <code xmlns=
3041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3042: "filename">All</code> directory there exists a
1.45 wiz 3043: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3044: class="filename">vulnerable</code> directory to which
3045: binary packages with known vulnerabilities are moved,
3046: since removing them could cause missing dependencies.
3047: To use these packages, add the <code xmlns=
3048: "http://www.w3.org/TR/xhtml1/transitional" class=
3049: "filename">vulnerable</code> directory to your
3050: <code class="varname">PKG_PATH</code>. However, you
3051: should run <a xmlns=
1.23 wiz 3052: "http://www.w3.org/TR/xhtml1/transitional" href=
3053: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3054: target="_top"><code xmlns="" class=
3055: "filename">security/audit-packages</code></a>
1.47 reed 3056: regularly, especially after installing new packages,
3057: and verify that the vulnerabilities are acceptable for
3058: your configuration. An example <code class=
3059: "varname">PKG_PATH</code> would be: <code xmlns=
3060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3061: "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 3062: Please note that semicolon (';') is a shell
3063: meta-character, so you'll probably have to quote
3064: it.</p>
3065:
1.1 grant 3066: <p>After you've installed packages, be sure to have
1.45 wiz 3067: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3068: class="filename">/usr/pkg/bin</code> and <code xmlns=
3069: "http://www.w3.org/TR/xhtml1/transitional" class=
3070: "filename">/usr/pkg/sbin</code> in your <code class=
3071: "varname">PATH</code> so you can actually start the
3072: just installed program.</p>
1.1 grant 3073: </div>
3074:
1.55 rillig 3075: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3076: <div class="titlepage">
3077: <div>
3078: <div>
1.55 rillig 3079: <h3 class="title"><a name="a-word-of-warning" id=
1.30 wiz 3080: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3081: warning</h3>
3082: </div>
3083: </div>
3084: </div>
3085:
3086: <p>Please pay very careful attention to the warnings
3087: expressed in the <a href=
3088: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3089: <span class="citerefentry"><span class=
3090: "refentrytitle">pkg_add</span>(1)</span></a> manual
3091: page about the inherent dangers of installing binary
3092: packages which you did not create yourself, and the
3093: security holes that can be introduced onto your system
3094: by indiscriminate adding of such files.</p>
3095: </div>
3096: </div>
3097:
1.55 rillig 3098: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3099: <div class="titlepage">
3100: <div>
3101: <div>
3102: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3103: "building-packages-from-source" id=
1.30 wiz 3104: "building-packages-from-source"></a>4.2. Building
1.1 grant 3105: packages from source</h2>
3106: </div>
3107: </div>
3108: </div>
3109:
3110: <p>This assumes that the package is already in pkgsrc. If
3111: it is not, see <a href="#developers-guide" title=
1.46 gdt 3112: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3113: “The pkgsrc developer's guide”</a> for
3114: instructions how to create your own packages.</p>
1.1 grant 3115:
1.55 rillig 3116: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3117: <div class="titlepage">
3118: <div>
3119: <div>
1.55 rillig 3120: <h3 class="title"><a name="requirements" id=
1.30 wiz 3121: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3122: </div>
3123: </div>
3124: </div>
3125:
3126: <p>To build packages from source on a NetBSD system the
3127: “<span class="quote">comp</span>” and the
3128: “<span class="quote">text</span>”
3129: distribution sets must be installed. If you want to
1.47 reed 3130: build X11-related packages the “<span class=
1.1 grant 3131: "quote">xbase</span>” and “<span class=
3132: "quote">xcomp</span>” distribution sets are
3133: required, too.</p>
3134: </div>
3135:
1.55 rillig 3136: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3137: <div class="titlepage">
3138: <div>
3139: <div>
1.55 rillig 3140: <h3 class="title"><a name="fetching-distfiles"
3141: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3142: distfiles</h3>
3143: </div>
3144: </div>
3145: </div>
3146:
1.27 rillig 3147: <p>The first step for building a package is downloading
3148: the distfiles (i.e. the unmodified source). If they
3149: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3150: automatically.</p>
3151:
3152: <p>You can overwrite some of the major distribution
3153: sites to fit to sites that are close to your own. Have
1.45 wiz 3154: a look at <code xmlns=
3155: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3156: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3157: some examples — in particular, look for the
1.14 xtraeme 3158: <code class="varname">MASTER_SORT</code>, <code class=
3159: "varname">MASTER_SORT_REGEX</code> and <code class=
3160: "varname">INET_COUNTRY</code> definitions. This may
3161: save some of your bandwidth and time.</p>
1.1 grant 3162:
3163: <p>You can change these settings either in your shell's
3164: environment, or, if you want to keep the settings, by
1.45 wiz 3165: editing the <code xmlns=
3166: "http://www.w3.org/TR/xhtml1/transitional" class=
3167: "filename">/etc/mk.conf</code> file, and adding the
3168: definitions there.</p>
1.1 grant 3169:
3170: <p>If you don't have a permanent Internet connection
3171: and you want to know which files to download,
1.14 xtraeme 3172: <span><strong class="command">make
3173: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3174: need. Put these distfiles into <code xmlns=
3175: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3176: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3177: </div>
3178:
1.55 rillig 3179: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3180: <div class="titlepage">
3181: <div>
3182: <div>
1.30 wiz 3183: <h3 class="title"><a name=
1.55 rillig 3184: "how-to-build-and-install" id=
1.30 wiz 3185: "how-to-build-and-install"></a>4.2.3. How to
3186: build and install</h3>
1.1 grant 3187: </div>
3188: </div>
3189: </div>
3190:
3191: <p>Assuming that the distfile has been fetched (see
3192: previous section), become root and change into the
1.47 reed 3193: relevant directory and run <span><strong class=
3194: "command">make</strong></span>.</p>
3195:
3196: <div class="note" style=
3197: "margin-left: 0.5in; margin-right: 0.5in;">
3198: <h3 class="title">Note</h3>
3199:
3200: <p>If using bootstrap or pkgsrc on a non-NetBSD
3201: system, use the pkgsrc <span><strong class=
3202: "command">bmake</strong></span> command instead of
3203: “<span class="quote">make</span>” in the
3204: examples in this guide.</p>
3205: </div>
3206:
3207: <p>For example, type</p>
1.1 grant 3208: <pre class="screen">
1.14 xtraeme 3209: <code class="prompt">%</code> <strong class=
3210: "userinput"><code>cd misc/figlet</code></strong>
3211: <code class="prompt">%</code> <strong class=
3212: "userinput"><code>make</code></strong>
1.1 grant 3213: </pre>
3214:
3215: <p>at the shell prompt to build the various components
3216: of the package, and</p>
3217: <pre class="screen">
1.14 xtraeme 3218: <code class="prompt">#</code> <strong class=
3219: "userinput"><code>make install</code></strong>
1.1 grant 3220: </pre>
3221:
3222: <p>to install the various components into the correct
3223: places on your system. Installing the package on your
3224: system requires you to be root. However, pkgsrc has a
3225: <span class="emphasis"><em>just-in-time-su</em></span>
3226: feature, which allows you to only become root for the
3227: actual installation step</p>
3228:
3229: <p>Taking the figlet utility as an example, we can
3230: install it on our system by building as shown in
3231: <a href="#logs" title=
1.55 rillig 3232: "Appendix B. Build logs">Appendix B, <i>Build
3233: logs</i></a>.</p>
1.1 grant 3234:
3235: <p>The program is installed under the default root of
1.45 wiz 3236: the packages tree - <code xmlns=
3237: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3238: "filename">/usr/pkg</code>. Should this not conform to
3239: your tastes, set the <code class=
3240: "varname">LOCALBASE</code> variable in your
1.1 grant 3241: environment, and it will use that value as the root of
1.45 wiz 3242: your packages tree. So, to use <code xmlns=
3243: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3244: "filename">/usr/local</code>, set <code class=
3245: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3246: environment. Please note that you should use a
3247: directory which is dedicated to packages and not shared
1.47 reed 3248: with other programs (i.e., do not try and use
1.14 xtraeme 3249: <code class="varname">LOCALBASE=/usr</code>). Also, you
3250: should not try to add any of your own files or
1.45 wiz 3251: directories (such as <code xmlns=
3252: "http://www.w3.org/TR/xhtml1/transitional" class=
3253: "filename">src/</code>, <code xmlns=
3254: "http://www.w3.org/TR/xhtml1/transitional" class=
3255: "filename">obj/</code>, or <code xmlns=
3256: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3257: "filename">pkgsrc/</code>) below the <code class=
3258: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3259: possible conflicts between programs and other files
3260: installed by the package system and whatever else may
3261: have been installed there.</p>
3262:
1.45 wiz 3263: <p>Some packages look in <code xmlns=
3264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3265: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3266: configuration options at build time. Have a look at
1.45 wiz 3267: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3268: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3269: get an overview of what will be set there by default.
1.14 xtraeme 3270: Environment variables such as <code class=
1.45 wiz 3271: "varname">LOCALBASE</code> can be set in <code xmlns=
3272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3273: "filename">/etc/mk.conf</code> to save having to
3274: remember to set them each time you want to use
3275: pkgsrc.</p>
1.1 grant 3276:
3277: <p>Occasionally, people want to “<span class=
3278: "quote">look under the covers</span>” to see what
3279: is going on when a package is building or being
3280: installed. This may be for debugging purposes, or out
3281: of simple curiosity. A number of utility values have
3282: been added to help with this.</p>
3283:
3284: <div class="orderedlist">
3285: <ol type="1">
3286: <li>
3287: <p>If you invoke the <a href=
3288: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3289: <span class="citerefentry"><span class=
3290: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3291: with <code class=
3292: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3293: amount of information will be displayed. For
3294: example,</p>
1.1 grant 3295: <pre class="screen">
1.14 xtraeme 3296: <strong class=
3297: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3298: </pre>
3299:
3300: <p>will show all the commands that are invoked,
3301: up to and including the “<span class=
3302: "quote">patch</span>” stage.</p>
3303: </li>
3304:
3305: <li>
3306: <p>If you want to know the value of a certain
1.22 tv 3307: <a href=
3308: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3309: <span class="citerefentry"><span class=
3310: "refentrytitle">make</span>(1)</span></a>
3311: definition, then the <code class=
1.14 xtraeme 3312: "varname">VARNAME</code> definition should be
3313: used, in conjunction with the show-var target.
3314: e.g. to show the expansion of the <a href=
1.1 grant 3315: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3316: <span class="citerefentry"><span class=
3317: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3318: variable <code class=
1.22 tv 3319: "varname">LOCALBASE</code>:</p>
1.1 grant 3320: <pre class="screen">
1.14 xtraeme 3321: <code class="prompt">%</code> <strong class=
3322: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3323: /usr/pkg
1.14 xtraeme 3324: <code class="prompt">%</code>
1.1 grant 3325:
3326: </pre>
3327: </li>
3328: </ol>
3329: </div>
3330:
3331: <p>If you want to install a binary package that you've
3332: either created yourself (see next section), that you
3333: put into pkgsrc/packages manually or that is located on
1.8 wiz 3334: a remote FTP server, you can use the "bin-install"
1.1 grant 3335: target. This target will install a binary package - if
3336: available - via <a href=
3337: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3338: <span class="citerefentry"><span class=
3339: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3340: <span><strong class="command">make
3341: package</strong></span>. The list of remote FTP sites
3342: searched is kept in the variable <code class=
3343: "varname">BINPKG_SITES</code>, which defaults to
3344: ftp.NetBSD.org. Any flags that should be added to
3345: <a href=
1.1 grant 3346: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3347: <span class="citerefentry"><span class=
3348: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3349: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3350: See <code xmlns=
3351: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3352: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3353: details.</p>
1.1 grant 3354:
1.47 reed 3355: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3356: has a non-standard setting for <code class=
3357: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3358: any packages are installed, as you can not use several
3359: directories for the same purpose. Doing so will result
3360: in pkgsrc not being able to properly detect your
3361: installed packages, and fail miserably. Note also that
3362: precompiled binary packages are usually built with the
1.14 xtraeme 3363: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3364: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3365: class="filename">/usr/pkg</code>, and that you should
3366: <span class="emphasis"><em>not</em></span> install any
3367: if you use a non-standard <code class=
1.14 xtraeme 3368: "varname">LOCALBASE</code>.</p>
1.1 grant 3369: </div>
3370:
1.55 rillig 3371: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3372: <div class="titlepage">
3373: <div>
3374: <div>
1.30 wiz 3375: <h3 class="title"><a name=
1.55 rillig 3376: "selecting-the-compiler" id=
1.30 wiz 3377: "selecting-the-compiler"></a>4.2.4. Selecting
3378: the compiler</h3>
1.1 grant 3379: </div>
3380: </div>
3381: </div>
3382:
3383: <p>By default, pkgsrc will use GCC to build packages.
3384: This may be overridden by setting the following
3385: variables in /etc/mk.conf:</p>
3386:
3387: <div class="variablelist">
3388: <dl>
1.14 xtraeme 3389: <dt><span class="term"><code class=
3390: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3391:
3392: <dd>
3393: <p>This is a list of values specifying the chain
3394: of compilers to invoke when building packages.
3395: Valid values are:</p>
3396:
3397: <div class="itemizedlist">
3398: <ul type="disc">
3399: <li>
1.14 xtraeme 3400: <p><code class="varname">distcc</code>:
1.1 grant 3401: distributed C/C++ (chainable)</p>
3402: </li>
3403:
3404: <li>
1.14 xtraeme 3405: <p><code class="varname">ccache</code>:
1.1 grant 3406: compiler cache (chainable)</p>
3407: </li>
3408:
3409: <li>
1.14 xtraeme 3410: <p><code class="varname">gcc</code>: GNU
3411: C/C++ Compiler</p>
1.1 grant 3412: </li>
3413:
3414: <li>
1.14 xtraeme 3415: <p><code class="varname">mipspro</code>:
1.1 grant 3416: Silicon Graphics, Inc. MIPSpro
3417: (n32/n64)</p>
3418: </li>
3419:
3420: <li>
1.14 xtraeme 3421: <p><code class="varname">mipspro</code>:
1.1 grant 3422: Silicon Graphics, Inc. MIPSpro (o32)</p>
3423: </li>
3424:
3425: <li>
1.14 xtraeme 3426: <p><code class="varname">sunpro</code>:
1.1 grant 3427: Microsystems, Inc. WorkShip/Forte/Sun ONE
3428: Studio</p>
3429: </li>
3430: </ul>
3431: </div>
3432:
3433: <p>The default is “<span class=
1.14 xtraeme 3434: "quote"><code class=
3435: "varname">gcc</code></span>”. You can use
3436: <code class="varname">ccache</code> and/or
3437: <code class="varname">distcc</code> with an
3438: appropriate <code class=
3439: "varname">PKGSRC_COMPILER</code> setting, e.g.
3440: “<span class="quote"><code class=
3441: "varname">ccache gcc</code></span>”. This
1.1 grant 3442: variable should always be terminated with a value
3443: for a real compiler.</p>
3444: </dd>
3445:
1.14 xtraeme 3446: <dt><span class="term"><code class=
3447: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3448:
3449: <dd>
3450: <p>This specifies the minimum version of GCC to
3451: use when building packages. If the system GCC
3452: doesn't satisfy this requirement, then pkgsrc
3453: will build and install one of the GCC packages to
3454: use instead.</p>
3455: </dd>
3456: </dl>
3457: </div>
3458: </div>
3459: </div>
3460: </div>
3461:
1.55 rillig 3462: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 3463: <div class="titlepage">
3464: <div>
3465: <div>
1.55 rillig 3466: <h2 class="title"><a name="configuring" id=
1.38 dillo 3467: "configuring"></a>Chapter 5. Configuring
3468: pkgsrc</h2>
3469: </div>
3470: </div>
3471: </div>
3472:
3473: <div class="toc">
3474: <p><b>Table of Contents</b></p>
3475:
3476: <dl>
3477: <dt><span class="sect1"><a href=
1.45 wiz 3478: "#general-configuration">5.1. General
3479: configuration</a></span></dt>
3480:
3481: <dt><span class="sect1"><a href=
3482: "#variables-affecting-build">5.2. Variables affecting
3483: the build process</a></span></dt>
3484:
3485: <dt><span class="sect1"><a href=
3486: "#developer-advanced-settings">5.3. Developer/advanced
3487: settings</a></span></dt>
3488:
3489: <dt><span class="sect1"><a href=
3490: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3491: Options</a></span></dt>
1.38 dillo 3492: </dl>
3493: </div>
3494:
1.55 rillig 3495: <div class="sect1" lang="en" xml:lang="en">
1.38 dillo 3496: <div class="titlepage">
3497: <div>
3498: <div>
3499: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3500: "general-configuration" id=
1.45 wiz 3501: "general-configuration"></a>5.1. General
3502: configuration</h2>
3503: </div>
3504: </div>
3505: </div>
3506:
1.47 reed 3507: <p>In this section, you can find some variables that
3508: apply to all pkgsrc packages. The preferred method of
3509: setting these variables is by setting them in
3510: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3511: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3512:
3513: <div class="itemizedlist">
3514: <ul type="disc">
3515: <li>
3516: <p><code class="varname">LOCALBASE</code>: Where
3517: packages will be installed. The default is
3518: <code xmlns=
3519: "http://www.w3.org/TR/xhtml1/transitional" class=
3520: "filename">/usr/pkg</code>. Do not mix binary
3521: packages with different <code class=
3522: "varname">LOCALBASE</code>s!</p>
3523: </li>
3524:
3525: <li>
3526: <p><code class="varname">CROSSBASE</code>: Where
3527: “<span class="quote">cross</span>”
3528: category packages will be installed. The default is
3529: <code xmlns=
3530: "http://www.w3.org/TR/xhtml1/transitional" class=
3531: "filename">${LOCALBASE}/cross</code>.</p>
3532: </li>
3533:
3534: <li>
3535: <p><code class="varname">X11BASE</code>: Where X11
3536: is installed on the system. The default is
3537: <code xmlns=
3538: "http://www.w3.org/TR/xhtml1/transitional" class=
3539: "filename">/usr/X11R6</code>.</p>
3540: </li>
3541:
3542: <li>
3543: <p><code class="varname">DISTDIR</code>: Where to
3544: store the downloaded copies of the original source
3545: distributions used for building pkgsrc packages.
3546: The default is <code xmlns=
3547: "http://www.w3.org/TR/xhtml1/transitional" class=
3548: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3549: </li>
3550:
3551: <li>
3552: <p><code class=
3553: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3554: override the packages' <code class=
3555: "varname">MASTER_SITES</code> with this value.</p>
3556: </li>
3557:
3558: <li>
3559: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3560: Backup location(s) for distribution files and patch
3561: files if not found locally or in <code xmlns=
3562: "http://www.w3.org/TR/xhtml1/transitional" class=
3563: "filename">${MASTER_SITES}</code> or <code xmlns=
3564: "http://www.w3.org/TR/xhtml1/transitional" class=
3565: "filename">${PATCH_SITES}</code> respectively. The
3566: defaults are <code xmlns=
3567: "http://www.w3.org/TR/xhtml1/transitional" class=
3568: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3569: and <code xmlns=
3570: "http://www.w3.org/TR/xhtml1/transitional" class=
3571: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3572: </li>
3573:
3574: <li>
3575: <p><code class="varname">BINPKG_SITES</code>: List
3576: of sites carrying binary pkgs.</p>
3577: </li>
3578: </ul>
3579: </div>
3580: </div>
3581:
1.55 rillig 3582: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3583: <div class="titlepage">
3584: <div>
3585: <div>
3586: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3587: "variables-affecting-build" id=
1.45 wiz 3588: "variables-affecting-build"></a>5.2. Variables
3589: affecting the build process</h2>
3590: </div>
3591: </div>
3592: </div>
3593:
3594: <p>XXX</p>
3595:
3596: <div class="itemizedlist">
3597: <ul type="disc">
3598: <li>
3599: <p><code class="varname">PACKAGES</code>: The top
3600: level directory for the binary packages. The
3601: default is <code xmlns=
3602: "http://www.w3.org/TR/xhtml1/transitional" class=
3603: "filename">${PKGSRCDIR}/packages</code>.</p>
3604: </li>
3605:
3606: <li>
3607: <p><code class="varname">WRKOBJDIR</code>: The top
3608: level directory where, if defined, the separate
3609: working directories will get created, and
3610: symbolically linked to from <code xmlns=
3611: "http://www.w3.org/TR/xhtml1/transitional" class=
3612: "filename">${WRKDIR}</code> (see below). This is
3613: useful for building packages on several
3614: architectures, then <code xmlns=
3615: "http://www.w3.org/TR/xhtml1/transitional" class=
3616: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3617: while <code xmlns=
3618: "http://www.w3.org/TR/xhtml1/transitional" class=
3619: "filename">${WRKOBJDIR}</code> is local to every
3620: architecture. (It should be noted that <code class=
3621: "varname">PKGSRCDIR</code> should not be set by the
3622: user — it is an internal definition which
3623: refers to the root of the pkgsrc tree. It is
3624: possible to have many pkgsrc tree instances.)</p>
3625: </li>
3626:
3627: <li>
3628: <p><code class="varname">LOCALPATCHES</code>:
3629: Directory for local patches that aren't part of
3630: pkgsrc. See <a href="#components.patches" title=
3631: "8.3. patches/*">Section 8.3,
3632: “patches/*”</a> for more information.
3633: <em class="replaceable"><code>rel</code></em> and
3634: <em class="replaceable"><code>arch</code></em> are
3635: replaced with OS release (“<span class=
3636: "quote">2.0</span>”, etc.) and architecture
3637: (“<span class="quote">mipsel</span>”,
3638: etc.).</p>
3639: </li>
3640:
3641: <li>
3642: <p><code class="varname">PKGMAKECONF</code>:
3643: Location of the <code xmlns=
3644: "http://www.w3.org/TR/xhtml1/transitional" class=
3645: "filename">mk.conf</code> file used by a package's
3646: BSD-style Makefile. If this is not set,
3647: <code class="varname">MAKECONF</code> is set to
3648: <code xmlns=
3649: "http://www.w3.org/TR/xhtml1/transitional" class=
3650: "filename">/dev/null</code> to avoid picking up
3651: settings used by builds in <code xmlns=
3652: "http://www.w3.org/TR/xhtml1/transitional" class=
3653: "filename">/usr/src</code>.</p>
3654: </li>
3655: </ul>
3656: </div>
3657: </div>
3658:
1.55 rillig 3659: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3660: <div class="titlepage">
3661: <div>
3662: <div>
3663: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3664: "developer-advanced-settings" id=
1.45 wiz 3665: "developer-advanced-settings"></a>5.3. Developer/advanced
3666: settings</h2>
3667: </div>
3668: </div>
3669: </div>
3670:
3671: <p>XXX</p>
3672:
3673: <div class="itemizedlist">
3674: <ul type="disc">
3675: <li>
3676: <p><code class="varname">PKG_DEVELOPER</code>: Run
3677: some sanity checks that package developers
3678: want:</p>
3679:
3680: <div class="itemizedlist">
3681: <ul type="circle">
3682: <li>
3683: <p>make sure patches apply with zero fuzz</p>
3684: </li>
3685:
3686: <li>
3687: <p>run check-shlibs to see that all binaries
3688: will find their shared libs.</p>
3689: </li>
3690: </ul>
3691: </div>
3692: </li>
3693:
3694: <li>
3695: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3696: The level of debugging output which is displayed
3697: whilst making and installing the package. The
3698: default value for this is 0, which will not display
3699: the commands as they are executed (normal, default,
3700: quiet operation); the value 1 will display all
3701: shell commands before their invocation, and the
3702: value 2 will display both the shell commands before
3703: their invocation, and their actual execution
3704: progress with <span><strong class="command">set
3705: -x</strong></span> will be displayed.</p>
3706: </li>
3707: </ul>
3708: </div>
3709: </div>
3710:
1.55 rillig 3711: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3712: <div class="titlepage">
3713: <div>
3714: <div>
3715: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3716: "selecting-build-options" id=
1.45 wiz 3717: "selecting-build-options"></a>5.4. Selecting
3718: Build Options</h2>
1.38 dillo 3719: </div>
3720: </div>
3721: </div>
3722:
3723: <p>Some packages have build time options, usually to
3724: select between different dependencies, enable optional
3725: support for big dependencies or enable experimental
3726: features.</p>
3727:
3728: <p>To see which options, if any, a package supports, and
3729: which options are mutually exclusive, run
3730: <span><strong class="command">make
3731: show-options</strong></span>, for example:</p>
3732: <pre class="programlisting">
1.51 rillig 3733: The following options are supported by this package:
3734: ssl Enable SSL support.
3735: Exactly one of the following gecko options is required:
3736: firefox Use firefox as gecko rendering engine.
3737: mozilla Use mozilla as gecko rendering engine.
3738: At most one of the following database options may be selected:
3739: mysql Enable support for MySQL database.
3740: pgsql Enable support for PostgreSQL database.
3741:
3742: These options are enabled by default: firefox
3743: These options are currently enabled: mozilla ssl
1.38 dillo 3744: </pre>
3745:
1.45 wiz 3746: <p>The following variables can be defined in <code xmlns=
3747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3748: "filename">/etc/mk.conf</code> to select which options to
3749: enable for a package: <code class=
3750: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3751: to select or disable options for all packages that
3752: support them, and <code class=
3753: "varname">PKG_OPTIONS.<em class=
3754: "replaceable"><code>pkgbase</code></em></code>, which can
3755: be used to select or disable options specifically for
3756: package <em class=
3757: "replaceable"><code>pkgbase</code></em>. Options listed
3758: in these variables are selected, options preceded by
3759: “<span class="quote">-</span>” are
3760: disabled.</p>
3761:
1.39 dillo 3762: <p>The following settings are consulted in the order
3763: given, and the last setting that selects or disables an
3764: option is used:</p>
1.38 dillo 3765:
3766: <div class="orderedlist">
3767: <ol type="1">
3768: <li>
3769: <p>the default options as suggested by the package
3770: maintainer</p>
3771: </li>
3772:
3773: <li>
3774: <p>the options implied by the settings of legacy
3775: variables (see below)</p>
3776: </li>
3777:
3778: <li>
3779: <p><code class=
3780: "varname">PKG_DEFAULT_OPTIONS</code></p>
3781: </li>
3782:
3783: <li>
3784: <p><code class="varname">PKG_OPTIONS.<em class=
3785: "replaceable"><code>pkgbase</code></em></code></p>
3786: </li>
3787: </ol>
3788: </div>
3789:
3790: <p>For groups of mutually exclusive options, the last
3791: option selected is used, all others are automatically
3792: disabled. If an option of the group is explicitly
3793: disabled, the previously selected option, if any, is
3794: used. It is an error if no option from a required group
3795: of options is selected, and building the package will
3796: fail.</p>
3797:
3798: <p>Before the options framework was introduced, build
3799: options were selected by setting a variable in
1.45 wiz 3800: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3801: class="filename">/etc/mk.conf</code> for each option. To
3802: ease transition to the options framework for the user,
3803: these legacy variables are converted to the appropriate
3804: options setting automatically. A warning is issued to
3805: prompt the user to update <code xmlns=
3806: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3807: "filename">/etc/mk.conf</code> to use the options
3808: framework directly. Support for these legacy variables
3809: will be removed eventually.</p>
3810: </div>
3811: </div>
3812:
1.55 rillig 3813: <div class="chapter" lang="en" xml:lang="en">
1.38 dillo 3814: <div class="titlepage">
3815: <div>
3816: <div>
1.55 rillig 3817: <h2 class="title"><a name="binary" id=
1.38 dillo 3818: "binary"></a>Chapter 6. Creating binary
1.1 grant 3819: packages</h2>
3820: </div>
3821: </div>
3822: </div>
3823:
3824: <div class="toc">
3825: <p><b>Table of Contents</b></p>
3826:
3827: <dl>
1.30 wiz 3828: <dt><span class="sect1"><a href=
1.38 dillo 3829: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3830: single binary package</a></span></dt>
1.1 grant 3831:
1.30 wiz 3832: <dt><span class="sect1"><a href=
1.38 dillo 3833: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3834: Settings for creation of binary
3835: packages</a></span></dt>
3836:
1.38 dillo 3837: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3838: a bulk build of all packages</a></span></dt>
3839:
3840: <dd>
3841: <dl>
3842: <dt><span class="sect2"><a href=
1.38 dillo 3843: "#binary.configuration">6.3.1.
1.1 grant 3844: Configuration</a></span></dt>
3845:
1.30 wiz 3846: <dt><span class="sect2"><a href=
1.38 dillo 3847: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3848: environmental considerations</a></span></dt>
1.1 grant 3849:
1.38 dillo 3850: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3851: Operation</a></span></dt>
3852:
1.30 wiz 3853: <dt><span class="sect2"><a href=
1.38 dillo 3854: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3855:
1.30 wiz 3856: <dt><span class="sect2"><a href=
1.38 dillo 3857: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3858: requirements</a></span></dt>
1.1 grant 3859:
1.30 wiz 3860: <dt><span class="sect2"><a href=
1.38 dillo 3861: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3862: for chrooted builds</a></span></dt>
1.1 grant 3863:
1.30 wiz 3864: <dt><span class="sect2"><a href=
1.38 dillo 3865: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3866: set of packages</a></span></dt>
1.13 hubertf 3867:
3868: <dt><span class="sect2"><a href=
1.38 dillo 3869: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3870: build</a></span></dt>
1.1 grant 3871: </dl>
3872: </dd>
3873:
1.38 dillo 3874: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3875: Creating a multiple CD-ROM packages
3876: collection</a></span></dt>
3877:
3878: <dd>
3879: <dl>
1.30 wiz 3880: <dt><span class="sect2"><a href=
1.38 dillo 3881: "#cdpack-example">6.4.1. Example of
1.30 wiz 3882: cdpack</a></span></dt>
1.1 grant 3883: </dl>
3884: </dd>
3885: </dl>
3886: </div>
3887:
1.55 rillig 3888: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3889: <div class="titlepage">
3890: <div>
3891: <div>
3892: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3893: "building-a-single-binary-package" id=
1.38 dillo 3894: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3895: a single binary package</h2>
1.1 grant 3896: </div>
3897: </div>
3898: </div>
3899:
3900: <p>Once you have built and installed a package, you can
3901: create a <span class="emphasis"><em>binary
3902: package</em></span> which can be installed on another
3903: system with <a href=
3904: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3905: <span class="citerefentry"><span class=
1.47 reed 3906: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3907: having to build the same package on a group of hosts and
3908: wasting CPU time. It also provides a simple means for
3909: others to install your package, should you distribute
3910: it.</p>
3911:
3912: <p>To create a binary package, change into the
1.14 xtraeme 3913: appropriate directory in pkgsrc, and run
3914: <span><strong class="command">make
3915: package</strong></span>:</p>
1.1 grant 3916: <pre class="screen">
1.14 xtraeme 3917: <code class="prompt">#</code> <strong class=
3918: "userinput"><code>cd misc/figlet</code></strong>
3919: <code class="prompt">#</code> <strong class=
3920: "userinput"><code>make package</code></strong>
1.1 grant 3921: </pre>
3922:
3923: <p>This will build and install your package (if not
3924: already done), and then build a binary package from what
1.14 xtraeme 3925: was installed. You can then use the <span><strong class=
3926: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3927: Binary packages are created by default in <code xmlns=
3928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3929: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3930: gzipped tar file. See <a href="#logs.package" title=
1.55 rillig 3931: "B.2. Packaging figlet">Section B.2,
1.1 grant 3932: “Packaging figlet”</a> for a continuation of
3933: the above <a xmlns=
3934: "http://www.w3.org/TR/xhtml1/transitional" href=
3935: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3936: target="_top"><code xmlns="" class=
3937: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3938:
3939: <p>See <a href="#submit" title=
1.55 rillig 3940: "Chapter 17. Submitting and Committing">Chapter
3941: 17, <i>Submitting and Committing</i></a> for information
3942: on how to submit such a binary package.</p>
1.1 grant 3943: </div>
3944:
1.55 rillig 3945: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3946: <div class="titlepage">
3947: <div>
3948: <div>
3949: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3950: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3951: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3952: for creation of binary packages</h2>
3953: </div>
3954: </div>
3955: </div>
3956:
3957: <p>See <a href="#build.helpful-targets" title=
1.56 ! rillig 3958: "14.16. Other helpful targets">Section 14.16,
1.1 grant 3959: “Other helpful targets”</a>.</p>
3960: </div>
3961:
1.55 rillig 3962: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3963: <div class="titlepage">
3964: <div>
3965: <div>
3966: <h2 class="title" style="clear: both"><a name=
1.55 rillig 3967: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
3968: bulk build of all packages</h2>
1.1 grant 3969: </div>
3970: </div>
3971: </div>
3972:
3973: <p>If you want to get a full set of precompiled binary
3974: packages, this section describes how to get them. Beware
3975: that the bulk build will remove all currently installed
1.23 wiz 3976: packages from your system! Having an FTP server
3977: configured either on the machine doing the bulk builds or
3978: on a nearby NFS server can help to make the packages
3979: available to everyone. See <a href=
1.1 grant 3980: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3981: <span class="citerefentry"><span class=
3982: "refentrytitle">ftpd</span>(8)</span></a> for more
3983: information. If you use a remote NFS server's storage, be
3984: sure to not actually compile on NFS storage, as this
3985: slows things down a lot.</p>
3986:
1.55 rillig 3987: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3988: <div class="titlepage">
3989: <div>
3990: <div>
1.55 rillig 3991: <h3 class="title"><a name="binary.configuration"
3992: id=
1.38 dillo 3993: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3994: </div>
3995: </div>
3996: </div>
3997:
1.55 rillig 3998: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 3999: <div class="titlepage">
4000: <div>
4001: <div>
1.55 rillig 4002: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 4003: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 4004: </div>
4005: </div>
4006: </div>
4007:
1.45 wiz 4008: <p>You may want to set variables in <code xmlns=
4009: "http://www.w3.org/TR/xhtml1/transitional" class=
4010: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4011: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4012: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4013: details of the default settings. You will want to
1.14 xtraeme 4014: ensure that <code class=
4015: "varname">ACCEPTABLE_LICENSES</code> meet your local
4016: policy. As used in this example, <code class=
4017: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4018: "emphasis"><em>all</em></span> licenses.</p>
4019: <pre class="programlisting">
1.51 rillig 4020: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4021: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4022: BSDSRCDIR= /usr/src
4023: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4024: OBJHOSTNAME?= yes # use work.`hostname`
4025: FAILOVER_FETCH= yes # insist on the correct checksum
4026: PKG_DEVELOPER?= yes
4027: _ACCEPTABLE= yes
1.1 grant 4028: </pre>
4029: </div>
4030:
1.55 rillig 4031: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4032: <div class="titlepage">
4033: <div>
4034: <div>
1.55 rillig 4035: <h4 class="title"><a name="build.conf" id=
1.45 wiz 4036: "build.conf"></a>6.3.1.2. <code xmlns=
4037: "http://www.w3.org/TR/xhtml1/transitional"
4038: class="filename">build.conf</code></h4>
1.1 grant 4039: </div>
4040: </div>
4041: </div>
4042:
1.45 wiz 4043: <p>In <code xmlns=
4044: "http://www.w3.org/TR/xhtml1/transitional" class=
4045: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
4046: "http://www.w3.org/TR/xhtml1/transitional" class=
4047: "filename">build.conf-example</code> to <code xmlns=
4048: "http://www.w3.org/TR/xhtml1/transitional" class=
4049: "filename">build.conf</code> and edit it, following
4050: the comments in that file. This is the config file
4051: that determines where log files are generated after
4052: the build, where to mail the build report to, where
4053: your pkgsrc tree is located and the user to which
4054: user to <a href=
1.1 grant 4055: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
4056: <span class="citerefentry"><span class=
1.23 wiz 4057: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 4058: <span><strong class="command">cvs
4059: update</strong></span>.</p>
1.1 grant 4060: </div>
4061:
1.55 rillig 4062: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4063: <div class="titlepage">
4064: <div>
4065: <div>
1.55 rillig 4066: <h4 class="title"><a name="pre-build.local" id=
1.45 wiz 4067: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4068: class="filename">pre-build.local</code></h4>
1.1 grant 4069: </div>
4070: </div>
4071: </div>
4072:
4073: <p>It is possible to configure the bulk build to
1.47 reed 4074: perform certain site-specific tasks at the end of the
1.45 wiz 4075: pre-build stage. If the file <code xmlns=
4076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4077: "filename">pre-build.local</code> exists in
1.45 wiz 4078: <code xmlns=
4079: "http://www.w3.org/TR/xhtml1/transitional" class=
4080: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4081: executed (as a <a href=
1.24 wiz 4082: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4083: <span class="citerefentry"><span class=
4084: "refentrytitle">sh</span>(1)</span></a> script) at
4085: the end of the usual pre-build stage. An example use
1.45 wiz 4086: of <code xmlns=
4087: "http://www.w3.org/TR/xhtml1/transitional" class=
4088: "filename">pre-build.local</code> is to have the
4089: line:</p>
1.1 grant 4090: <pre class="screen">
1.14 xtraeme 4091: <code class="prompt">#</code> <strong class=
4092: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4093: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4094: </pre>
4095:
4096: <p>to prevent the system from trying to build a
4097: particular package which requires nearly 3 GB of disk
4098: space.</p>
4099: </div>
4100: </div>
4101:
1.55 rillig 4102: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4103: <div class="titlepage">
4104: <div>
4105: <div>
1.30 wiz 4106: <h3 class="title"><a name=
1.55 rillig 4107: "other-environmental-considerations" id=
1.38 dillo 4108: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4109: environmental considerations</h3>
1.1 grant 4110: </div>
4111: </div>
4112: </div>
4113:
1.45 wiz 4114: <p>As <code xmlns=
4115: "http://www.w3.org/TR/xhtml1/transitional" class=
4116: "filename">/usr/pkg</code> will be completely deleted
4117: at the start of bulk builds, make sure your login shell
4118: is placed somewhere else. Either drop it into
4119: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4120: class="filename">/usr/local/bin</code> (and adjust your
4121: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4122: <a href=
1.1 grant 4123: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4124: <span class="citerefentry"><span class=
4125: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4126: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4127: class="filename">/etc/rc.local</code>, so you can login
4128: after a reboot (remember that your current process
4129: won't die if the package is removed, you just can't
4130: start any new instances of the shell any more). Also,
4131: if you use NetBSD earlier than 1.5, or you still want
4132: to use the pkgsrc version of ssh for some reason, be
4133: sure to install ssh before starting it from
4134: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4135: class="filename">rc.local</code>:</p>
1.1 grant 4136: <pre class="programlisting">
1.51 rillig 4137: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4138: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4139: /usr/pkg/etc/rc.d/sshd
4140: fi
1.1 grant 4141: </pre>
4142:
4143: <p>Not doing so will result in you being not able to
4144: log in via ssh after the bulk build is finished or if
4145: the machine gets rebooted or crashes. You have been
4146: warned! :)</p>
4147: </div>
4148:
1.55 rillig 4149: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4150: <div class="titlepage">
4151: <div>
4152: <div>
1.55 rillig 4153: <h3 class="title"><a name="operation" id=
1.38 dillo 4154: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4155: </div>
4156: </div>
4157: </div>
4158:
4159: <p>Make sure you don't need any of the packages still
4160: installed.</p>
4161:
4162: <div class="warning" style=
4163: "margin-left: 0.5in; margin-right: 0.5in;">
4164: <h3 class="title">Warning</h3>
4165:
4166: <p>During the bulk build, <span class=
4167: "emphasis"><em>all packages will be
4168: removed!</em></span></p>
4169: </div>
4170:
4171: <p>Be sure to remove all other things that might
4172: interfere with builds, like some libs installed in
1.45 wiz 4173: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4174: class="filename">/usr/local</code>, etc. then become
4175: root and type:</p>
1.1 grant 4176: <pre class="screen">
1.14 xtraeme 4177: <code class="prompt">#</code> <strong class=
4178: "userinput"><code>cd /usr/pkgsrc</code></strong>
4179: <code class="prompt">#</code> <strong class=
4180: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4181: </pre>
4182:
4183: <p>If for some reason your last build didn't complete
4184: (power failure, system panic, ...), you can continue it
4185: by running:</p>
4186: <pre class="screen">
1.14 xtraeme 4187: <code class="prompt">#</code> <strong class=
4188: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4189: </pre>
4190:
4191: <p>At the end of the bulk build, you will get a summary
4192: via mail, and find build logs in the directory
1.14 xtraeme 4193: specified by <code class="varname">FTP</code> in the
1.45 wiz 4194: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4195: class="filename">build.conf</code> file.</p>
1.1 grant 4196: </div>
4197:
1.55 rillig 4198: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4199: <div class="titlepage">
4200: <div>
4201: <div>
1.55 rillig 4202: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 4203: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4204: </div>
4205: </div>
4206: </div>
4207:
4208: <p>The bulk builds consist of three steps:</p>
4209:
4210: <div class="variablelist">
4211: <dl>
4212: <dt><span class="term">1. pre-build</span></dt>
4213:
4214: <dd>
4215: <p>The script updates your pkgsrc tree via
4216: (anon)cvs, then cleans out any broken distfiles,
4217: and removes all packages installed.</p>
4218: </dd>
4219:
4220: <dt><span class="term">2. the bulk
4221: build</span></dt>
4222:
4223: <dd>
4224: <p>This is basically “<span class=
4225: "quote">make bulk-package</span>” with an
4226: optimised order in which packages will be built.
4227: Packages that don't require other packages will
4228: be built first, and packages with many
4229: dependencies will be built later.</p>
4230: </dd>
4231:
4232: <dt><span class="term">3. post-build</span></dt>
4233:
4234: <dd>
4235: <p>Generates a report that's placed in the
1.45 wiz 4236: directory specified in the <code xmlns=
4237: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4238: "filename">build.conf</code> file named
1.45 wiz 4239: <code xmlns=
4240: "http://www.w3.org/TR/xhtml1/transitional" class=
4241: "filename">broken.html</code>, a short version of
4242: that report will also be mailed to the build's
4243: admin.</p>
1.1 grant 4244: </dd>
4245: </dl>
4246: </div>
4247:
4248: <p>During the build, a list of broken packages will be
1.45 wiz 4249: compiled in <code xmlns=
4250: "http://www.w3.org/TR/xhtml1/transitional" class=
4251: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4253: "filename">.../.broken.${MACHINE}</code> if
4254: <code class="varname">OBJMACHINE</code> is set),
4255: individual build logs of broken builds can be found in
4256: the package's directory. These files are used by the
4257: bulk-targets to mark broken builds to not waste time
4258: trying to rebuild them, and they can be used to debug
4259: these broken package builds later.</p>
1.1 grant 4260: </div>
4261:
1.55 rillig 4262: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4263: <div class="titlepage">
4264: <div>
4265: <div>
1.30 wiz 4266: <h3 class="title"><a name=
1.55 rillig 4267: "disk-space-requirements" id=
1.38 dillo 4268: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4269: space requirements</h3>
1.1 grant 4270: </div>
4271: </div>
4272: </div>
4273:
4274: <p>Currently, roughly the following requirements are
4275: valid for NetBSD 2.0/i386:</p>
4276:
4277: <div class="itemizedlist">
4278: <ul type="disc">
4279: <li>
4280: <p>10 GB - distfiles (NFS ok)</p>
4281: </li>
4282:
4283: <li>
4284: <p>8 GB - full set of all binaries (NFS ok)</p>
4285: </li>
4286:
4287: <li>
4288: <p>5 GB - temp space for compiling (local disk
4289: recommended)</p>
4290: </li>
4291: </ul>
4292: </div>
4293:
4294: <p>Note that all pkgs will be de-installed as soon as
4295: they are turned into a binary package, and that sources
4296: are removed, so there is no excessively huge demand to
4297: disk space. Afterwards, if the package is needed again,
4298: it will be installed via <a href=
4299: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4300: <span class="citerefentry"><span class=
4301: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4302: building again, so there are no cycles wasted by
4303: recompiling.</p>
4304: </div>
4305:
1.55 rillig 4306: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4307: <div class="titlepage">
4308: <div>
4309: <div>
1.55 rillig 4310: <h3 class="title"><a name="setting-up-a-sandbox"
4311: id="setting-up-a-sandbox"></a>6.3.6. Setting
4312: up a sandbox for chrooted builds</h3>
1.1 grant 4313: </div>
4314: </div>
4315: </div>
4316:
1.12 agc 4317: <p>If you don't want all the packages nuked from a
4318: machine (rendering it useless for anything but pkg
1.23 wiz 4319: compiling), there is the possibility of doing the
4320: package bulk build inside a chroot environment.</p>
1.12 agc 4321:
4322: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4323: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4324: class="filename">/usr/sandbox</code>. This can be done
4325: by using null mounts, or manually.</p>
1.12 agc 4326:
1.45 wiz 4327: <p>There is a shell script called <code xmlns=
4328: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4329: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4330: set up the sandbox environment using null mounts. It
1.45 wiz 4331: will also create a script called <code xmlns=
4332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4333: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4334: environment, which will allow the null mounts to be
1.14 xtraeme 4335: activated using the <span><strong class=
4336: "command">sandbox mount</strong></span> command and
4337: deactivated using the <span><strong class=
4338: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4339:
4340: <p>To set up a sandbox environment by hand, after
4341: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4342: doing a <span><strong class="command">make distribution
1.45 wiz 4343: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4344: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4345: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4346: items are present and properly configured:</p>
1.1 grant 4347:
4348: <div class="procedure">
4349: <ol type="1">
4350: <li>
4351: <p>Kernel</p>
4352: <pre class="screen">
1.14 xtraeme 4353: <code class="prompt">#</code> <strong class=
4354: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4355: </pre>
4356: </li>
4357:
4358: <li>
1.45 wiz 4359: <p><code xmlns=
4360: "http://www.w3.org/TR/xhtml1/transitional" class=
4361: "filename">/dev/*</code></p>
1.1 grant 4362: <pre class="screen">
1.14 xtraeme 4363: <code class="prompt">#</code> <strong class=
4364: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4365: </pre>
4366: </li>
4367:
4368: <li>
1.45 wiz 4369: <p><code xmlns=
4370: "http://www.w3.org/TR/xhtml1/transitional" class=
4371: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4372: "http://www.w3.org/TR/xhtml1/transitional" href=
4373: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4374: target="_top"><code xmlns="" class=
4375: "filename">security/smtpd</code></a> and
4376: mail):</p>
1.1 grant 4377: <pre class="screen">
1.14 xtraeme 4378: <code class="prompt">#</code> <strong class=
4379: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4380: </pre>
4381: </li>
4382:
4383: <li>
4384: <p>Working(!) mail config (hostname,
4385: sendmail.cf):</p>
4386: <pre class="screen">
1.14 xtraeme 4387: <code class="prompt">#</code> <strong class=
4388: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4389: </pre>
4390: </li>
4391:
4392: <li>
1.45 wiz 4393: <p><code xmlns=
4394: "http://www.w3.org/TR/xhtml1/transitional" class=
4395: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4396: "http://www.w3.org/TR/xhtml1/transitional" href=
4397: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4398: target="_top"><code xmlns="" class=
4399: "filename">security/smtpd</code></a>):</p>
1.1 grant 4400: <pre class="screen">
1.14 xtraeme 4401: <code class="prompt">#</code> <strong class=
4402: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4403: </pre>
4404: </li>
4405:
4406: <li>
1.45 wiz 4407: <p><code xmlns=
4408: "http://www.w3.org/TR/xhtml1/transitional" class=
4409: "filename">/usr/src</code> (system sources, for
4410: <a xmlns=
1.1 grant 4411: "http://www.w3.org/TR/xhtml1/transitional" href=
4412: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4413: target="_top"><code xmlns="" class=
4414: "filename">sysutils/aperture</code></a>,
4415: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4416: href=
1.20 ben 4417: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4418: target="_top"><code xmlns="" class=
4419: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4420: <pre class="screen">
1.14 xtraeme 4421: <code class="prompt">#</code> <strong class=
4422: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4423: <code class="prompt">#</code> <strong class=
1.23 wiz 4424: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4425: </pre>
4426: </li>
4427:
4428: <li>
1.45 wiz 4429: <p>Create <code xmlns=
4430: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4431: "filename">/var/db/pkg</code> (not part of
4432: default install):</p>
1.1 grant 4433: <pre class="screen">
1.14 xtraeme 4434: <code class="prompt">#</code> <strong class=
4435: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4436: </pre>
4437: </li>
4438:
4439: <li>
1.45 wiz 4440: <p>Create <code xmlns=
4441: "http://www.w3.org/TR/xhtml1/transitional" class=
4442: "filename">/usr/pkg</code> (not part of default
4443: install):</p>
1.1 grant 4444: <pre class="screen">
1.14 xtraeme 4445: <code class="prompt">#</code> <strong class=
4446: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4447: </pre>
4448: </li>
4449:
4450: <li>
1.45 wiz 4451: <p>Checkout pkgsrc via cvs into <code xmlns=
4452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4453: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4454: <pre class="screen">
1.14 xtraeme 4455: <code class="prompt">#</code> <strong class=
4456: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4457: <code class="prompt">#</code> <strong class=
4458: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4459: </pre>
4460:
4461: <p>Do not mount/link this to the copy of your
4462: pkgsrc tree you do development in, as this will
4463: likely cause problems!</p>
4464: </li>
4465:
4466: <li>
1.45 wiz 4467: <p>Make <code xmlns=
4468: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4469: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4470: and <code xmlns=
4471: "http://www.w3.org/TR/xhtml1/transitional" class=
4472: "filename">.../distfiles</code> point somewhere
4473: appropriate. NFS- and/or nullfs-mounts may come
4474: in handy!</p>
1.1 grant 4475: </li>
4476:
4477: <li>
1.45 wiz 4478: <p>Edit <code xmlns=
4479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4480: "filename">/etc/mk.conf</code>, see <a href=
4481: "#binary.mk.conf" title=
1.38 dillo 4482: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4483: “/etc/mk.conf”</a>.</p>
4484: </li>
4485:
4486: <li>
1.45 wiz 4487: <p>Adjust <code xmlns=
4488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4489: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4490: needs.</p>
4491: </li>
4492:
4493: <li>
1.14 xtraeme 4494: <p>If you have set <code class=
1.45 wiz 4495: "varname">CVS_USER</code> in <code xmlns=
4496: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4497: "filename">build.conf</code>, make sure that
4498: account exists and can do a <span><strong class=
4499: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4500: properly!</p>
4501: </li>
4502: </ol>
4503: </div>
4504:
1.47 reed 4505: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4506: build with the following steps:</p>
4507: <pre class="screen">
1.14 xtraeme 4508: <code class="prompt">#</code> <strong class=
4509: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4510: <code class="prompt">#</code> <strong class=
4511: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4512: </pre>
4513:
4514: <p>This will just jump inside the sandbox and start
4515: building. At the end of the build, mail will be sent
4516: with the results of the build. Created binary pkgs will
1.45 wiz 4517: be in <code xmlns=
4518: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4519: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4520: (wherever that points/mounts to/from).</p>
4521: </div>
4522:
1.55 rillig 4523: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4524: <div class="titlepage">
4525: <div>
4526: <div>
1.30 wiz 4527: <h3 class="title"><a name=
1.55 rillig 4528: "building-a-partial-set" id=
1.38 dillo 4529: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4530: a partial set of packages</h3>
1.1 grant 4531: </div>
4532: </div>
4533: </div>
4534:
4535: <p>In addition to building a complete set of all
1.45 wiz 4536: packages in pkgsrc, the <code xmlns=
4537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4538: "filename">pkgsrc/mk/bulk/build</code> script may be
4539: used to build a subset of the packages contained in
1.47 reed 4540: pkgsrc. By setting <code class=
1.45 wiz 4541: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4542: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4543: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4544:
4545: <div class="itemizedlist">
4546: <ul type="disc">
4547: <li>
4548: <p>SITE_SPECIFIC_PKGS</p>
4549: </li>
4550:
4551: <li>
4552: <p>HOST_SPECIFIC_PKGS</p>
4553: </li>
4554:
4555: <li>
4556: <p>GROUP_SPECIFIC_PKGS</p>
4557: </li>
4558:
4559: <li>
4560: <p>USER_SPECIFIC_PKGS</p>
4561: </li>
4562: </ul>
4563: </div>
4564:
4565: <p>will define the set of packages which should be
4566: built. The bulk build code will also include any
4567: packages which are needed as dependencies for the
4568: explicitly listed packages.</p>
4569:
4570: <p>One use of this is to do a bulk build with
1.14 xtraeme 4571: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4572: sandbox periodically to have a complete set of the
4573: binary packages needed for your site available without
4574: the overhead of building extra packages that are not
4575: needed.</p>
4576: </div>
1.13 hubertf 4577:
1.55 rillig 4578: <div class="sect2" lang="en" xml:lang="en">
1.13 hubertf 4579: <div class="titlepage">
4580: <div>
4581: <div>
1.55 rillig 4582: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4583: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4584: of a bulk build</h3>
4585: </div>
4586: </div>
4587: </div>
4588:
4589: <p>This section describes how pkgsrc developers can
4590: upload binary pkgs built by bulk builds to
4591: ftp.NetBSD.org.</p>
4592:
1.17 sketch 4593: <p>If you would like to automatically create checksum
4594: files for the binary packages you intend to upload,
4595: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4596: in your <code xmlns=
4597: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4598: "filename">mk/bulk/build.conf</code>.</p>
4599:
4600: <p>If you would like to PGP sign the checksum files
4601: (highly recommended!), remember to set <code class=
4602: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4603: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4604: class="filename">mk/bulk/build.conf</code>. This will
4605: prompt you for your GPG password to sign the files
1.17 sketch 4606: before uploading everything.</p>
4607:
4608: <p>Then, make sure that you have <code class=
1.14 xtraeme 4609: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4610: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4611: class="filename">mk/bulk/build.conf</code> file, i.e.
4612: adjust it to something like one of the following:</p>
1.13 hubertf 4613: <pre class="screen">
4614: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4615: </pre>
4616:
1.47 reed 4617: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4618: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4619: ftp.NetBSD.org is different from <code class=
4620: "varname">CVS_USER</code>, write your login directly
4621: into the variable, e.g. my local account is "feyrer",
4622: but for my login "hubertf", I use:</p>
1.13 hubertf 4623: <pre class="screen">
4624: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4625: </pre>
4626:
1.45 wiz 4627: <p>A separate <code xmlns=
4628: "http://www.w3.org/TR/xhtml1/transitional" class=
4629: "filename">upload</code> directory is used here to
4630: allow "closing" the directory during upload. To do so,
4631: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4632: <pre class="screen">
1.14 xtraeme 4633: nbftp% <strong class=
4634: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4635: </pre>
4636:
1.45 wiz 4637: <p>Please note that <code xmlns=
4638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4639: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4640: appropriate for packages for the NetBSD operating
4641: system. Binary packages for other operating systems
1.45 wiz 4642: should go into <code xmlns=
4643: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4644: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4645:
4646: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4647: needs to be set up. This example shows how to set up
1.13 hubertf 4648: temporary keys for the root account <span class=
4649: "emphasis"><em>inside the sandbox</em></span> (assuming
4650: that no keys should be present there usually):</p>
4651: <pre class="screen">
1.14 xtraeme 4652: <code class="prompt">#</code> <strong class=
4653: "userinput"><code>chroot /usr/sandbox</code></strong>
4654: chroot-<code class="prompt">#</code> <strong class=
4655: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4656: chroot-<code class="prompt">#</code> <strong class=
4657: "userinput"><code>ssh-keygen -t dsa</code></strong>
4658: chroot-<code class="prompt">#</code> <strong class=
4659: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4660: </pre>
4661:
1.45 wiz 4662: <p>Now take the output of <code xmlns=
4663: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4664: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4665: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4666: class="filename">~/.ssh/authorized_keys</code> file on
4667: ftp.NetBSD.org. You can remove the key after the upload
4668: is done!</p>
1.13 hubertf 4669:
4670: <p>Next, test if your ssh connection really works:</p>
4671: <pre class="screen">
1.14 xtraeme 4672: chroot-<code class="prompt">#</code> <strong class=
4673: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4674: </pre>
4675:
4676: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4677:
4678: <p>Now after all this works, you can exit the sandbox
4679: and start the upload:</p>
4680: <pre class="screen">
1.14 xtraeme 4681: chroot-<code class="prompt">#</code> <strong class=
4682: "userinput"><code>exit</code></strong>
4683: <code class="prompt">#</code> <strong class=
4684: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4685: <code class="prompt">#</code> <strong class=
4686: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4687: </pre>
4688:
4689: <p>The upload process may take quite some time. Use
1.24 wiz 4690: <a href=
4691: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4692: <span class="citerefentry"><span class=
4693: "refentrytitle">ls</span>(1)</span></a> or <a href=
4694: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4695: <span class="citerefentry"><span class=
4696: "refentrytitle">du</span>(1)</span></a> on the FTP
4697: server to monitor progress of the upload. The upload
4698: script will take care of not uploading restricted
4699: packages and putting vulnerable packages into the
1.45 wiz 4700: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4701: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4702:
4703: <p>After the upload has ended, first thing is to revoke
4704: ssh access:</p>
4705: <pre class="screen">
1.14 xtraeme 4706: nbftp% <strong class=
4707: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4708: Gdd:x!
4709: </pre>
4710:
4711: <p>Use whatever is needed to remove the key you've
4712: entered before! Last, move the uploaded packages out of
1.45 wiz 4713: the <code xmlns=
4714: "http://www.w3.org/TR/xhtml1/transitional" class=
4715: "filename">upload</code> directory to have them
4716: accessible to everyone:</p>
1.13 hubertf 4717: <pre class="screen">
1.14 xtraeme 4718: nbftp% <strong class=
4719: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4720: nbftp% <strong class=
4721: "userinput"><code>mv upload/* .</code></strong>
4722: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4723: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4724: </pre>
4725: </div>
1.1 grant 4726: </div>
4727:
1.55 rillig 4728: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4729: <div class="titlepage">
4730: <div>
4731: <div>
4732: <h2 class="title" style="clear: both"><a name=
1.55 rillig 4733: "creating-cdroms" id=
1.38 dillo 4734: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4735: CD-ROM packages collection</h2>
1.1 grant 4736: </div>
4737: </div>
4738: </div>
4739:
4740: <p>After your pkgsrc bulk-build has completed, you may
4741: wish to create a CD-ROM set of the resulting binary
4742: packages to assist in installing packages on other
4743: machines. The <a xmlns=
4744: "http://www.w3.org/TR/xhtml1/transitional" href=
4745: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4746: target="_top"><code xmlns="" class=
4747: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4748: simple tool for creating the ISO 9660 images.
4749: <span><strong class="command">cdpack</strong></span>
4750: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4751: all the dependencies for a given package on the same CD
4752: as that package.</p>
1.1 grant 4753:
1.55 rillig 4754: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4755: <div class="titlepage">
4756: <div>
4757: <div>
1.55 rillig 4758: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4759: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4760: cdpack</h3>
4761: </div>
4762: </div>
4763: </div>
4764:
4765: <p>Complete documentation for cdpack is found in the
1.47 reed 4766: cdpack(1) man page. The following short example assumes
1.45 wiz 4767: that the binary packages are left in <code xmlns=
4768: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4769: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4770: sufficient disk space exists in <code xmlns=
4771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4772: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4773: <pre class="screen">
1.14 xtraeme 4774: <code class="prompt">#</code> <strong class=
4775: "userinput"><code>mkdir /u2/images</code></strong>
4776: <code class="prompt">#</code> <strong class=
4777: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4778: <code class="prompt">#</code> <strong class=
4779: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4780: </pre>
4781:
4782: <p>If you wish to include a common set of files
1.45 wiz 4783: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4784: class="filename">COPYRIGHT</code>, <code xmlns=
4785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4786: "filename">README</code>, etc.) on each CD in the
1.1 grant 4787: collection, then you need to create a directory which
4788: contains these files. e.g.</p>
4789: <pre class="screen">
1.14 xtraeme 4790: <code class="prompt">#</code> <strong class=
4791: "userinput"><code>mkdir /tmp/common</code></strong>
4792: <code class="prompt">#</code> <strong class=
4793: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4794: <code class="prompt">#</code> <strong class=
4795: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4796: <code class="prompt">#</code> <strong class=
4797: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4798: <code class="prompt">#</code> <strong class=
4799: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4800: <code class="prompt">#</code> <strong class=
4801: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4802: <code class="prompt">#</code> <strong class=
4803: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4804: </pre>
4805:
4806: <p>Now create the images:</p>
4807: <pre class="screen">
1.14 xtraeme 4808: <code class="prompt">#</code> <strong class=
4809: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4810: </pre>
4811:
1.45 wiz 4812: <p>Each image will contain <code xmlns=
4813: "http://www.w3.org/TR/xhtml1/transitional" class=
4814: "filename">README</code>, <code xmlns=
4815: "http://www.w3.org/TR/xhtml1/transitional" class=
4816: "filename">COPYING</code>, and <code xmlns=
4817: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4818: "filename">bin/myscript</code> in their root
1.1 grant 4819: directories.</p>
4820: </div>
4821: </div>
4822: </div>
4823:
1.55 rillig 4824: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 4825: <div class="titlepage">
4826: <div>
4827: <div>
1.55 rillig 4828: <h2 class="title"><a name="faq" id=
1.38 dillo 4829: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4830: Questions</h2>
4831: </div>
4832: </div>
4833: </div>
4834:
4835: <div class="toc">
4836: <p><b>Table of Contents</b></p>
4837:
4838: <dl>
1.30 wiz 4839: <dt><span class="sect1"><a href=
1.38 dillo 4840: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4841: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4842:
1.38 dillo 4843: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4844: Where's the pkgviews documentation?</a></span></dt>
4845:
1.38 dillo 4846: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4847: Utilities for package management
4848: (pkgtools)</a></span></dt>
4849:
1.38 dillo 4850: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4851: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4852:
1.30 wiz 4853: <dt><span class="sect1"><a href=
1.38 dillo 4854: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4855: fetching distfiles?</a></span></dt>
1.14 xtraeme 4856:
1.30 wiz 4857: <dt><span class="sect1"><a href=
1.38 dillo 4858: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4859: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4860:
1.30 wiz 4861: <dt><span class="sect1"><a href=
1.38 dillo 4862: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4863: from pkgsrc?</a></span></dt>
1.1 grant 4864:
1.30 wiz 4865: <dt><span class="sect1"><a href=
1.38 dillo 4866: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4867: behind a firewall</a></span></dt>
1.1 grant 4868:
1.38 dillo 4869: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4870: do I tell <span><strong class="command">make
4871: fetch</strong></span> to do passive
4872: FTP?</a></span></dt>
1.1 grant 4873:
1.30 wiz 4874: <dt><span class="sect1"><a href=
1.38 dillo 4875: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4876: distfiles at once</a></span></dt>
1.1 grant 4877:
1.30 wiz 4878: <dt><span class="sect1"><a href=
1.38 dillo 4879: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4880: “<span class="quote">Don't know how to make
1.14 xtraeme 4881: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4882: mean?</a></span></dt>
4883:
1.30 wiz 4884: <dt><span class="sect1"><a href=
1.38 dillo 4885: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4886: “<span class="quote">Could not find
1.14 xtraeme 4887: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4888:
1.30 wiz 4889: <dt><span class="sect1"><a href=
1.38 dillo 4890: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4891: pkgsrc</a></span></dt>
1.1 grant 4892:
1.38 dillo 4893: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4894: do I change the location of configuration
4895: files?</a></span></dt>
1.1 grant 4896:
1.38 dillo 4897: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4898: Automated security checks</a></span></dt>
4899: </dl>
4900: </div>
4901:
4902: <p>This section contains hints, tips & tricks on
4903: special things in pkgsrc that we didn't find a better place
4904: for in the previous chapters, and it contains items for
4905: both pkgsrc users and developers.</p>
4906:
1.55 rillig 4907: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4908: <div class="titlepage">
4909: <div>
4910: <div>
4911: <h2 class="title" style="clear: both"><a name=
1.55 rillig 4912: "mailing-list-pointers" id=
1.38 dillo 4913: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4914: mailing lists for pkg-related discussion?</h2>
1.1 grant 4915: </div>
4916: </div>
4917: </div>
4918:
1.18 xtraeme 4919: <p>The following mailing lists may be of interest to
4920: pkgsrc users:</p>
4921:
4922: <div class="itemizedlist">
4923: <ul type="disc">
4924: <li>
4925: <p><a href=
4926: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4927: target="_top">pkgsrc-bugs</a>: A list where problem
4928: reports related to pkgsrc are sent and
4929: discussed.</p>
1.18 xtraeme 4930: </li>
4931:
4932: <li>
4933: <p><a href=
4934: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4935: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4936: results of pkgsrc bulk builds are sent and
1.34 wiz 4937: discussed.</p>
1.18 xtraeme 4938: </li>
4939:
4940: <li>
4941: <p><a href=
4942: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4943: target="_top">pkgsrc-changes</a>: A list where all
4944: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4945: </li>
4946:
4947: <li>
4948: <p><a href=
4949: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4950: target="_top">tech-pkg</a>: A general discussion
4951: list for all things related to pkgsrc.</p>
1.18 xtraeme 4952: </li>
4953: </ul>
4954: </div>
4955:
4956: <p>To subscribe, do:</p>
1.1 grant 4957: <pre class="programlisting">
1.51 rillig 4958: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 4959: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4960: </pre>
4961:
1.18 xtraeme 4962: <p>Archives for all these mailing lists are available
4963: from <a href="http://mail-index.NetBSD.org/" target=
4964: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4965: </div>
4966:
1.55 rillig 4967: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4968: <div class="titlepage">
4969: <div>
4970: <div>
4971: <h2 class="title" style="clear: both"><a name=
1.55 rillig 4972: "pkgviews-docs" id=
1.38 dillo 4973: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4974: documentation?</h2>
1.1 grant 4975: </div>
4976: </div>
4977: </div>
4978:
4979: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4980: find a pkgviews User's guide in <code xmlns=
4981: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4982: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4983: </div>
4984:
1.55 rillig 4985: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4986: <div class="titlepage">
4987: <div>
4988: <div>
4989: <h2 class="title" style="clear: both"><a name=
1.55 rillig 4990: "faq-pkgtools" id=
1.38 dillo 4991: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4992: management (pkgtools)</h2>
1.1 grant 4993: </div>
4994: </div>
4995: </div>
4996:
1.45 wiz 4997: <p>The <code xmlns=
4998: "http://www.w3.org/TR/xhtml1/transitional" class=
4999: "filename">pkgsrc/pkgtools</code> directory pkgtools
5000: contains a number of useful utilities for both users and
5001: developers of pkgsrc. This section attempts only to make
5002: the reader aware of the utilities and when they might be
5003: useful, and not to duplicate the documentation that comes
5004: with each package.</p>
1.1 grant 5005:
5006: <p>Utilities used by pkgsrc (automatically installed when
5007: needed):</p>
5008:
5009: <div class="itemizedlist">
5010: <ul type="disc">
5011: <li>
5012: <p><a xmlns=
5013: "http://www.w3.org/TR/xhtml1/transitional" href=
5014: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5015: target="_top"><code xmlns="" class=
5016: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5017: for use by buildlink.</p>
1.1 grant 5018: </li>
5019: </ul>
5020: </div>
5021:
5022: <p>OS tool augmentation (automatically installed when
5023: needed):</p>
5024:
5025: <div class="itemizedlist">
5026: <ul type="disc">
5027: <li>
5028: <p><a xmlns=
5029: "http://www.w3.org/TR/xhtml1/transitional" href=
5030: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5031: target="_top"><code xmlns="" class=
5032: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5033: various kinds of checksums (including SHA1).</p>
1.1 grant 5034: </li>
5035:
5036: <li>
5037: <p><a xmlns=
5038: "http://www.w3.org/TR/xhtml1/transitional" href=
5039: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5040: target="_top"><code xmlns="" class=
5041: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5042: Compatibility library for pkgsrc tools.</p>
1.1 grant 5043: </li>
5044:
5045: <li>
5046: <p><a xmlns=
5047: "http://www.w3.org/TR/xhtml1/transitional" href=
5048: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5049: target="_top"><code xmlns="" class=
5050: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5051: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5052: </li>
5053:
5054: <li>
5055: <p><a xmlns=
5056: "http://www.w3.org/TR/xhtml1/transitional" href=
5057: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5058: target="_top"><code xmlns="" class=
5059: "filename">pkgtools/pkg_install</code></a>:
5060: Up-to-date replacement for <code xmlns=
5061: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5062: "filename">/usr/sbin/pkg_install</code>, or for use
5063: on operating systems where pkg_install is not
5064: present.</p>
1.1 grant 5065: </li>
5066: </ul>
5067: </div>
5068:
5069: <p>Utilities used by pkgsrc (not automatically
5070: installed):</p>
5071:
5072: <div class="itemizedlist">
5073: <ul type="disc">
5074: <li>
5075: <p><a xmlns=
5076: "http://www.w3.org/TR/xhtml1/transitional" href=
5077: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5078: target="_top"><code xmlns="" class=
5079: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5080: binary package from an already-installed package.
1.34 wiz 5081: Used by <span><strong class="command">make
5082: replace</strong></span> to save the old
5083: package.</p>
1.1 grant 5084: </li>
5085:
5086: <li>
5087: <p><a xmlns=
5088: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5089: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5090: target="_top"><code xmlns="" class=
5091: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5092: functionality to pkgsrc, allowing it to fetch
5093: distfiles from multiple locations. It currently
5094: supports the following methods: multiple CD-ROMs
5095: and network FTP/HTTP connections.</p>
1.5 hubertf 5096: </li>
5097:
5098: <li>
5099: <p><a xmlns=
5100: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5101: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5102: target="_top"><code xmlns="" class=
5103: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5104: packages someplace else (enabled by default).</p>
1.1 grant 5105: </li>
1.5 hubertf 5106:
5107: <li>
5108: <p><a xmlns=
5109: "http://www.w3.org/TR/xhtml1/transitional" href=
5110: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5111: target="_top"><code xmlns="" class=
5112: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5113: best compiler flags to optimise code for your
1.20 ben 5114: current CPU and compiler.</p>
1.5 hubertf 5115: </li>
1.1 grant 5116: </ul>
5117: </div>
5118:
5119: <p>Utilities for keeping track of installed packages,
5120: being up to date, etc:</p>
5121:
5122: <div class="itemizedlist">
5123: <ul type="disc">
5124: <li>
5125: <p><a xmlns=
5126: "http://www.w3.org/TR/xhtml1/transitional" href=
5127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5128: target="_top"><code xmlns="" class=
5129: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5130: packages whose installed versions do not match the
1.34 wiz 5131: latest pkgsrc entries.</p>
1.1 grant 5132: </li>
5133:
5134: <li>
5135: <p><a xmlns=
5136: "http://www.w3.org/TR/xhtml1/transitional" href=
5137: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5138: target="_top"><code xmlns="" class=
5139: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5140: dependency graphs of packages, to aid in choosing a
1.34 wiz 5141: strategy for updating.</p>
1.1 grant 5142: </li>
5143:
5144: <li>
5145: <p><a xmlns=
5146: "http://www.w3.org/TR/xhtml1/transitional" href=
5147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5148: target="_top"><code xmlns="" class=
5149: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5150: graphs from the output of <a xmlns=
5151: "http://www.w3.org/TR/xhtml1/transitional" href=
5152: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5153: target="_top"><code xmlns="" class=
5154: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5155: graphviz).</p>
1.1 grant 5156: </li>
5157:
5158: <li>
5159: <p><a xmlns=
5160: "http://www.w3.org/TR/xhtml1/transitional" href=
5161: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5162: target="_top"><code xmlns="" class=
5163: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5164: pkglint(1) program checks a pkgsrc entry for
5165: errors, lintpkgsrc(1) does various checks on the
5166: complete pkgsrc system.</p>
1.1 grant 5167: </li>
5168:
5169: <li>
5170: <p><a xmlns=
5171: "http://www.w3.org/TR/xhtml1/transitional" href=
5172: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5173: target="_top"><code xmlns="" class=
5174: "filename">pkgtools/pkgsurvey</code></a>: Report
5175: what packages you have installed.</p>
1.1 grant 5176: </li>
5177: </ul>
5178: </div>
5179:
5180: <p>Utilities for people maintaining or creating
5181: individual packages:</p>
5182:
5183: <div class="itemizedlist">
5184: <ul type="disc">
5185: <li>
5186: <p><a xmlns=
5187: "http://www.w3.org/TR/xhtml1/transitional" href=
5188: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5189: target="_top"><code xmlns="" class=
5190: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5191: making and maintaining patches for a package
1.34 wiz 5192: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5193: </li>
5194:
5195: <li>
5196: <p><a xmlns=
5197: "http://www.w3.org/TR/xhtml1/transitional" href=
5198: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5199: target="_top"><code xmlns="" class=
5200: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5201: "http://www.w3.org/TR/xhtml1/transitional" href=
5202: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5203: target="_top"><code xmlns="" class=
5204: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5205: converting to pkgsrc.</p>
1.1 grant 5206: </li>
5207:
5208: <li>
5209: <p><a xmlns=
5210: "http://www.w3.org/TR/xhtml1/transitional" href=
5211: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5212: target="_top"><code xmlns="" class=
5213: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5214: pkgsrc to a Solaris package.</p>
1.1 grant 5215: </li>
5216: </ul>
5217: </div>
5218:
1.47 reed 5219: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5220: obscure pkg utilities)</p>
5221:
5222: <div class="itemizedlist">
5223: <ul type="disc">
5224: <li>
5225: <p><a xmlns=
5226: "http://www.w3.org/TR/xhtml1/transitional" href=
5227: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5228: target="_top"><code xmlns="" class=
5229: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5230: packages in a chrooted area.</p>
1.1 grant 5231: </li>
5232:
5233: <li>
5234: <p><a xmlns=
5235: "http://www.w3.org/TR/xhtml1/transitional" href=
5236: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5237: target="_top"><code xmlns="" class=
5238: "filename">pkgtools/libkver</code></a>: Spoof
5239: kernel version for chrooted cross builds.</p>
1.1 grant 5240: </li>
5241: </ul>
5242: </div>
5243: </div>
5244:
1.55 rillig 5245: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5246: <div class="titlepage">
5247: <div>
5248: <div>
5249: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5250: "non-root-pkgsrc" id=
1.38 dillo 5251: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5252: as non-root</h2>
1.1 grant 5253: </div>
5254: </div>
5255: </div>
5256:
5257: <p>If you want to use pkgsrc as non-root user, you can
5258: set some variables to make pkgsrc work under these
1.33 jmmv 5259: conditions. At the very least, you need to set
5260: <code class="varname">UNPRIVILEGED</code> to
5261: “<span class="quote">yes</span>”; this will
5262: turn on unprivileged mode and set multiple related
5263: variables to allow installation of packages as
5264: non-root.</p>
5265:
5266: <p>In case the defaults are not enough, you may want to
5267: tune some other variables used. For example, if the
5268: automatic user/group detection leads to incorrect values
5269: (or not the ones you would like to use), you can change
5270: them by setting <code class=
5271: "varname">UNPRIVILEGED_USER</code> and <code class=
5272: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5273:
5274: <p>As regards bootstrapping, please note that the
5275: <span><strong class="command">bootstrap</strong></span>
5276: script will ease non-root configuration when given the
5277: “<span class=
5278: "quote">--ignore-user-check</span>” flag, as it
5279: will choose and use multiple default directories under
1.45 wiz 5280: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5281: class="filename">~/pkg</code> as the installation
1.33 jmmv 5282: targets. These directories can be overriden by the
5283: “<span class="quote">--prefix</span>” flag
5284: provided by the script, as well as some others that allow
5285: finer tuning of the tree layout.</p>
1.14 xtraeme 5286: </div>
5287:
1.55 rillig 5288: <div class="sect1" lang="en" xml:lang="en">
1.14 xtraeme 5289: <div class="titlepage">
5290: <div>
5291: <div>
5292: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5293: "resume-transfers" id=
1.38 dillo 5294: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5295: transfers when fetching distfiles?</h2>
1.14 xtraeme 5296: </div>
5297: </div>
5298: </div>
5299:
1.47 reed 5300: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5301: but you can enable this feature by adding the option
5302: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5303: into <code xmlns=
5304: "http://www.w3.org/TR/xhtml1/transitional" class=
5305: "filename">/etc/mk.conf</code>. If, during a fetch step,
5306: an incomplete distfile is found, pkgsrc will try to
5307: resume it.</p>
1.15 xtraeme 5308:
5309: <p>You can also use a different program than the default
1.24 wiz 5310: <a href=
5311: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5312: <span class="citerefentry"><span class=
5313: "refentrytitle">ftp</span>(1)</span></a> by changing the
5314: <code class="varname">FETCH_CMD</code> variable. Don't
5315: forget to set <code class=
5316: "varname">FETCH_RESUME_ARGS</code> and <code class=
5317: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5318: default values.</p>
1.14 xtraeme 5319:
1.45 wiz 5320: <p>For example, if you want to use <code xmlns=
5321: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5322: "filename">wget</code> to resume downloads, you'll have
5323: to use something like:</p>
5324: <pre class="programlisting">
1.51 rillig 5325: FETCH_CMD= wget
5326: FETCH_BEFORE_ARGS= --passive-ftp
5327: FETCH_RESUME_ARGS= -c
5328: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5329: </pre>
1.1 grant 5330: </div>
5331:
1.55 rillig 5332: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5333: <div class="titlepage">
5334: <div>
5335: <div>
5336: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5337: "XFree86-from-pkgsrc" id=
1.38 dillo 5338: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5339: install/use XFree86 from pkgsrc?</h2>
5340: </div>
5341: </div>
5342: </div>
5343:
5344: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5345: system's own X11 (<code xmlns=
5346: "http://www.w3.org/TR/xhtml1/transitional" class=
5347: "filename">/usr/X11R6</code>, <code xmlns=
5348: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5349: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5350: add the following line into <code xmlns=
5351: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5352: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5353: <pre class="programlisting">
1.51 rillig 5354: X11_TYPE=XFree86
1.1 grant 5355: </pre>
5356: </div>
5357:
1.55 rillig 5358: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5359: <div class="titlepage">
5360: <div>
5361: <div>
5362: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5363: "x.org-from-pkgsrc" id=
1.38 dillo 5364: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5365: install/use X.org from pkgsrc?</h2>
5366: </div>
5367: </div>
5368: </div>
5369:
5370: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5371: system's own X11 (<code xmlns=
5372: "http://www.w3.org/TR/xhtml1/transitional" class=
5373: "filename">/usr/X11R6</code>, <code xmlns=
5374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5375: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5376: the following line into <code xmlns=
5377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5378: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5379: <pre class="programlisting">
1.51 rillig 5380: X11_TYPE=xorg
1.1 grant 5381: </pre>
5382: </div>
5383:
1.55 rillig 5384: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5385: <div class="titlepage">
5386: <div>
5387: <div>
5388: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5389: "fetch-behind-firewall" id=
1.38 dillo 5390: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5391: files from behind a firewall</h2>
1.1 grant 5392: </div>
5393: </div>
5394: </div>
5395:
5396: <p>If you are sitting behind a firewall which does not
5397: allow direct connections to Internet hosts (i.e.
5398: non-NAT), you may specify the relevant proxy hosts. This
5399: is done using an environment variable in the form of a
1.47 reed 5400: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5401: "quote">orpheus.amdahl.com</span>” is one of the
5402: firewalls, and it uses port 80 as the proxy port number.
5403: So the proxy environment variables are:</p>
5404: <pre class="programlisting">
1.51 rillig 5405: ftp_proxy=ftp://orpheus.amdahl.com:80/
5406: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5407: </pre>
5408: </div>
5409:
1.55 rillig 5410: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5411: <div class="titlepage">
5412: <div>
5413: <div>
5414: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5415: "passive-ftp" id="passive-ftp"></a>7.9. How do
5416: I tell <span><strong class="command">make
1.14 xtraeme 5417: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5418: </div>
5419: </div>
5420: </div>
5421:
5422: <p>This depends on which utility is used to retrieve
1.45 wiz 5423: distfiles. From <code xmlns=
5424: "http://www.w3.org/TR/xhtml1/transitional" class=
5425: "filename">bsd.pkg.mk</code>, <code class=
5426: "varname">FETCH_CMD</code> is assigned the first
5427: available command from the following list:</p>
1.34 wiz 5428:
5429: <div class="itemizedlist">
5430: <ul type="disc">
5431: <li>
1.45 wiz 5432: <p><code xmlns=
5433: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5434: "filename">${LOCALBASE}/bin/ftp</code></p>
5435: </li>
5436:
5437: <li>
1.45 wiz 5438: <p><code xmlns=
5439: "http://www.w3.org/TR/xhtml1/transitional" class=
5440: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5441: </li>
5442: </ul>
5443: </div>
1.1 grant 5444:
5445: <p>On a default NetBSD installation, this will be
1.45 wiz 5446: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5447: class="filename">/usr/bin/ftp</code>, which automatically
5448: tries passive connections first, and falls back to active
5449: connections if the server refuses to do passive. For the
5450: other tools, add the following to your <code xmlns=
5451: "http://www.w3.org/TR/xhtml1/transitional" class=
5452: "filename">/etc/mk.conf</code> file: <code class=
5453: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5454:
1.45 wiz 5455: <p>Having that option present will prevent <code xmlns=
5456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5457: "filename">/usr/bin/ftp</code> from falling back to
5458: active transfers.</p>
1.1 grant 5459: </div>
5460:
1.55 rillig 5461: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5462: <div class="titlepage">
5463: <div>
5464: <div>
5465: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5466: "fetching-all-distfiles" id=
1.38 dillo 5467: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5468: fetch all distfiles at once</h2>
5469: </div>
5470: </div>
5471: </div>
5472:
5473: <p>You would like to download all the distfiles in a
5474: single batch from work or university, where you can't run
1.14 xtraeme 5475: a <span><strong class="command">make
5476: fetch</strong></span>. There is an archive of distfiles
5477: on <a href=
1.1 grant 5478: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5479: target="_top">ftp.NetBSD.org</a>, but downloading the
5480: entire directory may not be appropriate.</p>
5481:
1.14 xtraeme 5482: <p>The answer here is to do a <span><strong class=
1.45 wiz 5483: "command">make fetch-list</strong></span> in <code xmlns=
5484: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5485: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5486: subdirectories, carry the resulting list to your machine
1.23 wiz 5487: at work/school and use it there. If you don't have a
1.24 wiz 5488: NetBSD-compatible <a href=
5489: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5490: <span class="citerefentry"><span class=
5491: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5492: at work, don't forget to set <code class=
5493: "varname">FETCH_CMD</code> to something that fetches a
5494: URL:</p>
1.1 grant 5495:
5496: <p>At home:</p>
5497: <pre class="screen">
1.14 xtraeme 5498: <code class="prompt">%</code> <strong class=
5499: "userinput"><code>cd /usr/pkgsrc</code></strong>
5500: <code class="prompt">%</code> <strong class=
5501: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5502: <code class="prompt">%</code> <strong class=
5503: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5504: </pre>
5505:
5506: <p>At work:</p>
5507: <pre class="screen">
1.14 xtraeme 5508: <code class="prompt">%</code> <strong class=
5509: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5510: </pre>
5511:
1.45 wiz 5512: <p>then tar up <code xmlns=
5513: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5514: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5515:
5516: <p>If you have a machine running NetBSD, and you want to
5517: get <span class="emphasis"><em>all</em></span> distfiles
5518: (even ones that aren't for your machine architecture),
5519: you can do so by using the above-mentioned
1.14 xtraeme 5520: <span><strong class="command">make
5521: fetch-list</strong></span> approach, or fetch the
5522: distfiles directly by running:</p>
1.1 grant 5523: <pre class="screen">
1.14 xtraeme 5524: <code class="prompt">%</code> <strong class=
5525: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5526: </pre>
5527:
1.14 xtraeme 5528: <p>If you even decide to ignore <code class=
5529: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5530: can get everything by running:</p>
1.1 grant 5531: <pre class="screen">
1.14 xtraeme 5532: <code class="prompt">%</code> <strong class=
5533: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5534: </pre>
5535: </div>
5536:
1.55 rillig 5537: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5538: <div class="titlepage">
5539: <div>
5540: <div>
5541: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5542: "tmac.andoc-missing" id=
1.38 dillo 5543: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5544: “<span class="quote">Don't know how to make
5545: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5546: </div>
5547: </div>
5548: </div>
5549:
5550: <p>When compiling the <a xmlns=
5551: "http://www.w3.org/TR/xhtml1/transitional" href=
5552: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5553: target="_top"><code xmlns="" class=
5554: "filename">pkgtools/pkg_install</code></a> package, you
5555: get the error from make that it doesn't know how to make
5556: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5557: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5558: indicates that you don't have installed the
1.23 wiz 5559: “<span class="quote">text</span>” set (nroff,
5560: ...) from the NetBSD base distribution on your machine.
1.47 reed 5561: It is recommended to do that to format man pages.</p>
1.1 grant 5562:
5563: <p>In the case of the <a xmlns=
5564: "http://www.w3.org/TR/xhtml1/transitional" href=
5565: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5566: target="_top"><code xmlns="" class=
5567: "filename">pkgtools/pkg_install</code></a> package, you
5568: can get away with setting <code class=
1.20 ben 5569: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5570: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5571: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5572: </div>
5573:
1.55 rillig 5574: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5575: <div class="titlepage">
5576: <div>
5577: <div>
5578: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5579: "bsd.own.mk-missing" id=
1.38 dillo 5580: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5581: “<span class="quote">Could not find
5582: bsd.own.mk</span>” mean?</h2>
5583: </div>
5584: </div>
5585: </div>
5586:
1.45 wiz 5587: <p>You didn't install the compiler set, <code xmlns=
5588: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5589: "filename">comp.tgz</code>, when you installed your
1.47 reed 5590: NetBSD machine. Please get and install it, by extracting
5591: it in <code xmlns=
1.45 wiz 5592: "http://www.w3.org/TR/xhtml1/transitional" class=
5593: "filename">/</code>:</p>
1.1 grant 5594: <pre class="screen">
1.14 xtraeme 5595: <code class="prompt">#</code> <strong class=
5596: "userinput"><code>cd /</code></strong>
5597: <code class="prompt">#</code> <strong class=
5598: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5599: </pre>
5600:
1.45 wiz 5601: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5602: class="filename">comp.tgz</code> is part of every NetBSD
5603: release. Get the one that corresponds to your release
5604: (determine via <span><strong class="command">uname
5605: -r</strong></span>).</p>
1.1 grant 5606: </div>
5607:
1.55 rillig 5608: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5609: <div class="titlepage">
5610: <div>
5611: <div>
5612: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5613: "using-sudo-with-pkgsrc" id=
1.38 dillo 5614: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5615: 'sudo' with pkgsrc</h2>
5616: </div>
5617: </div>
5618: </div>
5619:
5620: <p>When installing packages as non-root user and using
1.24 wiz 5621: the just-in-time <a href=
5622: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5623: <span class="citerefentry"><span class=
5624: "refentrytitle">su</span>(1)</span></a> feature of
5625: pkgsrc, it can become annoying to type in the root
5626: password for each required package installed. To avoid
5627: this, the sudo package can be used, which does password
5628: caching over a limited time. To use it, install sudo
5629: (either as binary package or from <a xmlns=
5630: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5631: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5632: target="_top"><code xmlns="" class=
5633: "filename">security/sudo</code></a>) and then put the
5634: following into your <code xmlns=
5635: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5636: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5637: <pre class="programlisting">
1.51 rillig 5638: .if exists(${LOCALBASE}/bin/sudo)
5639: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5640: .endif
1.1 grant 5641: </pre>
5642: </div>
5643:
1.55 rillig 5644: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5645: <div class="titlepage">
5646: <div>
5647: <div>
5648: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5649: "faq.conf" id="faq.conf"></a>7.14. How do I
5650: change the location of configuration files?</h2>
1.1 grant 5651: </div>
5652: </div>
5653: </div>
5654:
1.35 jmmv 5655: <p>As the system administrator, you can choose where
5656: configuration files are installed. The default settings
1.45 wiz 5657: make all these files go into <code xmlns=
5658: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5659: "filename">${PREFIX}/etc</code> or some of its
5660: subdirectories; this may be suboptimal depending on your
5661: expectations (e.g., a read-only, NFS-exported
5662: <code class="varname">PREFIX</code> with a need of
5663: per-machine configuration of the provided packages).</p>
5664:
5665: <p>In order to change the defaults, you can modify the
5666: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5667: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5668: class="filename">/etc/mk.conf</code>) to point to your
5669: preferred configuration directory; some common examples
5670: include <code xmlns=
5671: "http://www.w3.org/TR/xhtml1/transitional" class=
5672: "filename">/etc</code> or <code xmlns=
5673: "http://www.w3.org/TR/xhtml1/transitional" class=
5674: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5675:
5676: <p>Furthermore, you can change this value on a
5677: per-package basis by setting the <code class=
5678: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5679: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5680: value usually matches the name of the package you would
5681: like to modify, that is, the contents of <code class=
5682: "varname">PKGBASE</code>.</p>
1.1 grant 5683:
1.47 reed 5684: <p>Note that after changing these settings, you must
1.35 jmmv 5685: rebuild and reinstall any affected packages.</p>
1.1 grant 5686: </div>
5687:
1.55 rillig 5688: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5689: <div class="titlepage">
5690: <div>
5691: <div>
5692: <h2 class="title" style="clear: both"><a name=
1.55 rillig 5693: "audit-packages" id=
1.38 dillo 5694: "audit-packages"></a>7.15. Automated security
1.1 grant 5695: checks</h2>
5696: </div>
5697: </div>
5698: </div>
5699:
5700: <p>Please be aware that there can often be bugs in
5701: third-party software, and some of these bugs can leave a
5702: machine vulnerable to exploitation by attackers. In an
5703: effort to lessen the exposure, the NetBSD packages team
5704: maintains a database of known-exploits to packages which
5705: have at one time been included in pkgsrc. The database
5706: can be downloaded automatically, and a security audit of
5707: all packages installed on a system can take place. To do
5708: this, install the <a xmlns=
5709: "http://www.w3.org/TR/xhtml1/transitional" href=
5710: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5711: target="_top"><code xmlns="" class=
5712: "filename">security/audit-packages</code></a> package. It
1.20 ben 5713: has two components:</p>
1.1 grant 5714:
5715: <div class="orderedlist">
5716: <ol type="1">
5717: <li>
1.34 wiz 5718: <p><span><strong class=
5719: "command">download-vulnerability-list</strong></span>,
1.1 grant 5720: an easy way to download a list of the security
5721: vulnerabilities information. This list is kept up
5722: to date by the NetBSD security officer and the
5723: NetBSD packages team, and is distributed from the
5724: NetBSD ftp server:</p>
5725:
5726: <p><a href=
5727: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5728: target=
5729: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5730: </li>
5731:
5732: <li>
1.34 wiz 5733: <p><span><strong class=
5734: "command">audit-packages</strong></span>, an easy
5735: way to audit the current machine, checking each
1.1 grant 5736: vulnerability which is known. If a vulnerable
5737: package is installed, it will be shown by output to
5738: stdout, including a description of the type of
5739: vulnerability, and a URL containing more
5740: information.</p>
5741: </li>
5742: </ol>
5743: </div>
5744:
1.23 wiz 5745: <p>Use of the <a xmlns=
5746: "http://www.w3.org/TR/xhtml1/transitional" href=
5747: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5748: target="_top"><code xmlns="" class=
5749: "filename">security/audit-packages</code></a> package is
1.23 wiz 5750: strongly recommended! After “<span class=
5751: "quote">audit-packages</span>” is installed, please
5752: read the package's message, which you can get by running
5753: <strong class="userinput"><code>pkg_info -D
5754: audit-package</code></strong>.</p>
1.1 grant 5755: </div>
5756: </div>
5757: </div>
5758:
1.55 rillig 5759: <div class="part" lang="en" xml:lang="en">
1.1 grant 5760: <div class="titlepage">
5761: <div>
5762: <div>
1.55 rillig 5763: <h1 class="title"><a name="developers-guide" id=
1.48 dillo 5764: "developers-guide"></a>Part II. The pkgsrc
5765: developer's guide</h1>
1.1 grant 5766: </div>
5767: </div>
5768: </div>
5769:
5770: <div class="toc">
5771: <p><b>Table of Contents</b></p>
5772:
5773: <dl>
1.38 dillo 5774: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5775: Package components - files, directories and
5776: contents</a></span></dt>
5777:
5778: <dd>
5779: <dl>
5780: <dt><span class="sect1"><a href=
1.45 wiz 5781: "#components.Makefile">8.1. <code xmlns=
5782: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5783: "filename">Makefile</code></a></span></dt>
5784:
5785: <dt><span class="sect1"><a href=
1.45 wiz 5786: "#components.distinfo">8.2. <code xmlns=
5787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5788: "filename">distinfo</code></a></span></dt>
5789:
5790: <dt><span class="sect1"><a href=
1.38 dillo 5791: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5792:
1.30 wiz 5793: <dt><span class="sect1"><a href=
1.38 dillo 5794: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5795: files</a></span></dt>
1.27 rillig 5796:
5797: <dt><span class="sect1"><a href=
1.38 dillo 5798: "#components.optional">8.5. Optional
1.27 rillig 5799: files</a></span></dt>
5800:
1.38 dillo 5801: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5802: <code xmlns=
5803: "http://www.w3.org/TR/xhtml1/transitional" class=
5804: "filename">work*</code></a></span></dt>
1.27 rillig 5805:
1.38 dillo 5806: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5807: <code xmlns=
5808: "http://www.w3.org/TR/xhtml1/transitional" class=
5809: "filename">files/*</code></a></span></dt>
1.27 rillig 5810: </dl>
5811: </dd>
5812:
1.38 dillo 5813: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5814: Programming in <code xmlns=
5815: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5816: "filename">Makefile</code>s</a></span></dt>
5817:
5818: <dd>
5819: <dl>
5820: <dt><span class="sect1"><a href=
1.45 wiz 5821: "#makefile.variables">9.1. <code xmlns=
5822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5823: "filename">Makefile</code> variables</a></span></dt>
5824:
1.27 rillig 5825: <dd>
5826: <dl>
5827: <dt><span class="sect2"><a href=
1.38 dillo 5828: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5829: conventions</a></span></dt>
5830: </dl>
5831: </dd>
5832:
1.38 dillo 5833: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5834: Code snippets</a></span></dt>
5835:
5836: <dd>
5837: <dl>
5838: <dt><span class="sect2"><a href=
1.38 dillo 5839: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5840: list</a></span></dt>
5841:
5842: <dt><span class="sect2"><a href=
1.38 dillo 5843: "#converting-internal-to-external">9.2.2.
1.30 wiz 5844: Converting an internal list into an external
5845: list</a></span></dt>
1.25 rillig 5846:
5847: <dt><span class="sect2"><a href=
1.38 dillo 5848: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5849: variables to a shell command</a></span></dt>
1.27 rillig 5850:
5851: <dt><span class="sect2"><a href=
1.38 dillo 5852: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5853: guideline</a></span></dt>
5854:
5855: <dt><span class="sect2"><a href=
1.38 dillo 5856: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5857: a bug in BSD Make</a></span></dt>
1.25 rillig 5858: </dl>
5859: </dd>
5860: </dl>
5861: </dd>
5862:
1.38 dillo 5863: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5864: issues</a></span></dt>
5865:
5866: <dd>
5867: <dl>
1.38 dillo 5868: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5869: ID</a></span></dt>
5870:
1.30 wiz 5871: <dt><span class="sect1"><a href=
1.38 dillo 5872: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5873: <code xmlns=
5874: "http://www.w3.org/TR/xhtml1/transitional" class=
5875: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5876:
1.38 dillo 5877: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5878: Tweaking output of <span><strong class="command">make
5879: print-PLIST</strong></span></a></span></dt>
1.1 grant 5880:
1.38 dillo 5881: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5882: Variable substitution in PLIST</a></span></dt>
5883:
1.30 wiz 5884: <dt><span class="sect1"><a href=
1.48 dillo 5885: "#manpage-compression">10.5. Man page
5886: compression</a></span></dt>
1.1 grant 5887:
1.30 wiz 5888: <dt><span class="sect1"><a href=
1.38 dillo 5889: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5890: <code class=
1.14 xtraeme 5891: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5892:
1.30 wiz 5893: <dt><span class="sect1"><a href=
1.47 reed 5894: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5895: and differing PLISTs</a></span></dt>
1.1 grant 5896:
5897: <dt><span class="sect1"><a href=
1.38 dillo 5898: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5899: packages</a></span></dt>
5900: </dl>
5901: </dd>
5902:
1.38 dillo 5903: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5904: Buildlink methodology</a></span></dt>
5905:
5906: <dd>
5907: <dl>
1.30 wiz 5908: <dt><span class="sect1"><a href=
1.38 dillo 5909: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5910: to use buildlink3</a></span></dt>
1.1 grant 5911:
1.30 wiz 5912: <dt><span class="sect1"><a href=
1.45 wiz 5913: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5915: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5916:
5917: <dd>
5918: <dl>
5919: <dt><span class="sect2"><a href=
1.38 dillo 5920: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5921: buildlink3.mk file</a></span></dt>
1.1 grant 5922:
5923: <dt><span class="sect2"><a href=
1.38 dillo 5924: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5925: <code class=
1.55 rillig 5926: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
5927: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 5928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5929: "filename">buildlink3.mk</code>
1.1 grant 5930: files</a></span></dt>
5931: </dl>
5932: </dd>
5933:
1.30 wiz 5934: <dt><span class="sect1"><a href=
1.45 wiz 5935: "#writing-builtin.mk">11.3. Writing <code xmlns=
5936: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5937: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5938:
5939: <dd>
5940: <dl>
5941: <dt><span class="sect2"><a href=
1.38 dillo 5942: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5943: <code xmlns=
5944: "http://www.w3.org/TR/xhtml1/transitional" class=
5945: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5946:
5947: <dt><span class="sect2"><a href=
1.38 dillo 5948: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5949: preferences for native or pkgsrc
5950: software</a></span></dt>
1.1 grant 5951: </dl>
5952: </dd>
5953: </dl>
5954: </dd>
5955:
1.38 dillo 5956: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5957: pkginstall framework</a></span></dt>
5958:
5959: <dd>
5960: <dl>
5961: <dt><span class="sect1"><a href=
1.38 dillo 5962: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5963: directories outside the installation
5964: prefix</a></span></dt>
5965:
5966: <dd>
5967: <dl>
5968: <dt><span class="sect2"><a href=
1.38 dillo 5969: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5970: manipulation</a></span></dt>
5971:
5972: <dt><span class="sect2"><a href=
1.38 dillo 5973: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5974: manipulation</a></span></dt>
5975: </dl>
5976: </dd>
5977:
1.38 dillo 5978: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5979: Configuration files</a></span></dt>
5980:
5981: <dd>
5982: <dl>
5983: <dt><span class="sect2"><a href=
1.38 dillo 5984: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5985: "varname">PKG_SYSCONFDIR</code> is
5986: set</a></span></dt>
5987:
5988: <dt><span class="sect2"><a href=
1.38 dillo 5989: "#conf-files-configure">12.2.2. Telling the
1.47 reed 5990: software where configuration files
1.35 jmmv 5991: are</a></span></dt>
5992:
5993: <dt><span class="sect2"><a href=
1.38 dillo 5994: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5995: installations</a></span></dt>
5996:
5997: <dt><span class="sect2"><a href=
1.38 dillo 5998: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5999: of configuration files</a></span></dt>
6000: </dl>
6001: </dd>
6002:
1.38 dillo 6003: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6004: System startup scripts</a></span></dt>
6005:
6006: <dd>
6007: <dl>
6008: <dt><span class="sect2"><a href=
1.38 dillo 6009: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6010: of system startup scripts</a></span></dt>
6011: </dl>
6012: </dd>
6013:
6014: <dt><span class="sect1"><a href=
1.38 dillo 6015: "#users-and-groups">12.4. System users and
1.35 jmmv 6016: groups</a></span></dt>
6017:
1.38 dillo 6018: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6019: System shells</a></span></dt>
6020:
6021: <dd>
6022: <dl>
6023: <dt><span class="sect2"><a href=
1.38 dillo 6024: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 6025: configuration files</a></span></dt>
6026: </dl>
6027: </dd>
6028: </dl>
6029: </dd>
6030:
1.38 dillo 6031: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6032: handling</a></span></dt>
6033:
6034: <dd>
6035: <dl>
1.30 wiz 6036: <dt><span class="sect1"><a href=
1.38 dillo 6037: "#global-default-options">13.1. Global default
1.30 wiz 6038: options</a></span></dt>
1.1 grant 6039:
1.30 wiz 6040: <dt><span class="sect1"><a href=
1.38 dillo 6041: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6042: use <code xmlns=
6043: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6044: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6045:
6046: <dt><span class="sect1"><a href="#option-names">13.3.
6047: Option Names</a></span></dt>
1.1 grant 6048: </dl>
6049: </dd>
6050:
1.38 dillo 6051: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6052: process</a></span></dt>
6053:
6054: <dd>
6055: <dl>
1.56 ! rillig 6056: <dt><span class="sect1"><a href="#build.intro">14.1.
! 6057: Introduction</a></span></dt>
! 6058:
! 6059: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6060: Program location</a></span></dt>
6061:
1.56 ! rillig 6062: <dt><span class="sect1"><a href=
! 6063: "#build.builddirs">14.3. Directories used during the
! 6064: build process</a></span></dt>
1.1 grant 6065:
6066: <dt><span class="sect1"><a href=
1.56 ! rillig 6067: "#build.running">14.4. Running a
! 6068: phase</a></span></dt>
! 6069:
! 6070: <dt><span class="sect1"><a href="#build.fetch">14.5.
! 6071: The <span class="emphasis"><em>fetch</em></span>
! 6072: phase</a></span></dt>
! 6073:
! 6074: <dt><span class="sect1"><a href=
! 6075: "#build.checksum">14.6. The <span class=
! 6076: "emphasis"><em>checksum</em></span>
! 6077: phase</a></span></dt>
! 6078:
! 6079: <dt><span class="sect1"><a href=
! 6080: "#build.extract">14.7. The <span class=
! 6081: "emphasis"><em>extract</em></span>
! 6082: phase</a></span></dt>
! 6083:
! 6084: <dt><span class="sect1"><a href="#build.patch">14.8.
! 6085: The <span class="emphasis"><em>patch</em></span>
! 6086: phase</a></span></dt>
! 6087:
! 6088: <dt><span class="sect1"><a href="#build.tools">14.9.
! 6089: The <span class="emphasis"><em>tools</em></span>
! 6090: phase</a></span></dt>
! 6091:
! 6092: <dt><span class="sect1"><a href=
! 6093: "#build.wrapper">14.10. The <span class=
! 6094: "emphasis"><em>wrapper</em></span>
! 6095: phase</a></span></dt>
! 6096:
! 6097: <dt><span class="sect1"><a href=
! 6098: "#build.configure">14.11. The <span class=
! 6099: "emphasis"><em>configure</em></span>
! 6100: phase</a></span></dt>
! 6101:
! 6102: <dt><span class="sect1"><a href="#build.build">14.12.
! 6103: The <span class="emphasis"><em>build</em></span>
! 6104: phase</a></span></dt>
! 6105:
! 6106: <dt><span class="sect1"><a href="#build.test">14.13.
! 6107: The <span class="emphasis"><em>test</em></span>
! 6108: phase</a></span></dt>
! 6109:
! 6110: <dt><span class="sect1"><a href=
! 6111: "#build.install">14.14. The <span class=
! 6112: "emphasis"><em>install</em></span>
! 6113: phase</a></span></dt>
! 6114:
! 6115: <dt><span class="sect1"><a href=
! 6116: "#build.package">14.15. The <span class=
! 6117: "emphasis"><em>package</em></span>
! 6118: phase</a></span></dt>
! 6119:
! 6120: <dt><span class="sect1"><a href=
! 6121: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6122: targets</a></span></dt>
6123: </dl>
6124: </dd>
6125:
1.55 rillig 6126: <dt><span class="chapter"><a href="#fixes">15. Making
6127: your package work</a></span></dt>
1.1 grant 6128:
6129: <dd>
6130: <dl>
1.30 wiz 6131: <dt><span class="sect1"><a href=
1.38 dillo 6132: "#general-operation">15.1. General
1.30 wiz 6133: operation</a></span></dt>
1.1 grant 6134:
6135: <dd>
6136: <dl>
6137: <dt><span class="sect2"><a href=
1.38 dillo 6138: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 6139: pull in variables from
6140: /etc/mk.conf</a></span></dt>
1.1 grant 6141:
6142: <dt><span class="sect2"><a href=
1.38 dillo 6143: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 6144: to install documentation</a></span></dt>
6145:
6146: <dt><span class="sect2"><a href=
1.38 dillo 6147: "#restricted-packages">15.1.3. Restricted
1.1 grant 6148: packages</a></span></dt>
6149:
6150: <dt><span class="sect2"><a href=
1.38 dillo 6151: "#dependencies">15.1.4. Handling
1.1 grant 6152: dependencies</a></span></dt>
6153:
6154: <dt><span class="sect2"><a href=
1.38 dillo 6155: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 6156: other packages</a></span></dt>
6157:
6158: <dt><span class="sect2"><a href=
1.38 dillo 6159: "#not-building-packages">15.1.6. Packages that
1.30 wiz 6160: cannot or should not be built</a></span></dt>
1.1 grant 6161:
6162: <dt><span class="sect2"><a href=
1.38 dillo 6163: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6164: should not be deleted, once
6165: installed</a></span></dt>
1.1 grant 6166:
6167: <dt><span class="sect2"><a href=
1.38 dillo 6168: "#security-handling">15.1.8. Handling packages
1.1 grant 6169: with security problems</a></span></dt>
6170:
6171: <dt><span class="sect2"><a href=
1.38 dillo 6172: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6173: bugs</a></span></dt>
6174:
6175: <dt><span class="sect2"><a href=
1.38 dillo 6176: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6177: incrementing versions when fixing an existing
1.1 grant 6178: package</a></span></dt>
6179:
6180: <dt><span class="sect2"><a href=
1.38 dillo 6181: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6182: of packages</a></span></dt>
1.1 grant 6183: </dl>
6184: </dd>
6185:
1.30 wiz 6186: <dt><span class="sect1"><a href=
1.38 dillo 6187: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6188: issues</a></span></dt>
1.1 grant 6189:
6190: <dd>
6191: <dl>
6192: <dt><span class="sect2"><a href=
1.38 dillo 6193: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6194: distfiles aren't available for plain
1.1 grant 6195: downloading</a></span></dt>
6196:
6197: <dt><span class="sect2"><a href=
1.38 dillo 6198: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6199: handle modified distfiles with the 'old'
6200: name</a></span></dt>
1.1 grant 6201: </dl>
6202: </dd>
6203:
1.30 wiz 6204: <dt><span class="sect1"><a href=
1.38 dillo 6205: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6206: gotchas</a></span></dt>
1.1 grant 6207:
6208: <dd>
6209: <dl>
6210: <dt><span class="sect2"><a href=
1.38 dillo 6211: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6212: libtool</a></span></dt>
6213:
6214: <dt><span class="sect2"><a href=
1.38 dillo 6215: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6216: packages that already support
6217: libtool</a></span></dt>
6218:
6219: <dt><span class="sect2"><a href=
1.38 dillo 6220: "#autoconf-automake">15.3.3. GNU
1.1 grant 6221: Autoconf/Automake</a></span></dt>
6222: </dl>
6223: </dd>
6224:
1.55 rillig 6225: <dt><span class="sect1"><a href="#fixes-build">15.4.
6226: Building the package</a></span></dt>
1.1 grant 6227:
6228: <dd>
6229: <dl>
6230: <dt><span class="sect2"><a href=
1.38 dillo 6231: "#cpp-defines">15.4.1. CPP
1.30 wiz 6232: defines</a></span></dt>
1.51 rillig 6233:
6234: <dt><span class="sect2"><a href=
6235: "#cpp-list">15.4.2. Getting a list of CPP
6236: defines</a></span></dt>
1.1 grant 6237: </dl>
6238: </dd>
6239:
1.30 wiz 6240: <dt><span class="sect1"><a href=
1.38 dillo 6241: "#package-specific-actions">15.5. Package specific
1.30 wiz 6242: actions</a></span></dt>
1.1 grant 6243:
6244: <dd>
6245: <dl>
6246: <dt><span class="sect2"><a href=
1.38 dillo 6247: "#user-interaction">15.5.1. User
1.2 hubertf 6248: interaction</a></span></dt>
1.1 grant 6249:
6250: <dt><span class="sect2"><a href=
1.38 dillo 6251: "#handling-licenses">15.5.2. Handling
1.1 grant 6252: licenses</a></span></dt>
6253:
6254: <dt><span class="sect2"><a href=
1.38 dillo 6255: "#installing-score-files">15.5.3. Installing
1.30 wiz 6256: score files</a></span></dt>
1.1 grant 6257:
6258: <dt><span class="sect2"><a href=
1.38 dillo 6259: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6260: scripts</a></span></dt>
6261:
6262: <dt><span class="sect2"><a href=
1.38 dillo 6263: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6264: hardcoded paths to other
6265: interpreters</a></span></dt>
1.1 grant 6266:
6267: <dt><span class="sect2"><a href=
1.38 dillo 6268: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6269: modules</a></span></dt>
6270:
6271: <dt><span class="sect2"><a href=
1.38 dillo 6272: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6273: info files</a></span></dt>
6274:
6275: <dt><span class="sect2"><a href=
1.38 dillo 6276: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 6277: GConf2 data files</a></span></dt>
1.1 grant 6278:
6279: <dt><span class="sect2"><a href=
1.38 dillo 6280: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 6281: installing scrollkeeper data
6282: files</a></span></dt>
1.1 grant 6283:
6284: <dt><span class="sect2"><a href=
1.38 dillo 6285: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 6286: fonts</a></span></dt>
6287:
6288: <dt><span class="sect2"><a href=
1.38 dillo 6289: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 6290: modules</a></span></dt>
6291:
6292: <dt><span class="sect2"><a href=
1.38 dillo 6293: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 6294: SGML or XML data</a></span></dt>
1.1 grant 6295:
6296: <dt><span class="sect2"><a href=
1.38 dillo 6297: "#mime-database">15.5.13. Packages installing
1.1 grant 6298: extensions to the MIME database</a></span></dt>
6299:
6300: <dt><span class="sect2"><a href=
1.38 dillo 6301: "#intltool">15.5.14. Packages using
1.1 grant 6302: intltool</a></span></dt>
1.18 xtraeme 6303:
6304: <dt><span class="sect2"><a href=
1.38 dillo 6305: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 6306: startup scripts</a></span></dt>
1.1 grant 6307: </dl>
6308: </dd>
6309:
1.30 wiz 6310: <dt><span class="sect1"><a href=
1.38 dillo 6311: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6312: author</a></span></dt>
1.1 grant 6313: </dl>
6314: </dd>
6315:
1.38 dillo 6316: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6317: Debugging</a></span></dt>
6318:
1.38 dillo 6319: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6320: Submitting and Committing</a></span></dt>
6321:
6322: <dd>
6323: <dl>
1.30 wiz 6324: <dt><span class="sect1"><a href=
1.38 dillo 6325: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6326: packages</a></span></dt>
1.1 grant 6327:
1.30 wiz 6328: <dt><span class="sect1"><a href=
1.41 wiz 6329: "#general-notes-for-changes">17.2. General notes when
6330: adding, updating, or removing
6331: packages</a></span></dt>
6332:
6333: <dt><span class="sect1"><a href=
6334: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6335: package into CVS</a></span></dt>
1.1 grant 6336:
1.30 wiz 6337: <dt><span class="sect1"><a href=
1.41 wiz 6338: "#updating-package">17.4. Updating a package to a
1.30 wiz 6339: newer version</a></span></dt>
1.1 grant 6340:
1.30 wiz 6341: <dt><span class="sect1"><a href=
1.41 wiz 6342: "#moving-package">17.5. Moving a package in
1.30 wiz 6343: pkgsrc</a></span></dt>
1.1 grant 6344: </dl>
6345: </dd>
6346: </dl>
6347: </div>
6348:
1.55 rillig 6349: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 6350: <div class="titlepage">
6351: <div>
6352: <div>
1.55 rillig 6353: <h2 class="title"><a name="components" id=
1.38 dillo 6354: "components"></a>Chapter 8. Package
1.27 rillig 6355: components - files, directories and contents</h2>
1.25 rillig 6356: </div>
6357: </div>
6358: </div>
6359:
6360: <div class="toc">
6361: <p><b>Table of Contents</b></p>
6362:
6363: <dl>
6364: <dt><span class="sect1"><a href=
1.45 wiz 6365: "#components.Makefile">8.1. <code xmlns=
6366: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6367: "filename">Makefile</code></a></span></dt>
6368:
6369: <dt><span class="sect1"><a href=
1.45 wiz 6370: "#components.distinfo">8.2. <code xmlns=
6371: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6372: "filename">distinfo</code></a></span></dt>
6373:
6374: <dt><span class="sect1"><a href=
1.38 dillo 6375: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6376:
1.30 wiz 6377: <dt><span class="sect1"><a href=
1.38 dillo 6378: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6379: files</a></span></dt>
1.25 rillig 6380:
1.27 rillig 6381: <dt><span class="sect1"><a href=
1.38 dillo 6382: "#components.optional">8.5. Optional
1.27 rillig 6383: files</a></span></dt>
1.25 rillig 6384:
1.38 dillo 6385: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6386: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6387: class="filename">work*</code></a></span></dt>
1.25 rillig 6388:
1.38 dillo 6389: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6390: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6391: class="filename">files/*</code></a></span></dt>
1.25 rillig 6392: </dl>
6393: </div>
6394:
1.27 rillig 6395: <p>Whenever you're preparing a package, there are a number
6396: of files involved which are described in the following
6397: sections.</p>
1.25 rillig 6398:
1.55 rillig 6399: <div class="sect1" lang="en" xml:lang="en">
1.25 rillig 6400: <div class="titlepage">
6401: <div>
6402: <div>
6403: <h2 class="title" style="clear: both"><a name=
1.55 rillig 6404: "components.Makefile" id=
1.45 wiz 6405: "components.Makefile"></a>8.1. <code xmlns=
6406: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6407: "filename">Makefile</code></h2>
1.25 rillig 6408: </div>
6409: </div>
6410: </div>
6411:
1.27 rillig 6412: <p>Building, installation and creation of a binary
1.45 wiz 6413: package are all controlled by the package's <code xmlns=
6414: "http://www.w3.org/TR/xhtml1/transitional" class=
6415: "filename">Makefile</code>. The <code xmlns=
6416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6417: "filename">Makefile</code> describes various things about
6418: a package, for example from where to get it, how to
6419: configure, build, and install it.</p>
6420:
1.45 wiz 6421: <p>A package <code xmlns=
6422: "http://www.w3.org/TR/xhtml1/transitional" class=
6423: "filename">Makefile</code> contains several sections that
6424: describe the package.</p>
1.25 rillig 6425:
1.27 rillig 6426: <p>In the first section there are the following
6427: variables, which should appear exactly in the order given
6428: here.</p>
1.25 rillig 6429:
6430: <div class="itemizedlist">
6431: <ul type="disc">
6432: <li>
1.27 rillig 6433: <p><code class="varname">DISTNAME</code> is the
6434: basename of the distribution file to be downloaded
6435: from the package's website.</p>
6436: </li>
6437:
6438: <li>
6439: <p><code class="varname">PKGNAME</code> is the name
6440: of the package, as used by pkgsrc. You only need to
1.50 rillig 6441: provide it if it differs from <code class=
6442: "varname">DISTNAME</code>. Usually it is the
6443: directory name together with the version number. It
6444: must match the regular expression <code class=
1.27 rillig 6445: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6446: that is, it starts with a letter or digit, and
6447: contains only letters, digits, dashes, underscores,
6448: dots and plus signs.</p>
1.25 rillig 6449: </li>
6450:
6451: <li>
1.27 rillig 6452: <p><code class="varname">CATEGORIES</code> is a
6453: list of categories which the package fits in. You
6454: can choose any of the top-level directories of
6455: pkgsrc for it.</p>
1.45 wiz 6456:
6457: <p>Currently the following values are available for
6458: <code class="varname">CATEGORIES</code>. If more
6459: than one is used, they need to be separated by
6460: spaces:</p>
6461: <pre class="programlisting">
1.51 rillig 6462: archivers cross geography meta-pkgs security
6463: audio databases graphics misc shells
6464: benchmarks devel ham multimedia sysutils
6465: biology editors inputmethod net textproc
6466: cad emulators lang news time
6467: chat finance mail parallel wm
6468: comms fonts math pkgtools www
6469: converters games mbone print x11
1.45 wiz 6470: </pre>
1.25 rillig 6471: </li>
6472:
6473: <li>
1.27 rillig 6474: <p><code class="varname">MASTER_SITES</code> is a
6475: list of URLs where the distribution files can be
6476: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6477:
6478: <p>The <code class="varname">MASTER_SITES</code>
6479: may make use of the following predefined sites:</p>
6480: <pre class="programlisting">
1.51 rillig 6481: ${MASTER_SITE_APACHE}
6482: ${MASTER_SITE_BACKUP}
6483: ${MASTER_SITE_CYGWIN}
6484: ${MASTER_SITE_DEBIAN}
6485: ${MASTER_SITE_FREEBSD}
6486: ${MASTER_SITE_FREEBSD_LOCAL}
6487: ${MASTER_SITE_GNOME}
6488: ${MASTER_SITE_GNU}
6489: ${MASTER_SITE_GNUSTEP}
6490: ${MASTER_SITE_IFARCHIVE}
6491: ${MASTER_SITE_MOZILLA}
6492: ${MASTER_SITE_OPENOFFICE}
6493: ${MASTER_SITE_PERL_CPAN}
6494: ${MASTER_SITE_R_CRAN}
6495: ${MASTER_SITE_SOURCEFORGE}
6496: ${MASTER_SITE_SUNSITE}
6497: ${MASTER_SITE_SUSE}
6498: ${MASTER_SITE_TEX_CTAN}
6499: ${MASTER_SITE_XCONTRIB}
6500: ${MASTER_SITE_XEMACS}
1.45 wiz 6501: </pre>
6502:
6503: <p>If one of these predefined sites is chosen, you
6504: may want to specify a subdirectory of that site.
6505: Since these macros may expand to more than one
6506: actual site, you <span class=
6507: "emphasis"><em>must</em></span> use the following
6508: construct to specify a subdirectory:</p>
6509: <pre class="programlisting">
1.51 rillig 6510: ${MASTER_SITE_GNU:=subdirectory/name/}
6511: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6512: </pre>
6513:
6514: <p>Note the trailing slash after the subdirectory
6515: name.</p>
6516:
6517: <p>If the package has multiple <code class=
6518: "varname">DISTFILES</code> or multiple <code class=
6519: "varname">PATCHFILES</code> from different sites,
6520: set <code class="varname">SITES_foo</code> to a
1.47 reed 6521: list of URIs where file “<span class=
1.45 wiz 6522: "quote">foo</span>” may be found.
6523: “<span class="quote">foo</span>”
1.47 reed 6524: includes the suffix, e.g.:</p>
1.45 wiz 6525: <pre class="programlisting">
1.51 rillig 6526: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6527: DISTFILES+= foo-file.tar.gz
6528: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6529: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6530: </pre>
6531: </li>
6532:
6533: <li>
6534: <p><code class="varname">DISTFILES</code>: Name(s)
6535: of archive file(s) containing distribution. The
6536: default is <code xmlns=
6537: "http://www.w3.org/TR/xhtml1/transitional" class=
6538: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6539: Should only be set if you have more than one
6540: distfile.</p>
6541:
6542: <p>Note that the normal default setting of
6543: <code class="varname">DISTFILES</code> must be made
6544: explicit if you want to add to it (rather than
6545: replace it), as you usually would.</p>
6546: </li>
6547:
6548: <li>
6549: <p><code class="varname">EXTRACT_SUFX</code>:
6550: Suffix of the distribution file, will be appended
6551: to <code class="varname">DISTNAME</code>. Defaults
6552: to <code xmlns=
6553: "http://www.w3.org/TR/xhtml1/transitional" class=
6554: "filename">.tar.gz</code>.</p>
6555: </li>
6556: </ul>
6557: </div>
6558:
6559: <p>The second section contains information about
6560: separately downloaded patches, if any.</p>
6561:
6562: <div class="itemizedlist">
6563: <ul type="disc">
6564: <li>
1.47 reed 6565: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6566: of additional files that contain distribution
6567: patches. There is no default. pkgsrc will look for
6568: them at <code class="varname">PATCH_SITES</code>.
6569: They will automatically be uncompressed before
6570: patching if the names end with <code xmlns=
6571: "http://www.w3.org/TR/xhtml1/transitional" class=
6572: "filename">.gz</code> or <code xmlns=
6573: "http://www.w3.org/TR/xhtml1/transitional" class=
6574: "filename">.Z</code>.</p>
6575: </li>
6576:
6577: <li>
6578: <p><code class="varname">PATCH_SITES</code>:
6579: Primary location(s) for distribution patch files
6580: (see <code class="varname">PATCHFILES</code> below)
6581: if not found locally.</p>
1.25 rillig 6582: </li>
6583: </ul>
6584: </div>
6585:
1.45 wiz 6586: <p>The third section contains the following
1.27 rillig 6587: variables.</p>
1.25 rillig 6588:
1.27 rillig 6589: <div class="itemizedlist">
6590: <ul type="disc">
6591: <li>
6592: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6593: email address of the person who feels responsible
6594: for this package, and who is most likely to look at
6595: problems or questions regarding this package which
6596: have been reported with <a href=
1.45 wiz 6597: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6598: <span class="citerefentry"><span class=
1.50 rillig 6599: "refentrytitle">send-pr</span>(1)</span></a>. Other
6600: developers should contact the <code class=
6601: "varname">MAINTAINER</code> before making major
6602: changes to the package. When packaging a new
6603: program, set <code class=
6604: "varname">MAINTAINER</code> to yourself. If you
6605: really can't maintain the package for future
6606: updates, set it to <code class="email"><<a href=
1.45 wiz 6607: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6608: </li>
1.25 rillig 6609:
1.27 rillig 6610: <li>
6611: <p><code class="varname">HOMEPAGE</code> is a URL
6612: where users can find more information about the
1.23 wiz 6613: package.</p>
6614: </li>
1.1 grant 6615:
1.23 wiz 6616: <li>
6617: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6618: one-line description of the package (should not
6619: include the package name).</p>
1.23 wiz 6620: </li>
6621: </ul>
6622: </div>
1.1 grant 6623:
1.45 wiz 6624: <p>Other variables that affect the build:</p>
1.1 grant 6625:
1.45 wiz 6626: <div class="itemizedlist">
6627: <ul type="disc">
6628: <li>
6629: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6630: directory where the interesting distribution files
6631: of the package are found. The default is
6632: <code xmlns=
6633: "http://www.w3.org/TR/xhtml1/transitional" class=
6634: "filename">${WRKDIR}/${DISTNAME}</code>, which
6635: works for most packages.</p>
6636:
6637: <p>If a package doesn't create a subdirectory for
6638: itself (most GNU software does, for instance), but
6639: extracts itself in the current directory, you
6640: should set <code class="varname">WRKSRC=
6641: ${WRKDIR}</code>.</p>
6642:
6643: <p>If a package doesn't create a subdirectory with
6644: the name of <code class="varname">DISTNAME</code>
6645: but some different name, set <code class=
6646: "varname">WRKSRC</code> to point to the proper name
6647: in <code xmlns=
6648: "http://www.w3.org/TR/xhtml1/transitional" class=
6649: "filename">${WRKDIR}</code>, for example
6650: <code class="varname">WRKSRC=
6651: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6652: "http://www.w3.org/TR/xhtml1/transitional" href=
6653: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6654: target="_top"><code xmlns="" class=
6655: "filename">lang/tcl</code></a> and <a xmlns=
6656: "http://www.w3.org/TR/xhtml1/transitional" href=
6657: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6658: target="_top"><code xmlns="" class=
6659: "filename">x11/tk</code></a> for other
6660: examples.</p>
6661:
6662: <p>The name of the working directory created by
6663: pkgsrc is taken from the <code class=
6664: "varname">WRKDIR_BASENAME</code> variable. By
6665: default, its value is <code xmlns=
6666: "http://www.w3.org/TR/xhtml1/transitional" class=
6667: "filename">work</code>. If you want to use the same
6668: pkgsrc tree for building different kinds of binary
6669: packages, you can change the variable according to
6670: your needs. Two other variables handle common cases
6671: of setting <code class=
6672: "varname">WRKDIR_BASENAME</code> individually. If
6673: <code class="varname">OBJHOSTNAME</code> is defined
6674: in <code xmlns=
1.45 wiz 6675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6676: "filename">/etc/mk.conf</code>, the first component
6677: of the host's name is attached to the directory
6678: name. If <code class="varname">OBJMACHINE</code> is
6679: defined, the platform name is attached, which might
6680: look like <code xmlns=
6681: "http://www.w3.org/TR/xhtml1/transitional" class=
6682: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6683: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6684: "filename">work.sparc</code>.</p>
1.45 wiz 6685: </li>
6686: </ul>
1.1 grant 6687: </div>
6688:
6689: <p>Please pay attention to the following gotchas:</p>
6690:
6691: <div class="itemizedlist">
6692: <ul type="disc">
6693: <li>
1.14 xtraeme 6694: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6695: if man pages are installed in compressed form by
6696: the package; see comment in <code xmlns=
1.45 wiz 6697: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6698: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6699: </li>
6700:
6701: <li>
1.45 wiz 6702: <p>Replace <code xmlns=
6703: "http://www.w3.org/TR/xhtml1/transitional" class=
6704: "filename">/usr/local</code> with
6705: “<span class="quote">${PREFIX}</span>”
6706: in all files (see patches, below).</p>
1.1 grant 6707: </li>
6708:
6709: <li>
6710: <p>If the package installs any info files, see
6711: <a href="#faq.info-files" title=
1.45 wiz 6712: "15.5.7. Packages installing info files">Section 15.5.7,
6713: “Packages installing info
1.1 grant 6714: files”</a>.</p>
6715: </li>
6716: </ul>
6717: </div>
6718: </div>
6719:
1.55 rillig 6720: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6721: <div class="titlepage">
6722: <div>
6723: <div>
6724: <h2 class="title" style="clear: both"><a name=
1.55 rillig 6725: "components.distinfo" id=
1.45 wiz 6726: "components.distinfo"></a>8.2. <code xmlns=
6727: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6728: "filename">distinfo</code></h2>
1.1 grant 6729: </div>
6730: </div>
6731: </div>
6732:
1.50 rillig 6733: <p>The <code xmlns=
6734: "http://www.w3.org/TR/xhtml1/transitional" class=
6735: "filename">distinfo</code> file contains the message
6736: digest, or checksum, of each distfile needed for the
6737: package. This ensures that the distfiles retrieved from
6738: the Internet have not been corrupted during transfer or
6739: altered by a malign force to introduce a security hole.
6740: Due to recent rumor about weaknesses of digest
6741: algorithms, all distfiles are protected using both SHA1
6742: and RMD160 message digests, as well as the file size.</p>
6743:
6744: <p>The <code xmlns=
6745: "http://www.w3.org/TR/xhtml1/transitional" class=
6746: "filename">distinfo</code> file also contains the
6747: checksums for all the patches found in the <code xmlns=
6748: "http://www.w3.org/TR/xhtml1/transitional" class=
6749: "filename">patches</code> directory (see <a href=
6750: "#components.patches" title=
6751: "8.3. patches/*">Section 8.3,
6752: “patches/*”</a>).</p>
6753:
6754: <p>To regenerate the <code xmlns=
6755: "http://www.w3.org/TR/xhtml1/transitional" class=
6756: "filename">distinfo</code> file, use the
1.14 xtraeme 6757: <span><strong class="command">make
1.50 rillig 6758: makedistinfo</strong></span> or <span><strong class=
6759: "command">make mdi</strong></span> command.</p>
1.1 grant 6760:
1.50 rillig 6761: <p>Some packages have different sets of distfiles
6762: depending on the platform, for example <a xmlns=
1.1 grant 6763: "http://www.w3.org/TR/xhtml1/transitional" href=
6764: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6765: target="_top"><code xmlns="" class=
6766: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6767: the same <code xmlns=
1.45 wiz 6768: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6769: "filename">distinfo</code> file and care should be taken
6770: when upgrading such a package to ensure distfile
6771: information is not lost.</p>
1.1 grant 6772: </div>
6773:
1.55 rillig 6774: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6775: <div class="titlepage">
6776: <div>
6777: <div>
6778: <h2 class="title" style="clear: both"><a name=
1.55 rillig 6779: "components.patches" id=
1.38 dillo 6780: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6781: </div>
6782: </div>
6783: </div>
6784:
6785: <p>This directory contains files that are used by the
6786: <a href=
6787: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6788: <span class="citerefentry"><span class=
6789: "refentrytitle">patch</span>(1)</span></a> command to
6790: modify the sources as distributed in the distribution
6791: file into a form that will compile and run perfectly on
6792: NetBSD. The files are applied successively in alphabetic
6793: order (as returned by a shell “<span class=
6794: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6795: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6796: class="filename">patch-aa</code> is applied before
6797: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6798: class="filename">patch-ab</code>, etc.</p>
6799:
6800: <p>The <code xmlns=
6801: "http://www.w3.org/TR/xhtml1/transitional" class=
6802: "filename">patch-*</code> files should be in
6803: <span><strong class="command">diff -bu</strong></span>
6804: format, and apply without a fuzz to avoid problems. (To
6805: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6806: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6807: not put changes for more than one file into a single
1.47 reed 6808: patch file, as this will make future modifications more
1.1 grant 6809: difficult.</p>
6810:
6811: <p>Similar, a file should be patched at most once, not
6812: several times by several different patches. If a file
6813: needs several patches, they should be combined into one
6814: file.</p>
6815:
6816: <p>One important thing to mention is to pay attention
6817: that no RCS IDs get stored in the patch files, as these
6818: will cause problems when later checked into the NetBSD
1.14 xtraeme 6819: CVS tree. Use the <span><strong class=
6820: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6821: "http://www.w3.org/TR/xhtml1/transitional" href=
6822: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6823: target="_top"><code xmlns="" class=
6824: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6825: these problems.</p>
1.1 grant 6826:
6827: <p>For even more automation, we recommend using
1.14 xtraeme 6828: <span><strong class="command">mkpatches</strong></span>
6829: from the same package to make a whole set of patches. You
6830: just have to backup files before you edit them to
1.45 wiz 6831: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6832: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6833: <span><strong class="command">cp -p filename
6834: filename.orig</strong></span> or, easier, by using
6835: <span><strong class="command">pkgvi</strong></span> again
6836: from the same package. If you upgrade a package this way,
6837: you can easily compare the new set of patches with the
6838: previously existing one with <span><strong class=
6839: "command">patchdiff</strong></span>.</p>
1.1 grant 6840:
6841: <p>When you have finished a package, remember to generate
6842: the checksums for the patch files by using the
1.14 xtraeme 6843: <span><strong class="command">make
6844: makepatchsum</strong></span> command, see <a href=
6845: "#components.distinfo" title=
1.38 dillo 6846: "8.2. distinfo">Section 8.2,
1.45 wiz 6847: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6848: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6849:
1.46 gdt 6850: <p>When adding a patch that corrects a problem in the
6851: distfile (rather than e.g. enforcing pkgsrc's view of
6852: where man pages should go), send the patch as a bug
6853: report to the maintainer. This benefits non-pkgsrc users
6854: of the package, and usually enables removing the patch in
6855: future version.</p>
6856:
1.1 grant 6857: <p>Patch files that are distributed by the author or
1.14 xtraeme 6858: other maintainers can be listed in <code class=
6859: "varname">$PATCHFILES</code>.</p>
1.1 grant 6860:
6861: <p>If it is desired to store any patches that should not
6862: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6863: pkgsrc tree in the <code xmlns=
6864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6865: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6866: tree there is expected to have the same
6867: “<span class="quote">category/package</span>”
6868: structure as pkgsrc, and patches are expected to be
1.45 wiz 6869: stored inside these dirs (also known as <code xmlns=
6870: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6871: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
6872: if you want to keep a private patch for <code xmlns=
1.45 wiz 6873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6874: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6875: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6876: class=
1.14 xtraeme 6877: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6878: files in the named directory are expected to be patch
1.1 grant 6879: files, and <span class="emphasis"><em>they are applied
6880: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6881: </div>
6882:
1.55 rillig 6883: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6884: <div class="titlepage">
6885: <div>
6886: <div>
6887: <h2 class="title" style="clear: both"><a name=
1.55 rillig 6888: "other-mandatory-files" id=
1.38 dillo 6889: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6890: mandatory files</h2>
6891: </div>
6892: </div>
6893: </div>
6894:
6895: <div class="variablelist">
6896: <dl>
1.45 wiz 6897: <dt><span class="term"><code xmlns=
6898: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6899: "filename">DESCR</code></span></dt>
6900:
6901: <dd>
6902: <p>A multi-line description of the piece of
6903: software. This should include any credits where
6904: they are due. Please bear in mind that others do
6905: not share your sense of humour (or spelling
6906: idiosyncrasies), and that others will read
6907: everything that you write here.</p>
6908: </dd>
6909:
1.45 wiz 6910: <dt><span class="term"><code xmlns=
6911: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6912: "filename">PLIST</code></span></dt>
6913:
6914: <dd>
6915: <p>This file governs the files that are installed
6916: on your system: all the binaries, manual pages,
6917: etc. There are other directives which may be
6918: entered in this file, to control the creation and
6919: deletion of directories, and the location of
6920: inserted files. See <a href="#plist" title=
1.38 dillo 6921: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6922: <i>PLIST issues</i></a> for more information.</p>
6923: </dd>
6924: </dl>
6925: </div>
6926: </div>
6927:
1.55 rillig 6928: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6929: <div class="titlepage">
6930: <div>
6931: <div>
6932: <h2 class="title" style="clear: both"><a name=
1.55 rillig 6933: "components.optional" id=
1.38 dillo 6934: "components.optional"></a>8.5. Optional
1.27 rillig 6935: files</h2>
6936: </div>
6937: </div>
6938: </div>
6939:
6940: <div class="variablelist">
6941: <dl>
1.45 wiz 6942: <dt><span class="term"><code xmlns=
6943: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6944: "filename">INSTALL</code></span></dt>
6945:
6946: <dd>
6947: <p>This shell script is invoked twice by <a href=
6948: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6949: <span class="citerefentry"><span class=
6950: "refentrytitle">pkg_add</span>(1)</span></a>. First
6951: time after package extraction and before files are
6952: moved in place, the second time after the files to
6953: install are moved in place. This can be used to do
6954: any custom procedures not possible with @exec
1.45 wiz 6955: commands in <code xmlns=
6956: "http://www.w3.org/TR/xhtml1/transitional" class=
6957: "filename">PLIST</code>. See <a href=
1.27 rillig 6958: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6959: <span class="citerefentry"><span class=
6960: "refentrytitle">pkg_add</span>(1)</span></a> and
6961: <a href=
6962: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6963: <span class="citerefentry"><span class=
6964: "refentrytitle">pkg_create</span>(1)</span></a> for
6965: more information.</p>
6966: </dd>
6967:
1.45 wiz 6968: <dt><span class="term"><code xmlns=
6969: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6970: "filename">DEINSTALL</code></span></dt>
6971:
6972: <dd>
6973: <p>This script is executed before and after any
6974: files are removed. It is this script's
6975: responsibility to clean up any additional messy
6976: details around the package's installation, since
6977: all pkg_delete knows is how to delete the files
6978: created in the original distribution. See <a href=
6979: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6980: <span class="citerefentry"><span class=
6981: "refentrytitle">pkg_delete</span>(1)</span></a> and
6982: <a href=
6983: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6984: <span class="citerefentry"><span class=
6985: "refentrytitle">pkg_create</span>(1)</span></a> for
6986: more information.</p>
6987: </dd>
6988:
1.45 wiz 6989: <dt><span class="term"><code xmlns=
6990: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6991: "filename">MESSAGE</code></span></dt>
6992:
6993: <dd>
1.50 rillig 6994: <p>This file is displayed after installation of the
1.27 rillig 6995: package. Useful for things like legal notices on
6996: almost-free software and hints for updating config
6997: files after installing modules for apache, PHP etc.
6998: Please note that you can modify variables in it
6999: easily by using <code class=
7000: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7001: <code xmlns=
7002: "http://www.w3.org/TR/xhtml1/transitional" class=
7003: "filename">Makefile</code>:</p>
1.27 rillig 7004: <pre class="programlisting">
1.51 rillig 7005: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7006: </pre>
7007:
7008: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7009: "quote">somevalue</span>” in <code xmlns=
7010: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7011: "filename">MESSAGE</code>.</p>
7012: </dd>
7013: </dl>
7014: </div>
7015: </div>
7016:
1.55 rillig 7017: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7018: <div class="titlepage">
7019: <div>
7020: <div>
7021: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7022: "work-dir" id="work-dir"></a>8.6. <code xmlns=
1.45 wiz 7023: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7024: "filename">work*</code></h2>
7025: </div>
7026: </div>
7027: </div>
7028:
7029: <p>When you type <span><strong class=
1.47 reed 7030: "command">make</strong></span>, the distribution files
7031: are unpacked into the directory denoted by <code class=
1.45 wiz 7032: "varname">WRKDIR</code>. It can be removed by running
7033: <span><strong class="command">make clean</strong></span>.
7034: Besides the sources, this directory is also used to keep
7035: various timestamp files. The directory gets <span class=
7036: "emphasis"><em>removed completely</em></span> on clean.
7037: The default is <code xmlns=
7038: "http://www.w3.org/TR/xhtml1/transitional" class=
7039: "filename">${.CURDIR}/work</code> or <code xmlns=
7040: "http://www.w3.org/TR/xhtml1/transitional" class=
7041: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7042: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7043: </div>
7044:
1.55 rillig 7045: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7046: <div class="titlepage">
7047: <div>
7048: <div>
7049: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7050: "files-dir" id=
1.45 wiz 7051: "files-dir"></a>8.7. <code xmlns=
7052: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7053: "filename">files/*</code></h2>
7054: </div>
7055: </div>
7056: </div>
7057:
7058: <p>If you have any files that you wish to be placed in
7059: the package prior to configuration or building, you could
7060: place these files here and use a “<span class=
7061: "quote">${CP}</span>” command in the
7062: “<span class="quote">pre-configure</span>”
7063: target to achieve this. Alternatively, you could simply
1.45 wiz 7064: diff the file against <code xmlns=
7065: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7066: "filename">/dev/null</code> and use the patch mechanism
7067: to manage the creation of this file.</p>
7068: </div>
7069: </div>
7070:
1.55 rillig 7071: <div class="chapter" lang="en" xml:lang="en">
1.27 rillig 7072: <div class="titlepage">
7073: <div>
7074: <div>
1.55 rillig 7075: <h2 class="title"><a name="makefile" id=
1.38 dillo 7076: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7077: <code xmlns=
7078: "http://www.w3.org/TR/xhtml1/transitional" class=
7079: "filename">Makefile</code>s</h2>
1.27 rillig 7080: </div>
7081: </div>
7082: </div>
7083:
7084: <div class="toc">
7085: <p><b>Table of Contents</b></p>
7086:
7087: <dl>
7088: <dt><span class="sect1"><a href=
1.45 wiz 7089: "#makefile.variables">9.1. <code xmlns=
7090: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7091: "filename">Makefile</code> variables</a></span></dt>
7092:
7093: <dd>
7094: <dl>
7095: <dt><span class="sect2"><a href=
1.38 dillo 7096: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7097: conventions</a></span></dt>
7098: </dl>
7099: </dd>
7100:
1.38 dillo 7101: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7102: Code snippets</a></span></dt>
7103:
7104: <dd>
7105: <dl>
1.30 wiz 7106: <dt><span class="sect2"><a href=
1.38 dillo 7107: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7108: list</a></span></dt>
1.27 rillig 7109:
1.30 wiz 7110: <dt><span class="sect2"><a href=
1.38 dillo 7111: "#converting-internal-to-external">9.2.2.
1.27 rillig 7112: Converting an internal list into an external
7113: list</a></span></dt>
7114:
1.30 wiz 7115: <dt><span class="sect2"><a href=
1.38 dillo 7116: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7117: variables to a shell command</a></span></dt>
1.27 rillig 7118:
1.30 wiz 7119: <dt><span class="sect2"><a href=
1.38 dillo 7120: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7121: guideline</a></span></dt>
1.27 rillig 7122:
1.30 wiz 7123: <dt><span class="sect2"><a href=
1.38 dillo 7124: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7125: bug in BSD Make</a></span></dt>
1.27 rillig 7126: </dl>
7127: </dd>
7128: </dl>
7129: </div>
7130:
1.45 wiz 7131: <p>Pkgsrc consists of many <code xmlns=
7132: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7133: "filename">Makefile</code> fragments, each of which forms a
7134: well-defined part of the pkgsrc system. Using the <a href=
7135: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7136: <span class="citerefentry"><span class=
7137: "refentrytitle">make</span>(1)</span></a> system as a
7138: programming language for a big system like pkgsrc requires
7139: some discipline to keep the code correct and
7140: understandable.</p>
7141:
1.45 wiz 7142: <p>The basic ingredients for <code xmlns=
7143: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7144: "filename">Makefile</code> programming are variables (which
7145: are actually macros) and shell commands. Among these shell
7146: commands may even be more complex ones like <a href=
7147: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7148: <span class="citerefentry"><span class=
7149: "refentrytitle">awk</span>(1)</span></a> programs. To make
7150: sure that every shell command runs as intended it is
7151: necessary to quote all variables correctly when they are
7152: used.</p>
7153:
7154: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7155: often in <code xmlns=
7156: "http://www.w3.org/TR/xhtml1/transitional" class=
7157: "filename">Makefile</code>s, including the pitfalls that
7158: come along with them.</p>
1.27 rillig 7159:
1.55 rillig 7160: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7161: <div class="titlepage">
7162: <div>
7163: <div>
7164: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7165: "makefile.variables" id=
1.45 wiz 7166: "makefile.variables"></a>9.1. <code xmlns=
7167: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7168: "filename">Makefile</code> variables</h2>
7169: </div>
7170: </div>
7171: </div>
7172:
1.45 wiz 7173: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7174: class="filename">Makefile</code> variables contain
7175: strings that can be processed using the five operators
7176: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7177: described in the <a href=
1.27 rillig 7178: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7179: <span class="citerefentry"><span class=
7180: "refentrytitle">make</span>(1)</span></a> man page.</p>
7181:
1.45 wiz 7182: <p>When a variable's value is parsed from a <code xmlns=
7183: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7184: "filename">Makefile</code>, the hash character ``#'' and
7185: the backslash character ``\'' are handled specially. If a
7186: backslash is followed by a newline, any whitespace
7187: immediately in front of the backslash, the backslash, the
7188: newline, and any whitespace immediately behind the
7189: newline are replaced with a single space. A backspace
7190: character and an immediately following hash character are
1.47 reed 7191: replaced with a single hash character. Otherwise, the
1.27 rillig 7192: backslash is passed as is. In a variable assignment, any
7193: hash character that is not preceded by a backslash starts
7194: a comment that continues upto the end of the logical
7195: line.</p>
7196:
7197: <p><span class="emphasis"><em>Note:</em></span> Because
7198: of this parsing algorithm the only way to create a
7199: variable consisting of a single backslash is using the
7200: ``!='' operator, for example: <code class=
7201: "varname">BACKSLASH!=echo "\\"</code>.</p>
7202:
7203: <p>So far for defining variables. The other thing you can
7204: do with variables is evaluating them. A variable is
7205: evaluated when it is part of the right side of the ``:=''
7206: or the ``!='' operator, or directly before executing a
7207: shell command which the variable is part of. In all other
1.47 reed 7208: cases, <a href=
1.27 rillig 7209: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7210: <span class="citerefentry"><span class=
7211: "refentrytitle">make</span>(1)</span></a> performs lazy
7212: evaluation, that is, variables are not evaluated until
7213: there's no other way. The ``modifiers'' mentioned in the
7214: man page also evaluate the variable.</p>
7215:
7216: <p>Some of the modifiers split the string into words and
7217: then operate on the words, others operate on the string
1.47 reed 7218: as a whole. When a string is split into words, it is
7219: split as you would expect it from <a href=
1.27 rillig 7220: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7221: <span class="citerefentry"><span class=
7222: "refentrytitle">sh</span>(1)</span></a>.</p>
7223:
7224: <p>No rule without exception—the
7225: <span><strong class="command">.for</strong></span> loop
7226: does not follow the shell quoting rules but splits at
7227: sequences of whitespace.</p>
7228:
7229: <p>There are several types of variables that should be
7230: handled differently. Strings and two types of lists.</p>
7231:
7232: <div class="itemizedlist">
7233: <ul type="disc">
7234: <li>
7235: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7236: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7237: should restrict yourself to only using printable
7238: characters. Examples are <code class=
7239: "varname">PREFIX</code> and <code class=
7240: "varname">COMMENT</code>.</p>
7241: </li>
7242:
7243: <li>
7244: <p><span class="emphasis"><em>Internal
7245: lists</em></span> are lists that are never exported
7246: to any shell command. Their elements are separated
1.47 reed 7247: by whitespace. Therefore, the elements themselves
1.27 rillig 7248: cannot have embedded whitespace. Any other
7249: characters are allowed. Internal lists can be used
7250: in <span><strong class=
7251: "command">.for</strong></span> loops. Examples are
7252: <code class="varname">DEPENDS</code> and
7253: <code class="varname">BUILD_DEPENDS</code>.</p>
7254: </li>
7255:
7256: <li>
7257: <p><span class="emphasis"><em>External
7258: lists</em></span> are lists that may be exported to
7259: a shell command. Their elements can contain any
7260: characters, including whitespace. That's why they
7261: cannot be used in <span><strong class=
7262: "command">.for</strong></span> loops. Examples are
7263: <code class="varname">DISTFILES</code> and
7264: <code class="varname">MASTER_SITES</code>.</p>
7265: </li>
7266: </ul>
7267: </div>
7268:
1.55 rillig 7269: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7270: <div class="titlepage">
7271: <div>
7272: <div>
7273: <h3 class="title"><a name=
1.55 rillig 7274: "makefile.variables.names" id=
1.38 dillo 7275: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7276: conventions</h3>
7277: </div>
7278: </div>
7279: </div>
7280:
7281: <div class="itemizedlist">
7282: <ul type="disc">
7283: <li>
7284: <p>All variable names starting with an underscore
7285: are reserved for use by the pkgsrc
7286: infrastructure. They shall not be used by package
1.45 wiz 7287: <code xmlns=
7288: "http://www.w3.org/TR/xhtml1/transitional" class=
7289: "filename">Makefile</code>s.</p>
1.27 rillig 7290: </li>
7291:
7292: <li>
7293: <p>In <span><strong class=
7294: "command">.for</strong></span> loops you should
7295: use lowercase variable names for the iteration
7296: variables.</p>
7297: </li>
7298:
7299: <li>
7300: <p>All list variables should have a ``plural''
7301: name, e.g. <code class=
7302: "varname">PKG_OPTIONS</code> or <code class=
7303: "varname">DISTFILES</code>.</p>
7304: </li>
7305: </ul>
7306: </div>
7307: </div>
7308: </div>
7309:
1.55 rillig 7310: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7311: <div class="titlepage">
7312: <div>
7313: <div>
7314: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7315: "makefile.code" id=
1.38 dillo 7316: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7317: </div>
7318: </div>
7319: </div>
7320:
7321: <p>This section presents you with some code snippets you
7322: should use in your own code. If you don't find anything
7323: appropriate here, you should test your code and add it
7324: here.</p>
7325:
1.55 rillig 7326: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7327: <div class="titlepage">
7328: <div>
7329: <div>
1.55 rillig 7330: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7331: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7332: a list</h3>
1.27 rillig 7333: </div>
7334: </div>
7335: </div>
7336: <pre class="programlisting">
1.51 rillig 7337: STRING= foo * bar `date`
7338: INT_LIST= # empty
7339: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7340: EXT_LIST= # empty
7341: ANOTHER_EXT_LIST= a=b c=d
7342:
7343: INT_LIST+= ${STRING} # 1
7344: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7345: EXT_LIST+= ${STRING:Q} # 3
7346: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7347: </pre>
7348:
7349: <p>When you add a string to an external list (example
7350: 3), it must be quoted. In all other cases, you must not
7351: add a quoting level. You must not merge internal and
7352: external lists, unless you are sure that all entries
7353: are correctly interpreted in both lists.</p>
7354: </div>
7355:
1.55 rillig 7356: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7357: <div class="titlepage">
7358: <div>
7359: <div>
1.30 wiz 7360: <h3 class="title"><a name=
1.55 rillig 7361: "converting-internal-to-external" id=
1.38 dillo 7362: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7363: an internal list into an external list</h3>
1.27 rillig 7364: </div>
7365: </div>
7366: </div>
7367: <pre class="programlisting">
1.51 rillig 7368: EXT_LIST= # empty
7369: .for i in ${INT_LIST}
7370: EXT_LIST+= ${i:Q}""
7371: .endfor
1.27 rillig 7372: </pre>
7373:
7374: <p>This code converts the internal list <code class=
7375: "varname">INT_LIST</code> into the external list
7376: <code class="varname">EXT_LIST</code>. As the elements
7377: of an internal list are unquoted they must be quoted
7378: here. The reason for appending <code class=
7379: "varname">""</code> is explained below.</p>
7380: </div>
1.1 grant 7381:
1.55 rillig 7382: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7383: <div class="titlepage">
1.1 grant 7384: <div>
1.27 rillig 7385: <div>
1.30 wiz 7386: <h3 class="title"><a name=
1.55 rillig 7387: "passing-variable-to-shell" id=
1.38 dillo 7388: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7389: variables to a shell command</h3>
1.27 rillig 7390: </div>
1.1 grant 7391: </div>
7392: </div>
1.27 rillig 7393: <pre class="programlisting">
1.51 rillig 7394: STRING= foo bar < > * `date` $$HOME ' "
7395: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7396:
1.51 rillig 7397: all:
7398: echo ${STRING} # 1
7399: echo "${STRING}" # 2
7400: echo "${STRING:Q}" # 3
7401: echo ${STRING:Q} # 4
7402: echo x${STRING:Q} | sed 1s,.,, # 5
7403: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7404: </pre>
7405:
7406: <p>Example 1 leads to a syntax error in the shell, as
7407: the characters are just copied.</p>
7408:
7409: <p>Example 2 leads to a syntax error too, and if you
7410: leave out the last " character from <code class=
7411: "varname">${STRING}</code>, <a href=
7412: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7413: <span class="citerefentry"><span class=
7414: "refentrytitle">date</span>(1)</span></a> will be
7415: executed. The <code class="varname">$HOME</code> shell
7416: variable would be evaluated, too.</p>
7417:
7418: <p>Example 3 outputs each space character preceded by a
7419: backslash (or not), depending on the implementation of
7420: the <a href=
7421: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7422: <span class="citerefentry"><span class=
7423: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7424:
1.27 rillig 7425: <p>Example 4 handles correctly every string that does
7426: not start with a dash. In that case, the result depends
7427: on the implementation of the <a href=
7428: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7429: <span class="citerefentry"><span class=
7430: "refentrytitle">echo</span>(1)</span></a> command. As
7431: long as you can guarantee that your input does not
1.47 reed 7432: start with a dash, this form is appropriate.</p>
1.1 grant 7433:
1.27 rillig 7434: <p>Example 5 handles even the case of a leading dash
7435: correctly.</p>
1.1 grant 7436:
1.27 rillig 7437: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7438: need to be quoted because the quoting has already been
1.27 rillig 7439: done when adding elements to the list.</p>
1.1 grant 7440:
1.27 rillig 7441: <p>As internal lists shall not be passed to the shell,
7442: there is no example for it.</p>
1.1 grant 7443: </div>
7444:
1.55 rillig 7445: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7446: <div class="titlepage">
1.1 grant 7447: <div>
1.27 rillig 7448: <div>
1.55 rillig 7449: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7450: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7451: guideline</h3>
7452: </div>
1.1 grant 7453: </div>
7454: </div>
7455:
1.27 rillig 7456: <p>There are many possible sources of wrongly quoted
7457: variables. This section lists some of the commonly
7458: known ones.</p>
1.1 grant 7459:
1.27 rillig 7460: <div class="itemizedlist">
7461: <ul type="disc">
7462: <li>
7463: <p>Whenever you use the value of a list, think
7464: about what happens to leading or trailing
7465: whitespace. If the list is a well-formed shell
1.47 reed 7466: expression, you can apply the <code class=
1.27 rillig 7467: "varname">:M*</code> modifier to strip leading
7468: and trailing whitespace from each word. The
7469: <code class="varname">:M</code> operator first
7470: splits its argument according to the rules of the
7471: shell, and then creates a new list consisting of
7472: all words that match the shell glob expression
7473: <code class="varname">*</code>, that is: all. One
7474: class of situations where this is needed is when
7475: adding a variable like <code class=
7476: "varname">CPPFLAGS</code> to <code class=
7477: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7478: script invokes other configure scripts, it strips
1.27 rillig 7479: the leading and trailing whitespace from the
7480: variable and then passes it to the other
7481: configure scripts. But these configure scripts
7482: expect the (child) <code class=
7483: "varname">CPPFLAGS</code> variable to be the same
7484: as the parent <code class=
7485: "varname">CPPFLAGS</code>. That's why we better
7486: pass the <code class="varname">CPPFLAGS</code>
7487: value properly trimmed. And here is how we do
7488: it:</p>
7489: <pre class="programlisting">
1.51 rillig 7490: CPPFLAGS= # empty
7491: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7492: CPPFLAGS+= ${MY_CPPFLAGS}
7493:
7494: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7495:
7496: all:
7497: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7498: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7499: </pre>
7500: </li>
1.1 grant 7501:
1.27 rillig 7502: <li>
7503: <p>The example above contains one bug: The
7504: <code class="varname">${PREFIX}</code> is a
7505: properly quoted shell expression, but there is
7506: the C compiler after it, which also expects a
7507: properly quoted string (this time in C syntax).
7508: The version above is therefore only correct if
7509: <code class="varname">${PREFIX}</code> does not
7510: have embedded backslashes or double quotes. If
7511: you want to allow these, you have to add another
7512: layer of quoting to each variable that is used as
7513: a C string literal. You cannot use the
7514: <code class="varname">:Q</code> operator for it,
7515: as this operator only works for the shell.</p>
7516: </li>
1.1 grant 7517:
1.27 rillig 7518: <li>
1.47 reed 7519: <p>Whenever a variable can be empty, the
1.27 rillig 7520: <code class="varname">:Q</code> operator can have
7521: surprising results. Here are two completely
7522: different cases which can be solved with the same
7523: trick.</p>
7524: <pre class="programlisting">
1.51 rillig 7525: EMPTY= # empty
7526: empty_test:
7527: for i in a ${EMPTY:Q} c; do \
7528: echo "$$i"; \
7529: done
7530:
7531: for_test:
7532: .for i in a:\ a:\test.txt
7533: echo ${i:Q}
7534: echo "foo"
7535: .endfor
1.1 grant 7536: </pre>
7537:
1.27 rillig 7538: <p>The first example will only print two of the
7539: three lines we might have expected. This is
7540: because <code class="varname">${EMPTY:Q}</code>
7541: expands to the empty string, which the shell
7542: cannot see. The workaround is to write
7543: <code class="varname">${EMPTY:Q}""</code>. This
7544: pattern can be often found as <code class=
7545: "varname">${TEST} -z ${VAR:Q}</code> or as
7546: <code class="varname">${TEST} -f
7547: ${FNAME:Q}</code> (both of these are wrong).</p>
7548:
7549: <p>The second example will only print three lines
7550: instead of four. The first line looks like
7551: <code class="varname">a:\ echo foo</code>. This
7552: is because the backslash of the value
7553: <code class="varname">a:\</code> is interpreted
7554: as a line-continuation by <a href=
7555: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7556: <span class="citerefentry"><span class=
7557: "refentrytitle">make</span>(1)</span></a>, which
7558: makes the second line the arguments of the
7559: <a href=
7560: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7561: <span class="citerefentry"><span class=
7562: "refentrytitle">echo</span>(1)</span></a> command
7563: from the first line. To avoid this, write
7564: <code class="varname">${i:Q}""</code>.</p>
7565: </li>
7566: </ul>
7567: </div>
1.1 grant 7568: </div>
7569:
1.55 rillig 7570: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7571: <div class="titlepage">
1.1 grant 7572: <div>
1.27 rillig 7573: <div>
1.30 wiz 7574: <h3 class="title"><a name=
1.55 rillig 7575: "bsd-make-bug-workaround" id=
1.38 dillo 7576: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7577: for a bug in BSD Make</h3>
1.27 rillig 7578: </div>
1.1 grant 7579: </div>
7580: </div>
7581:
1.27 rillig 7582: <p>The pkgsrc bmake program does not handle the
7583: following assignment correctly. In case <code class=
7584: "varname">_othervar_</code> contains a ``-'' character,
7585: one of the closing braces is included in <code class=
7586: "varname">${VAR}</code> after this code executes.</p>
7587: <pre class="programlisting">
1.51 rillig 7588: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7589: </pre>
7590:
1.27 rillig 7591: <p>For a more complex code snippet and a workaround,
7592: see the package <a xmlns=
7593: "http://www.w3.org/TR/xhtml1/transitional" href=
7594: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7595: target="_top"><code xmlns="" class=
7596: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7597: <code class="varname">bug1</code>.</p>
1.1 grant 7598: </div>
7599: </div>
7600: </div>
7601:
1.55 rillig 7602: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 7603: <div class="titlepage">
7604: <div>
7605: <div>
1.55 rillig 7606: <h2 class="title"><a name="plist" id=
1.38 dillo 7607: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7608: </div>
7609: </div>
7610: </div>
7611:
7612: <div class="toc">
7613: <p><b>Table of Contents</b></p>
7614:
7615: <dl>
1.38 dillo 7616: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7617: ID</a></span></dt>
7618:
1.30 wiz 7619: <dt><span class="sect1"><a href=
1.38 dillo 7620: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7621: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7622: class="filename">PLIST</code>
1.14 xtraeme 7623: generation</a></span></dt>
1.1 grant 7624:
1.38 dillo 7625: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7626: Tweaking output of <span><strong class="command">make
7627: print-PLIST</strong></span></a></span></dt>
1.1 grant 7628:
1.38 dillo 7629: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7630: Variable substitution in PLIST</a></span></dt>
7631:
1.30 wiz 7632: <dt><span class="sect1"><a href=
1.48 dillo 7633: "#manpage-compression">10.5. Man page
7634: compression</a></span></dt>
1.1 grant 7635:
1.38 dillo 7636: <dt><span class="sect1"><a href=
7637: "#using-PLIST_SRC">10.6. Changing PLIST source with
7638: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7639:
1.30 wiz 7640: <dt><span class="sect1"><a href=
1.47 reed 7641: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7642: differing PLISTs</a></span></dt>
1.1 grant 7643:
1.38 dillo 7644: <dt><span class="sect1"><a href=
7645: "#faq.common-dirs">10.8. Sharing directories between
7646: packages</a></span></dt>
1.1 grant 7647: </dl>
7648: </div>
7649:
1.45 wiz 7650: <p>The <code xmlns=
7651: "http://www.w3.org/TR/xhtml1/transitional" class=
7652: "filename">PLIST</code> file contains a package's
7653: “<span class="quote">packing list</span>”, i.e.
7654: a list of files that belong to the package (relative to the
7655: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7656: class="filename">${PREFIX}</code> directory it's been
7657: installed in) plus some additional statements - see the
7658: <a href=
1.1 grant 7659: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7660: <span class="citerefentry"><span class=
1.47 reed 7661: "refentrytitle">pkg_create</span>(1)</span></a> man page
7662: for a full list. This chapter addresses some issues that
7663: need attention when dealing with the <code xmlns=
1.45 wiz 7664: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7665: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7666:
1.55 rillig 7667: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7668: <div class="titlepage">
7669: <div>
7670: <div>
7671: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7672: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7673: </div>
7674: </div>
7675: </div>
7676:
7677: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7678: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7679: class="filename">PLIST</code> file you write:</p>
1.1 grant 7680: <pre class="programlisting">
1.51 rillig 7681: @comment $NetBSD$
1.1 grant 7682: </pre>
7683: </div>
7684:
1.55 rillig 7685: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7686: <div class="titlepage">
7687: <div>
7688: <div>
7689: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7690: "automatic-plist-generation" id=
1.38 dillo 7691: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7692: <code xmlns=
7693: "http://www.w3.org/TR/xhtml1/transitional" class=
7694: "filename">PLIST</code> generation</h2>
1.1 grant 7695: </div>
7696: </div>
7697: </div>
7698:
1.14 xtraeme 7699: <p>You can use the <span><strong class="command">make
7700: print-PLIST</strong></span> command to output a PLIST
7701: that matches any new files since the package was
7702: extracted. See <a href="#build.helpful-targets" title=
1.56 ! rillig 7703: "14.16. Other helpful targets">Section 14.16,
1.1 grant 7704: “Other helpful targets”</a> for more
7705: information on this target.</p>
7706: </div>
7707:
1.55 rillig 7708: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7709: <div class="titlepage">
7710: <div>
7711: <div>
7712: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7713: "print-PLIST" id=
1.38 dillo 7714: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7715: <span><strong class="command">make
7716: print-PLIST</strong></span></h2>
1.1 grant 7717: </div>
7718: </div>
7719: </div>
7720:
7721: <p>If you have used any of the *-dirs packages, as
7722: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7723: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7724: “Sharing directories between packages”</a>,
1.14 xtraeme 7725: you may have noticed that <span><strong class=
7726: "command">make print-PLIST</strong></span> outputs a set
7727: of <code class="varname">@comment</code>s instead of real
7728: <code class="varname">@dirrm</code> lines. You can also
7729: do this for specific directories and files, so that the
7730: results of that command are very close to reality. This
7731: helps <span class="emphasis"><em>a lot</em></span> during
7732: the update of packages.</p>
7733:
7734: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7735: variable takes a set of AWK patterns and actions that are
7736: used to filter the output of print-PLIST. You can
7737: <span class="emphasis"><em>append</em></span> any chunk
7738: of AWK scripting you like to it, but be careful with
1.1 grant 7739: quoting.</p>
7740:
1.45 wiz 7741: <p>For example, to get all files inside the <code xmlns=
7742: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7743: "filename">libdata/foo</code> directory removed from the
1.1 grant 7744: resulting PLIST:</p>
7745: <pre class="programlisting">
1.51 rillig 7746: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7747: </pre>
7748:
1.14 xtraeme 7749: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7750: lines referring to a specific (shared) directory
1.14 xtraeme 7751: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7752: <pre class="programlisting">
1.51 rillig 7753: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7754: </pre>
7755: </div>
7756:
1.55 rillig 7757: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7758: <div class="titlepage">
7759: <div>
7760: <div>
7761: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7762: "plist.misc" id=
1.38 dillo 7763: "plist.misc"></a>10.4. Variable substitution
7764: in PLIST</h2>
1.1 grant 7765: </div>
7766: </div>
7767: </div>
7768:
7769: <p>A number of variables are substituted automatically in
7770: PLISTs when a package is installed on a system. This
7771: includes the following variables:</p>
7772:
7773: <div class="variablelist">
7774: <dl>
1.14 xtraeme 7775: <dt><span class="term"><code class=
7776: "varname">${MACHINE_ARCH}</code>, <code class=
7777: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7778:
7779: <dd>
7780: <p>Some packages like emacs and perl embed
7781: information about which architecture they were
7782: built on into the pathnames where they install
1.47 reed 7783: their files. To handle this case, PLIST will be
1.1 grant 7784: preprocessed before actually used, and the symbol
1.14 xtraeme 7785: “<span class="quote"><code class=
7786: "varname">${MACHINE_ARCH}</code></span>” will
7787: be replaced by what <span><strong class=
7788: "command">uname -p</strong></span> gives. The same
7789: is done if the string <code class=
7790: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7791: PLIST somewhere - use this on packages that have
1.47 reed 7792: GNU autoconf-created configure scripts.</p>
1.1 grant 7793:
7794: <div class="note" style=
7795: "margin-left: 0.5in; margin-right: 0.5in;">
7796: <h3 class="title">Legacy note</h3>
7797:
7798: <p>There used to be a symbol “<span class=
1.14 xtraeme 7799: "quote"><code class=
7800: "varname">$ARCH</code></span>” that was
7801: replaced by the output of <span><strong class=
7802: "command">uname -m</strong></span>, but that's no
1.1 grant 7803: longer supported and has been removed.</p>
7804: </div>
7805: </dd>
7806:
1.14 xtraeme 7807: <dt><span class="term"><code class=
7808: "varname">${OPSYS}</code>, <code class=
7809: "varname">${LOWER_OPSYS}</code>, <code class=
7810: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7811:
7812: <dd>
7813: <p>Some packages want to embed the OS name and
7814: version into some paths. To do this, use these
1.45 wiz 7815: variables in the <code xmlns=
7816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7817: "filename">PLIST</code>:</p>
1.1 grant 7818:
7819: <div class="itemizedlist">
7820: <ul type="disc">
7821: <li>
1.14 xtraeme 7822: <p><code class="varname">${OPSYS}</code> -
7823: output of “<span class=
7824: "quote"><span><strong class="command">uname
7825: -s</strong></span></span>”</p>
1.1 grant 7826: </li>
7827:
7828: <li>
1.14 xtraeme 7829: <p><code class=
7830: "varname">${LOWER_OPSYS}</code> - lowercase
7831: common name (eg. “<span class=
7832: "quote">solaris</span>”)</p>
1.1 grant 7833: </li>
7834:
7835: <li>
1.14 xtraeme 7836: <p><code class="varname">${OS_VERSION}</code>
7837: - “<span class=
7838: "quote"><span><strong class="command">uname
7839: -r</strong></span></span>”</p>
1.1 grant 7840: </li>
7841: </ul>
7842: </div>
7843: </dd>
7844:
1.14 xtraeme 7845: <dt><span class="term"><code class=
7846: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7847:
7848: <dd>
7849: <p>Packages that install locale files should list
7850: them in the PLIST as “<span class=
7851: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7852: instead of “<span class=
7853: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7854: This properly handles the fact that different
7855: operating systems expect locale files to be either
1.45 wiz 7856: in <code xmlns=
7857: "http://www.w3.org/TR/xhtml1/transitional" class=
7858: "filename">share</code> or <code xmlns=
7859: "http://www.w3.org/TR/xhtml1/transitional" class=
7860: "filename">lib</code> by default.</p>
1.1 grant 7861: </dd>
7862: </dl>
7863: </div>
7864:
7865: <p>For a complete list of values which are replaced by
1.45 wiz 7866: default, please look in <code xmlns=
7867: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7868: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7869: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7870:
7871: <p>If you want to change other variables not listed
7872: above, you can add variables and their expansions to this
1.14 xtraeme 7873: variable in the following way, similar to <code class=
7874: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7875: "#components.optional" title=
1.38 dillo 7876: "8.5. Optional files">Section 8.5,
1.1 grant 7877: “Optional files”</a>):</p>
7878: <pre class="programlisting">
1.51 rillig 7879: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 7880: </pre>
7881:
7882: <p>This replaces all occurrences of “<span class=
7883: "quote">${SOMEVAR}</span>” in the PLIST with
7884: “<span class="quote">somevalue</span>”.</p>
7885: </div>
7886:
1.55 rillig 7887: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7888: <div class="titlepage">
7889: <div>
7890: <div>
7891: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7892: "manpage-compression" id=
1.48 dillo 7893: "manpage-compression"></a>10.5. Man page
7894: compression</h2>
1.1 grant 7895: </div>
7896: </div>
7897: </div>
7898:
1.47 reed 7899: <p>Man pages should be installed in compressed form if
1.45 wiz 7900: <code class="varname">MANZ</code> is set (in <code xmlns=
7901: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7902: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7903: otherwise. To handle this in the <code xmlns=
7904: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7905: "filename">PLIST</code> file, the suffix
7906: “<span class="quote">.gz</span>” is
1.47 reed 7907: appended/removed automatically for man pages according to
1.14 xtraeme 7908: <code class="varname">MANZ</code> and <code class=
7909: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7910: above for details. This modification of the <code xmlns=
7911: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7912: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7913: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7914: class="filename">PLIST</code> itself.</p>
1.1 grant 7915: </div>
7916:
1.55 rillig 7917: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7918: <div class="titlepage">
7919: <div>
7920: <div>
7921: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7922: "using-PLIST_SRC" id=
1.38 dillo 7923: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7924: source with <code class=
1.14 xtraeme 7925: "varname">PLIST_SRC</code></h2>
1.1 grant 7926: </div>
7927: </div>
7928: </div>
7929:
1.14 xtraeme 7930: <p>To use one or more files as source for the
1.45 wiz 7931: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7932: class="filename">PLIST</code> used in generating the
7933: binary package, set the variable <code class=
1.14 xtraeme 7934: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7935: The files are later concatenated using <a href=
7936: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7937: <span class="citerefentry"><span class=
7938: "refentrytitle">cat</span>(1)</span></a>, and order of
7939: things is important.</p>
1.1 grant 7940: </div>
7941:
1.55 rillig 7942: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7943: <div class="titlepage">
7944: <div>
7945: <div>
7946: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7947: "platform-specific-plist" id=
1.47 reed 7948: "platform-specific-plist"></a>10.7. Platform-specific
7949: and differing PLISTs</h2>
1.1 grant 7950: </div>
7951: </div>
7952: </div>
7953:
7954: <p>Some packages decide to install a different set of
7955: files based on the operating system being used. These
7956: differences can be automatically handled by using the
7957: following files:</p>
7958:
7959: <div class="itemizedlist">
7960: <ul type="disc">
7961: <li>
1.45 wiz 7962: <p><code xmlns=
7963: "http://www.w3.org/TR/xhtml1/transitional" class=
7964: "filename">PLIST.common</code></p>
1.1 grant 7965: </li>
7966:
7967: <li>
1.45 wiz 7968: <p><code xmlns=
7969: "http://www.w3.org/TR/xhtml1/transitional" class=
7970: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7971: </li>
7972:
7973: <li>
1.45 wiz 7974: <p><code xmlns=
7975: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7976: "filename">PLIST.${MACHINE_ARCH}</code></p>
7977: </li>
7978:
7979: <li>
1.45 wiz 7980: <p><code xmlns=
7981: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7982: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7983: </li>
7984:
7985: <li>
1.45 wiz 7986: <p><code xmlns=
7987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7988: "filename">PLIST.common_end</code></p>
1.1 grant 7989: </li>
7990: </ul>
7991: </div>
7992: </div>
7993:
1.55 rillig 7994: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7995: <div class="titlepage">
7996: <div>
7997: <div>
7998: <h2 class="title" style="clear: both"><a name=
1.55 rillig 7999: "faq.common-dirs" id=
1.38 dillo 8000: "faq.common-dirs"></a>10.8. Sharing
8001: directories between packages</h2>
1.1 grant 8002: </div>
8003: </div>
8004: </div>
8005:
8006: <p>A “<span class="quote">shared
8007: directory</span>” is a directory where multiple
8008: (and unrelated) packages install files. These directories
8009: are problematic because you have to add special tricks in
8010: the PLIST to conditionally remove them, or have some
8011: centralized package handle them.</p>
8012:
8013: <p>Within pkgsrc, you'll find both approaches. If a
8014: directory is shared by a few unrelated packages, it's
8015: often not worth to add an extra package to remove it.
8016: Therefore, one simply does:</p>
8017: <pre class="programlisting">
1.51 rillig 8018: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8019: </pre>
8020:
8021: <p>in the PLISTs of all affected packages, instead of the
8022: regular "@dirrm" line.</p>
8023:
8024: <p>However, if the directory is shared across many
8025: packages, two different solutions are available:</p>
8026:
8027: <div class="orderedlist">
8028: <ol type="1">
8029: <li>
8030: <p>If the packages have a common dependency, the
8031: directory can be removed in that. For example, see
8032: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8033: href=
8034: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8035: target="_top"><code xmlns="" class=
8036: "filename">textproc/scrollkeeper</code></a>, which
8037: removes the shared directory <code xmlns=
8038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8039: "filename">share/omf</code>.</p>
1.1 grant 8040: </li>
8041:
8042: <li>
8043: <p>If the packages using the directory are not
8044: related at all (they have no common dependencies),
8045: a *-dirs package is used.</p>
8046: </li>
8047: </ol>
8048: </div>
8049:
8050: <p>From now on, we'll discuss the second solution. To get
8051: an idea of the *-dirs packages available, issue:</p>
8052: <pre class="programlisting">
1.51 rillig 8053: <code class="prompt">%</code> cd .../pkgsrc
8054: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8055: </pre>
8056:
8057: <p>Their use from other packages is very simple. The
1.14 xtraeme 8058: <code class="varname">USE_DIRS</code> variable takes a
8059: list of package names (without the “<span class=
1.1 grant 8060: "quote">-dirs</span>” part) together with the
8061: required version number (always pick the latest one when
1.34 wiz 8062: writing new packages).</p>
1.1 grant 8063:
8064: <p>For example, if a package installs files under
1.45 wiz 8065: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8066: class="filename">share/applications</code>, it should
8067: have the following line in it:</p>
1.1 grant 8068: <pre class="programlisting">
1.51 rillig 8069: USE_DIRS+= xdg-1.1
1.1 grant 8070: </pre>
8071:
1.14 xtraeme 8072: <p>After regenerating the PLIST using
8073: <span><strong class="command">make
8074: print-PLIST</strong></span>, you should get the right
8075: (commented out) lines.</p>
1.1 grant 8076:
1.47 reed 8077: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8078: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8079: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8080: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8081: part and pkgsrc (in particular, <code xmlns=
8082: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8083: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8084: </div>
8085: </div>
8086:
1.55 rillig 8087: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 8088: <div class="titlepage">
8089: <div>
8090: <div>
1.55 rillig 8091: <h2 class="title"><a name="buildlink" id=
1.38 dillo 8092: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8093: methodology</h2>
8094: </div>
8095: </div>
8096: </div>
8097:
8098: <div class="toc">
8099: <p><b>Table of Contents</b></p>
8100:
8101: <dl>
1.30 wiz 8102: <dt><span class="sect1"><a href=
1.38 dillo 8103: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8104: to use buildlink3</a></span></dt>
1.1 grant 8105:
1.30 wiz 8106: <dt><span class="sect1"><a href=
1.45 wiz 8107: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8108: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8109: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8110:
8111: <dd>
8112: <dl>
1.25 rillig 8113: <dt><span class="sect2"><a href=
1.38 dillo 8114: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8115: buildlink3.mk file</a></span></dt>
1.1 grant 8116:
1.25 rillig 8117: <dt><span class="sect2"><a href=
1.38 dillo 8118: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8119: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8120: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8121: <code xmlns=
8122: "http://www.w3.org/TR/xhtml1/transitional" class=
8123: "filename">buildlink3.mk</code>
1.1 grant 8124: files</a></span></dt>
8125: </dl>
8126: </dd>
8127:
1.30 wiz 8128: <dt><span class="sect1"><a href=
1.45 wiz 8129: "#writing-builtin.mk">11.3. Writing <code xmlns=
8130: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8131: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8132:
8133: <dd>
8134: <dl>
1.25 rillig 8135: <dt><span class="sect2"><a href=
1.38 dillo 8136: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8137: <code xmlns=
8138: "http://www.w3.org/TR/xhtml1/transitional" class=
8139: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8140:
1.25 rillig 8141: <dt><span class="sect2"><a href=
1.38 dillo 8142: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8143: preferences for native or pkgsrc
8144: software</a></span></dt>
1.1 grant 8145: </dl>
8146: </dd>
8147: </dl>
8148: </div>
8149:
8150: <p>Buildlink is a framework in pkgsrc that controls what
8151: headers and libraries are seen by a package's configure and
8152: build processes. This is implemented in a two step
8153: process:</p>
8154:
8155: <div class="orderedlist">
8156: <ol type="1">
8157: <li>
8158: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8159: into <code class="varname">BUILDLINK_DIR</code>,
8160: which by default is a subdirectory of <code class=
8161: "varname">WRKDIR</code>.</p>
1.1 grant 8162: </li>
8163:
8164: <li>
8165: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8166: the normal compiler tools that translate <code class=
8167: "option">-I${LOCALBASE}/include</code> and
8168: <code class="option">-L${LOCALBASE}/lib</code> into
8169: references to <code class=
8170: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8171: also make native compiler on some operating systems
8172: look like GCC, so that packages that expect GCC won't
8173: require modifications to build with those native
8174: compilers.</p>
1.1 grant 8175: </li>
8176: </ol>
8177: </div>
8178:
8179: <p>This normalizes the environment in which a package is
8180: built so that the package may be built consistently despite
8181: what other software may be installed. Please note that the
1.45 wiz 8182: normal system header and library paths, e.g. <code xmlns=
8183: "http://www.w3.org/TR/xhtml1/transitional" class=
8184: "filename">/usr/include</code>, <code xmlns=
8185: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8186: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8187: buildlink3 is designed to insulate the package build from
8188: non-system-supplied software.</p>
8189:
1.55 rillig 8190: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8191: <div class="titlepage">
8192: <div>
8193: <div>
8194: <h2 class="title" style="clear: both"><a name=
1.55 rillig 8195: "converting-to-buildlink3" id=
1.38 dillo 8196: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8197: packages to use buildlink3</h2>
1.1 grant 8198: </div>
8199: </div>
8200: </div>
8201:
8202: <p>The process of converting packages to use the
8203: buildlink3 framework (“<span class=
8204: "quote">bl3ifying</span>”) is fairly
8205: straightforward. The things to keep in mind are:</p>
8206:
8207: <div class="orderedlist">
8208: <ol type="1">
8209: <li>
8210: <p>Ensure that the build always calls the wrapper
8211: scripts instead of the actual toolchain. Some
8212: packages are tricky, and the only way to know for
1.45 wiz 8213: sure is the check <code xmlns=
8214: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8215: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8216: wrappers are being invoked.</p>
8217: </li>
8218:
8219: <li>
1.14 xtraeme 8220: <p>Don't override <code class=
8221: "varname">PREFIX</code> from within the package
8222: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8223: because the code to symlink files into <code xmlns=
8224: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8225: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8226: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8227: <em class=
8228: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8229: </li>
8230:
8231: <li>
8232: <p>Remember that <span class=
1.45 wiz 8233: "emphasis"><em>only</em></span> the <code xmlns=
8234: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8235: "filename">buildlink3.mk</code> files that you list
1.1 grant 8236: in a package's Makefile are added as dependencies
8237: for that package.</p>
8238: </li>
8239: </ol>
8240: </div>
8241:
8242: <p>If a dependency on a particular package is required
8243: for its libraries and headers, then we replace:</p>
8244: <pre class="programlisting">
1.51 rillig 8245: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8246: </pre>
8247:
8248: <p>with</p>
8249: <pre class="programlisting">
1.51 rillig 8250: .include "../../category/foo/buildlink3.mk"
1.1 grant 8251: </pre>
8252:
1.47 reed 8253: <p>The buildlink3.mk files usually define the required
8254: dependencies. If you need a newer version of the
8255: dependency when using buildlink3.mk files, then you can
8256: define it in your Makefile; for example:</p>
8257: <pre class="programlisting">
1.51 rillig 8258: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8259: .include "../../category/foo/buildlink3.mk"
1.47 reed 8260: </pre>
8261:
1.45 wiz 8262: <p>There are several <code xmlns=
8263: "http://www.w3.org/TR/xhtml1/transitional" class=
8264: "filename">buildlink3.mk</code> files in <code xmlns=
8265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8266: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8267: issues:</p>
8268:
8269: <div class="itemizedlist">
8270: <ul type="disc">
8271: <li>
1.45 wiz 8272: <p><code xmlns=
8273: "http://www.w3.org/TR/xhtml1/transitional" class=
8274: "filename">bdb.buildlink3.mk</code> chooses either
8275: the native or a pkgsrc Berkeley DB implementation
8276: based on the values of <code class=
1.14 xtraeme 8277: "varname">BDB_ACCEPTED</code> and <code class=
8278: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8279: </li>
8280:
8281: <li>
1.45 wiz 8282: <p><code xmlns=
8283: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8284: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8285: system comes with neither Curses nor NCurses, this
8286: will take care to install the <a xmlns=
8287: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8288: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8289: target="_top"><code xmlns="" class=
8290: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8291: </li>
8292:
8293: <li>
1.45 wiz 8294: <p><code xmlns=
8295: "http://www.w3.org/TR/xhtml1/transitional" class=
8296: "filename">krb5.buildlink3.mk</code> uses the value
8297: of <code class="varname">KRB5_ACCEPTED</code> to
8298: choose between adding a dependency on Heimdal or
8299: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8300: implementation.</p>
8301: </li>
8302:
8303: <li>
1.45 wiz 8304: <p><code xmlns=
8305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8306: "filename">motif.buildlink3.mk</code> checks for a
8307: system-provided Motif installation or adds a
8308: dependency on <a xmlns=
1.1 grant 8309: "http://www.w3.org/TR/xhtml1/transitional" href=
8310: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8311: target="_top"><code xmlns="" class=
8312: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8313: "http://www.w3.org/TR/xhtml1/transitional" href=
8314: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8315: target="_top"><code xmlns="" class=
1.47 reed 8316: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8317: </li>
8318:
8319: <li>
1.45 wiz 8320: <p><code xmlns=
8321: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8322: "filename">ossaudio.buildlink3.mk</code> defines
8323: several variables that may be used by packages that
1.47 reed 8324: use the Open Sound System (OSS) API.</p>
1.1 grant 8325: </li>
8326:
8327: <li>
1.45 wiz 8328: <p><code xmlns=
8329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8330: "filename">pgsql.buildlink3.mk</code> will accept
8331: either Postgres 7.3 or 7.4, whichever is found
8332: installed. See the file for more information.</p>
1.1 grant 8333: </li>
8334:
8335: <li>
1.45 wiz 8336: <p><code xmlns=
8337: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8338: "filename">pthread.buildlink3.mk</code> uses the
8339: value of <code class="varname">PTHREAD_OPTS</code>
8340: and checks for native pthreads or adds a dependency
8341: on <a xmlns=
1.1 grant 8342: "http://www.w3.org/TR/xhtml1/transitional" href=
8343: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8344: target="_top"><code xmlns="" class=
1.47 reed 8345: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8346: </li>
8347:
8348: <li>
1.45 wiz 8349: <p><code xmlns=
8350: "http://www.w3.org/TR/xhtml1/transitional" class=
8351: "filename">xaw.buildlink3.mk</code> uses the value
8352: of <code class="varname">XAW_TYPE</code> to choose
8353: a particular Athena widgets library.</p>
1.1 grant 8354: </li>
8355: </ul>
8356: </div>
8357:
1.45 wiz 8358: <p>The comments in those <code xmlns=
8359: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8360: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8361: complete description of how to use them properly.</p>
8362: </div>
8363:
1.55 rillig 8364: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8365: <div class="titlepage">
8366: <div>
8367: <div>
8368: <h2 class="title" style="clear: both"><a name=
1.55 rillig 8369: "creating-buildlink3.mk" id=
1.38 dillo 8370: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8371: <code xmlns=
8372: "http://www.w3.org/TR/xhtml1/transitional" class=
8373: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8374: </div>
8375: </div>
8376: </div>
8377:
1.45 wiz 8378: <p>A package's <code xmlns=
8379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8380: "filename">buildlink3.mk</code> file is included by
8381: Makefiles to indicate the need to compile and link
8382: against header files and libraries provided by the
1.45 wiz 8383: package. A <code xmlns=
8384: "http://www.w3.org/TR/xhtml1/transitional" class=
8385: "filename">buildlink3.mk</code> file should always
8386: provide enough information to add the correct type of
8387: dependency relationship and include any other
8388: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8389: class="filename">buildlink3.mk</code> files that it needs
8390: to find headers and libraries that it needs in turn.</p>
1.1 grant 8391:
1.45 wiz 8392: <p>To generate an initial <code xmlns=
8393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8394: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8395: Rene Hexel's <a xmlns=
8396: "http://www.w3.org/TR/xhtml1/transitional" href=
8397: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8398: target="_top"><code xmlns="" class=
8399: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8400: highly recommended. For most packages, the following
8401: command will generate a good starting point for
1.45 wiz 8402: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8403: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8404: <pre class="screen">
1.14 xtraeme 8405: <code class="prompt">%</code> <strong class=
8406: "userinput"><code>cd pkgsrc/<em class=
8407: "replaceable"><code>category</code></em>/<em class=
8408: "replaceable"><code>pkgdir</code></em>
8409: <code class=
1.49 rillig 8410: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8411: </pre>
8412:
1.55 rillig 8413: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8414: <div class="titlepage">
8415: <div>
8416: <div>
1.55 rillig 8417: <h3 class="title"><a name="anatomy-of-bl3" id=
8418: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8419: buildlink3.mk file</h3>
1.1 grant 8420: </div>
8421: </div>
8422: </div>
8423:
1.45 wiz 8424: <p>The following real-life example <code xmlns=
8425: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8426: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8427: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8428: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8429: <pre class="programlisting">
1.51 rillig 8430: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8431:
1.51 rillig 8432: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8433: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8434:
1.51 rillig 8435: .if !empty(BUILDLINK_DEPTH:M+)
8436: BUILDLINK_DEPENDS+= tiff
8437: .endif
1.1 grant 8438:
1.51 rillig 8439: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8440: BUILDLINK_PACKAGES+= tiff
1.1 grant 8441:
1.51 rillig 8442: .if !empty(TIFF_BUILDLINK3_MK:M+)
8443: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8444: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8445: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8446:
1.51 rillig 8447: .include "../../devel/zlib/buildlink3.mk"
8448: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8449:
1.51 rillig 8450: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8451: </pre>
8452:
1.14 xtraeme 8453: <p>The header and footer manipulate <code class=
8454: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8455: across all <code xmlns=
8456: "http://www.w3.org/TR/xhtml1/transitional" class=
8457: "filename">buildlink3.mk</code> files and is used to
8458: track at what depth we are including <code xmlns=
8459: "http://www.w3.org/TR/xhtml1/transitional" class=
8460: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8461:
8462: <p>The first section controls if the dependency on
1.14 xtraeme 8463: <em class="replaceable"><code>pkg</code></em> is added.
8464: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8465: global list of packages for which dependencies are
8466: added by buildlink3.</p>
8467:
8468: <p>The second section advises pkgsrc that the
1.45 wiz 8469: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8470: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8471: <em class="replaceable"><code>pkg</code></em> has been
8472: included at some point. <code class=
8473: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8474: of packages for which <code xmlns=
8475: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8476: "filename">buildlink3.mk</code> files have been
8477: included. It must <span class=
8478: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8479: a <code xmlns=
8480: "http://www.w3.org/TR/xhtml1/transitional" class=
8481: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8482:
8483: <p>The third section is protected from multiple
1.14 xtraeme 8484: inclusion and controls how the dependency on <em class=
8485: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8486: important variables are set in the section:</p>
8487:
8488: <div class="itemizedlist">
8489: <ul type="disc">
8490: <li>
1.14 xtraeme 8491: <p><code class=
8492: "varname">BUILDLINK_DEPENDS.<em class=
8493: "replaceable"><code>pkg</code></em></code> is the
8494: actual dependency recorded in the installed
8495: package; this should always be set using
8496: <span><strong class="command">+=</strong></span>
8497: to ensure that we're appending to any
8498: pre-existing list of values. This variable should
8499: be set to the first version of the package that
8500: had the last change in the major number of a
8501: shared library or that had a major API
8502: change.</p>
1.1 grant 8503: </li>
8504:
8505: <li>
1.14 xtraeme 8506: <p><code class=
8507: "varname">BUILDLINK_PKGSRCDIR.<em class=
8508: "replaceable"><code>pkg</code></em></code> is the
8509: location of the <em class=
8510: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8511: directory.</p>
1.1 grant 8512: </li>
8513:
8514: <li>
1.14 xtraeme 8515: <p><code class=
8516: "varname">BUILDLINK_DEPMETHOD.<em class=
8517: "replaceable"><code>pkg</code></em></code> (not
8518: shown above) controls whether we use <code class=
8519: "varname">BUILD_DEPENDS</code> or <code class=
8520: "varname">DEPENDS</code> to add the dependency on
8521: <em class="replaceable"><code>pkg</code></em>.
8522: The build dependency is selected by setting
8523: <code class=
8524: "varname">BUILDLINK_DEPMETHOD.<em class=
8525: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8526: “<span class="quote">build</span>”.
8527: By default, the full dependency is used.</p>
8528: </li>
8529:
8530: <li>
1.14 xtraeme 8531: <p><code class=
8532: "varname">BUILDLINK_INCDIRS.<em class=
8533: "replaceable"><code>pkg</code></em></code> and
8534: <code class=
1.55 rillig 8535: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
8536: <code>pkg</code></em></code> (not shown above)
8537: are lists of subdirectories of <code xmlns=
1.45 wiz 8538: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8539: "filename">${BUILDLINK_PREFIX.<em class=
8540: "replaceable"><code>pkg</code></em>}</code> to
8541: add to the header and library search paths. These
1.1 grant 8542: default to “<span class=
8543: "quote">include</span>” and
8544: “<span class="quote">lib</span>”
8545: respectively.</p>
8546: </li>
8547:
8548: <li>
1.14 xtraeme 8549: <p><code class=
8550: "varname">BUILDLINK_CPPFLAGS.<em class=
8551: "replaceable"><code>pkg</code></em></code> (not
8552: shown above) is the list of preprocessor flags to
8553: add to <code class="varname">CPPFLAGS</code>,
8554: which are passed on to the configure and build
8555: phases. The “<span class=
8556: "quote">-I</span>” option should be avoided
8557: and instead be handled using <code class=
8558: "varname">BUILDLINK_INCDIRS.<em class=
8559: "replaceable"><code>pkg</code></em></code> as
8560: above.</p>
1.1 grant 8561: </li>
8562: </ul>
8563: </div>
8564:
8565: <p>The following variables are all optionally defined
8566: within this second section (protected against multiple
8567: inclusion) and control which package files are
1.45 wiz 8568: symlinked into <code xmlns=
8569: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8570: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8571: are transformed during the symlinking:</p>
8572:
8573: <div class="itemizedlist">
8574: <ul type="disc">
8575: <li>
1.14 xtraeme 8576: <p><code class=
8577: "varname">BUILDLINK_FILES.<em class=
8578: "replaceable"><code>pkg</code></em></code> (not
8579: shown above) is a shell glob pattern relative to
1.45 wiz 8580: <code xmlns=
8581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8582: "filename">${BUILDLINK_PREFIX.<em class=
8583: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8584: symlinked into <code xmlns=
8585: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8586: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8587: <code xmlns=
8588: "http://www.w3.org/TR/xhtml1/transitional" class=
8589: "filename">include/*.h</code>.</p>
1.1 grant 8590: </li>
8591:
8592: <li>
1.14 xtraeme 8593: <p><code class=
8594: "varname">BUILDLINK_FILES_CMD.<em class=
8595: "replaceable"><code>pkg</code></em></code> (not
8596: shown above) is a shell pipeline that outputs to
1.45 wiz 8597: stdout a list of files relative to <code xmlns=
8598: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8599: "filename">${BUILDLINK_PREFIX.<em class=
8600: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8601: resulting files are to be symlinked into
1.45 wiz 8602: <code xmlns=
8603: "http://www.w3.org/TR/xhtml1/transitional" class=
8604: "filename">${BUILDLINK_DIR}</code>. By default,
8605: this takes the <code xmlns=
8606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8607: "filename">+CONTENTS</code> of a <em class=
8608: "replaceable"><code>pkg</code></em> and filters
8609: it through <code class=
8610: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8611: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8612: </li>
8613:
8614: <li>
1.14 xtraeme 8615: <p><code class=
8616: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8617: "replaceable"><code>pkg</code></em></code> (not
8618: shown above) is a filter command that filters
1.45 wiz 8619: <code xmlns=
8620: "http://www.w3.org/TR/xhtml1/transitional" class=
8621: "filename">+CONTENTS</code> input into a list of
8622: files relative to <code xmlns=
8623: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8624: "filename">${BUILDLINK_PREFIX.<em class=
8625: "replaceable"><code>pkg</code></em>}</code> on
8626: stdout. By default for overwrite packages,
8627: <code class=
8628: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8629: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8630: outputs the contents of the <code xmlns=
8631: "http://www.w3.org/TR/xhtml1/transitional" class=
8632: "filename">include</code> and <code xmlns=
8633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8634: "filename">lib</code> directories in the package
1.45 wiz 8635: <code xmlns=
8636: "http://www.w3.org/TR/xhtml1/transitional" class=
8637: "filename">+CONTENTS</code>, and for pkgviews
8638: packages, it outputs any libtool archives in
8639: <code xmlns=
8640: "http://www.w3.org/TR/xhtml1/transitional" class=
8641: "filename">lib</code> directories.</p>
1.1 grant 8642: </li>
8643:
8644: <li>
1.14 xtraeme 8645: <p><code class=
8646: "varname">BUILDLINK_TRANSFORM.<em class=
8647: "replaceable"><code>pkg</code></em></code> (not
8648: shown above) is a list of sed arguments used to
1.1 grant 8649: transform the name of the source filename into a
1.14 xtraeme 8650: destination filename, e.g. <span><strong class=
1.1 grant 8651: "command">-e
1.14 xtraeme 8652: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8653: </li>
8654: </ul>
8655: </div>
8656:
1.45 wiz 8657: <p>The last section includes any <code xmlns=
8658: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8659: "filename">buildlink3.mk</code> needed for <em class=
8660: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8661: dependencies. Including these <code xmlns=
8662: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8663: "filename">buildlink3.mk</code> files means that the
8664: headers and libraries for these dependencies are also
1.45 wiz 8665: symlinked into <code xmlns=
8666: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8667: "filename">${BUILDLINK_DIR}</code> whenever the
8668: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8669: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8670: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8671: included.</p>
1.1 grant 8672: </div>
8673:
1.55 rillig 8674: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8675: <div class="titlepage">
8676: <div>
8677: <div>
1.30 wiz 8678: <h3 class="title"><a name=
1.55 rillig 8679: "updating-buildlink-depends" id=
8680: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8681: <code class=
1.55 rillig 8682: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
8683: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 8684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8685: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8686: </div>
8687: </div>
8688: </div>
8689:
8690: <p>There are two situations that require increasing the
1.14 xtraeme 8691: dependency listed in <code class=
8692: "varname">BUILDLINK_DEPENDS.<em class=
8693: "replaceable"><code>pkg</code></em></code> after a
8694: package update:</p>
1.1 grant 8695:
8696: <div class="orderedlist">
8697: <ol type="1">
8698: <li>
8699: <p>if the sonames (major number of the library
8700: version) of any installed shared libraries
1.47 reed 8701: change.</p>
1.1 grant 8702: </li>
8703:
8704: <li>
8705: <p>if the API or interface to the header files
8706: change.</p>
8707: </li>
8708: </ol>
8709: </div>
8710:
1.14 xtraeme 8711: <p>In these cases, <code class=
8712: "varname">BUILDLINK_DEPENDS.<em class=
8713: "replaceable"><code>pkg</code></em></code> should be
8714: adjusted to require at least the new package version.
8715: In some cases, the packages that depend on this new
8716: version may need their <code class=
8717: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8718: have <code xmlns=
8719: "http://www.w3.org/TR/xhtml1/transitional" class=
8720: "filename">buildlink3.mk</code> files, their
8721: <code class="varname">BUILDLINK_DEPENDS.<em class=
8722: "replaceable"><code>pkg</code></em></code> adjusted,
8723: too. This is needed so that binary packages made using
8724: it will require the correct package dependency and not
8725: settle for an older one which will not contain the
8726: necessary shared libraries.</p>
1.1 grant 8727:
8728: <p>Please take careful consideration before adjusting
1.14 xtraeme 8729: <code class="varname">BUILDLINK_DEPENDS.<em class=
8730: "replaceable"><code>pkg</code></em></code> as we don't
8731: want to cause unneeded package deletions and rebuilds.
8732: In many cases, new versions of packages work just fine
8733: with older dependencies. See <a href="#dependencies"
1.55 rillig 8734: title="15.1.4. Handling dependencies">Section
8735: 15.1.4, “Handling dependencies”</a> for
8736: more information about dependencies on other packages,
1.25 rillig 8737: including the <code class=
8738: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8739: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8740: </div>
8741: </div>
8742:
1.55 rillig 8743: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8744: <div class="titlepage">
8745: <div>
8746: <div>
8747: <h2 class="title" style="clear: both"><a name=
1.55 rillig 8748: "writing-builtin.mk" id=
1.38 dillo 8749: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8750: <code xmlns=
8751: "http://www.w3.org/TR/xhtml1/transitional" class=
8752: "filename">builtin.mk</code> files</h2>
1.1 grant 8753: </div>
8754: </div>
8755: </div>
8756:
8757: <p>Some packages in pkgsrc install headers and libraries
8758: that coincide with headers and libraries present in the
1.45 wiz 8759: base system. Aside from a <code xmlns=
8760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8761: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8762: should also include a <code xmlns=
8763: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8764: "filename">builtin.mk</code> file that includes the
8765: necessary checks to decide whether using the built-in
8766: software or the pkgsrc software is appropriate.</p>
1.1 grant 8767:
8768: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8769: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8770:
8771: <div class="orderedlist">
8772: <ol type="1">
8773: <li>
1.14 xtraeme 8774: <p>It should set <code class=
8775: "varname">USE_BUILTIN.<em class=
8776: "replaceable"><code>pkg</code></em></code> to
8777: either “<span class="quote">yes</span>”
8778: or “<span class="quote">no</span>”
8779: after it is included.</p>
1.1 grant 8780: </li>
8781:
8782: <li>
8783: <p>It should <span class=
8784: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8785: <code class="varname">USE_BUILTIN.<em class=
8786: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8787: already set before the <code xmlns=
8788: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8789: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8790: </li>
8791:
8792: <li>
8793: <p>It should be written to allow multiple
8794: inclusion. This is <span class=
8795: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8796: careful attention to <code xmlns=
8797: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8798: "filename">Makefile</code> coding.</p>
1.1 grant 8799: </li>
8800: </ol>
8801: </div>
8802:
1.55 rillig 8803: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8804: <div class="titlepage">
8805: <div>
8806: <div>
1.55 rillig 8807: <h3 class="title"><a name="anatomy-of-builtin.mk"
8808: id=
1.38 dillo 8809: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8810: of a <code xmlns=
8811: "http://www.w3.org/TR/xhtml1/transitional" class=
8812: "filename">builtin.mk</code> file</h3>
1.1 grant 8813: </div>
8814: </div>
8815: </div>
8816:
8817: <p>The following is the recommended template for
8818: builtin.mk files:</p>
8819: <pre class="programlisting">
1.51 rillig 8820: .if !defined(IS_BUILTIN.foo)
8821: #
8822: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8823: # genuinely exists in the system or not.
8824: #
8825: IS_BUILTIN.foo?= no
8826:
8827: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8828: # version can be determined.
8829: #
8830: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8831: BUILTIN_PKG.foo?= foo-1.0
8832: . endif
8833: .endif # IS_BUILTIN.foo
8834:
8835: .if !defined(USE_BUILTIN.foo)
8836: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8837: . if defined(BUILTIN_PKG.foo)
8838: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8839: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8840: USE_BUILTIN.foo!= \
8841: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8842: ${ECHO} "yes"; \
8843: else \
8844: ${ECHO} "no"; \
8845: fi
8846: . endif
8847: . endfor
8848: . endif
8849: .endif # USE_BUILTIN.foo
8850:
8851: CHECK_BUILTIN.foo?= no
8852: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8853: #
8854: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8855: # "yes" or "no".
8856: #
8857: .endif # CHECK_BUILTIN.foo
1.1 grant 8858: </pre>
8859:
1.14 xtraeme 8860: <p>The first section sets <code class=
8861: "varname">IS_BUILTIN.<em class=
8862: "replaceable"><code>pkg</code></em></code> depending on
8863: if <em class="replaceable"><code>pkg</code></em> really
8864: exists in the base system. This should not be a base
8865: system software with similar functionality to
8866: <em class="replaceable"><code>pkg</code></em>; it
8867: should only be “<span class=
8868: "quote">yes</span>” if the actual package is
8869: included as part of the base system. This variable is
1.45 wiz 8870: only used internally within the <code xmlns=
8871: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8872: "filename">builtin.mk</code> file.</p>
8873:
8874: <p>The second section sets <code class=
8875: "varname">BUILTIN_PKG.<em class=
8876: "replaceable"><code>pkg</code></em></code> to the
8877: version of <em class=
8878: "replaceable"><code>pkg</code></em> in the base system
8879: if it exists (if <code class=
8880: "varname">IS_BUILTIN.<em class=
8881: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8882: “<span class="quote">yes</span>”). This
1.14 xtraeme 8883: variable is only used internally within the
1.45 wiz 8884: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8885: class="filename">builtin.mk</code> file.</p>
1.1 grant 8886:
1.14 xtraeme 8887: <p>The third section sets <code class=
8888: "varname">USE_BUILTIN.<em class=
8889: "replaceable"><code>pkg</code></em></code> and is
8890: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8891: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8892: class="filename">builtin.mk</code> files. The code in
8893: this section must make the determination whether the
8894: built-in software is adequate to satisfy the
8895: dependencies listed in <code class=
1.14 xtraeme 8896: "varname">BUILDLINK_DEPENDS.<em class=
8897: "replaceable"><code>pkg</code></em></code>. This is
8898: typically done by comparing <code class=
8899: "varname">BUILTIN_PKG.<em class=
8900: "replaceable"><code>pkg</code></em></code> against each
8901: of the dependencies in <code class=
8902: "varname">BUILDLINK_DEPENDS.<em class=
8903: "replaceable"><code>pkg</code></em></code>.
8904: <code class="varname">USE_BUILTIN.<em class=
8905: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8906: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8907: value by the end of the <code xmlns=
8908: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8909: "filename">builtin.mk</code> file. Note that
8910: <code class="varname">USE_BUILTIN.<em class=
8911: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8912: “<span class="quote">yes</span>” even if
1.14 xtraeme 8913: <code class="varname">IS_BUILTIN.<em class=
8914: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8915: “<span class="quote">no</span>” because we
8916: may make the determination that the built-in version of
8917: the software is similar enough to be used as a
8918: replacement.</p>
8919:
1.14 xtraeme 8920: <p>The last section is guarded by <code class=
8921: "varname">CHECK_BUILTIN.<em class=
8922: "replaceable"><code>pkg</code></em></code>, and
8923: includes code that uses the value of <code class=
8924: "varname">USE_BUILTIN.<em class=
8925: "replaceable"><code>pkg</code></em></code> set in the
8926: previous section. This typically includes, e.g., adding
1.1 grant 8927: additional dependency restrictions and listing
1.45 wiz 8928: additional files to symlink into <code xmlns=
8929: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8930: "filename">${BUILDLINK_DIR}</code> (via <code class=
8931: "varname">BUILDLINK_FILES.<em class=
8932: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8933: </div>
8934:
1.55 rillig 8935: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8936: <div class="titlepage">
8937: <div>
8938: <div>
1.30 wiz 8939: <h3 class="title"><a name=
1.55 rillig 8940: "native-or-pkgsrc-preference" id=
1.38 dillo 8941: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8942: preferences for native or pkgsrc software</h3>
1.1 grant 8943: </div>
8944: </div>
8945: </div>
8946:
8947: <p>When building packages, it's possible to choose
8948: whether to set a global preference for using either the
8949: built-in (native) version or the pkgsrc version of
8950: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8951: setting <code class="varname">PREFER_PKGSRC</code> and
8952: <code class="varname">PREFER_NATIVE</code>. These
8953: variables take values of either “<span class=
1.1 grant 8954: "quote">yes</span>”, “<span class=
8955: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8956: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8957: to use the pkgsrc versions of software, while
8958: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8959: to use the built-in versions. Preferences are
8960: determined by the most specific instance of the package
8961: in either <code class="varname">PREFER_PKGSRC</code> or
8962: <code class="varname">PREFER_NATIVE</code>. If a
8963: package is specified in neither or in both variables,
8964: then <code class="varname">PREFER_PKGSRC</code> has
8965: precedence over <code class=
8966: "varname">PREFER_NATIVE</code>. For example, to require
8967: using pkgsrc versions of software for all but the most
8968: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8969: <pre class="programlisting">
1.51 rillig 8970: PREFER_PKGSRC= yes
8971: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 8972: </pre>
8973:
8974: <p>A package <span class=
1.45 wiz 8975: "emphasis"><em>must</em></span> have a <code xmlns=
8976: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8977: "filename">builtin.mk</code> file to be listed in
8978: <code class="varname">PREFER_NATIVE</code>, otherwise
8979: it is simply ignored in that list.</p>
1.1 grant 8980: </div>
8981: </div>
8982: </div>
8983:
1.55 rillig 8984: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 8985: <div class="titlepage">
8986: <div>
8987: <div>
1.55 rillig 8988: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 8989: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8990: framework</h2>
1.1 grant 8991: </div>
8992: </div>
8993: </div>
8994:
8995: <div class="toc">
8996: <p><b>Table of Contents</b></p>
8997:
8998: <dl>
1.30 wiz 8999: <dt><span class="sect1"><a href=
1.38 dillo 9000: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9001: directories outside the installation
9002: prefix</a></span></dt>
9003:
9004: <dd>
9005: <dl>
9006: <dt><span class="sect2"><a href=
1.38 dillo 9007: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9008: manipulation</a></span></dt>
9009:
9010: <dt><span class="sect2"><a href=
1.38 dillo 9011: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9012: manipulation</a></span></dt>
9013: </dl>
9014: </dd>
9015:
1.38 dillo 9016: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9017: Configuration files</a></span></dt>
9018:
9019: <dd>
9020: <dl>
9021: <dt><span class="sect2"><a href=
1.38 dillo 9022: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9023: "varname">PKG_SYSCONFDIR</code> is
9024: set</a></span></dt>
9025:
9026: <dt><span class="sect2"><a href=
1.38 dillo 9027: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9028: software where configuration files
1.35 jmmv 9029: are</a></span></dt>
9030:
9031: <dt><span class="sect2"><a href=
1.38 dillo 9032: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9033: installations</a></span></dt>
9034:
9035: <dt><span class="sect2"><a href=
1.38 dillo 9036: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9037: configuration files</a></span></dt>
9038: </dl>
9039: </dd>
9040:
1.38 dillo 9041: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9042: System startup scripts</a></span></dt>
9043:
9044: <dd>
9045: <dl>
9046: <dt><span class="sect2"><a href=
1.38 dillo 9047: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9048: of system startup scripts</a></span></dt>
9049: </dl>
9050: </dd>
1.1 grant 9051:
1.30 wiz 9052: <dt><span class="sect1"><a href=
1.38 dillo 9053: "#users-and-groups">12.4. System users and
1.35 jmmv 9054: groups</a></span></dt>
9055:
1.38 dillo 9056: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9057: shells</a></span></dt>
9058:
9059: <dd>
9060: <dl>
9061: <dt><span class="sect2"><a href=
1.38 dillo 9062: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 9063: configuration files</a></span></dt>
9064: </dl>
9065: </dd>
1.1 grant 9066: </dl>
9067: </div>
9068:
1.35 jmmv 9069: <p>This chapter describes the framework known as
9070: <code class="literal">pkginstall</code>, whose key features
9071: are:</p>
9072:
9073: <div class="itemizedlist">
9074: <ul type="disc">
9075: <li>
9076: <p>Generic installation and manipulation of
9077: directories and files outside the pkgsrc-handled
9078: tree, <code class="varname">LOCALBASE</code>.</p>
9079: </li>
9080:
9081: <li>
9082: <p>Automatic handling of configuration files during
9083: installation, provided that packages are correctly
9084: designed.</p>
9085: </li>
9086:
9087: <li>
9088: <p>Generation and installation of system startup
9089: scripts.</p>
9090: </li>
9091:
9092: <li>
9093: <p>Registration of system users and groups.</p>
9094: </li>
9095:
9096: <li>
9097: <p>Registration of system shells.</p>
9098: </li>
9099: </ul>
9100: </div>
9101:
9102: <p>The following sections inspect each of the above points
1.47 reed 9103: in detail. Note that in order to use any of the described
1.35 jmmv 9104: functionalities, you must add the following to your
1.45 wiz 9105: package's <code xmlns=
9106: "http://www.w3.org/TR/xhtml1/transitional" class=
9107: "filename">Makefile</code>:</p>
1.35 jmmv 9108: <pre class="programlisting">
1.51 rillig 9109: USE_PKGINSTALL= YES
1.35 jmmv 9110: </pre>
9111:
9112: <p>You may be thinking that many of the things described
9113: here could be easily done with simple code in the package's
9114: post-installation target (<code class=
9115: "literal">post-install</code>). <span class=
9116: "emphasis"><em>This is incorrect</em></span>, as the code
9117: in them is only executed when building from source.
9118: Machines using binary packages could not benefit from it at
9119: all (as the code itself could be unavailable). Therefore,
9120: the only way to achieve any of the items described above is
9121: by means of the installation scripts, which are
9122: automatically generated by pkginstall.</p>
1.1 grant 9123:
1.55 rillig 9124: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 9125: <div class="titlepage">
9126: <div>
9127: <div>
9128: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9129: "files-and-dirs-outside-prefix" id=
9130: "files-and-dirs-outside-prefix"></a>12.1. Files and
9131: directories outside the installation prefix</h2>
1.1 grant 9132: </div>
9133: </div>
9134: </div>
9135:
1.45 wiz 9136: <p>As you already know, the <code xmlns=
9137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9138: "filename">PLIST</code> file holds a list of files and
9139: directories that belong to a package. The names used in
1.45 wiz 9140: it are relative to the installation prefix (<code xmlns=
9141: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9142: "filename">${PREFIX}</code>), which means that it cannot
9143: register files outside this directory (absolute path
9144: names are not allowed). Despite this restriction, some
9145: packages need to install files outside this location;
1.45 wiz 9146: e.g., under <code xmlns=
9147: "http://www.w3.org/TR/xhtml1/transitional" class=
9148: "filename">${VARBASE}</code> or <code xmlns=
9149: "http://www.w3.org/TR/xhtml1/transitional" class=
9150: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9151:
9152: <p>The only way to achieve this is to create such files
9153: during installation time by using the installation
9154: scripts. These scripts can run arbitrary commands, so
9155: they have the potential to create and manage files
1.47 reed 9156: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9157: comes into play: it provides generic scripts to abstract
9158: the manipulation of such files and directories based on
1.45 wiz 9159: variables set in the package's <code xmlns=
9160: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9161: "filename">Makefile</code>. The rest of this section
1.47 reed 9162: describes these variables.</p>
1.1 grant 9163:
1.55 rillig 9164: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9165: <div class="titlepage">
1.1 grant 9166: <div>
1.35 jmmv 9167: <div>
1.55 rillig 9168: <h3 class="title"><a name="dirs-outside-prefix"
9169: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9170: manipulation</h3>
9171: </div>
1.1 grant 9172: </div>
9173: </div>
9174:
1.35 jmmv 9175: <p>The following variables can be set to request the
1.47 reed 9176: creation of directories anywhere in the file
9177: system:</p>
1.27 rillig 9178:
1.35 jmmv 9179: <div class="itemizedlist">
9180: <ul type="disc">
9181: <li>
9182: <p><code class="varname">MAKE_DIRS</code> and
9183: <code class="varname">OWN_DIRS</code> contain a
9184: list of directories that should be created and
9185: should attempt to be destroyed by the
9186: installation scripts. The difference between the
9187: two is that the latter prompts the administrator
9188: to remove any directories that may be left after
9189: deinstallation (because they were not empty),
9190: while the former does not.</p>
9191: </li>
1.1 grant 9192:
1.35 jmmv 9193: <li>
9194: <p><code class="varname">MAKE_DIRS_PERMS</code>
9195: and <code class="varname">OWN_DIRS_PERMS</code>
9196: contain a list of tuples describing which
9197: directories should be created and should attempt
9198: to be destroyed by the installation scripts. Each
9199: tuple holds the following values, separated by
9200: spaces: the directory name, its owner, its group
9201: and its numerical mode. For example:</p>
9202: <pre class="programlisting">
1.51 rillig 9203: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9204: </pre>
1.1 grant 9205:
1.35 jmmv 9206: <p>The difference between the two is exactly the
9207: same as their non-<code class=
9208: "varname">PERMS</code> counterparts.</p>
9209: </li>
9210: </ul>
9211: </div>
9212: </div>
9213:
1.55 rillig 9214: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9215: <div class="titlepage">
9216: <div>
9217: <div>
1.55 rillig 9218: <h3 class="title"><a name="files-outside-prefix"
9219: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9220: manipulation</h3>
9221: </div>
9222: </div>
9223: </div>
9224:
9225: <p>Creating non-empty files outside the installation
1.45 wiz 9226: prefix is tricky because the <code xmlns=
9227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9228: "filename">PLIST</code> forces all files to be inside
9229: it. To overcome this problem, the only solution is to
9230: extract the file in the known place (i.e., inside the
9231: installation prefix) and copy it to the appropriate
9232: location during installation (done by the installation
9233: scripts generated by pkginstall). We will call the
9234: former the <span class="emphasis"><em>master
9235: file</em></span> in the following paragraphs, which
9236: describe the variables that can be used to
9237: automatically and consistently handle files outside the
9238: installation prefix:</p>
9239:
9240: <div class="itemizedlist">
9241: <ul type="disc">
9242: <li>
9243: <p><code class="varname">CONF_FILES</code> and
9244: <code class="varname">SUPPORT_FILES</code> are
9245: pairs of master and target files. During
9246: installation time, the master file is copied to
9247: the target one if and only if the latter does not
9248: exist. Upon deinstallation, the target file is
9249: removed provided that it was not modified by the
9250: installation.</p>
9251:
9252: <p>The difference between the two is that the
9253: latter prompts the administrator to remove any
9254: files that may be left after deinstallation
9255: (because they were not empty), while the former
9256: does not.</p>
9257: </li>
9258:
9259: <li>
9260: <p><code class="varname">CONF_FILES_PERMS</code>
9261: and <code class=
9262: "varname">SUPPORT_FILES_PERMS</code> contain
9263: tuples describing master files as well as their
9264: target locations. For each of them, it also
9265: specifies their owner, their group and their
9266: numeric permissions, in this order. For
9267: example:</p>
9268: <pre class="programlisting">
1.51 rillig 9269: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9270: </pre>
9271:
9272: <p>The difference between the two is exactly the
9273: same as their non-<code class=
9274: "varname">PERMS</code> counterparts.</p>
9275: </li>
9276: </ul>
9277: </div>
9278: </div>
9279: </div>
9280:
1.55 rillig 9281: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9282: <div class="titlepage">
9283: <div>
9284: <div>
9285: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9286: "conf-files" id="conf-files"></a>12.2.
9287: Configuration files</h2>
1.35 jmmv 9288: </div>
9289: </div>
9290: </div>
9291:
9292: <p>Configuration files are special in the sense that they
9293: are installed in their own specific directory,
9294: <code class="varname">PKG_SYSCONFDIR</code>, and need
9295: special treatment during installation (most of which is
9296: automated by pkginstall). The main concept you must bear
1.36 wiz 9297: in mind is that files marked as configuration files are
1.35 jmmv 9298: automatically copied to the right place (somewhere inside
9299: <code class="varname">PKG_SYSCONFDIR</code>) during
9300: installation <span class="emphasis"><em>if and only
9301: if</em></span> they didn't exist before. Similarly, they
9302: will not be removed if they have local modifications.
1.36 wiz 9303: This ensures that administrators never lose any custom
1.35 jmmv 9304: changes they may have made.</p>
9305:
1.55 rillig 9306: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9307: <div class="titlepage">
9308: <div>
9309: <div>
1.55 rillig 9310: <h3 class="title"><a name="conf-files-sysconfdir"
9311: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9312: <code class="varname">PKG_SYSCONFDIR</code> is
9313: set</h3>
9314: </div>
9315: </div>
9316: </div>
9317:
9318: <p>As said before, the <code class=
9319: "varname">PKG_SYSCONFDIR</code> variable specifies
9320: where configuration files shall be installed. Its
9321: contents are set based upon the following
9322: variables:</p>
9323:
9324: <div class="itemizedlist">
9325: <ul type="disc">
9326: <li>
9327: <p><code class="varname">PKG_SYSCONFBASE</code>:
9328: The configuration's root directory. Defaults to
1.45 wiz 9329: <code xmlns=
9330: "http://www.w3.org/TR/xhtml1/transitional" class=
9331: "filename">${PREFIX}/etc</code> although it may
9332: be overridden by the user to point to his
9333: preferred location (e.g., <code xmlns=
9334: "http://www.w3.org/TR/xhtml1/transitional" class=
9335: "filename">/etc</code>, <code xmlns=
9336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9337: "filename">/etc/pkg</code>, etc.). Packages must
9338: not use it directly.</p>
9339: </li>
9340:
9341: <li>
9342: <p><code class=
9343: "varname">PKG_SYSCONFSUBDIR</code>: A
9344: subdirectory of <code class=
9345: "varname">PKG_SYSCONFBASE</code> under which the
9346: configuration files for the package being built
9347: shall be installed. The definition of this
9348: variable only makes sense in the package's
1.45 wiz 9349: <code xmlns=
9350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9351: "filename">Makefile</code> (i.e., it is not
9352: user-customizable).</p>
1.35 jmmv 9353:
9354: <p>As an example, consider the Apache package,
9355: <a xmlns=
9356: "http://www.w3.org/TR/xhtml1/transitional" href=
9357: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9358: target="_top"><code xmlns="" class=
9359: "filename">www/apache2</code></a>, which places
9360: its configuration files under the <code xmlns=
9361: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9362: "filename">httpd/</code> subdirectory of
9363: <code class="varname">PKG_SYSCONFBASE</code>.
9364: This should be set in the package Makefile.</p>
9365: </li>
9366:
9367: <li>
9368: <p><code class="varname">PKG_SYSCONFVAR</code>:
9369: Specifies the name of the variable that holds
9370: this package's configuration directory (if
9371: different from <code class=
9372: "varname">PKG_SYSCONFBASE</code>). It defaults to
9373: <code class="varname">PKGBASE</code>'s value, and
9374: is always prefixed with <code class=
9375: "literal">PKG_SYSCONFDIR</code>.</p>
9376: </li>
9377:
9378: <li>
9379: <p><code class=
9380: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9381: Holds the directory where the configuration files
9382: for the package identified by <code class=
9383: "varname">PKG_SYSCONFVAR</code>'s shall be
9384: placed.</p>
9385: </li>
9386: </ul>
9387: </div>
9388:
9389: <p>Based on the above variables, pkginstall determines
9390: the value of <code class=
9391: "varname">PKG_SYSCONFDIR</code>, which is the
9392: <span class="emphasis"><em>only</em></span> variable
9393: that can be used within a package to refer to its
9394: configuration directory. The algorithm used to set its
9395: value is basically the following:</p>
9396:
9397: <div class="orderedlist">
9398: <ol type="1">
9399: <li>
9400: <p>If <code class=
9401: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9402: is set, its value is used.</p>
9403: </li>
9404:
9405: <li>
9406: <p>If the previous variable is not defined but
9407: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9408: set in the package's <code xmlns=
9409: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9410: "filename">Makefile</code>, the resulting value
1.45 wiz 9411: is <code xmlns=
9412: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9413: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9414: </li>
9415:
9416: <li>
1.45 wiz 9417: <p>Otherwise, it is set to <code xmlns=
9418: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9419: "filename">${PKG_SYSCONFBASE}</code>.</p>
9420: </li>
9421: </ol>
9422: </div>
9423:
1.45 wiz 9424: <p>It is worth mentioning that <code xmlns=
9425: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9426: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9427: added to <code xmlns=
9428: "http://www.w3.org/TR/xhtml1/transitional" class=
9429: "filename">OWN_DIRS</code>. See <a href=
9430: "#dirs-outside-prefix" title=
1.55 rillig 9431: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9432: “Directory manipulation”</a> what this
9433: means.</p>
9434: </div>
9435:
1.55 rillig 9436: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9437: <div class="titlepage">
9438: <div>
9439: <div>
1.55 rillig 9440: <h3 class="title"><a name="conf-files-configure"
9441: id="conf-files-configure"></a>12.2.2. Telling the
9442: software where configuration files are</h3>
1.35 jmmv 9443: </div>
9444: </div>
9445: </div>
9446:
9447: <p>Given that pkgsrc (and users!) expect configuration
9448: files to be in a known place, you need to teach each
1.36 wiz 9449: package where it shall install its files. In some cases
1.35 jmmv 9450: you will have to patch the package Makefiles to achieve
9451: it. If you are lucky, though, it may be as easy as
9452: passing an extra flag to the configuration script; this
1.47 reed 9453: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9454: <pre class="programlisting">
1.51 rillig 9455: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9456: </pre>
9457:
9458: <p>Note that this specifies where the package has to
9459: <span class="emphasis"><em>look for</em></span> its
9460: configuration files, not where they will be originally
9461: installed (although the difference is never explicit,
9462: unfortunately).</p>
9463: </div>
9464:
1.55 rillig 9465: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9466: <div class="titlepage">
9467: <div>
9468: <div>
1.55 rillig 9469: <h3 class="title"><a name="conf-files-patching"
9470: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9471: installations</h3>
9472: </div>
9473: </div>
9474: </div>
9475:
9476: <p>As said before, pkginstall automatically handles
9477: configuration files. This means that <span class=
9478: "strong"><strong>the packages themselves must not touch
1.45 wiz 9479: the contents of <code xmlns=
9480: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9481: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9482: directly</strong></span>. Bad news is that many
9483: software installation scripts will, out of the box,
9484: mess with the contents of that directory. So what is
9485: the correct procedure to fix this issue?</p>
1.35 jmmv 9486:
9487: <p>You must teach the package (usually by manually
9488: patching it) to install any configuration files under
1.45 wiz 9489: the examples hierarchy, <code xmlns=
9490: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9491: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9492: the <code xmlns=
9493: "http://www.w3.org/TR/xhtml1/transitional" class=
9494: "filename">PLIST</code> registers them and the
9495: administrator always has the original copies
1.35 jmmv 9496: available.</p>
9497:
9498: <p>Once the required configuration files are in place
9499: (i.e., under the examples hierarchy), the pkginstall
9500: framework can use them as master copies during the
1.45 wiz 9501: package installation to update what is in <code xmlns=
9502: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9503: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9504: the variables <code class="varname">CONF_FILES</code>
9505: and <code class="varname">CONF_FILES_PERMS</code> are
9506: used. Check out <a href="#files-outside-prefix" title=
1.55 rillig 9507: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9508: “File manipulation”</a> for information
9509: about their syntax and their purpose. Here is an
9510: example, taken from the <a xmlns=
9511: "http://www.w3.org/TR/xhtml1/transitional" href=
9512: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9513: target="_top"><code xmlns="" class=
9514: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9515: <pre class="programlisting">
1.51 rillig 9516: EGDIR= ${PREFIX}/share/doc/mutt/samples
9517: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9518: </pre>
9519:
9520: <p>Note that the <code class="varname">EGDIR</code>
9521: variable is specific to that package and has no meaning
9522: outside it.</p>
9523: </div>
9524:
1.55 rillig 9525: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9526: <div class="titlepage">
9527: <div>
9528: <div>
1.55 rillig 9529: <h3 class="title"><a name="conf-files-disable"
9530: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9531: handling of configuration files</h3>
9532: </div>
9533: </div>
9534: </div>
9535:
9536: <p>The automatic copying of config files can be toggled
9537: by setting the environment variable <code class=
9538: "varname">PKG_CONFIG</code> prior to package
9539: installation.</p>
9540: </div>
9541: </div>
9542:
1.55 rillig 9543: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9544: <div class="titlepage">
9545: <div>
9546: <div>
9547: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9548: "rcd-scripts" id="rcd-scripts"></a>12.3. System
9549: startup scripts</h2>
1.35 jmmv 9550: </div>
9551: </div>
9552: </div>
9553:
9554: <p>System startup scripts are special files because they
9555: must be installed in a place known by the underlying OS,
9556: usually outside the installation prefix. Therefore, the
9557: same rules described in <a href=
9558: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9559: "12.1. Files and directories outside the installation prefix">
1.55 rillig 9560: Section 12.1, “Files and directories outside the
9561: installation prefix”</a> apply, and the same
1.35 jmmv 9562: solutions can be used. However, pkginstall provides a
1.36 wiz 9563: special mechanism to handle these files.</p>
1.35 jmmv 9564:
9565: <p>In order to provide system startup scripts, the
9566: package has to:</p>
9567:
9568: <div class="orderedlist">
9569: <ol type="1">
9570: <li>
1.45 wiz 9571: <p>Store the script inside <code xmlns=
9572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9573: "filename">${FILESDIR}</code>, with the
9574: <code class="literal">.sh</code> suffix appended.
9575: Considering the <a xmlns=
9576: "http://www.w3.org/TR/xhtml1/transitional" href=
9577: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9578: target="_top"><code xmlns="" class=
9579: "filename">print/cups</code></a> package as an
9580: example, it has a <code xmlns=
9581: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9582: "filename">cupsd.sh</code> in its files
9583: directory.</p>
9584: </li>
9585:
9586: <li>
9587: <p>Tell pkginstall to handle it, appending the name
9588: of the script, without its extension, to the
9589: <code class="varname">RCD_SCRIPTS</code> variable.
9590: Continuing the previous example:</p>
9591: <pre class="programlisting">
1.51 rillig 9592: RCD_SCRIPTS+= cupsd
1.35 jmmv 9593: </pre>
9594: </li>
9595: </ol>
9596: </div>
9597:
9598: <p>Once this is done, pkginstall will do the following
9599: steps for each script in an automated fashion:</p>
9600:
9601: <div class="orderedlist">
9602: <ol type="1">
9603: <li>
9604: <p>Process the file found in the files directory
9605: applying all the substitutions described in the
1.45 wiz 9606: <code xmlns=
9607: "http://www.w3.org/TR/xhtml1/transitional" class=
9608: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9609: </li>
9610:
9611: <li>
9612: <p>Copy the script from the files directory to the
1.45 wiz 9613: examples hierarchy, <code xmlns=
9614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9615: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9616: Note that this master file must be explicitly
1.45 wiz 9617: registered in the <code xmlns=
9618: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9619: "filename">PLIST</code>.</p>
9620: </li>
9621:
9622: <li>
9623: <p>Add code to the installation scripts to copy the
9624: startup script from the examples hierarchy into the
9625: system-wide startup scripts directory.</p>
9626: </li>
9627: </ol>
9628: </div>
9629:
1.55 rillig 9630: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9631: <div class="titlepage">
9632: <div>
9633: <div>
1.55 rillig 9634: <h3 class="title"><a name="rcd-scripts-disable"
9635: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9636: handling of system startup scripts</h3>
9637: </div>
9638: </div>
9639: </div>
9640:
9641: <p>The automatic copying of config files can be toggled
9642: by setting the environment variable <code class=
9643: "varname">PKG_RCD_SCRIPTS</code> prior to package
9644: installation. Note that the scripts will be always
1.45 wiz 9645: copied inside the examples hierarchy, <code xmlns=
9646: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9647: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9648: matter what the value of this variable is.</p>
9649: </div>
9650: </div>
9651:
1.55 rillig 9652: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9653: <div class="titlepage">
9654: <div>
9655: <div>
9656: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9657: "users-and-groups" id="users-and-groups"></a>12.4.
9658: System users and groups</h2>
1.35 jmmv 9659: </div>
9660: </div>
9661: </div>
9662:
9663: <p>If a package needs to create special users and/or
9664: groups during installation, it can do so by using the
9665: pkginstall framework.</p>
9666:
9667: <p>Users can be created by adding entries to the
9668: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9669: entry has the following syntax, which mimics <code xmlns=
9670: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9671: "filename">/etc/passwd</code>:</p>
9672: <pre class="programlisting">
1.51 rillig 9673: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9674: </pre>
9675:
9676: <p>Only the user and group are required; everything else
9677: is optional, but the colons must be in the right places
9678: when specifying optional bits. By default, a new user
1.45 wiz 9679: will have home directory <code xmlns=
9680: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9681: "filename">/nonexistent</code>, and login shell
1.45 wiz 9682: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9683: class="filename">/sbin/nologin</code> unless they are
9684: specified as part of the user element. Note that if the
1.51 rillig 9685: description contains spaces, then spaces should be
1.45 wiz 9686: backslash-escaped, as in:</p>
1.35 jmmv 9687: <pre class="programlisting">
1.51 rillig 9688: foo:foogrp::The\ Foomister
1.35 jmmv 9689: </pre>
9690:
9691: <p>Similarly, groups can be created using the
9692: <code class="varname">PKG_GROUPS</code> variable, whose
9693: syntax is:</p>
9694: <pre class="programlisting">
1.51 rillig 9695: group[:groupid]
1.35 jmmv 9696: </pre>
9697:
9698: <p>As before, only the group name is required; the
9699: numeric identifier is optional.</p>
9700: </div>
9701:
1.55 rillig 9702: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9703: <div class="titlepage">
9704: <div>
9705: <div>
9706: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9707: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9708: </div>
9709: </div>
9710: </div>
9711:
9712: <p>Packages that install system shells should register
1.45 wiz 9713: them in the shell database, <code xmlns=
9714: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9715: "filename">/etc/shells</code>, to make things easier to
9716: the administrator. This must be done from the
9717: installation scripts to keep binary packages working on
9718: any system. pkginstall provides an easy way to accomplish
9719: this task.</p>
9720:
9721: <p>When a package provides a shell interpreter, it has to
9722: set the <code class="varname">PKG_SHELL</code> variable
9723: to its absolute file name. This will add some hooks to
9724: the installation scripts to handle it. Consider the
9725: following example, taken from <a xmlns=
9726: "http://www.w3.org/TR/xhtml1/transitional" href=
9727: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9728: target="_top"><code xmlns="" class=
9729: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9730: <pre class="programlisting">
1.51 rillig 9731: USE_PKGINSTALL= YES
9732: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9733: </pre>
9734:
1.55 rillig 9735: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9736: <div class="titlepage">
9737: <div>
9738: <div>
1.55 rillig 9739: <h3 class="title"><a name="shells-disable" id=
9740: "shells-disable"></a>12.5.1. Disabling handling
9741: of configuration files</h3>
1.35 jmmv 9742: </div>
9743: </div>
9744: </div>
9745:
9746: <p>The automatic registration of shell interpreters can
9747: be disabled by the administrator by setting the
1.45 wiz 9748: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9749: class="filename">PKG_REGISTER_SHELLS</code> environment
9750: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9751: </div>
9752: </div>
9753: </div>
9754:
1.55 rillig 9755: <div class="chapter" lang="en" xml:lang="en">
1.35 jmmv 9756: <div class="titlepage">
9757: <div>
9758: <div>
1.55 rillig 9759: <h2 class="title"><a name="options" id=
1.38 dillo 9760: "options"></a>Chapter 13. Options
1.35 jmmv 9761: handling</h2>
9762: </div>
9763: </div>
9764: </div>
9765:
9766: <div class="toc">
9767: <p><b>Table of Contents</b></p>
9768:
9769: <dl>
9770: <dt><span class="sect1"><a href=
1.38 dillo 9771: "#global-default-options">13.1. Global default
1.35 jmmv 9772: options</a></span></dt>
9773:
9774: <dt><span class="sect1"><a href=
1.38 dillo 9775: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9776: use <code xmlns=
9777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9778: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9779:
9780: <dt><span class="sect1"><a href="#option-names">13.3.
9781: Option Names</a></span></dt>
1.35 jmmv 9782: </dl>
9783: </div>
9784:
9785: <p>Many packages have the ability to be built to support
1.45 wiz 9786: different sets of features. <code xmlns=
9787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9788: "filename">bsd.options.mk</code> is a framework in pkgsrc
9789: that provides generic handling of those options that
9790: determine different ways in which the packages can be
9791: built. It's possible for the user to specify exactly which
9792: sets of options will be built into a package or to allow a
9793: set of global default options apply.</p>
9794:
1.55 rillig 9795: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9796: <div class="titlepage">
9797: <div>
9798: <div>
9799: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9800: "global-default-options" id=
1.38 dillo 9801: "global-default-options"></a>13.1. Global
1.35 jmmv 9802: default options</h2>
9803: </div>
9804: </div>
9805: </div>
9806:
9807: <p>Global default options are listed in <code class=
9808: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9809: the options that should be built into every package if
9810: that option is supported. This variable should be set in
1.45 wiz 9811: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9812: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9813: </div>
9814:
1.55 rillig 9815: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9816: <div class="titlepage">
9817: <div>
9818: <div>
9819: <h2 class="title" style="clear: both"><a name=
1.55 rillig 9820: "converting-to-options" id=
1.38 dillo 9821: "converting-to-options"></a>13.2. Converting
1.45 wiz 9822: packages to use <code xmlns=
9823: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9824: "filename">bsd.options.mk</code></h2>
9825: </div>
9826: </div>
9827: </div>
9828:
1.45 wiz 9829: <p>The following example shows how <code xmlns=
9830: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9831: "filename">bsd.options.mk</code> should be used by the
9832: hypothetical ``wibble'' package, either in the package
1.45 wiz 9833: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9834: class="filename">Makefile</code>, or in a file, e.g.
9835: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9836: class="filename">options.mk</code>, that is included by
9837: the main package <code xmlns=
9838: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9839: "filename">Makefile</code>.</p>
9840: <pre class="programlisting">
1.51 rillig 9841: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9842: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9843: PKG_OPTIONS_OPTIONAL_GROUPS= database
9844: PKG_OPTIONS_GROUP.database= mysql pgsql
9845: PKG_SUGGESTED_OPTIONS= wibble-foo
9846: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9847: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9848:
9849: .include "../../mk/bsd.prefs.mk"
9850:
9851: # this package was previously named wibble2
9852: .if defined(PKG_OPTIONS.wibble2)
9853: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
9854: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
9855: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
9856: .endif
9857:
9858: .include "../../mk/bsd.options.mk"
9859:
9860: # Package-specific option-handling
9861:
9862: ###
9863: ### FOO support
9864: ###
9865: .if !empty(PKG_OPTIONS:Mwibble-foo)
9866: CONFIGURE_ARGS+= --enable-foo
9867: .endif
9868:
9869: ###
9870: ### LDAP support
9871: ###
9872: .if !empty(PKG_OPTIONS:Mldap)
9873: . include "../../databases/openldap/buildlink3.mk"
9874: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
9875: .endif
9876:
9877: ###
9878: ### database support
9879: ###
9880: .if !empty(PKG_OPTIONS:Mmysql)
9881: . include "../../mk/mysql.buildlink3.mk"
9882: .endif
9883: .if !empty(PKG_OPTIONS:Mpgsql)
9884: . include "../../mk/pgsql.buildlink3.mk"
9885: .endif
1.1 grant 9886: </pre>
9887:
1.28 rillig 9888: <p>The first section contains the information about which
9889: build options are supported by the package, and any
1.1 grant 9890: default options settings if needed.</p>
9891:
9892: <div class="orderedlist">
9893: <ol type="1">
9894: <li>
1.14 xtraeme 9895: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9896: the name of the <a href=
1.1 grant 9897: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9898: <span class="citerefentry"><span class=
1.27 rillig 9899: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9900: that the user can set to override the default
9901: options. It should be set to “<span class=
9902: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9903: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9904: </li>
9905:
9906: <li>
1.14 xtraeme 9907: <p><code class=
9908: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9909: build options supported by the package.</p>
9910: </li>
9911:
9912: <li>
9913: <p><code class=
9914: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9915: list of names of groups of mutually exclusive
9916: options. The options in each group are listed in
9917: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9918: "replaceable"><code>groupname</code></em></code>.
9919: The most specific setting of any option from the
9920: group takes precedence over all other options in
9921: the group. Options from the groups will be
9922: automatically added to <code class=
9923: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9924: </li>
9925:
9926: <li>
9927: <p><code class=
9928: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9929: like <code class=
9930: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9931: building the packages will fail if no option from
9932: the group is selected.</p>
1.1 grant 9933: </li>
9934:
9935: <li>
1.27 rillig 9936: <p><code class=
1.44 gdt 9937: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9938: list of names of sets of options. At least one
9939: option from each set must be selected. The options
9940: in each set are listed in <code class=
9941: "varname">PKG_OPTIONS_SET.<em class=
9942: "replaceable"><code>setname</code></em></code>.
9943: Options from the sets will be automatically added
9944: to <code class=
9945: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9946: the package will fail if no option from the set is
9947: selected.</p>
9948: </li>
9949:
9950: <li>
9951: <p><code class=
1.27 rillig 9952: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9953: build options which are enabled by default.</p>
9954: </li>
9955:
9956: <li>
1.37 dillo 9957: <p><code class=
9958: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9959: of “<span class="quote"><em class=
1.55 rillig 9960: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
9961: <code>option</code></em></span>” pairs that
9962: map legacy <code xmlns=
1.45 wiz 9963: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9964: "filename">/etc/mk.conf</code> variables to their
9965: option counterparts. Pairs should be added with
9966: “<span class="quote">+=</span>” to keep
9967: the listing of global legacy variables. A warning
9968: will be issued if the user uses a legacy
9969: variable.</p>
9970: </li>
1.1 grant 9971:
1.37 dillo 9972: <li>
9973: <p><code class=
9974: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9975: of “<span class="quote"><em class=
1.55 rillig 9976: "replaceable"><code>old-option</code></em>:<em class="replaceable">
9977: <code>new-option</code></em></span>” pairs
9978: that map options that have been renamed to their
9979: new counterparts. Pairs should be added with
1.37 dillo 9980: “<span class="quote">+=</span>” to keep
9981: the listing of global legacy options. A warning
9982: will be issued if the user uses a legacy
9983: option.</p>
9984: </li>
1.1 grant 9985:
1.37 dillo 9986: <li>
9987: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9988: is a list of options implied by deprecated
9989: variables used. This can be used for cases that
9990: neither <code class=
9991: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9992: <code class=
9993: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9994: handle, e. g. when <code class=
9995: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9996: </li>
9997:
9998: <li>
1.37 dillo 9999: <p><code class=
10000: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10001: a list of warnings about deprecated variables or
10002: options used, and what to use instead.</p>
1.1 grant 10003: </li>
1.28 rillig 10004: </ol>
1.1 grant 10005: </div>
10006:
1.37 dillo 10007: <p>A package should never modify <code class=
10008: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10009: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10010: These are strictly user-settable. To suggest a default
10011: set of options, use <code class=
10012: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10013:
1.42 dillo 10014: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10015: defined before including <code xmlns=
10016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10017: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10018: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10019: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10020: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10021: are defined (as can happen with platform-specific options
1.42 dillo 10022: if none of them is supported on the current platform),
10023: <code class="varname">PKG_OPTIONS</code> is set to the
10024: empty list and the package is otherwise treated as not
10025: using the options framework.</p>
1.37 dillo 10026:
1.45 wiz 10027: <p>After the inclusion of <code xmlns=
10028: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10029: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10030: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10031: list of selected build options, properly filtered to
1.28 rillig 10032: remove unsupported and duplicate options.</p>
10033:
1.1 grant 10034: <p>The remaining sections contain the logic that is
1.37 dillo 10035: specific to each option. The correct way to check for an
10036: option is to check whether it is listed in <code class=
10037: "varname">PKG_OPTIONS</code>:</p>
10038: <pre class="programlisting">
1.51 rillig 10039: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10040: "replaceable"><code>option</code></em>)
10041: </pre>
1.48 dillo 10042: </div>
1.37 dillo 10043:
1.55 rillig 10044: <div class="sect1" lang="en" xml:lang="en">
1.48 dillo 10045: <div class="titlepage">
10046: <div>
10047: <div>
10048: <h2 class="title" style="clear: both"><a name=
1.55 rillig 10049: "option-names" id=
1.48 dillo 10050: "option-names"></a>13.3. Option Names</h2>
10051: </div>
10052: </div>
10053: </div>
10054:
10055: <p>Options that enable similar features in different
10056: packages (like optional support for a library) should use
10057: a common name in all packages that support it (like the
10058: name of the library). If another package already has an
10059: option with the same meaning, use the same name.</p>
10060:
10061: <p>Options that enable features specific to one package,
10062: where it's unlikely that another (unrelated) package has
10063: the same (or a similar) optional feature, should use a
10064: name prefixed with <code class="varname"><em class=
10065: "replaceable"><code>pkgname</code></em>-</code>.</p>
10066:
10067: <p>If a group of related packages share an optional
10068: feature specific to that group, prefix it with the name
10069: of the “<span class="quote">main</span>”
10070: package (e. g. <code class=
10071: "varname">djbware-errno-hack</code>).</p>
10072:
10073: <p>For new options, add a line to <code xmlns=
10074: "http://www.w3.org/TR/xhtml1/transitional" class=
10075: "filename">mk/defaults/options.description</code>. Lines
10076: have two fields, separated by tab. The first field is the
10077: option name, the second its description. The description
10078: should be a whole sentence (starting with an uppercase
10079: letter and ending with a period) that describes what
10080: enabling the option does. E. g. “<span class=
10081: "quote">Enable ispell support.</span>” The file is
10082: sorted by option names.</p>
1.1 grant 10083: </div>
10084: </div>
10085:
1.55 rillig 10086: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 10087: <div class="titlepage">
10088: <div>
10089: <div>
1.55 rillig 10090: <h2 class="title"><a name="build" id=
1.38 dillo 10091: "build"></a>Chapter 14. The build
1.1 grant 10092: process</h2>
10093: </div>
10094: </div>
10095: </div>
10096:
10097: <div class="toc">
10098: <p><b>Table of Contents</b></p>
10099:
10100: <dl>
1.56 ! rillig 10101: <dt><span class="sect1"><a href="#build.intro">14.1.
! 10102: Introduction</a></span></dt>
! 10103:
! 10104: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10105: Program location</a></span></dt>
10106:
1.56 ! rillig 10107: <dt><span class="sect1"><a href=
! 10108: "#build.builddirs">14.3. Directories used during the
! 10109: build process</a></span></dt>
! 10110:
! 10111: <dt><span class="sect1"><a href="#build.running">14.4.
! 10112: Running a phase</a></span></dt>
! 10113:
! 10114: <dt><span class="sect1"><a href="#build.fetch">14.5.
! 10115: The <span class="emphasis"><em>fetch</em></span>
! 10116: phase</a></span></dt>
! 10117:
! 10118: <dt><span class="sect1"><a href="#build.checksum">14.6.
! 10119: The <span class="emphasis"><em>checksum</em></span>
! 10120: phase</a></span></dt>
! 10121:
! 10122: <dt><span class="sect1"><a href="#build.extract">14.7.
! 10123: The <span class="emphasis"><em>extract</em></span>
! 10124: phase</a></span></dt>
! 10125:
! 10126: <dt><span class="sect1"><a href="#build.patch">14.8.
! 10127: The <span class="emphasis"><em>patch</em></span>
! 10128: phase</a></span></dt>
! 10129:
! 10130: <dt><span class="sect1"><a href="#build.tools">14.9.
! 10131: The <span class="emphasis"><em>tools</em></span>
! 10132: phase</a></span></dt>
! 10133:
! 10134: <dt><span class="sect1"><a href="#build.wrapper">14.10.
! 10135: The <span class="emphasis"><em>wrapper</em></span>
! 10136: phase</a></span></dt>
1.1 grant 10137:
10138: <dt><span class="sect1"><a href=
1.56 ! rillig 10139: "#build.configure">14.11. The <span class=
! 10140: "emphasis"><em>configure</em></span>
! 10141: phase</a></span></dt>
! 10142:
! 10143: <dt><span class="sect1"><a href="#build.build">14.12.
! 10144: The <span class="emphasis"><em>build</em></span>
! 10145: phase</a></span></dt>
! 10146:
! 10147: <dt><span class="sect1"><a href="#build.test">14.13.
! 10148: The <span class="emphasis"><em>test</em></span>
! 10149: phase</a></span></dt>
! 10150:
! 10151: <dt><span class="sect1"><a href="#build.install">14.14.
! 10152: The <span class="emphasis"><em>install</em></span>
! 10153: phase</a></span></dt>
! 10154:
! 10155: <dt><span class="sect1"><a href="#build.package">14.15.
! 10156: The <span class="emphasis"><em>package</em></span>
! 10157: phase</a></span></dt>
! 10158:
! 10159: <dt><span class="sect1"><a href=
! 10160: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10161: targets</a></span></dt>
10162: </dl>
10163: </div>
10164:
1.56 ! rillig 10165: <div class="sect1" lang="en" xml:lang="en">
! 10166: <div class="titlepage">
! 10167: <div>
! 10168: <div>
! 10169: <h2 class="title" style="clear: both"><a name=
! 10170: "build.intro" id=
! 10171: "build.intro"></a>14.1. Introduction</h2>
! 10172: </div>
! 10173: </div>
! 10174: </div>
! 10175:
! 10176: <p>This chapter gives a detailed description on how a
! 10177: package is built. Building a package is separated into
! 10178: different <span class="emphasis"><em>phases</em></span>
! 10179: (for example <code class="varname">fetch</code>,
! 10180: <code class="varname">build</code>, <code class=
! 10181: "varname">install</code>), all of which are described in
! 10182: the following sections. Each phase is splitted into
! 10183: so-called <span class="emphasis"><em>stages</em></span>,
! 10184: which take the name of the containing stage, prefixed by
! 10185: one of <code class="varname">pre-</code>, <code class=
! 10186: "varname">do-</code> or <code class=
! 10187: "varname">post-</code>. (Examples are <code class=
! 10188: "varname">pre-configure</code>, <code class=
! 10189: "varname">post-build</code>.) Most of the actual work is
! 10190: done in the <code class="varname">do-*</code> stages.</p>
! 10191:
! 10192: <p>The basic steps for building a program are always the
! 10193: same. First the program's source (<span class=
! 10194: "emphasis"><em>distfile</em></span>) must be brought to
! 10195: the local system and then extracted. After any patches to
! 10196: compile properly on NetBSD are applied, the software can
! 10197: be configured, then built (usually by compiling), and
! 10198: finally the generated binaries, etc. can be put into
! 10199: place on the system. These are exactly the steps
! 10200: performed by the NetBSD package system, which is
! 10201: implemented as a series of targets in a central Makefile,
! 10202: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 10203: class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
! 10204: </div>
1.1 grant 10205:
1.55 rillig 10206: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10207: <div class="titlepage">
10208: <div>
10209: <div>
10210: <h2 class="title" style="clear: both"><a name=
1.55 rillig 10211: "build.prefix" id=
1.56 ! rillig 10212: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10213: </div>
10214: </div>
10215: </div>
10216:
10217: <p>Before outlining the process performed by the NetBSD
10218: package system in the next section, here's a brief
10219: discussion on where programs are installed, and which
10220: variables influence this.</p>
10221:
1.14 xtraeme 10222: <p>The automatic variable <code class=
10223: "varname">PREFIX</code> indicates where all files of the
10224: final program shall be installed. It is usually set to
1.45 wiz 10225: <code class="varname">LOCALBASE</code> (<code xmlns=
10226: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10227: "filename">/usr/pkg</code>), or <code class=
10228: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10229: “<span class="quote">cross</span>” category.
1.14 xtraeme 10230: The value of <code class="varname">PREFIX</code> needs to
10231: be put into the various places in the program's source
10232: where paths to these files are encoded. See <a href=
1.1 grant 10233: "#components.patches" title=
1.38 dillo 10234: "8.3. patches/*">Section 8.3,
1.1 grant 10235: “patches/*”</a> and <a href="#fixes.libtool"
10236: title=
1.38 dillo 10237: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 10238: “Shared libraries - libtool”</a> for more
10239: details.</p>
10240:
10241: <p>When choosing which of these variables to use, follow
10242: the following rules:</p>
10243:
10244: <div class="itemizedlist">
10245: <ul type="disc">
10246: <li>
1.14 xtraeme 10247: <p><code class="varname">PREFIX</code> always
10248: points to the location where the current pkg will
10249: be installed. When referring to a pkg's own
1.1 grant 10250: installation path, use “<span class=
10251: "quote">${PREFIX}</span>”.</p>
10252: </li>
10253:
10254: <li>
1.14 xtraeme 10255: <p><code class="varname">LOCALBASE</code> is where
10256: all non-X11 pkgs are installed. If you need to
1.1 grant 10257: construct a -I or -L argument to the compiler to
10258: find includes and libraries installed by another
10259: non-X11 pkg, use “<span class=
10260: "quote">${LOCALBASE}</span>”.</p>
10261: </li>
10262:
10263: <li>
1.14 xtraeme 10264: <p><code class="varname">X11BASE</code> is where
10265: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10266: installed. When looking for <span class=
10267: "emphasis"><em>standard</em></span> X11 includes
10268: (not those installed by a pkg), use
10269: “<span class=
10270: "quote">${X11BASE}</span>”.</p>
10271: </li>
10272:
10273: <li>
1.47 reed 10274: <p>X11-based packages are special in that they may
10275: be installed in either <code class=
1.14 xtraeme 10276: "varname">X11BASE</code> or <code class=
10277: "varname">LOCALBASE</code>.</p>
1.1 grant 10278:
10279: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10280: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10281: possible. Note that you will need to include
1.45 wiz 10282: <code xmlns=
10283: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10284: "filename">../../mk/x11.buildlink3.mk</code> in
10285: them to request the presence of X11 and to get the
10286: right compilation flags.</p>
1.1 grant 10287:
10288: <p>Even though, there are some packages that cannot
1.14 xtraeme 10289: be installed under <code class=
10290: "varname">LOCALBASE</code>: those that come with
1.1 grant 10291: app-defaults files. These packages are special and
1.14 xtraeme 10292: they must be placed under <code class=
10293: "varname">X11BASE</code>. To accomplish this, set
10294: either <code class="varname">USE_X11BASE</code> or
10295: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10296: package.</p>
10297:
1.34 wiz 10298: <p>Some notes: If you need to find includes or
1.14 xtraeme 10299: libraries installed by a pkg that has <code class=
10300: "varname">USE_IMAKE</code> or <code class=
10301: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10302: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10303: class="filename">Makefile</code>, you need to look
10304: in <span class="emphasis"><em>both</em></span>
10305: <code xmlns=
10306: "http://www.w3.org/TR/xhtml1/transitional" class=
10307: "filename">${X11BASE}</code> and <code xmlns=
10308: "http://www.w3.org/TR/xhtml1/transitional" class=
10309: "filename">${LOCALBASE}</code>. To force
10310: installation of all X11 packages in <code class=
10311: "varname">LOCALBASE</code>, the <a xmlns=
10312: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10313: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10314: target="_top"><code xmlns="" class=
10315: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10316: enabled by default.</p>
1.1 grant 10317: </li>
10318:
10319: <li>
1.14 xtraeme 10320: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10321: used to refer to the installed location of an X11
1.14 xtraeme 10322: package. <code class="varname">X11PREFIX</code>
10323: will be set to <code class="varname">X11BASE</code>
10324: if xpkgwedge is not installed, and to <code class=
10325: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10326: installed.</p>
10327: </li>
10328:
10329: <li>
10330: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10331: have some packages installed in <code class=
10332: "varname">X11BASE</code> and some in <code class=
10333: "varname">LOCALBASE</code>. To determine the prefix
10334: of an installed package, the <code class=
10335: "varname">EVAL_PREFIX</code> definition can be
10336: used. It takes pairs in the format
10337: “<span class=
1.1 grant 10338: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10339: the <a href=
10340: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10341: <span class="citerefentry"><span class=
10342: "refentrytitle">make</span>(1)</span></a> variable
10343: <code class="varname">DIRNAME</code> will be set to
10344: the prefix of the installed package
10345: <package>, or “<span class=
1.1 grant 10346: "quote">${X11PREFIX}</span>” if the package
10347: is not installed.</p>
10348:
10349: <p>This is best illustrated by example.</p>
10350:
1.45 wiz 10351: <p>The following lines are taken from <code xmlns=
10352: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10353: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10354: <pre class="programlisting">
1.51 rillig 10355: EVAL_PREFIX+= GTKDIR=gtk+
10356: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10357: --with-gtk-prefix="${GTKDIR}" \
10358: --enable-multibyte
1.1 grant 10359: </pre>
10360:
10361: <p>Specific defaults can be defined for the
1.14 xtraeme 10362: packages evaluated using <code class=
10363: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10364: of the form:</p>
10365: <pre class="programlisting">
1.51 rillig 10366: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10367: </pre>
10368:
1.14 xtraeme 10369: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10370: corresponds to the first definition in the
1.14 xtraeme 10371: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10372: </li>
10373:
10374: <li>
1.45 wiz 10375: <p>Within <code xmlns=
10376: "http://www.w3.org/TR/xhtml1/transitional" class=
10377: "filename">${PREFIX}</code>, packages should
10378: install files according to <a href=
1.24 wiz 10379: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10380: <span class="citerefentry"><span class=
10381: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10382: exception that manual pages go into <code xmlns=
10383: "http://www.w3.org/TR/xhtml1/transitional" class=
10384: "filename">${PREFIX}/man</code>, not <code xmlns=
10385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10386: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10387: </li>
10388: </ul>
10389: </div>
10390: </div>
10391:
1.55 rillig 10392: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10393: <div class="titlepage">
10394: <div>
10395: <div>
10396: <h2 class="title" style="clear: both"><a name=
1.56 ! rillig 10397: "build.builddirs" id=
! 10398: "build.builddirs"></a>14.3. Directories used
! 10399: during the build process</h2>
1.1 grant 10400: </div>
10401: </div>
10402: </div>
10403:
1.56 ! rillig 10404: <p>When building a package, a number of directories is
! 10405: used to store source files, temporary files,
! 10406: pkgsrc-internal files, and so on. These directories are
! 10407: explained here.</p>
! 10408:
! 10409: <p>Some of the directory variables contain relative
! 10410: pathnames. There are two common base directories for
! 10411: these relative directories: <code class=
! 10412: "varname">PKGSRCDIR/PKGPATH</code> is used for
! 10413: directories that are pkgsrc-specific. <code class=
! 10414: "varname">WRKSRC</code> is used for directories inside
! 10415: the package itself. The permissions after each variable
! 10416: indicate whether the variable may be changed by the
! 10417: package Makefile.</p>
1.1 grant 10418:
10419: <div class="variablelist">
10420: <dl>
1.56 ! rillig 10421: <dt><span class="term"><code class=
! 10422: "varname">PKGSRCDIR</code> (read-only)</span></dt>
! 10423:
! 10424: <dd>
! 10425: <p>This is an absolute pathname that points to the
! 10426: pkgsrc root directory. Generally, you don't need
! 10427: it.</p>
! 10428: </dd>
! 10429:
! 10430: <dt><span class="term"><code class=
! 10431: "varname">PKGPATH</code> (read-only)</span></dt>
1.1 grant 10432:
10433: <dd>
1.56 ! rillig 10434: <p>This is a pathname relative to <code class=
! 10435: "varname">PKGSRCDIR</code> that points to the
! 10436: current package.</p>
! 10437: </dd>
! 10438:
! 10439: <dt><span class="term"><code class=
! 10440: "varname">WRKDIR</code> (read-only)</span></dt>
! 10441:
! 10442: <dd>
! 10443: <p>This is an absolute pathname pointing to the
! 10444: directory where all work takes place. This
! 10445: directory typically contains temporary directories
! 10446: used by the various pkgsrc frameworks, like
! 10447: <span class="emphasis"><em>buildlink</em></span> or
! 10448: the <span class=
! 10449: "emphasis"><em>wrappers</em></span>.</p>
! 10450: </dd>
! 10451:
! 10452: <dt><span class="term"><code class=
! 10453: "varname">WRKSRC</code> (read-write)</span></dt>
! 10454:
! 10455: <dd>
! 10456: <p>This is an absolute pathname pointing to the
! 10457: directory where the distfiles are extracted. It is
! 10458: usually a direct subdirectory of <code class=
! 10459: "varname">WRKDIR</code>, and often it's the only
! 10460: directory entry that isn't hidden.</p>
! 10461: </dd>
! 10462: </dl>
! 10463: </div>
! 10464: </div>
! 10465:
! 10466: <div class="sect1" lang="en" xml:lang="en">
! 10467: <div class="titlepage">
! 10468: <div>
! 10469: <div>
! 10470: <h2 class="title" style="clear: both"><a name=
! 10471: "build.running" id=
! 10472: "build.running"></a>14.4. Running a phase</h2>
! 10473: </div>
! 10474: </div>
! 10475: </div>
! 10476:
! 10477: <p>You can run a particular phase by typing
! 10478: <span><strong class="command">make phase</strong></span>,
! 10479: where <span class="emphasis"><em>phase</em></span> is the
! 10480: name of the phase. This will automatically run all phases
! 10481: that are required for this phase. The default phase is
! 10482: <code class="varname">build</code>, that is, when you run
! 10483: <span><strong class="command">make</strong></span>
! 10484: without parameters in a package directory, the package
! 10485: will be built, but not installed.</p>
! 10486: </div>
! 10487:
! 10488: <div class="sect1" lang="en" xml:lang="en">
! 10489: <div class="titlepage">
! 10490: <div>
! 10491: <div>
! 10492: <h2 class="title" style="clear: both"><a name=
! 10493: "build.fetch" id="build.fetch"></a>14.5. The
! 10494: <span class="emphasis"><em>fetch</em></span>
! 10495: phase</h2>
! 10496: </div>
! 10497: </div>
! 10498: </div>
! 10499:
! 10500: <p>This will check if the file(s) given in the variables
! 10501: <code class="varname">DISTFILES</code> and <code class=
! 10502: "varname">PATCHFILES</code> (as defined in the package's
! 10503: Makefile) are present on the local system in <code xmlns=
! 10504: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10505: "filename">/usr/pkgsrc/distfiles</code>. If they are not
! 10506: present, an attempt will be made to fetch them using
! 10507: commands of the form:</p>
! 10508: <pre class="programlisting">
1.51 rillig 10509: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10510: </pre>
10511:
1.56 ! rillig 10512: <p>where ${site} varies through several possibilities in
! 10513: turn: first, <code class=
! 10514: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
! 10515: sites specified in either <code class=
! 10516: "varname">SITES_file</code> if defined, else <code class=
! 10517: "varname">MASTER_SITES</code> or <code class=
! 10518: "varname">PATCH_SITES</code>, as applies, then finally
! 10519: the value of <code class=
! 10520: "varname">MASTER_SITE_BACKUP</code>. The order of all
! 10521: except the first can be optionally sorted by the user,
! 10522: via setting either <code class=
! 10523: "varname">MASTER_SORT_AWK</code> or <code class=
! 10524: "varname">MASTER_SORT_REGEX</code>.</p>
! 10525: </div>
! 10526:
! 10527: <div class="sect1" lang="en" xml:lang="en">
! 10528: <div class="titlepage">
! 10529: <div>
! 10530: <div>
! 10531: <h2 class="title" style="clear: both"><a name=
! 10532: "build.checksum" id=
! 10533: "build.checksum"></a>14.6. The <span class=
! 10534: "emphasis"><em>checksum</em></span> phase</h2>
! 10535: </div>
! 10536: </div>
! 10537: </div>
! 10538:
! 10539: <p>After the distfile(s) are fetched, their checksum is
! 10540: generated and compared with the checksums stored in the
! 10541: distinfo file. If the checksums don't match, the build is
! 10542: aborted. This is to ensure the same distfile is used for
! 10543: building, and that the distfile wasn't changed, e.g. by
! 10544: some malign force, deliberately changed distfiles on the
! 10545: master distribution site or network lossage.</p>
! 10546: </div>
! 10547:
! 10548: <div class="sect1" lang="en" xml:lang="en">
! 10549: <div class="titlepage">
! 10550: <div>
! 10551: <div>
! 10552: <h2 class="title" style="clear: both"><a name=
! 10553: "build.extract" id=
! 10554: "build.extract"></a>14.7. The <span class=
! 10555: "emphasis"><em>extract</em></span> phase</h2>
! 10556: </div>
! 10557: </div>
! 10558: </div>
! 10559:
! 10560: <p>When the distfiles are present on the local system,
! 10561: they need to be extracted, as they are usually in the
! 10562: form of some compressed archive format, most commonly
! 10563: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 10564: class="filename">.tar.gz</code>.</p>
1.1 grant 10565:
1.56 ! rillig 10566: <p>If only some of the distfiles need to be uncompressed,
! 10567: the files to be uncompressed should be put into
! 10568: <code class="varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10569:
1.56 ! rillig 10570: <p>If the distfiles are not in <code xmlns=
! 10571: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10572: "filename">.tar.gz</code> format, they can be extracted
! 10573: by setting either <code class=
! 10574: "varname">EXTRACT_SUFX</code>, or <code class=
! 10575: "varname">EXTRACT_CMD</code>, <code class=
! 10576: "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
! 10577: "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
! 10578: pkgsrc knows how to extract a number of suffixes
! 10579: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 10580: class="filename">.tar.gz</code>, <code xmlns=
! 10581: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10582: "filename">.tgz</code>, <code xmlns=
! 10583: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10584: "filename">.tar.gz2</code>, <code xmlns=
! 10585: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10586: "filename">.tbz</code>, <code xmlns=
! 10587: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10588: "filename">.tar.Z</code>, <code xmlns=
! 10589: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10590: "filename">.tar</code>, <code xmlns=
! 10591: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10592: "filename">.shar.gz</code>, <code xmlns=
! 10593: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10594: "filename">.shar.bz2</code>, <code xmlns=
! 10595: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10596: "filename">.shar.Z</code>, <code xmlns=
! 10597: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10598: "filename">.shar</code>, <code xmlns=
! 10599: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10600: "filename">.Z</code>, <code xmlns=
! 10601: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10602: "filename">.bz2</code> and <code xmlns=
! 10603: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10604: "filename">.gz</code>; see the definition of the various
! 10605: <code class="varname">DECOMPRESS_CMD</code> variables in
! 10606: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 10607: class="filename">bsd.pkg.extract.mk</code> for a complete
! 10608: list). Here's an example on how to use the other
! 10609: variables for a program that comes with a compressed
! 10610: shell archive whose name ends in <code xmlns=
! 10611: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10612: "filename">.msg.gz</code>:</p>
! 10613: <pre class="programlisting">
1.51 rillig 10614: EXTRACT_SUFX= .msg.gz
10615: EXTRACT_CMD= zcat
10616: EXTRACT_BEFORE_ARGS=
10617: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10618: </pre>
1.56 ! rillig 10619: </div>
! 10620:
! 10621: <div class="sect1" lang="en" xml:lang="en">
! 10622: <div class="titlepage">
! 10623: <div>
! 10624: <div>
! 10625: <h2 class="title" style="clear: both"><a name=
! 10626: "build.patch" id="build.patch"></a>14.8. The
! 10627: <span class="emphasis"><em>patch</em></span>
! 10628: phase</h2>
! 10629: </div>
! 10630: </div>
! 10631: </div>
! 10632:
! 10633: <p>After extraction, all the patches named by the
! 10634: <code class="varname">PATCHFILES</code>, those present in
! 10635: the patches subdirectory of the package as well as in
! 10636: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
! 10637: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10638: "filename">/usr/local/patches/graphics/png</code>) are
! 10639: applied. Patchfiles ending in <code xmlns=
! 10640: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10641: "filename">.Z</code> or <code xmlns=
! 10642: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10643: "filename">.gz</code> are uncompressed before they are
! 10644: applied, files ending in <code xmlns=
! 10645: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10646: "filename">.orig</code> or <code xmlns=
! 10647: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10648: "filename">.rej</code> are ignored. Any special options
! 10649: to <a href=
! 10650: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
! 10651: <span class="citerefentry"><span class=
! 10652: "refentrytitle">patch</span>(1)</span></a> can be handed
! 10653: in <code class="varname">PATCH_DIST_ARGS</code>. See
! 10654: <a href="#components.patches" title=
! 10655: "8.3. patches/*">Section 8.3,
! 10656: “patches/*”</a> for more details.</p>
! 10657:
! 10658: <p>By default <a href=
! 10659: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
! 10660: <span class="citerefentry"><span class=
! 10661: "refentrytitle">patch</span>(1)</span></a> is given
! 10662: special args to make it fail if the patches apply with
! 10663: some lines of fuzz. Please fix (regen) the patches so
! 10664: that they apply cleanly. The rationale behind this is
! 10665: that patches that don't apply cleanly may end up being
! 10666: applied in the wrong place, and cause severe harm
! 10667: there.</p>
! 10668: </div>
! 10669:
! 10670: <div class="sect1" lang="en" xml:lang="en">
! 10671: <div class="titlepage">
! 10672: <div>
! 10673: <div>
! 10674: <h2 class="title" style="clear: both"><a name=
! 10675: "build.tools" id="build.tools"></a>14.9. The
! 10676: <span class="emphasis"><em>tools</em></span>
! 10677: phase</h2>
! 10678: </div>
! 10679: </div>
! 10680: </div>
! 10681:
! 10682: <p>[TODO]</p>
! 10683: </div>
! 10684:
! 10685: <div class="sect1" lang="en" xml:lang="en">
! 10686: <div class="titlepage">
! 10687: <div>
! 10688: <div>
! 10689: <h2 class="title" style="clear: both"><a name=
! 10690: "build.wrapper" id=
! 10691: "build.wrapper"></a>14.10. The <span class=
! 10692: "emphasis"><em>wrapper</em></span> phase</h2>
! 10693: </div>
! 10694: </div>
! 10695: </div>
! 10696:
! 10697: <p>[TODO]</p>
! 10698: </div>
! 10699:
! 10700: <div class="sect1" lang="en" xml:lang="en">
! 10701: <div class="titlepage">
! 10702: <div>
! 10703: <div>
! 10704: <h2 class="title" style="clear: both"><a name=
! 10705: "build.configure" id=
! 10706: "build.configure"></a>14.11. The <span class=
! 10707: "emphasis"><em>configure</em></span> phase</h2>
! 10708: </div>
! 10709: </div>
! 10710: </div>
! 10711:
! 10712: <p>Most pieces of software need information on the header
! 10713: files, system calls, and library routines which are
! 10714: available on the platform they run on. The process of
! 10715: determining this information is known as configuration,
! 10716: and is usually automated. In most cases, a script is
! 10717: supplied with the distfiles, and its invocation results
! 10718: in generation of header files, Makefiles, etc.</p>
! 10719:
! 10720: <p>If the package contains a configure script, this can
! 10721: be invoked by setting <code class=
! 10722: "varname">HAS_CONFIGURE</code> to “<span class=
! 10723: "quote">yes</span>”. If the configure script is a
! 10724: GNU autoconf script, you should set <code class=
! 10725: "varname">GNU_CONFIGURE</code> to “<span class=
! 10726: "quote">yes</span>” instead. What happens in the
! 10727: <span class="emphasis"><em>configure</em></span> phase is
! 10728: roughly:</p>
! 10729: <pre class="programlisting">
! 10730: .for d in ${CONFIGURE_DIRS}
! 10731: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
! 10732: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
! 10733: .endfor
! 10734: </pre>
1.1 grant 10735:
1.56 ! rillig 10736: <p><code class="varname">CONFIGURE_DIRS</code> (default:
! 10737: “<span class="quote">.</span>”) is a list of
! 10738: pathnames relative to <code class=
! 10739: "varname">WRKSRC</code>. In each of these directories,
! 10740: the configure script is run with the environment
! 10741: <code class="varname">CONFIGURE_ENV</code> and arguments
! 10742: <code class="varname">CONFIGURE_ARGS</code>. The
! 10743: variables <code class="varname">CONFIGURE_ENV</code>,
! 10744: <code class="varname">CONFIGURE_SCRIPT</code> (default:
! 10745: “<span class="quote">./configure</span>”) and
! 10746: <code class="varname">CONFIGURE_ARGS</code> may all be
! 10747: changed by the package.</p>
1.1 grant 10748:
1.56 ! rillig 10749: <p>If the program uses an <code xmlns=
! 10750: "http://www.w3.org/TR/xhtml1/transitional" class=
! 10751: "filename">Imakefile</code> for configuration, the
! 10752: appropriate steps can be invoked by setting <code class=
! 10753: "varname">USE_IMAKE</code> to “<span class=
! 10754: "quote">yes</span>”. (If you only want the package
! 10755: installed in <code class="varname">${X11PREFIX}</code>
! 10756: but xmkmf not being run, set <code class=
! 10757: "varname">USE_X11BASE</code> instead.)</p>
! 10758: </div>
1.1 grant 10759:
1.56 ! rillig 10760: <div class="sect1" lang="en" xml:lang="en">
! 10761: <div class="titlepage">
! 10762: <div>
! 10763: <div>
! 10764: <h2 class="title" style="clear: both"><a name=
! 10765: "build.build" id="build.build"></a>14.12. The
! 10766: <span class="emphasis"><em>build</em></span>
! 10767: phase</h2>
! 10768: </div>
! 10769: </div>
1.1 grant 10770: </div>
10771:
1.56 ! rillig 10772: <p>For building a package, a rough equivalent of the
! 10773: following code is executed.</p>
1.1 grant 10774: <pre class="programlisting">
1.56 ! rillig 10775: .for d in ${BUILD_DIRS}
! 10776: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
! 10777: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
! 10778: -f ${MAKEFILE} ${BUILD_TARGET}
! 10779: .endfor
1.1 grant 10780: </pre>
1.56 ! rillig 10781:
! 10782: <p><code class="varname">BUILD_DIRS</code> (default:
! 10783: “<span class="quote">.</span>”) is a list of
! 10784: pathnames relative to <code class=
! 10785: "varname">WRKSRC</code>. In each of these directories,
! 10786: <code class="varname">MAKE_PROGRAM</code> is run with the
! 10787: environment <code class="varname">MAKE_ENV</code> and
! 10788: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
! 10789: The variables <code class="varname">MAKE_ENV</code>,
! 10790: <code class="varname">BUILD_MAKE_FLAGS</code>,
! 10791: <code class="varname">MAKEFILE</code> and <code class=
! 10792: "varname">BUILD_TARGET</code> may all be changed by the
! 10793: package.</p>
! 10794:
! 10795: <p>The default value of <code class=
! 10796: "varname">MAKE_PROGRAM</code> is “<span class=
! 10797: "quote">gmake</span>” if <code class=
! 10798: "varname">USE_TOOLS</code> contains “<span class=
! 10799: "quote">gmake</span>”, “<span class=
! 10800: "quote">make</span>” otherwise. The default value
! 10801: of <code class="varname">MAKEFILE</code> is
! 10802: “<span class="quote">Makefile</span>”, and
! 10803: <code class="varname">BUILD_TARGET</code> defaults to
! 10804: “<span class="quote">all</span>”.</p>
! 10805: </div>
! 10806:
! 10807: <div class="sect1" lang="en" xml:lang="en">
! 10808: <div class="titlepage">
! 10809: <div>
! 10810: <div>
! 10811: <h2 class="title" style="clear: both"><a name=
! 10812: "build.test" id="build.test"></a>14.13. The
! 10813: <span class="emphasis"><em>test</em></span>
! 10814: phase</h2>
! 10815: </div>
! 10816: </div>
! 10817: </div>
! 10818:
! 10819: <p>[TODO]</p>
! 10820: </div>
! 10821:
! 10822: <div class="sect1" lang="en" xml:lang="en">
! 10823: <div class="titlepage">
! 10824: <div>
! 10825: <div>
! 10826: <h2 class="title" style="clear: both"><a name=
! 10827: "build.install" id=
! 10828: "build.install"></a>14.14. The <span class=
! 10829: "emphasis"><em>install</em></span> phase</h2>
! 10830: </div>
! 10831: </div>
! 10832: </div>
! 10833:
! 10834: <p>Once the build stage has completed, the final step is
! 10835: to install the software in public directories, so users
! 10836: can access the programs and files. As in the
! 10837: build-target, <code class="varname">$MAKE_PROGRAM</code>
! 10838: is invoked on <code class="varname">$MAKEFILE</code>
! 10839: here, but with the <code class=
! 10840: "varname">$INSTALL_TARGET</code> instead, the latter
! 10841: defaulting to “<span class=
! 10842: "quote">install</span>” (plus “<span class=
! 10843: "quote">install.man</span>”, if <code class=
! 10844: "varname">USE_IMAKE</code> is set).</p>
! 10845: </div>
! 10846:
! 10847: <div class="sect1" lang="en" xml:lang="en">
! 10848: <div class="titlepage">
! 10849: <div>
! 10850: <div>
! 10851: <h2 class="title" style="clear: both"><a name=
! 10852: "build.package" id=
! 10853: "build.package"></a>14.15. The <span class=
! 10854: "emphasis"><em>package</em></span> phase</h2>
! 10855: </div>
! 10856: </div>
! 10857: </div>
! 10858:
! 10859: <p>[TODO]</p>
1.1 grant 10860: </div>
10861:
1.55 rillig 10862: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10863: <div class="titlepage">
10864: <div>
10865: <div>
10866: <h2 class="title" style="clear: both"><a name=
1.55 rillig 10867: "build.helpful-targets" id=
1.56 ! rillig 10868: "build.helpful-targets"></a>14.16. Other
1.1 grant 10869: helpful targets</h2>
10870: </div>
10871: </div>
10872: </div>
10873:
10874: <div class="variablelist">
10875: <dl>
10876: <dt><span class="term">pre/post-*</span></dt>
10877:
10878: <dd>
10879: <p>For any of the main targets described in the
10880: previous section, two auxiliary targets exist with
10881: “<span class="quote">pre-</span>” and
10882: “<span class="quote">post-</span>” used
10883: as a prefix for the main target's name. These
10884: targets are invoked before and after the main
10885: target is called, allowing extra configuration or
10886: installation steps be performed from a package's
10887: Makefile, for example, which a program's configure
10888: script or install target omitted.</p>
10889: </dd>
10890:
10891: <dt><span class="term">do-*</span></dt>
10892:
10893: <dd>
10894: <p>Should one of the main targets do the wrong
10895: thing, and should there be no variable to fix this,
10896: you can redefine it with the do-* target. (Note
10897: that redefining the target itself instead of the
10898: do-* target is a bad idea, as the pre-* and post-*
10899: targets won't be called anymore, etc.) You will not
10900: usually need to do this.</p>
10901: </dd>
10902:
10903: <dt><span class="term">reinstall</span></dt>
10904:
10905: <dd>
1.14 xtraeme 10906: <p>If you did a <span><strong class="command">make
10907: install</strong></span> and you noticed some file
10908: was not installed properly, you can repeat the
1.1 grant 10909: installation with this target, which will ignore
10910: the “<span class="quote">already
10911: installed</span>” flag.</p>
10912: </dd>
10913:
10914: <dt><span class="term">deinstall</span></dt>
10915:
10916: <dd>
1.24 wiz 10917: <p>This target does a <a href=
10918: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10919: <span class="citerefentry"><span class=
10920: "refentrytitle">pkg_delete</span>(1)</span></a> in
10921: the current directory, effectively de-installing
10922: the package. The following variables can be used to
10923: tune the behaviour:</p>
1.1 grant 10924:
10925: <div class="variablelist">
10926: <dl>
1.14 xtraeme 10927: <dt><span class="term"><code class=
10928: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10929:
10930: <dd>
10931: <p>Add a "-v" to the <a href=
10932: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10933: <span class="citerefentry"><span class=
10934: "refentrytitle">pkg_delete</span>(1)</span></a>
10935: command.</p>
10936: </dd>
10937:
1.14 xtraeme 10938: <dt><span class="term"><code class=
10939: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10940:
10941: <dd>
10942: <p>Remove all packages that require (depend
10943: on) the given package. This can be used to
10944: remove any packages that may have been pulled
10945: in by a given package, e.g. if
1.14 xtraeme 10946: <span><strong class="command">make deinstall
10947: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10948: <code xmlns=
10949: "http://www.w3.org/TR/xhtml1/transitional"
10950: class="filename">pkgsrc/x11/kde</code>, this
10951: is likely to remove whole KDE. Works by
1.1 grant 10952: adding “<span class=
10953: "quote">-R</span>” to the <a href=
10954: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10955: <span class="citerefentry"><span class=
10956: "refentrytitle">pkg_delete</span>(1)</span></a>
10957: command line.</p>
10958: </dd>
10959: </dl>
10960: </div>
10961: </dd>
10962:
10963: <dt><span class="term">update</span></dt>
10964:
10965: <dd>
10966: <p>This target causes the current package to be
10967: updated to the latest version. The package and all
10968: depending packages first get de-installed, then
10969: current versions of the corresponding packages get
10970: compiled and installed. This is similar to manually
10971: noting which packages are currently installed, then
1.14 xtraeme 10972: performing a series of <span><strong class=
10973: "command">make deinstall</strong></span> and
10974: <span><strong class="command">make
10975: install</strong></span> (or whatever <code class=
10976: "varname">UPDATE_TARGET</code> is set to) for these
10977: packages.</p>
1.1 grant 10978:
10979: <p>You can use the “<span class=
10980: "quote">update</span>” target to resume
1.14 xtraeme 10981: package updating in case a previous
10982: <span><strong class="command">make
10983: update</strong></span> was interrupted for some
10984: reason. However, in this case, make sure you don't
10985: call <span><strong class="command">make
10986: clean</strong></span> or otherwise remove the list
10987: of dependent packages in <code class=
1.47 reed 10988: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 10989: ability to automatically update the current package
10990: along with the dependent packages you have
10991: installed.</p>
10992:
1.14 xtraeme 10993: <p>Resuming an interrupted <span><strong class=
10994: "command">make update</strong></span> will only
10995: work as long as the package tree remains unchanged.
10996: If the source code for one of the packages to be
10997: updated has been changed, resuming
10998: <span><strong class="command">make
10999: update</strong></span> will most certainly
11000: fail!</p>
1.1 grant 11001:
11002: <p>The following variables can be used either on
1.45 wiz 11003: the command line or in <code xmlns=
11004: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11005: "filename">/etc/mk.conf</code> to alter the
11006: behaviour of <span><strong class="command">make
11007: update</strong></span>:</p>
1.1 grant 11008:
11009: <div class="variablelist">
11010: <dl>
1.14 xtraeme 11011: <dt><span class="term"><code class=
11012: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11013:
11014: <dd>
11015: <p>Install target to recursively use for the
11016: updated package and the dependent packages.
1.14 xtraeme 11017: Defaults to <code class=
11018: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11019: “<span class=
11020: "quote">install</span>” otherwise for
1.14 xtraeme 11021: <span><strong class="command">make
11022: update</strong></span>. e.g.
11023: <span><strong class="command">make update
11024: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11025: </dd>
11026:
1.14 xtraeme 11027: <dt><span class="term"><code class=
11028: "varname">NOCLEAN</code></span></dt>
1.1 grant 11029:
11030: <dd>
11031: <p>Don't clean up after updating. Useful if
11032: you want to leave the work sources of the
11033: updated packages around for inspection or
11034: other purposes. Be sure you eventually clean
11035: up the source tree (see the
11036: “<span class=
11037: "quote">clean-update</span>” target
11038: below) or you may run into troubles with old
11039: source code still lying around on your next
1.14 xtraeme 11040: <span><strong class=
11041: "command">make</strong></span> or
11042: <span><strong class="command">make
11043: update</strong></span>.</p>
1.1 grant 11044: </dd>
11045:
1.14 xtraeme 11046: <dt><span class="term"><code class=
11047: "varname">REINSTALL</code></span></dt>
1.1 grant 11048:
11049: <dd>
11050: <p>Deinstall each package before installing
1.14 xtraeme 11051: (making <code class=
11052: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11053: necessary if the “<span class=
11054: "quote">clean-update</span>” target
11055: (see below) was called after interrupting a
1.14 xtraeme 11056: running <span><strong class="command">make
11057: update</strong></span>.</p>
1.1 grant 11058: </dd>
11059:
1.14 xtraeme 11060: <dt><span class="term"><code class=
11061: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11062:
11063: <dd>
11064: <p>Allows you to disable recursion and
11065: hardcode the target for packages. The default
11066: is “<span class=
11067: "quote">update</span>” for the update
11068: target, facilitating a recursive update of
1.14 xtraeme 11069: prerequisite packages. Only set <code class=
11070: "varname">DEPENDS_TARGET</code> if you want
11071: to disable recursive updates. Use
11072: <code class="varname">UPDATE_TARGET</code>
11073: instead to just set a specific target for
11074: each package to be installed during
11075: <span><strong class="command">make
11076: update</strong></span> (see above).</p>
1.1 grant 11077: </dd>
11078: </dl>
11079: </div>
11080: </dd>
11081:
11082: <dt><span class="term">clean-update</span></dt>
11083:
11084: <dd>
11085: <p>Clean the source tree for all packages that
1.14 xtraeme 11086: would get updated if <span><strong class=
11087: "command">make update</strong></span> was called
11088: from the current directory. This target should not
11089: be used if the current package (or any of its
11090: depending packages) have already been de-installed
11091: (e.g., after calling <span><strong class=
11092: "command">make update</strong></span>) or you may
11093: lose some packages you intended to update. As a
11094: rule of thumb: only use this target <span class=
11095: "emphasis"><em>before</em></span> the first time
11096: you run <span><strong class="command">make
11097: update</strong></span> and only if you have a dirty
11098: package tree (e.g., if you used <code class=
11099: "varname">NOCLEAN</code>).</p>
1.1 grant 11100:
1.47 reed 11101: <p>If you are unsure about whether your tree is
11102: clean, you can either perform a
1.14 xtraeme 11103: <span><strong class="command">make
1.47 reed 11104: clean</strong></span> at the top of the tree, or
11105: use the following sequence of commands from the
11106: directory of the package you want to update
11107: (<span class="emphasis"><em>before</em></span>
11108: running <span><strong class="command">make
1.14 xtraeme 11109: update</strong></span> for the first time,
11110: otherwise you lose all the packages you wanted to
11111: update!):</p>
1.1 grant 11112: <pre class="screen">
1.14 xtraeme 11113: <code class="prompt">#</code> <strong class=
11114: "userinput"><code>make clean-update</code></strong>
11115: <code class="prompt">#</code> <strong class=
11116: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11117: <code class="prompt">#</code> <strong class=
11118: "userinput"><code>make update</code></strong>
1.1 grant 11119: </pre>
11120:
11121: <p>The following variables can be used either on
1.45 wiz 11122: the command line or in <code xmlns=
11123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11124: "filename">/etc/mk.conf</code> to alter the
11125: behaviour of <span><strong class="command">make
11126: clean-update</strong></span>:</p>
1.1 grant 11127:
11128: <div class="variablelist">
11129: <dl>
1.14 xtraeme 11130: <dt><span class="term"><code class=
11131: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11132:
11133: <dd>
1.14 xtraeme 11134: <p>After <span><strong class="command">make
11135: clean</strong></span>, do not reconstruct the
11136: list of directories to update for this
11137: package. Only use this if
11138: <span><strong class="command">make
11139: update</strong></span> successfully installed
11140: all packages you wanted to update. Normally,
11141: this is done automatically on
11142: <span><strong class="command">make
11143: update</strong></span>, but may have been
11144: suppressed by the <code class=
11145: "varname">NOCLEAN</code> variable (see
1.1 grant 11146: above).</p>
11147: </dd>
11148: </dl>
11149: </div>
11150: </dd>
11151:
11152: <dt><span class="term">info</span></dt>
11153:
11154: <dd>
11155: <p>This target invokes <a href=
11156: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11157: <span class="citerefentry"><span class=
11158: "refentrytitle">pkg_info</span>(1)</span></a> for
11159: the current package. You can use this to check
11160: which version of a package is installed.</p>
11161: </dd>
11162:
11163: <dt><span class="term">readme</span></dt>
11164:
11165: <dd>
1.45 wiz 11166: <p>This target generates a <code xmlns=
11167: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11168: "filename">README.html</code> file, which can be
1.1 grant 11169: viewed using a browser such as <a xmlns=
11170: "http://www.w3.org/TR/xhtml1/transitional" href=
11171: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11172: target="_top"><code xmlns="" class=
11173: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11174: "http://www.w3.org/TR/xhtml1/transitional" href=
11175: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11176: target="_top"><code xmlns="" class=
11177: "filename">www/links</code></a>. The generated
11178: files contain references to any packages which are
11179: in the <code class="varname">PACKAGES</code>
11180: directory on the local host. The generated files
11181: can be made to refer to URLs based on <code class=
1.20 ben 11182: "varname">FTP_PKG_URL_HOST</code> and <code class=
11183: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11184: wanted to generate <code xmlns=
11185: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11186: "filename">README.html</code> files which pointed
11187: to binary packages on the local machine, in the
1.45 wiz 11188: directory <code xmlns=
11189: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11190: "filename">/usr/packages</code>, set <code class=
11191: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11192: and <code class=
11193: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11194: <code class="varname">${PACKAGES}</code> directory
11195: and its subdirectories will be searched for all the
11196: binary packages.</p>
1.1 grant 11197: </dd>
11198:
11199: <dt><span class="term">readme-all</span></dt>
11200:
11201: <dd>
1.45 wiz 11202: <p>Use this target to create a file <code xmlns=
11203: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11204: "filename">README-all.html</code> which contains a
1.1 grant 11205: list of all packages currently available in the
11206: NetBSD Packages Collection, together with the
11207: category they belong to and a short description.
1.45 wiz 11208: This file is compiled from the <code xmlns=
11209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11210: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11211: sure to run this <span class=
1.14 xtraeme 11212: "emphasis"><em>after</em></span> a
11213: <span><strong class="command">make
11214: readme</strong></span>.</p>
1.1 grant 11215: </dd>
11216:
11217: <dt><span class="term">cdrom-readme</span></dt>
11218:
11219: <dd>
11220: <p>This is very much the same as the
11221: “<span class="quote">readme</span>”
11222: target (see above), but is to be used when
11223: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11224: This target also produces <code xmlns=
11225: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11226: "filename">README.html</code> files, and can be
11227: made to refer to URLs based on <code class=
11228: "varname">CDROM_PKG_URL_HOST</code> and
11229: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11230: </dd>
11231:
11232: <dt><span class="term">show-distfiles</span></dt>
11233:
11234: <dd>
11235: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11236: are needed to build the package. (<code class=
11237: "varname">DISTFILES</code> and <code class=
1.45 wiz 11238: "varname">PATCHFILES</code>, but not <code xmlns=
11239: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11240: "filename">patches/*</code>)</p>
1.1 grant 11241: </dd>
11242:
11243: <dt><span class="term">show-downlevel</span></dt>
11244:
11245: <dd>
11246: <p>This target shows nothing if the package is not
11247: installed. If a version of this package is
11248: installed, but is not the version provided in this
11249: version of pkgsrc, then a warning message is
11250: displayed. This target can be used to show which of
11251: your installed packages are downlevel, and so the
11252: old versions can be deleted, and the current ones
11253: added.</p>
11254: </dd>
11255:
11256: <dt><span class="term">show-pkgsrc-dir</span></dt>
11257:
11258: <dd>
11259: <p>This target shows the directory in the pkgsrc
11260: hierarchy from which the package can be built and
11261: installed. This may not be the same directory as
11262: the one from which the package was installed. This
11263: target is intended to be used by people who may
11264: wish to upgrade many packages on a single host, and
11265: can be invoked from the top-level pkgsrc Makefile
11266: by using the “<span class=
11267: "quote">show-host-specific-pkgs</span>”
11268: target.</p>
11269: </dd>
11270:
11271: <dt><span class=
11272: "term">show-installed-depends</span></dt>
11273:
11274: <dd>
11275: <p>This target shows which installed packages match
1.14 xtraeme 11276: the current package's <code class=
11277: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11278: dependencies are causing build problems.</p>
11279: </dd>
11280:
11281: <dt><span class="term">check-shlibs</span></dt>
11282:
11283: <dd>
11284: <p>After a package is installed, check all its
11285: binaries and (on ELF platforms) shared libraries to
11286: see if they find the shared libs they need. Run by
1.14 xtraeme 11287: default if <code class=
11288: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11289: <code xmlns=
11290: "http://www.w3.org/TR/xhtml1/transitional" class=
11291: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11292: </dd>
11293:
11294: <dt><span class="term">print-PLIST</span></dt>
11295:
11296: <dd>
11297: <p>After a “<span class="quote">make
11298: install</span>” from a new or upgraded pkg,
11299: this prints out an attempt to generate a new
1.45 wiz 11300: <code xmlns=
11301: "http://www.w3.org/TR/xhtml1/transitional" class=
11302: "filename">PLIST</code> from a <span><strong class=
11303: "command">find -newer
1.14 xtraeme 11304: work/.extract_done</strong></span>. An attempt is
11305: made to care for shared libs etc., but it is
1.1 grant 11306: <span class="emphasis"><em>strongly</em></span>
11307: recommended to review the result before putting it
1.45 wiz 11308: into <code xmlns=
11309: "http://www.w3.org/TR/xhtml1/transitional" class=
11310: "filename">PLIST</code>. On upgrades, it's useful
11311: to diff the output of this command against an
11312: already existing <code xmlns=
11313: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11314: "filename">PLIST</code> file.</p>
1.1 grant 11315:
1.24 wiz 11316: <p>If the package installs files via <a href=
11317: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11318: <span class="citerefentry"><span class=
11319: "refentrytitle">tar</span>(1)</span></a> or other
11320: methods that don't update file access times, be
11321: sure to add these files manually to your
1.45 wiz 11322: <code xmlns=
11323: "http://www.w3.org/TR/xhtml1/transitional" class=
11324: "filename">PLIST</code>, as the “<span class=
11325: "quote">find -newer</span>” command used by
11326: this target won't catch them!</p>
1.1 grant 11327:
11328: <p>See <a href="#print-PLIST" title=
1.38 dillo 11329: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11330: “Tweaking output of <span><strong class=
11331: "command">make
11332: print-PLIST</strong></span>”</a> for more
11333: information on this target.</p>
1.1 grant 11334: </dd>
11335:
11336: <dt><span class="term">bulk-package</span></dt>
11337:
11338: <dd>
11339: <p>Used to do bulk builds. If an appropriate binary
11340: package already exists, no action is taken. If not,
11341: this target will compile, install and package it
1.47 reed 11342: (and its depends, if <code class=
1.14 xtraeme 11343: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11344: <a href="#binary.configuration" title=
1.38 dillo 11345: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11346: “Configuration”</a>). After creating
11347: the binary package, the sources, the just-installed
11348: package and its required packages are removed,
1.1 grant 11349: preserving free disk space.</p>
11350:
11351: <p><span class="emphasis"><em>Beware that this
11352: target may deinstall all packages installed on a
11353: system!</em></span></p>
11354: </dd>
11355:
11356: <dt><span class="term">bulk-install</span></dt>
11357:
11358: <dd>
11359: <p>Used during bulk-installs to install required
1.47 reed 11360: packages. If an up-to-date binary package is
1.1 grant 11361: available, it will be installed via <a href=
11362: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11363: <span class="citerefentry"><span class=
11364: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11365: not, <span><strong class="command">make
11366: bulk-package</strong></span> will be executed, but
1.47 reed 11367: the installed binary won't be removed.</p>
1.1 grant 11368:
11369: <p>A binary package is considered
1.47 reed 11370: “<span class="quote">up-to-date</span>”
1.1 grant 11371: to be installed via <a href=
11372: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11373: <span class="citerefentry"><span class=
11374: "refentrytitle">pkg_add</span>(1)</span></a>
11375: if:</p>
11376:
11377: <div class="itemizedlist">
11378: <ul type="disc">
11379: <li>
1.45 wiz 11380: <p>None of the package's files (<code xmlns=
11381: "http://www.w3.org/TR/xhtml1/transitional"
11382: class="filename">Makefile</code>, ...) were
1.14 xtraeme 11383: modified since it was built.</p>
1.1 grant 11384: </li>
11385:
11386: <li>
11387: <p>None of the package's required (binary)
11388: packages were modified since it was
11389: built.</p>
11390: </li>
11391: </ul>
11392: </div>
11393:
11394: <p><span class="emphasis"><em>Beware that this
11395: target may deinstall all packages installed on a
11396: system!</em></span></p>
11397: </dd>
11398: </dl>
11399: </div>
11400: </div>
11401: </div>
11402:
1.55 rillig 11403: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 11404: <div class="titlepage">
11405: <div>
11406: <div>
1.55 rillig 11407: <h2 class="title"><a name="fixes" id=
11408: "fixes"></a>Chapter 15. Making your package
11409: work</h2>
1.1 grant 11410: </div>
11411: </div>
11412: </div>
11413:
11414: <div class="toc">
11415: <p><b>Table of Contents</b></p>
11416:
11417: <dl>
1.30 wiz 11418: <dt><span class="sect1"><a href=
1.38 dillo 11419: "#general-operation">15.1. General
1.30 wiz 11420: operation</a></span></dt>
1.1 grant 11421:
11422: <dd>
11423: <dl>
11424: <dt><span class="sect2"><a href=
1.38 dillo 11425: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 11426: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11427:
11428: <dt><span class="sect2"><a href=
1.38 dillo 11429: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 11430: install documentation</a></span></dt>
11431:
11432: <dt><span class="sect2"><a href=
1.38 dillo 11433: "#restricted-packages">15.1.3. Restricted
1.1 grant 11434: packages</a></span></dt>
11435:
11436: <dt><span class="sect2"><a href=
1.38 dillo 11437: "#dependencies">15.1.4. Handling
1.1 grant 11438: dependencies</a></span></dt>
11439:
11440: <dt><span class="sect2"><a href=
1.38 dillo 11441: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 11442: packages</a></span></dt>
11443:
11444: <dt><span class="sect2"><a href=
1.38 dillo 11445: "#not-building-packages">15.1.6. Packages that
1.30 wiz 11446: cannot or should not be built</a></span></dt>
1.1 grant 11447:
11448: <dt><span class="sect2"><a href=
1.38 dillo 11449: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 11450: should not be deleted, once
11451: installed</a></span></dt>
1.1 grant 11452:
11453: <dt><span class="sect2"><a href=
1.38 dillo 11454: "#security-handling">15.1.8. Handling packages with
1.1 grant 11455: security problems</a></span></dt>
11456:
11457: <dt><span class="sect2"><a href=
1.38 dillo 11458: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 11459: bugs</a></span></dt>
11460:
11461: <dt><span class="sect2"><a href=
1.38 dillo 11462: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 11463: incrementing versions when fixing an existing
1.1 grant 11464: package</a></span></dt>
11465:
11466: <dt><span class="sect2"><a href=
1.38 dillo 11467: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11468: packages</a></span></dt>
11469: </dl>
11470: </dd>
11471:
1.30 wiz 11472: <dt><span class="sect1"><a href=
1.38 dillo 11473: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11474: issues</a></span></dt>
1.1 grant 11475:
11476: <dd>
11477: <dl>
11478: <dt><span class="sect2"><a href=
1.38 dillo 11479: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11480: distfiles aren't available for plain
1.1 grant 11481: downloading</a></span></dt>
11482:
11483: <dt><span class="sect2"><a href=
1.38 dillo 11484: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11485: handle modified distfiles with the 'old'
11486: name</a></span></dt>
1.1 grant 11487: </dl>
11488: </dd>
11489:
1.30 wiz 11490: <dt><span class="sect1"><a href=
1.38 dillo 11491: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11492: gotchas</a></span></dt>
1.1 grant 11493:
11494: <dd>
11495: <dl>
11496: <dt><span class="sect2"><a href=
1.38 dillo 11497: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11498: libtool</a></span></dt>
11499:
11500: <dt><span class="sect2"><a href=
1.38 dillo 11501: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11502: packages that already support
11503: libtool</a></span></dt>
1.1 grant 11504:
11505: <dt><span class="sect2"><a href=
1.38 dillo 11506: "#autoconf-automake">15.3.3. GNU
1.1 grant 11507: Autoconf/Automake</a></span></dt>
11508: </dl>
11509: </dd>
11510:
1.55 rillig 11511: <dt><span class="sect1"><a href="#fixes-build">15.4.
11512: Building the package</a></span></dt>
1.1 grant 11513:
11514: <dd>
11515: <dl>
11516: <dt><span class="sect2"><a href=
1.38 dillo 11517: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11518:
11519: <dt><span class="sect2"><a href="#cpp-list">15.4.2.
11520: Getting a list of CPP defines</a></span></dt>
1.1 grant 11521: </dl>
11522: </dd>
11523:
1.30 wiz 11524: <dt><span class="sect1"><a href=
1.38 dillo 11525: "#package-specific-actions">15.5. Package specific
1.30 wiz 11526: actions</a></span></dt>
1.1 grant 11527:
11528: <dd>
11529: <dl>
11530: <dt><span class="sect2"><a href=
1.38 dillo 11531: "#user-interaction">15.5.1. User
1.2 hubertf 11532: interaction</a></span></dt>
1.1 grant 11533:
11534: <dt><span class="sect2"><a href=
1.38 dillo 11535: "#handling-licenses">15.5.2. Handling
1.1 grant 11536: licenses</a></span></dt>
11537:
11538: <dt><span class="sect2"><a href=
1.38 dillo 11539: "#installing-score-files">15.5.3. Installing score
1.1 grant 11540: files</a></span></dt>
11541:
11542: <dt><span class="sect2"><a href=
1.38 dillo 11543: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11544: scripts</a></span></dt>
11545:
11546: <dt><span class="sect2"><a href=
1.38 dillo 11547: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11548: paths to other interpreters</a></span></dt>
1.1 grant 11549:
11550: <dt><span class="sect2"><a href=
1.38 dillo 11551: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11552: modules</a></span></dt>
11553:
11554: <dt><span class="sect2"><a href=
1.38 dillo 11555: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11556: files</a></span></dt>
11557:
11558: <dt><span class="sect2"><a href=
1.38 dillo 11559: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 11560: GConf2 data files</a></span></dt>
1.1 grant 11561:
11562: <dt><span class="sect2"><a href=
1.38 dillo 11563: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 11564: installing scrollkeeper data files</a></span></dt>
1.1 grant 11565:
11566: <dt><span class="sect2"><a href=
1.38 dillo 11567: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 11568: fonts</a></span></dt>
11569:
11570: <dt><span class="sect2"><a href=
1.38 dillo 11571: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 11572: modules</a></span></dt>
11573:
11574: <dt><span class="sect2"><a href=
1.38 dillo 11575: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 11576: or XML data</a></span></dt>
1.1 grant 11577:
11578: <dt><span class="sect2"><a href=
1.38 dillo 11579: "#mime-database">15.5.13. Packages installing
1.1 grant 11580: extensions to the MIME database</a></span></dt>
11581:
11582: <dt><span class="sect2"><a href=
1.38 dillo 11583: "#intltool">15.5.14. Packages using
1.1 grant 11584: intltool</a></span></dt>
1.18 xtraeme 11585:
11586: <dt><span class="sect2"><a href=
1.38 dillo 11587: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 11588: startup scripts</a></span></dt>
1.1 grant 11589: </dl>
11590: </dd>
11591:
1.30 wiz 11592: <dt><span class="sect1"><a href=
1.38 dillo 11593: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11594: author</a></span></dt>
1.1 grant 11595: </dl>
11596: </div>
11597:
1.55 rillig 11598: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 11599: <div class="titlepage">
11600: <div>
11601: <div>
11602: <h2 class="title" style="clear: both"><a name=
1.55 rillig 11603: "general-operation" id=
1.38 dillo 11604: "general-operation"></a>15.1. General
1.1 grant 11605: operation</h2>
11606: </div>
11607: </div>
11608: </div>
11609:
1.55 rillig 11610: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11611: <div class="titlepage">
11612: <div>
11613: <div>
1.30 wiz 11614: <h3 class="title"><a name=
1.55 rillig 11615: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11616: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11617: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11618: </div>
11619: </div>
11620: </div>
11621:
11622: <p>The problem with package-defined variables that can
1.14 xtraeme 11623: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11624: or <code xmlns=
11625: "http://www.w3.org/TR/xhtml1/transitional" class=
11626: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11627: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11628: <span class="citerefentry"><span class=
11629: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11630: variable as it is used, but evaluates preprocessor-like
1.1 grant 11631: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11632: So, to use any variable (which may be set in
1.45 wiz 11633: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11634: class="filename">/etc/mk.conf</code>) in one of the
11635: .if* statements, the file <code xmlns=
11636: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11637: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11638: that .if* statement.</p>
11639:
1.47 reed 11640: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11641: including <code xmlns=
11642: "http://www.w3.org/TR/xhtml1/transitional" class=
11643: "filename">/etc/mk.conf</code>, should it exist, or
11644: <code class="varname">MAKECONF</code>, should it exist,
11645: include the <code xmlns=
11646: "http://www.w3.org/TR/xhtml1/transitional" class=
11647: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11648: package Makefile before any preprocessor-like .if,
11649: .ifdef, or .ifndef statements:</p>
1.1 grant 11650: <pre class="programlisting">
1.51 rillig 11651: .include "../../mk/bsd.prefs.mk"
11652:
1.1 grant 11653: .if defined(USE_MENUS)
1.51 rillig 11654: # ...
1.1 grant 11655: .endif
11656: </pre>
11657:
1.14 xtraeme 11658: <p>If you wish to set the <code class=
1.45 wiz 11659: "varname">CFLAGS</code> variable in <code xmlns=
11660: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11661: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11662: use:</p>
11663: <pre class="programlisting">
1.51 rillig 11664: CFLAGS+= -your -flags
1.1 grant 11665: </pre>
11666:
1.14 xtraeme 11667: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11668: without the “<span class="quote">+</span>”)
11669: may lead to problems with packages that need to add
11670: their own flags. Also, you may want to take a look at
11671: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11672: href=
11673: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11674: target="_top"><code xmlns="" class=
11675: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11676: interested in optimization for the current CPU.</p>
1.1 grant 11677: </div>
11678:
1.55 rillig 11679: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11680: <div class="titlepage">
11681: <div>
11682: <div>
1.31 wiz 11683: <h3 class="title"><a name=
1.55 rillig 11684: "where-to-install-documentation" id=
1.38 dillo 11685: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11686: to install documentation</h3>
11687: </div>
11688: </div>
11689: </div>
11690:
1.45 wiz 11691: <p>Documentation should be installed into <code xmlns=
11692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11693: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11694: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11695: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11696: (the latter includes the version number of the
11697: package).</p>
1.31 wiz 11698: </div>
11699:
1.55 rillig 11700: <div class="sect2" lang="en" xml:lang="en">
1.31 wiz 11701: <div class="titlepage">
11702: <div>
11703: <div>
1.55 rillig 11704: <h3 class="title"><a name="restricted-packages"
11705: id=
1.38 dillo 11706: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11707: packages</h3>
11708: </div>
11709: </div>
11710: </div>
11711:
11712: <p>Some licenses restrict how software may be
11713: re-distributed. In order to satisfy these restrictions,
11714: the package system defines five make variables that can
11715: be set to note these restrictions:</p>
11716:
11717: <div class="itemizedlist">
11718: <ul type="disc">
11719: <li>
1.14 xtraeme 11720: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11721:
11722: <p>This variable should be set whenever a
11723: restriction exists (regardless of its kind). Set
11724: this variable to a string containing the reason
11725: for the restriction.</p>
11726: </li>
11727:
11728: <li>
1.14 xtraeme 11729: <p><code class=
11730: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11731:
11732: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11733: variable to <code class=
11734: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11735: package may not be included on a CD-ROM.</p>
11736: </li>
11737:
11738: <li>
1.14 xtraeme 11739: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11740:
11741: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11742: Set this variable to <code class=
11743: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11744: package may not not be made available on the
11745: Internet.</p>
11746: </li>
11747:
11748: <li>
1.14 xtraeme 11749: <p><code class=
11750: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11751:
11752: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11753: this variable to <code class=
11754: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11755: of the source code or other distfile(s) is not
11756: allowed on CD-ROMs.</p>
11757: </li>
11758:
11759: <li>
1.14 xtraeme 11760: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11761:
11762: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11763: variable to <code class=
11764: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11765: of the source code or other distfile(s) via the
11766: Internet is not allowed.</p>
11767: </li>
11768: </ul>
11769: </div>
11770:
1.14 xtraeme 11771: <p>Please note that the use of <code class=
11772: "varname">NO_PACKAGE</code>, <code class=
11773: "varname">IGNORE</code>, <code class=
11774: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11775: variables to denote restrictions is deprecated, because
11776: they unconditionally prevent users from generating
11777: binary packages!</p>
11778: </div>
11779:
1.55 rillig 11780: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11781: <div class="titlepage">
11782: <div>
11783: <div>
1.55 rillig 11784: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11785: "dependencies"></a>15.1.4. Handling
1.1 grant 11786: dependencies</h3>
11787: </div>
11788: </div>
11789: </div>
11790:
11791: <p>Your package may depend on some other package being
11792: present - and there are various ways of expressing this
1.14 xtraeme 11793: dependency. pkgsrc supports the <code class=
11794: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11795: "varname">DEPENDS</code> definitions, the <code class=
11796: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11797: dependencies via <code xmlns=
11798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11799: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11800: way to handle dependencies, and which uses the
11801: variables named above. See <a href="#buildlink" title=
1.38 dillo 11802: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11803: <i>Buildlink methodology</i></a> for more
11804: information.</p>
11805:
11806: <p>The basic difference between the two variables is as
1.14 xtraeme 11807: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11808: definition registers that pre-requisite in the binary
11809: package so it will be pulled in when the binary package
1.14 xtraeme 11810: is later installed, whilst the <code class=
11811: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11812: marking a dependency that is only needed for building
11813: the package.</p>
11814:
11815: <p>This means that if you only need a package present
11816: whilst you are building, it should be noted as a
1.14 xtraeme 11817: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11818:
1.14 xtraeme 11819: <p>The format for a <code class=
11820: "varname">BUILD_DEPENDS</code> and a <code class=
11821: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11822: <pre class="programlisting">
1.51 rillig 11823: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11824: </pre>
11825:
11826: <p>Please note that the “<span class=
11827: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11828: any of the wildcard version numbers recognized by
1.1 grant 11829: <a href=
11830: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11831: <span class="citerefentry"><span class=
11832: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11833:
11834: <div class="orderedlist">
11835: <ol type="1">
11836: <li>
11837: <p>If your package needs another package's
11838: binaries or libraries to build or run, and if
1.45 wiz 11839: that package has a <code xmlns=
11840: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11841: "filename">buildlink3.mk</code> file available,
11842: use it:</p>
1.1 grant 11843: <pre class="programlisting">
11844: .include "../../graphics/jpeg/buildlink3.mk"
11845: </pre>
11846: </li>
11847:
11848: <li>
11849: <p>If your package needs to use another package
1.45 wiz 11850: to build itself and there is no <code xmlns=
11851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11852: "filename">buildlink3.mk</code> file available,
11853: use the <code class=
11854: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11855: <pre class="programlisting">
1.51 rillig 11856: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 11857: </pre>
11858: </li>
11859:
11860: <li>
11861: <p>If your package needs a library with which to
1.45 wiz 11862: link and again there is no <code xmlns=
11863: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11864: "filename">buildlink3.mk</code> file available,
11865: this is specified using the <code class=
11866: "varname">DEPENDS</code> definition. An example
11867: of this is the <a xmlns=
1.1 grant 11868: "http://www.w3.org/TR/xhtml1/transitional" href=
11869: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11870: target="_top"><code xmlns="" class=
11871: "filename">print/lyx</code></a> package, which
11872: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11873: <pre class="programlisting">
1.51 rillig 11874: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 11875: </pre>
11876:
11877: <p>You can also use wildcards in package
11878: dependences:</p>
11879: <pre class="programlisting">
1.51 rillig 11880: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 11881: </pre>
11882:
11883: <p>Note that such wildcard dependencies are
11884: retained when creating binary packages. The
11885: dependency is checked when installing the binary
11886: package and any package which matches the pattern
11887: will be used. Wildcard dependencies should be
11888: used with care.</p>
11889:
11890: <p>The “<span class=
11891: "quote">-[0-9]*</span>” should be used
11892: instead of “<span class=
11893: "quote">-*</span>” to avoid potentially
11894: ambiguous matches such as “<span class=
11895: "quote">tk-postgresql</span>” matching a
11896: “<span class="quote">tk-*</span>”
1.14 xtraeme 11897: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11898:
11899: <p>Wildcards can also be used to specify that a
11900: package will only build against a certain minimum
11901: version of a pre-requisite:</p>
11902: <pre class="programlisting">
1.51 rillig 11903: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 11904: </pre>
11905:
11906: <p>This means that the package will build against
11907: version 3.5.4 of the tiff library or newer. Such
11908: a dependency may be warranted if, for example,
11909: the API of the library has changed with version
11910: 3.5.4 and a package would not compile against an
11911: earlier version of tiff.</p>
11912:
11913: <p>Please note that such dependencies should only
11914: be updated if a package requires a newer
11915: pre-requisite, but not to denote recommendations
11916: such as security updates or ABI changes that do
11917: not prevent a package from building correctly.
11918: Such recommendations can be expressed using
1.14 xtraeme 11919: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11920: <pre class="programlisting">
1.51 rillig 11921: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 11922: </pre>
11923:
1.14 xtraeme 11924: <p>In addition to the above <code class=
11925: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11926: while a package will build against
11927: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11928: recommended. <code class=
11929: "varname">RECOMMENDED</code> entries will be
11930: turned into dependencies unless explicitly
11931: ignored (in which case a warning will be
1.36 wiz 11932: printed).</p>
11933:
11934: <p>To ignore these dependency recommendations and
11935: just use the required <code class=
11936: "varname">DEPENDS</code>, set <code class=
11937: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11938: make it easier and faster to update packages
11939: built using pkgsrc, since older compatible
11940: dependencies can continue to be used. This is
11941: useful for people who watch their rebuilds very
11942: carefully; it is not very good as a
11943: general-purpose hammer. If you use it, you need
11944: to be mindful of possible ABI changes, including
11945: those from the underlying OS.</p>
11946:
11947: <p>Packages that are built with recommendations
11948: ignored may not be uploaded to ftp.NetBSD.org by
11949: developers and should not be used across
11950: different systems that may have different
11951: versions of binary packages installed.</p>
1.1 grant 11952:
11953: <p>For security fixes, please update the package
11954: vulnerabilities file as well as setting
1.14 xtraeme 11955: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11956: <a href="#security-handling" title=
1.38 dillo 11957: "15.1.8. Handling packages with security problems">
1.55 rillig 11958: Section 15.1.8, “Handling packages with
11959: security problems”</a> for more
1.1 grant 11960: information.</p>
11961: </li>
11962:
11963: <li>
11964: <p>If your package needs some executable to be
1.17 sketch 11965: able to run correctly and if there's no
1.45 wiz 11966: <code xmlns=
11967: "http://www.w3.org/TR/xhtml1/transitional" class=
11968: "filename">buildlink3.mk</code> file, this is
11969: specified using the <code class=
1.14 xtraeme 11970: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11971: "http://www.w3.org/TR/xhtml1/transitional" href=
11972: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11973: target="_top"><code xmlns="" class=
11974: "filename">print/lyx</code></a> package needs to
11975: be able to execute the latex binary from the
11976: teTeX package when it runs, and that is
11977: specified:</p>
1.1 grant 11978: <pre class="programlisting">
1.51 rillig 11979: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 11980: </pre>
11981:
11982: <p>The comment about wildcard dependencies from
11983: previous paragraph applies here, too.</p>
11984: </li>
11985: </ol>
11986: </div>
11987:
11988: <p>If your package needs files from another package to
11989: build, see the first part of the “<span class=
11990: "quote">do-configure</span>” target <a xmlns=
11991: "http://www.w3.org/TR/xhtml1/transitional" href=
11992: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11993: target="_top"><code xmlns="" class=
11994: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11995: relies on the jpeg sources being present in source form
11996: during the build):</p>
1.1 grant 11997: <pre class="programlisting">
1.51 rillig 11998: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11999: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 12000: fi
12001: </pre>
12002:
12003: <p>If you build any other packages that way, please
12004: make sure the working files are deleted too when this
12005: package's working files are cleaned up. The easiest way
12006: to do so is by adding a pre-clean target:</p>
12007: <pre class="programlisting">
1.51 rillig 12008: pre-clean:
12009: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 12010: </pre>
12011:
1.14 xtraeme 12012: <p>Please also note the <code class=
12013: "varname">BUILD_USES_MSGFMT</code> and <code class=
12014: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12015: which are provided as convenience definitions. The
1.24 wiz 12016: former works out whether <a href=
12017: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12018: <span class="citerefentry"><span class=
12019: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12020: the base system, and, if it isn't, installs the
12021: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12022: href=
1.1 grant 12023: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12024: target="_top"><code xmlns="" class=
12025: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12026: adds a build dependency on either an installed version
12027: of an older gettext package, or if it isn't, installs
12028: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12029: href=
12030: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12031: target="_top"><code xmlns="" class=
12032: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12033: </div>
12034:
1.55 rillig 12035: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12036: <div class="titlepage">
12037: <div>
12038: <div>
1.55 rillig 12039: <h3 class="title"><a name="conflicts" id=
1.38 dillo 12040: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 12041: with other packages</h3>
12042: </div>
12043: </div>
12044: </div>
12045:
12046: <p>Your package may conflict with other packages a user
12047: might already have installed on his system, e.g. if
12048: your package installs the same set of files like
12049: another package in our pkgsrc tree.</p>
12050:
1.14 xtraeme 12051: <p>In this case you can set <code class=
1.47 reed 12052: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12053: packages (including version string) your package
12054: conflicts with.</p>
12055:
1.47 reed 12056: <p>For example, <a xmlns=
1.1 grant 12057: "http://www.w3.org/TR/xhtml1/transitional" href=
12058: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12059: target="_top"><code xmlns="" class=
12060: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12061: "http://www.w3.org/TR/xhtml1/transitional" href=
12062: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12063: target="_top"><code xmlns="" class=
1.47 reed 12064: "filename">x11/Xaw-Xpm</code></a> install the same
12065: shared library, thus you set in <code xmlns=
1.45 wiz 12066: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12067: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12068: <pre class="programlisting">
1.51 rillig 12069: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12070: </pre>
12071:
1.45 wiz 12072: <p>and in <code xmlns=
12073: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12074: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12075: <pre class="programlisting">
1.51 rillig 12076: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12077: </pre>
12078:
12079: <p>Packages will automatically conflict with other
12080: packages with the name prefix and a different version
12081: string. “<span class=
12082: "quote">Xaw3d-1.5</span>” e.g. will automatically
12083: conflict with the older version “<span class=
12084: "quote">Xaw3d-1.3</span>”.</p>
12085: </div>
12086:
1.55 rillig 12087: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12088: <div class="titlepage">
12089: <div>
12090: <div>
1.55 rillig 12091: <h3 class="title"><a name="not-building-packages"
12092: id=
1.38 dillo 12093: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 12094: that cannot or should not be built</h3>
1.1 grant 12095: </div>
12096: </div>
12097: </div>
12098:
12099: <p>There are several reasons why a package might be
12100: instructed to not build under certain circumstances. If
12101: the package builds and runs on most platforms, the
1.14 xtraeme 12102: exceptions should be noted with <code class=
12103: "varname">NOT_FOR_PLATFORM</code>. If the package
12104: builds and runs on a small handful of platforms, set
12105: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12106: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12107: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12108: triples (OS-version-platform) that can use glob-style
12109: wildcards.</p>
12110:
12111: <p>If the package should be skipped (for example,
12112: because it provides functionality already provided by
12113: the system), set <code class=
1.14 xtraeme 12114: "varname">PKG_SKIP_REASON</code> to a descriptive
12115: message. If the package should fail because some
12116: preconditions are not met, set <code class=
12117: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12118: message.</p>
12119: </div>
12120:
1.55 rillig 12121: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12122: <div class="titlepage">
12123: <div>
12124: <div>
1.55 rillig 12125: <h3 class="title"><a name="undeletable-packages"
12126: id=
1.38 dillo 12127: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 12128: which should not be deleted, once installed</h3>
1.1 grant 12129: </div>
12130: </div>
12131: </div>
12132:
12133: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12134: has been installed, the <code class=
12135: "varname">PKG_PRESERVE</code> definition should be set
12136: in the package Makefile. This will be carried into any
1.1 grant 12137: binary package that is made from this pkgsrc entry. A
12138: “<span class="quote">preserved</span>”
12139: package will not be deleted using <a href=
12140: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12141: <span class="citerefentry"><span class=
12142: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12143: the “<span class="quote">-f</span>” option
12144: is used.</p>
12145: </div>
12146:
1.55 rillig 12147: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12148: <div class="titlepage">
12149: <div>
12150: <div>
1.55 rillig 12151: <h3 class="title"><a name="security-handling" id=
1.38 dillo 12152: "security-handling"></a>15.1.8. Handling
1.1 grant 12153: packages with security problems</h3>
12154: </div>
12155: </div>
12156: </div>
12157:
12158: <p>When a vulnerability is found, this should be noted
1.45 wiz 12159: in <code xmlns=
12160: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12161: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12162: and after committing that file, use
12163: <span><strong class="command">make
12164: upload</strong></span> in the same directory to update
12165: the file on ftp.NetBSD.org.</p>
12166:
12167: <p>After fixing the vulnerability by a patch, its
12168: <code class="varname">PKGREVISION</code> should be
12169: increased (this is of course not necessary if the
12170: problem is fixed by using a newer release of the
1.45 wiz 12171: software). In addition, if a <code xmlns=
12172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12173: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12174: affected package, a corresponding <code class=
1.14 xtraeme 12175: "varname">BUILDLINK_RECOMMENDED.<em class=
12176: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12177: be added or updated in it.</p>
1.1 grant 12178:
12179: <p>Also, if the fix should be applied to the stable
12180: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12181:
12182: <p>Binary packages already on ftp.NetBSD.org will be
12183: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12184: </div>
12185:
1.55 rillig 12186: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12187: <div class="titlepage">
12188: <div>
12189: <div>
1.55 rillig 12190: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 12191: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 12192: compiler bugs</h3>
12193: </div>
12194: </div>
12195: </div>
12196:
12197: <p>Some source files trigger bugs in the compiler,
12198: based on combinations of compiler version and
12199: architecture and almost always relation to optimisation
12200: being enabled. Common symptoms are gcc internal errors
12201: or never finishing compiling a file.</p>
12202:
1.47 reed 12203: <p>Typically, a workaround involves testing the
1.14 xtraeme 12204: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12205: version, disabling optimisation for that
1.14 xtraeme 12206: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12207: combination, and documenting it in <code xmlns=
12208: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12209: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12210: number of examples!</p>
12211: </div>
12212:
1.55 rillig 12213: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12214: <div class="titlepage">
12215: <div>
12216: <div>
1.55 rillig 12217: <h3 class="title"><a name="bumping-pkgrevision"
12218: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 12219: handle incrementing versions when fixing an
12220: existing package</h3>
1.1 grant 12221: </div>
12222: </div>
12223: </div>
12224:
12225: <p>When making fixes to an existing package it can be
1.14 xtraeme 12226: useful to change the version number in <code class=
12227: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 12228: future versions by the original author, a
12229: “<span class="quote">nb1</span>”,
12230: “<span class="quote">nb2</span>”, ...
12231: suffix can be used on package versions by setting
1.14 xtraeme 12232: <code class="varname">PKGREVISION=1</code> (2, ...).
12233: The “<span class="quote">nb</span>” is
12234: treated like a “<span class=
12235: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 12236: <pre class="programlisting">
1.51 rillig 12237: DISTNAME= foo-17.42
12238: PKGREVISION= 9
1.1 grant 12239: </pre>
12240:
1.14 xtraeme 12241: <p>will result in a <code class=
12242: "varname">PKGNAME</code> of “<span class=
1.1 grant 12243: "quote">foo-17.42nb9</span>”.</p>
12244:
12245: <p>When a new release of the package is released, the
1.14 xtraeme 12246: <code class="varname">PKGREVISION</code> should be
1.47 reed 12247: removed, e.g. on a new minor release of the above
1.14 xtraeme 12248: package, things should be like:</p>
1.1 grant 12249: <pre class="programlisting">
1.51 rillig 12250: DISTNAME= foo-17.43
1.1 grant 12251: </pre>
12252: </div>
12253:
1.55 rillig 12254: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12255: <div class="titlepage">
12256: <div>
12257: <div>
1.30 wiz 12258: <h3 class="title"><a name=
1.55 rillig 12259: "portability-of-packages" id=
1.38 dillo 12260: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 12261: of packages</h3>
1.1 grant 12262: </div>
12263: </div>
12264: </div>
12265:
12266: <p>One appealing feature of pkgsrc is that it runs on
12267: many different platforms. As a result, it is important
12268: to ensure, where possible, that packages in pkgsrc are
12269: portable. There are some particular details you should
12270: pay attention to while working on pkgsrc.</p>
12271:
1.55 rillig 12272: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 12273: <div class="titlepage">
12274: <div>
12275: <div>
1.55 rillig 12276: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 12277: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 12278: ${INSTALL_DATA_DIR}, ...</h4>
12279: </div>
12280: </div>
12281: </div>
12282:
1.14 xtraeme 12283: <p>The BSD-compatible <span><strong class=
12284: "command">install</strong></span> supplied with some
1.1 grant 12285: operating systems will not perform more than one
12286: operation at a time. As such, you should call
12287: “<span class="quote">${INSTALL}</span>”,
12288: etc. like this:</p>
12289: <pre class="programlisting">
1.51 rillig 12290: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
12291: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 12292: </pre>
12293: </div>
12294: </div>
12295: </div>
12296:
1.55 rillig 12297: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12298: <div class="titlepage">
12299: <div>
12300: <div>
12301: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12302: "downloading-issues" id=
1.38 dillo 12303: "downloading-issues"></a>15.2. Possible
1.1 grant 12304: downloading issues</h2>
12305: </div>
12306: </div>
12307: </div>
12308:
1.55 rillig 12309: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12310: <div class="titlepage">
12311: <div>
12312: <div>
1.55 rillig 12313: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 12314: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 12315: whose distfiles aren't available for plain
1.1 grant 12316: downloading</h3>
12317: </div>
12318: </div>
12319: </div>
12320:
12321: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 12322: set <code class="varname">DYNAMIC_MASTER_SITES</code>
12323: and a <span><strong class="command">make
1.45 wiz 12324: fetch</strong></span> will call <code xmlns=
12325: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12326: "filename">files/getsite.sh</code> with the name of
12327: each file to download as an argument, expecting it to
12328: output the URL of the directory from which to download
12329: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12330: href=
1.1 grant 12331: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 12332: target="_top"><code xmlns="" class=
12333: "filename">graphics/ns-cult3d</code></a> is an example
12334: of this usage.</p>
1.1 grant 12335:
12336: <p>If the download can't be automated, because the user
12337: must submit personal information to apply for a
12338: password, or must pay for the source, or whatever, you
1.14 xtraeme 12339: can set <code class="varname">_FETCH_MESSAGE</code> to
12340: a macro which displays a message explaining the
12341: situation. <code class="varname">_FETCH_MESSAGE</code>
12342: must be executable shell commands, not just a message.
12343: (Generally, it executes <code class=
12344: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 12345: following packages use this: <a xmlns=
12346: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12347: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 12348: target="_top"><code xmlns="" class=
12349: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 12350: "http://www.w3.org/TR/xhtml1/transitional" href=
12351: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 12352: target="_top"><code xmlns="" class=
12353: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 12354: "http://www.w3.org/TR/xhtml1/transitional" href=
12355: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 12356: target="_top"><code xmlns="" class=
12357: "filename">emulators/vmware-module</code></a>,
12358: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12359: href=
1.20 ben 12360: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 12361: target="_top"><code xmlns="" class=
12362: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 12363: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 12364: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 12365: target="_top"><code xmlns="" class=
12366: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 12367: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12368: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 12369: target="_top"><code xmlns="" class=
12370: "filename">sysutils/storage-manager</code></a>,
12371: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12372: href=
1.20 ben 12373: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 12374: target="_top"><code xmlns="" class=
12375: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 12376: "http://www.w3.org/TR/xhtml1/transitional" href=
12377: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 12378: target="_top"><code xmlns="" class=
12379: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 12380: with them.</p>
1.1 grant 12381: </div>
12382:
1.55 rillig 12383: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12384: <div class="titlepage">
12385: <div>
12386: <div>
1.30 wiz 12387: <h3 class="title"><a name=
1.55 rillig 12388: "modified-distfiles-same-name" id=
1.38 dillo 12389: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 12390: to handle modified distfiles with the 'old'
12391: name</h3>
1.1 grant 12392: </div>
12393: </div>
12394: </div>
12395:
12396: <p>Sometimes authors of a software package make some
12397: modifications after the software was released, and they
12398: put up a new distfile without changing the package's
12399: version number. If a package is already in pkgsrc at
1.32 wiz 12400: that time, the checksum will no longer match. The
12401: contents of the new distfile should be compared against
12402: the old one before changing anything, to make sure the
12403: distfile was really updated on purpose, and that no
12404: trojan horse or so crept in. Then, the correct way to
12405: work around this is to set <code class=
12406: "varname">DIST_SUBDIR</code> to a unique directory
12407: name, usually based on <code class=
12408: "varname">PKGNAME_NOREV</code>. In case this happens
12409: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12410: used (thus including the <code xmlns=
12411: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12412: "filename">nbX</code> suffix) or a date stamp can be
12413: appended, like <code class=
12414: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12415: forget regenerating the <code xmlns=
12416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12417: "filename">distinfo</code> file after that, since it
12418: contains the <code class="varname">DIST_SUBDIR</code>
12419: path in the filenames. Furthermore, a mail to the
12420: package's authors seems appropriate telling them that
12421: changing distfiles after releases without changing the
12422: file names is not good practice.</p>
1.1 grant 12423: </div>
12424: </div>
12425:
1.55 rillig 12426: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12427: <div class="titlepage">
12428: <div>
12429: <div>
12430: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12431: "configuration-gotchas" id=
1.38 dillo 12432: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 12433: gotchas</h2>
12434: </div>
12435: </div>
12436: </div>
12437:
1.55 rillig 12438: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12439: <div class="titlepage">
12440: <div>
12441: <div>
1.55 rillig 12442: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 12443: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 12444: - libtool</h3>
12445: </div>
12446: </div>
12447: </div>
12448:
12449: <p>pkgsrc supports many different machines, with
12450: different object formats like a.out and ELF, and
12451: varying abilities to do shared library and dynamic
12452: loading at all. To accompany this, varying commands and
12453: options have to be passed to the compiler, linker, etc.
12454: to get the Right Thing, which can be pretty annoying
12455: especially if you don't have all the machines at your
12456: hand to test things. The <a xmlns=
12457: "http://www.w3.org/TR/xhtml1/transitional" href=
12458: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 12459: target="_top"><code xmlns="" class=
12460: "filename">devel/libtool</code></a> pkg can help here,
12461: as it just “<span class=
12462: "quote">knows</span>” how to build both static
12463: and dynamic libraries from a set of source files, thus
1.47 reed 12464: being platform-independent.</p>
1.1 grant 12465:
12466: <p>Here's how to use libtool in a pkg in seven simple
12467: steps:</p>
12468:
12469: <div class="orderedlist">
12470: <ol type="1">
12471: <li>
1.14 xtraeme 12472: <p>Add <code class=
12473: "varname">USE_LIBTOOL=yes</code> to the package
12474: Makefile.</p>
1.1 grant 12475: </li>
12476:
12477: <li>
12478: <p>For library objects, use “<span class=
12479: "quote">${LIBTOOL} --mode=compile
12480: ${CC}</span>” in place of
12481: “<span class="quote">${CC}</span>”.
12482: You could even add it to the definition of
1.14 xtraeme 12483: <code class="varname">CC</code>, if only
12484: libraries are being built in a given Makefile.
12485: This one command will build both PIC and non-PIC
12486: library objects, so you need not have separate
12487: shared and non-shared library rules.</p>
1.1 grant 12488: </li>
12489:
12490: <li>
12491: <p>For the linking of the library, remove any
12492: “<span class="quote">ar</span>”,
12493: “<span class="quote">ranlib</span>”,
12494: and “<span class="quote">ld
12495: -Bshareable</span>” commands, and instead
12496: use:</p>
12497: <pre class="programlisting">
1.51 rillig 12498: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12499: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12500: </pre>
12501:
12502: <p>Note that the library is changed to have a
1.45 wiz 12503: <code xmlns=
12504: "http://www.w3.org/TR/xhtml1/transitional" class=
12505: "filename">.la</code> extension, and the objects
12506: are changed to have a <code xmlns=
12507: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12508: "filename">.lo</code> extension. Change
12509: <code class="varname">OBJS</code> as necessary.
12510: This automatically creates all of the
1.45 wiz 12511: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12512: class="filename">.a</code>, <code xmlns=
12513: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12514: "filename">.so.major.minor</code>, and ELF
12515: symlinks (if necessary) in the build directory.
12516: Be sure to include “<span class=
1.1 grant 12517: "quote">-version-info</span>”, especially
12518: when major and minor are zero, as libtool will
12519: otherwise strip off the shared library
12520: version.</p>
12521:
12522: <p>From the libtool manual:</p>
12523: <pre class="programlisting">
1.51 rillig 12524: So, libtool library versions are described by three integers:
1.1 grant 12525:
1.51 rillig 12526: CURRENT
12527: The most recent interface number that this library implements.
1.1 grant 12528:
1.51 rillig 12529: REVISION
12530: The implementation number of the CURRENT interface.
1.1 grant 12531:
1.51 rillig 12532: AGE
12533: The difference between the newest and oldest interfaces that
12534: this library implements. In other words, the library implements
12535: all the interface numbers in the range from number `CURRENT -
12536: AGE' to `CURRENT'.
1.1 grant 12537:
1.51 rillig 12538: If two libraries have identical CURRENT and AGE numbers, then the
12539: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12540: </pre>
12541:
12542: <p>The “<span class=
12543: "quote">-release</span>” option will
12544: produce different results for a.out and ELF
12545: (excluding symlinks) in only one case. An ELF
12546: library of the form “<span class=
12547: "quote">libfoo-release.so.<span class=
12548: "emphasis"><em>x</em></span>.<span class=
12549: "emphasis"><em>y</em></span></span>” will
12550: have a symlink of “<span class=
12551: "quote">libfoo.so.<span class=
12552: "emphasis"><em>x</em></span>.<span class=
12553: "emphasis"><em>y</em></span></span>” on an
12554: a.out platform. This is handled
12555: automatically.</p>
12556:
12557: <p>The “<span class="quote">-rpath
12558: argument</span>” is the install directory
12559: of the library being built.</p>
12560:
1.45 wiz 12561: <p>In the <code xmlns=
12562: "http://www.w3.org/TR/xhtml1/transitional" class=
12563: "filename">PLIST</code>, include only the
12564: <code xmlns=
12565: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12566: "filename">.la</code> file, the other files will
12567: be added automatically.</p>
1.1 grant 12568: </li>
12569:
12570: <li>
1.45 wiz 12571: <p>When linking shared object (<code xmlns=
12572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12573: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12574: loaded via <a href=
12575: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12576: <span class="citerefentry"><span class=
12577: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12578: shared libraries, use “<span class=
12579: "quote">-module -avoid-version</span>” to
12580: prevent them getting version tacked on.</p>
1.1 grant 12581:
1.45 wiz 12582: <p>The <code xmlns=
12583: "http://www.w3.org/TR/xhtml1/transitional" class=
12584: "filename">PLIST</code> file gets the
12585: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12586: class="filename">foo.so</code> entry.</p>
1.1 grant 12587: </li>
12588:
12589: <li>
12590: <p>When linking programs that depend on these
12591: libraries <span class=
12592: "emphasis"><em>before</em></span> they are
12593: installed, preface the <a href=
12594: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12595: <span class="citerefentry"><span class=
12596: "refentrytitle">cc</span>(1)</span></a> or
12597: <a href=
12598: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12599: <span class="citerefentry"><span class=
12600: "refentrytitle">ld</span>(1)</span></a> line with
12601: “<span class="quote">${LIBTOOL}
12602: --mode=link</span>”, and it will find the
12603: correct libraries (static or shared), but please
12604: be aware that libtool will not allow you to
12605: specify a relative path in -L (such as
12606: “<span class=
12607: "quote">-L../somelib</span>”), because it
12608: expects you to change that argument to be the
1.45 wiz 12609: <code xmlns=
12610: "http://www.w3.org/TR/xhtml1/transitional" class=
12611: "filename">.la</code> file. e.g.</p>
1.1 grant 12612: <pre class="programlisting">
1.51 rillig 12613: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12614: </pre>
12615:
12616: <p>should be changed to:</p>
12617: <pre class="programlisting">
1.51 rillig 12618: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12619: "replaceable"><code>someprog</code></em> <em class=
12620: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12621: </pre>
12622:
12623: <p>and it will do the right thing with the
12624: libraries.</p>
12625: </li>
12626:
12627: <li>
12628: <p>When installing libraries, preface the
12629: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12630: <span class="citerefentry"><span class=
12631: "refentrytitle">install</span>(1)</span></a> or
12632: <a href=
12633: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12634: <span class="citerefentry"><span class=
12635: "refentrytitle">cp</span>(1)</span></a> command
12636: with “<span class="quote">${LIBTOOL}
12637: --mode=install</span>”, and change the
1.45 wiz 12638: library name to <code xmlns=
12639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12640: "filename">.la</code>. e.g.</p>
1.1 grant 12641: <pre class="programlisting">
1.51 rillig 12642: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12643: </pre>
12644:
1.45 wiz 12645: <p>This will install the static <code xmlns=
12646: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12647: "filename">.a</code>, shared library, any needed
1.1 grant 12648: symlinks, and run <a href=
12649: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12650: <span class="citerefentry"><span class=
12651: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12652: </li>
12653:
12654: <li>
1.45 wiz 12655: <p>In your <code xmlns=
12656: "http://www.w3.org/TR/xhtml1/transitional" class=
12657: "filename">PLIST</code>, include only the
12658: <code xmlns=
12659: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12660: "filename">.la</code> file (this is a change from
12661: previous behaviour).</p>
1.1 grant 12662: </li>
12663: </ol>
12664: </div>
12665: </div>
12666:
1.55 rillig 12667: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12668: <div class="titlepage">
12669: <div>
12670: <div>
1.55 rillig 12671: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12672: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12673: GNU packages that already support libtool</h3>
1.1 grant 12674: </div>
12675: </div>
12676: </div>
12677:
1.14 xtraeme 12678: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12679: the package Makefile. This will override the package's
12680: own libtool in most cases. For older libtool using
1.1 grant 12681: packages, libtool is made by ltconfig script during the
12682: do-configure step; you can check the libtool script
1.14 xtraeme 12683: location by doing <span><strong class="command">make
12684: configure; find work*/ -name
12685: libtool</strong></span>.</p>
12686:
12687: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12688: specifies which libtool scripts, relative to
12689: <code class="varname">WRKSRC</code>, to override. By
12690: default, it is set to “<span class=
12691: "quote">libtool */libtool */*/libtool</span>”. If
12692: this does not match the location of the package's
12693: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12694:
1.45 wiz 12695: <p>If you do not need <code xmlns=
12696: "http://www.w3.org/TR/xhtml1/transitional" class=
12697: "filename">*.a</code> static libraries built and
12698: installed, then use <code class=
12699: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12700:
1.47 reed 12701: <p>If your package makes use of the
12702: platform-independent library for loading dynamic shared
12703: objects, that comes with libtool (libltdl), you should
12704: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12705:
12706: <p>Some packages use libtool incorrectly so that the
12707: package may not work or build in some circumstances.
12708: Some of the more common errors are:</p>
12709:
12710: <div class="itemizedlist">
12711: <ul type="disc">
12712: <li>
12713: <p>The inclusion of a shared object (-module) as
12714: a dependent library in an executable or library.
12715: This in itself isn't a problem if one of two
12716: things has been done:</p>
12717:
12718: <div class="orderedlist">
12719: <ol type="1">
12720: <li>
12721: <p>The shared object is named correctly,
1.45 wiz 12722: i.e. <code xmlns=
12723: "http://www.w3.org/TR/xhtml1/transitional"
12724: class="filename">libfoo.la</code>, not
12725: <code xmlns=
12726: "http://www.w3.org/TR/xhtml1/transitional"
12727: class="filename">foo.la</code></p>
1.1 grant 12728: </li>
12729:
12730: <li>
12731: <p>The -dlopen option is used when linking
12732: an executable.</p>
12733: </li>
12734: </ol>
12735: </div>
12736: </li>
12737:
12738: <li>
12739: <p>The use of libltdl without the correct calls
12740: to initialisation routines. The function
12741: lt_dlinit() should be called and the macro
1.14 xtraeme 12742: <code class=
12743: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12744: included in executables.</p>
12745: </li>
12746: </ul>
12747: </div>
12748: </div>
12749:
1.55 rillig 12750: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12751: <div class="titlepage">
12752: <div>
12753: <div>
1.55 rillig 12754: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12755: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12756: Autoconf/Automake</h3>
12757: </div>
12758: </div>
12759: </div>
12760:
12761: <p>If a package needs GNU autoconf or automake to be
12762: executed to regenerate the configure script and
12763: Makefile.in makefile templates, then they should be
1.35 jmmv 12764: executed in a pre-configure target.</p>
1.1 grant 12765:
12766: <p>For packages that need only autoconf:</p>
12767: <pre class="programlisting">
1.51 rillig 12768: AUTOCONF_REQD= 2.50 # if default version is not good enough
12769: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12770: ...
1.1 grant 12771:
1.51 rillig 12772: pre-configure:
12773: cd ${WRKSRC}; autoconf
1.1 grant 12774:
1.51 rillig 12775: ...
1.1 grant 12776: </pre>
12777:
12778: <p>and for packages that need automake and
12779: autoconf:</p>
12780: <pre class="programlisting">
1.51 rillig 12781: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12782: USE_TOOLS+= automake # use "automake14" for automake-1.4
12783: ...
1.1 grant 12784:
1.51 rillig 12785: pre-configure:
12786: cd ${WRKSRC}; \
12787: aclocal; autoheader; \
12788: automake -a --foreign -i; autoconf
12789:
12790: ...
1.1 grant 12791: </pre>
12792:
12793: <p>Packages which use GNU Automake will almost
1.35 jmmv 12794: certainly require GNU Make.</p>
1.1 grant 12795:
12796: <p>There are times when the configure process makes
12797: additional changes to the generated files, which then
12798: causes the build process to try to re-execute the
12799: automake sequence. This is prevented by touching
12800: various files in the configure stage. If this causes
1.14 xtraeme 12801: problems with your package you can set <code class=
12802: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12803: Makefile.</p>
12804: </div>
12805: </div>
12806:
1.55 rillig 12807: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12808: <div class="titlepage">
12809: <div>
12810: <div>
12811: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12812: "fixes-build" id=
12813: "fixes-build"></a>15.4. Building the
12814: package</h2>
1.1 grant 12815: </div>
12816: </div>
12817: </div>
12818:
1.55 rillig 12819: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12820: <div class="titlepage">
12821: <div>
12822: <div>
1.55 rillig 12823: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12824: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12825: </div>
12826: </div>
12827: </div>
12828:
1.55 rillig 12829: <p>Sometimes you need to compile different code
12830: depending on the target platform. The C preprocessor
12831: has a set of predefined macros that can be queried by
12832: using <code class="varname">#ifdef FOO</code> or
12833: <code class="varname">#if defined(FOO)</code>. Among
12834: these macros are usually ones that describe the target
12835: CPU and operating system. Depending of which of the
12836: macros are defined, you can write code that uses
12837: features unique to a specific platform. The best way to
12838: handle these differences is to use the GNU autotools
12839: (automake, autoconf, etc.) to check for specific
12840: features (like the existence of a header file, a
12841: function or a library).</p>
12842:
12843: <p>If that is not possible you can use the predefined
12844: macros below to configure your code to the platform it
12845: runs on. Almost every operating system, hardware
12846: architecture and compiler has its own macro. For
12847: example, if the macros <code class=
12848: "varname">__GNUC__</code>, <code class=
12849: "varname">__i386__</code> and <code class=
12850: "varname">__NetBSD__</code> are all defined, you know
12851: that you are using NetBSD on an Intel CPU, and your
12852: compiler is GCC.</p>
12853:
12854: <div class="sect3" lang="en" xml:lang="en">
12855: <div class="titlepage">
12856: <div>
12857: <div>
12858: <h4 class="title"><a name=
12859: "fixes-build-cpp-opsys" id=
12860: "fixes-build-cpp-opsys"></a>15.4.1.1. CPP
12861: defines for operating systems</h4>
12862: </div>
12863: </div>
12864: </div>
12865:
12866: <p>To distinguish between 4.4 BSD-derived systems and
12867: the rest of the world, you should use the following
12868: code.</p>
12869: <pre class="programlisting">
1.51 rillig 12870: #include <sys/param.h>
1.55 rillig 12871: #if (defined(BSD) && BSD >= 199306)
12872: /* your BSD-specific code goes here */
12873: #else
12874: /* non-BSD-specific code */
12875: #endif
1.1 grant 12876: </pre>
12877:
1.55 rillig 12878: <p>If this distinction is not fine enough, you can
12879: also use the following defines.</p>
12880: <pre class="programlisting">
12881: FreeBSD __FreeBSD__
1.56 ! rillig 12882: DragonFly __DragonFly__
1.55 rillig 12883: Linux linux, __linux, __linux__
12884: NetBSD __NetBSD__
12885: OpenBSD __OpenBSD__
12886: Solaris sun, __sun (GCC and SunPro), __sun__ (only GCC)
1.1 grant 12887: </pre>
1.55 rillig 12888: </div>
1.1 grant 12889:
1.55 rillig 12890: <div class="sect3" lang="en" xml:lang="en">
12891: <div class="titlepage">
12892: <div>
12893: <div>
12894: <h4 class="title"><a name="fixes-build-cpp-cpu"
12895: id="fixes-build-cpp-cpu"></a>15.4.1.2. CPP
12896: defines for CPUs</h4>
12897: </div>
12898: </div>
12899: </div>
12900: <pre class="programlisting">
12901: i386 i386, __i386, __i386__
12902: MIPS __mips
12903: SPARC sparc, __sparc
12904: </pre>
12905: </div>
12906:
12907: <div class="sect3" lang="en" xml:lang="en">
12908: <div class="titlepage">
12909: <div>
12910: <div>
12911: <h4 class="title"><a name=
12912: "fixes-build-cpp-compiler" id=
12913: "fixes-build-cpp-compiler"></a>15.4.1.3. CPP
12914: defines for compilers</h4>
12915: </div>
12916: </div>
12917: </div>
12918: <pre class="programlisting">
12919: GCC __GNUC__ (major version), __GNUC_MINOR__
12920: </pre>
12921: </div>
1.1 grant 12922: </div>
1.51 rillig 12923:
1.55 rillig 12924: <div class="sect2" lang="en" xml:lang="en">
1.51 rillig 12925: <div class="titlepage">
12926: <div>
12927: <div>
1.55 rillig 12928: <h3 class="title"><a name="cpp-list" id=
1.51 rillig 12929: "cpp-list"></a>15.4.2. Getting a list of CPP
12930: defines</h3>
12931: </div>
12932: </div>
12933: </div>
12934:
12935: <p>When your system uses the GNU C Compiler, you can
12936: get a list of symbols that are defined by default, e.g.
12937: to identify the platform, with the following
12938: command:</p>
12939: <pre class="programlisting">
12940: gcc -E -dM - < /dev/null
12941: </pre>
12942: </div>
1.1 grant 12943: </div>
12944:
1.55 rillig 12945: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12946: <div class="titlepage">
12947: <div>
12948: <div>
12949: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12950: "package-specific-actions" id=
1.38 dillo 12951: "package-specific-actions"></a>15.5. Package
1.1 grant 12952: specific actions</h2>
12953: </div>
12954: </div>
12955: </div>
12956:
1.55 rillig 12957: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12958: <div class="titlepage">
12959: <div>
12960: <div>
1.55 rillig 12961: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 12962: "user-interaction"></a>15.5.1. User
1.2 hubertf 12963: interaction</h3>
1.1 grant 12964: </div>
12965: </div>
12966: </div>
12967:
12968: <p>Occasionally, packages require interaction from the
12969: user, and this can be in a number of ways:</p>
12970:
12971: <div class="itemizedlist">
12972: <ul type="disc">
12973: <li>
12974: <p>help in fetching the distfiles</p>
12975: </li>
12976:
12977: <li>
12978: <p>help to configure the package before it is
12979: built</p>
12980: </li>
12981:
12982: <li>
12983: <p>help during the build process</p>
12984: </li>
12985:
12986: <li>
12987: <p>help during the installation of a package</p>
12988: </li>
12989: </ul>
12990: </div>
12991:
1.14 xtraeme 12992: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12993: definition is provided to notify the pkgsrc mechanism
12994: of an interactive stage which will be needed, and this
1.45 wiz 12995: should be set in the package's <code xmlns=
12996: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12997: "filename">Makefile</code>, e.g.:</p>
1.1 grant 12998: <pre class="programlisting">
1.51 rillig 12999: INTERACTIVE_STAGE= build
1.1 grant 13000: </pre>
13001:
13002: <p>Multiple interactive stages can be specified:</p>
13003: <pre class="programlisting">
1.51 rillig 13004: INTERACTIVE_STAGE= configure install
1.1 grant 13005: </pre>
13006: </div>
13007:
1.55 rillig 13008: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13009: <div class="titlepage">
13010: <div>
13011: <div>
1.55 rillig 13012: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 13013: "handling-licenses"></a>15.5.2. Handling
1.1 grant 13014: licenses</h3>
13015: </div>
13016: </div>
13017: </div>
13018:
1.44 gdt 13019: <p>A package may be covered by a license which the user
13020: has or has not agreed to accept. For these cases,
13021: pkgsrc contains a mechanism to note that a package is
13022: covered by a particular license, and the package cannot
13023: be built unless the user has accepted the license.
13024: (Installation of binary packages are not currently
13025: subject to this mechanism.) Packages with licenses that
13026: are either Open Source according to the Open Source
13027: Initiative or Free according to the Free Software
13028: Foundation will not be marked with a license tag.
13029: Packages with licenses that have not been determined to
13030: meet either definition will be marked with a license
13031: tag referring to the license. This will prevent
13032: building unless pkgsrc is informed that the license is
13033: acceptable, and enables displaying the license.</p>
13034:
13035: <p>The license tag mechanism is intended to address
13036: copyright-related issues surrounding building,
13037: installing and using a package, and not to address
13038: redistribution issues (see <code class=
13039: "varname">RESTRICTED</code> and <code class=
13040: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13041: above definition of licenses for which tags are not
13042: needed implies that packages with redistribution
13043: restrictions should have tags.</p>
13044:
13045: <p>Denoting that a package is covered by a particular
1.45 wiz 13046: license is done by placing the license in <code xmlns=
13047: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13048: "filename">pkgsrc/licenses</code> and setting the
13049: <code class="varname">LICENSE</code> variable to a
13050: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13051: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13052: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13053: target="_top"><code xmlns="" class=
13054: "filename">graphics/xv</code></a>:</p>
1.1 grant 13055: <pre class="programlisting">
1.51 rillig 13056: LICENSE= xv-license
1.1 grant 13057: </pre>
13058:
13059: <p>When trying to build, the user will get a notice
1.44 gdt 13060: that the package is covered by a license which has not
13061: been accepted:</p>
1.1 grant 13062: <pre class="programlisting">
1.51 rillig 13063: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13064: "userinput"><code>make</code></strong>
1.51 rillig 13065: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13066: ===> To view the license, enter "/usr/bin/make show-license".
13067: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13068: ===> ACCEPTABLE_LICENSES+=xv-license
13069: *** Error code 1
1.1 grant 13070: </pre>
13071:
1.14 xtraeme 13072: <p>The license can be viewed with <span><strong class=
13073: "command">make show-license</strong></span>, and if it
13074: is considered appropriate, the line printed above can
1.45 wiz 13075: be added to <code xmlns=
13076: "http://www.w3.org/TR/xhtml1/transitional" class=
13077: "filename">/etc/mk.conf</code> to indicate acceptance
13078: of the particular license:</p>
1.1 grant 13079: <pre class="programlisting">
1.51 rillig 13080: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13081: </pre>
13082:
13083: <p>When adding a package with a new license, the
1.45 wiz 13084: license text should be added to <code xmlns=
13085: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13086: "filename">pkgsrc/licenses</code> for displaying. A
13087: list of known licenses can be seen in this directory as
13088: well as by looking at the list of (commented out)
13089: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13090: variable settings in <code xmlns=
13091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13092: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13093:
1.44 gdt 13094: <p>The use of <code class=
13095: "varname">LICENSE=shareware</code>, <code class=
13096: "varname">LICENSE=no-commercial-use</code>, and similar
13097: language is deprecated because it does not crisply
13098: refer to a particular license text. Another problem
13099: with such usage is that it does not enable a user to
13100: denote acceptance of the license for a single package
13101: without accepting the same license text for another
13102: package. In particular, this can be inappropriate when
13103: e.g. one accepts a particular license to indicate to
13104: pkgsrc that a fee has been paid.</p>
1.1 grant 13105: </div>
13106:
1.55 rillig 13107: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13108: <div class="titlepage">
13109: <div>
13110: <div>
1.30 wiz 13111: <h3 class="title"><a name=
1.55 rillig 13112: "installing-score-files" id=
1.38 dillo 13113: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 13114: score files</h3>
1.1 grant 13115: </div>
13116: </div>
13117: </div>
13118:
13119: <p>Certain packages, most of them in the games
13120: category, install a score file that allows all users on
13121: the system to record their highscores. In order for
13122: this to work, the binaries need to be installed setgid
13123: and the score files owned by the appropriate group
13124: and/or owner (traditionally the "games" user/group).
13125: The following variables, documented in more detail in
1.45 wiz 13126: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13127: class="filename">mk/defaults/mk.conf</code>, control
13128: this behaviour: <code class=
1.14 xtraeme 13129: "varname">SETGIDGAME</code>, <code class=
13130: "varname">GAMEDATAMODE</code>, <code class=
13131: "varname">GAMEGRP</code>, <code class=
13132: "varname">GAMEMODE</code>, <code class=
13133: "varname">GAMEOWN</code>.</p>
1.1 grant 13134:
13135: <p>Note that per default, setgid installation of games
1.14 xtraeme 13136: is disabled; setting <code class=
13137: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13138: variables accordingly.</p>
13139:
13140: <p>A package should therefor never hard code file
1.14 xtraeme 13141: ownership or access permissions but rely on
13142: <code class="varname">INSTALL_GAME</code> and
13143: <code class="varname">INSTALL_GAME_DATA</code> to set
13144: these correctly.</p>
1.1 grant 13145: </div>
13146:
1.55 rillig 13147: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13148: <div class="titlepage">
13149: <div>
13150: <div>
1.55 rillig 13151: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 13152: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 13153: containing perl scripts</h3>
1.1 grant 13154: </div>
13155: </div>
13156: </div>
13157:
13158: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13159: set <code class="varname">REPLACE_PERL</code> to ensure
13160: that the proper interpreter path is set. <code class=
13161: "varname">REPLACE_PERL</code> should contain a list of
13162: scripts, relative to <code class=
13163: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 13164: </div>
13165:
1.55 rillig 13166: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13167: <div class="titlepage">
13168: <div>
13169: <div>
1.55 rillig 13170: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 13171: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 13172: hardcoded paths to other interpreters</h3>
13173: </div>
13174: </div>
13175: </div>
13176:
13177: <p>Your package may also contain scripts with hardcoded
13178: paths to other interpreters besides (or as well as)
13179: perl. To correct the full pathname to the script
13180: interpreter, you need to set the following definitions
1.45 wiz 13181: in your <code xmlns=
13182: "http://www.w3.org/TR/xhtml1/transitional" class=
13183: "filename">Makefile</code> (we shall use
13184: <span><strong class="command">tclsh</strong></span> in
13185: this example):</p>
1.1 grant 13186: <pre class="programlisting">
1.51 rillig 13187: REPLACE_INTERPRETER+= tcl
13188: _REPLACE.tcl.old= .*/bin/tclsh
13189: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
13190: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
13191: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 13192: </pre>
13193: </div>
13194:
1.55 rillig 13195: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13196: <div class="titlepage">
13197: <div>
13198: <div>
1.55 rillig 13199: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 13200: "perl-modules"></a>15.5.6. Packages
1.30 wiz 13201: installing perl modules</h3>
1.1 grant 13202: </div>
13203: </div>
13204: </div>
13205:
13206: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 13207: include the Makefile fragment <code xmlns=
13208: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13209: "filename">../../lang/perl5/module.mk</code>. It
13210: provides a <span><strong class=
13211: "command">do-configure</strong></span> target for the
13212: standard perl configuration for such modules as well as
13213: various hooks to tune this configuration. See comments
13214: in this file for details.</p>
1.1 grant 13215:
13216: <p>Perl5 modules will install into different places
13217: depending on the version of perl used during the build
13218: process. To address this, pkgsrc will append lines to
1.45 wiz 13219: the <code xmlns=
13220: "http://www.w3.org/TR/xhtml1/transitional" class=
13221: "filename">PLIST</code> corresponding to the files
13222: listed in the installed <code xmlns=
13223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13224: "filename">.packlist</code> file generated by most
13225: perl5 modules. This is invoked by defining <code class=
13226: "varname">PERL5_PACKLIST</code> to a space-separated
13227: list of paths to packlist files, e.g.:</p>
1.1 grant 13228: <pre class="programlisting">
1.51 rillig 13229: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 13230: </pre>
13231:
1.14 xtraeme 13232: <p>The variables <code class=
13233: "varname">PERL5_SITELIB</code>, <code class=
13234: "varname">PERL5_SITEARCH</code>, and <code class=
13235: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 13236: locations in which perl5 modules may be installed, and
13237: may be used by perl5 packages that don't have a
13238: packlist. These three variables are also substituted
1.45 wiz 13239: for in the <code xmlns=
13240: "http://www.w3.org/TR/xhtml1/transitional" class=
13241: "filename">PLIST</code>.</p>
1.1 grant 13242: </div>
13243:
1.55 rillig 13244: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13245: <div class="titlepage">
13246: <div>
13247: <div>
1.55 rillig 13248: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 13249: "faq.info-files"></a>15.5.7. Packages
1.1 grant 13250: installing info files</h3>
13251: </div>
13252: </div>
13253: </div>
13254:
13255: <p>Some packages install info files or use the
13256: “<span class="quote">makeinfo</span>” or
13257: “<span class="quote">install-info</span>”
13258: commands. Each of the info files:</p>
13259:
13260: <div class="itemizedlist">
13261: <ul type="disc">
13262: <li>
13263: <p>is considered to be installed in the directory
1.45 wiz 13264: <code xmlns=
13265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13266: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 13267: </li>
13268:
13269: <li>
13270: <p>is registered in the Info directory file
1.45 wiz 13271: <code xmlns=
13272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13273: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 13274: </li>
13275:
13276: <li>
13277: <p>and must be listed as a filename in the
1.14 xtraeme 13278: <code class="varname">INFO_FILES</code> variable
13279: in the package Makefile.</p>
1.1 grant 13280: </li>
13281: </ul>
13282: </div>
13283:
1.14 xtraeme 13284: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 13285: “<span class="quote">info</span>” and can
1.45 wiz 13286: be overridden in the package Makefile. <code xmlns=
13287: "http://www.w3.org/TR/xhtml1/transitional" class=
13288: "filename">INSTALL</code> and <code xmlns=
13289: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13290: "filename">DEINSTALL</code> scripts will be generated
13291: to handle registration of the info files in the Info
1.1 grant 13292: directory file. The “<span class=
13293: "quote">install-info</span>” command used for the
13294: info files registration is either provided by the
13295: system, or by a special purpose package automatically
13296: added as dependency if needed.</p>
13297:
13298: <p>A package which needs the “<span class=
13299: "quote">makeinfo</span>” command at build time
1.14 xtraeme 13300: must define the variable <code class=
13301: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 13302: minimum version of the “<span class=
13303: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 13304: should be noted with the <code class=
13305: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 13306: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13307: class="filename">Makefile</code>. By default, a minimum
13308: version of 3.12 is required. If the system does not
13309: provide a <span><strong class=
1.14 xtraeme 13310: "command">makeinfo</strong></span> command or if it
13311: does not match the required minimum, a build dependency
13312: on the <a xmlns=
13313: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 13314: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 13315: target="_top"><code xmlns="" class=
13316: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 13317: added automatically.</p>
1.1 grant 13318:
13319: <p>The build and installation process of the software
13320: provided by the package should not use the
1.14 xtraeme 13321: <span><strong class=
13322: "command">install-info</strong></span> command as the
13323: registration of info files is the task of the package
1.45 wiz 13324: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13325: class="filename">INSTALL</code> script, and it must use
13326: the appropriate <span><strong class=
1.14 xtraeme 13327: "command">makeinfo</strong></span> command.</p>
1.1 grant 13328:
1.47 reed 13329: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 13330: creates overriding scripts for the <span><strong class=
13331: "command">install-info</strong></span> and
13332: <span><strong class="command">makeinfo</strong></span>
13333: commands in a directory listed early in <code class=
13334: "varname">PATH</code>.</p>
1.1 grant 13335:
1.14 xtraeme 13336: <p>The script overriding <span><strong class=
13337: "command">install-info</strong></span> has no effect
13338: except the logging of a message. The script overriding
13339: <span><strong class="command">makeinfo</strong></span>
13340: logs a message and according to the value of
13341: <code class="varname">USE_MAKEINFO</code> and
13342: <code class="varname">TEXINFO_REQD</code> either run
13343: the appropriate <span><strong class=
13344: "command">makeinfo</strong></span> command or exit on
13345: error.</p>
1.1 grant 13346: </div>
13347:
1.55 rillig 13348: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13349: <div class="titlepage">
13350: <div>
13351: <div>
1.55 rillig 13352: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 13353: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 13354: installing GConf2 data files</h3>
1.1 grant 13355: </div>
13356: </div>
13357: </div>
13358:
1.45 wiz 13359: <p>If a package installs <code xmlns=
13360: "http://www.w3.org/TR/xhtml1/transitional" class=
13361: "filename">.schemas</code> or <code xmlns=
13362: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13363: "filename">.entries</code> files, used by GConf2, you
1.1 grant 13364: need to take some extra steps to make sure they get
13365: registered in the database:</p>
13366:
13367: <div class="orderedlist">
13368: <ol type="1">
13369: <li>
1.45 wiz 13370: <p>Include <code xmlns=
13371: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13372: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 13373: instead of its <code xmlns=
13374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13375: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13376: care of rebuilding the GConf2 database at
13377: installation and deinstallation time, and tells
13378: the package where to install GConf2 data files
13379: using some standard configure arguments. It also
13380: disallows any access to the database directly
13381: from the package.</p>
13382: </li>
13383:
13384: <li>
13385: <p>Ensure that the package installs its
1.45 wiz 13386: <code xmlns=
13387: "http://www.w3.org/TR/xhtml1/transitional" class=
13388: "filename">.schemas</code> files under
13389: <code xmlns=
13390: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13391: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 13392: If they get installed under <code xmlns=
13393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13394: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 13395: manually patch the package.</p>
13396: </li>
13397:
13398: <li>
13399: <p>Check the PLIST and remove any entries under
13400: the etc/gconf directory, as they will be handled
13401: automatically. See <a href="#faq.conf" title=
1.38 dillo 13402: "7.14. How do I change the location of configuration files?">
13403: Section 7.14, “How do I change the
1.35 jmmv 13404: location of configuration files?”</a> for
13405: more information.</p>
1.1 grant 13406: </li>
13407:
13408: <li>
1.14 xtraeme 13409: <p>Define the <code class=
13410: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 13411: <code xmlns=
13412: "http://www.w3.org/TR/xhtml1/transitional" class=
13413: "filename">Makefile</code> with a list of all
13414: <code xmlns=
13415: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13416: "filename">.schemas</code> files installed by the
13417: package, if any. Names must not contain any
13418: directories in them.</p>
1.1 grant 13419: </li>
13420:
13421: <li>
1.14 xtraeme 13422: <p>Define the <code class=
13423: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 13424: <code xmlns=
13425: "http://www.w3.org/TR/xhtml1/transitional" class=
13426: "filename">Makefile</code> with a list of all
13427: <code xmlns=
13428: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13429: "filename">.entries</code> files installed by the
13430: package, if any. Names must not contain any
13431: directories in them.</p>
1.1 grant 13432: </li>
13433: </ol>
13434: </div>
13435: </div>
13436:
1.55 rillig 13437: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13438: <div class="titlepage">
13439: <div>
13440: <div>
1.30 wiz 13441: <h3 class="title"><a name=
1.55 rillig 13442: "scrollkeeper-data-files" id=
1.38 dillo 13443: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 13444: installing scrollkeeper data files</h3>
1.1 grant 13445: </div>
13446: </div>
13447: </div>
13448:
1.45 wiz 13449: <p>If a package installs <code xmlns=
13450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13451: "filename">.omf</code> files, used by scrollkeeper, you
13452: need to take some extra steps to make sure they get
13453: registered in the database:</p>
1.1 grant 13454:
13455: <div class="orderedlist">
13456: <ol type="1">
13457: <li>
1.45 wiz 13458: <p>Include <code xmlns=
13459: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13460: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 13461: instead of its <code xmlns=
13462: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13463: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13464: care of rebuilding the scrollkeeper database at
13465: installation and deinstallation time, and
13466: disallows any access to it directly from the
13467: package.</p>
13468: </li>
13469:
13470: <li>
13471: <p>Check the PLIST and remove any entries under
1.45 wiz 13472: the <code xmlns=
13473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13474: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 13475: as they will be handled automatically.</p>
13476: </li>
13477:
13478: <li>
1.45 wiz 13479: <p>Remove the <code xmlns=
13480: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13481: "filename">share/omf</code> directory from the
13482: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 13483: </li>
13484: </ol>
13485: </div>
13486: </div>
13487:
1.55 rillig 13488: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13489: <div class="titlepage">
13490: <div>
13491: <div>
1.55 rillig 13492: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 13493: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 13494: X11 fonts</h3>
13495: </div>
13496: </div>
13497: </div>
13498:
13499: <p>If a package installs font files, you will need to
13500: rebuild the fonts database in the directory where they
13501: get installed at installation and deinstallation time.
1.45 wiz 13502: This can be automatically done by using <code xmlns=
13503: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13504: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 13505: include in your <code xmlns=
13506: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13507: "filename">Makefile</code>.</p>
1.1 grant 13508:
13509: <p>When the file is included, you can list the
1.14 xtraeme 13510: directories where fonts are installed in the
13511: <code class="varname">FONTS_<em class=
13512: "replaceable"><code>type</code></em>_DIRS</code>
13513: variables, where <em class=
13514: "replaceable"><code>type</code></em> can be one of
13515: “<span class="quote">TTF</span>”,
1.1 grant 13516: “<span class="quote">TYPE1</span>” or
13517: “<span class="quote">X11</span>”. Also make
1.45 wiz 13518: sure that the database file <code xmlns=
13519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13520: "filename">fonts.dir</code> is not listed in the
1.1 grant 13521: PLIST.</p>
13522:
13523: <p>Note that you should not create new directories for
13524: fonts; instead use the standard ones to avoid that the
13525: user needs to manually configure his X server to find
13526: them.</p>
13527: </div>
13528:
1.55 rillig 13529: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13530: <div class="titlepage">
13531: <div>
13532: <div>
1.55 rillig 13533: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 13534: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 13535: installing GTK2 modules</h3>
1.1 grant 13536: </div>
13537: </div>
13538: </div>
13539:
1.47 reed 13540: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 13541: need to take some extra steps to get them registered in
13542: the GTK2 database properly:</p>
13543:
13544: <div class="orderedlist">
13545: <ol type="1">
13546: <li>
1.45 wiz 13547: <p>Include <code xmlns=
13548: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13549: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13550: instead of its <code xmlns=
13551: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13552: "filename">buildlink3.mk</code> file. This takes
13553: care of rebuilding the database at installation
13554: and deinstallation time.</p>
1.1 grant 13555: </li>
13556:
13557: <li>
1.14 xtraeme 13558: <p>Set <code class=
13559: "varname">GTK2_IMMODULES=YES</code> if your
13560: package installs GTK2 immodules.</p>
1.1 grant 13561: </li>
13562:
13563: <li>
1.14 xtraeme 13564: <p>Set <code class=
13565: "varname">GTK2_LOADERS=YES</code> if your package
13566: installs GTK2 loaders.</p>
1.1 grant 13567: </li>
13568:
13569: <li>
1.47 reed 13570: <p>Patch the package to not touch any of the GTK2
1.1 grant 13571: databases directly. These are:</p>
13572:
13573: <div class="itemizedlist">
13574: <ul type="disc">
13575: <li>
1.45 wiz 13576: <p><code xmlns=
13577: "http://www.w3.org/TR/xhtml1/transitional"
13578: class=
1.14 xtraeme 13579: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13580: </li>
13581:
13582: <li>
1.45 wiz 13583: <p><code xmlns=
13584: "http://www.w3.org/TR/xhtml1/transitional"
13585: class=
1.14 xtraeme 13586: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13587: </li>
13588: </ul>
13589: </div>
13590: </li>
13591:
13592: <li>
13593: <p>Check the PLIST and remove any entries under
1.45 wiz 13594: the <code xmlns=
13595: "http://www.w3.org/TR/xhtml1/transitional" class=
13596: "filename">libdata/gtk-2.0</code> directory, as
13597: they will be handled automatically.</p>
1.1 grant 13598: </li>
13599: </ol>
13600: </div>
13601: </div>
13602:
1.55 rillig 13603: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13604: <div class="titlepage">
13605: <div>
13606: <div>
1.55 rillig 13607: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 13608: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 13609: installing SGML or XML data</h3>
1.1 grant 13610: </div>
13611: </div>
13612: </div>
13613:
13614: <p>If a package installs SGML or XML data files that
13615: need to be registered in system-wide catalogs (like
13616: DTDs, sub-catalogs, etc.), you need to take some extra
13617: steps:</p>
13618:
13619: <div class="orderedlist">
13620: <ol type="1">
13621: <li>
1.45 wiz 13622: <p>Include <code xmlns=
13623: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13624: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13625: in your <code xmlns=
13626: "http://www.w3.org/TR/xhtml1/transitional" class=
13627: "filename">Makefile</code>, which takes care of
13628: registering those files in system-wide catalogs
13629: at installation and deinstallation time.</p>
1.1 grant 13630: </li>
13631:
13632: <li>
1.14 xtraeme 13633: <p>Set <code class="varname">SGML_CATALOGS</code>
13634: to the full path of any SGML catalogs installed
13635: by the package.</p>
1.1 grant 13636: </li>
13637:
13638: <li>
1.14 xtraeme 13639: <p>Set <code class="varname">XML_CATALOGS</code>
13640: to the full path of any XML catalogs installed by
1.1 grant 13641: the package.</p>
13642: </li>
13643:
13644: <li>
1.14 xtraeme 13645: <p>Set <code class="varname">SGML_ENTRIES</code>
13646: to individual entries to be added to the SGML
1.1 grant 13647: catalog. These come in groups of three strings;
13648: see xmlcatmgr(1) for more information
13649: (specifically, arguments recognized by the 'add'
13650: action). Note that you will normally not use this
13651: variable.</p>
13652: </li>
13653:
13654: <li>
1.14 xtraeme 13655: <p>Set <code class="varname">XML_ENTRIES</code>
13656: to individual entries to be added to the XML
1.1 grant 13657: catalog. These come in groups of three strings;
13658: see xmlcatmgr(1) for more information
13659: (specifically, arguments recognized by the 'add'
13660: action). Note that you will normally not use this
13661: variable.</p>
13662: </li>
13663: </ol>
13664: </div>
13665: </div>
13666:
1.55 rillig 13667: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13668: <div class="titlepage">
13669: <div>
13670: <div>
1.55 rillig 13671: <h3 class="title"><a name="mime-database" id=
1.38 dillo 13672: "mime-database"></a>15.5.13. Packages
1.30 wiz 13673: installing extensions to the MIME database</h3>
1.1 grant 13674: </div>
13675: </div>
13676: </div>
13677:
13678: <p>If a package provides extensions to the MIME
1.45 wiz 13679: database by installing <code xmlns=
13680: "http://www.w3.org/TR/xhtml1/transitional" class=
13681: "filename">.xml</code> files inside <code xmlns=
13682: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13683: "filename">${PREFIX}/share/mime/packages</code>, you
13684: need to take some extra steps to ensure that the
13685: database is kept consistent with respect to these new
13686: files:</p>
1.1 grant 13687:
13688: <div class="orderedlist">
13689: <ol type="1">
13690: <li>
1.45 wiz 13691: <p>Include <code xmlns=
13692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13693: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13694: (avoid using the <code xmlns=
13695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13696: "filename">buildlink3.mk</code> file from this
13697: same directory, which is reserved for inclusion
1.45 wiz 13698: from other <code xmlns=
13699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13700: "filename">buildlink3.mk</code> files). It takes
13701: care of rebuilding the MIME database at
13702: installation and deinstallation time, and
13703: disallows any access to it directly from the
1.1 grant 13704: package.</p>
13705: </li>
13706:
13707: <li>
13708: <p>Check the PLIST and remove any entries under
1.45 wiz 13709: the <code xmlns=
13710: "http://www.w3.org/TR/xhtml1/transitional" class=
13711: "filename">share/mime</code> directory,
13712: <span class="emphasis"><em>except</em></span> for
13713: files saved under <code xmlns=
13714: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13715: "filename">share/mime/packages</code>. The former
1.1 grant 13716: are handled automatically by the
1.47 reed 13717: update-mime-database program, but the latter are
1.1 grant 13718: package-dependent and must be removed by the
13719: package that installed them in the first
13720: place.</p>
13721: </li>
13722:
13723: <li>
1.45 wiz 13724: <p>Remove any <code xmlns=
13725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13726: "filename">share/mime/*</code> directories from
13727: the PLIST. They will be handled by the
1.1 grant 13728: shared-mime-info package.</p>
13729: </li>
13730: </ol>
13731: </div>
13732: </div>
13733:
1.55 rillig 13734: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13735: <div class="titlepage">
13736: <div>
13737: <div>
1.55 rillig 13738: <h3 class="title"><a name="intltool" id=
1.38 dillo 13739: "intltool"></a>15.5.14. Packages using
1.1 grant 13740: intltool</h3>
13741: </div>
13742: </div>
13743: </div>
13744:
13745: <p>If a package uses intltool during its build, include
1.45 wiz 13746: the <code xmlns=
13747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13748: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13749: file, which forces it to use the intltool package
13750: provided by pkgsrc, instead of the one bundled with the
13751: distribution file.</p>
13752:
13753: <p>This tracks intltool's build-time dependencies and
13754: uses the latest available version; this way, the
13755: package benefits of any bug fixes that may have
13756: appeared since it was released.</p>
13757: </div>
1.18 xtraeme 13758:
1.55 rillig 13759: <div class="sect2" lang="en" xml:lang="en">
1.18 xtraeme 13760: <div class="titlepage">
13761: <div>
13762: <div>
1.55 rillig 13763: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 13764: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13765: installing startup scripts</h3>
1.18 xtraeme 13766: </div>
13767: </div>
13768: </div>
13769:
13770: <p>If a package contains a rc.d script, it won't be
13771: copied into the startup directory by default, but you
13772: can enable it, by adding the option <code class=
1.45 wiz 13773: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13774: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13775: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13776: the scripts into <code xmlns=
13777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13778: "filename">/etc/rc.d</code> when a package is
13779: installed, and it will automatically remove the scripts
13780: when the package is deinstalled.</p>
13781: </div>
1.1 grant 13782: </div>
13783:
1.55 rillig 13784: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13785: <div class="titlepage">
13786: <div>
13787: <div>
13788: <h2 class="title" style="clear: both"><a name=
1.55 rillig 13789: "feedback-to-author" id=
1.38 dillo 13790: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13791: author</h2>
1.1 grant 13792: </div>
13793: </div>
13794: </div>
13795:
13796: <p>If you have found any bugs in the package you make
13797: available, if you had to do special steps to make it run
13798: under NetBSD or if you enhanced the software in various
13799: other ways, be sure to report these changes back to the
13800: original author of the program! With that kind of
13801: support, the next release of the program can incorporate
13802: these fixes, and people not using the NetBSD packages
13803: system can win from your efforts.</p>
13804:
13805: <p>Support the idea of free software!</p>
13806: </div>
13807: </div>
13808:
1.55 rillig 13809: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 13810: <div class="titlepage">
13811: <div>
13812: <div>
1.55 rillig 13813: <h2 class="title"><a name="debug" id=
1.38 dillo 13814: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13815: </div>
13816: </div>
13817: </div>
13818:
13819: <p>To check out all the gotchas when building a package,
13820: here are the steps that I do in order to get a package
13821: working. Please note this is basically the same as what was
13822: explained in the previous sections, only with some
13823: debugging aids.</p>
13824:
13825: <div class="itemizedlist">
13826: <ul type="disc">
13827: <li>
1.14 xtraeme 13828: <p>Be sure to set <code class=
1.45 wiz 13829: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13830: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13831: "filename">/etc/mk.conf</code></p>
1.1 grant 13832: </li>
13833:
13834: <li>
13835: <p>Install <a xmlns=
13836: "http://www.w3.org/TR/xhtml1/transitional" href=
13837: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13838: target="_top"><code xmlns="" class=
13839: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13840: directory for a new package, change into it, then run
13841: <span><strong class=
13842: "command">url2pkg</strong></span>:</p>
1.1 grant 13843: <pre class="screen">
1.14 xtraeme 13844: <code class="prompt">%</code> <strong class=
13845: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13846: "replaceable"><code>category</code></em>/<em class=
13847: "replaceable"><code>examplepkg</code></em></code></strong>
13848: <code class="prompt">%</code> <strong class=
13849: "userinput"><code>cd /usr/pkgsrc/<em class=
13850: "replaceable"><code>category</code></em>/<em class=
13851: "replaceable"><code>examplepkg</code></em></code></strong>
13852: <code class="prompt">%</code> <strong class=
13853: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13854: </pre>
13855: </li>
13856:
13857: <li>
1.45 wiz 13858: <p>Edit the <code xmlns=
13859: "http://www.w3.org/TR/xhtml1/transitional" class=
13860: "filename">Makefile</code> as requested.</p>
1.1 grant 13861: </li>
13862:
13863: <li>
1.45 wiz 13864: <p>Fill in the <code xmlns=
13865: "http://www.w3.org/TR/xhtml1/transitional" class=
13866: "filename">DESCR</code> file</p>
1.1 grant 13867: </li>
13868:
13869: <li>
1.14 xtraeme 13870: <p>Run <span><strong class="command">make
13871: configure</strong></span></p>
1.1 grant 13872: </li>
13873:
13874: <li>
13875: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13876: and the configure step to the package's <code xmlns=
13877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13878: "filename">Makefile</code>.</p>
1.1 grant 13879: </li>
13880:
13881: <li>
13882: <p>Make the package compile, doing multiple rounds
13883: of</p>
13884: <pre class="screen">
1.14 xtraeme 13885: <code class="prompt">%</code> <strong class=
13886: "userinput"><code>make</code></strong>
13887: <code class="prompt">%</code> <strong class=
13888: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13889: <code class="prompt">%</code> <strong class=
13890: "userinput"><code>mkpatches</code></strong>
13891: <code class="prompt">%</code> <strong class=
13892: "userinput"><code>patchdiff</code></strong>
13893: <code class="prompt">%</code> <strong class=
13894: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13895: <code class="prompt">%</code> <strong class=
13896: "userinput"><code>make mps</code></strong>
13897: <code class="prompt">%</code> <strong class=
13898: "userinput"><code>make clean</code></strong>
1.1 grant 13899: </pre>
13900:
13901: <p>Doing as non-root user will ensure that no files
13902: are modified that shouldn't be, especially during the
1.14 xtraeme 13903: build phase. <span><strong class=
13904: "command">mkpatches</strong></span>,
13905: <span><strong class=
13906: "command">patchdiff</strong></span> and
13907: <span><strong class="command">pkgvi</strong></span>
13908: are from the <a xmlns=
1.1 grant 13909: "http://www.w3.org/TR/xhtml1/transitional" href=
13910: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13911: target="_top"><code xmlns="" class=
13912: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13913: </li>
13914:
13915: <li>
1.45 wiz 13916: <p>Look at the <code xmlns=
13917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13918: "filename">Makefile</code>, fix if necessary; see
13919: <a href="#components.Makefile" title=
1.38 dillo 13920: "8.1. Makefile">Section 8.1,
1.45 wiz 13921: “<code xmlns=
13922: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13923: "filename">Makefile</code>”</a>.</p>
1.1 grant 13924: </li>
13925:
13926: <li>
1.45 wiz 13927: <p>Generate a <code xmlns=
13928: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13929: "filename">PLIST</code>:</p>
1.1 grant 13930: <pre class="screen">
1.14 xtraeme 13931: <code class="prompt">#</code> <strong class=
13932: "userinput"><code>make install</code></strong>
13933: <code class="prompt">#</code> <strong class=
13934: "userinput"><code>make print-PLIST >PLIST</code></strong>
13935: <code class="prompt">#</code> <strong class=
13936: "userinput"><code>make deinstall</code></strong>
13937: <code class="prompt">#</code> <strong class=
13938: "userinput"><code>make install</code></strong>
13939: <code class="prompt">#</code> <strong class=
13940: "userinput"><code>make deinstall</code></strong>
1.1 grant 13941: </pre>
13942:
1.45 wiz 13943: <p>You usually need to be <code xmlns=
13944: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13945: "username">root</code> to do this. Look if there are
1.1 grant 13946: any files left:</p>
13947: <pre class="screen">
1.14 xtraeme 13948: <code class="prompt">#</code> <strong class=
13949: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13950: </pre>
13951:
13952: <p>If this reveals any files that are missing in
1.45 wiz 13953: <code xmlns=
13954: "http://www.w3.org/TR/xhtml1/transitional" class=
13955: "filename">PLIST</code>, add them.</p>
1.1 grant 13956: </li>
13957:
13958: <li>
1.45 wiz 13959: <p>Now that the <code xmlns=
13960: "http://www.w3.org/TR/xhtml1/transitional" class=
13961: "filename">PLIST</code> is OK, install the package
13962: again and make a binary package:</p>
1.1 grant 13963: <pre class="screen">
1.14 xtraeme 13964: <code class="prompt">#</code> <strong class=
13965: "userinput"><code>make reinstall</code></strong>
13966: <code class="prompt">#</code> <strong class=
13967: "userinput"><code>make package</code></strong>
1.1 grant 13968: </pre>
13969: </li>
13970:
13971: <li>
13972: <p>Delete the installed package:</p>
13973: <pre class="screen">
1.14 xtraeme 13974: <code class="prompt">#</code> <strong class=
13975: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13976: </pre>
13977: </li>
13978:
13979: <li>
1.14 xtraeme 13980: <p>Repeat the above <span><strong class=
13981: "command">make print-PLIST</strong></span> command,
13982: which shouldn't find anything now:</p>
1.1 grant 13983: <pre class="screen">
1.14 xtraeme 13984: <code class="prompt">#</code> <strong class=
13985: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13986: </pre>
13987: </li>
13988:
13989: <li>
13990: <p>Reinstall the binary package:</p>
13991: <pre class="screen">
1.14 xtraeme 13992: <code class="prompt">#</code> <strong class=
13993: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13994: </pre>
13995: </li>
13996:
13997: <li>
13998: <p>Play with it. Make sure everything works.</p>
13999: </li>
14000:
14001: <li>
1.14 xtraeme 14002: <p>Run <span><strong class=
14003: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14004: "http://www.w3.org/TR/xhtml1/transitional" href=
14005: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14006: target="_top"><code xmlns="" class=
14007: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14008: problems it reports:</p>
1.1 grant 14009: <pre class="screen">
1.14 xtraeme 14010: <code class="prompt">#</code> <strong class=
14011: "userinput"><code>pkglint</code></strong>
1.1 grant 14012: </pre>
14013: </li>
14014:
14015: <li>
14016: <p>Submit (or commit, if you have cvs access); see
14017: <a href="#submit" title=
1.38 dillo 14018: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 14019: <i>Submitting and Committing</i></a>.</p>
14020: </li>
14021: </ul>
14022: </div>
14023: </div>
14024:
1.55 rillig 14025: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 14026: <div class="titlepage">
14027: <div>
14028: <div>
1.55 rillig 14029: <h2 class="title"><a name="submit" id=
1.38 dillo 14030: "submit"></a>Chapter 17. Submitting and
1.1 grant 14031: Committing</h2>
14032: </div>
14033: </div>
14034: </div>
14035:
14036: <div class="toc">
14037: <p><b>Table of Contents</b></p>
14038:
14039: <dl>
1.30 wiz 14040: <dt><span class="sect1"><a href=
1.38 dillo 14041: "#submitting-your-package">17.1. Submitting your
1.30 wiz 14042: packages</a></span></dt>
1.1 grant 14043:
1.30 wiz 14044: <dt><span class="sect1"><a href=
1.41 wiz 14045: "#general-notes-for-changes">17.2. General notes when
14046: adding, updating, or removing packages</a></span></dt>
14047:
14048: <dt><span class="sect1"><a href=
14049: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 14050: package into CVS</a></span></dt>
1.1 grant 14051:
1.30 wiz 14052: <dt><span class="sect1"><a href=
1.41 wiz 14053: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 14054: version</a></span></dt>
1.1 grant 14055:
1.41 wiz 14056: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 14057: Moving a package in pkgsrc</a></span></dt>
1.1 grant 14058: </dl>
14059: </div>
14060:
1.55 rillig 14061: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14062: <div class="titlepage">
14063: <div>
14064: <div>
14065: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14066: "submitting-your-package" id=
1.38 dillo 14067: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 14068: your packages</h2>
1.1 grant 14069: </div>
14070: </div>
14071: </div>
14072:
14073: <p>You have to separate between binary and
14074: “<span class="quote">normal</span>” (source)
14075: packages here:</p>
14076:
14077: <div class="itemizedlist">
14078: <ul type="disc">
14079: <li>
14080: <p>precompiled binary packages</p>
14081:
14082: <p>Our policy is that we accept binaries only from
14083: pkgsrc developers to guarantee that the packages
14084: don't contain any trojan horses etc. This is not to
1.13 hubertf 14085: annoy anyone but rather to protect our users!
1.1 grant 14086: You're still free to put up your home-made binary
1.13 hubertf 14087: packages and tell the world where to get them.
14088: NetBSD developers doing bulk builds and wanting to
14089: upload them please see <a href="#bulk-upload"
1.38 dillo 14090: title="6.3.8. Uploading results of a bulk build">
14091: Section 6.3.8, “Uploading results of a
1.13 hubertf 14092: bulk build”</a>.</p>
1.1 grant 14093: </li>
14094:
14095: <li>
14096: <p>packages</p>
14097:
14098: <p>First, check that your package is complete,
14099: compiles and runs well; see <a href="#debug" title=
1.38 dillo 14100: "Chapter 16. Debugging">Chapter 16,
1.1 grant 14101: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 14102: Next, generate an uuencoded gzipped <a href=
14103: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
14104: <span class="citerefentry"><span class=
14105: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 14106: preferably with all files in a single directory.
1.14 xtraeme 14107: Finally, <span><strong class=
14108: "command">send-pr</strong></span> with category
1.1 grant 14109: “<span class="quote">pkg</span>”, a
14110: synopsis which includes the package name and
14111: version number, a short description of your package
14112: (contents of the COMMENT variable or DESCR file are
14113: OK) and attach the archive to your PR.</p>
14114:
14115: <p>If you want to submit several packages, please
14116: send a separate PR for each one, it's easier for us
14117: to track things that way.</p>
14118:
14119: <p>Alternatively, you can also import new packages
14120: into pkgsrc-wip (“<span class="quote">pkgsrc
14121: work-in-progress</span>”); see the homepage
14122: at <a href="http://pkgsrc-wip.sourceforge.net/"
14123: target=
14124: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
14125: details.</p>
14126: </li>
14127: </ul>
14128: </div>
14129: </div>
14130:
1.55 rillig 14131: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14132: <div class="titlepage">
14133: <div>
14134: <div>
14135: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14136: "general-notes-for-changes" id=
1.41 wiz 14137: "general-notes-for-changes"></a>17.2. General
14138: notes when adding, updating, or removing
14139: packages</h2>
14140: </div>
14141: </div>
14142: </div>
14143:
14144: <p>Please note all package additions, updates, moves, and
1.45 wiz 14145: removals in <code xmlns=
14146: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14147: "filename">pkgsrc/doc/CHANGES</code>. It's very important
14148: to keep this file up to date and conforming to the
14149: existing format, because it will be used by scripts to
14150: automatically update pages on <a href=
14151: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 14152: and other sites. Additionally, check the <code xmlns=
14153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14154: "filename">pkgsrc/doc/TODO</code> file and remove the
14155: entry for the package you updated or removed, in case it
14156: was mentioned there.</p>
14157:
14158: <p>There is a make target that helps in creating proper
1.45 wiz 14159: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14160: class="filename">CHANGES</code> entries:
1.41 wiz 14161: <span><strong class="command">make
14162: changes-entry</strong></span>. It uses the optional
14163: <code class="varname">CTYPE</code> and <code class=
14164: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 14165: usage is to first make sure that your <code xmlns=
14166: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14167: "filename">CHANGES</code> file is up-to-date (to avoid
14168: having to resolve conflicts later-on) and then to
14169: <span><strong class="command">cd</strong></span> to the
14170: package directory. For package updates,
14171: <span><strong class="command">make
14172: changes-entry</strong></span> is enough. For new
14173: packages, or package moves or removals, set the
14174: <code class="varname">CTYPE</code> variable on the
14175: command line to "Added", "Moved", or "Removed". You can
14176: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 14177: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14178: class="filename">/etc/mk.conf</code> if your local login
14179: name is not the same as your NetBSD login name. Don't
14180: forget to commit the changes to <code xmlns=
14181: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14182: "filename">pkgsrc/doc/CHANGES</code>!</p>
14183: </div>
14184:
1.55 rillig 14185: <div class="sect1" lang="en" xml:lang="en">
1.41 wiz 14186: <div class="titlepage">
14187: <div>
14188: <div>
14189: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14190: "committing-importing" id=
1.41 wiz 14191: "committing-importing"></a>17.3. Committing:
1.30 wiz 14192: Importing a package into CVS</h2>
1.1 grant 14193: </div>
14194: </div>
14195: </div>
14196:
14197: <p>This section is only of interest for pkgsrc developers
14198: with write access to the pkgsrc repository. Please
14199: remember that cvs imports files relative to the current
14200: working directory, and that the pathname that you give
1.14 xtraeme 14201: the <span><strong class="command">cvs
14202: import</strong></span> command is so that it knows where
14203: to place the files in the repository. Newly created
14204: packages should be imported with a vendor tag of
14205: “<span class="quote">TNF</span>” and a
14206: release tag of “<span class=
14207: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 14208: <pre class="programlisting">
1.51 rillig 14209: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
14210: <code class=
14211: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 14212: </pre>
14213:
14214: <p>Remember to move the directory from which you imported
14215: out of the way, or cvs will complain the next time you
14216: “<span class="quote">cvs update</span>” your
14217: source tree. Also don't forget to add the new package to
1.45 wiz 14218: the category's <code xmlns=
14219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14220: "filename">Makefile</code>.</p>
1.1 grant 14221:
14222: <p>The commit message of the initial import should
1.45 wiz 14223: include part of the <code xmlns=
14224: "http://www.w3.org/TR/xhtml1/transitional" class=
14225: "filename">DESCR</code> file, so people reading the
14226: mailing lists know what the package is/does.</p>
1.1 grant 14227:
14228: <p>For new packages, “<span class="quote">cvs
14229: import</span>” is preferred to “<span class=
14230: "quote">cvs add</span>” because the former gets
14231: everything with a single command, and provides a
14232: consistent tag.</p>
14233: </div>
14234:
1.55 rillig 14235: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14236: <div class="titlepage">
14237: <div>
14238: <div>
14239: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14240: "updating-package" id=
1.41 wiz 14241: "updating-package"></a>17.4. Updating a
1.30 wiz 14242: package to a newer version</h2>
1.1 grant 14243: </div>
14244: </div>
14245: </div>
14246:
14247: <p>Please always put a concise, appropriate and relevant
14248: summary of the changes between old and new versions into
14249: the commit log when updating a package. There are various
14250: reasons for this:</p>
14251:
14252: <div class="itemizedlist">
14253: <ul type="disc">
14254: <li>
14255: <p>A URL is volatile, and can change over time. It
14256: may go away completely or its information may be
14257: overwritten by newer information.</p>
14258: </li>
14259:
14260: <li>
14261: <p>Having the change information between old and
14262: new versions in our CVS repository is very useful
14263: for people who use either cvs or anoncvs.</p>
14264: </li>
14265:
14266: <li>
14267: <p>Having the change information between old and
14268: new versions in our CVS repository is very useful
14269: for people who read the pkgsrc-changes mailing
14270: list, so that they can make tactical decisions
14271: about when to upgrade the package.</p>
14272: </li>
14273: </ul>
14274: </div>
14275:
1.18 xtraeme 14276: <p>Please also recognize that, just because a new version
1.1 grant 14277: of a package has been released, it should not
14278: automatically be upgraded in the CVS repository. We
14279: prefer to be conservative in the packages that are
14280: included in pkgsrc - development or beta packages are not
14281: really the best thing for most places in which pkgsrc is
14282: used. Please use your judgement about what should go into
14283: pkgsrc, and bear in mind that stability is to be
14284: preferred above new and possibly untested features.</p>
14285: </div>
14286:
1.55 rillig 14287: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14288: <div class="titlepage">
14289: <div>
14290: <div>
14291: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14292: "moving-package" id=
1.41 wiz 14293: "moving-package"></a>17.5. Moving a package in
1.30 wiz 14294: pkgsrc</h2>
1.1 grant 14295: </div>
14296: </div>
14297: </div>
14298:
14299: <div class="orderedlist">
14300: <ol type="1">
14301: <li>
14302: <p>Make a copy of the directory somewhere else.</p>
14303: </li>
14304:
14305: <li>
14306: <p>Remove all CVS dirs.</p>
14307:
14308: <p>Alternatively to the first two steps you can
14309: also do:</p>
14310: <pre class="screen">
1.14 xtraeme 14311: <code class="prompt">%</code> <strong class=
14312: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 14313: </pre>
14314:
14315: <p>and use that for further work.</p>
14316: </li>
14317:
14318: <li>
1.14 xtraeme 14319: <p>Fix <code class="varname">CATEGORIES</code> and
14320: any <code class="varname">DEPENDS</code> paths that
14321: just did “<span class=
1.1 grant 14322: "quote">../package</span>” instead of
14323: “<span class=
14324: "quote">../../category/package</span>”.</p>
14325: </li>
14326:
14327: <li>
1.14 xtraeme 14328: <p><span><strong class="command">cvs
14329: import</strong></span> the modified package in the
14330: new place.</p>
1.1 grant 14331: </li>
14332:
14333: <li>
14334: <p>Check if any package depends on it:</p>
14335: <pre class="screen">
1.14 xtraeme 14336: <code class="prompt">%</code> <strong class=
14337: "userinput"><code>cd /usr/pkgsrc</code></strong>
14338: <code class="prompt">%</code> <strong class=
14339: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 14340: </pre>
14341: </li>
14342:
14343: <li>
14344: <p>Fix paths in packages from step 5 to point to
14345: new location.</p>
14346: </li>
14347:
14348: <li>
1.14 xtraeme 14349: <p><span><strong class="command">cvs rm
14350: (-f)</strong></span> the package at the old
14351: location.</p>
1.1 grant 14352: </li>
14353:
14354: <li>
1.45 wiz 14355: <p>Remove from <code xmlns=
14356: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14357: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 14358: </li>
14359:
14360: <li>
1.45 wiz 14361: <p>Add to <code xmlns=
14362: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14363: "filename">newcategory/Makefile</code>.</p>
1.1 grant 14364: </li>
14365:
14366: <li>
14367: <p>Commit the changed and removed files:</p>
14368: <pre class="screen">
1.14 xtraeme 14369: <code class="prompt">%</code> <strong class=
14370: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 14371: </pre>
14372:
14373: <p>(and any packages from step 5, of course).</p>
14374: </li>
14375: </ol>
14376: </div>
14377: </div>
14378: </div>
14379: </div>
14380:
1.55 rillig 14381: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14382: <div class="titlepage">
14383: <div>
14384: <div>
1.55 rillig 14385: <h2 class="title"><a name="examples" id=
1.46 gdt 14386: "examples"></a>Appendix A. A simple example
1.1 grant 14387: package: bison</h2>
14388: </div>
14389: </div>
14390: </div>
14391:
14392: <div class="toc">
14393: <p><b>Table of Contents</b></p>
14394:
14395: <dl>
1.46 gdt 14396: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 14397: files</a></span></dt>
14398:
14399: <dd>
14400: <dl>
1.30 wiz 14401: <dt><span class="sect2"><a href=
1.46 gdt 14402: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 14403:
1.30 wiz 14404: <dt><span class="sect2"><a href=
1.46 gdt 14405: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 14406:
1.30 wiz 14407: <dt><span class="sect2"><a href=
1.46 gdt 14408: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 14409:
1.30 wiz 14410: <dt><span class="sect2"><a href=
1.46 gdt 14411: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 14412: package with <span><strong class=
1.14 xtraeme 14413: "command">pkglint</strong></span></a></span></dt>
1.1 grant 14414: </dl>
14415: </dd>
14416:
1.46 gdt 14417: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 14418: Steps for building, installing, packaging</a></span></dt>
1.1 grant 14419: </dl>
14420: </div>
14421:
14422: <p>We checked to find a piece of software that wasn't in the
14423: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 14424: would want to have <span><strong class=
14425: "command">bison</strong></span> when Berkeley
14426: <span><strong class="command">yacc</strong></span> is already
14427: present in the tree is beyond us, but it's useful for the
14428: purposes of this exercise.</p>
1.1 grant 14429:
1.55 rillig 14430: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14431: <div class="titlepage">
14432: <div>
14433: <div>
14434: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14435: "example-files" id=
1.46 gdt 14436: "example-files"></a>A.1. files</h2>
1.1 grant 14437: </div>
14438: </div>
14439: </div>
14440:
1.55 rillig 14441: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14442: <div class="titlepage">
14443: <div>
14444: <div>
1.55 rillig 14445: <h3 class="title"><a name="example-Makefile" id=
1.46 gdt 14446: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 14447: </div>
14448: </div>
14449: </div>
14450: <pre class="programlisting">
1.51 rillig 14451: # $NetBSD$
14452: #
1.1 grant 14453:
1.51 rillig 14454: DISTNAME= bison-1.25
14455: CATEGORIES= devel
14456: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 14457:
1.51 rillig 14458: MAINTAINER= thorpej@NetBSD.org
14459: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
14460: COMMENT= GNU yacc clone
1.1 grant 14461:
1.51 rillig 14462: GNU_CONFIGURE= yes
14463: INFO_FILES= bison.info
1.1 grant 14464:
1.51 rillig 14465: .include "../../mk/bsd.pkg.mk"
1.1 grant 14466: </pre>
14467: </div>
14468:
1.55 rillig 14469: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14470: <div class="titlepage">
14471: <div>
14472: <div>
1.55 rillig 14473: <h3 class="title"><a name="example-descr" id=
1.46 gdt 14474: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 14475: </div>
14476: </div>
14477: </div>
14478: <pre class="programlisting">
1.51 rillig 14479: GNU version of yacc. Can make re-entrant parsers, and numerous other
14480: improvements. Why you would want this when Berkeley <a href=
1.1 grant 14481: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51 rillig 14482: of the NetBSD source tree is beyond me.
1.1 grant 14483: </pre>
14484: </div>
14485:
1.55 rillig 14486: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14487: <div class="titlepage">
14488: <div>
14489: <div>
1.55 rillig 14490: <h3 class="title"><a name="example-plist" id=
1.46 gdt 14491: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 14492: </div>
14493: </div>
14494: </div>
14495: <pre class="programlisting">
1.51 rillig 14496: @comment $NetBSD$
14497: bin/bison
14498: man/man1/bison.1.gz
14499: share/bison.simple
14500: share/bison.hairy
1.1 grant 14501: </pre>
14502: </div>
14503:
1.55 rillig 14504: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14505: <div class="titlepage">
14506: <div>
14507: <div>
1.30 wiz 14508: <h3 class="title"><a name=
1.55 rillig 14509: "checking-package-with-pkglint" id=
1.46 gdt 14510: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 14511: a package with <span><strong class=
1.14 xtraeme 14512: "command">pkglint</strong></span></h3>
1.1 grant 14513: </div>
14514: </div>
14515: </div>
14516:
14517: <p>The NetBSD package system comes with <a xmlns=
14518: "http://www.w3.org/TR/xhtml1/transitional" href=
14519: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14520: target="_top"><code xmlns="" class=
14521: "filename">pkgtools/pkglint</code></a> which helps to
14522: check the contents of these files. After installation it
14523: is quite easy to use, just change to the directory of the
1.20 ben 14524: package you wish to examine and execute
14525: <span><strong class=
14526: "command">pkglint</strong></span>:</p>
1.1 grant 14527: <pre class="screen">
1.14 xtraeme 14528: <code class="prompt">$</code> <strong class=
14529: "userinput"><code>pkglint</code></strong>
1.1 grant 14530: looks fine.
14531: </pre>
14532:
14533: <p>Depending on the supplied command line arguments (see
1.47 reed 14534: pkglint(1)), more verbose checks will be performed. Use
1.14 xtraeme 14535: e.g. <span><strong class="command">pkglint
14536: -v</strong></span> for a very verbose check.</p>
1.1 grant 14537: </div>
14538: </div>
14539:
1.55 rillig 14540: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14541: <div class="titlepage">
14542: <div>
14543: <div>
14544: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14545: "steps-for-b-i-p" id=
1.46 gdt 14546: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 14547: installing, packaging</h2>
1.1 grant 14548: </div>
14549: </div>
14550: </div>
14551:
14552: <p>Create the directory where the package lives, plus any
14553: auxiliary directories:</p>
14554: <pre class="screen">
1.14 xtraeme 14555: <code class="prompt">#</code> <strong class=
14556: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14557: <code class="prompt">#</code> <strong class=
14558: "userinput"><code>mkdir bison</code></strong>
14559: <code class="prompt">#</code> <strong class=
14560: "userinput"><code>cd bison</code></strong>
14561: <code class="prompt">#</code> <strong class=
14562: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14563: </pre>
14564:
1.45 wiz 14565: <p>Create <code xmlns=
14566: "http://www.w3.org/TR/xhtml1/transitional" class=
14567: "filename">Makefile</code>, <code xmlns=
14568: "http://www.w3.org/TR/xhtml1/transitional" class=
14569: "filename">DESCR</code> and <code xmlns=
14570: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14571: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14572: "Chapter 8. Package components - files, directories and contents">
1.55 rillig 14573: Chapter 8, <i>Package components - files, directories and
14574: contents</i></a>) then continue with fetching the
1.1 grant 14575: distfile:</p>
14576: <pre class="screen">
1.14 xtraeme 14577: <code class="prompt">#</code> <strong class=
14578: "userinput"><code>make fetch</code></strong>
1.1 grant 14579: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14580: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14581: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14582: ftp: Error retrieving file: 500 Internal error
14583:
14584: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14585: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14586: ftp: Error retrieving file: 500 Internal error
14587:
14588: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14589: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14590: Successfully retrieved file.
14591: </pre>
14592:
1.45 wiz 14593: <p>Generate the checksum of the distfile into <code xmlns=
14594: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14595: "filename">distinfo</code>:</p>
1.1 grant 14596: <pre class="screen">
1.14 xtraeme 14597: <code class="prompt">#</code> <strong class=
14598: "userinput"><code>make makesum</code></strong>
1.1 grant 14599: </pre>
14600:
14601: <p>Now compile:</p>
14602: <pre class="screen">
1.14 xtraeme 14603: <code class="prompt">#</code> <strong class=
14604: "userinput"><code>make</code></strong>
1.1 grant 14605: >> Checksum OK for bison-1.25.tar.gz.
14606: ===> Extracting for bison-1.25
14607: ===> Patching for bison-1.25
14608: ===> Ignoring empty patch directory
14609: ===> Configuring for bison-1.25
14610: creating cache ./config.cache
14611: checking for gcc... cc
14612: checking whether we are using GNU C... yes
14613: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14614: checking how to run the C preprocessor... cc -E
14615: checking for minix/config.h... no
14616: checking for POSIXized ISC... no
14617: checking whether cross-compiling... no
14618: checking for ANSI C header files... yes
14619: checking for string.h... yes
14620: checking for stdlib.h... yes
14621: checking for memory.h... yes
14622: checking for working const... yes
14623: checking for working alloca.h... no
14624: checking for alloca... yes
14625: checking for strerror... yes
14626: updating cache ./config.cache
14627: creating ./config.status
14628: creating Makefile
14629: ===> Building for bison-1.25
14630: 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
14631: 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
14632: 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
14633: 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
14634: 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
14635: 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
14636: 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
14637: 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
14638: 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
14639: 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
14640: 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
14641: 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
14642: 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
14643: 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
14644: 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
14645: 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
14646: 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
14647: 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
14648: 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
14649: 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
14650: 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
14651: 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
14652: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
14653: rm -f bison.s1
14654: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
14655: </pre>
14656:
14657: <p>Everything seems OK, so install the files:</p>
14658: <pre class="screen">
1.14 xtraeme 14659: <code class="prompt">#</code> <strong class=
14660: "userinput"><code>make install</code></strong>
1.1 grant 14661: >> Checksum OK for bison-1.25.tar.gz.
14662: ===> Installing for bison-1.25
14663: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14664: rm -f /usr/pkg/bin/bison
14665: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14666: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14667: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14668: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14669: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14670: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14671: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14672: ===> Registering installation for bison-1.25
14673: </pre>
14674:
14675: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14676: remove it with <span><strong class="command">pkg_delete
14677: bison</strong></span>. Should you decide that you want a
14678: binary package, do this now:</p>
1.1 grant 14679: <pre class="screen">
1.14 xtraeme 14680: <code class="prompt">#</code> <strong class=
14681: "userinput"><code>make package</code></strong>
1.1 grant 14682: >> Checksum OK for bison-1.25.tar.gz.
14683: ===> Building package for bison-1.25
14684: Creating package bison-1.25.tgz
14685: Registering depends:.
14686: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14687: </pre>
14688:
14689: <p>Now that you don't need the source and object files any
14690: more, clean up:</p>
14691: <pre class="screen">
1.14 xtraeme 14692: <code class="prompt">#</code> <strong class=
14693: "userinput"><code>make clean</code></strong>
1.1 grant 14694: ===> Cleaning for bison-1.25
14695: </pre>
14696: </div>
14697: </div>
14698:
1.55 rillig 14699: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14700: <div class="titlepage">
14701: <div>
14702: <div>
1.55 rillig 14703: <h2 class="title"><a name="logs" id=
1.46 gdt 14704: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14705: </div>
14706: </div>
14707: </div>
14708:
14709: <div class="toc">
14710: <p><b>Table of Contents</b></p>
14711:
14712: <dl>
1.46 gdt 14713: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14714: Building figlet</a></span></dt>
14715:
1.46 gdt 14716: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14717: Packaging figlet</a></span></dt>
14718: </dl>
14719: </div>
14720:
1.55 rillig 14721: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14722: <div class="titlepage">
14723: <div>
14724: <div>
14725: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14726: "logs.building" id=
1.46 gdt 14727: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14728: </div>
14729: </div>
14730: </div>
14731: <pre class="screen">
1.14 xtraeme 14732: <code class="prompt">#</code> <strong class=
14733: "userinput"><code>make</code></strong>
1.1 grant 14734: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14735: => figlet221.tar.gz doesn't seem to exist on this system.
14736: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14737: => [172219 bytes]
14738: Connected to ftp.plig.net.
14739: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14740: 331 Guest login ok, send your complete e-mail address as password.
14741: 230-You are user #5 of 500 simultaneous users allowed.
14742: 230-
14743: 230- ___ _ _ _
14744: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14745: 230- | _| _| . |_| . | | | . |_| . | _| . |
14746: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14747: 230- |_| |_| |___| |___|
14748: 230-
14749: 230-** Welcome to ftp.plig.org **
14750: 230-
14751: 230-Please note that all transfers from this FTP site are logged. If you
14752: 230-do not like this, please disconnect now.
14753: 230-
14754: 230-This arhive is available via
14755: 230-
14756: 230-HTTP: http://ftp.plig.org/
14757: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14758: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14759: 230-
14760: 230-Please email comments, bug reports and requests for packages to be
14761: 230-mirrored to ftp-admin@plig.org.
14762: 230-
14763: 230-
14764: 230 Logged in anonymously.
14765: Remote system type is UNIX.
14766: Using binary mode to transfer files.
14767: 200 Type okay.
14768: 250 "/pub" is new cwd.
14769: 250-"/pub/figlet" is new cwd.
14770: 250-
14771: 250-Welcome to the figlet archive at ftp.figlet.org
14772: 250-
14773: 250- ftp://ftp.figlet.org/pub/figlet/
14774: 250-
14775: 250-The official FIGlet web page is:
14776: 250- http://www.figlet.org/
14777: 250-
14778: 250-If you have questions, please mailto:info@figlet.org. If you want to
14779: 250-contribute a font or something else, you can email us.
14780: 250
14781: 250 "/pub/figlet/program" is new cwd.
14782: 250 "/pub/figlet/program/unix" is new cwd.
14783: local: figlet221.tar.gz remote: figlet221.tar.gz
14784: 502 Unimplemented command.
14785: 227 Entering Passive Mode (195,40,6,41,246,104)
14786: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14787: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14788: 226 Transfer completed.
14789: 172219 bytes received in 00:02 (75.99 KB/s)
14790: 221 Goodbye.
14791: => Checksum OK for figlet221.tar.gz.
14792: ===> Extracting for figlet-2.2.1nb2
14793: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14794: ===> Patching for figlet-2.2.1nb2
14795: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14796: ===> Overriding tools for figlet-2.2.1nb2
14797: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14798: ===> Configuring for figlet-2.2.1nb2
14799: ===> Building for figlet-2.2.1nb2
14800: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14801: chmod a+x figlet
14802: gcc -O2 -o chkfont chkfont.c
14803: => Unwrapping files-to-be-installed.
1.14 xtraeme 14804: <code class="prompt">#</code>
14805: <code class="prompt">#</code> <strong class=
14806: "userinput"><code>make install</code></strong>
1.1 grant 14807: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14808: ===> Installing for figlet-2.2.1nb2
14809: install -d -o root -g wheel -m 755 /usr/pkg/bin
14810: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14811: mkdir -p /usr/pkg/share/figlet
14812: cp figlet /usr/pkg/bin
14813: cp chkfont /usr/pkg/bin
14814: chmod 555 figlist showfigfonts
14815: cp figlist /usr/pkg/bin
14816: cp showfigfonts /usr/pkg/bin
14817: cp fonts/*.flf /usr/pkg/share/figlet
14818: cp fonts/*.flc /usr/pkg/share/figlet
14819: cp figlet.6 /usr/pkg/man/man6
14820: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14821: <code class="prompt">#</code>
1.1 grant 14822: </pre>
14823: </div>
14824:
1.55 rillig 14825: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14826: <div class="titlepage">
14827: <div>
14828: <div>
14829: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14830: "logs.package" id=
1.46 gdt 14831: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14832: </div>
14833: </div>
14834: </div>
14835: <pre class="screen">
1.14 xtraeme 14836: <code class="prompt">#</code> <strong class=
14837: "userinput"><code>make package</code></strong>
1.1 grant 14838: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14839: ===> Packaging figlet-2.2.1nb2
14840: ===> Building binary package for figlet-2.2.1nb2
14841: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14842: Using SrcDir value of /usr/pkg
14843: Registering depends:.
1.14 xtraeme 14844: <code class="prompt">#</code>
1.1 grant 14845: </pre>
14846: </div>
14847: </div>
14848:
1.55 rillig 14849: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14850: <div class="titlepage">
14851: <div>
14852: <div>
1.55 rillig 14853: <h2 class="title"><a name="ftp-layout" id=
1.46 gdt 14854: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14855: FTP server's package archive</h2>
14856: </div>
14857: </div>
14858: </div>
14859:
14860: <p>Layout for precompiled binary packages on
14861: ftp.NetBSD.org:</p>
14862: <pre class="programlisting">
1.51 rillig 14863: /pub/NetBSD/packages/
14864: distfiles/
1.1 grant 14865:
1.51 rillig 14866: # Unpacked pkgsrc trees
14867: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14868: pkgsrc-2003Q4 -> N/A
14869: pkgsrc-2004Q1/pkgsrc
14870:
14871: # pkgsrc archives
14872: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14873: pkgsrc-2003Q4.tar.gz -> N/A
14874: pkgsrc-2004Q1.tar.gz -> N/A
14875:
14876: # Per pkgsrc-release/OS-release/arch package archives
14877: pkgsrc-2003Q4/
14878: NetBSD-1.6.2/
14879: i386/
14880: All/
14881: archivers/
14882: foo -> ../All/foo
14883: ...
14884: pkgsrc-2004Q1/
14885: NetBSD-1.6.2/
14886: i386/
14887: All/
14888: ...
14889: NetBSD-2.0/
14890: i386/
14891: All/
14892: ...
14893: SunOS-5.9/
14894: sparc/
14895: All/
14896: ...
14897: x86/
14898: All/
14899: ...
14900:
14901: # Per os-release package archive convenience links
14902: NetBSD-1.6.2 -> 1.6.2
14903: 1.6.2/
14904: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14905: m68k/
14906: All/
14907: archivers/
14908: foo -> ../All/foo
14909: ...
14910: amiga -> m68k
14911: atari -> m68k
14912: ...
14913:
14914: 2.0 -> NetBSD-2.0 # backward compat, historic
14915: NetBSD-2.0/
14916: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14917: SunOS-5.9/
14918: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14919: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 14920: </pre>
14921:
14922: <p>To create:</p>
14923:
14924: <div class="orderedlist">
14925: <ol type="1">
14926: <li>
14927: <p>Run bulk build, see <a href="#bulkbuild" title=
1.55 rillig 14928: "6.3. Doing a bulk build of all packages">Section
14929: 6.3, “Doing a bulk build of all
1.1 grant 14930: packages”</a></p>
14931: </li>
14932:
14933: <li>
14934: <p>Upload /usr/pkgsrc/packages to</p>
14935: <pre class="programlisting">
14936: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 14937: pkgsrc-2004Q4/\ # pkgsrc-branch
14938: `uname -s`-`uname -r`/\ # OS & version
14939: `uname -p` # architecture
1.1 grant 14940: </pre>
14941: </li>
14942:
14943: <li>
1.14 xtraeme 14944: <p>If necessary, create a symlink <span><strong class=
14945: "command">ln -s `uname -m` `uname -p`</strong></span>
14946: (amiga -> m68k, ...)</p>
1.1 grant 14947: </li>
14948: </ol>
14949: </div>
14950: </div>
1.2 hubertf 14951:
1.55 rillig 14952: <div class="appendix" lang="en" xml:lang="en">
1.2 hubertf 14953: <div class="titlepage">
14954: <div>
14955: <div>
1.55 rillig 14956: <h2 class="title"><a name="editing" id=
1.46 gdt 14957: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 14958: for the pkgsrc guide</h2>
14959: </div>
14960: </div>
14961: </div>
14962:
14963: <div class="toc">
14964: <p><b>Table of Contents</b></p>
14965:
14966: <dl>
1.46 gdt 14967: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 14968: Targets</a></span></dt>
14969:
1.46 gdt 14970: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 14971: Procedure</a></span></dt>
14972: </dl>
14973: </div>
14974:
14975: <p>This section contains information on editing the pkgsrc
14976: guide itself.</p>
14977:
1.55 rillig 14978: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 14979: <div class="titlepage">
14980: <div>
14981: <div>
14982: <h2 class="title" style="clear: both"><a name=
1.55 rillig 14983: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 14984: </div>
14985: </div>
14986: </div>
14987:
1.45 wiz 14988: <p>The pkgsrc guide's source code is stored in <code xmlns=
14989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14990: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14991: are created from it:</p>
14992:
14993: <div class="itemizedlist">
14994: <ul type="disc">
14995: <li>
1.45 wiz 14996: <p><code xmlns=
14997: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14998: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14999: </li>
15000:
15001: <li>
1.45 wiz 15002: <p><code xmlns=
15003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15004: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 15005: </li>
15006:
15007: <li>
1.45 wiz 15008: <p><code xmlns=
15009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15010: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 15011: the documentation on the NetBSD website will be built
15012: from pkgsrc and kept up to date on the web server
15013: itself. This means you <span class=
15014: "emphasis"><em>must</em></span> make sure that your
15015: changes haven't broken the build!</p>
15016: </li>
1.6 hubertf 15017:
15018: <li>
1.45 wiz 15019: <p><code xmlns=
15020: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15021: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 15022: PDF version of the pkgsrc guide.</p>
15023: </li>
15024:
15025: <li>
1.45 wiz 15026: <p><code xmlns=
15027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15028: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 15029: PostScript version of the pkgsrc guide.</p>
15030: </li>
1.2 hubertf 15031: </ul>
15032: </div>
15033: </div>
15034:
1.55 rillig 15035: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 15036: <div class="titlepage">
15037: <div>
15038: <div>
15039: <h2 class="title" style="clear: both"><a name=
1.55 rillig 15040: "procedure" id=
1.46 gdt 15041: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 15042: </div>
15043: </div>
15044: </div>
15045:
15046: <p>The procedure to edit the pkgsrc guide is:</p>
15047:
15048: <div class="itemizedlist">
15049: <ul type="disc">
15050: <li>
1.6 hubertf 15051: <p>Make sure you have the packages needed to
15052: re-generate the pkgsrc guide (and other XML-based
15053: NetBSD documentation) installed. These are
1.11 ben 15054: “<span class="quote">netbsd-doc</span>”
1.47 reed 15055: for creating the ASCII and HTML versions, and
1.6 hubertf 15056: “<span class=
1.47 reed 15057: "quote">netbsd-doc-print</span>” for the
15058: PostScript and PDF versions. You will need both
1.6 hubertf 15059: packages installed, to make sure documentation is
15060: consistent across all formats. The packages can be
1.45 wiz 15061: found in <code xmlns=
15062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15063: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 15064: <code xmlns=
15065: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15066: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 15067: </li>
15068:
15069: <li>
1.45 wiz 15070: <p>Edit the XML file(s) in <code xmlns=
15071: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15072: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 15073: </li>
15074:
15075: <li>
1.14 xtraeme 15076: <p>Run <span><strong class="command">make extract
15077: && make do-lint</strong></span> in
1.45 wiz 15078: <code xmlns=
15079: "http://www.w3.org/TR/xhtml1/transitional" class=
15080: "filename">pkgsrc/doc/guide</code> to check the XML
15081: syntax, and fix it if needed.</p>
1.4 hubertf 15082: </li>
15083:
15084: <li>
1.14 xtraeme 15085: <p>Run <span><strong class=
1.45 wiz 15086: "command">make</strong></span> in <code xmlns=
15087: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15088: "filename">pkgsrc/doc/guide</code> to build the HTML
15089: and ASCII version.</p>
1.2 hubertf 15090: </li>
15091:
15092: <li>
1.14 xtraeme 15093: <p>If all is well, run <span><strong class=
15094: "command">make install-doc</strong></span> to put the
1.45 wiz 15095: generated files into <code xmlns=
15096: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15097: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 15098: </li>
15099:
15100: <li>
1.14 xtraeme 15101: <p><span><strong class="command">cvs commit
15102: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 15103: </li>
15104:
15105: <li>
1.14 xtraeme 15106: <p><span><strong class="command">cvs commit -m
15107: re-generate
15108: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 15109: </li>
1.4 hubertf 15110:
15111: <li>
15112: <p>Until the webserver on www.NetBSD.org is really
15113: updated automatically to pick up changes to the
1.14 xtraeme 15114: pkgsrc guide automatically, also run
1.18 xtraeme 15115: <span><strong class="command">make install-htdocs
1.14 xtraeme 15116: HTDOCSDIR=../../../htdocs</strong></span> (or
15117: similar, adjust <code class=
15118: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 15119: </li>
15120:
15121: <li>
1.14 xtraeme 15122: <p><span><strong class="command">cvs commit
15123: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 15124: </li>
1.2 hubertf 15125: </ul>
15126: </div>
15127: </div>
15128: </div>
1.1 grant 15129: </div>
15130: </body>
15131: </html>
CVSweb <webmaster@jp.NetBSD.org>