Annotation of pkgsrc/doc/pkgsrc.html, revision 1.55
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.38 dillo 683: "#build.prefix">14.1. Program
1.1 grant 684: location</a></span></dt>
685:
1.30 wiz 686: <dt><span class="sect1"><a href=
1.38 dillo 687: "#main-targets">14.2. Main targets</a></span></dt>
1.1 grant 688:
689: <dt><span class="sect1"><a href=
1.38 dillo 690: "#build.helpful-targets">14.3. Other helpful
1.1 grant 691: targets</a></span></dt>
692: </dl>
693: </dd>
694:
1.55 ! rillig 695: <dt><span class="chapter"><a href="#fixes">15. Making
! 696: your package work</a></span></dt>
1.1 grant 697:
698: <dd>
699: <dl>
1.30 wiz 700: <dt><span class="sect1"><a href=
1.38 dillo 701: "#general-operation">15.1. General
1.30 wiz 702: operation</a></span></dt>
1.1 grant 703:
704: <dd>
705: <dl>
706: <dt><span class="sect2"><a href=
1.38 dillo 707: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 708: pull in variables from
709: /etc/mk.conf</a></span></dt>
1.1 grant 710:
711: <dt><span class="sect2"><a href=
1.38 dillo 712: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 713: to install documentation</a></span></dt>
714:
715: <dt><span class="sect2"><a href=
1.38 dillo 716: "#restricted-packages">15.1.3. Restricted
1.1 grant 717: packages</a></span></dt>
718:
719: <dt><span class="sect2"><a href=
1.38 dillo 720: "#dependencies">15.1.4. Handling
1.1 grant 721: dependencies</a></span></dt>
722:
723: <dt><span class="sect2"><a href=
1.38 dillo 724: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 725: other packages</a></span></dt>
726:
727: <dt><span class="sect2"><a href=
1.38 dillo 728: "#not-building-packages">15.1.6. Packages that
1.30 wiz 729: cannot or should not be built</a></span></dt>
1.1 grant 730:
731: <dt><span class="sect2"><a href=
1.38 dillo 732: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 733: should not be deleted, once
734: installed</a></span></dt>
1.1 grant 735:
736: <dt><span class="sect2"><a href=
1.38 dillo 737: "#security-handling">15.1.8. Handling packages
1.1 grant 738: with security problems</a></span></dt>
739:
740: <dt><span class="sect2"><a href=
1.38 dillo 741: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 742: bugs</a></span></dt>
743:
744: <dt><span class="sect2"><a href=
1.38 dillo 745: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 746: incrementing versions when fixing an existing
1.1 grant 747: package</a></span></dt>
748:
749: <dt><span class="sect2"><a href=
1.38 dillo 750: "#portability-of-packages">15.1.11. Portability
1.30 wiz 751: of packages</a></span></dt>
1.1 grant 752: </dl>
753: </dd>
754:
1.30 wiz 755: <dt><span class="sect1"><a href=
1.38 dillo 756: "#downloading-issues">15.2. Possible downloading
1.30 wiz 757: issues</a></span></dt>
1.1 grant 758:
759: <dd>
760: <dl>
761: <dt><span class="sect2"><a href=
1.38 dillo 762: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 763: distfiles aren't available for plain
1.1 grant 764: downloading</a></span></dt>
765:
766: <dt><span class="sect2"><a href=
1.38 dillo 767: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 768: handle modified distfiles with the 'old'
769: name</a></span></dt>
1.1 grant 770: </dl>
771: </dd>
772:
1.30 wiz 773: <dt><span class="sect1"><a href=
1.38 dillo 774: "#configuration-gotchas">15.3. Configuration
1.30 wiz 775: gotchas</a></span></dt>
1.1 grant 776:
777: <dd>
778: <dl>
779: <dt><span class="sect2"><a href=
1.38 dillo 780: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 781: libtool</a></span></dt>
782:
783: <dt><span class="sect2"><a href=
1.38 dillo 784: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 785: packages that already support
786: libtool</a></span></dt>
787:
788: <dt><span class="sect2"><a href=
1.38 dillo 789: "#autoconf-automake">15.3.3. GNU
1.1 grant 790: Autoconf/Automake</a></span></dt>
791: </dl>
792: </dd>
793:
1.30 wiz 794: <dt><span class="sect1"><a href=
1.55 ! rillig 795: "#fixes-build">15.4. Building the
! 796: package</a></span></dt>
1.1 grant 797:
798: <dd>
799: <dl>
800: <dt><span class="sect2"><a href=
1.38 dillo 801: "#cpp-defines">15.4.1. CPP
1.1 grant 802: defines</a></span></dt>
1.51 rillig 803:
804: <dt><span class="sect2"><a href=
805: "#cpp-list">15.4.2. Getting a list of CPP
806: defines</a></span></dt>
1.1 grant 807: </dl>
808: </dd>
809:
1.30 wiz 810: <dt><span class="sect1"><a href=
1.38 dillo 811: "#package-specific-actions">15.5. Package specific
1.30 wiz 812: actions</a></span></dt>
1.1 grant 813:
814: <dd>
815: <dl>
816: <dt><span class="sect2"><a href=
1.38 dillo 817: "#user-interaction">15.5.1. User
1.2 hubertf 818: interaction</a></span></dt>
1.1 grant 819:
820: <dt><span class="sect2"><a href=
1.38 dillo 821: "#handling-licenses">15.5.2. Handling
1.1 grant 822: licenses</a></span></dt>
823:
824: <dt><span class="sect2"><a href=
1.38 dillo 825: "#installing-score-files">15.5.3. Installing
1.30 wiz 826: score files</a></span></dt>
1.1 grant 827:
828: <dt><span class="sect2"><a href=
1.38 dillo 829: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 830: perl scripts</a></span></dt>
1.1 grant 831:
832: <dt><span class="sect2"><a href=
1.38 dillo 833: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 834: hardcoded paths to other
835: interpreters</a></span></dt>
1.1 grant 836:
837: <dt><span class="sect2"><a href=
1.38 dillo 838: "#perl-modules">15.5.6. Packages installing
1.30 wiz 839: perl modules</a></span></dt>
1.1 grant 840:
841: <dt><span class="sect2"><a href=
1.38 dillo 842: "#faq.info-files">15.5.7. Packages installing
1.1 grant 843: info files</a></span></dt>
844:
845: <dt><span class="sect2"><a href=
1.38 dillo 846: "#gconf2-data-files">15.5.8. Packages
1.30 wiz 847: installing GConf2 data files</a></span></dt>
1.1 grant 848:
849: <dt><span class="sect2"><a href=
1.38 dillo 850: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 851: installing scrollkeeper data
852: files</a></span></dt>
1.1 grant 853:
854: <dt><span class="sect2"><a href=
1.38 dillo 855: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 856: fonts</a></span></dt>
857:
858: <dt><span class="sect2"><a href=
1.38 dillo 859: "#gtk2-modules">15.5.11. Packages installing
1.30 wiz 860: GTK2 modules</a></span></dt>
1.1 grant 861:
862: <dt><span class="sect2"><a href=
1.38 dillo 863: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 864: SGML or XML data</a></span></dt>
1.1 grant 865:
866: <dt><span class="sect2"><a href=
1.38 dillo 867: "#mime-database">15.5.13. Packages installing
1.1 grant 868: extensions to the MIME database</a></span></dt>
869:
870: <dt><span class="sect2"><a href=
1.38 dillo 871: "#intltool">15.5.14. Packages using
1.1 grant 872: intltool</a></span></dt>
1.18 xtraeme 873:
874: <dt><span class="sect2"><a href=
1.38 dillo 875: "#startup-scripts">15.5.15. Packages installing
1.18 xtraeme 876: startup scripts</a></span></dt>
1.1 grant 877: </dl>
878: </dd>
879:
1.30 wiz 880: <dt><span class="sect1"><a href=
1.38 dillo 881: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 882: author</a></span></dt>
1.1 grant 883: </dl>
884: </dd>
885:
1.38 dillo 886: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 887: Debugging</a></span></dt>
888:
1.38 dillo 889: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 890: Submitting and Committing</a></span></dt>
891:
892: <dd>
893: <dl>
1.30 wiz 894: <dt><span class="sect1"><a href=
1.38 dillo 895: "#submitting-your-package">17.1. Submitting your
1.30 wiz 896: packages</a></span></dt>
1.1 grant 897:
1.30 wiz 898: <dt><span class="sect1"><a href=
1.41 wiz 899: "#general-notes-for-changes">17.2. General notes
900: when adding, updating, or removing
901: packages</a></span></dt>
902:
903: <dt><span class="sect1"><a href=
904: "#committing-importing">17.3. Committing: Importing
1.30 wiz 905: a package into CVS</a></span></dt>
1.1 grant 906:
1.30 wiz 907: <dt><span class="sect1"><a href=
1.41 wiz 908: "#updating-package">17.4. Updating a package to a
1.30 wiz 909: newer version</a></span></dt>
1.1 grant 910:
1.30 wiz 911: <dt><span class="sect1"><a href=
1.41 wiz 912: "#moving-package">17.5. Moving a package in
1.30 wiz 913: pkgsrc</a></span></dt>
1.1 grant 914: </dl>
915: </dd>
916: </dl>
917: </dd>
918:
1.46 gdt 919: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 920: example package: bison</a></span></dt>
921:
922: <dd>
923: <dl>
1.46 gdt 924: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 925: files</a></span></dt>
926:
927: <dd>
928: <dl>
1.30 wiz 929: <dt><span class="sect2"><a href=
1.46 gdt 930: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 931:
1.30 wiz 932: <dt><span class="sect2"><a href=
1.46 gdt 933: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 934:
1.30 wiz 935: <dt><span class="sect2"><a href=
1.46 gdt 936: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 937:
1.30 wiz 938: <dt><span class="sect2"><a href=
1.46 gdt 939: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 940: package with <span><strong class=
1.14 xtraeme 941: "command">pkglint</strong></span></a></span></dt>
1.1 grant 942: </dl>
943: </dd>
944:
1.46 gdt 945: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 946: Steps for building, installing,
947: packaging</a></span></dt>
1.1 grant 948: </dl>
949: </dd>
950:
1.46 gdt 951: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 952: logs</a></span></dt>
953:
954: <dd>
955: <dl>
1.46 gdt 956: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 957: Building figlet</a></span></dt>
958:
1.46 gdt 959: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 960: Packaging figlet</a></span></dt>
961: </dl>
962: </dd>
963:
1.46 gdt 964: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 965: of the FTP server's package archive</a></span></dt>
1.2 hubertf 966:
1.46 gdt 967: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 968: guidelines for the pkgsrc guide</a></span></dt>
969:
970: <dd>
971: <dl>
1.46 gdt 972: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 973: Targets</a></span></dt>
974:
1.46 gdt 975: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 976: Procedure</a></span></dt>
977: </dl>
978: </dd>
1.1 grant 979: </dl>
980: </div>
981:
1.55 ! rillig 982: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 983: <div class="titlepage">
984: <div>
985: <div>
1.55 ! rillig 986: <h2 class="title"><a name="introduction" id=
1.51 rillig 987: "introduction"></a>Chapter 1. What is
988: pkgsrc?</h2>
1.1 grant 989: </div>
990: </div>
991: </div>
992:
993: <div class="toc">
994: <p><b>Table of Contents</b></p>
995:
996: <dl>
1.30 wiz 997: <dt><span class="sect1"><a href=
998: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 999:
1000: <dt><span class="sect1"><a href="#overview">1.2.
1001: Overview</a></span></dt>
1002:
1003: <dt><span class="sect1"><a href="#terminology">1.3.
1004: Terminology</a></span></dt>
1005:
1006: <dt><span class="sect1"><a href="#typography">1.4.
1007: Typography</a></span></dt>
1008: </dl>
1009: </div>
1010:
1.55 ! rillig 1011: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1012: <div class="titlepage">
1013: <div>
1014: <div>
1015: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1016: "introduction-section" id=
1.30 wiz 1017: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1018: </div>
1019: </div>
1020: </div>
1021:
1.47 reed 1022: <p>There is a lot of software freely available for
1023: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1024: Unix-flavoured systems, too, sometimes with some
1025: modifications. The NetBSD Packages Collection (pkgsrc)
1026: incorporates any such changes necessary to make that
1027: software run, and makes the installation (and
1028: de-installation) of the software package easy by means of a
1029: single command.</p>
1030:
1031: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1032: the <span><strong class="command">pkg_*</strong></span>
1033: tools so that installation and de-installation, printing of
1034: an inventory of all installed packages and retrieval of
1035: one-line comments or more verbose descriptions are all
1036: simple.</p>
1.1 grant 1037:
1038: <p>pkgsrc currently contains several thousand packages,
1039: including:</p>
1040:
1041: <div class="itemizedlist">
1042: <ul type="disc">
1043: <li>
1044: <p><a xmlns=
1045: "http://www.w3.org/TR/xhtml1/transitional" href=
1046: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1047: target="_top"><code xmlns="" class=
1048: "filename">www/apache</code></a> - The Apache web
1.20 ben 1049: server</p>
1.1 grant 1050: </li>
1051:
1052: <li>
1053: <p><a xmlns=
1054: "http://www.w3.org/TR/xhtml1/transitional" href=
1055: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1056: target="_top"><code xmlns="" class=
1057: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1058: browser</p>
1.1 grant 1059: </li>
1060:
1061: <li>
1062: <p><a xmlns=
1063: "http://www.w3.org/TR/xhtml1/transitional" href=
1064: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1065: target="_top"><code xmlns="" class=
1066: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1067: Desktop Environment</p>
1.1 grant 1068: </li>
1069:
1070: <li>
1071: <p><a xmlns=
1072: "http://www.w3.org/TR/xhtml1/transitional" href=
1073: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1074: target="_top"><code xmlns="" class=
1075: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1076: Environment</p>
1.1 grant 1077: </li>
1078: </ul>
1079: </div>
1080:
1081: <p>...just to name a few.</p>
1082:
1083: <p>pkgsrc has built-in support for handling varying
1084: dependencies, such as pthreads and X11, and extended
1085: features such as IPv6 support on a range of platforms.</p>
1086:
1087: <p>pkgsrc was derived from FreeBSD's ports system, and
1088: initially developed for NetBSD only. Since then, pkgsrc has
1089: grown a lot, and now supports the following platforms:</p>
1090:
1091: <div class="itemizedlist">
1092: <ul type="disc">
1093: <li>
1094: <p><a href="http://developer.apple.com/darwin/"
1095: target="_top">Darwin</a> (<a href=
1096: "http://www.apple.com/macosx/" target="_top">Mac OS
1097: X</a>)</p>
1098: </li>
1099:
1100: <li>
1.3 hubertf 1101: <p><a href="http://www.DragonFlyBSD.org/" target=
1102: "_top">DragonFlyBSD</a></p>
1103: </li>
1104:
1105: <li>
1.1 grant 1106: <p><a href="http://www.FreeBSD.org/" target=
1107: "_top">FreeBSD</a></p>
1108: </li>
1109:
1110: <li>
1.3 hubertf 1111: <p>Microsoft Windows, via <a href=
1112: "http://www.microsoft.com/windows/sfu/" target=
1113: "_top">Interix</a></p>
1.1 grant 1114: </li>
1115:
1116: <li>
1117: <p><a href="http://www.sgi.com/software/irix6.5/"
1118: target="_top">IRIX</a></p>
1119: </li>
1120:
1121: <li>
1122: <p><a href="http://www.linux.org/" target=
1123: "_top">Linux</a></p>
1124: </li>
1125:
1126: <li>
1127: <p><a href="http://www.NetBSD.org/" target=
1128: "_top">NetBSD</a> (of course)</p>
1129: </li>
1130:
1131: <li>
1.17 sketch 1132: <p><a href="http://h30097.www3.hp.com/" target=
1133: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1134: </li>
1135:
1136: <li>
1.1 grant 1137: <p><a href="http://www.openbsd.org/" target=
1138: "_top">OpenBSD</a></p>
1139: </li>
1140:
1141: <li>
1142: <p><a href="http://www.sun.com/solaris/" target=
1143: "_top">Solaris</a></p>
1144: </li>
1145: </ul>
1146: </div>
1147: </div>
1148:
1.55 ! rillig 1149: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1150: <div class="titlepage">
1151: <div>
1152: <div>
1153: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1154: "overview" id="overview"></a>1.2. Overview</h2>
1.1 grant 1155: </div>
1156: </div>
1157: </div>
1158:
1159: <p>This document is divided into two parts. The first,
1160: <a href="#users-guide" title=
1.46 gdt 1161: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1162: user's guide</a>, describes how one can use one of the
1163: packages in the Package Collection, either by installing a
1164: precompiled binary package, or by building one's own copy
1165: using the NetBSD package system. The second part, <a href=
1.1 grant 1166: "#developers-guide" title=
1.46 gdt 1167: "Part II. The pkgsrc developer's guide">The
1168: pkgsrc developer's guide</a>, explains how to prepare a
1169: package so it can be easily built by other NetBSD users
1170: without knowing about the package's building details.</p>
1.1 grant 1171:
1172: <p>This document is available in various formats:</p>
1173:
1174: <div class="itemizedlist">
1175: <ul type="disc">
1176: <li>
1177: <p><a href="index.html" target="_top">HTML</a></p>
1178: </li>
1179:
1180: <li>
1181: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1182: </li>
1183:
1184: <li>
1185: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1186: </li>
1187:
1188: <li>
1189: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1190: </li>
1191: </ul>
1192: </div>
1193: </div>
1194:
1.55 ! rillig 1195: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1196: <div class="titlepage">
1197: <div>
1198: <div>
1199: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1200: "terminology" id=
1.1 grant 1201: "terminology"></a>1.3. Terminology</h2>
1202: </div>
1203: </div>
1204: </div>
1205:
1206: <p>There has been a lot of talk about “<span class=
1207: "quote">ports</span>”, “<span class=
1208: "quote">packages</span>”, etc. so far. Here is a
1209: description of all the terminology used within this
1210: document.</p>
1211:
1212: <div class="variablelist">
1213: <dl>
1214: <dt><span class="term">Package</span></dt>
1215:
1216: <dd>
1217: <p>A set of files and building instructions that
1218: describe what's necessary to build a certain piece of
1219: software using pkgsrc. Packages are traditionally
1.45 wiz 1220: stored under <code xmlns=
1221: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1222: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1223: </dd>
1224:
1225: <dt><span class="term">The NetBSD package
1226: system</span></dt>
1227:
1228: <dd>
1229: <p>This is the former name of “<span class=
1230: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1231: NetBSD operating system and can be bootstrapped to
1232: run on non-NetBSD operating systems as well. It
1233: handles building (compiling), installing, and
1234: removing of packages.</p>
1.1 grant 1235: </dd>
1236:
1237: <dt><span class="term">Distfile</span></dt>
1238:
1239: <dd>
1240: <p>This term describes the file or files that are
1241: provided by the author of the piece of software to
1242: distribute his work. All the changes necessary to
1243: build on NetBSD are reflected in the corresponding
1244: package. Usually the distfile is in the form of a
1245: compressed tar-archive, but other types are possible,
1.45 wiz 1246: too. Distfiles are usually stored below <code xmlns=
1247: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1248: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1249: </dd>
1250:
1251: <dt><span class="term">Port</span></dt>
1252:
1253: <dd>
1254: <p>This is the term used by FreeBSD and OpenBSD
1255: people for what we call a package. In NetBSD
1256: terminology, “<span class=
1257: "quote">port</span>” refers to a different
1258: architecture.</p>
1259: </dd>
1260:
1261: <dt><span class="term">Precompiled/binary
1262: package</span></dt>
1263:
1264: <dd>
1265: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1266: distfile and stuffed together in a single
1.45 wiz 1267: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1268: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1269: installed on machines of the same machine
1270: architecture without the need to recompile. Packages
1.45 wiz 1271: are usually generated in <code xmlns=
1272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1273: "filename">/usr/pkgsrc/packages</code>; there is also
1274: an archive on <a href=
1.1 grant 1275: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1276: "_top">ftp.NetBSD.org</a>.</p>
1277:
1278: <p>Sometimes, this is referred to by the term
1279: “<span class="quote">package</span>” too,
1280: especially in the context of precompiled
1281: packages.</p>
1282: </dd>
1283:
1284: <dt><span class="term">Program</span></dt>
1285:
1286: <dd>
1287: <p>The piece of software to be installed which will
1.47 reed 1288: be constructed from all the files in the distfile by
1.1 grant 1289: the actions defined in the corresponding package.</p>
1290: </dd>
1291: </dl>
1292: </div>
1293: </div>
1294:
1.55 ! rillig 1295: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1296: <div class="titlepage">
1297: <div>
1298: <div>
1299: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1300: "typography" id=
1.1 grant 1301: "typography"></a>1.4. Typography</h2>
1302: </div>
1303: </div>
1304: </div>
1305:
1306: <p>When giving examples for commands, shell prompts are
1307: used to show if the command should/can be issued as root,
1308: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1309: privileges are sufficient. We use a <code class=
1310: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1311: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1312: assuming they use the C-shell or tcsh.</p>
1.1 grant 1313: </div>
1314: </div>
1315:
1.55 ! rillig 1316: <div class="part" lang="en" xml:lang="en">
1.1 grant 1317: <div class="titlepage">
1318: <div>
1319: <div>
1.55 ! rillig 1320: <h1 class="title"><a name="users-guide" id=
1.48 dillo 1321: "users-guide"></a>Part I. The pkgsrc user's
1322: guide</h1>
1.1 grant 1323: </div>
1324: </div>
1325: </div>
1326:
1327: <div class="toc">
1328: <p><b>Table of Contents</b></p>
1329:
1330: <dl>
1331: <dt><span class="chapter"><a href="#getting">2. Where to
1332: get pkgsrc</a></span></dt>
1333:
1334: <dd>
1335: <dl>
1.30 wiz 1336: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1337: As tar file</a></span></dt>
1.1 grant 1338:
1.30 wiz 1339: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1340: SUP</a></span></dt>
1341:
1.30 wiz 1342: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1343: CVS</a></span></dt>
1344: </dl>
1345: </dd>
1346:
1347: <dt><span class="chapter"><a href="#platforms">3. Using
1348: pkgsrc on systems other than NetBSD</a></span></dt>
1349:
1350: <dd>
1351: <dl>
1.30 wiz 1352: <dt><span class="sect1"><a href=
1353: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1354: pkgsrc</a></span></dt>
1.1 grant 1355:
1.30 wiz 1356: <dt><span class="sect1"><a href=
1.47 reed 1357: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1358: notes</a></span></dt>
1.1 grant 1359:
1360: <dd>
1361: <dl>
1.30 wiz 1362: <dt><span class="sect2"><a href="#darwin">3.2.1.
1363: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1364:
1.30 wiz 1365: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1366: FreeBSD</a></span></dt>
1.22 tv 1367:
1.30 wiz 1368: <dt><span class="sect2"><a href="#interix">3.2.3.
1369: Interix</a></span></dt>
1.1 grant 1370:
1.30 wiz 1371: <dt><span class="sect2"><a href="#irix">3.2.4.
1372: IRIX</a></span></dt>
1.1 grant 1373:
1.30 wiz 1374: <dt><span class="sect2"><a href="#linux">3.2.5.
1375: Linux</a></span></dt>
1.1 grant 1376:
1.30 wiz 1377: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1378: OpenBSD</a></span></dt>
1.1 grant 1379:
1.30 wiz 1380: <dt><span class="sect2"><a href="#solaris">3.2.7.
1381: Solaris</a></span></dt>
1.1 grant 1382: </dl>
1383: </dd>
1384: </dl>
1385: </dd>
1386:
1387: <dt><span class="chapter"><a href="#using">4. Using
1388: pkgsrc</a></span></dt>
1389:
1390: <dd>
1391: <dl>
1392: <dt><span class="sect1"><a href=
1393: "#getting-started">4.1. Working with binary
1394: packages</a></span></dt>
1395:
1396: <dd>
1397: <dl>
1398: <dt><span class="sect2"><a href=
1.30 wiz 1399: "#where-to-get-binary-packages">4.1.1. Where to
1400: get binary packages</a></span></dt>
1.1 grant 1401:
1402: <dt><span class="sect2"><a href=
1.30 wiz 1403: "#how-to-use-binary-packages">4.1.2. How to use
1404: binary packages</a></span></dt>
1.1 grant 1405:
1406: <dt><span class="sect2"><a href=
1.30 wiz 1407: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1408: warning</a></span></dt>
1409: </dl>
1410: </dd>
1411:
1.30 wiz 1412: <dt><span class="sect1"><a href=
1413: "#building-packages-from-source">4.2. Building
1414: packages from source</a></span></dt>
1.1 grant 1415:
1416: <dd>
1417: <dl>
1418: <dt><span class="sect2"><a href=
1.30 wiz 1419: "#requirements">4.2.1.
1420: Requirements</a></span></dt>
1.1 grant 1421:
1422: <dt><span class="sect2"><a href=
1.30 wiz 1423: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1424: distfiles</a></span></dt>
1425:
1426: <dt><span class="sect2"><a href=
1.30 wiz 1427: "#how-to-build-and-install">4.2.3. How to build
1428: and install</a></span></dt>
1.1 grant 1429:
1430: <dt><span class="sect2"><a href=
1.30 wiz 1431: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1432: compiler</a></span></dt>
1433: </dl>
1434: </dd>
1435: </dl>
1436: </dd>
1437:
1.38 dillo 1438: <dt><span class="chapter"><a href="#configuring">5.
1439: Configuring pkgsrc</a></span></dt>
1440:
1441: <dd>
1442: <dl>
1443: <dt><span class="sect1"><a href=
1.45 wiz 1444: "#general-configuration">5.1. General
1445: configuration</a></span></dt>
1446:
1447: <dt><span class="sect1"><a href=
1448: "#variables-affecting-build">5.2. Variables affecting
1449: the build process</a></span></dt>
1450:
1451: <dt><span class="sect1"><a href=
1452: "#developer-advanced-settings">5.3.
1453: Developer/advanced settings</a></span></dt>
1454:
1455: <dt><span class="sect1"><a href=
1456: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1457: Options</a></span></dt>
1.38 dillo 1458: </dl>
1459: </dd>
1460:
1461: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1462: binary packages</a></span></dt>
1463:
1464: <dd>
1465: <dl>
1.30 wiz 1466: <dt><span class="sect1"><a href=
1.38 dillo 1467: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1468: single binary package</a></span></dt>
1.1 grant 1469:
1.30 wiz 1470: <dt><span class="sect1"><a href=
1.38 dillo 1471: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1472: Settings for creation of binary
1473: packages</a></span></dt>
1474:
1.38 dillo 1475: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1476: Doing a bulk build of all packages</a></span></dt>
1477:
1478: <dd>
1479: <dl>
1480: <dt><span class="sect2"><a href=
1.38 dillo 1481: "#binary.configuration">6.3.1.
1.1 grant 1482: Configuration</a></span></dt>
1483:
1484: <dt><span class="sect2"><a href=
1.38 dillo 1485: "#other-environmental-considerations">6.3.2.
1.30 wiz 1486: Other environmental
1.1 grant 1487: considerations</a></span></dt>
1488:
1489: <dt><span class="sect2"><a href=
1.38 dillo 1490: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1491:
1492: <dt><span class="sect2"><a href=
1.38 dillo 1493: "#what-it-does">6.3.4. What it
1.30 wiz 1494: does</a></span></dt>
1.1 grant 1495:
1496: <dt><span class="sect2"><a href=
1.38 dillo 1497: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1498: requirements</a></span></dt>
1499:
1500: <dt><span class="sect2"><a href=
1.38 dillo 1501: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1502: sandbox for chrooted builds</a></span></dt>
1.1 grant 1503:
1504: <dt><span class="sect2"><a href=
1.38 dillo 1505: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1506: partial set of packages</a></span></dt>
1.13 hubertf 1507:
1508: <dt><span class="sect2"><a href=
1.38 dillo 1509: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1510: build</a></span></dt>
1.1 grant 1511: </dl>
1512: </dd>
1513:
1.30 wiz 1514: <dt><span class="sect1"><a href=
1.38 dillo 1515: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1516: packages collection</a></span></dt>
1.1 grant 1517:
1518: <dd>
1519: <dl>
1520: <dt><span class="sect2"><a href=
1.38 dillo 1521: "#cdpack-example">6.4.1. Example of
1.1 grant 1522: cdpack</a></span></dt>
1523: </dl>
1524: </dd>
1525: </dl>
1526: </dd>
1527:
1.38 dillo 1528: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1529: Asked Questions</a></span></dt>
1530:
1531: <dd>
1532: <dl>
1.30 wiz 1533: <dt><span class="sect1"><a href=
1.38 dillo 1534: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1535: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1536:
1.38 dillo 1537: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1538: Where's the pkgviews documentation?</a></span></dt>
1539:
1.38 dillo 1540: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1541: Utilities for package management
1542: (pkgtools)</a></span></dt>
1543:
1.30 wiz 1544: <dt><span class="sect1"><a href=
1.38 dillo 1545: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1546: non-root</a></span></dt>
1.1 grant 1547:
1.30 wiz 1548: <dt><span class="sect1"><a href=
1.38 dillo 1549: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1550: fetching distfiles?</a></span></dt>
1.14 xtraeme 1551:
1.30 wiz 1552: <dt><span class="sect1"><a href=
1.38 dillo 1553: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1554: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1555:
1.30 wiz 1556: <dt><span class="sect1"><a href=
1.38 dillo 1557: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1558: from pkgsrc?</a></span></dt>
1.1 grant 1559:
1.30 wiz 1560: <dt><span class="sect1"><a href=
1.38 dillo 1561: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1562: behind a firewall</a></span></dt>
1.1 grant 1563:
1.38 dillo 1564: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1565: How do I tell <span><strong class="command">make
1.14 xtraeme 1566: fetch</strong></span> to do passive
1.1 grant 1567: FTP?</a></span></dt>
1568:
1.30 wiz 1569: <dt><span class="sect1"><a href=
1.38 dillo 1570: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1571: distfiles at once</a></span></dt>
1.1 grant 1572:
1.30 wiz 1573: <dt><span class="sect1"><a href=
1.38 dillo 1574: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1575: “<span class="quote">Don't know how to make
1576: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1577: mean?</a></span></dt>
1.13 hubertf 1578:
1.30 wiz 1579: <dt><span class="sect1"><a href=
1.38 dillo 1580: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1581: “<span class="quote">Could not find
1.14 xtraeme 1582: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1583:
1.30 wiz 1584: <dt><span class="sect1"><a href=
1.38 dillo 1585: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1586: pkgsrc</a></span></dt>
1.1 grant 1587:
1.38 dillo 1588: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1589: do I change the location of configuration
1590: files?</a></span></dt>
1.1 grant 1591:
1592: <dt><span class="sect1"><a href=
1.38 dillo 1593: "#audit-packages">7.15. Automated security
1.1 grant 1594: checks</a></span></dt>
1595: </dl>
1596: </dd>
1597: </dl>
1598: </div>
1599:
1.55 ! rillig 1600: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1601: <div class="titlepage">
1602: <div>
1603: <div>
1.55 ! rillig 1604: <h2 class="title"><a name="getting" id=
1.1 grant 1605: "getting"></a>Chapter 2. Where to get
1606: pkgsrc</h2>
1607: </div>
1608: </div>
1609: </div>
1610:
1611: <div class="toc">
1612: <p><b>Table of Contents</b></p>
1613:
1614: <dl>
1.30 wiz 1615: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1616: tar file</a></span></dt>
1617:
1.30 wiz 1618: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1619: SUP</a></span></dt>
1620:
1.30 wiz 1621: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1622: CVS</a></span></dt>
1623: </dl>
1624: </div>
1625:
1626: <p>There are three ways to get pkgsrc. Either as a tar
1627: file, via SUP, or via CVS. All three ways are described
1628: here.</p>
1629:
1.55 ! rillig 1630: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1631: <div class="titlepage">
1632: <div>
1633: <div>
1634: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1635: "as-tar-file" id="as-tar-file"></a>2.1. As tar
! 1636: file</h2>
1.1 grant 1637: </div>
1638: </div>
1639: </div>
1640:
1641: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1642: file from <a href=
1.11 ben 1643: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1644: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1645: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1646: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1647: </div>
1648:
1.55 ! rillig 1649: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1650: <div class="titlepage">
1651: <div>
1652: <div>
1653: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1654: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1655: </div>
1656: </div>
1657: </div>
1658:
1659: <p>As an alternative to the tar file, you can get pkgsrc
1660: via the Software Update Protocol, SUP. To do so, make
1661: sure your supfile has a line</p>
1662: <pre class="programlisting">
1.51 rillig 1663: release=pkgsrc
1.1 grant 1664: </pre>
1665:
1.45 wiz 1666: <p>in it, see the examples in <code xmlns=
1667: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1668: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1669: the <code xmlns=
1670: "http://www.w3.org/TR/xhtml1/transitional" class=
1671: "filename">/usr/pkgsrc</code> directory exists. Then,
1672: simply run <span><strong class="command">sup -v
1673: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1674: </div>
1675:
1.55 ! rillig 1676: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1677: <div class="titlepage">
1678: <div>
1679: <div>
1680: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1681: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1682: </div>
1683: </div>
1684: </div>
1685:
1686: <p>To get pkgsrc via CVS, make sure you have
1687: “<span class="quote">cvs</span>” installed.
1.27 rillig 1688: To do an initial (full) checkout of pkgsrc, do the
1689: following steps:</p>
1.1 grant 1690: <pre class="screen">
1.14 xtraeme 1691: <code class="prompt">%</code> <strong class=
1692: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1693: <code class="prompt">%</code> <strong class=
1694: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1695: <code class="prompt">%</code> <strong class=
1696: "userinput"><code>cd /usr</code></strong>
1697: <code class="prompt">%</code> <strong class=
1698: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1699: </pre>
1700:
1.45 wiz 1701: <p>This will create the <code xmlns=
1702: "http://www.w3.org/TR/xhtml1/transitional" class=
1703: "filename">pkgsrc</code> directory in your <code xmlns=
1704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1705: "filename">/usr</code>, and all the package source will
1.45 wiz 1706: be stored under <code xmlns=
1707: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1708: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1709: initial checkout, make sure you have <code class=
1710: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1711: <pre class="screen">
1.14 xtraeme 1712: <code class="prompt">%</code> <strong class=
1713: "userinput"><code>cd /usr/pkgsrc</code></strong>
1714: <code class="prompt">%</code> <strong class=
1715: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1716: </pre>
1717:
1718: <p>Please also note that it is possible to have multiple
1719: copies of the pkgsrc hierarchy in use at any one time -
1720: all work is done relatively within the pkgsrc tree.</p>
1721: </div>
1722: </div>
1723:
1.55 ! rillig 1724: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1725: <div class="titlepage">
1726: <div>
1727: <div>
1.55 ! rillig 1728: <h2 class="title"><a name="platforms" id=
1.1 grant 1729: "platforms"></a>Chapter 3. Using pkgsrc on
1730: systems other than NetBSD</h2>
1731: </div>
1732: </div>
1733: </div>
1734:
1735: <div class="toc">
1736: <p><b>Table of Contents</b></p>
1737:
1738: <dl>
1.30 wiz 1739: <dt><span class="sect1"><a href=
1740: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1741: pkgsrc</a></span></dt>
1.1 grant 1742:
1.30 wiz 1743: <dt><span class="sect1"><a href=
1.47 reed 1744: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1745: notes</a></span></dt>
1.1 grant 1746:
1747: <dd>
1748: <dl>
1.30 wiz 1749: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1750: Darwin (Mac OS X)</a></span></dt>
1751:
1.30 wiz 1752: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1753: FreeBSD</a></span></dt>
1754:
1.30 wiz 1755: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1756: Interix</a></span></dt>
1757:
1.30 wiz 1758: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1759: IRIX</a></span></dt>
1760:
1.30 wiz 1761: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1762: Linux</a></span></dt>
1763:
1.30 wiz 1764: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1765: OpenBSD</a></span></dt>
1766:
1.30 wiz 1767: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1768: Solaris</a></span></dt>
1769: </dl>
1770: </dd>
1771: </dl>
1772: </div>
1773:
1.55 ! rillig 1774: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1775: <div class="titlepage">
1776: <div>
1777: <div>
1778: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1779: "bootstrapping-pkgsrc" id=
1.30 wiz 1780: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1781: pkgsrc</h2>
1.1 grant 1782: </div>
1783: </div>
1784: </div>
1785:
1.27 rillig 1786: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1787: bootstrap kit to build the required tools to use pkgsrc
1788: on your platform. Besides support for native NetBSD,
1789: pkgsrc and the bootstrap kit have support for the
1790: following operating systems:</p>
1791:
1792: <div class="itemizedlist">
1793: <ul type="disc">
1794: <li>
1795: <p>Darwin (Mac OS X)</p>
1796: </li>
1797:
1798: <li>
1.16 grant 1799: <p>DragonFlyBSD</p>
1800: </li>
1801:
1802: <li>
1.1 grant 1803: <p>FreeBSD</p>
1804: </li>
1805:
1806: <li>
1807: <p>Interix (Windows 2000, XP, 2003)</p>
1808: </li>
1809:
1810: <li>
1811: <p>IRIX</p>
1812: </li>
1813:
1814: <li>
1815: <p>Linux</p>
1816: </li>
1817:
1818: <li>
1819: <p>OpenBSD</p>
1820: </li>
1821:
1822: <li>
1823: <p>Solaris</p>
1824: </li>
1.16 grant 1825:
1826: <li>
1827: <p>Tru64 (Digital UNIX/OSF1)</p>
1828: </li>
1.1 grant 1829: </ul>
1830: </div>
1831:
1832: <p>Support for other platforms is under development.</p>
1833:
1834: <p>Installing the bootstrap kit should be as simple
1835: as:</p>
1836: <pre class="screen">
1.14 xtraeme 1837: <code class="prompt">#</code> <strong class=
1838: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1839: <code class="prompt">#</code> <strong class=
1840: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1841: <code class="prompt">#</code> <strong class=
1842: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1843: </pre>
1844:
1845: <p>See <a href="#getting" title=
1.55 ! rillig 1846: "Chapter 2. Where to get pkgsrc">Chapter 2,
1.1 grant 1847: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1848: pkgsrc before bootstrapping. The given
1849: <span><strong class="command">bootstrap</strong></span>
1.45 wiz 1850: command will use the defaults of <code xmlns=
1851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1852: "filename">/usr/pkg</code> for the <span class=
1853: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1854: installed in, and <code xmlns=
1855: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1856: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1857: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1858: However, these can also be set using command-line
1.27 rillig 1859: arguments.</p>
1.1 grant 1860:
1861: <p>Binary packages for the pkgsrc tools and an initial
1862: set of packages is available for supported platforms. An
1863: up-to-date list of these can be found on <a href=
1864: "http://www.pkgsrc.org/" target=
1865: "_top">www.pkgsrc.org</a>.</p>
1.47 reed 1866:
1867: <div class="note" style=
1868: "margin-left: 0.5in; margin-right: 0.5in;">
1869: <h3 class="title">Note</h3>
1870:
1871: <p>The bootstrap installs a <span><strong class=
1872: "command">bmake</strong></span> tool. Use this
1873: <span><strong class="command">bmake</strong></span>
1874: when building via pkgsrc. For examples in this guide,
1875: use <span><strong class="command">bmake</strong></span>
1876: instead of “<span class=
1877: "quote">make</span>”.</p>
1878: </div>
1.1 grant 1879: </div>
1880:
1.55 ! rillig 1881: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1882: <div class="titlepage">
1883: <div>
1884: <div>
1885: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 1886: "platform-specific-notes" id=
1.47 reed 1887: "platform-specific-notes"></a>3.2. Platform-specific
1888: notes</h2>
1.1 grant 1889: </div>
1890: </div>
1891: </div>
1892:
1893: <p>Here are some platform-specific notes you should be
1894: aware of.</p>
1895:
1.55 ! rillig 1896: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 1897: <div class="titlepage">
1898: <div>
1899: <div>
1.55 ! rillig 1900: <h3 class="title"><a name="darwin" id=
1.30 wiz 1901: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1902: </div>
1903: </div>
1904: </div>
1905:
1906: <p>Darwin 5.x and 6.x are supported. There are two
1907: methods of using pkgsrc on Mac OS X, by using a
1908: <a href="#platform.osx-image" title=
1909: "3.2.1.1. Using a disk image">disk image</a>, or a
1910: <a href="#platform.osx-ufs" title=
1911: "3.2.1.2. Using a UFS partition">UFS
1912: partition</a>.</p>
1913:
1914: <p>Before you start, you will need to download and
1915: install the Mac OS X Developer Tools from Apple's
1916: Developer Connection. See <a href=
1917: "http://developer.apple.com/macosx/" target=
1918: "_top">http://developer.apple.com/macosx/</a> for
1919: details. Also, make sure you install X11 for Mac OS X
1920: and the X11 SDK from <a href=
1921: "http://www.apple.com/macosx/x11/download/" target=
1922: "_top">http://www.apple.com/macosx/x11/download/</a> if
1923: you intend to build packages that use the X11 Window
1924: System.</p>
1925:
1926: <p>If you already have a UFS partition, or have a spare
1927: partition that you can format as UFS, it is recommended
1928: to use that instead of the disk image. It'll be
1929: somewhat faster and will mount automatically at boot
1930: time, where you must manually mount a disk image.</p>
1931:
1932: <div class="note" style=
1933: "margin-left: 0.5in; margin-right: 0.5in;">
1934: <h3 class="title">Note</h3>
1935:
1936: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 1937: because pkgsrc currently requires the file system to
1.1 grant 1938: be case-sensitive, and HFS+ is not.</p>
1939: </div>
1940:
1.55 ! rillig 1941: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 1942: <div class="titlepage">
1943: <div>
1944: <div>
1.55 ! rillig 1945: <h4 class="title"><a name="platform.osx-image"
! 1946: id="platform.osx-image"></a>3.2.1.1. Using
! 1947: a disk image</h4>
1.1 grant 1948: </div>
1949: </div>
1950: </div>
1951:
1952: <p>Create the disk image:</p>
1953: <pre class="screen">
1.14 xtraeme 1954: <code class="prompt">#</code> <strong class=
1955: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1956: <code class="prompt">#</code> <strong class=
1957: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1958: <code class="prompt">#</code> <strong class=
1959: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1960: <code class="prompt">#</code> <strong class=
1961: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1962: </pre>
1963:
1964: <p>That's it!</p>
1965: </div>
1966:
1.55 ! rillig 1967: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 1968: <div class="titlepage">
1969: <div>
1970: <div>
1.55 ! rillig 1971: <h4 class="title"><a name="platform.osx-ufs"
! 1972: id="platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 1973: UFS partition</h4>
1974: </div>
1975: </div>
1976: </div>
1977:
1.45 wiz 1978: <p>By default, <code xmlns=
1979: "http://www.w3.org/TR/xhtml1/transitional" class=
1980: "filename">/usr</code> will be on your root file
1981: system, normally HFS+. It is possible to use the
1982: default <span class="emphasis"><em>prefix</em></span>
1983: of <code xmlns=
1984: "http://www.w3.org/TR/xhtml1/transitional" class=
1985: "filename">/usr/pkg</code> by symlinking <code xmlns=
1986: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1987: "filename">/usr/pkg</code> to a directory on a UFS
1988: file system. Obviously, another symlink is required
1989: if you want to place the package database directory
1990: outside the <span class=
1991: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1992: <pre class="screen">
1.14 xtraeme 1993: <code class="prompt">#</code> <strong class=
1.22 tv 1994: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1995: </pre>
1996:
1997: <p>If you created your partitions at the time of
1998: installing Mac OS X and formatted the target
1999: partition as UFS, it should automatically mount on
1.45 wiz 2000: <code xmlns=
2001: "http://www.w3.org/TR/xhtml1/transitional" class=
2002: "filename">/Volumes/<volume name></code> when
2003: the machine boots. If you are (re)formatting a
2004: partition as UFS, you need to ensure that the
2005: partition map correctly reflects “<span class=
2006: "quote">Apple_UFS</span>” and not
2007: “<span class=
1.1 grant 2008: "quote">Apple_HFS</span>”.</p>
2009:
2010: <p>The problem is that none of the disk tools will
2011: let you touch a disk that is booted from. You can
2012: unmount the partition, but even if you newfs it, the
2013: partition type will be incorrect and the automounter
2014: won't mount it. It can be mounted manually, but it
2015: won't appear in Finder.</p>
2016:
2017: <p>You'll need to boot off of the OS X Installation
2018: (User) CD. When the Installation program starts, go
2019: up to the menu and select Disk Utility. Now, you will
2020: be able to select the partition you want to be UFS,
2021: and Format it Apple UFS. Quit the Disk Utility, quit
2022: the installer which will reboot your machine. The new
2023: UFS file system will appear in Finder.</p>
2024:
2025: <p>Be aware that the permissions on the new file
2026: system will be writable by root only.</p>
2027:
2028: <p>This note is as of 10.2 (Jaguar) and applies to
2029: earlier versions. Hopefully Apple will fix Disk
2030: Utility in 10.3 (Panther).</p>
2031: </div>
2032: </div>
2033:
1.55 ! rillig 2034: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2035: <div class="titlepage">
2036: <div>
2037: <div>
1.55 ! rillig 2038: <h3 class="title"><a name="freebsd" id=
1.30 wiz 2039: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2040: </div>
2041: </div>
2042: </div>
2043:
2044: <p>FreeBSD 4.7 and 5.0 have been tested and are
2045: supported, other versions may work.</p>
2046:
2047: <p>Care should be taken so that the tools that this kit
2048: installs do not conflict with the FreeBSD userland
2049: tools. There are several steps:</p>
2050:
2051: <div class="orderedlist">
2052: <ol type="1">
2053: <li>
2054: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2055: <code xmlns=
2056: "http://www.w3.org/TR/xhtml1/transitional" class=
2057: "filename">/var/db/pkg</code>. It is therefore
2058: recommended that you choose a different location
2059: (e.g. <code xmlns=
2060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2061: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2062: --pkgdbdir option to the bootstrap script.</p>
2063: </li>
2064:
2065: <li>
2066: <p>If you do not intend to use the FreeBSD ports
2067: tools, it's probably a good idea to move them out
2068: of the way to avoid confusion, e.g.</p>
2069: <pre class="screen">
1.14 xtraeme 2070: <code class="prompt">#</code> <strong class=
2071: "userinput"><code>cd /usr/sbin</code></strong>
2072: <code class="prompt">#</code> <strong class=
2073: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2074: <code class="prompt">#</code> <strong class=
2075: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2076: <code class="prompt">#</code> <strong class=
2077: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2078: <code class="prompt">#</code> <strong class=
2079: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2080: </pre>
2081: </li>
2082:
2083: <li>
1.45 wiz 2084: <p>An example <code xmlns=
2085: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2086: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2087: placed in <code xmlns=
2088: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2089: "filename">/etc/mk.conf.example</code> file when
2090: you use the bootstrap script.</p>
1.1 grant 2091: </li>
2092: </ol>
2093: </div>
2094: </div>
2095:
1.55 ! rillig 2096: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2097: <div class="titlepage">
2098: <div>
2099: <div>
1.55 ! rillig 2100: <h3 class="title"><a name="interix" id=
1.30 wiz 2101: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2102: </div>
2103: </div>
2104: </div>
2105:
1.47 reed 2106: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2107: Windows NT kernel, providing a Unix-like environment
2108: with a tighter kernel integration than available with
2109: Cygwin. It is part of the Windows Services for Unix
2110: package, available for free for any licensed copy of
1.22 tv 2111: Windows 2000, XP (not including XP Home), or 2003. SFU
2112: can be downloaded from <a href=
2113: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2114: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2115:
2116: <p>Services for Unix 3.5, current as of this writing,
2117: has been tested. 3.0 or 3.1 may work, but are not
2118: officially supported. (The main difference in 3.0/3.1
2119: is lack of pthreads.)</p>
2120:
1.55 ! rillig 2121: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2122: <div class="titlepage">
2123: <div>
2124: <div>
2125: <h4 class="title"><a name=
1.55 ! rillig 2126: "platform.interix-sfu-install" id=
1.1 grant 2127: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2128: installing Interix/SFU</h4>
1.1 grant 2129: </div>
2130: </div>
2131: </div>
2132:
2133: <p>At an absolute minimum, the following packages
2134: must be installed from the Windows Services for Unix
2135: 3.5 distribution in order to use pkgsrc:</p>
2136:
2137: <div class="itemizedlist">
2138: <ul type="disc">
2139: <li>
2140: <p>Utilities -> Base Utilities</p>
2141: </li>
2142:
2143: <li>
2144: <p>Interix GNU Components -> (all)</p>
2145: </li>
2146:
2147: <li>
2148: <p>Remote Connectivity</p>
2149: </li>
2150:
2151: <li>
2152: <p>Interix SDK</p>
2153: </li>
2154: </ul>
2155: </div>
2156:
2157: <p>When using pkgsrc on Interix, DO NOT install the
2158: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2159: without shared module support, installed to
2160: /usr/local, and will only cause confusion. Instead,
2161: install Perl 5.8 from pkgsrc (or from a binary
2162: package).</p>
2163:
2164: <p>The Remote Connectivity subcomponent "Windows
2165: Remote Shell Service" does not need to be installed,
2166: but Remote Connectivity itself should be installed in
2167: order to have a working inetd.</p>
2168:
1.52 tv 2169: <p>During installation you may be asked whether to
2170: enable setuid behavior for Interix programs, and
2171: whether to make pathnames default to case-sensitive.
2172: Setuid should be enabled, and case-sensitivity MUST
2173: be enabled. (Without case-sensitivity, a large number
2174: of packages including perl will not build.)</p>
2175:
2176: <p>NOTE: Newer Windows service packs change the way
2177: binary execution works (via the Data Execution
2178: Prevention feature). In order to use pkgsrc and other
2179: gcc-compiled binaries reliably, a hotfix containing
2180: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2181: (899522 or newer) must be installed. Hotfixes are
2182: available from Microsoft through a support contract;
2183: however, a NetBSD developer has made most Interix
2184: hotfixes available for personal use from <a href=
2185: "http://www.duh.org/interix/hotfixes.php" target=
2186: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2187: </div>
2188:
1.55 ! rillig 2189: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2190: <div class="titlepage">
2191: <div>
2192: <div>
2193: <h4 class="title"><a name=
1.55 ! rillig 2194: "platform.interix-sfu-postinstall" id=
1.1 grant 2195: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2196: to do if Interix/SFU is already installed</h4>
2197: </div>
2198: </div>
2199: </div>
2200:
2201: <p>If SFU is already installed and you wish to alter
2202: these settings to work with pkgsrc, note the
2203: following things.</p>
2204:
2205: <div class="itemizedlist">
2206: <ul type="disc">
2207: <li>
2208: <p>To uninstall UNIX Perl, use Add/Remove
2209: Programs, select Microsoft Windows Services for
2210: UNIX, then click Change. In the installer,
2211: choose Add or Remove, then uncheck
2212: Utilities->UNIX Perl.</p>
2213: </li>
2214:
2215: <li>
1.47 reed 2216: <p>To enable case-sensitivity for the file
2217: system, run REGEDIT.EXE, and change the
1.1 grant 2218: following registry key:</p>
2219:
2220: <p>
2221: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2222: Manager\kernel</p>
2223:
2224: <p>Set the DWORD value "obcaseinsensitive" to
2225: 0; then reboot.</p>
2226: </li>
2227:
2228: <li>
2229: <p>To enable setuid binaries (optional), run
2230: REGEDIT.EXE, and change the following registry
2231: key:</p>
2232:
2233: <p>
2234: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2235: for UNIX</p>
2236:
2237: <p>Set the DWORD value "EnableSetuidBinaries"
2238: to 1; then reboot.</p>
2239: </li>
2240: </ul>
2241: </div>
2242: </div>
2243:
1.55 ! rillig 2244: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2245: <div class="titlepage">
2246: <div>
2247: <div>
2248: <h4 class="title"><a name=
1.55 ! rillig 2249: "platform.interix-notes" id=
1.1 grant 2250: "platform.interix-notes"></a>3.2.3.3. Important
2251: notes for using pkgsrc</h4>
2252: </div>
2253: </div>
2254: </div>
2255:
1.52 tv 2256: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2257: or the user running "pkg_add") must be a member of
2258: the local Administrators group. Such a user must also
2259: be used to run the bootstrap. This is slightly
2260: relaxed from the normal pkgsrc requirement of
2261: "root".</p>
2262:
2263: <p>The package manager should use a umask of 002.
2264: "make install" will automatically complain if this is
2265: not the case. This ensures that directories written
2266: in /var/db/pkg are Administrators-group
2267: writeable.</p>
2268:
2269: <p>The popular Interix binary packages from
2270: http://www.interopsystems.com/ use an older version
2271: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2272: used in conjunction with pkgsrc. If you choose to use
2273: them at the same time as the pkgsrc packages, ensure
2274: that you use the proper pkg_* tools for each type of
2275: binary package.</p>
1.22 tv 2276:
2277: <p>The TERM setting used for DOS-type console windows
2278: (including those invoked by the csh and ksh startup
2279: shortcuts) is "interix". Most systems don't have a
2280: termcap/terminfo entry for it, but the following
2281: .termcap entry provides adequate emulation in most
2282: cases:</p>
2283: <pre class="programlisting">
1.51 rillig 2284: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2285: </pre>
1.1 grant 2286: </div>
1.52 tv 2287:
1.55 ! rillig 2288: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2289: <div class="titlepage">
2290: <div>
2291: <div>
2292: <h4 class="title"><a name=
1.55 ! rillig 2293: "platform.interix-limits" id=
1.52 tv 2294: "platform.interix-limits"></a>3.2.3.4. Limitations
2295: of the Interix platform</h4>
2296: </div>
2297: </div>
2298: </div>
2299:
2300: <p>Though Interix suffices as a familiar and flexible
2301: substitute for a full Unix-like platform, it has some
2302: drawbacks that should be noted for those desiring to
2303: make the most of Interix.</p>
2304:
2305: <div class="itemizedlist">
2306: <ul type="disc">
2307: <li>
1.54 tv 2308: <p><span class=
2309: "strong"><strong>X-Windows:</strong></span></p>
1.52 tv 2310:
2311: <p>Interix comes with the standard set of X11R6
2312: client libraries, and can run X-Windows based
2313: applications, but it does <span class=
2314: "emphasis"><em>not</em></span> come with an X
2315: server. Some options are <a href=
2316: "http://www.starnet.com/products/xwin32/"
2317: target="_top">StarNet X-Win32</a>, <a href=
2318: "http://connectivity.hummingbird.com/products/nc/exceed/"
2319: target="_top">Hummingbird Exceed</a>, and the
2320: free X-Windows server included with <a href=
2321: "http://x.cygwin.com/" target=
2322: "_top">Cygwin</a>.</p>
2323:
2324: <p>Also, StarNet Communications has graciously
2325: provided a free version of their X-Win32
2326: product that accepts connections only from
2327: localhost: <a href=
2328: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2329: target="_top">X-Win32 LX</a>, recommended by
2330: the maintainer of Interix pkgsrc support.</p>
2331: </li>
2332:
2333: <li>
1.54 tv 2334: <p><span class="strong"><strong>X-Windows
2335: acceleration:</strong></span></p>
1.52 tv 2336:
2337: <p>Because Interix runs in a completely
2338: different NT subsystem from Win32 applications,
2339: it does not currently support various X11
2340: protocol extensions for acceleration (such as
2341: MIT-SHM or DGA). Most interactive applications
2342: to a local X server will run reasonably fast,
2343: but full motion video and other graphics
2344: intensive applications may require a
2345: faster-than-expected CPU.</p>
2346: </li>
2347:
2348: <li>
1.54 tv 2349: <p><span class=
2350: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2351:
2352: <p>Interix has no native support for audio
1.53 tv 2353: output. For audio support, pkgsrc uses the
2354: <span><strong class=
1.52 tv 2355: "command">esound</strong></span> client/server
2356: audio system on Interix. Unlike on most
2357: platforms, the <a xmlns=
2358: "http://www.w3.org/TR/xhtml1/transitional"
2359: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2360: target="_top"><code xmlns="" class=
2361: "filename">audio/esound</code></a> package does
2362: <span class="emphasis"><em>not</em></span>
2363: contain the <span><strong class=
1.53 tv 2364: "command">esd</strong></span> server component.
2365: To output audio via an Interix host, the
2366: <a xmlns=
1.52 tv 2367: "http://www.w3.org/TR/xhtml1/transitional"
2368: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2369: target="_top"><code xmlns="" class=
2370: "filename">emulators/cygwin_esound</code></a>
2371: package must also be installed.</p>
2372: </li>
2373:
2374: <li>
1.54 tv 2375: <p><span class="strong"><strong>CD/DVDs, USB,
2376: and SCSI:</strong></span></p>
1.52 tv 2377:
2378: <p>Direct device access is not currently
2379: supported in Interix, so it is not currently
2380: possible to access CD/DVD drives, USB devices,
2381: or SCSI devices through non-filesystem means.
2382: Among other things, this makes it impossible to
2383: use Interix directly for CD/DVD burning.</p>
2384: </li>
2385:
2386: <li>
1.54 tv 2387: <p><span class="strong"><strong>Tape
2388: drives:</strong></span></p>
1.52 tv 2389:
2390: <p>Due to the same limitations as for CD-ROMs
2391: and SCSI devices, tape drives are also not
2392: directly accessible in Interix. However,
2393: support is in work to make tape drive access
2394: possible by using Cygwin as a bridge (similarly
2395: to audio bridged via Cygwin's esound
2396: server).</p>
2397: </li>
2398: </ul>
2399: </div>
2400: </div>
2401:
1.55 ! rillig 2402: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2403: <div class="titlepage">
2404: <div>
2405: <div>
2406: <h4 class="title"><a name=
1.55 ! rillig 2407: "platform.interix-knownissues" id=
1.52 tv 2408: "platform.interix-knownissues"></a>3.2.3.5. Known
2409: issues for pkgsrc on Interix</h4>
2410: </div>
2411: </div>
2412: </div>
2413:
2414: <p>It is not necessary, in general, to have a "root"
2415: user on the Windows system; any member of the local
2416: Administrators group will suffice. However, some
2417: packages currently assume that the user named "root"
2418: is the privileged user. To accommodate these, you may
2419: create such a user; make sure it is in the local
2420: group Administrators (or your language
2421: equivalent).</p>
2422:
2423: <p>"pkg_add" creates directories of mode 0755, not
2424: 0775, in $PKG_DBDIR. For the time being, install
2425: packages as the local Administrator (or your language
2426: equivalent), or run the following command after
2427: installing a package to work around the issue:</p>
2428: <pre class="screen">
2429: <code class="prompt">#</code> <strong class=
2430: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2431: </pre>
2432: </div>
1.1 grant 2433: </div>
2434:
1.55 ! rillig 2435: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2436: <div class="titlepage">
2437: <div>
2438: <div>
1.55 ! rillig 2439: <h3 class="title"><a name="irix" id=
1.30 wiz 2440: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2441: </div>
2442: </div>
2443: </div>
2444:
2445: <p>You will need a working C compiler, either gcc or
2446: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2447: the <code class="varname">CC</code> environment
2448: variable according to your preference. If you do not
2449: have a license for the MIPSpro compiler suite, you can
1.1 grant 2450: download a gcc tardist file from <a href=
2451: "http://freeware.sgi.com/" target=
2452: "_top">http://freeware.sgi.com/</a>.</p>
2453:
2454: <p>Please note that you will need IRIX 6.5.17 or
2455: higher, as this is the earliest version of IRIX
1.24 wiz 2456: providing support for <a href=
2457: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2458: <span class="citerefentry"><span class=
2459: "refentrytitle">if_indextoname</span>(3)</span></a>,
2460: <a href=
2461: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2462: <span class="citerefentry"><span class=
2463: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2464: etc.</p>
1.1 grant 2465:
1.27 rillig 2466: <p>At this point in time, pkgsrc only supports one ABI
2467: at a time. That is, you can not switch between the old
2468: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2469: you start out using "abi=n32", that's what all your
2470: packages will be built with.</p>
1.1 grant 2471:
2472: <p>Therefore, please make sure that you have no
1.14 xtraeme 2473: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2474: environment or the <code xmlns=
2475: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2476: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2477: that you do not try to link n32 object files with lib64
1.45 wiz 2478: or vice versa. Check your <code xmlns=
2479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2480: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2481:
2482: <p>If you have the actual pkgsrc tree mounted via NFS
2483: from a different host, please make sure to set
1.14 xtraeme 2484: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2485: directory, as it appears that IRIX linker occasionally
1.47 reed 2486: runs into issues when trying to link over a
2487: network-mounted file system.</p>
1.1 grant 2488:
2489: <p>The bootstrapping process should set all the right
2490: options for programs such as imake(1), but you may want
2491: to set some options depending on your local setup.
1.45 wiz 2492: Please see <code xmlns=
2493: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2494: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2495: course, your compiler's man pages for details.</p>
1.22 tv 2496:
2497: <p>If you are using SGI's MIPSPro compiler, please
2498: set</p>
2499: <pre class="programlisting">
1.51 rillig 2500: PKGSRC_COMPILER= mipspro
1.22 tv 2501: </pre>
2502:
1.45 wiz 2503: <p>in <code xmlns=
2504: "http://www.w3.org/TR/xhtml1/transitional" class=
2505: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2506: assume you are using gcc and may end up passing invalid
2507: flags to the compiler. Note that bootstrap should
2508: create an appropriate <code xmlns=
2509: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2510: "filename">mk.conf.example</code> by default.</p>
2511:
2512: <p>If you have both the MIPSPro compiler chain
2513: installed as well as gcc, but want to make sure that
2514: MIPRPro is used, please set your <code class=
2515: "varname">PATH</code> to <span class=
2516: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2517: gcc (often <code xmlns=
2518: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2519: "filename">/usr/freeware/bin</code>), and (important)
2520: pass the '--preserve-path' flag.</p>
1.1 grant 2521: </div>
2522:
1.55 ! rillig 2523: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2524: <div class="titlepage">
2525: <div>
2526: <div>
1.55 ! rillig 2527: <h3 class="title"><a name="linux" id=
1.30 wiz 2528: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2529: </div>
2530: </div>
2531: </div>
2532:
2533: <p>Some versions of Linux (for example Debian
2534: GNU/Linux) need either libtermcap or libcurses
2535: (libncurses). Installing the distributions
2536: libncurses-dev package (or equivalent) should fix the
2537: problem.</p>
2538:
2539: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2540: and icc (Intel C++ Compiler). gcc is the default. icc
2541: 8.0 and 8.1 on i386 have been tested.</p>
2542:
2543: <p>To bootstrap using icc, assuming the default icc
2544: installation directory:</p>
2545: <pre class="programlisting">
1.51 rillig 2546: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2547: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2548: </pre>
2549:
2550: <div class="note" style=
2551: "margin-left: 0.5in; margin-right: 0.5in;">
2552: <h3 class="title">Note</h3>
2553:
2554: <p>icc 8.1 needs the `-i-static' argument instead of
2555: -static-libcxa.</p>
2556: </div>
2557:
2558: <p>icc supports __attribute__, but the GNU configure
2559: test uses a nested function, which icc does not
2560: support. #undef'ing __attribute__ has the unfortunate
2561: side-effect of breaking many of the Linux header files,
2562: which cannot be compiled properly without
2563: __attribute__. The test must be overridden so that
2564: __attribute__ is assumed supported by the compiler.</p>
2565:
2566: <p>After bootstrapping, you should set <code class=
1.45 wiz 2567: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2568: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2569: "filename">/etc/mk.conf</code>:</p>
2570: <pre class="programlisting">
1.51 rillig 2571: PKGSRC_COMPILER= icc
1.22 tv 2572: </pre>
2573:
2574: <p>The default installation directory for icc is
1.45 wiz 2575: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2576: class="filename">/opt/intel_cc_80</code>, which is also
2577: the pkgsrc default. If you have installed it into a
2578: different directory, set <code class=
2579: "varname">ICCBASE</code> in <code xmlns=
2580: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2581: "filename">/etc/mk.conf</code>:</p>
2582: <pre class="programlisting">
1.51 rillig 2583: ICCBASE= /opt/icc
1.22 tv 2584: </pre>
2585:
2586: <p>pkgsrc uses the static linking method of the runtime
2587: libraries provided by icc, so binaries can be run on
2588: other systems which do not have the shared libraries
2589: installed.</p>
2590:
2591: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2592: the <a href=
2593: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2594: <span class="citerefentry"><span class=
2595: "refentrytitle">ld</span>(1)</span></a> command run
2596: when linking a C++ shared library and records it,
2597: throwing away the -Bstatic and -Bdynamic options
2598: interspersed between the libraries. This means that
2599: libtool-linked C++ shared libraries will have a runtime
2600: dependency on the icc libraries until this is fixed in
2601: libtool.</p>
1.22 tv 2602: </div>
2603:
1.55 ! rillig 2604: <div class="sect2" lang="en" xml:lang="en">
1.22 tv 2605: <div class="titlepage">
2606: <div>
2607: <div>
1.55 ! rillig 2608: <h3 class="title"><a name="openbsd" id=
1.30 wiz 2609: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2610: </div>
2611: </div>
2612: </div>
2613:
2614: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2615:
2616: <p>Care should be taken so that the tools that this kit
2617: installs do not conflict with the OpenBSD userland
2618: tools. There are several steps:</p>
2619:
2620: <div class="orderedlist">
2621: <ol type="1">
2622: <li>
2623: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2624: <code xmlns=
2625: "http://www.w3.org/TR/xhtml1/transitional" class=
2626: "filename">/var/db/pkg</code>. It is therefore
2627: recommended that you choose a different location
2628: (e.g. <code xmlns=
2629: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2630: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2631: --pkgdbdir option to the bootstrap script.</p>
2632: </li>
2633:
2634: <li>
2635: <p>If you do not intend to use the OpenBSD ports
2636: tools, it's probably a good idea to move them out
2637: of the way to avoid confusion, e.g.</p>
2638: <pre class="screen">
1.14 xtraeme 2639: <code class="prompt">#</code> <strong class=
2640: "userinput"><code>cd /usr/sbin</code></strong>
2641: <code class="prompt">#</code> <strong class=
2642: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2643: <code class="prompt">#</code> <strong class=
2644: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2645: <code class="prompt">#</code> <strong class=
2646: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2647: <code class="prompt">#</code> <strong class=
2648: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2649: </pre>
2650: </li>
2651:
2652: <li>
1.45 wiz 2653: <p>An example <code xmlns=
2654: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2655: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2656: placed in <code xmlns=
2657: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2658: "filename">/etc/mk.conf.example</code> file when
2659: you use the bootstrap script. OpenBSD's make
1.45 wiz 2660: program uses <code xmlns=
2661: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2662: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2663: work around this by enclosing all the
2664: pkgsrc-specific parts of the file with:</p>
1.1 grant 2665: <pre class="programlisting">
1.51 rillig 2666: .ifdef BSD_PKG_MK
2667: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2668: .else
2669: # OpenBSD stuff
2670: .endif
1.1 grant 2671: </pre>
2672: </li>
2673: </ol>
2674: </div>
2675: </div>
2676:
1.55 ! rillig 2677: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2678: <div class="titlepage">
2679: <div>
2680: <div>
1.55 ! rillig 2681: <h3 class="title"><a name="solaris" id=
1.30 wiz 2682: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2683: </div>
2684: </div>
2685: </div>
2686:
2687: <p>Solaris 2.6 through 9 are supported on both x86 and
2688: sparc. You will need a working C compiler. Both gcc
2689: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2690:
2691: <p>The following packages are required on Solaris 8 for
2692: the bootstrap process and to build packages.</p>
2693:
2694: <div class="itemizedlist">
2695: <ul type="disc">
2696: <li>
2697: <p>SUNWsprot</p>
2698: </li>
2699:
2700: <li>
2701: <p>SUNWarc</p>
2702: </li>
2703:
2704: <li>
2705: <p>SUNWbtool</p>
2706: </li>
2707:
2708: <li>
2709: <p>SUNWtoo</p>
2710: </li>
2711:
2712: <li>
2713: <p>SUNWlibm</p>
2714: </li>
2715: </ul>
2716: </div>
2717:
2718: <p>Please note the use of GNU binutils on Solaris is
2719: <span class="emphasis"><em>not</em></span>
2720: supported.</p>
2721:
1.55 ! rillig 2722: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2723: <div class="titlepage">
2724: <div>
2725: <div>
1.55 ! rillig 2726: <h4 class="title"><a name="solaris-gcc-note"
! 2727: id="solaris-gcc-note"></a>3.2.7.1. If you
! 2728: are using gcc</h4>
1.1 grant 2729: </div>
2730: </div>
2731: </div>
2732:
2733: <p>It makes life much simpler if you only use the
2734: same gcc consistently for building all packages.</p>
2735:
2736: <p>It is recommended that an external gcc be used
2737: only for bootstrapping, then either build gcc from
2738: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2739: href=
2740: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2741: target="_top"><code xmlns="" class=
2742: "filename">lang/gcc</code></a> or install a binary
2743: gcc package, then remove gcc used during
1.20 ben 2744: bootstrapping.</p>
1.1 grant 2745:
2746: <p>Binary packages of gcc can be found through
2747: <a href=
2748: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2749: target=
2750: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2751: </div>
2752:
1.55 ! rillig 2753: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2754: <div class="titlepage">
2755: <div>
2756: <div>
1.30 wiz 2757: <h4 class="title"><a name=
1.55 ! rillig 2758: "solaris-sun-workshop-note" id=
1.30 wiz 2759: "solaris-sun-workshop-note"></a>3.2.7.2. If
2760: you are using Sun WorkShop</h4>
1.1 grant 2761: </div>
2762: </div>
2763: </div>
2764:
2765: <p>You will need at least the following packages
2766: installed (from WorkShop 5.0)</p>
2767:
2768: <div class="itemizedlist">
2769: <ul type="disc">
2770: <li>
2771: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2772: </li>
2773:
2774: <li>
2775: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2776: </li>
2777:
2778: <li>
2779: <p>SPROild - Sun WorkShop Incremental
2780: Linker</p>
2781: </li>
2782:
2783: <li>
2784: <p>SPROlang - Sun WorkShop Compilers common
2785: components</p>
2786: </li>
2787: </ul>
2788: </div>
2789:
1.14 xtraeme 2790: <p>You should set <code class="varname">CC</code>,
2791: <code class="varname">CXX</code> and optionally,
1.45 wiz 2792: <code class="varname">CPP</code> in <code xmlns=
2793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2794: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2795: <pre class="programlisting">
1.51 rillig 2796: CC= cc
2797: CXX= CC
2798: CPP= /usr/ccs/lib/cpp
1.1 grant 2799: </pre>
2800:
2801: <p>You may also want to build 64-bit binaries,
1.47 reed 2802: e.g.:</p>
1.1 grant 2803: <pre class="programlisting">
1.51 rillig 2804: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2805: </pre>
2806:
2807: <p>Whichever compiler you use, please ensure the
2808: compiler tools and your $prefix are in your
1.14 xtraeme 2809: <code class="varname">PATH</code>. This includes
1.45 wiz 2810: <code xmlns=
2811: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2812: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2813: <code xmlns=
2814: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2815: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2816: </div>
2817: </div>
2818: </div>
2819: </div>
2820:
1.55 ! rillig 2821: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 2822: <div class="titlepage">
2823: <div>
2824: <div>
1.55 ! rillig 2825: <h2 class="title"><a name="using" id=
1.1 grant 2826: "using"></a>Chapter 4. Using pkgsrc</h2>
2827: </div>
2828: </div>
2829: </div>
2830:
2831: <div class="toc">
2832: <p><b>Table of Contents</b></p>
2833:
2834: <dl>
2835: <dt><span class="sect1"><a href="#getting-started">4.1.
2836: Working with binary packages</a></span></dt>
2837:
2838: <dd>
2839: <dl>
1.30 wiz 2840: <dt><span class="sect2"><a href=
2841: "#where-to-get-binary-packages">4.1.1. Where to get
2842: binary packages</a></span></dt>
1.1 grant 2843:
1.30 wiz 2844: <dt><span class="sect2"><a href=
2845: "#how-to-use-binary-packages">4.1.2. How to use
2846: binary packages</a></span></dt>
1.1 grant 2847:
1.30 wiz 2848: <dt><span class="sect2"><a href=
2849: "#a-word-of-warning">4.1.3. A word of
2850: warning</a></span></dt>
1.1 grant 2851: </dl>
2852: </dd>
2853:
1.30 wiz 2854: <dt><span class="sect1"><a href=
2855: "#building-packages-from-source">4.2. Building packages
2856: from source</a></span></dt>
1.1 grant 2857:
2858: <dd>
2859: <dl>
1.30 wiz 2860: <dt><span class="sect2"><a href=
2861: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2862:
1.30 wiz 2863: <dt><span class="sect2"><a href=
2864: "#fetching-distfiles">4.2.2. Fetching
2865: distfiles</a></span></dt>
1.1 grant 2866:
1.30 wiz 2867: <dt><span class="sect2"><a href=
2868: "#how-to-build-and-install">4.2.3. How to build and
2869: install</a></span></dt>
1.1 grant 2870:
1.30 wiz 2871: <dt><span class="sect2"><a href=
2872: "#selecting-the-compiler">4.2.4. Selecting the
2873: compiler</a></span></dt>
1.1 grant 2874: </dl>
2875: </dd>
2876: </dl>
2877: </div>
2878:
1.55 ! rillig 2879: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 2880: <div class="titlepage">
2881: <div>
2882: <div>
2883: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 2884: "getting-started" id=
1.1 grant 2885: "getting-started"></a>4.1. Working with binary
2886: packages</h2>
2887: </div>
2888: </div>
2889: </div>
2890:
2891: <p>This section describes how to find, retrieve and
2892: install a precompiled binary package that someone else
2893: already prepared for your type of machine.</p>
2894:
1.55 ! rillig 2895: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2896: <div class="titlepage">
2897: <div>
2898: <div>
1.30 wiz 2899: <h3 class="title"><a name=
1.55 ! rillig 2900: "where-to-get-binary-packages" id=
1.30 wiz 2901: "where-to-get-binary-packages"></a>4.1.1. Where
2902: to get binary packages</h3>
1.1 grant 2903: </div>
2904: </div>
2905: </div>
2906:
2907: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2908: and its mirrors in the directory <code xmlns=
2909: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2910: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2911: for anonymous FTP access. <code class=
2912: "varname">OSVERSION</code> is the NetBSD version
2913: (<span><strong class="command">uname
2914: -r</strong></span>), <code class="varname">ARCH</code>
2915: is the architecture (<span><strong class=
2916: "command">uname -p</strong></span>). In that directory,
2917: there is a subdirectory for each category plus a
1.45 wiz 2918: subdirectory <code xmlns=
2919: "http://www.w3.org/TR/xhtml1/transitional" class=
2920: "filename">All</code> which includes the actual
2921: binaries in <code xmlns=
2922: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2923: "filename">.tgz</code> files. The category
2924: subdirectories use symbolic links to those files (this
1.45 wiz 2925: is the same directory layout as in <code xmlns=
2926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2927: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2928:
1.47 reed 2929: <p>This same directory layout applies for CD-ROM
1.1 grant 2930: distributions, only that the directory may be rooted
1.45 wiz 2931: somewhere else, probably somewhere below <code xmlns=
2932: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2933: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 2934: documentation for the exact location.</p>
2935: </div>
2936:
1.55 ! rillig 2937: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2938: <div class="titlepage">
2939: <div>
2940: <div>
1.30 wiz 2941: <h3 class="title"><a name=
1.55 ! rillig 2942: "how-to-use-binary-packages" id=
1.30 wiz 2943: "how-to-use-binary-packages"></a>4.1.2. How
2944: to use binary packages</h3>
1.1 grant 2945: </div>
2946: </div>
2947: </div>
2948:
1.47 reed 2949: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 2950: to your hard disk, you can install them with the
1.27 rillig 2951: following command (be sure to <span><strong class=
1.14 xtraeme 2952: "command">su</strong></span> to root first):</p>
1.1 grant 2953: <pre class="screen">
1.14 xtraeme 2954: <code class="prompt">#</code> <strong class=
2955: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2956: </pre>
2957:
2958: <p>If you have FTP access and you don't want to
2959: download the packages via FTP prior to installation,
1.14 xtraeme 2960: you can do this automatically by giving
2961: <span><strong class="command">pkg_add</strong></span>
2962: an FTP URL:</p>
1.1 grant 2963: <pre class="screen">
1.14 xtraeme 2964: <code class="prompt">#</code> <strong class=
1.27 rillig 2965: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2966: </pre>
2967:
1.27 rillig 2968: <p>Note that any prerequisite packages needed to run
2969: the package in question will be installed, too,
1.1 grant 2970: assuming they are present where you install from.</p>
2971:
1.23 wiz 2972: <p>To save some typing, you can set the <code class=
2973: "varname">PKG_PATH</code> environment variable to a
1.47 reed 2974: semicolon-separated list of paths (including remote
1.23 wiz 2975: URLs); trailing slashes are not allowed.</p>
2976:
1.45 wiz 2977: <p>Additionally to the <code xmlns=
2978: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 2979: "filename">All</code> directory there exists a
1.45 wiz 2980: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2981: class="filename">vulnerable</code> directory to which
2982: binary packages with known vulnerabilities are moved,
2983: since removing them could cause missing dependencies.
2984: To use these packages, add the <code xmlns=
2985: "http://www.w3.org/TR/xhtml1/transitional" class=
2986: "filename">vulnerable</code> directory to your
2987: <code class="varname">PKG_PATH</code>. However, you
2988: should run <a xmlns=
1.23 wiz 2989: "http://www.w3.org/TR/xhtml1/transitional" href=
2990: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 2991: target="_top"><code xmlns="" class=
2992: "filename">security/audit-packages</code></a>
1.47 reed 2993: regularly, especially after installing new packages,
2994: and verify that the vulnerabilities are acceptable for
2995: your configuration. An example <code class=
2996: "varname">PKG_PATH</code> would be: <code xmlns=
2997: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2998: "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 2999: Please note that semicolon (';') is a shell
3000: meta-character, so you'll probably have to quote
3001: it.</p>
3002:
1.1 grant 3003: <p>After you've installed packages, be sure to have
1.45 wiz 3004: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3005: class="filename">/usr/pkg/bin</code> and <code xmlns=
3006: "http://www.w3.org/TR/xhtml1/transitional" class=
3007: "filename">/usr/pkg/sbin</code> in your <code class=
3008: "varname">PATH</code> so you can actually start the
3009: just installed program.</p>
1.1 grant 3010: </div>
3011:
1.55 ! rillig 3012: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3013: <div class="titlepage">
3014: <div>
3015: <div>
1.55 ! rillig 3016: <h3 class="title"><a name="a-word-of-warning" id=
1.30 wiz 3017: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3018: warning</h3>
3019: </div>
3020: </div>
3021: </div>
3022:
3023: <p>Please pay very careful attention to the warnings
3024: expressed in the <a href=
3025: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3026: <span class="citerefentry"><span class=
3027: "refentrytitle">pkg_add</span>(1)</span></a> manual
3028: page about the inherent dangers of installing binary
3029: packages which you did not create yourself, and the
3030: security holes that can be introduced onto your system
3031: by indiscriminate adding of such files.</p>
3032: </div>
3033: </div>
3034:
1.55 ! rillig 3035: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3036: <div class="titlepage">
3037: <div>
3038: <div>
3039: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3040: "building-packages-from-source" id=
1.30 wiz 3041: "building-packages-from-source"></a>4.2. Building
1.1 grant 3042: packages from source</h2>
3043: </div>
3044: </div>
3045: </div>
3046:
3047: <p>This assumes that the package is already in pkgsrc. If
3048: it is not, see <a href="#developers-guide" title=
1.46 gdt 3049: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3050: “The pkgsrc developer's guide”</a> for
3051: instructions how to create your own packages.</p>
1.1 grant 3052:
1.55 ! rillig 3053: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3054: <div class="titlepage">
3055: <div>
3056: <div>
1.55 ! rillig 3057: <h3 class="title"><a name="requirements" id=
1.30 wiz 3058: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3059: </div>
3060: </div>
3061: </div>
3062:
3063: <p>To build packages from source on a NetBSD system the
3064: “<span class="quote">comp</span>” and the
3065: “<span class="quote">text</span>”
3066: distribution sets must be installed. If you want to
1.47 reed 3067: build X11-related packages the “<span class=
1.1 grant 3068: "quote">xbase</span>” and “<span class=
3069: "quote">xcomp</span>” distribution sets are
3070: required, too.</p>
3071: </div>
3072:
1.55 ! rillig 3073: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3074: <div class="titlepage">
3075: <div>
3076: <div>
1.55 ! rillig 3077: <h3 class="title"><a name="fetching-distfiles"
! 3078: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3079: distfiles</h3>
3080: </div>
3081: </div>
3082: </div>
3083:
1.27 rillig 3084: <p>The first step for building a package is downloading
3085: the distfiles (i.e. the unmodified source). If they
3086: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3087: automatically.</p>
3088:
3089: <p>You can overwrite some of the major distribution
3090: sites to fit to sites that are close to your own. Have
1.45 wiz 3091: a look at <code xmlns=
3092: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3093: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3094: some examples — in particular, look for the
1.14 xtraeme 3095: <code class="varname">MASTER_SORT</code>, <code class=
3096: "varname">MASTER_SORT_REGEX</code> and <code class=
3097: "varname">INET_COUNTRY</code> definitions. This may
3098: save some of your bandwidth and time.</p>
1.1 grant 3099:
3100: <p>You can change these settings either in your shell's
3101: environment, or, if you want to keep the settings, by
1.45 wiz 3102: editing the <code xmlns=
3103: "http://www.w3.org/TR/xhtml1/transitional" class=
3104: "filename">/etc/mk.conf</code> file, and adding the
3105: definitions there.</p>
1.1 grant 3106:
3107: <p>If you don't have a permanent Internet connection
3108: and you want to know which files to download,
1.14 xtraeme 3109: <span><strong class="command">make
3110: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3111: need. Put these distfiles into <code xmlns=
3112: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3113: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3114: </div>
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.30 wiz 3120: <h3 class="title"><a name=
1.55 ! rillig 3121: "how-to-build-and-install" id=
1.30 wiz 3122: "how-to-build-and-install"></a>4.2.3. How to
3123: build and install</h3>
1.1 grant 3124: </div>
3125: </div>
3126: </div>
3127:
3128: <p>Assuming that the distfile has been fetched (see
3129: previous section), become root and change into the
1.47 reed 3130: relevant directory and run <span><strong class=
3131: "command">make</strong></span>.</p>
3132:
3133: <div class="note" style=
3134: "margin-left: 0.5in; margin-right: 0.5in;">
3135: <h3 class="title">Note</h3>
3136:
3137: <p>If using bootstrap or pkgsrc on a non-NetBSD
3138: system, use the pkgsrc <span><strong class=
3139: "command">bmake</strong></span> command instead of
3140: “<span class="quote">make</span>” in the
3141: examples in this guide.</p>
3142: </div>
3143:
3144: <p>For example, type</p>
1.1 grant 3145: <pre class="screen">
1.14 xtraeme 3146: <code class="prompt">%</code> <strong class=
3147: "userinput"><code>cd misc/figlet</code></strong>
3148: <code class="prompt">%</code> <strong class=
3149: "userinput"><code>make</code></strong>
1.1 grant 3150: </pre>
3151:
3152: <p>at the shell prompt to build the various components
3153: of the package, and</p>
3154: <pre class="screen">
1.14 xtraeme 3155: <code class="prompt">#</code> <strong class=
3156: "userinput"><code>make install</code></strong>
1.1 grant 3157: </pre>
3158:
3159: <p>to install the various components into the correct
3160: places on your system. Installing the package on your
3161: system requires you to be root. However, pkgsrc has a
3162: <span class="emphasis"><em>just-in-time-su</em></span>
3163: feature, which allows you to only become root for the
3164: actual installation step</p>
3165:
3166: <p>Taking the figlet utility as an example, we can
3167: install it on our system by building as shown in
3168: <a href="#logs" title=
1.55 ! rillig 3169: "Appendix B. Build logs">Appendix B, <i>Build
! 3170: logs</i></a>.</p>
1.1 grant 3171:
3172: <p>The program is installed under the default root of
1.45 wiz 3173: the packages tree - <code xmlns=
3174: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3175: "filename">/usr/pkg</code>. Should this not conform to
3176: your tastes, set the <code class=
3177: "varname">LOCALBASE</code> variable in your
1.1 grant 3178: environment, and it will use that value as the root of
1.45 wiz 3179: your packages tree. So, to use <code xmlns=
3180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3181: "filename">/usr/local</code>, set <code class=
3182: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3183: environment. Please note that you should use a
3184: directory which is dedicated to packages and not shared
1.47 reed 3185: with other programs (i.e., do not try and use
1.14 xtraeme 3186: <code class="varname">LOCALBASE=/usr</code>). Also, you
3187: should not try to add any of your own files or
1.45 wiz 3188: directories (such as <code xmlns=
3189: "http://www.w3.org/TR/xhtml1/transitional" class=
3190: "filename">src/</code>, <code xmlns=
3191: "http://www.w3.org/TR/xhtml1/transitional" class=
3192: "filename">obj/</code>, or <code xmlns=
3193: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3194: "filename">pkgsrc/</code>) below the <code class=
3195: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3196: possible conflicts between programs and other files
3197: installed by the package system and whatever else may
3198: have been installed there.</p>
3199:
1.45 wiz 3200: <p>Some packages look in <code xmlns=
3201: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3202: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3203: configuration options at build time. Have a look at
1.45 wiz 3204: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3205: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3206: get an overview of what will be set there by default.
1.14 xtraeme 3207: Environment variables such as <code class=
1.45 wiz 3208: "varname">LOCALBASE</code> can be set in <code xmlns=
3209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3210: "filename">/etc/mk.conf</code> to save having to
3211: remember to set them each time you want to use
3212: pkgsrc.</p>
1.1 grant 3213:
3214: <p>Occasionally, people want to “<span class=
3215: "quote">look under the covers</span>” to see what
3216: is going on when a package is building or being
3217: installed. This may be for debugging purposes, or out
3218: of simple curiosity. A number of utility values have
3219: been added to help with this.</p>
3220:
3221: <div class="orderedlist">
3222: <ol type="1">
3223: <li>
3224: <p>If you invoke the <a href=
3225: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3226: <span class="citerefentry"><span class=
3227: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3228: with <code class=
3229: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3230: amount of information will be displayed. For
3231: example,</p>
1.1 grant 3232: <pre class="screen">
1.14 xtraeme 3233: <strong class=
3234: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3235: </pre>
3236:
3237: <p>will show all the commands that are invoked,
3238: up to and including the “<span class=
3239: "quote">patch</span>” stage.</p>
3240: </li>
3241:
3242: <li>
3243: <p>If you want to know the value of a certain
1.22 tv 3244: <a href=
3245: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3246: <span class="citerefentry"><span class=
3247: "refentrytitle">make</span>(1)</span></a>
3248: definition, then the <code class=
1.14 xtraeme 3249: "varname">VARNAME</code> definition should be
3250: used, in conjunction with the show-var target.
3251: e.g. to show the expansion of the <a href=
1.1 grant 3252: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3253: <span class="citerefentry"><span class=
3254: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3255: variable <code class=
1.22 tv 3256: "varname">LOCALBASE</code>:</p>
1.1 grant 3257: <pre class="screen">
1.14 xtraeme 3258: <code class="prompt">%</code> <strong class=
3259: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3260: /usr/pkg
1.14 xtraeme 3261: <code class="prompt">%</code>
1.1 grant 3262:
3263: </pre>
3264: </li>
3265: </ol>
3266: </div>
3267:
3268: <p>If you want to install a binary package that you've
3269: either created yourself (see next section), that you
3270: put into pkgsrc/packages manually or that is located on
1.8 wiz 3271: a remote FTP server, you can use the "bin-install"
1.1 grant 3272: target. This target will install a binary package - if
3273: available - via <a href=
3274: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3275: <span class="citerefentry"><span class=
3276: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3277: <span><strong class="command">make
3278: package</strong></span>. The list of remote FTP sites
3279: searched is kept in the variable <code class=
3280: "varname">BINPKG_SITES</code>, which defaults to
3281: ftp.NetBSD.org. Any flags that should be added to
3282: <a href=
1.1 grant 3283: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3284: <span class="citerefentry"><span class=
3285: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3286: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3287: See <code xmlns=
3288: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3289: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3290: details.</p>
1.1 grant 3291:
1.47 reed 3292: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3293: has a non-standard setting for <code class=
3294: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3295: any packages are installed, as you can not use several
3296: directories for the same purpose. Doing so will result
3297: in pkgsrc not being able to properly detect your
3298: installed packages, and fail miserably. Note also that
3299: precompiled binary packages are usually built with the
1.14 xtraeme 3300: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3301: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3302: class="filename">/usr/pkg</code>, and that you should
3303: <span class="emphasis"><em>not</em></span> install any
3304: if you use a non-standard <code class=
1.14 xtraeme 3305: "varname">LOCALBASE</code>.</p>
1.1 grant 3306: </div>
3307:
1.55 ! rillig 3308: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3309: <div class="titlepage">
3310: <div>
3311: <div>
1.30 wiz 3312: <h3 class="title"><a name=
1.55 ! rillig 3313: "selecting-the-compiler" id=
1.30 wiz 3314: "selecting-the-compiler"></a>4.2.4. Selecting
3315: the compiler</h3>
1.1 grant 3316: </div>
3317: </div>
3318: </div>
3319:
3320: <p>By default, pkgsrc will use GCC to build packages.
3321: This may be overridden by setting the following
3322: variables in /etc/mk.conf:</p>
3323:
3324: <div class="variablelist">
3325: <dl>
1.14 xtraeme 3326: <dt><span class="term"><code class=
3327: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3328:
3329: <dd>
3330: <p>This is a list of values specifying the chain
3331: of compilers to invoke when building packages.
3332: Valid values are:</p>
3333:
3334: <div class="itemizedlist">
3335: <ul type="disc">
3336: <li>
1.14 xtraeme 3337: <p><code class="varname">distcc</code>:
1.1 grant 3338: distributed C/C++ (chainable)</p>
3339: </li>
3340:
3341: <li>
1.14 xtraeme 3342: <p><code class="varname">ccache</code>:
1.1 grant 3343: compiler cache (chainable)</p>
3344: </li>
3345:
3346: <li>
1.14 xtraeme 3347: <p><code class="varname">gcc</code>: GNU
3348: C/C++ Compiler</p>
1.1 grant 3349: </li>
3350:
3351: <li>
1.14 xtraeme 3352: <p><code class="varname">mipspro</code>:
1.1 grant 3353: Silicon Graphics, Inc. MIPSpro
3354: (n32/n64)</p>
3355: </li>
3356:
3357: <li>
1.14 xtraeme 3358: <p><code class="varname">mipspro</code>:
1.1 grant 3359: Silicon Graphics, Inc. MIPSpro (o32)</p>
3360: </li>
3361:
3362: <li>
1.14 xtraeme 3363: <p><code class="varname">sunpro</code>:
1.1 grant 3364: Microsystems, Inc. WorkShip/Forte/Sun ONE
3365: Studio</p>
3366: </li>
3367: </ul>
3368: </div>
3369:
3370: <p>The default is “<span class=
1.14 xtraeme 3371: "quote"><code class=
3372: "varname">gcc</code></span>”. You can use
3373: <code class="varname">ccache</code> and/or
3374: <code class="varname">distcc</code> with an
3375: appropriate <code class=
3376: "varname">PKGSRC_COMPILER</code> setting, e.g.
3377: “<span class="quote"><code class=
3378: "varname">ccache gcc</code></span>”. This
1.1 grant 3379: variable should always be terminated with a value
3380: for a real compiler.</p>
3381: </dd>
3382:
1.14 xtraeme 3383: <dt><span class="term"><code class=
3384: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3385:
3386: <dd>
3387: <p>This specifies the minimum version of GCC to
3388: use when building packages. If the system GCC
3389: doesn't satisfy this requirement, then pkgsrc
3390: will build and install one of the GCC packages to
3391: use instead.</p>
3392: </dd>
3393: </dl>
3394: </div>
3395: </div>
3396: </div>
3397: </div>
3398:
1.55 ! rillig 3399: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 3400: <div class="titlepage">
3401: <div>
3402: <div>
1.55 ! rillig 3403: <h2 class="title"><a name="configuring" id=
1.38 dillo 3404: "configuring"></a>Chapter 5. Configuring
3405: pkgsrc</h2>
3406: </div>
3407: </div>
3408: </div>
3409:
3410: <div class="toc">
3411: <p><b>Table of Contents</b></p>
3412:
3413: <dl>
3414: <dt><span class="sect1"><a href=
1.45 wiz 3415: "#general-configuration">5.1. General
3416: configuration</a></span></dt>
3417:
3418: <dt><span class="sect1"><a href=
3419: "#variables-affecting-build">5.2. Variables affecting
3420: the build process</a></span></dt>
3421:
3422: <dt><span class="sect1"><a href=
3423: "#developer-advanced-settings">5.3. Developer/advanced
3424: settings</a></span></dt>
3425:
3426: <dt><span class="sect1"><a href=
3427: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3428: Options</a></span></dt>
1.38 dillo 3429: </dl>
3430: </div>
3431:
1.55 ! rillig 3432: <div class="sect1" lang="en" xml:lang="en">
1.38 dillo 3433: <div class="titlepage">
3434: <div>
3435: <div>
3436: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3437: "general-configuration" id=
1.45 wiz 3438: "general-configuration"></a>5.1. General
3439: configuration</h2>
3440: </div>
3441: </div>
3442: </div>
3443:
1.47 reed 3444: <p>In this section, you can find some variables that
3445: apply to all pkgsrc packages. The preferred method of
3446: setting these variables is by setting them in
3447: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3448: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3449:
3450: <div class="itemizedlist">
3451: <ul type="disc">
3452: <li>
3453: <p><code class="varname">LOCALBASE</code>: Where
3454: packages will be installed. The default is
3455: <code xmlns=
3456: "http://www.w3.org/TR/xhtml1/transitional" class=
3457: "filename">/usr/pkg</code>. Do not mix binary
3458: packages with different <code class=
3459: "varname">LOCALBASE</code>s!</p>
3460: </li>
3461:
3462: <li>
3463: <p><code class="varname">CROSSBASE</code>: Where
3464: “<span class="quote">cross</span>”
3465: category packages will be installed. The default is
3466: <code xmlns=
3467: "http://www.w3.org/TR/xhtml1/transitional" class=
3468: "filename">${LOCALBASE}/cross</code>.</p>
3469: </li>
3470:
3471: <li>
3472: <p><code class="varname">X11BASE</code>: Where X11
3473: is installed on the system. The default is
3474: <code xmlns=
3475: "http://www.w3.org/TR/xhtml1/transitional" class=
3476: "filename">/usr/X11R6</code>.</p>
3477: </li>
3478:
3479: <li>
3480: <p><code class="varname">DISTDIR</code>: Where to
3481: store the downloaded copies of the original source
3482: distributions used for building pkgsrc packages.
3483: The default is <code xmlns=
3484: "http://www.w3.org/TR/xhtml1/transitional" class=
3485: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3486: </li>
3487:
3488: <li>
3489: <p><code class=
3490: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3491: override the packages' <code class=
3492: "varname">MASTER_SITES</code> with this value.</p>
3493: </li>
3494:
3495: <li>
3496: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3497: Backup location(s) for distribution files and patch
3498: files if not found locally or in <code xmlns=
3499: "http://www.w3.org/TR/xhtml1/transitional" class=
3500: "filename">${MASTER_SITES}</code> or <code xmlns=
3501: "http://www.w3.org/TR/xhtml1/transitional" class=
3502: "filename">${PATCH_SITES}</code> respectively. The
3503: defaults are <code xmlns=
3504: "http://www.w3.org/TR/xhtml1/transitional" class=
3505: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3506: and <code xmlns=
3507: "http://www.w3.org/TR/xhtml1/transitional" class=
3508: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3509: </li>
3510:
3511: <li>
3512: <p><code class="varname">BINPKG_SITES</code>: List
3513: of sites carrying binary pkgs.</p>
3514: </li>
3515: </ul>
3516: </div>
3517: </div>
3518:
1.55 ! rillig 3519: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3520: <div class="titlepage">
3521: <div>
3522: <div>
3523: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3524: "variables-affecting-build" id=
1.45 wiz 3525: "variables-affecting-build"></a>5.2. Variables
3526: affecting the build process</h2>
3527: </div>
3528: </div>
3529: </div>
3530:
3531: <p>XXX</p>
3532:
3533: <div class="itemizedlist">
3534: <ul type="disc">
3535: <li>
3536: <p><code class="varname">PACKAGES</code>: The top
3537: level directory for the binary packages. The
3538: default is <code xmlns=
3539: "http://www.w3.org/TR/xhtml1/transitional" class=
3540: "filename">${PKGSRCDIR}/packages</code>.</p>
3541: </li>
3542:
3543: <li>
3544: <p><code class="varname">WRKOBJDIR</code>: The top
3545: level directory where, if defined, the separate
3546: working directories will get created, and
3547: symbolically linked to from <code xmlns=
3548: "http://www.w3.org/TR/xhtml1/transitional" class=
3549: "filename">${WRKDIR}</code> (see below). This is
3550: useful for building packages on several
3551: architectures, then <code xmlns=
3552: "http://www.w3.org/TR/xhtml1/transitional" class=
3553: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3554: while <code xmlns=
3555: "http://www.w3.org/TR/xhtml1/transitional" class=
3556: "filename">${WRKOBJDIR}</code> is local to every
3557: architecture. (It should be noted that <code class=
3558: "varname">PKGSRCDIR</code> should not be set by the
3559: user — it is an internal definition which
3560: refers to the root of the pkgsrc tree. It is
3561: possible to have many pkgsrc tree instances.)</p>
3562: </li>
3563:
3564: <li>
3565: <p><code class="varname">LOCALPATCHES</code>:
3566: Directory for local patches that aren't part of
3567: pkgsrc. See <a href="#components.patches" title=
3568: "8.3. patches/*">Section 8.3,
3569: “patches/*”</a> for more information.
3570: <em class="replaceable"><code>rel</code></em> and
3571: <em class="replaceable"><code>arch</code></em> are
3572: replaced with OS release (“<span class=
3573: "quote">2.0</span>”, etc.) and architecture
3574: (“<span class="quote">mipsel</span>”,
3575: etc.).</p>
3576: </li>
3577:
3578: <li>
3579: <p><code class="varname">PKGMAKECONF</code>:
3580: Location of the <code xmlns=
3581: "http://www.w3.org/TR/xhtml1/transitional" class=
3582: "filename">mk.conf</code> file used by a package's
3583: BSD-style Makefile. If this is not set,
3584: <code class="varname">MAKECONF</code> is set to
3585: <code xmlns=
3586: "http://www.w3.org/TR/xhtml1/transitional" class=
3587: "filename">/dev/null</code> to avoid picking up
3588: settings used by builds in <code xmlns=
3589: "http://www.w3.org/TR/xhtml1/transitional" class=
3590: "filename">/usr/src</code>.</p>
3591: </li>
3592: </ul>
3593: </div>
3594: </div>
3595:
1.55 ! rillig 3596: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3597: <div class="titlepage">
3598: <div>
3599: <div>
3600: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3601: "developer-advanced-settings" id=
1.45 wiz 3602: "developer-advanced-settings"></a>5.3. Developer/advanced
3603: settings</h2>
3604: </div>
3605: </div>
3606: </div>
3607:
3608: <p>XXX</p>
3609:
3610: <div class="itemizedlist">
3611: <ul type="disc">
3612: <li>
3613: <p><code class="varname">PKG_DEVELOPER</code>: Run
3614: some sanity checks that package developers
3615: want:</p>
3616:
3617: <div class="itemizedlist">
3618: <ul type="circle">
3619: <li>
3620: <p>make sure patches apply with zero fuzz</p>
3621: </li>
3622:
3623: <li>
3624: <p>run check-shlibs to see that all binaries
3625: will find their shared libs.</p>
3626: </li>
3627: </ul>
3628: </div>
3629: </li>
3630:
3631: <li>
3632: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3633: The level of debugging output which is displayed
3634: whilst making and installing the package. The
3635: default value for this is 0, which will not display
3636: the commands as they are executed (normal, default,
3637: quiet operation); the value 1 will display all
3638: shell commands before their invocation, and the
3639: value 2 will display both the shell commands before
3640: their invocation, and their actual execution
3641: progress with <span><strong class="command">set
3642: -x</strong></span> will be displayed.</p>
3643: </li>
3644: </ul>
3645: </div>
3646: </div>
3647:
1.55 ! rillig 3648: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3649: <div class="titlepage">
3650: <div>
3651: <div>
3652: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3653: "selecting-build-options" id=
1.45 wiz 3654: "selecting-build-options"></a>5.4. Selecting
3655: Build Options</h2>
1.38 dillo 3656: </div>
3657: </div>
3658: </div>
3659:
3660: <p>Some packages have build time options, usually to
3661: select between different dependencies, enable optional
3662: support for big dependencies or enable experimental
3663: features.</p>
3664:
3665: <p>To see which options, if any, a package supports, and
3666: which options are mutually exclusive, run
3667: <span><strong class="command">make
3668: show-options</strong></span>, for example:</p>
3669: <pre class="programlisting">
1.51 rillig 3670: The following options are supported by this package:
3671: ssl Enable SSL support.
3672: Exactly one of the following gecko options is required:
3673: firefox Use firefox as gecko rendering engine.
3674: mozilla Use mozilla as gecko rendering engine.
3675: At most one of the following database options may be selected:
3676: mysql Enable support for MySQL database.
3677: pgsql Enable support for PostgreSQL database.
3678:
3679: These options are enabled by default: firefox
3680: These options are currently enabled: mozilla ssl
1.38 dillo 3681: </pre>
3682:
1.45 wiz 3683: <p>The following variables can be defined in <code xmlns=
3684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3685: "filename">/etc/mk.conf</code> to select which options to
3686: enable for a package: <code class=
3687: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3688: to select or disable options for all packages that
3689: support them, and <code class=
3690: "varname">PKG_OPTIONS.<em class=
3691: "replaceable"><code>pkgbase</code></em></code>, which can
3692: be used to select or disable options specifically for
3693: package <em class=
3694: "replaceable"><code>pkgbase</code></em>. Options listed
3695: in these variables are selected, options preceded by
3696: “<span class="quote">-</span>” are
3697: disabled.</p>
3698:
1.39 dillo 3699: <p>The following settings are consulted in the order
3700: given, and the last setting that selects or disables an
3701: option is used:</p>
1.38 dillo 3702:
3703: <div class="orderedlist">
3704: <ol type="1">
3705: <li>
3706: <p>the default options as suggested by the package
3707: maintainer</p>
3708: </li>
3709:
3710: <li>
3711: <p>the options implied by the settings of legacy
3712: variables (see below)</p>
3713: </li>
3714:
3715: <li>
3716: <p><code class=
3717: "varname">PKG_DEFAULT_OPTIONS</code></p>
3718: </li>
3719:
3720: <li>
3721: <p><code class="varname">PKG_OPTIONS.<em class=
3722: "replaceable"><code>pkgbase</code></em></code></p>
3723: </li>
3724: </ol>
3725: </div>
3726:
3727: <p>For groups of mutually exclusive options, the last
3728: option selected is used, all others are automatically
3729: disabled. If an option of the group is explicitly
3730: disabled, the previously selected option, if any, is
3731: used. It is an error if no option from a required group
3732: of options is selected, and building the package will
3733: fail.</p>
3734:
3735: <p>Before the options framework was introduced, build
3736: options were selected by setting a variable in
1.45 wiz 3737: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3738: class="filename">/etc/mk.conf</code> for each option. To
3739: ease transition to the options framework for the user,
3740: these legacy variables are converted to the appropriate
3741: options setting automatically. A warning is issued to
3742: prompt the user to update <code xmlns=
3743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3744: "filename">/etc/mk.conf</code> to use the options
3745: framework directly. Support for these legacy variables
3746: will be removed eventually.</p>
3747: </div>
3748: </div>
3749:
1.55 ! rillig 3750: <div class="chapter" lang="en" xml:lang="en">
1.38 dillo 3751: <div class="titlepage">
3752: <div>
3753: <div>
1.55 ! rillig 3754: <h2 class="title"><a name="binary" id=
1.38 dillo 3755: "binary"></a>Chapter 6. Creating binary
1.1 grant 3756: packages</h2>
3757: </div>
3758: </div>
3759: </div>
3760:
3761: <div class="toc">
3762: <p><b>Table of Contents</b></p>
3763:
3764: <dl>
1.30 wiz 3765: <dt><span class="sect1"><a href=
1.38 dillo 3766: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3767: single binary package</a></span></dt>
1.1 grant 3768:
1.30 wiz 3769: <dt><span class="sect1"><a href=
1.38 dillo 3770: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3771: Settings for creation of binary
3772: packages</a></span></dt>
3773:
1.38 dillo 3774: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3775: a bulk build of all packages</a></span></dt>
3776:
3777: <dd>
3778: <dl>
3779: <dt><span class="sect2"><a href=
1.38 dillo 3780: "#binary.configuration">6.3.1.
1.1 grant 3781: Configuration</a></span></dt>
3782:
1.30 wiz 3783: <dt><span class="sect2"><a href=
1.38 dillo 3784: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3785: environmental considerations</a></span></dt>
1.1 grant 3786:
1.38 dillo 3787: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3788: Operation</a></span></dt>
3789:
1.30 wiz 3790: <dt><span class="sect2"><a href=
1.38 dillo 3791: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3792:
1.30 wiz 3793: <dt><span class="sect2"><a href=
1.38 dillo 3794: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3795: requirements</a></span></dt>
1.1 grant 3796:
1.30 wiz 3797: <dt><span class="sect2"><a href=
1.38 dillo 3798: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3799: for chrooted builds</a></span></dt>
1.1 grant 3800:
1.30 wiz 3801: <dt><span class="sect2"><a href=
1.38 dillo 3802: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3803: set of packages</a></span></dt>
1.13 hubertf 3804:
3805: <dt><span class="sect2"><a href=
1.38 dillo 3806: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3807: build</a></span></dt>
1.1 grant 3808: </dl>
3809: </dd>
3810:
1.38 dillo 3811: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3812: Creating a multiple CD-ROM packages
3813: collection</a></span></dt>
3814:
3815: <dd>
3816: <dl>
1.30 wiz 3817: <dt><span class="sect2"><a href=
1.38 dillo 3818: "#cdpack-example">6.4.1. Example of
1.30 wiz 3819: cdpack</a></span></dt>
1.1 grant 3820: </dl>
3821: </dd>
3822: </dl>
3823: </div>
3824:
1.55 ! rillig 3825: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3826: <div class="titlepage">
3827: <div>
3828: <div>
3829: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3830: "building-a-single-binary-package" id=
1.38 dillo 3831: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3832: a single binary package</h2>
1.1 grant 3833: </div>
3834: </div>
3835: </div>
3836:
3837: <p>Once you have built and installed a package, you can
3838: create a <span class="emphasis"><em>binary
3839: package</em></span> which can be installed on another
3840: system with <a href=
3841: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3842: <span class="citerefentry"><span class=
1.47 reed 3843: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3844: having to build the same package on a group of hosts and
3845: wasting CPU time. It also provides a simple means for
3846: others to install your package, should you distribute
3847: it.</p>
3848:
3849: <p>To create a binary package, change into the
1.14 xtraeme 3850: appropriate directory in pkgsrc, and run
3851: <span><strong class="command">make
3852: package</strong></span>:</p>
1.1 grant 3853: <pre class="screen">
1.14 xtraeme 3854: <code class="prompt">#</code> <strong class=
3855: "userinput"><code>cd misc/figlet</code></strong>
3856: <code class="prompt">#</code> <strong class=
3857: "userinput"><code>make package</code></strong>
1.1 grant 3858: </pre>
3859:
3860: <p>This will build and install your package (if not
3861: already done), and then build a binary package from what
1.14 xtraeme 3862: was installed. You can then use the <span><strong class=
3863: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3864: Binary packages are created by default in <code xmlns=
3865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3866: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3867: gzipped tar file. See <a href="#logs.package" title=
1.55 ! rillig 3868: "B.2. Packaging figlet">Section B.2,
1.1 grant 3869: “Packaging figlet”</a> for a continuation of
3870: the above <a xmlns=
3871: "http://www.w3.org/TR/xhtml1/transitional" href=
3872: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3873: target="_top"><code xmlns="" class=
3874: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3875:
3876: <p>See <a href="#submit" title=
1.55 ! rillig 3877: "Chapter 17. Submitting and Committing">Chapter
! 3878: 17, <i>Submitting and Committing</i></a> for information
! 3879: on how to submit such a binary package.</p>
1.1 grant 3880: </div>
3881:
1.55 ! rillig 3882: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3883: <div class="titlepage">
3884: <div>
3885: <div>
3886: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3887: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 3888: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3889: for creation of binary packages</h2>
3890: </div>
3891: </div>
3892: </div>
3893:
3894: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3895: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3896: “Other helpful targets”</a>.</p>
3897: </div>
3898:
1.55 ! rillig 3899: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3900: <div class="titlepage">
3901: <div>
3902: <div>
3903: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 3904: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
! 3905: bulk build of all packages</h2>
1.1 grant 3906: </div>
3907: </div>
3908: </div>
3909:
3910: <p>If you want to get a full set of precompiled binary
3911: packages, this section describes how to get them. Beware
3912: that the bulk build will remove all currently installed
1.23 wiz 3913: packages from your system! Having an FTP server
3914: configured either on the machine doing the bulk builds or
3915: on a nearby NFS server can help to make the packages
3916: available to everyone. See <a href=
1.1 grant 3917: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3918: <span class="citerefentry"><span class=
3919: "refentrytitle">ftpd</span>(8)</span></a> for more
3920: information. If you use a remote NFS server's storage, be
3921: sure to not actually compile on NFS storage, as this
3922: slows things down a lot.</p>
3923:
1.55 ! rillig 3924: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3925: <div class="titlepage">
3926: <div>
3927: <div>
1.55 ! rillig 3928: <h3 class="title"><a name="binary.configuration"
! 3929: id=
1.38 dillo 3930: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3931: </div>
3932: </div>
3933: </div>
3934:
1.55 ! rillig 3935: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 3936: <div class="titlepage">
3937: <div>
3938: <div>
1.55 ! rillig 3939: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 3940: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3941: </div>
3942: </div>
3943: </div>
3944:
1.45 wiz 3945: <p>You may want to set variables in <code xmlns=
3946: "http://www.w3.org/TR/xhtml1/transitional" class=
3947: "filename">/etc/mk.conf</code>. Look at <code xmlns=
3948: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3949: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3950: details of the default settings. You will want to
1.14 xtraeme 3951: ensure that <code class=
3952: "varname">ACCEPTABLE_LICENSES</code> meet your local
3953: policy. As used in this example, <code class=
3954: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3955: "emphasis"><em>all</em></span> licenses.</p>
3956: <pre class="programlisting">
1.51 rillig 3957: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3958: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3959: BSDSRCDIR= /usr/src
3960: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3961: OBJHOSTNAME?= yes # use work.`hostname`
3962: FAILOVER_FETCH= yes # insist on the correct checksum
3963: PKG_DEVELOPER?= yes
3964: _ACCEPTABLE= yes
1.1 grant 3965: </pre>
3966: </div>
3967:
1.55 ! rillig 3968: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 3969: <div class="titlepage">
3970: <div>
3971: <div>
1.55 ! rillig 3972: <h4 class="title"><a name="build.conf" id=
1.45 wiz 3973: "build.conf"></a>6.3.1.2. <code xmlns=
3974: "http://www.w3.org/TR/xhtml1/transitional"
3975: class="filename">build.conf</code></h4>
1.1 grant 3976: </div>
3977: </div>
3978: </div>
3979:
1.45 wiz 3980: <p>In <code xmlns=
3981: "http://www.w3.org/TR/xhtml1/transitional" class=
3982: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
3983: "http://www.w3.org/TR/xhtml1/transitional" class=
3984: "filename">build.conf-example</code> to <code xmlns=
3985: "http://www.w3.org/TR/xhtml1/transitional" class=
3986: "filename">build.conf</code> and edit it, following
3987: the comments in that file. This is the config file
3988: that determines where log files are generated after
3989: the build, where to mail the build report to, where
3990: your pkgsrc tree is located and the user to which
3991: user to <a href=
1.1 grant 3992: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3993: <span class="citerefentry"><span class=
1.23 wiz 3994: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3995: <span><strong class="command">cvs
3996: update</strong></span>.</p>
1.1 grant 3997: </div>
3998:
1.55 ! rillig 3999: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4000: <div class="titlepage">
4001: <div>
4002: <div>
1.55 ! rillig 4003: <h4 class="title"><a name="pre-build.local" id=
1.45 wiz 4004: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4005: class="filename">pre-build.local</code></h4>
1.1 grant 4006: </div>
4007: </div>
4008: </div>
4009:
4010: <p>It is possible to configure the bulk build to
1.47 reed 4011: perform certain site-specific tasks at the end of the
1.45 wiz 4012: pre-build stage. If the file <code xmlns=
4013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4014: "filename">pre-build.local</code> exists in
1.45 wiz 4015: <code xmlns=
4016: "http://www.w3.org/TR/xhtml1/transitional" class=
4017: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4018: executed (as a <a href=
1.24 wiz 4019: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4020: <span class="citerefentry"><span class=
4021: "refentrytitle">sh</span>(1)</span></a> script) at
4022: the end of the usual pre-build stage. An example use
1.45 wiz 4023: of <code xmlns=
4024: "http://www.w3.org/TR/xhtml1/transitional" class=
4025: "filename">pre-build.local</code> is to have the
4026: line:</p>
1.1 grant 4027: <pre class="screen">
1.14 xtraeme 4028: <code class="prompt">#</code> <strong class=
4029: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4030: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4031: </pre>
4032:
4033: <p>to prevent the system from trying to build a
4034: particular package which requires nearly 3 GB of disk
4035: space.</p>
4036: </div>
4037: </div>
4038:
1.55 ! rillig 4039: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4040: <div class="titlepage">
4041: <div>
4042: <div>
1.30 wiz 4043: <h3 class="title"><a name=
1.55 ! rillig 4044: "other-environmental-considerations" id=
1.38 dillo 4045: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4046: environmental considerations</h3>
1.1 grant 4047: </div>
4048: </div>
4049: </div>
4050:
1.45 wiz 4051: <p>As <code xmlns=
4052: "http://www.w3.org/TR/xhtml1/transitional" class=
4053: "filename">/usr/pkg</code> will be completely deleted
4054: at the start of bulk builds, make sure your login shell
4055: is placed somewhere else. Either drop it into
4056: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4057: class="filename">/usr/local/bin</code> (and adjust your
4058: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4059: <a href=
1.1 grant 4060: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4061: <span class="citerefentry"><span class=
4062: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4063: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4064: class="filename">/etc/rc.local</code>, so you can login
4065: after a reboot (remember that your current process
4066: won't die if the package is removed, you just can't
4067: start any new instances of the shell any more). Also,
4068: if you use NetBSD earlier than 1.5, or you still want
4069: to use the pkgsrc version of ssh for some reason, be
4070: sure to install ssh before starting it from
4071: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4072: class="filename">rc.local</code>:</p>
1.1 grant 4073: <pre class="programlisting">
1.51 rillig 4074: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4075: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4076: /usr/pkg/etc/rc.d/sshd
4077: fi
1.1 grant 4078: </pre>
4079:
4080: <p>Not doing so will result in you being not able to
4081: log in via ssh after the bulk build is finished or if
4082: the machine gets rebooted or crashes. You have been
4083: warned! :)</p>
4084: </div>
4085:
1.55 ! rillig 4086: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4087: <div class="titlepage">
4088: <div>
4089: <div>
1.55 ! rillig 4090: <h3 class="title"><a name="operation" id=
1.38 dillo 4091: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4092: </div>
4093: </div>
4094: </div>
4095:
4096: <p>Make sure you don't need any of the packages still
4097: installed.</p>
4098:
4099: <div class="warning" style=
4100: "margin-left: 0.5in; margin-right: 0.5in;">
4101: <h3 class="title">Warning</h3>
4102:
4103: <p>During the bulk build, <span class=
4104: "emphasis"><em>all packages will be
4105: removed!</em></span></p>
4106: </div>
4107:
4108: <p>Be sure to remove all other things that might
4109: interfere with builds, like some libs installed in
1.45 wiz 4110: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4111: class="filename">/usr/local</code>, etc. then become
4112: root and type:</p>
1.1 grant 4113: <pre class="screen">
1.14 xtraeme 4114: <code class="prompt">#</code> <strong class=
4115: "userinput"><code>cd /usr/pkgsrc</code></strong>
4116: <code class="prompt">#</code> <strong class=
4117: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4118: </pre>
4119:
4120: <p>If for some reason your last build didn't complete
4121: (power failure, system panic, ...), you can continue it
4122: by running:</p>
4123: <pre class="screen">
1.14 xtraeme 4124: <code class="prompt">#</code> <strong class=
4125: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4126: </pre>
4127:
4128: <p>At the end of the bulk build, you will get a summary
4129: via mail, and find build logs in the directory
1.14 xtraeme 4130: specified by <code class="varname">FTP</code> in the
1.45 wiz 4131: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4132: class="filename">build.conf</code> file.</p>
1.1 grant 4133: </div>
4134:
1.55 ! rillig 4135: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4136: <div class="titlepage">
4137: <div>
4138: <div>
1.55 ! rillig 4139: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 4140: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4141: </div>
4142: </div>
4143: </div>
4144:
4145: <p>The bulk builds consist of three steps:</p>
4146:
4147: <div class="variablelist">
4148: <dl>
4149: <dt><span class="term">1. pre-build</span></dt>
4150:
4151: <dd>
4152: <p>The script updates your pkgsrc tree via
4153: (anon)cvs, then cleans out any broken distfiles,
4154: and removes all packages installed.</p>
4155: </dd>
4156:
4157: <dt><span class="term">2. the bulk
4158: build</span></dt>
4159:
4160: <dd>
4161: <p>This is basically “<span class=
4162: "quote">make bulk-package</span>” with an
4163: optimised order in which packages will be built.
4164: Packages that don't require other packages will
4165: be built first, and packages with many
4166: dependencies will be built later.</p>
4167: </dd>
4168:
4169: <dt><span class="term">3. post-build</span></dt>
4170:
4171: <dd>
4172: <p>Generates a report that's placed in the
1.45 wiz 4173: directory specified in the <code xmlns=
4174: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4175: "filename">build.conf</code> file named
1.45 wiz 4176: <code xmlns=
4177: "http://www.w3.org/TR/xhtml1/transitional" class=
4178: "filename">broken.html</code>, a short version of
4179: that report will also be mailed to the build's
4180: admin.</p>
1.1 grant 4181: </dd>
4182: </dl>
4183: </div>
4184:
4185: <p>During the build, a list of broken packages will be
1.45 wiz 4186: compiled in <code xmlns=
4187: "http://www.w3.org/TR/xhtml1/transitional" class=
4188: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4189: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4190: "filename">.../.broken.${MACHINE}</code> if
4191: <code class="varname">OBJMACHINE</code> is set),
4192: individual build logs of broken builds can be found in
4193: the package's directory. These files are used by the
4194: bulk-targets to mark broken builds to not waste time
4195: trying to rebuild them, and they can be used to debug
4196: these broken package builds later.</p>
1.1 grant 4197: </div>
4198:
1.55 ! rillig 4199: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4200: <div class="titlepage">
4201: <div>
4202: <div>
1.30 wiz 4203: <h3 class="title"><a name=
1.55 ! rillig 4204: "disk-space-requirements" id=
1.38 dillo 4205: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4206: space requirements</h3>
1.1 grant 4207: </div>
4208: </div>
4209: </div>
4210:
4211: <p>Currently, roughly the following requirements are
4212: valid for NetBSD 2.0/i386:</p>
4213:
4214: <div class="itemizedlist">
4215: <ul type="disc">
4216: <li>
4217: <p>10 GB - distfiles (NFS ok)</p>
4218: </li>
4219:
4220: <li>
4221: <p>8 GB - full set of all binaries (NFS ok)</p>
4222: </li>
4223:
4224: <li>
4225: <p>5 GB - temp space for compiling (local disk
4226: recommended)</p>
4227: </li>
4228: </ul>
4229: </div>
4230:
4231: <p>Note that all pkgs will be de-installed as soon as
4232: they are turned into a binary package, and that sources
4233: are removed, so there is no excessively huge demand to
4234: disk space. Afterwards, if the package is needed again,
4235: it will be installed via <a href=
4236: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4237: <span class="citerefentry"><span class=
4238: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4239: building again, so there are no cycles wasted by
4240: recompiling.</p>
4241: </div>
4242:
1.55 ! rillig 4243: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4244: <div class="titlepage">
4245: <div>
4246: <div>
1.55 ! rillig 4247: <h3 class="title"><a name="setting-up-a-sandbox"
! 4248: id="setting-up-a-sandbox"></a>6.3.6. Setting
! 4249: up a sandbox for chrooted builds</h3>
1.1 grant 4250: </div>
4251: </div>
4252: </div>
4253:
1.12 agc 4254: <p>If you don't want all the packages nuked from a
4255: machine (rendering it useless for anything but pkg
1.23 wiz 4256: compiling), there is the possibility of doing the
4257: package bulk build inside a chroot environment.</p>
1.12 agc 4258:
4259: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4260: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4261: class="filename">/usr/sandbox</code>. This can be done
4262: by using null mounts, or manually.</p>
1.12 agc 4263:
1.45 wiz 4264: <p>There is a shell script called <code xmlns=
4265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4266: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4267: set up the sandbox environment using null mounts. It
1.45 wiz 4268: will also create a script called <code xmlns=
4269: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4270: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4271: environment, which will allow the null mounts to be
1.14 xtraeme 4272: activated using the <span><strong class=
4273: "command">sandbox mount</strong></span> command and
4274: deactivated using the <span><strong class=
4275: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4276:
4277: <p>To set up a sandbox environment by hand, after
4278: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4279: doing a <span><strong class="command">make distribution
1.45 wiz 4280: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4281: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4282: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4283: items are present and properly configured:</p>
1.1 grant 4284:
4285: <div class="procedure">
4286: <ol type="1">
4287: <li>
4288: <p>Kernel</p>
4289: <pre class="screen">
1.14 xtraeme 4290: <code class="prompt">#</code> <strong class=
4291: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4292: </pre>
4293: </li>
4294:
4295: <li>
1.45 wiz 4296: <p><code xmlns=
4297: "http://www.w3.org/TR/xhtml1/transitional" class=
4298: "filename">/dev/*</code></p>
1.1 grant 4299: <pre class="screen">
1.14 xtraeme 4300: <code class="prompt">#</code> <strong class=
4301: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4302: </pre>
4303: </li>
4304:
4305: <li>
1.45 wiz 4306: <p><code xmlns=
4307: "http://www.w3.org/TR/xhtml1/transitional" class=
4308: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4309: "http://www.w3.org/TR/xhtml1/transitional" href=
4310: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4311: target="_top"><code xmlns="" class=
4312: "filename">security/smtpd</code></a> and
4313: mail):</p>
1.1 grant 4314: <pre class="screen">
1.14 xtraeme 4315: <code class="prompt">#</code> <strong class=
4316: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4317: </pre>
4318: </li>
4319:
4320: <li>
4321: <p>Working(!) mail config (hostname,
4322: sendmail.cf):</p>
4323: <pre class="screen">
1.14 xtraeme 4324: <code class="prompt">#</code> <strong class=
4325: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4326: </pre>
4327: </li>
4328:
4329: <li>
1.45 wiz 4330: <p><code xmlns=
4331: "http://www.w3.org/TR/xhtml1/transitional" class=
4332: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4333: "http://www.w3.org/TR/xhtml1/transitional" href=
4334: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4335: target="_top"><code xmlns="" class=
4336: "filename">security/smtpd</code></a>):</p>
1.1 grant 4337: <pre class="screen">
1.14 xtraeme 4338: <code class="prompt">#</code> <strong class=
4339: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4340: </pre>
4341: </li>
4342:
4343: <li>
1.45 wiz 4344: <p><code xmlns=
4345: "http://www.w3.org/TR/xhtml1/transitional" class=
4346: "filename">/usr/src</code> (system sources, for
4347: <a xmlns=
1.1 grant 4348: "http://www.w3.org/TR/xhtml1/transitional" href=
4349: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4350: target="_top"><code xmlns="" class=
4351: "filename">sysutils/aperture</code></a>,
4352: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4353: href=
1.20 ben 4354: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4355: target="_top"><code xmlns="" class=
4356: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4357: <pre class="screen">
1.14 xtraeme 4358: <code class="prompt">#</code> <strong class=
4359: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4360: <code class="prompt">#</code> <strong class=
1.23 wiz 4361: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4362: </pre>
4363: </li>
4364:
4365: <li>
1.45 wiz 4366: <p>Create <code xmlns=
4367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4368: "filename">/var/db/pkg</code> (not part of
4369: default install):</p>
1.1 grant 4370: <pre class="screen">
1.14 xtraeme 4371: <code class="prompt">#</code> <strong class=
4372: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4373: </pre>
4374: </li>
4375:
4376: <li>
1.45 wiz 4377: <p>Create <code xmlns=
4378: "http://www.w3.org/TR/xhtml1/transitional" class=
4379: "filename">/usr/pkg</code> (not part of default
4380: install):</p>
1.1 grant 4381: <pre class="screen">
1.14 xtraeme 4382: <code class="prompt">#</code> <strong class=
4383: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4384: </pre>
4385: </li>
4386:
4387: <li>
1.45 wiz 4388: <p>Checkout pkgsrc via cvs into <code xmlns=
4389: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4390: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4391: <pre class="screen">
1.14 xtraeme 4392: <code class="prompt">#</code> <strong class=
4393: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4394: <code class="prompt">#</code> <strong class=
4395: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4396: </pre>
4397:
4398: <p>Do not mount/link this to the copy of your
4399: pkgsrc tree you do development in, as this will
4400: likely cause problems!</p>
4401: </li>
4402:
4403: <li>
1.45 wiz 4404: <p>Make <code xmlns=
4405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4406: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4407: and <code xmlns=
4408: "http://www.w3.org/TR/xhtml1/transitional" class=
4409: "filename">.../distfiles</code> point somewhere
4410: appropriate. NFS- and/or nullfs-mounts may come
4411: in handy!</p>
1.1 grant 4412: </li>
4413:
4414: <li>
1.45 wiz 4415: <p>Edit <code xmlns=
4416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4417: "filename">/etc/mk.conf</code>, see <a href=
4418: "#binary.mk.conf" title=
1.38 dillo 4419: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4420: “/etc/mk.conf”</a>.</p>
4421: </li>
4422:
4423: <li>
1.45 wiz 4424: <p>Adjust <code xmlns=
4425: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4426: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4427: needs.</p>
4428: </li>
4429:
4430: <li>
1.14 xtraeme 4431: <p>If you have set <code class=
1.45 wiz 4432: "varname">CVS_USER</code> in <code xmlns=
4433: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4434: "filename">build.conf</code>, make sure that
4435: account exists and can do a <span><strong class=
4436: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4437: properly!</p>
4438: </li>
4439: </ol>
4440: </div>
4441:
1.47 reed 4442: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4443: build with the following steps:</p>
4444: <pre class="screen">
1.14 xtraeme 4445: <code class="prompt">#</code> <strong class=
4446: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4447: <code class="prompt">#</code> <strong class=
4448: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4449: </pre>
4450:
4451: <p>This will just jump inside the sandbox and start
4452: building. At the end of the build, mail will be sent
4453: with the results of the build. Created binary pkgs will
1.45 wiz 4454: be in <code xmlns=
4455: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4456: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4457: (wherever that points/mounts to/from).</p>
4458: </div>
4459:
1.55 ! rillig 4460: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4461: <div class="titlepage">
4462: <div>
4463: <div>
1.30 wiz 4464: <h3 class="title"><a name=
1.55 ! rillig 4465: "building-a-partial-set" id=
1.38 dillo 4466: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4467: a partial set of packages</h3>
1.1 grant 4468: </div>
4469: </div>
4470: </div>
4471:
4472: <p>In addition to building a complete set of all
1.45 wiz 4473: packages in pkgsrc, the <code xmlns=
4474: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4475: "filename">pkgsrc/mk/bulk/build</code> script may be
4476: used to build a subset of the packages contained in
1.47 reed 4477: pkgsrc. By setting <code class=
1.45 wiz 4478: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4479: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4480: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4481:
4482: <div class="itemizedlist">
4483: <ul type="disc">
4484: <li>
4485: <p>SITE_SPECIFIC_PKGS</p>
4486: </li>
4487:
4488: <li>
4489: <p>HOST_SPECIFIC_PKGS</p>
4490: </li>
4491:
4492: <li>
4493: <p>GROUP_SPECIFIC_PKGS</p>
4494: </li>
4495:
4496: <li>
4497: <p>USER_SPECIFIC_PKGS</p>
4498: </li>
4499: </ul>
4500: </div>
4501:
4502: <p>will define the set of packages which should be
4503: built. The bulk build code will also include any
4504: packages which are needed as dependencies for the
4505: explicitly listed packages.</p>
4506:
4507: <p>One use of this is to do a bulk build with
1.14 xtraeme 4508: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4509: sandbox periodically to have a complete set of the
4510: binary packages needed for your site available without
4511: the overhead of building extra packages that are not
4512: needed.</p>
4513: </div>
1.13 hubertf 4514:
1.55 ! rillig 4515: <div class="sect2" lang="en" xml:lang="en">
1.13 hubertf 4516: <div class="titlepage">
4517: <div>
4518: <div>
1.55 ! rillig 4519: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4520: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4521: of a bulk build</h3>
4522: </div>
4523: </div>
4524: </div>
4525:
4526: <p>This section describes how pkgsrc developers can
4527: upload binary pkgs built by bulk builds to
4528: ftp.NetBSD.org.</p>
4529:
1.17 sketch 4530: <p>If you would like to automatically create checksum
4531: files for the binary packages you intend to upload,
4532: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4533: in your <code xmlns=
4534: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4535: "filename">mk/bulk/build.conf</code>.</p>
4536:
4537: <p>If you would like to PGP sign the checksum files
4538: (highly recommended!), remember to set <code class=
4539: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4540: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4541: class="filename">mk/bulk/build.conf</code>. This will
4542: prompt you for your GPG password to sign the files
1.17 sketch 4543: before uploading everything.</p>
4544:
4545: <p>Then, make sure that you have <code class=
1.14 xtraeme 4546: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4547: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4548: class="filename">mk/bulk/build.conf</code> file, i.e.
4549: adjust it to something like one of the following:</p>
1.13 hubertf 4550: <pre class="screen">
4551: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4552: </pre>
4553:
1.47 reed 4554: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4555: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4556: ftp.NetBSD.org is different from <code class=
4557: "varname">CVS_USER</code>, write your login directly
4558: into the variable, e.g. my local account is "feyrer",
4559: but for my login "hubertf", I use:</p>
1.13 hubertf 4560: <pre class="screen">
4561: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4562: </pre>
4563:
1.45 wiz 4564: <p>A separate <code xmlns=
4565: "http://www.w3.org/TR/xhtml1/transitional" class=
4566: "filename">upload</code> directory is used here to
4567: allow "closing" the directory during upload. To do so,
4568: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4569: <pre class="screen">
1.14 xtraeme 4570: nbftp% <strong class=
4571: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4572: </pre>
4573:
1.45 wiz 4574: <p>Please note that <code xmlns=
4575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4576: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4577: appropriate for packages for the NetBSD operating
4578: system. Binary packages for other operating systems
1.45 wiz 4579: should go into <code xmlns=
4580: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4581: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4582:
4583: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4584: needs to be set up. This example shows how to set up
1.13 hubertf 4585: temporary keys for the root account <span class=
4586: "emphasis"><em>inside the sandbox</em></span> (assuming
4587: that no keys should be present there usually):</p>
4588: <pre class="screen">
1.14 xtraeme 4589: <code class="prompt">#</code> <strong class=
4590: "userinput"><code>chroot /usr/sandbox</code></strong>
4591: chroot-<code class="prompt">#</code> <strong class=
4592: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4593: chroot-<code class="prompt">#</code> <strong class=
4594: "userinput"><code>ssh-keygen -t dsa</code></strong>
4595: chroot-<code class="prompt">#</code> <strong class=
4596: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4597: </pre>
4598:
1.45 wiz 4599: <p>Now take the output of <code xmlns=
4600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4601: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4602: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4603: class="filename">~/.ssh/authorized_keys</code> file on
4604: ftp.NetBSD.org. You can remove the key after the upload
4605: is done!</p>
1.13 hubertf 4606:
4607: <p>Next, test if your ssh connection really works:</p>
4608: <pre class="screen">
1.14 xtraeme 4609: chroot-<code class="prompt">#</code> <strong class=
4610: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4611: </pre>
4612:
4613: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4614:
4615: <p>Now after all this works, you can exit the sandbox
4616: and start the upload:</p>
4617: <pre class="screen">
1.14 xtraeme 4618: chroot-<code class="prompt">#</code> <strong class=
4619: "userinput"><code>exit</code></strong>
4620: <code class="prompt">#</code> <strong class=
4621: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4622: <code class="prompt">#</code> <strong class=
4623: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4624: </pre>
4625:
4626: <p>The upload process may take quite some time. Use
1.24 wiz 4627: <a href=
4628: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4629: <span class="citerefentry"><span class=
4630: "refentrytitle">ls</span>(1)</span></a> or <a href=
4631: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4632: <span class="citerefentry"><span class=
4633: "refentrytitle">du</span>(1)</span></a> on the FTP
4634: server to monitor progress of the upload. The upload
4635: script will take care of not uploading restricted
4636: packages and putting vulnerable packages into the
1.45 wiz 4637: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4638: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4639:
4640: <p>After the upload has ended, first thing is to revoke
4641: ssh access:</p>
4642: <pre class="screen">
1.14 xtraeme 4643: nbftp% <strong class=
4644: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4645: Gdd:x!
4646: </pre>
4647:
4648: <p>Use whatever is needed to remove the key you've
4649: entered before! Last, move the uploaded packages out of
1.45 wiz 4650: the <code xmlns=
4651: "http://www.w3.org/TR/xhtml1/transitional" class=
4652: "filename">upload</code> directory to have them
4653: accessible to everyone:</p>
1.13 hubertf 4654: <pre class="screen">
1.14 xtraeme 4655: nbftp% <strong class=
4656: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4657: nbftp% <strong class=
4658: "userinput"><code>mv upload/* .</code></strong>
4659: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4660: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4661: </pre>
4662: </div>
1.1 grant 4663: </div>
4664:
1.55 ! rillig 4665: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4666: <div class="titlepage">
4667: <div>
4668: <div>
4669: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 4670: "creating-cdroms" id=
1.38 dillo 4671: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4672: CD-ROM packages collection</h2>
1.1 grant 4673: </div>
4674: </div>
4675: </div>
4676:
4677: <p>After your pkgsrc bulk-build has completed, you may
4678: wish to create a CD-ROM set of the resulting binary
4679: packages to assist in installing packages on other
4680: machines. The <a xmlns=
4681: "http://www.w3.org/TR/xhtml1/transitional" href=
4682: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4683: target="_top"><code xmlns="" class=
4684: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4685: simple tool for creating the ISO 9660 images.
4686: <span><strong class="command">cdpack</strong></span>
4687: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4688: all the dependencies for a given package on the same CD
4689: as that package.</p>
1.1 grant 4690:
1.55 ! rillig 4691: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4692: <div class="titlepage">
4693: <div>
4694: <div>
1.55 ! rillig 4695: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4696: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4697: cdpack</h3>
4698: </div>
4699: </div>
4700: </div>
4701:
4702: <p>Complete documentation for cdpack is found in the
1.47 reed 4703: cdpack(1) man page. The following short example assumes
1.45 wiz 4704: that the binary packages are left in <code xmlns=
4705: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4706: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4707: sufficient disk space exists in <code xmlns=
4708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4709: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4710: <pre class="screen">
1.14 xtraeme 4711: <code class="prompt">#</code> <strong class=
4712: "userinput"><code>mkdir /u2/images</code></strong>
4713: <code class="prompt">#</code> <strong class=
4714: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4715: <code class="prompt">#</code> <strong class=
4716: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4717: </pre>
4718:
4719: <p>If you wish to include a common set of files
1.45 wiz 4720: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4721: class="filename">COPYRIGHT</code>, <code xmlns=
4722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4723: "filename">README</code>, etc.) on each CD in the
1.1 grant 4724: collection, then you need to create a directory which
4725: contains these files. e.g.</p>
4726: <pre class="screen">
1.14 xtraeme 4727: <code class="prompt">#</code> <strong class=
4728: "userinput"><code>mkdir /tmp/common</code></strong>
4729: <code class="prompt">#</code> <strong class=
4730: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4731: <code class="prompt">#</code> <strong class=
4732: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4733: <code class="prompt">#</code> <strong class=
4734: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4735: <code class="prompt">#</code> <strong class=
4736: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4737: <code class="prompt">#</code> <strong class=
4738: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4739: <code class="prompt">#</code> <strong class=
4740: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4741: </pre>
4742:
4743: <p>Now create the images:</p>
4744: <pre class="screen">
1.14 xtraeme 4745: <code class="prompt">#</code> <strong class=
4746: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4747: </pre>
4748:
1.45 wiz 4749: <p>Each image will contain <code xmlns=
4750: "http://www.w3.org/TR/xhtml1/transitional" class=
4751: "filename">README</code>, <code xmlns=
4752: "http://www.w3.org/TR/xhtml1/transitional" class=
4753: "filename">COPYING</code>, and <code xmlns=
4754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4755: "filename">bin/myscript</code> in their root
1.1 grant 4756: directories.</p>
4757: </div>
4758: </div>
4759: </div>
4760:
1.55 ! rillig 4761: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 4762: <div class="titlepage">
4763: <div>
4764: <div>
1.55 ! rillig 4765: <h2 class="title"><a name="faq" id=
1.38 dillo 4766: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4767: Questions</h2>
4768: </div>
4769: </div>
4770: </div>
4771:
4772: <div class="toc">
4773: <p><b>Table of Contents</b></p>
4774:
4775: <dl>
1.30 wiz 4776: <dt><span class="sect1"><a href=
1.38 dillo 4777: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4778: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4779:
1.38 dillo 4780: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4781: Where's the pkgviews documentation?</a></span></dt>
4782:
1.38 dillo 4783: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4784: Utilities for package management
4785: (pkgtools)</a></span></dt>
4786:
1.38 dillo 4787: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4788: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4789:
1.30 wiz 4790: <dt><span class="sect1"><a href=
1.38 dillo 4791: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4792: fetching distfiles?</a></span></dt>
1.14 xtraeme 4793:
1.30 wiz 4794: <dt><span class="sect1"><a href=
1.38 dillo 4795: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4796: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4797:
1.30 wiz 4798: <dt><span class="sect1"><a href=
1.38 dillo 4799: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4800: from pkgsrc?</a></span></dt>
1.1 grant 4801:
1.30 wiz 4802: <dt><span class="sect1"><a href=
1.38 dillo 4803: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4804: behind a firewall</a></span></dt>
1.1 grant 4805:
1.38 dillo 4806: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4807: do I tell <span><strong class="command">make
4808: fetch</strong></span> to do passive
4809: FTP?</a></span></dt>
1.1 grant 4810:
1.30 wiz 4811: <dt><span class="sect1"><a href=
1.38 dillo 4812: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4813: distfiles at once</a></span></dt>
1.1 grant 4814:
1.30 wiz 4815: <dt><span class="sect1"><a href=
1.38 dillo 4816: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4817: “<span class="quote">Don't know how to make
1.14 xtraeme 4818: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4819: mean?</a></span></dt>
4820:
1.30 wiz 4821: <dt><span class="sect1"><a href=
1.38 dillo 4822: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4823: “<span class="quote">Could not find
1.14 xtraeme 4824: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4825:
1.30 wiz 4826: <dt><span class="sect1"><a href=
1.38 dillo 4827: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4828: pkgsrc</a></span></dt>
1.1 grant 4829:
1.38 dillo 4830: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4831: do I change the location of configuration
4832: files?</a></span></dt>
1.1 grant 4833:
1.38 dillo 4834: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4835: Automated security checks</a></span></dt>
4836: </dl>
4837: </div>
4838:
4839: <p>This section contains hints, tips & tricks on
4840: special things in pkgsrc that we didn't find a better place
4841: for in the previous chapters, and it contains items for
4842: both pkgsrc users and developers.</p>
4843:
1.55 ! rillig 4844: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4845: <div class="titlepage">
4846: <div>
4847: <div>
4848: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 4849: "mailing-list-pointers" id=
1.38 dillo 4850: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4851: mailing lists for pkg-related discussion?</h2>
1.1 grant 4852: </div>
4853: </div>
4854: </div>
4855:
1.18 xtraeme 4856: <p>The following mailing lists may be of interest to
4857: pkgsrc users:</p>
4858:
4859: <div class="itemizedlist">
4860: <ul type="disc">
4861: <li>
4862: <p><a href=
4863: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4864: target="_top">pkgsrc-bugs</a>: A list where problem
4865: reports related to pkgsrc are sent and
4866: discussed.</p>
1.18 xtraeme 4867: </li>
4868:
4869: <li>
4870: <p><a href=
4871: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4872: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4873: results of pkgsrc bulk builds are sent and
1.34 wiz 4874: discussed.</p>
1.18 xtraeme 4875: </li>
4876:
4877: <li>
4878: <p><a href=
4879: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4880: target="_top">pkgsrc-changes</a>: A list where all
4881: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4882: </li>
4883:
4884: <li>
4885: <p><a href=
4886: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4887: target="_top">tech-pkg</a>: A general discussion
4888: list for all things related to pkgsrc.</p>
1.18 xtraeme 4889: </li>
4890: </ul>
4891: </div>
4892:
4893: <p>To subscribe, do:</p>
1.1 grant 4894: <pre class="programlisting">
1.51 rillig 4895: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 4896: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4897: </pre>
4898:
1.18 xtraeme 4899: <p>Archives for all these mailing lists are available
4900: from <a href="http://mail-index.NetBSD.org/" target=
4901: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4902: </div>
4903:
1.55 ! rillig 4904: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4905: <div class="titlepage">
4906: <div>
4907: <div>
4908: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 4909: "pkgviews-docs" id=
1.38 dillo 4910: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4911: documentation?</h2>
1.1 grant 4912: </div>
4913: </div>
4914: </div>
4915:
4916: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4917: find a pkgviews User's guide in <code xmlns=
4918: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4919: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4920: </div>
4921:
1.55 ! rillig 4922: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4923: <div class="titlepage">
4924: <div>
4925: <div>
4926: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 4927: "faq-pkgtools" id=
1.38 dillo 4928: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4929: management (pkgtools)</h2>
1.1 grant 4930: </div>
4931: </div>
4932: </div>
4933:
1.45 wiz 4934: <p>The <code xmlns=
4935: "http://www.w3.org/TR/xhtml1/transitional" class=
4936: "filename">pkgsrc/pkgtools</code> directory pkgtools
4937: contains a number of useful utilities for both users and
4938: developers of pkgsrc. This section attempts only to make
4939: the reader aware of the utilities and when they might be
4940: useful, and not to duplicate the documentation that comes
4941: with each package.</p>
1.1 grant 4942:
4943: <p>Utilities used by pkgsrc (automatically installed when
4944: needed):</p>
4945:
4946: <div class="itemizedlist">
4947: <ul type="disc">
4948: <li>
4949: <p><a xmlns=
4950: "http://www.w3.org/TR/xhtml1/transitional" href=
4951: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 4952: target="_top"><code xmlns="" class=
4953: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4954: for use by buildlink.</p>
1.1 grant 4955: </li>
4956: </ul>
4957: </div>
4958:
4959: <p>OS tool augmentation (automatically installed when
4960: needed):</p>
4961:
4962: <div class="itemizedlist">
4963: <ul type="disc">
4964: <li>
4965: <p><a xmlns=
4966: "http://www.w3.org/TR/xhtml1/transitional" href=
4967: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 4968: target="_top"><code xmlns="" class=
4969: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 4970: various kinds of checksums (including SHA1).</p>
1.1 grant 4971: </li>
4972:
4973: <li>
4974: <p><a xmlns=
4975: "http://www.w3.org/TR/xhtml1/transitional" href=
4976: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 4977: target="_top"><code xmlns="" class=
4978: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 4979: Compatibility library for pkgsrc tools.</p>
1.1 grant 4980: </li>
4981:
4982: <li>
4983: <p><a xmlns=
4984: "http://www.w3.org/TR/xhtml1/transitional" href=
4985: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 4986: target="_top"><code xmlns="" class=
4987: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 4988: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4989: </li>
4990:
4991: <li>
4992: <p><a xmlns=
4993: "http://www.w3.org/TR/xhtml1/transitional" href=
4994: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 4995: target="_top"><code xmlns="" class=
4996: "filename">pkgtools/pkg_install</code></a>:
4997: Up-to-date replacement for <code xmlns=
4998: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 4999: "filename">/usr/sbin/pkg_install</code>, or for use
5000: on operating systems where pkg_install is not
5001: present.</p>
1.1 grant 5002: </li>
5003: </ul>
5004: </div>
5005:
5006: <p>Utilities used by pkgsrc (not automatically
5007: installed):</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/pkg_tarup/README.html"
1.45 wiz 5015: target="_top"><code xmlns="" class=
5016: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5017: binary package from an already-installed package.
1.34 wiz 5018: Used by <span><strong class="command">make
5019: replace</strong></span> to save the old
5020: package.</p>
1.1 grant 5021: </li>
5022:
5023: <li>
5024: <p><a xmlns=
5025: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5026: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5027: target="_top"><code xmlns="" class=
5028: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5029: functionality to pkgsrc, allowing it to fetch
5030: distfiles from multiple locations. It currently
5031: supports the following methods: multiple CD-ROMs
5032: and network FTP/HTTP connections.</p>
1.5 hubertf 5033: </li>
5034:
5035: <li>
5036: <p><a xmlns=
5037: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5038: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5039: target="_top"><code xmlns="" class=
5040: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5041: packages someplace else (enabled by default).</p>
1.1 grant 5042: </li>
1.5 hubertf 5043:
5044: <li>
5045: <p><a xmlns=
5046: "http://www.w3.org/TR/xhtml1/transitional" href=
5047: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5048: target="_top"><code xmlns="" class=
5049: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5050: best compiler flags to optimise code for your
1.20 ben 5051: current CPU and compiler.</p>
1.5 hubertf 5052: </li>
1.1 grant 5053: </ul>
5054: </div>
5055:
5056: <p>Utilities for keeping track of installed packages,
5057: being up to date, etc:</p>
5058:
5059: <div class="itemizedlist">
5060: <ul type="disc">
5061: <li>
5062: <p><a xmlns=
5063: "http://www.w3.org/TR/xhtml1/transitional" href=
5064: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5065: target="_top"><code xmlns="" class=
5066: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5067: packages whose installed versions do not match the
1.34 wiz 5068: latest pkgsrc entries.</p>
1.1 grant 5069: </li>
5070:
5071: <li>
5072: <p><a xmlns=
5073: "http://www.w3.org/TR/xhtml1/transitional" href=
5074: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5075: target="_top"><code xmlns="" class=
5076: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5077: dependency graphs of packages, to aid in choosing a
1.34 wiz 5078: strategy for updating.</p>
1.1 grant 5079: </li>
5080:
5081: <li>
5082: <p><a xmlns=
5083: "http://www.w3.org/TR/xhtml1/transitional" href=
5084: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5085: target="_top"><code xmlns="" class=
5086: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5087: graphs from the output of <a xmlns=
5088: "http://www.w3.org/TR/xhtml1/transitional" href=
5089: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5090: target="_top"><code xmlns="" class=
5091: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5092: graphviz).</p>
1.1 grant 5093: </li>
5094:
5095: <li>
5096: <p><a xmlns=
5097: "http://www.w3.org/TR/xhtml1/transitional" href=
5098: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5099: target="_top"><code xmlns="" class=
5100: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5101: pkglint(1) program checks a pkgsrc entry for
5102: errors, lintpkgsrc(1) does various checks on the
5103: complete pkgsrc system.</p>
1.1 grant 5104: </li>
5105:
5106: <li>
5107: <p><a xmlns=
5108: "http://www.w3.org/TR/xhtml1/transitional" href=
5109: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5110: target="_top"><code xmlns="" class=
5111: "filename">pkgtools/pkgsurvey</code></a>: Report
5112: what packages you have installed.</p>
1.1 grant 5113: </li>
5114: </ul>
5115: </div>
5116:
5117: <p>Utilities for people maintaining or creating
5118: individual packages:</p>
5119:
5120: <div class="itemizedlist">
5121: <ul type="disc">
5122: <li>
5123: <p><a xmlns=
5124: "http://www.w3.org/TR/xhtml1/transitional" href=
5125: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5126: target="_top"><code xmlns="" class=
5127: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5128: making and maintaining patches for a package
1.34 wiz 5129: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5130: </li>
5131:
5132: <li>
5133: <p><a xmlns=
5134: "http://www.w3.org/TR/xhtml1/transitional" href=
5135: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5136: target="_top"><code xmlns="" class=
5137: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5138: "http://www.w3.org/TR/xhtml1/transitional" href=
5139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5140: target="_top"><code xmlns="" class=
5141: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5142: converting to pkgsrc.</p>
1.1 grant 5143: </li>
5144:
5145: <li>
5146: <p><a xmlns=
5147: "http://www.w3.org/TR/xhtml1/transitional" href=
5148: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5149: target="_top"><code xmlns="" class=
5150: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5151: pkgsrc to a Solaris package.</p>
1.1 grant 5152: </li>
5153: </ul>
5154: </div>
5155:
1.47 reed 5156: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5157: obscure pkg utilities)</p>
5158:
5159: <div class="itemizedlist">
5160: <ul type="disc">
5161: <li>
5162: <p><a xmlns=
5163: "http://www.w3.org/TR/xhtml1/transitional" href=
5164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5165: target="_top"><code xmlns="" class=
5166: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5167: packages in a chrooted area.</p>
1.1 grant 5168: </li>
5169:
5170: <li>
5171: <p><a xmlns=
5172: "http://www.w3.org/TR/xhtml1/transitional" href=
5173: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5174: target="_top"><code xmlns="" class=
5175: "filename">pkgtools/libkver</code></a>: Spoof
5176: kernel version for chrooted cross builds.</p>
1.1 grant 5177: </li>
5178: </ul>
5179: </div>
5180: </div>
5181:
1.55 ! rillig 5182: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5183: <div class="titlepage">
5184: <div>
5185: <div>
5186: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5187: "non-root-pkgsrc" id=
1.38 dillo 5188: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5189: as non-root</h2>
1.1 grant 5190: </div>
5191: </div>
5192: </div>
5193:
5194: <p>If you want to use pkgsrc as non-root user, you can
5195: set some variables to make pkgsrc work under these
1.33 jmmv 5196: conditions. At the very least, you need to set
5197: <code class="varname">UNPRIVILEGED</code> to
5198: “<span class="quote">yes</span>”; this will
5199: turn on unprivileged mode and set multiple related
5200: variables to allow installation of packages as
5201: non-root.</p>
5202:
5203: <p>In case the defaults are not enough, you may want to
5204: tune some other variables used. For example, if the
5205: automatic user/group detection leads to incorrect values
5206: (or not the ones you would like to use), you can change
5207: them by setting <code class=
5208: "varname">UNPRIVILEGED_USER</code> and <code class=
5209: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5210:
5211: <p>As regards bootstrapping, please note that the
5212: <span><strong class="command">bootstrap</strong></span>
5213: script will ease non-root configuration when given the
5214: “<span class=
5215: "quote">--ignore-user-check</span>” flag, as it
5216: will choose and use multiple default directories under
1.45 wiz 5217: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5218: class="filename">~/pkg</code> as the installation
1.33 jmmv 5219: targets. These directories can be overriden by the
5220: “<span class="quote">--prefix</span>” flag
5221: provided by the script, as well as some others that allow
5222: finer tuning of the tree layout.</p>
1.14 xtraeme 5223: </div>
5224:
1.55 ! rillig 5225: <div class="sect1" lang="en" xml:lang="en">
1.14 xtraeme 5226: <div class="titlepage">
5227: <div>
5228: <div>
5229: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5230: "resume-transfers" id=
1.38 dillo 5231: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5232: transfers when fetching distfiles?</h2>
1.14 xtraeme 5233: </div>
5234: </div>
5235: </div>
5236:
1.47 reed 5237: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5238: but you can enable this feature by adding the option
5239: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5240: into <code xmlns=
5241: "http://www.w3.org/TR/xhtml1/transitional" class=
5242: "filename">/etc/mk.conf</code>. If, during a fetch step,
5243: an incomplete distfile is found, pkgsrc will try to
5244: resume it.</p>
1.15 xtraeme 5245:
5246: <p>You can also use a different program than the default
1.24 wiz 5247: <a href=
5248: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5249: <span class="citerefentry"><span class=
5250: "refentrytitle">ftp</span>(1)</span></a> by changing the
5251: <code class="varname">FETCH_CMD</code> variable. Don't
5252: forget to set <code class=
5253: "varname">FETCH_RESUME_ARGS</code> and <code class=
5254: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5255: default values.</p>
1.14 xtraeme 5256:
1.45 wiz 5257: <p>For example, if you want to use <code xmlns=
5258: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5259: "filename">wget</code> to resume downloads, you'll have
5260: to use something like:</p>
5261: <pre class="programlisting">
1.51 rillig 5262: FETCH_CMD= wget
5263: FETCH_BEFORE_ARGS= --passive-ftp
5264: FETCH_RESUME_ARGS= -c
5265: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5266: </pre>
1.1 grant 5267: </div>
5268:
1.55 ! rillig 5269: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5270: <div class="titlepage">
5271: <div>
5272: <div>
5273: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5274: "XFree86-from-pkgsrc" id=
1.38 dillo 5275: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5276: install/use XFree86 from pkgsrc?</h2>
5277: </div>
5278: </div>
5279: </div>
5280:
5281: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5282: system's own X11 (<code xmlns=
5283: "http://www.w3.org/TR/xhtml1/transitional" class=
5284: "filename">/usr/X11R6</code>, <code xmlns=
5285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5286: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5287: add the following line into <code xmlns=
5288: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5289: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5290: <pre class="programlisting">
1.51 rillig 5291: X11_TYPE=XFree86
1.1 grant 5292: </pre>
5293: </div>
5294:
1.55 ! rillig 5295: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5296: <div class="titlepage">
5297: <div>
5298: <div>
5299: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5300: "x.org-from-pkgsrc" id=
1.38 dillo 5301: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5302: install/use X.org from pkgsrc?</h2>
5303: </div>
5304: </div>
5305: </div>
5306:
5307: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5308: system's own X11 (<code xmlns=
5309: "http://www.w3.org/TR/xhtml1/transitional" class=
5310: "filename">/usr/X11R6</code>, <code xmlns=
5311: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5312: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5313: the following line into <code xmlns=
5314: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5315: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5316: <pre class="programlisting">
1.51 rillig 5317: X11_TYPE=xorg
1.1 grant 5318: </pre>
5319: </div>
5320:
1.55 ! rillig 5321: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5322: <div class="titlepage">
5323: <div>
5324: <div>
5325: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5326: "fetch-behind-firewall" id=
1.38 dillo 5327: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5328: files from behind a firewall</h2>
1.1 grant 5329: </div>
5330: </div>
5331: </div>
5332:
5333: <p>If you are sitting behind a firewall which does not
5334: allow direct connections to Internet hosts (i.e.
5335: non-NAT), you may specify the relevant proxy hosts. This
5336: is done using an environment variable in the form of a
1.47 reed 5337: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5338: "quote">orpheus.amdahl.com</span>” is one of the
5339: firewalls, and it uses port 80 as the proxy port number.
5340: So the proxy environment variables are:</p>
5341: <pre class="programlisting">
1.51 rillig 5342: ftp_proxy=ftp://orpheus.amdahl.com:80/
5343: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5344: </pre>
5345: </div>
5346:
1.55 ! rillig 5347: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5348: <div class="titlepage">
5349: <div>
5350: <div>
5351: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5352: "passive-ftp" id="passive-ftp"></a>7.9. How do
! 5353: I tell <span><strong class="command">make
1.14 xtraeme 5354: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5355: </div>
5356: </div>
5357: </div>
5358:
5359: <p>This depends on which utility is used to retrieve
1.45 wiz 5360: distfiles. From <code xmlns=
5361: "http://www.w3.org/TR/xhtml1/transitional" class=
5362: "filename">bsd.pkg.mk</code>, <code class=
5363: "varname">FETCH_CMD</code> is assigned the first
5364: available command from the following list:</p>
1.34 wiz 5365:
5366: <div class="itemizedlist">
5367: <ul type="disc">
5368: <li>
1.45 wiz 5369: <p><code xmlns=
5370: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5371: "filename">${LOCALBASE}/bin/ftp</code></p>
5372: </li>
5373:
5374: <li>
1.45 wiz 5375: <p><code xmlns=
5376: "http://www.w3.org/TR/xhtml1/transitional" class=
5377: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5378: </li>
5379: </ul>
5380: </div>
1.1 grant 5381:
5382: <p>On a default NetBSD installation, this will be
1.45 wiz 5383: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5384: class="filename">/usr/bin/ftp</code>, which automatically
5385: tries passive connections first, and falls back to active
5386: connections if the server refuses to do passive. For the
5387: other tools, add the following to your <code xmlns=
5388: "http://www.w3.org/TR/xhtml1/transitional" class=
5389: "filename">/etc/mk.conf</code> file: <code class=
5390: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5391:
1.45 wiz 5392: <p>Having that option present will prevent <code xmlns=
5393: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5394: "filename">/usr/bin/ftp</code> from falling back to
5395: active transfers.</p>
1.1 grant 5396: </div>
5397:
1.55 ! rillig 5398: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5399: <div class="titlepage">
5400: <div>
5401: <div>
5402: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5403: "fetching-all-distfiles" id=
1.38 dillo 5404: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5405: fetch all distfiles at once</h2>
5406: </div>
5407: </div>
5408: </div>
5409:
5410: <p>You would like to download all the distfiles in a
5411: single batch from work or university, where you can't run
1.14 xtraeme 5412: a <span><strong class="command">make
5413: fetch</strong></span>. There is an archive of distfiles
5414: on <a href=
1.1 grant 5415: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5416: target="_top">ftp.NetBSD.org</a>, but downloading the
5417: entire directory may not be appropriate.</p>
5418:
1.14 xtraeme 5419: <p>The answer here is to do a <span><strong class=
1.45 wiz 5420: "command">make fetch-list</strong></span> in <code xmlns=
5421: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5422: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5423: subdirectories, carry the resulting list to your machine
1.23 wiz 5424: at work/school and use it there. If you don't have a
1.24 wiz 5425: NetBSD-compatible <a href=
5426: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5427: <span class="citerefentry"><span class=
5428: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5429: at work, don't forget to set <code class=
5430: "varname">FETCH_CMD</code> to something that fetches a
5431: URL:</p>
1.1 grant 5432:
5433: <p>At home:</p>
5434: <pre class="screen">
1.14 xtraeme 5435: <code class="prompt">%</code> <strong class=
5436: "userinput"><code>cd /usr/pkgsrc</code></strong>
5437: <code class="prompt">%</code> <strong class=
5438: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5439: <code class="prompt">%</code> <strong class=
5440: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5441: </pre>
5442:
5443: <p>At work:</p>
5444: <pre class="screen">
1.14 xtraeme 5445: <code class="prompt">%</code> <strong class=
5446: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5447: </pre>
5448:
1.45 wiz 5449: <p>then tar up <code xmlns=
5450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5451: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5452:
5453: <p>If you have a machine running NetBSD, and you want to
5454: get <span class="emphasis"><em>all</em></span> distfiles
5455: (even ones that aren't for your machine architecture),
5456: you can do so by using the above-mentioned
1.14 xtraeme 5457: <span><strong class="command">make
5458: fetch-list</strong></span> approach, or fetch the
5459: distfiles directly by running:</p>
1.1 grant 5460: <pre class="screen">
1.14 xtraeme 5461: <code class="prompt">%</code> <strong class=
5462: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5463: </pre>
5464:
1.14 xtraeme 5465: <p>If you even decide to ignore <code class=
5466: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5467: can get everything by running:</p>
1.1 grant 5468: <pre class="screen">
1.14 xtraeme 5469: <code class="prompt">%</code> <strong class=
5470: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5471: </pre>
5472: </div>
5473:
1.55 ! rillig 5474: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5475: <div class="titlepage">
5476: <div>
5477: <div>
5478: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5479: "tmac.andoc-missing" id=
1.38 dillo 5480: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5481: “<span class="quote">Don't know how to make
5482: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5483: </div>
5484: </div>
5485: </div>
5486:
5487: <p>When compiling the <a xmlns=
5488: "http://www.w3.org/TR/xhtml1/transitional" href=
5489: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5490: target="_top"><code xmlns="" class=
5491: "filename">pkgtools/pkg_install</code></a> package, you
5492: get the error from make that it doesn't know how to make
5493: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5494: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5495: indicates that you don't have installed the
1.23 wiz 5496: “<span class="quote">text</span>” set (nroff,
5497: ...) from the NetBSD base distribution on your machine.
1.47 reed 5498: It is recommended to do that to format man pages.</p>
1.1 grant 5499:
5500: <p>In the case of the <a xmlns=
5501: "http://www.w3.org/TR/xhtml1/transitional" href=
5502: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5503: target="_top"><code xmlns="" class=
5504: "filename">pkgtools/pkg_install</code></a> package, you
5505: can get away with setting <code class=
1.20 ben 5506: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5507: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5508: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5509: </div>
5510:
1.55 ! rillig 5511: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5512: <div class="titlepage">
5513: <div>
5514: <div>
5515: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5516: "bsd.own.mk-missing" id=
1.38 dillo 5517: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5518: “<span class="quote">Could not find
5519: bsd.own.mk</span>” mean?</h2>
5520: </div>
5521: </div>
5522: </div>
5523:
1.45 wiz 5524: <p>You didn't install the compiler set, <code xmlns=
5525: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5526: "filename">comp.tgz</code>, when you installed your
1.47 reed 5527: NetBSD machine. Please get and install it, by extracting
5528: it in <code xmlns=
1.45 wiz 5529: "http://www.w3.org/TR/xhtml1/transitional" class=
5530: "filename">/</code>:</p>
1.1 grant 5531: <pre class="screen">
1.14 xtraeme 5532: <code class="prompt">#</code> <strong class=
5533: "userinput"><code>cd /</code></strong>
5534: <code class="prompt">#</code> <strong class=
5535: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5536: </pre>
5537:
1.45 wiz 5538: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5539: class="filename">comp.tgz</code> is part of every NetBSD
5540: release. Get the one that corresponds to your release
5541: (determine via <span><strong class="command">uname
5542: -r</strong></span>).</p>
1.1 grant 5543: </div>
5544:
1.55 ! rillig 5545: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5546: <div class="titlepage">
5547: <div>
5548: <div>
5549: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5550: "using-sudo-with-pkgsrc" id=
1.38 dillo 5551: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5552: 'sudo' with pkgsrc</h2>
5553: </div>
5554: </div>
5555: </div>
5556:
5557: <p>When installing packages as non-root user and using
1.24 wiz 5558: the just-in-time <a href=
5559: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5560: <span class="citerefentry"><span class=
5561: "refentrytitle">su</span>(1)</span></a> feature of
5562: pkgsrc, it can become annoying to type in the root
5563: password for each required package installed. To avoid
5564: this, the sudo package can be used, which does password
5565: caching over a limited time. To use it, install sudo
5566: (either as binary package or from <a xmlns=
5567: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5568: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5569: target="_top"><code xmlns="" class=
5570: "filename">security/sudo</code></a>) and then put the
5571: following into your <code xmlns=
5572: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5573: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5574: <pre class="programlisting">
1.51 rillig 5575: .if exists(${LOCALBASE}/bin/sudo)
5576: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5577: .endif
1.1 grant 5578: </pre>
5579: </div>
5580:
1.55 ! rillig 5581: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5582: <div class="titlepage">
5583: <div>
5584: <div>
5585: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5586: "faq.conf" id="faq.conf"></a>7.14. How do I
! 5587: change the location of configuration files?</h2>
1.1 grant 5588: </div>
5589: </div>
5590: </div>
5591:
1.35 jmmv 5592: <p>As the system administrator, you can choose where
5593: configuration files are installed. The default settings
1.45 wiz 5594: make all these files go into <code xmlns=
5595: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5596: "filename">${PREFIX}/etc</code> or some of its
5597: subdirectories; this may be suboptimal depending on your
5598: expectations (e.g., a read-only, NFS-exported
5599: <code class="varname">PREFIX</code> with a need of
5600: per-machine configuration of the provided packages).</p>
5601:
5602: <p>In order to change the defaults, you can modify the
5603: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5604: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5605: class="filename">/etc/mk.conf</code>) to point to your
5606: preferred configuration directory; some common examples
5607: include <code xmlns=
5608: "http://www.w3.org/TR/xhtml1/transitional" class=
5609: "filename">/etc</code> or <code xmlns=
5610: "http://www.w3.org/TR/xhtml1/transitional" class=
5611: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5612:
5613: <p>Furthermore, you can change this value on a
5614: per-package basis by setting the <code class=
5615: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5616: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5617: value usually matches the name of the package you would
5618: like to modify, that is, the contents of <code class=
5619: "varname">PKGBASE</code>.</p>
1.1 grant 5620:
1.47 reed 5621: <p>Note that after changing these settings, you must
1.35 jmmv 5622: rebuild and reinstall any affected packages.</p>
1.1 grant 5623: </div>
5624:
1.55 ! rillig 5625: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5626: <div class="titlepage">
5627: <div>
5628: <div>
5629: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 5630: "audit-packages" id=
1.38 dillo 5631: "audit-packages"></a>7.15. Automated security
1.1 grant 5632: checks</h2>
5633: </div>
5634: </div>
5635: </div>
5636:
5637: <p>Please be aware that there can often be bugs in
5638: third-party software, and some of these bugs can leave a
5639: machine vulnerable to exploitation by attackers. In an
5640: effort to lessen the exposure, the NetBSD packages team
5641: maintains a database of known-exploits to packages which
5642: have at one time been included in pkgsrc. The database
5643: can be downloaded automatically, and a security audit of
5644: all packages installed on a system can take place. To do
5645: this, install the <a xmlns=
5646: "http://www.w3.org/TR/xhtml1/transitional" href=
5647: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5648: target="_top"><code xmlns="" class=
5649: "filename">security/audit-packages</code></a> package. It
1.20 ben 5650: has two components:</p>
1.1 grant 5651:
5652: <div class="orderedlist">
5653: <ol type="1">
5654: <li>
1.34 wiz 5655: <p><span><strong class=
5656: "command">download-vulnerability-list</strong></span>,
1.1 grant 5657: an easy way to download a list of the security
5658: vulnerabilities information. This list is kept up
5659: to date by the NetBSD security officer and the
5660: NetBSD packages team, and is distributed from the
5661: NetBSD ftp server:</p>
5662:
5663: <p><a href=
5664: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5665: target=
5666: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5667: </li>
5668:
5669: <li>
1.34 wiz 5670: <p><span><strong class=
5671: "command">audit-packages</strong></span>, an easy
5672: way to audit the current machine, checking each
1.1 grant 5673: vulnerability which is known. If a vulnerable
5674: package is installed, it will be shown by output to
5675: stdout, including a description of the type of
5676: vulnerability, and a URL containing more
5677: information.</p>
5678: </li>
5679: </ol>
5680: </div>
5681:
1.23 wiz 5682: <p>Use of the <a xmlns=
5683: "http://www.w3.org/TR/xhtml1/transitional" href=
5684: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5685: target="_top"><code xmlns="" class=
5686: "filename">security/audit-packages</code></a> package is
1.23 wiz 5687: strongly recommended! After “<span class=
5688: "quote">audit-packages</span>” is installed, please
5689: read the package's message, which you can get by running
5690: <strong class="userinput"><code>pkg_info -D
5691: audit-package</code></strong>.</p>
1.1 grant 5692: </div>
5693: </div>
5694: </div>
5695:
1.55 ! rillig 5696: <div class="part" lang="en" xml:lang="en">
1.1 grant 5697: <div class="titlepage">
5698: <div>
5699: <div>
1.55 ! rillig 5700: <h1 class="title"><a name="developers-guide" id=
1.48 dillo 5701: "developers-guide"></a>Part II. The pkgsrc
5702: developer's guide</h1>
1.1 grant 5703: </div>
5704: </div>
5705: </div>
5706:
5707: <div class="toc">
5708: <p><b>Table of Contents</b></p>
5709:
5710: <dl>
1.38 dillo 5711: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5712: Package components - files, directories and
5713: contents</a></span></dt>
5714:
5715: <dd>
5716: <dl>
5717: <dt><span class="sect1"><a href=
1.45 wiz 5718: "#components.Makefile">8.1. <code xmlns=
5719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5720: "filename">Makefile</code></a></span></dt>
5721:
5722: <dt><span class="sect1"><a href=
1.45 wiz 5723: "#components.distinfo">8.2. <code xmlns=
5724: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5725: "filename">distinfo</code></a></span></dt>
5726:
5727: <dt><span class="sect1"><a href=
1.38 dillo 5728: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5729:
1.30 wiz 5730: <dt><span class="sect1"><a href=
1.38 dillo 5731: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5732: files</a></span></dt>
1.27 rillig 5733:
5734: <dt><span class="sect1"><a href=
1.38 dillo 5735: "#components.optional">8.5. Optional
1.27 rillig 5736: files</a></span></dt>
5737:
1.38 dillo 5738: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5739: <code xmlns=
5740: "http://www.w3.org/TR/xhtml1/transitional" class=
5741: "filename">work*</code></a></span></dt>
1.27 rillig 5742:
1.38 dillo 5743: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5744: <code xmlns=
5745: "http://www.w3.org/TR/xhtml1/transitional" class=
5746: "filename">files/*</code></a></span></dt>
1.27 rillig 5747: </dl>
5748: </dd>
5749:
1.38 dillo 5750: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5751: Programming in <code xmlns=
5752: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5753: "filename">Makefile</code>s</a></span></dt>
5754:
5755: <dd>
5756: <dl>
5757: <dt><span class="sect1"><a href=
1.45 wiz 5758: "#makefile.variables">9.1. <code xmlns=
5759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5760: "filename">Makefile</code> variables</a></span></dt>
5761:
1.27 rillig 5762: <dd>
5763: <dl>
5764: <dt><span class="sect2"><a href=
1.38 dillo 5765: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5766: conventions</a></span></dt>
5767: </dl>
5768: </dd>
5769:
1.38 dillo 5770: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5771: Code snippets</a></span></dt>
5772:
5773: <dd>
5774: <dl>
5775: <dt><span class="sect2"><a href=
1.38 dillo 5776: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5777: list</a></span></dt>
5778:
5779: <dt><span class="sect2"><a href=
1.38 dillo 5780: "#converting-internal-to-external">9.2.2.
1.30 wiz 5781: Converting an internal list into an external
5782: list</a></span></dt>
1.25 rillig 5783:
5784: <dt><span class="sect2"><a href=
1.38 dillo 5785: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5786: variables to a shell command</a></span></dt>
1.27 rillig 5787:
5788: <dt><span class="sect2"><a href=
1.38 dillo 5789: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5790: guideline</a></span></dt>
5791:
5792: <dt><span class="sect2"><a href=
1.38 dillo 5793: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5794: a bug in BSD Make</a></span></dt>
1.25 rillig 5795: </dl>
5796: </dd>
5797: </dl>
5798: </dd>
5799:
1.38 dillo 5800: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5801: issues</a></span></dt>
5802:
5803: <dd>
5804: <dl>
1.38 dillo 5805: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5806: ID</a></span></dt>
5807:
1.30 wiz 5808: <dt><span class="sect1"><a href=
1.38 dillo 5809: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5810: <code xmlns=
5811: "http://www.w3.org/TR/xhtml1/transitional" class=
5812: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5813:
1.38 dillo 5814: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5815: Tweaking output of <span><strong class="command">make
5816: print-PLIST</strong></span></a></span></dt>
1.1 grant 5817:
1.38 dillo 5818: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5819: Variable substitution in PLIST</a></span></dt>
5820:
1.30 wiz 5821: <dt><span class="sect1"><a href=
1.48 dillo 5822: "#manpage-compression">10.5. Man page
5823: compression</a></span></dt>
1.1 grant 5824:
1.30 wiz 5825: <dt><span class="sect1"><a href=
1.38 dillo 5826: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5827: <code class=
1.14 xtraeme 5828: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5829:
1.30 wiz 5830: <dt><span class="sect1"><a href=
1.47 reed 5831: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5832: and differing PLISTs</a></span></dt>
1.1 grant 5833:
5834: <dt><span class="sect1"><a href=
1.38 dillo 5835: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5836: packages</a></span></dt>
5837: </dl>
5838: </dd>
5839:
1.38 dillo 5840: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5841: Buildlink methodology</a></span></dt>
5842:
5843: <dd>
5844: <dl>
1.30 wiz 5845: <dt><span class="sect1"><a href=
1.38 dillo 5846: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5847: to use buildlink3</a></span></dt>
1.1 grant 5848:
1.30 wiz 5849: <dt><span class="sect1"><a href=
1.45 wiz 5850: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5851: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5852: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5853:
5854: <dd>
5855: <dl>
5856: <dt><span class="sect2"><a href=
1.38 dillo 5857: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5858: buildlink3.mk file</a></span></dt>
1.1 grant 5859:
5860: <dt><span class="sect2"><a href=
1.38 dillo 5861: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5862: <code class=
1.55 ! rillig 5863: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
! 5864: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 5865: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5866: "filename">buildlink3.mk</code>
1.1 grant 5867: files</a></span></dt>
5868: </dl>
5869: </dd>
5870:
1.30 wiz 5871: <dt><span class="sect1"><a href=
1.45 wiz 5872: "#writing-builtin.mk">11.3. Writing <code xmlns=
5873: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5874: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5875:
5876: <dd>
5877: <dl>
5878: <dt><span class="sect2"><a href=
1.38 dillo 5879: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5880: <code xmlns=
5881: "http://www.w3.org/TR/xhtml1/transitional" class=
5882: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5883:
5884: <dt><span class="sect2"><a href=
1.38 dillo 5885: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5886: preferences for native or pkgsrc
5887: software</a></span></dt>
1.1 grant 5888: </dl>
5889: </dd>
5890: </dl>
5891: </dd>
5892:
1.38 dillo 5893: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5894: pkginstall framework</a></span></dt>
5895:
5896: <dd>
5897: <dl>
5898: <dt><span class="sect1"><a href=
1.38 dillo 5899: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5900: directories outside the installation
5901: prefix</a></span></dt>
5902:
5903: <dd>
5904: <dl>
5905: <dt><span class="sect2"><a href=
1.38 dillo 5906: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5907: manipulation</a></span></dt>
5908:
5909: <dt><span class="sect2"><a href=
1.38 dillo 5910: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5911: manipulation</a></span></dt>
5912: </dl>
5913: </dd>
5914:
1.38 dillo 5915: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5916: Configuration files</a></span></dt>
5917:
5918: <dd>
5919: <dl>
5920: <dt><span class="sect2"><a href=
1.38 dillo 5921: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5922: "varname">PKG_SYSCONFDIR</code> is
5923: set</a></span></dt>
5924:
5925: <dt><span class="sect2"><a href=
1.38 dillo 5926: "#conf-files-configure">12.2.2. Telling the
1.47 reed 5927: software where configuration files
1.35 jmmv 5928: are</a></span></dt>
5929:
5930: <dt><span class="sect2"><a href=
1.38 dillo 5931: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5932: installations</a></span></dt>
5933:
5934: <dt><span class="sect2"><a href=
1.38 dillo 5935: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5936: of configuration files</a></span></dt>
5937: </dl>
5938: </dd>
5939:
1.38 dillo 5940: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5941: System startup scripts</a></span></dt>
5942:
5943: <dd>
5944: <dl>
5945: <dt><span class="sect2"><a href=
1.38 dillo 5946: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5947: of system startup scripts</a></span></dt>
5948: </dl>
5949: </dd>
5950:
5951: <dt><span class="sect1"><a href=
1.38 dillo 5952: "#users-and-groups">12.4. System users and
1.35 jmmv 5953: groups</a></span></dt>
5954:
1.38 dillo 5955: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5956: System shells</a></span></dt>
5957:
5958: <dd>
5959: <dl>
5960: <dt><span class="sect2"><a href=
1.38 dillo 5961: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5962: configuration files</a></span></dt>
5963: </dl>
5964: </dd>
5965: </dl>
5966: </dd>
5967:
1.38 dillo 5968: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5969: handling</a></span></dt>
5970:
5971: <dd>
5972: <dl>
1.30 wiz 5973: <dt><span class="sect1"><a href=
1.38 dillo 5974: "#global-default-options">13.1. Global default
1.30 wiz 5975: options</a></span></dt>
1.1 grant 5976:
1.30 wiz 5977: <dt><span class="sect1"><a href=
1.38 dillo 5978: "#converting-to-options">13.2. Converting packages to
1.45 wiz 5979: use <code xmlns=
5980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5981: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 5982:
5983: <dt><span class="sect1"><a href="#option-names">13.3.
5984: Option Names</a></span></dt>
1.1 grant 5985: </dl>
5986: </dd>
5987:
1.38 dillo 5988: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5989: process</a></span></dt>
5990:
5991: <dd>
5992: <dl>
1.38 dillo 5993: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5994: Program location</a></span></dt>
5995:
1.38 dillo 5996: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5997: Main targets</a></span></dt>
5998:
5999: <dt><span class="sect1"><a href=
1.38 dillo 6000: "#build.helpful-targets">14.3. Other helpful
1.1 grant 6001: targets</a></span></dt>
6002: </dl>
6003: </dd>
6004:
1.55 ! rillig 6005: <dt><span class="chapter"><a href="#fixes">15. Making
! 6006: your package work</a></span></dt>
1.1 grant 6007:
6008: <dd>
6009: <dl>
1.30 wiz 6010: <dt><span class="sect1"><a href=
1.38 dillo 6011: "#general-operation">15.1. General
1.30 wiz 6012: operation</a></span></dt>
1.1 grant 6013:
6014: <dd>
6015: <dl>
6016: <dt><span class="sect2"><a href=
1.38 dillo 6017: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 6018: pull in variables from
6019: /etc/mk.conf</a></span></dt>
1.1 grant 6020:
6021: <dt><span class="sect2"><a href=
1.38 dillo 6022: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 6023: to install documentation</a></span></dt>
6024:
6025: <dt><span class="sect2"><a href=
1.38 dillo 6026: "#restricted-packages">15.1.3. Restricted
1.1 grant 6027: packages</a></span></dt>
6028:
6029: <dt><span class="sect2"><a href=
1.38 dillo 6030: "#dependencies">15.1.4. Handling
1.1 grant 6031: dependencies</a></span></dt>
6032:
6033: <dt><span class="sect2"><a href=
1.38 dillo 6034: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 6035: other packages</a></span></dt>
6036:
6037: <dt><span class="sect2"><a href=
1.38 dillo 6038: "#not-building-packages">15.1.6. Packages that
1.30 wiz 6039: cannot or should not be built</a></span></dt>
1.1 grant 6040:
6041: <dt><span class="sect2"><a href=
1.38 dillo 6042: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6043: should not be deleted, once
6044: installed</a></span></dt>
1.1 grant 6045:
6046: <dt><span class="sect2"><a href=
1.38 dillo 6047: "#security-handling">15.1.8. Handling packages
1.1 grant 6048: with security problems</a></span></dt>
6049:
6050: <dt><span class="sect2"><a href=
1.38 dillo 6051: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6052: bugs</a></span></dt>
6053:
6054: <dt><span class="sect2"><a href=
1.38 dillo 6055: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6056: incrementing versions when fixing an existing
1.1 grant 6057: package</a></span></dt>
6058:
6059: <dt><span class="sect2"><a href=
1.38 dillo 6060: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6061: of packages</a></span></dt>
1.1 grant 6062: </dl>
6063: </dd>
6064:
1.30 wiz 6065: <dt><span class="sect1"><a href=
1.38 dillo 6066: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6067: issues</a></span></dt>
1.1 grant 6068:
6069: <dd>
6070: <dl>
6071: <dt><span class="sect2"><a href=
1.38 dillo 6072: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6073: distfiles aren't available for plain
1.1 grant 6074: downloading</a></span></dt>
6075:
6076: <dt><span class="sect2"><a href=
1.38 dillo 6077: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6078: handle modified distfiles with the 'old'
6079: name</a></span></dt>
1.1 grant 6080: </dl>
6081: </dd>
6082:
1.30 wiz 6083: <dt><span class="sect1"><a href=
1.38 dillo 6084: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6085: gotchas</a></span></dt>
1.1 grant 6086:
6087: <dd>
6088: <dl>
6089: <dt><span class="sect2"><a href=
1.38 dillo 6090: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6091: libtool</a></span></dt>
6092:
6093: <dt><span class="sect2"><a href=
1.38 dillo 6094: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6095: packages that already support
6096: libtool</a></span></dt>
6097:
6098: <dt><span class="sect2"><a href=
1.38 dillo 6099: "#autoconf-automake">15.3.3. GNU
1.1 grant 6100: Autoconf/Automake</a></span></dt>
6101: </dl>
6102: </dd>
6103:
1.55 ! rillig 6104: <dt><span class="sect1"><a href="#fixes-build">15.4.
! 6105: Building the package</a></span></dt>
1.1 grant 6106:
6107: <dd>
6108: <dl>
6109: <dt><span class="sect2"><a href=
1.38 dillo 6110: "#cpp-defines">15.4.1. CPP
1.30 wiz 6111: defines</a></span></dt>
1.51 rillig 6112:
6113: <dt><span class="sect2"><a href=
6114: "#cpp-list">15.4.2. Getting a list of CPP
6115: defines</a></span></dt>
1.1 grant 6116: </dl>
6117: </dd>
6118:
1.30 wiz 6119: <dt><span class="sect1"><a href=
1.38 dillo 6120: "#package-specific-actions">15.5. Package specific
1.30 wiz 6121: actions</a></span></dt>
1.1 grant 6122:
6123: <dd>
6124: <dl>
6125: <dt><span class="sect2"><a href=
1.38 dillo 6126: "#user-interaction">15.5.1. User
1.2 hubertf 6127: interaction</a></span></dt>
1.1 grant 6128:
6129: <dt><span class="sect2"><a href=
1.38 dillo 6130: "#handling-licenses">15.5.2. Handling
1.1 grant 6131: licenses</a></span></dt>
6132:
6133: <dt><span class="sect2"><a href=
1.38 dillo 6134: "#installing-score-files">15.5.3. Installing
1.30 wiz 6135: score files</a></span></dt>
1.1 grant 6136:
6137: <dt><span class="sect2"><a href=
1.38 dillo 6138: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6139: scripts</a></span></dt>
6140:
6141: <dt><span class="sect2"><a href=
1.38 dillo 6142: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6143: hardcoded paths to other
6144: interpreters</a></span></dt>
1.1 grant 6145:
6146: <dt><span class="sect2"><a href=
1.38 dillo 6147: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6148: modules</a></span></dt>
6149:
6150: <dt><span class="sect2"><a href=
1.38 dillo 6151: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6152: info files</a></span></dt>
6153:
6154: <dt><span class="sect2"><a href=
1.38 dillo 6155: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 6156: GConf2 data files</a></span></dt>
1.1 grant 6157:
6158: <dt><span class="sect2"><a href=
1.38 dillo 6159: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 6160: installing scrollkeeper data
6161: files</a></span></dt>
1.1 grant 6162:
6163: <dt><span class="sect2"><a href=
1.38 dillo 6164: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 6165: fonts</a></span></dt>
6166:
6167: <dt><span class="sect2"><a href=
1.38 dillo 6168: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 6169: modules</a></span></dt>
6170:
6171: <dt><span class="sect2"><a href=
1.38 dillo 6172: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 6173: SGML or XML data</a></span></dt>
1.1 grant 6174:
6175: <dt><span class="sect2"><a href=
1.38 dillo 6176: "#mime-database">15.5.13. Packages installing
1.1 grant 6177: extensions to the MIME database</a></span></dt>
6178:
6179: <dt><span class="sect2"><a href=
1.38 dillo 6180: "#intltool">15.5.14. Packages using
1.1 grant 6181: intltool</a></span></dt>
1.18 xtraeme 6182:
6183: <dt><span class="sect2"><a href=
1.38 dillo 6184: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 6185: startup scripts</a></span></dt>
1.1 grant 6186: </dl>
6187: </dd>
6188:
1.30 wiz 6189: <dt><span class="sect1"><a href=
1.38 dillo 6190: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6191: author</a></span></dt>
1.1 grant 6192: </dl>
6193: </dd>
6194:
1.38 dillo 6195: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6196: Debugging</a></span></dt>
6197:
1.38 dillo 6198: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6199: Submitting and Committing</a></span></dt>
6200:
6201: <dd>
6202: <dl>
1.30 wiz 6203: <dt><span class="sect1"><a href=
1.38 dillo 6204: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6205: packages</a></span></dt>
1.1 grant 6206:
1.30 wiz 6207: <dt><span class="sect1"><a href=
1.41 wiz 6208: "#general-notes-for-changes">17.2. General notes when
6209: adding, updating, or removing
6210: packages</a></span></dt>
6211:
6212: <dt><span class="sect1"><a href=
6213: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6214: package into CVS</a></span></dt>
1.1 grant 6215:
1.30 wiz 6216: <dt><span class="sect1"><a href=
1.41 wiz 6217: "#updating-package">17.4. Updating a package to a
1.30 wiz 6218: newer version</a></span></dt>
1.1 grant 6219:
1.30 wiz 6220: <dt><span class="sect1"><a href=
1.41 wiz 6221: "#moving-package">17.5. Moving a package in
1.30 wiz 6222: pkgsrc</a></span></dt>
1.1 grant 6223: </dl>
6224: </dd>
6225: </dl>
6226: </div>
6227:
1.55 ! rillig 6228: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 6229: <div class="titlepage">
6230: <div>
6231: <div>
1.55 ! rillig 6232: <h2 class="title"><a name="components" id=
1.38 dillo 6233: "components"></a>Chapter 8. Package
1.27 rillig 6234: components - files, directories and contents</h2>
1.25 rillig 6235: </div>
6236: </div>
6237: </div>
6238:
6239: <div class="toc">
6240: <p><b>Table of Contents</b></p>
6241:
6242: <dl>
6243: <dt><span class="sect1"><a href=
1.45 wiz 6244: "#components.Makefile">8.1. <code xmlns=
6245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6246: "filename">Makefile</code></a></span></dt>
6247:
6248: <dt><span class="sect1"><a href=
1.45 wiz 6249: "#components.distinfo">8.2. <code xmlns=
6250: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6251: "filename">distinfo</code></a></span></dt>
6252:
6253: <dt><span class="sect1"><a href=
1.38 dillo 6254: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6255:
1.30 wiz 6256: <dt><span class="sect1"><a href=
1.38 dillo 6257: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6258: files</a></span></dt>
1.25 rillig 6259:
1.27 rillig 6260: <dt><span class="sect1"><a href=
1.38 dillo 6261: "#components.optional">8.5. Optional
1.27 rillig 6262: files</a></span></dt>
1.25 rillig 6263:
1.38 dillo 6264: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6265: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6266: class="filename">work*</code></a></span></dt>
1.25 rillig 6267:
1.38 dillo 6268: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6269: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6270: class="filename">files/*</code></a></span></dt>
1.25 rillig 6271: </dl>
6272: </div>
6273:
1.27 rillig 6274: <p>Whenever you're preparing a package, there are a number
6275: of files involved which are described in the following
6276: sections.</p>
1.25 rillig 6277:
1.55 ! rillig 6278: <div class="sect1" lang="en" xml:lang="en">
1.25 rillig 6279: <div class="titlepage">
6280: <div>
6281: <div>
6282: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6283: "components.Makefile" id=
1.45 wiz 6284: "components.Makefile"></a>8.1. <code xmlns=
6285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6286: "filename">Makefile</code></h2>
1.25 rillig 6287: </div>
6288: </div>
6289: </div>
6290:
1.27 rillig 6291: <p>Building, installation and creation of a binary
1.45 wiz 6292: package are all controlled by the package's <code xmlns=
6293: "http://www.w3.org/TR/xhtml1/transitional" class=
6294: "filename">Makefile</code>. The <code xmlns=
6295: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6296: "filename">Makefile</code> describes various things about
6297: a package, for example from where to get it, how to
6298: configure, build, and install it.</p>
6299:
1.45 wiz 6300: <p>A package <code xmlns=
6301: "http://www.w3.org/TR/xhtml1/transitional" class=
6302: "filename">Makefile</code> contains several sections that
6303: describe the package.</p>
1.25 rillig 6304:
1.27 rillig 6305: <p>In the first section there are the following
6306: variables, which should appear exactly in the order given
6307: here.</p>
1.25 rillig 6308:
6309: <div class="itemizedlist">
6310: <ul type="disc">
6311: <li>
1.27 rillig 6312: <p><code class="varname">DISTNAME</code> is the
6313: basename of the distribution file to be downloaded
6314: from the package's website.</p>
6315: </li>
6316:
6317: <li>
6318: <p><code class="varname">PKGNAME</code> is the name
6319: of the package, as used by pkgsrc. You only need to
1.50 rillig 6320: provide it if it differs from <code class=
6321: "varname">DISTNAME</code>. Usually it is the
6322: directory name together with the version number. It
6323: must match the regular expression <code class=
1.27 rillig 6324: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6325: that is, it starts with a letter or digit, and
6326: contains only letters, digits, dashes, underscores,
6327: dots and plus signs.</p>
1.25 rillig 6328: </li>
6329:
6330: <li>
1.27 rillig 6331: <p><code class="varname">CATEGORIES</code> is a
6332: list of categories which the package fits in. You
6333: can choose any of the top-level directories of
6334: pkgsrc for it.</p>
1.45 wiz 6335:
6336: <p>Currently the following values are available for
6337: <code class="varname">CATEGORIES</code>. If more
6338: than one is used, they need to be separated by
6339: spaces:</p>
6340: <pre class="programlisting">
1.51 rillig 6341: archivers cross geography meta-pkgs security
6342: audio databases graphics misc shells
6343: benchmarks devel ham multimedia sysutils
6344: biology editors inputmethod net textproc
6345: cad emulators lang news time
6346: chat finance mail parallel wm
6347: comms fonts math pkgtools www
6348: converters games mbone print x11
1.45 wiz 6349: </pre>
1.25 rillig 6350: </li>
6351:
6352: <li>
1.27 rillig 6353: <p><code class="varname">MASTER_SITES</code> is a
6354: list of URLs where the distribution files can be
6355: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6356:
6357: <p>The <code class="varname">MASTER_SITES</code>
6358: may make use of the following predefined sites:</p>
6359: <pre class="programlisting">
1.51 rillig 6360: ${MASTER_SITE_APACHE}
6361: ${MASTER_SITE_BACKUP}
6362: ${MASTER_SITE_CYGWIN}
6363: ${MASTER_SITE_DEBIAN}
6364: ${MASTER_SITE_FREEBSD}
6365: ${MASTER_SITE_FREEBSD_LOCAL}
6366: ${MASTER_SITE_GNOME}
6367: ${MASTER_SITE_GNU}
6368: ${MASTER_SITE_GNUSTEP}
6369: ${MASTER_SITE_IFARCHIVE}
6370: ${MASTER_SITE_MOZILLA}
6371: ${MASTER_SITE_OPENOFFICE}
6372: ${MASTER_SITE_PERL_CPAN}
6373: ${MASTER_SITE_R_CRAN}
6374: ${MASTER_SITE_SOURCEFORGE}
6375: ${MASTER_SITE_SUNSITE}
6376: ${MASTER_SITE_SUSE}
6377: ${MASTER_SITE_TEX_CTAN}
6378: ${MASTER_SITE_XCONTRIB}
6379: ${MASTER_SITE_XEMACS}
1.45 wiz 6380: </pre>
6381:
6382: <p>If one of these predefined sites is chosen, you
6383: may want to specify a subdirectory of that site.
6384: Since these macros may expand to more than one
6385: actual site, you <span class=
6386: "emphasis"><em>must</em></span> use the following
6387: construct to specify a subdirectory:</p>
6388: <pre class="programlisting">
1.51 rillig 6389: ${MASTER_SITE_GNU:=subdirectory/name/}
6390: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6391: </pre>
6392:
6393: <p>Note the trailing slash after the subdirectory
6394: name.</p>
6395:
6396: <p>If the package has multiple <code class=
6397: "varname">DISTFILES</code> or multiple <code class=
6398: "varname">PATCHFILES</code> from different sites,
6399: set <code class="varname">SITES_foo</code> to a
1.47 reed 6400: list of URIs where file “<span class=
1.45 wiz 6401: "quote">foo</span>” may be found.
6402: “<span class="quote">foo</span>”
1.47 reed 6403: includes the suffix, e.g.:</p>
1.45 wiz 6404: <pre class="programlisting">
1.51 rillig 6405: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6406: DISTFILES+= foo-file.tar.gz
6407: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6408: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6409: </pre>
6410: </li>
6411:
6412: <li>
6413: <p><code class="varname">DISTFILES</code>: Name(s)
6414: of archive file(s) containing distribution. The
6415: default is <code xmlns=
6416: "http://www.w3.org/TR/xhtml1/transitional" class=
6417: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6418: Should only be set if you have more than one
6419: distfile.</p>
6420:
6421: <p>Note that the normal default setting of
6422: <code class="varname">DISTFILES</code> must be made
6423: explicit if you want to add to it (rather than
6424: replace it), as you usually would.</p>
6425: </li>
6426:
6427: <li>
6428: <p><code class="varname">EXTRACT_SUFX</code>:
6429: Suffix of the distribution file, will be appended
6430: to <code class="varname">DISTNAME</code>. Defaults
6431: to <code xmlns=
6432: "http://www.w3.org/TR/xhtml1/transitional" class=
6433: "filename">.tar.gz</code>.</p>
6434: </li>
6435: </ul>
6436: </div>
6437:
6438: <p>The second section contains information about
6439: separately downloaded patches, if any.</p>
6440:
6441: <div class="itemizedlist">
6442: <ul type="disc">
6443: <li>
1.47 reed 6444: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6445: of additional files that contain distribution
6446: patches. There is no default. pkgsrc will look for
6447: them at <code class="varname">PATCH_SITES</code>.
6448: They will automatically be uncompressed before
6449: patching if the names end with <code xmlns=
6450: "http://www.w3.org/TR/xhtml1/transitional" class=
6451: "filename">.gz</code> or <code xmlns=
6452: "http://www.w3.org/TR/xhtml1/transitional" class=
6453: "filename">.Z</code>.</p>
6454: </li>
6455:
6456: <li>
6457: <p><code class="varname">PATCH_SITES</code>:
6458: Primary location(s) for distribution patch files
6459: (see <code class="varname">PATCHFILES</code> below)
6460: if not found locally.</p>
1.25 rillig 6461: </li>
6462: </ul>
6463: </div>
6464:
1.45 wiz 6465: <p>The third section contains the following
1.27 rillig 6466: variables.</p>
1.25 rillig 6467:
1.27 rillig 6468: <div class="itemizedlist">
6469: <ul type="disc">
6470: <li>
6471: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6472: email address of the person who feels responsible
6473: for this package, and who is most likely to look at
6474: problems or questions regarding this package which
6475: have been reported with <a href=
1.45 wiz 6476: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6477: <span class="citerefentry"><span class=
1.50 rillig 6478: "refentrytitle">send-pr</span>(1)</span></a>. Other
6479: developers should contact the <code class=
6480: "varname">MAINTAINER</code> before making major
6481: changes to the package. When packaging a new
6482: program, set <code class=
6483: "varname">MAINTAINER</code> to yourself. If you
6484: really can't maintain the package for future
6485: updates, set it to <code class="email"><<a href=
1.45 wiz 6486: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6487: </li>
1.25 rillig 6488:
1.27 rillig 6489: <li>
6490: <p><code class="varname">HOMEPAGE</code> is a URL
6491: where users can find more information about the
1.23 wiz 6492: package.</p>
6493: </li>
1.1 grant 6494:
1.23 wiz 6495: <li>
6496: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6497: one-line description of the package (should not
6498: include the package name).</p>
1.23 wiz 6499: </li>
6500: </ul>
6501: </div>
1.1 grant 6502:
1.45 wiz 6503: <p>Other variables that affect the build:</p>
1.1 grant 6504:
1.45 wiz 6505: <div class="itemizedlist">
6506: <ul type="disc">
6507: <li>
6508: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6509: directory where the interesting distribution files
6510: of the package are found. The default is
6511: <code xmlns=
6512: "http://www.w3.org/TR/xhtml1/transitional" class=
6513: "filename">${WRKDIR}/${DISTNAME}</code>, which
6514: works for most packages.</p>
6515:
6516: <p>If a package doesn't create a subdirectory for
6517: itself (most GNU software does, for instance), but
6518: extracts itself in the current directory, you
6519: should set <code class="varname">WRKSRC=
6520: ${WRKDIR}</code>.</p>
6521:
6522: <p>If a package doesn't create a subdirectory with
6523: the name of <code class="varname">DISTNAME</code>
6524: but some different name, set <code class=
6525: "varname">WRKSRC</code> to point to the proper name
6526: in <code xmlns=
6527: "http://www.w3.org/TR/xhtml1/transitional" class=
6528: "filename">${WRKDIR}</code>, for example
6529: <code class="varname">WRKSRC=
6530: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6531: "http://www.w3.org/TR/xhtml1/transitional" href=
6532: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6533: target="_top"><code xmlns="" class=
6534: "filename">lang/tcl</code></a> and <a xmlns=
6535: "http://www.w3.org/TR/xhtml1/transitional" href=
6536: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6537: target="_top"><code xmlns="" class=
6538: "filename">x11/tk</code></a> for other
6539: examples.</p>
6540:
6541: <p>The name of the working directory created by
6542: pkgsrc is taken from the <code class=
6543: "varname">WRKDIR_BASENAME</code> variable. By
6544: default, its value is <code xmlns=
6545: "http://www.w3.org/TR/xhtml1/transitional" class=
6546: "filename">work</code>. If you want to use the same
6547: pkgsrc tree for building different kinds of binary
6548: packages, you can change the variable according to
6549: your needs. Two other variables handle common cases
6550: of setting <code class=
6551: "varname">WRKDIR_BASENAME</code> individually. If
6552: <code class="varname">OBJHOSTNAME</code> is defined
6553: in <code xmlns=
1.45 wiz 6554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6555: "filename">/etc/mk.conf</code>, the first component
6556: of the host's name is attached to the directory
6557: name. If <code class="varname">OBJMACHINE</code> is
6558: defined, the platform name is attached, which might
6559: look like <code xmlns=
6560: "http://www.w3.org/TR/xhtml1/transitional" class=
6561: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6562: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6563: "filename">work.sparc</code>.</p>
1.45 wiz 6564: </li>
6565: </ul>
1.1 grant 6566: </div>
6567:
6568: <p>Please pay attention to the following gotchas:</p>
6569:
6570: <div class="itemizedlist">
6571: <ul type="disc">
6572: <li>
1.14 xtraeme 6573: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6574: if man pages are installed in compressed form by
6575: the package; see comment in <code xmlns=
1.45 wiz 6576: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6577: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6578: </li>
6579:
6580: <li>
1.45 wiz 6581: <p>Replace <code xmlns=
6582: "http://www.w3.org/TR/xhtml1/transitional" class=
6583: "filename">/usr/local</code> with
6584: “<span class="quote">${PREFIX}</span>”
6585: in all files (see patches, below).</p>
1.1 grant 6586: </li>
6587:
6588: <li>
6589: <p>If the package installs any info files, see
6590: <a href="#faq.info-files" title=
1.45 wiz 6591: "15.5.7. Packages installing info files">Section 15.5.7,
6592: “Packages installing info
1.1 grant 6593: files”</a>.</p>
6594: </li>
6595: </ul>
6596: </div>
6597: </div>
6598:
1.55 ! rillig 6599: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6600: <div class="titlepage">
6601: <div>
6602: <div>
6603: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6604: "components.distinfo" id=
1.45 wiz 6605: "components.distinfo"></a>8.2. <code xmlns=
6606: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6607: "filename">distinfo</code></h2>
1.1 grant 6608: </div>
6609: </div>
6610: </div>
6611:
1.50 rillig 6612: <p>The <code xmlns=
6613: "http://www.w3.org/TR/xhtml1/transitional" class=
6614: "filename">distinfo</code> file contains the message
6615: digest, or checksum, of each distfile needed for the
6616: package. This ensures that the distfiles retrieved from
6617: the Internet have not been corrupted during transfer or
6618: altered by a malign force to introduce a security hole.
6619: Due to recent rumor about weaknesses of digest
6620: algorithms, all distfiles are protected using both SHA1
6621: and RMD160 message digests, as well as the file size.</p>
6622:
6623: <p>The <code xmlns=
6624: "http://www.w3.org/TR/xhtml1/transitional" class=
6625: "filename">distinfo</code> file also contains the
6626: checksums for all the patches found in the <code xmlns=
6627: "http://www.w3.org/TR/xhtml1/transitional" class=
6628: "filename">patches</code> directory (see <a href=
6629: "#components.patches" title=
6630: "8.3. patches/*">Section 8.3,
6631: “patches/*”</a>).</p>
6632:
6633: <p>To regenerate the <code xmlns=
6634: "http://www.w3.org/TR/xhtml1/transitional" class=
6635: "filename">distinfo</code> file, use the
1.14 xtraeme 6636: <span><strong class="command">make
1.50 rillig 6637: makedistinfo</strong></span> or <span><strong class=
6638: "command">make mdi</strong></span> command.</p>
1.1 grant 6639:
1.50 rillig 6640: <p>Some packages have different sets of distfiles
6641: depending on the platform, for example <a xmlns=
1.1 grant 6642: "http://www.w3.org/TR/xhtml1/transitional" href=
6643: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6644: target="_top"><code xmlns="" class=
6645: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6646: the same <code xmlns=
1.45 wiz 6647: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6648: "filename">distinfo</code> file and care should be taken
6649: when upgrading such a package to ensure distfile
6650: information is not lost.</p>
1.1 grant 6651: </div>
6652:
1.55 ! rillig 6653: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6654: <div class="titlepage">
6655: <div>
6656: <div>
6657: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6658: "components.patches" id=
1.38 dillo 6659: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6660: </div>
6661: </div>
6662: </div>
6663:
6664: <p>This directory contains files that are used by the
6665: <a href=
6666: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6667: <span class="citerefentry"><span class=
6668: "refentrytitle">patch</span>(1)</span></a> command to
6669: modify the sources as distributed in the distribution
6670: file into a form that will compile and run perfectly on
6671: NetBSD. The files are applied successively in alphabetic
6672: order (as returned by a shell “<span class=
6673: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6674: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6675: class="filename">patch-aa</code> is applied before
6676: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6677: class="filename">patch-ab</code>, etc.</p>
6678:
6679: <p>The <code xmlns=
6680: "http://www.w3.org/TR/xhtml1/transitional" class=
6681: "filename">patch-*</code> files should be in
6682: <span><strong class="command">diff -bu</strong></span>
6683: format, and apply without a fuzz to avoid problems. (To
6684: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6685: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6686: not put changes for more than one file into a single
1.47 reed 6687: patch file, as this will make future modifications more
1.1 grant 6688: difficult.</p>
6689:
6690: <p>Similar, a file should be patched at most once, not
6691: several times by several different patches. If a file
6692: needs several patches, they should be combined into one
6693: file.</p>
6694:
6695: <p>One important thing to mention is to pay attention
6696: that no RCS IDs get stored in the patch files, as these
6697: will cause problems when later checked into the NetBSD
1.14 xtraeme 6698: CVS tree. Use the <span><strong class=
6699: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6700: "http://www.w3.org/TR/xhtml1/transitional" href=
6701: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6702: target="_top"><code xmlns="" class=
6703: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6704: these problems.</p>
1.1 grant 6705:
6706: <p>For even more automation, we recommend using
1.14 xtraeme 6707: <span><strong class="command">mkpatches</strong></span>
6708: from the same package to make a whole set of patches. You
6709: just have to backup files before you edit them to
1.45 wiz 6710: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6711: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6712: <span><strong class="command">cp -p filename
6713: filename.orig</strong></span> or, easier, by using
6714: <span><strong class="command">pkgvi</strong></span> again
6715: from the same package. If you upgrade a package this way,
6716: you can easily compare the new set of patches with the
6717: previously existing one with <span><strong class=
6718: "command">patchdiff</strong></span>.</p>
1.1 grant 6719:
6720: <p>When you have finished a package, remember to generate
6721: the checksums for the patch files by using the
1.14 xtraeme 6722: <span><strong class="command">make
6723: makepatchsum</strong></span> command, see <a href=
6724: "#components.distinfo" title=
1.38 dillo 6725: "8.2. distinfo">Section 8.2,
1.45 wiz 6726: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6727: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6728:
1.46 gdt 6729: <p>When adding a patch that corrects a problem in the
6730: distfile (rather than e.g. enforcing pkgsrc's view of
6731: where man pages should go), send the patch as a bug
6732: report to the maintainer. This benefits non-pkgsrc users
6733: of the package, and usually enables removing the patch in
6734: future version.</p>
6735:
1.1 grant 6736: <p>Patch files that are distributed by the author or
1.14 xtraeme 6737: other maintainers can be listed in <code class=
6738: "varname">$PATCHFILES</code>.</p>
1.1 grant 6739:
6740: <p>If it is desired to store any patches that should not
6741: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6742: pkgsrc tree in the <code xmlns=
6743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6744: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6745: tree there is expected to have the same
6746: “<span class="quote">category/package</span>”
6747: structure as pkgsrc, and patches are expected to be
1.45 wiz 6748: stored inside these dirs (also known as <code xmlns=
6749: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6750: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
6751: if you want to keep a private patch for <code xmlns=
1.45 wiz 6752: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6753: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6754: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6755: class=
1.14 xtraeme 6756: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6757: files in the named directory are expected to be patch
1.1 grant 6758: files, and <span class="emphasis"><em>they are applied
6759: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6760: </div>
6761:
1.55 ! rillig 6762: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6763: <div class="titlepage">
6764: <div>
6765: <div>
6766: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6767: "other-mandatory-files" id=
1.38 dillo 6768: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6769: mandatory files</h2>
6770: </div>
6771: </div>
6772: </div>
6773:
6774: <div class="variablelist">
6775: <dl>
1.45 wiz 6776: <dt><span class="term"><code xmlns=
6777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6778: "filename">DESCR</code></span></dt>
6779:
6780: <dd>
6781: <p>A multi-line description of the piece of
6782: software. This should include any credits where
6783: they are due. Please bear in mind that others do
6784: not share your sense of humour (or spelling
6785: idiosyncrasies), and that others will read
6786: everything that you write here.</p>
6787: </dd>
6788:
1.45 wiz 6789: <dt><span class="term"><code xmlns=
6790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6791: "filename">PLIST</code></span></dt>
6792:
6793: <dd>
6794: <p>This file governs the files that are installed
6795: on your system: all the binaries, manual pages,
6796: etc. There are other directives which may be
6797: entered in this file, to control the creation and
6798: deletion of directories, and the location of
6799: inserted files. See <a href="#plist" title=
1.38 dillo 6800: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6801: <i>PLIST issues</i></a> for more information.</p>
6802: </dd>
6803: </dl>
6804: </div>
6805: </div>
6806:
1.55 ! rillig 6807: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6808: <div class="titlepage">
6809: <div>
6810: <div>
6811: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6812: "components.optional" id=
1.38 dillo 6813: "components.optional"></a>8.5. Optional
1.27 rillig 6814: files</h2>
6815: </div>
6816: </div>
6817: </div>
6818:
6819: <div class="variablelist">
6820: <dl>
1.45 wiz 6821: <dt><span class="term"><code xmlns=
6822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6823: "filename">INSTALL</code></span></dt>
6824:
6825: <dd>
6826: <p>This shell script is invoked twice by <a href=
6827: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6828: <span class="citerefentry"><span class=
6829: "refentrytitle">pkg_add</span>(1)</span></a>. First
6830: time after package extraction and before files are
6831: moved in place, the second time after the files to
6832: install are moved in place. This can be used to do
6833: any custom procedures not possible with @exec
1.45 wiz 6834: commands in <code xmlns=
6835: "http://www.w3.org/TR/xhtml1/transitional" class=
6836: "filename">PLIST</code>. See <a href=
1.27 rillig 6837: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6838: <span class="citerefentry"><span class=
6839: "refentrytitle">pkg_add</span>(1)</span></a> and
6840: <a href=
6841: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6842: <span class="citerefentry"><span class=
6843: "refentrytitle">pkg_create</span>(1)</span></a> for
6844: more information.</p>
6845: </dd>
6846:
1.45 wiz 6847: <dt><span class="term"><code xmlns=
6848: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6849: "filename">DEINSTALL</code></span></dt>
6850:
6851: <dd>
6852: <p>This script is executed before and after any
6853: files are removed. It is this script's
6854: responsibility to clean up any additional messy
6855: details around the package's installation, since
6856: all pkg_delete knows is how to delete the files
6857: created in the original distribution. See <a href=
6858: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6859: <span class="citerefentry"><span class=
6860: "refentrytitle">pkg_delete</span>(1)</span></a> and
6861: <a href=
6862: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6863: <span class="citerefentry"><span class=
6864: "refentrytitle">pkg_create</span>(1)</span></a> for
6865: more information.</p>
6866: </dd>
6867:
1.45 wiz 6868: <dt><span class="term"><code xmlns=
6869: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6870: "filename">MESSAGE</code></span></dt>
6871:
6872: <dd>
1.50 rillig 6873: <p>This file is displayed after installation of the
1.27 rillig 6874: package. Useful for things like legal notices on
6875: almost-free software and hints for updating config
6876: files after installing modules for apache, PHP etc.
6877: Please note that you can modify variables in it
6878: easily by using <code class=
6879: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 6880: <code xmlns=
6881: "http://www.w3.org/TR/xhtml1/transitional" class=
6882: "filename">Makefile</code>:</p>
1.27 rillig 6883: <pre class="programlisting">
1.51 rillig 6884: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 6885: </pre>
6886:
6887: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 6888: "quote">somevalue</span>” in <code xmlns=
6889: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6890: "filename">MESSAGE</code>.</p>
6891: </dd>
6892: </dl>
6893: </div>
6894: </div>
6895:
1.55 ! rillig 6896: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6897: <div class="titlepage">
6898: <div>
6899: <div>
6900: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6901: "work-dir" id="work-dir"></a>8.6. <code xmlns=
1.45 wiz 6902: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6903: "filename">work*</code></h2>
6904: </div>
6905: </div>
6906: </div>
6907:
6908: <p>When you type <span><strong class=
1.47 reed 6909: "command">make</strong></span>, the distribution files
6910: are unpacked into the directory denoted by <code class=
1.45 wiz 6911: "varname">WRKDIR</code>. It can be removed by running
6912: <span><strong class="command">make clean</strong></span>.
6913: Besides the sources, this directory is also used to keep
6914: various timestamp files. The directory gets <span class=
6915: "emphasis"><em>removed completely</em></span> on clean.
6916: The default is <code xmlns=
6917: "http://www.w3.org/TR/xhtml1/transitional" class=
6918: "filename">${.CURDIR}/work</code> or <code xmlns=
6919: "http://www.w3.org/TR/xhtml1/transitional" class=
6920: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
6921: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 6922: </div>
6923:
1.55 ! rillig 6924: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6925: <div class="titlepage">
6926: <div>
6927: <div>
6928: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 6929: "files-dir" id=
1.45 wiz 6930: "files-dir"></a>8.7. <code xmlns=
6931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6932: "filename">files/*</code></h2>
6933: </div>
6934: </div>
6935: </div>
6936:
6937: <p>If you have any files that you wish to be placed in
6938: the package prior to configuration or building, you could
6939: place these files here and use a “<span class=
6940: "quote">${CP}</span>” command in the
6941: “<span class="quote">pre-configure</span>”
6942: target to achieve this. Alternatively, you could simply
1.45 wiz 6943: diff the file against <code xmlns=
6944: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6945: "filename">/dev/null</code> and use the patch mechanism
6946: to manage the creation of this file.</p>
6947: </div>
6948: </div>
6949:
1.55 ! rillig 6950: <div class="chapter" lang="en" xml:lang="en">
1.27 rillig 6951: <div class="titlepage">
6952: <div>
6953: <div>
1.55 ! rillig 6954: <h2 class="title"><a name="makefile" id=
1.38 dillo 6955: "makefile"></a>Chapter 9. Programming in
1.45 wiz 6956: <code xmlns=
6957: "http://www.w3.org/TR/xhtml1/transitional" class=
6958: "filename">Makefile</code>s</h2>
1.27 rillig 6959: </div>
6960: </div>
6961: </div>
6962:
6963: <div class="toc">
6964: <p><b>Table of Contents</b></p>
6965:
6966: <dl>
6967: <dt><span class="sect1"><a href=
1.45 wiz 6968: "#makefile.variables">9.1. <code xmlns=
6969: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6970: "filename">Makefile</code> variables</a></span></dt>
6971:
6972: <dd>
6973: <dl>
6974: <dt><span class="sect2"><a href=
1.38 dillo 6975: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6976: conventions</a></span></dt>
6977: </dl>
6978: </dd>
6979:
1.38 dillo 6980: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6981: Code snippets</a></span></dt>
6982:
6983: <dd>
6984: <dl>
1.30 wiz 6985: <dt><span class="sect2"><a href=
1.38 dillo 6986: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6987: list</a></span></dt>
1.27 rillig 6988:
1.30 wiz 6989: <dt><span class="sect2"><a href=
1.38 dillo 6990: "#converting-internal-to-external">9.2.2.
1.27 rillig 6991: Converting an internal list into an external
6992: list</a></span></dt>
6993:
1.30 wiz 6994: <dt><span class="sect2"><a href=
1.38 dillo 6995: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6996: variables to a shell command</a></span></dt>
1.27 rillig 6997:
1.30 wiz 6998: <dt><span class="sect2"><a href=
1.38 dillo 6999: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7000: guideline</a></span></dt>
1.27 rillig 7001:
1.30 wiz 7002: <dt><span class="sect2"><a href=
1.38 dillo 7003: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7004: bug in BSD Make</a></span></dt>
1.27 rillig 7005: </dl>
7006: </dd>
7007: </dl>
7008: </div>
7009:
1.45 wiz 7010: <p>Pkgsrc consists of many <code xmlns=
7011: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7012: "filename">Makefile</code> fragments, each of which forms a
7013: well-defined part of the pkgsrc system. Using the <a href=
7014: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7015: <span class="citerefentry"><span class=
7016: "refentrytitle">make</span>(1)</span></a> system as a
7017: programming language for a big system like pkgsrc requires
7018: some discipline to keep the code correct and
7019: understandable.</p>
7020:
1.45 wiz 7021: <p>The basic ingredients for <code xmlns=
7022: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7023: "filename">Makefile</code> programming are variables (which
7024: are actually macros) and shell commands. Among these shell
7025: commands may even be more complex ones like <a href=
7026: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7027: <span class="citerefentry"><span class=
7028: "refentrytitle">awk</span>(1)</span></a> programs. To make
7029: sure that every shell command runs as intended it is
7030: necessary to quote all variables correctly when they are
7031: used.</p>
7032:
7033: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7034: often in <code xmlns=
7035: "http://www.w3.org/TR/xhtml1/transitional" class=
7036: "filename">Makefile</code>s, including the pitfalls that
7037: come along with them.</p>
1.27 rillig 7038:
1.55 ! rillig 7039: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7040: <div class="titlepage">
7041: <div>
7042: <div>
7043: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7044: "makefile.variables" id=
1.45 wiz 7045: "makefile.variables"></a>9.1. <code xmlns=
7046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7047: "filename">Makefile</code> variables</h2>
7048: </div>
7049: </div>
7050: </div>
7051:
1.45 wiz 7052: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7053: class="filename">Makefile</code> variables contain
7054: strings that can be processed using the five operators
7055: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7056: described in the <a href=
1.27 rillig 7057: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7058: <span class="citerefentry"><span class=
7059: "refentrytitle">make</span>(1)</span></a> man page.</p>
7060:
1.45 wiz 7061: <p>When a variable's value is parsed from a <code xmlns=
7062: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7063: "filename">Makefile</code>, the hash character ``#'' and
7064: the backslash character ``\'' are handled specially. If a
7065: backslash is followed by a newline, any whitespace
7066: immediately in front of the backslash, the backslash, the
7067: newline, and any whitespace immediately behind the
7068: newline are replaced with a single space. A backspace
7069: character and an immediately following hash character are
1.47 reed 7070: replaced with a single hash character. Otherwise, the
1.27 rillig 7071: backslash is passed as is. In a variable assignment, any
7072: hash character that is not preceded by a backslash starts
7073: a comment that continues upto the end of the logical
7074: line.</p>
7075:
7076: <p><span class="emphasis"><em>Note:</em></span> Because
7077: of this parsing algorithm the only way to create a
7078: variable consisting of a single backslash is using the
7079: ``!='' operator, for example: <code class=
7080: "varname">BACKSLASH!=echo "\\"</code>.</p>
7081:
7082: <p>So far for defining variables. The other thing you can
7083: do with variables is evaluating them. A variable is
7084: evaluated when it is part of the right side of the ``:=''
7085: or the ``!='' operator, or directly before executing a
7086: shell command which the variable is part of. In all other
1.47 reed 7087: cases, <a href=
1.27 rillig 7088: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7089: <span class="citerefentry"><span class=
7090: "refentrytitle">make</span>(1)</span></a> performs lazy
7091: evaluation, that is, variables are not evaluated until
7092: there's no other way. The ``modifiers'' mentioned in the
7093: man page also evaluate the variable.</p>
7094:
7095: <p>Some of the modifiers split the string into words and
7096: then operate on the words, others operate on the string
1.47 reed 7097: as a whole. When a string is split into words, it is
7098: split as you would expect it from <a href=
1.27 rillig 7099: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7100: <span class="citerefentry"><span class=
7101: "refentrytitle">sh</span>(1)</span></a>.</p>
7102:
7103: <p>No rule without exception—the
7104: <span><strong class="command">.for</strong></span> loop
7105: does not follow the shell quoting rules but splits at
7106: sequences of whitespace.</p>
7107:
7108: <p>There are several types of variables that should be
7109: handled differently. Strings and two types of lists.</p>
7110:
7111: <div class="itemizedlist">
7112: <ul type="disc">
7113: <li>
7114: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7115: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7116: should restrict yourself to only using printable
7117: characters. Examples are <code class=
7118: "varname">PREFIX</code> and <code class=
7119: "varname">COMMENT</code>.</p>
7120: </li>
7121:
7122: <li>
7123: <p><span class="emphasis"><em>Internal
7124: lists</em></span> are lists that are never exported
7125: to any shell command. Their elements are separated
1.47 reed 7126: by whitespace. Therefore, the elements themselves
1.27 rillig 7127: cannot have embedded whitespace. Any other
7128: characters are allowed. Internal lists can be used
7129: in <span><strong class=
7130: "command">.for</strong></span> loops. Examples are
7131: <code class="varname">DEPENDS</code> and
7132: <code class="varname">BUILD_DEPENDS</code>.</p>
7133: </li>
7134:
7135: <li>
7136: <p><span class="emphasis"><em>External
7137: lists</em></span> are lists that may be exported to
7138: a shell command. Their elements can contain any
7139: characters, including whitespace. That's why they
7140: cannot be used in <span><strong class=
7141: "command">.for</strong></span> loops. Examples are
7142: <code class="varname">DISTFILES</code> and
7143: <code class="varname">MASTER_SITES</code>.</p>
7144: </li>
7145: </ul>
7146: </div>
7147:
1.55 ! rillig 7148: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7149: <div class="titlepage">
7150: <div>
7151: <div>
7152: <h3 class="title"><a name=
1.55 ! rillig 7153: "makefile.variables.names" id=
1.38 dillo 7154: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7155: conventions</h3>
7156: </div>
7157: </div>
7158: </div>
7159:
7160: <div class="itemizedlist">
7161: <ul type="disc">
7162: <li>
7163: <p>All variable names starting with an underscore
7164: are reserved for use by the pkgsrc
7165: infrastructure. They shall not be used by package
1.45 wiz 7166: <code xmlns=
7167: "http://www.w3.org/TR/xhtml1/transitional" class=
7168: "filename">Makefile</code>s.</p>
1.27 rillig 7169: </li>
7170:
7171: <li>
7172: <p>In <span><strong class=
7173: "command">.for</strong></span> loops you should
7174: use lowercase variable names for the iteration
7175: variables.</p>
7176: </li>
7177:
7178: <li>
7179: <p>All list variables should have a ``plural''
7180: name, e.g. <code class=
7181: "varname">PKG_OPTIONS</code> or <code class=
7182: "varname">DISTFILES</code>.</p>
7183: </li>
7184: </ul>
7185: </div>
7186: </div>
7187: </div>
7188:
1.55 ! rillig 7189: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7190: <div class="titlepage">
7191: <div>
7192: <div>
7193: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7194: "makefile.code" id=
1.38 dillo 7195: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7196: </div>
7197: </div>
7198: </div>
7199:
7200: <p>This section presents you with some code snippets you
7201: should use in your own code. If you don't find anything
7202: appropriate here, you should test your code and add it
7203: here.</p>
7204:
1.55 ! rillig 7205: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7206: <div class="titlepage">
7207: <div>
7208: <div>
1.55 ! rillig 7209: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7210: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7211: a list</h3>
1.27 rillig 7212: </div>
7213: </div>
7214: </div>
7215: <pre class="programlisting">
1.51 rillig 7216: STRING= foo * bar `date`
7217: INT_LIST= # empty
7218: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7219: EXT_LIST= # empty
7220: ANOTHER_EXT_LIST= a=b c=d
7221:
7222: INT_LIST+= ${STRING} # 1
7223: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7224: EXT_LIST+= ${STRING:Q} # 3
7225: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7226: </pre>
7227:
7228: <p>When you add a string to an external list (example
7229: 3), it must be quoted. In all other cases, you must not
7230: add a quoting level. You must not merge internal and
7231: external lists, unless you are sure that all entries
7232: are correctly interpreted in both lists.</p>
7233: </div>
7234:
1.55 ! rillig 7235: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7236: <div class="titlepage">
7237: <div>
7238: <div>
1.30 wiz 7239: <h3 class="title"><a name=
1.55 ! rillig 7240: "converting-internal-to-external" id=
1.38 dillo 7241: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7242: an internal list into an external list</h3>
1.27 rillig 7243: </div>
7244: </div>
7245: </div>
7246: <pre class="programlisting">
1.51 rillig 7247: EXT_LIST= # empty
7248: .for i in ${INT_LIST}
7249: EXT_LIST+= ${i:Q}""
7250: .endfor
1.27 rillig 7251: </pre>
7252:
7253: <p>This code converts the internal list <code class=
7254: "varname">INT_LIST</code> into the external list
7255: <code class="varname">EXT_LIST</code>. As the elements
7256: of an internal list are unquoted they must be quoted
7257: here. The reason for appending <code class=
7258: "varname">""</code> is explained below.</p>
7259: </div>
1.1 grant 7260:
1.55 ! rillig 7261: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7262: <div class="titlepage">
1.1 grant 7263: <div>
1.27 rillig 7264: <div>
1.30 wiz 7265: <h3 class="title"><a name=
1.55 ! rillig 7266: "passing-variable-to-shell" id=
1.38 dillo 7267: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7268: variables to a shell command</h3>
1.27 rillig 7269: </div>
1.1 grant 7270: </div>
7271: </div>
1.27 rillig 7272: <pre class="programlisting">
1.51 rillig 7273: STRING= foo bar < > * `date` $$HOME ' "
7274: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7275:
1.51 rillig 7276: all:
7277: echo ${STRING} # 1
7278: echo "${STRING}" # 2
7279: echo "${STRING:Q}" # 3
7280: echo ${STRING:Q} # 4
7281: echo x${STRING:Q} | sed 1s,.,, # 5
7282: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7283: </pre>
7284:
7285: <p>Example 1 leads to a syntax error in the shell, as
7286: the characters are just copied.</p>
7287:
7288: <p>Example 2 leads to a syntax error too, and if you
7289: leave out the last " character from <code class=
7290: "varname">${STRING}</code>, <a href=
7291: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7292: <span class="citerefentry"><span class=
7293: "refentrytitle">date</span>(1)</span></a> will be
7294: executed. The <code class="varname">$HOME</code> shell
7295: variable would be evaluated, too.</p>
7296:
7297: <p>Example 3 outputs each space character preceded by a
7298: backslash (or not), depending on the implementation of
7299: the <a href=
7300: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7301: <span class="citerefentry"><span class=
7302: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7303:
1.27 rillig 7304: <p>Example 4 handles correctly every string that does
7305: not start with a dash. In that case, the result depends
7306: on the implementation of the <a href=
7307: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7308: <span class="citerefentry"><span class=
7309: "refentrytitle">echo</span>(1)</span></a> command. As
7310: long as you can guarantee that your input does not
1.47 reed 7311: start with a dash, this form is appropriate.</p>
1.1 grant 7312:
1.27 rillig 7313: <p>Example 5 handles even the case of a leading dash
7314: correctly.</p>
1.1 grant 7315:
1.27 rillig 7316: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7317: need to be quoted because the quoting has already been
1.27 rillig 7318: done when adding elements to the list.</p>
1.1 grant 7319:
1.27 rillig 7320: <p>As internal lists shall not be passed to the shell,
7321: there is no example for it.</p>
1.1 grant 7322: </div>
7323:
1.55 ! rillig 7324: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7325: <div class="titlepage">
1.1 grant 7326: <div>
1.27 rillig 7327: <div>
1.55 ! rillig 7328: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7329: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7330: guideline</h3>
7331: </div>
1.1 grant 7332: </div>
7333: </div>
7334:
1.27 rillig 7335: <p>There are many possible sources of wrongly quoted
7336: variables. This section lists some of the commonly
7337: known ones.</p>
1.1 grant 7338:
1.27 rillig 7339: <div class="itemizedlist">
7340: <ul type="disc">
7341: <li>
7342: <p>Whenever you use the value of a list, think
7343: about what happens to leading or trailing
7344: whitespace. If the list is a well-formed shell
1.47 reed 7345: expression, you can apply the <code class=
1.27 rillig 7346: "varname">:M*</code> modifier to strip leading
7347: and trailing whitespace from each word. The
7348: <code class="varname">:M</code> operator first
7349: splits its argument according to the rules of the
7350: shell, and then creates a new list consisting of
7351: all words that match the shell glob expression
7352: <code class="varname">*</code>, that is: all. One
7353: class of situations where this is needed is when
7354: adding a variable like <code class=
7355: "varname">CPPFLAGS</code> to <code class=
7356: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7357: script invokes other configure scripts, it strips
1.27 rillig 7358: the leading and trailing whitespace from the
7359: variable and then passes it to the other
7360: configure scripts. But these configure scripts
7361: expect the (child) <code class=
7362: "varname">CPPFLAGS</code> variable to be the same
7363: as the parent <code class=
7364: "varname">CPPFLAGS</code>. That's why we better
7365: pass the <code class="varname">CPPFLAGS</code>
7366: value properly trimmed. And here is how we do
7367: it:</p>
7368: <pre class="programlisting">
1.51 rillig 7369: CPPFLAGS= # empty
7370: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7371: CPPFLAGS+= ${MY_CPPFLAGS}
7372:
7373: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7374:
7375: all:
7376: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7377: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7378: </pre>
7379: </li>
1.1 grant 7380:
1.27 rillig 7381: <li>
7382: <p>The example above contains one bug: The
7383: <code class="varname">${PREFIX}</code> is a
7384: properly quoted shell expression, but there is
7385: the C compiler after it, which also expects a
7386: properly quoted string (this time in C syntax).
7387: The version above is therefore only correct if
7388: <code class="varname">${PREFIX}</code> does not
7389: have embedded backslashes or double quotes. If
7390: you want to allow these, you have to add another
7391: layer of quoting to each variable that is used as
7392: a C string literal. You cannot use the
7393: <code class="varname">:Q</code> operator for it,
7394: as this operator only works for the shell.</p>
7395: </li>
1.1 grant 7396:
1.27 rillig 7397: <li>
1.47 reed 7398: <p>Whenever a variable can be empty, the
1.27 rillig 7399: <code class="varname">:Q</code> operator can have
7400: surprising results. Here are two completely
7401: different cases which can be solved with the same
7402: trick.</p>
7403: <pre class="programlisting">
1.51 rillig 7404: EMPTY= # empty
7405: empty_test:
7406: for i in a ${EMPTY:Q} c; do \
7407: echo "$$i"; \
7408: done
7409:
7410: for_test:
7411: .for i in a:\ a:\test.txt
7412: echo ${i:Q}
7413: echo "foo"
7414: .endfor
1.1 grant 7415: </pre>
7416:
1.27 rillig 7417: <p>The first example will only print two of the
7418: three lines we might have expected. This is
7419: because <code class="varname">${EMPTY:Q}</code>
7420: expands to the empty string, which the shell
7421: cannot see. The workaround is to write
7422: <code class="varname">${EMPTY:Q}""</code>. This
7423: pattern can be often found as <code class=
7424: "varname">${TEST} -z ${VAR:Q}</code> or as
7425: <code class="varname">${TEST} -f
7426: ${FNAME:Q}</code> (both of these are wrong).</p>
7427:
7428: <p>The second example will only print three lines
7429: instead of four. The first line looks like
7430: <code class="varname">a:\ echo foo</code>. This
7431: is because the backslash of the value
7432: <code class="varname">a:\</code> is interpreted
7433: as a line-continuation by <a href=
7434: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7435: <span class="citerefentry"><span class=
7436: "refentrytitle">make</span>(1)</span></a>, which
7437: makes the second line the arguments of the
7438: <a href=
7439: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7440: <span class="citerefentry"><span class=
7441: "refentrytitle">echo</span>(1)</span></a> command
7442: from the first line. To avoid this, write
7443: <code class="varname">${i:Q}""</code>.</p>
7444: </li>
7445: </ul>
7446: </div>
1.1 grant 7447: </div>
7448:
1.55 ! rillig 7449: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7450: <div class="titlepage">
1.1 grant 7451: <div>
1.27 rillig 7452: <div>
1.30 wiz 7453: <h3 class="title"><a name=
1.55 ! rillig 7454: "bsd-make-bug-workaround" id=
1.38 dillo 7455: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7456: for a bug in BSD Make</h3>
1.27 rillig 7457: </div>
1.1 grant 7458: </div>
7459: </div>
7460:
1.27 rillig 7461: <p>The pkgsrc bmake program does not handle the
7462: following assignment correctly. In case <code class=
7463: "varname">_othervar_</code> contains a ``-'' character,
7464: one of the closing braces is included in <code class=
7465: "varname">${VAR}</code> after this code executes.</p>
7466: <pre class="programlisting">
1.51 rillig 7467: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7468: </pre>
7469:
1.27 rillig 7470: <p>For a more complex code snippet and a workaround,
7471: see the package <a xmlns=
7472: "http://www.w3.org/TR/xhtml1/transitional" href=
7473: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7474: target="_top"><code xmlns="" class=
7475: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7476: <code class="varname">bug1</code>.</p>
1.1 grant 7477: </div>
7478: </div>
7479: </div>
7480:
1.55 ! rillig 7481: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 7482: <div class="titlepage">
7483: <div>
7484: <div>
1.55 ! rillig 7485: <h2 class="title"><a name="plist" id=
1.38 dillo 7486: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7487: </div>
7488: </div>
7489: </div>
7490:
7491: <div class="toc">
7492: <p><b>Table of Contents</b></p>
7493:
7494: <dl>
1.38 dillo 7495: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7496: ID</a></span></dt>
7497:
1.30 wiz 7498: <dt><span class="sect1"><a href=
1.38 dillo 7499: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7500: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7501: class="filename">PLIST</code>
1.14 xtraeme 7502: generation</a></span></dt>
1.1 grant 7503:
1.38 dillo 7504: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7505: Tweaking output of <span><strong class="command">make
7506: print-PLIST</strong></span></a></span></dt>
1.1 grant 7507:
1.38 dillo 7508: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7509: Variable substitution in PLIST</a></span></dt>
7510:
1.30 wiz 7511: <dt><span class="sect1"><a href=
1.48 dillo 7512: "#manpage-compression">10.5. Man page
7513: compression</a></span></dt>
1.1 grant 7514:
1.38 dillo 7515: <dt><span class="sect1"><a href=
7516: "#using-PLIST_SRC">10.6. Changing PLIST source with
7517: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7518:
1.30 wiz 7519: <dt><span class="sect1"><a href=
1.47 reed 7520: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7521: differing PLISTs</a></span></dt>
1.1 grant 7522:
1.38 dillo 7523: <dt><span class="sect1"><a href=
7524: "#faq.common-dirs">10.8. Sharing directories between
7525: packages</a></span></dt>
1.1 grant 7526: </dl>
7527: </div>
7528:
1.45 wiz 7529: <p>The <code xmlns=
7530: "http://www.w3.org/TR/xhtml1/transitional" class=
7531: "filename">PLIST</code> file contains a package's
7532: “<span class="quote">packing list</span>”, i.e.
7533: a list of files that belong to the package (relative to the
7534: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7535: class="filename">${PREFIX}</code> directory it's been
7536: installed in) plus some additional statements - see the
7537: <a href=
1.1 grant 7538: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7539: <span class="citerefentry"><span class=
1.47 reed 7540: "refentrytitle">pkg_create</span>(1)</span></a> man page
7541: for a full list. This chapter addresses some issues that
7542: need attention when dealing with the <code xmlns=
1.45 wiz 7543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7544: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7545:
1.55 ! rillig 7546: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7547: <div class="titlepage">
7548: <div>
7549: <div>
7550: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7551: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7552: </div>
7553: </div>
7554: </div>
7555:
7556: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7557: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7558: class="filename">PLIST</code> file you write:</p>
1.1 grant 7559: <pre class="programlisting">
1.51 rillig 7560: @comment $NetBSD$
1.1 grant 7561: </pre>
7562: </div>
7563:
1.55 ! rillig 7564: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7565: <div class="titlepage">
7566: <div>
7567: <div>
7568: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7569: "automatic-plist-generation" id=
1.38 dillo 7570: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7571: <code xmlns=
7572: "http://www.w3.org/TR/xhtml1/transitional" class=
7573: "filename">PLIST</code> generation</h2>
1.1 grant 7574: </div>
7575: </div>
7576: </div>
7577:
1.14 xtraeme 7578: <p>You can use the <span><strong class="command">make
7579: print-PLIST</strong></span> command to output a PLIST
7580: that matches any new files since the package was
7581: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 7582: "14.3. Other helpful targets">Section 14.3,
1.1 grant 7583: “Other helpful targets”</a> for more
7584: information on this target.</p>
7585: </div>
7586:
1.55 ! rillig 7587: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7588: <div class="titlepage">
7589: <div>
7590: <div>
7591: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7592: "print-PLIST" id=
1.38 dillo 7593: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7594: <span><strong class="command">make
7595: print-PLIST</strong></span></h2>
1.1 grant 7596: </div>
7597: </div>
7598: </div>
7599:
7600: <p>If you have used any of the *-dirs packages, as
7601: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7602: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7603: “Sharing directories between packages”</a>,
1.14 xtraeme 7604: you may have noticed that <span><strong class=
7605: "command">make print-PLIST</strong></span> outputs a set
7606: of <code class="varname">@comment</code>s instead of real
7607: <code class="varname">@dirrm</code> lines. You can also
7608: do this for specific directories and files, so that the
7609: results of that command are very close to reality. This
7610: helps <span class="emphasis"><em>a lot</em></span> during
7611: the update of packages.</p>
7612:
7613: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7614: variable takes a set of AWK patterns and actions that are
7615: used to filter the output of print-PLIST. You can
7616: <span class="emphasis"><em>append</em></span> any chunk
7617: of AWK scripting you like to it, but be careful with
1.1 grant 7618: quoting.</p>
7619:
1.45 wiz 7620: <p>For example, to get all files inside the <code xmlns=
7621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7622: "filename">libdata/foo</code> directory removed from the
1.1 grant 7623: resulting PLIST:</p>
7624: <pre class="programlisting">
1.51 rillig 7625: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7626: </pre>
7627:
1.14 xtraeme 7628: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7629: lines referring to a specific (shared) directory
1.14 xtraeme 7630: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7631: <pre class="programlisting">
1.51 rillig 7632: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7633: </pre>
7634: </div>
7635:
1.55 ! rillig 7636: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7637: <div class="titlepage">
7638: <div>
7639: <div>
7640: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7641: "plist.misc" id=
1.38 dillo 7642: "plist.misc"></a>10.4. Variable substitution
7643: in PLIST</h2>
1.1 grant 7644: </div>
7645: </div>
7646: </div>
7647:
7648: <p>A number of variables are substituted automatically in
7649: PLISTs when a package is installed on a system. This
7650: includes the following variables:</p>
7651:
7652: <div class="variablelist">
7653: <dl>
1.14 xtraeme 7654: <dt><span class="term"><code class=
7655: "varname">${MACHINE_ARCH}</code>, <code class=
7656: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7657:
7658: <dd>
7659: <p>Some packages like emacs and perl embed
7660: information about which architecture they were
7661: built on into the pathnames where they install
1.47 reed 7662: their files. To handle this case, PLIST will be
1.1 grant 7663: preprocessed before actually used, and the symbol
1.14 xtraeme 7664: “<span class="quote"><code class=
7665: "varname">${MACHINE_ARCH}</code></span>” will
7666: be replaced by what <span><strong class=
7667: "command">uname -p</strong></span> gives. The same
7668: is done if the string <code class=
7669: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7670: PLIST somewhere - use this on packages that have
1.47 reed 7671: GNU autoconf-created configure scripts.</p>
1.1 grant 7672:
7673: <div class="note" style=
7674: "margin-left: 0.5in; margin-right: 0.5in;">
7675: <h3 class="title">Legacy note</h3>
7676:
7677: <p>There used to be a symbol “<span class=
1.14 xtraeme 7678: "quote"><code class=
7679: "varname">$ARCH</code></span>” that was
7680: replaced by the output of <span><strong class=
7681: "command">uname -m</strong></span>, but that's no
1.1 grant 7682: longer supported and has been removed.</p>
7683: </div>
7684: </dd>
7685:
1.14 xtraeme 7686: <dt><span class="term"><code class=
7687: "varname">${OPSYS}</code>, <code class=
7688: "varname">${LOWER_OPSYS}</code>, <code class=
7689: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7690:
7691: <dd>
7692: <p>Some packages want to embed the OS name and
7693: version into some paths. To do this, use these
1.45 wiz 7694: variables in the <code xmlns=
7695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7696: "filename">PLIST</code>:</p>
1.1 grant 7697:
7698: <div class="itemizedlist">
7699: <ul type="disc">
7700: <li>
1.14 xtraeme 7701: <p><code class="varname">${OPSYS}</code> -
7702: output of “<span class=
7703: "quote"><span><strong class="command">uname
7704: -s</strong></span></span>”</p>
1.1 grant 7705: </li>
7706:
7707: <li>
1.14 xtraeme 7708: <p><code class=
7709: "varname">${LOWER_OPSYS}</code> - lowercase
7710: common name (eg. “<span class=
7711: "quote">solaris</span>”)</p>
1.1 grant 7712: </li>
7713:
7714: <li>
1.14 xtraeme 7715: <p><code class="varname">${OS_VERSION}</code>
7716: - “<span class=
7717: "quote"><span><strong class="command">uname
7718: -r</strong></span></span>”</p>
1.1 grant 7719: </li>
7720: </ul>
7721: </div>
7722: </dd>
7723:
1.14 xtraeme 7724: <dt><span class="term"><code class=
7725: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7726:
7727: <dd>
7728: <p>Packages that install locale files should list
7729: them in the PLIST as “<span class=
7730: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7731: instead of “<span class=
7732: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7733: This properly handles the fact that different
7734: operating systems expect locale files to be either
1.45 wiz 7735: in <code xmlns=
7736: "http://www.w3.org/TR/xhtml1/transitional" class=
7737: "filename">share</code> or <code xmlns=
7738: "http://www.w3.org/TR/xhtml1/transitional" class=
7739: "filename">lib</code> by default.</p>
1.1 grant 7740: </dd>
7741: </dl>
7742: </div>
7743:
7744: <p>For a complete list of values which are replaced by
1.45 wiz 7745: default, please look in <code xmlns=
7746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7747: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7748: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7749:
7750: <p>If you want to change other variables not listed
7751: above, you can add variables and their expansions to this
1.14 xtraeme 7752: variable in the following way, similar to <code class=
7753: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7754: "#components.optional" title=
1.38 dillo 7755: "8.5. Optional files">Section 8.5,
1.1 grant 7756: “Optional files”</a>):</p>
7757: <pre class="programlisting">
1.51 rillig 7758: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 7759: </pre>
7760:
7761: <p>This replaces all occurrences of “<span class=
7762: "quote">${SOMEVAR}</span>” in the PLIST with
7763: “<span class="quote">somevalue</span>”.</p>
7764: </div>
7765:
1.55 ! rillig 7766: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7767: <div class="titlepage">
7768: <div>
7769: <div>
7770: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7771: "manpage-compression" id=
1.48 dillo 7772: "manpage-compression"></a>10.5. Man page
7773: compression</h2>
1.1 grant 7774: </div>
7775: </div>
7776: </div>
7777:
1.47 reed 7778: <p>Man pages should be installed in compressed form if
1.45 wiz 7779: <code class="varname">MANZ</code> is set (in <code xmlns=
7780: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7781: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7782: otherwise. To handle this in the <code xmlns=
7783: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7784: "filename">PLIST</code> file, the suffix
7785: “<span class="quote">.gz</span>” is
1.47 reed 7786: appended/removed automatically for man pages according to
1.14 xtraeme 7787: <code class="varname">MANZ</code> and <code class=
7788: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7789: above for details. This modification of the <code xmlns=
7790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7791: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7792: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7793: class="filename">PLIST</code> itself.</p>
1.1 grant 7794: </div>
7795:
1.55 ! rillig 7796: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7797: <div class="titlepage">
7798: <div>
7799: <div>
7800: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7801: "using-PLIST_SRC" id=
1.38 dillo 7802: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7803: source with <code class=
1.14 xtraeme 7804: "varname">PLIST_SRC</code></h2>
1.1 grant 7805: </div>
7806: </div>
7807: </div>
7808:
1.14 xtraeme 7809: <p>To use one or more files as source for the
1.45 wiz 7810: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7811: class="filename">PLIST</code> used in generating the
7812: binary package, set the variable <code class=
1.14 xtraeme 7813: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7814: The files are later concatenated using <a href=
7815: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7816: <span class="citerefentry"><span class=
7817: "refentrytitle">cat</span>(1)</span></a>, and order of
7818: things is important.</p>
1.1 grant 7819: </div>
7820:
1.55 ! rillig 7821: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7822: <div class="titlepage">
7823: <div>
7824: <div>
7825: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7826: "platform-specific-plist" id=
1.47 reed 7827: "platform-specific-plist"></a>10.7. Platform-specific
7828: and differing PLISTs</h2>
1.1 grant 7829: </div>
7830: </div>
7831: </div>
7832:
7833: <p>Some packages decide to install a different set of
7834: files based on the operating system being used. These
7835: differences can be automatically handled by using the
7836: following files:</p>
7837:
7838: <div class="itemizedlist">
7839: <ul type="disc">
7840: <li>
1.45 wiz 7841: <p><code xmlns=
7842: "http://www.w3.org/TR/xhtml1/transitional" class=
7843: "filename">PLIST.common</code></p>
1.1 grant 7844: </li>
7845:
7846: <li>
1.45 wiz 7847: <p><code xmlns=
7848: "http://www.w3.org/TR/xhtml1/transitional" class=
7849: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7850: </li>
7851:
7852: <li>
1.45 wiz 7853: <p><code xmlns=
7854: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7855: "filename">PLIST.${MACHINE_ARCH}</code></p>
7856: </li>
7857:
7858: <li>
1.45 wiz 7859: <p><code xmlns=
7860: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7861: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7862: </li>
7863:
7864: <li>
1.45 wiz 7865: <p><code xmlns=
7866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7867: "filename">PLIST.common_end</code></p>
1.1 grant 7868: </li>
7869: </ul>
7870: </div>
7871: </div>
7872:
1.55 ! rillig 7873: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7874: <div class="titlepage">
7875: <div>
7876: <div>
7877: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 7878: "faq.common-dirs" id=
1.38 dillo 7879: "faq.common-dirs"></a>10.8. Sharing
7880: directories between packages</h2>
1.1 grant 7881: </div>
7882: </div>
7883: </div>
7884:
7885: <p>A “<span class="quote">shared
7886: directory</span>” is a directory where multiple
7887: (and unrelated) packages install files. These directories
7888: are problematic because you have to add special tricks in
7889: the PLIST to conditionally remove them, or have some
7890: centralized package handle them.</p>
7891:
7892: <p>Within pkgsrc, you'll find both approaches. If a
7893: directory is shared by a few unrelated packages, it's
7894: often not worth to add an extra package to remove it.
7895: Therefore, one simply does:</p>
7896: <pre class="programlisting">
1.51 rillig 7897: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 7898: </pre>
7899:
7900: <p>in the PLISTs of all affected packages, instead of the
7901: regular "@dirrm" line.</p>
7902:
7903: <p>However, if the directory is shared across many
7904: packages, two different solutions are available:</p>
7905:
7906: <div class="orderedlist">
7907: <ol type="1">
7908: <li>
7909: <p>If the packages have a common dependency, the
7910: directory can be removed in that. For example, see
7911: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7912: href=
7913: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 7914: target="_top"><code xmlns="" class=
7915: "filename">textproc/scrollkeeper</code></a>, which
7916: removes the shared directory <code xmlns=
7917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7918: "filename">share/omf</code>.</p>
1.1 grant 7919: </li>
7920:
7921: <li>
7922: <p>If the packages using the directory are not
7923: related at all (they have no common dependencies),
7924: a *-dirs package is used.</p>
7925: </li>
7926: </ol>
7927: </div>
7928:
7929: <p>From now on, we'll discuss the second solution. To get
7930: an idea of the *-dirs packages available, issue:</p>
7931: <pre class="programlisting">
1.51 rillig 7932: <code class="prompt">%</code> cd .../pkgsrc
7933: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7934: </pre>
7935:
7936: <p>Their use from other packages is very simple. The
1.14 xtraeme 7937: <code class="varname">USE_DIRS</code> variable takes a
7938: list of package names (without the “<span class=
1.1 grant 7939: "quote">-dirs</span>” part) together with the
7940: required version number (always pick the latest one when
1.34 wiz 7941: writing new packages).</p>
1.1 grant 7942:
7943: <p>For example, if a package installs files under
1.45 wiz 7944: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7945: class="filename">share/applications</code>, it should
7946: have the following line in it:</p>
1.1 grant 7947: <pre class="programlisting">
1.51 rillig 7948: USE_DIRS+= xdg-1.1
1.1 grant 7949: </pre>
7950:
1.14 xtraeme 7951: <p>After regenerating the PLIST using
7952: <span><strong class="command">make
7953: print-PLIST</strong></span>, you should get the right
7954: (commented out) lines.</p>
1.1 grant 7955:
1.47 reed 7956: <p>Note that even if your package is using <code xmlns=
1.45 wiz 7957: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7958: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7959: *-x11-dirs packages. Just specify the name without that
1.45 wiz 7960: part and pkgsrc (in particular, <code xmlns=
7961: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7962: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7963: </div>
7964: </div>
7965:
1.55 ! rillig 7966: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 7967: <div class="titlepage">
7968: <div>
7969: <div>
1.55 ! rillig 7970: <h2 class="title"><a name="buildlink" id=
1.38 dillo 7971: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7972: methodology</h2>
7973: </div>
7974: </div>
7975: </div>
7976:
7977: <div class="toc">
7978: <p><b>Table of Contents</b></p>
7979:
7980: <dl>
1.30 wiz 7981: <dt><span class="sect1"><a href=
1.38 dillo 7982: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7983: to use buildlink3</a></span></dt>
1.1 grant 7984:
1.30 wiz 7985: <dt><span class="sect1"><a href=
1.45 wiz 7986: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
7987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7988: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7989:
7990: <dd>
7991: <dl>
1.25 rillig 7992: <dt><span class="sect2"><a href=
1.38 dillo 7993: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7994: buildlink3.mk file</a></span></dt>
1.1 grant 7995:
1.25 rillig 7996: <dt><span class="sect2"><a href=
1.38 dillo 7997: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7998: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7999: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8000: <code xmlns=
8001: "http://www.w3.org/TR/xhtml1/transitional" class=
8002: "filename">buildlink3.mk</code>
1.1 grant 8003: files</a></span></dt>
8004: </dl>
8005: </dd>
8006:
1.30 wiz 8007: <dt><span class="sect1"><a href=
1.45 wiz 8008: "#writing-builtin.mk">11.3. Writing <code xmlns=
8009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8010: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8011:
8012: <dd>
8013: <dl>
1.25 rillig 8014: <dt><span class="sect2"><a href=
1.38 dillo 8015: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8016: <code xmlns=
8017: "http://www.w3.org/TR/xhtml1/transitional" class=
8018: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8019:
1.25 rillig 8020: <dt><span class="sect2"><a href=
1.38 dillo 8021: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8022: preferences for native or pkgsrc
8023: software</a></span></dt>
1.1 grant 8024: </dl>
8025: </dd>
8026: </dl>
8027: </div>
8028:
8029: <p>Buildlink is a framework in pkgsrc that controls what
8030: headers and libraries are seen by a package's configure and
8031: build processes. This is implemented in a two step
8032: process:</p>
8033:
8034: <div class="orderedlist">
8035: <ol type="1">
8036: <li>
8037: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8038: into <code class="varname">BUILDLINK_DIR</code>,
8039: which by default is a subdirectory of <code class=
8040: "varname">WRKDIR</code>.</p>
1.1 grant 8041: </li>
8042:
8043: <li>
8044: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8045: the normal compiler tools that translate <code class=
8046: "option">-I${LOCALBASE}/include</code> and
8047: <code class="option">-L${LOCALBASE}/lib</code> into
8048: references to <code class=
8049: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8050: also make native compiler on some operating systems
8051: look like GCC, so that packages that expect GCC won't
8052: require modifications to build with those native
8053: compilers.</p>
1.1 grant 8054: </li>
8055: </ol>
8056: </div>
8057:
8058: <p>This normalizes the environment in which a package is
8059: built so that the package may be built consistently despite
8060: what other software may be installed. Please note that the
1.45 wiz 8061: normal system header and library paths, e.g. <code xmlns=
8062: "http://www.w3.org/TR/xhtml1/transitional" class=
8063: "filename">/usr/include</code>, <code xmlns=
8064: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8065: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8066: buildlink3 is designed to insulate the package build from
8067: non-system-supplied software.</p>
8068:
1.55 ! rillig 8069: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8070: <div class="titlepage">
8071: <div>
8072: <div>
8073: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 8074: "converting-to-buildlink3" id=
1.38 dillo 8075: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8076: packages to use buildlink3</h2>
1.1 grant 8077: </div>
8078: </div>
8079: </div>
8080:
8081: <p>The process of converting packages to use the
8082: buildlink3 framework (“<span class=
8083: "quote">bl3ifying</span>”) is fairly
8084: straightforward. The things to keep in mind are:</p>
8085:
8086: <div class="orderedlist">
8087: <ol type="1">
8088: <li>
8089: <p>Ensure that the build always calls the wrapper
8090: scripts instead of the actual toolchain. Some
8091: packages are tricky, and the only way to know for
1.45 wiz 8092: sure is the check <code xmlns=
8093: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8094: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8095: wrappers are being invoked.</p>
8096: </li>
8097:
8098: <li>
1.14 xtraeme 8099: <p>Don't override <code class=
8100: "varname">PREFIX</code> from within the package
8101: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8102: because the code to symlink files into <code xmlns=
8103: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8104: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8105: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8106: <em class=
8107: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8108: </li>
8109:
8110: <li>
8111: <p>Remember that <span class=
1.45 wiz 8112: "emphasis"><em>only</em></span> the <code xmlns=
8113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8114: "filename">buildlink3.mk</code> files that you list
1.1 grant 8115: in a package's Makefile are added as dependencies
8116: for that package.</p>
8117: </li>
8118: </ol>
8119: </div>
8120:
8121: <p>If a dependency on a particular package is required
8122: for its libraries and headers, then we replace:</p>
8123: <pre class="programlisting">
1.51 rillig 8124: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8125: </pre>
8126:
8127: <p>with</p>
8128: <pre class="programlisting">
1.51 rillig 8129: .include "../../category/foo/buildlink3.mk"
1.1 grant 8130: </pre>
8131:
1.47 reed 8132: <p>The buildlink3.mk files usually define the required
8133: dependencies. If you need a newer version of the
8134: dependency when using buildlink3.mk files, then you can
8135: define it in your Makefile; for example:</p>
8136: <pre class="programlisting">
1.51 rillig 8137: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8138: .include "../../category/foo/buildlink3.mk"
1.47 reed 8139: </pre>
8140:
1.45 wiz 8141: <p>There are several <code xmlns=
8142: "http://www.w3.org/TR/xhtml1/transitional" class=
8143: "filename">buildlink3.mk</code> files in <code xmlns=
8144: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8145: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8146: issues:</p>
8147:
8148: <div class="itemizedlist">
8149: <ul type="disc">
8150: <li>
1.45 wiz 8151: <p><code xmlns=
8152: "http://www.w3.org/TR/xhtml1/transitional" class=
8153: "filename">bdb.buildlink3.mk</code> chooses either
8154: the native or a pkgsrc Berkeley DB implementation
8155: based on the values of <code class=
1.14 xtraeme 8156: "varname">BDB_ACCEPTED</code> and <code class=
8157: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8158: </li>
8159:
8160: <li>
1.45 wiz 8161: <p><code xmlns=
8162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8163: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8164: system comes with neither Curses nor NCurses, this
8165: will take care to install the <a xmlns=
8166: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8167: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8168: target="_top"><code xmlns="" class=
8169: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8170: </li>
8171:
8172: <li>
1.45 wiz 8173: <p><code xmlns=
8174: "http://www.w3.org/TR/xhtml1/transitional" class=
8175: "filename">krb5.buildlink3.mk</code> uses the value
8176: of <code class="varname">KRB5_ACCEPTED</code> to
8177: choose between adding a dependency on Heimdal or
8178: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8179: implementation.</p>
8180: </li>
8181:
8182: <li>
1.45 wiz 8183: <p><code xmlns=
8184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8185: "filename">motif.buildlink3.mk</code> checks for a
8186: system-provided Motif installation or adds a
8187: dependency on <a xmlns=
1.1 grant 8188: "http://www.w3.org/TR/xhtml1/transitional" href=
8189: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8190: target="_top"><code xmlns="" class=
8191: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8192: "http://www.w3.org/TR/xhtml1/transitional" href=
8193: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8194: target="_top"><code xmlns="" class=
1.47 reed 8195: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8196: </li>
8197:
8198: <li>
1.45 wiz 8199: <p><code xmlns=
8200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8201: "filename">ossaudio.buildlink3.mk</code> defines
8202: several variables that may be used by packages that
1.47 reed 8203: use the Open Sound System (OSS) API.</p>
1.1 grant 8204: </li>
8205:
8206: <li>
1.45 wiz 8207: <p><code xmlns=
8208: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8209: "filename">pgsql.buildlink3.mk</code> will accept
8210: either Postgres 7.3 or 7.4, whichever is found
8211: installed. See the file for more information.</p>
1.1 grant 8212: </li>
8213:
8214: <li>
1.45 wiz 8215: <p><code xmlns=
8216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8217: "filename">pthread.buildlink3.mk</code> uses the
8218: value of <code class="varname">PTHREAD_OPTS</code>
8219: and checks for native pthreads or adds a dependency
8220: on <a xmlns=
1.1 grant 8221: "http://www.w3.org/TR/xhtml1/transitional" href=
8222: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8223: target="_top"><code xmlns="" class=
1.47 reed 8224: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8225: </li>
8226:
8227: <li>
1.45 wiz 8228: <p><code xmlns=
8229: "http://www.w3.org/TR/xhtml1/transitional" class=
8230: "filename">xaw.buildlink3.mk</code> uses the value
8231: of <code class="varname">XAW_TYPE</code> to choose
8232: a particular Athena widgets library.</p>
1.1 grant 8233: </li>
8234: </ul>
8235: </div>
8236:
1.45 wiz 8237: <p>The comments in those <code xmlns=
8238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8239: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8240: complete description of how to use them properly.</p>
8241: </div>
8242:
1.55 ! rillig 8243: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8244: <div class="titlepage">
8245: <div>
8246: <div>
8247: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 8248: "creating-buildlink3.mk" id=
1.38 dillo 8249: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8250: <code xmlns=
8251: "http://www.w3.org/TR/xhtml1/transitional" class=
8252: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8253: </div>
8254: </div>
8255: </div>
8256:
1.45 wiz 8257: <p>A package's <code xmlns=
8258: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8259: "filename">buildlink3.mk</code> file is included by
8260: Makefiles to indicate the need to compile and link
8261: against header files and libraries provided by the
1.45 wiz 8262: package. A <code xmlns=
8263: "http://www.w3.org/TR/xhtml1/transitional" class=
8264: "filename">buildlink3.mk</code> file should always
8265: provide enough information to add the correct type of
8266: dependency relationship and include any other
8267: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8268: class="filename">buildlink3.mk</code> files that it needs
8269: to find headers and libraries that it needs in turn.</p>
1.1 grant 8270:
1.45 wiz 8271: <p>To generate an initial <code xmlns=
8272: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8273: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8274: Rene Hexel's <a xmlns=
8275: "http://www.w3.org/TR/xhtml1/transitional" href=
8276: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8277: target="_top"><code xmlns="" class=
8278: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8279: highly recommended. For most packages, the following
8280: command will generate a good starting point for
1.45 wiz 8281: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8282: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8283: <pre class="screen">
1.14 xtraeme 8284: <code class="prompt">%</code> <strong class=
8285: "userinput"><code>cd pkgsrc/<em class=
8286: "replaceable"><code>category</code></em>/<em class=
8287: "replaceable"><code>pkgdir</code></em>
8288: <code class=
1.49 rillig 8289: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8290: </pre>
8291:
1.55 ! rillig 8292: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8293: <div class="titlepage">
8294: <div>
8295: <div>
1.55 ! rillig 8296: <h3 class="title"><a name="anatomy-of-bl3" id=
! 8297: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8298: buildlink3.mk file</h3>
1.1 grant 8299: </div>
8300: </div>
8301: </div>
8302:
1.45 wiz 8303: <p>The following real-life example <code xmlns=
8304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8305: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8306: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8307: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8308: <pre class="programlisting">
1.51 rillig 8309: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8310:
1.51 rillig 8311: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8312: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8313:
1.51 rillig 8314: .if !empty(BUILDLINK_DEPTH:M+)
8315: BUILDLINK_DEPENDS+= tiff
8316: .endif
1.1 grant 8317:
1.51 rillig 8318: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8319: BUILDLINK_PACKAGES+= tiff
1.1 grant 8320:
1.51 rillig 8321: .if !empty(TIFF_BUILDLINK3_MK:M+)
8322: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8323: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8324: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8325:
1.51 rillig 8326: .include "../../devel/zlib/buildlink3.mk"
8327: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8328:
1.51 rillig 8329: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8330: </pre>
8331:
1.14 xtraeme 8332: <p>The header and footer manipulate <code class=
8333: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8334: across all <code xmlns=
8335: "http://www.w3.org/TR/xhtml1/transitional" class=
8336: "filename">buildlink3.mk</code> files and is used to
8337: track at what depth we are including <code xmlns=
8338: "http://www.w3.org/TR/xhtml1/transitional" class=
8339: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8340:
8341: <p>The first section controls if the dependency on
1.14 xtraeme 8342: <em class="replaceable"><code>pkg</code></em> is added.
8343: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8344: global list of packages for which dependencies are
8345: added by buildlink3.</p>
8346:
8347: <p>The second section advises pkgsrc that the
1.45 wiz 8348: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8349: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8350: <em class="replaceable"><code>pkg</code></em> has been
8351: included at some point. <code class=
8352: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8353: of packages for which <code xmlns=
8354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8355: "filename">buildlink3.mk</code> files have been
8356: included. It must <span class=
8357: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8358: a <code xmlns=
8359: "http://www.w3.org/TR/xhtml1/transitional" class=
8360: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8361:
8362: <p>The third section is protected from multiple
1.14 xtraeme 8363: inclusion and controls how the dependency on <em class=
8364: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8365: important variables are set in the section:</p>
8366:
8367: <div class="itemizedlist">
8368: <ul type="disc">
8369: <li>
1.14 xtraeme 8370: <p><code class=
8371: "varname">BUILDLINK_DEPENDS.<em class=
8372: "replaceable"><code>pkg</code></em></code> is the
8373: actual dependency recorded in the installed
8374: package; this should always be set using
8375: <span><strong class="command">+=</strong></span>
8376: to ensure that we're appending to any
8377: pre-existing list of values. This variable should
8378: be set to the first version of the package that
8379: had the last change in the major number of a
8380: shared library or that had a major API
8381: change.</p>
1.1 grant 8382: </li>
8383:
8384: <li>
1.14 xtraeme 8385: <p><code class=
8386: "varname">BUILDLINK_PKGSRCDIR.<em class=
8387: "replaceable"><code>pkg</code></em></code> is the
8388: location of the <em class=
8389: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8390: directory.</p>
1.1 grant 8391: </li>
8392:
8393: <li>
1.14 xtraeme 8394: <p><code class=
8395: "varname">BUILDLINK_DEPMETHOD.<em class=
8396: "replaceable"><code>pkg</code></em></code> (not
8397: shown above) controls whether we use <code class=
8398: "varname">BUILD_DEPENDS</code> or <code class=
8399: "varname">DEPENDS</code> to add the dependency on
8400: <em class="replaceable"><code>pkg</code></em>.
8401: The build dependency is selected by setting
8402: <code class=
8403: "varname">BUILDLINK_DEPMETHOD.<em class=
8404: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8405: “<span class="quote">build</span>”.
8406: By default, the full dependency is used.</p>
8407: </li>
8408:
8409: <li>
1.14 xtraeme 8410: <p><code class=
8411: "varname">BUILDLINK_INCDIRS.<em class=
8412: "replaceable"><code>pkg</code></em></code> and
8413: <code class=
1.55 ! rillig 8414: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
! 8415: <code>pkg</code></em></code> (not shown above)
! 8416: are lists of subdirectories of <code xmlns=
1.45 wiz 8417: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8418: "filename">${BUILDLINK_PREFIX.<em class=
8419: "replaceable"><code>pkg</code></em>}</code> to
8420: add to the header and library search paths. These
1.1 grant 8421: default to “<span class=
8422: "quote">include</span>” and
8423: “<span class="quote">lib</span>”
8424: respectively.</p>
8425: </li>
8426:
8427: <li>
1.14 xtraeme 8428: <p><code class=
8429: "varname">BUILDLINK_CPPFLAGS.<em class=
8430: "replaceable"><code>pkg</code></em></code> (not
8431: shown above) is the list of preprocessor flags to
8432: add to <code class="varname">CPPFLAGS</code>,
8433: which are passed on to the configure and build
8434: phases. The “<span class=
8435: "quote">-I</span>” option should be avoided
8436: and instead be handled using <code class=
8437: "varname">BUILDLINK_INCDIRS.<em class=
8438: "replaceable"><code>pkg</code></em></code> as
8439: above.</p>
1.1 grant 8440: </li>
8441: </ul>
8442: </div>
8443:
8444: <p>The following variables are all optionally defined
8445: within this second section (protected against multiple
8446: inclusion) and control which package files are
1.45 wiz 8447: symlinked into <code xmlns=
8448: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8449: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8450: are transformed during the symlinking:</p>
8451:
8452: <div class="itemizedlist">
8453: <ul type="disc">
8454: <li>
1.14 xtraeme 8455: <p><code class=
8456: "varname">BUILDLINK_FILES.<em class=
8457: "replaceable"><code>pkg</code></em></code> (not
8458: shown above) is a shell glob pattern relative to
1.45 wiz 8459: <code xmlns=
8460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8461: "filename">${BUILDLINK_PREFIX.<em class=
8462: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8463: symlinked into <code xmlns=
8464: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8465: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8466: <code xmlns=
8467: "http://www.w3.org/TR/xhtml1/transitional" class=
8468: "filename">include/*.h</code>.</p>
1.1 grant 8469: </li>
8470:
8471: <li>
1.14 xtraeme 8472: <p><code class=
8473: "varname">BUILDLINK_FILES_CMD.<em class=
8474: "replaceable"><code>pkg</code></em></code> (not
8475: shown above) is a shell pipeline that outputs to
1.45 wiz 8476: stdout a list of files relative to <code xmlns=
8477: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8478: "filename">${BUILDLINK_PREFIX.<em class=
8479: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8480: resulting files are to be symlinked into
1.45 wiz 8481: <code xmlns=
8482: "http://www.w3.org/TR/xhtml1/transitional" class=
8483: "filename">${BUILDLINK_DIR}</code>. By default,
8484: this takes the <code xmlns=
8485: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8486: "filename">+CONTENTS</code> of a <em class=
8487: "replaceable"><code>pkg</code></em> and filters
8488: it through <code class=
8489: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8490: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8491: </li>
8492:
8493: <li>
1.14 xtraeme 8494: <p><code class=
8495: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8496: "replaceable"><code>pkg</code></em></code> (not
8497: shown above) is a filter command that filters
1.45 wiz 8498: <code xmlns=
8499: "http://www.w3.org/TR/xhtml1/transitional" class=
8500: "filename">+CONTENTS</code> input into a list of
8501: files relative to <code xmlns=
8502: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8503: "filename">${BUILDLINK_PREFIX.<em class=
8504: "replaceable"><code>pkg</code></em>}</code> on
8505: stdout. By default for overwrite packages,
8506: <code class=
8507: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8508: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8509: outputs the contents of the <code xmlns=
8510: "http://www.w3.org/TR/xhtml1/transitional" class=
8511: "filename">include</code> and <code xmlns=
8512: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8513: "filename">lib</code> directories in the package
1.45 wiz 8514: <code xmlns=
8515: "http://www.w3.org/TR/xhtml1/transitional" class=
8516: "filename">+CONTENTS</code>, and for pkgviews
8517: packages, it outputs any libtool archives in
8518: <code xmlns=
8519: "http://www.w3.org/TR/xhtml1/transitional" class=
8520: "filename">lib</code> directories.</p>
1.1 grant 8521: </li>
8522:
8523: <li>
1.14 xtraeme 8524: <p><code class=
8525: "varname">BUILDLINK_TRANSFORM.<em class=
8526: "replaceable"><code>pkg</code></em></code> (not
8527: shown above) is a list of sed arguments used to
1.1 grant 8528: transform the name of the source filename into a
1.14 xtraeme 8529: destination filename, e.g. <span><strong class=
1.1 grant 8530: "command">-e
1.14 xtraeme 8531: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8532: </li>
8533: </ul>
8534: </div>
8535:
1.45 wiz 8536: <p>The last section includes any <code xmlns=
8537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8538: "filename">buildlink3.mk</code> needed for <em class=
8539: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8540: dependencies. Including these <code xmlns=
8541: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8542: "filename">buildlink3.mk</code> files means that the
8543: headers and libraries for these dependencies are also
1.45 wiz 8544: symlinked into <code xmlns=
8545: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8546: "filename">${BUILDLINK_DIR}</code> whenever the
8547: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8548: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8549: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8550: included.</p>
1.1 grant 8551: </div>
8552:
1.55 ! rillig 8553: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8554: <div class="titlepage">
8555: <div>
8556: <div>
1.30 wiz 8557: <h3 class="title"><a name=
1.55 ! rillig 8558: "updating-buildlink-depends" id=
! 8559: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8560: <code class=
1.55 ! rillig 8561: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
! 8562: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 8563: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8564: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8565: </div>
8566: </div>
8567: </div>
8568:
8569: <p>There are two situations that require increasing the
1.14 xtraeme 8570: dependency listed in <code class=
8571: "varname">BUILDLINK_DEPENDS.<em class=
8572: "replaceable"><code>pkg</code></em></code> after a
8573: package update:</p>
1.1 grant 8574:
8575: <div class="orderedlist">
8576: <ol type="1">
8577: <li>
8578: <p>if the sonames (major number of the library
8579: version) of any installed shared libraries
1.47 reed 8580: change.</p>
1.1 grant 8581: </li>
8582:
8583: <li>
8584: <p>if the API or interface to the header files
8585: change.</p>
8586: </li>
8587: </ol>
8588: </div>
8589:
1.14 xtraeme 8590: <p>In these cases, <code class=
8591: "varname">BUILDLINK_DEPENDS.<em class=
8592: "replaceable"><code>pkg</code></em></code> should be
8593: adjusted to require at least the new package version.
8594: In some cases, the packages that depend on this new
8595: version may need their <code class=
8596: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8597: have <code xmlns=
8598: "http://www.w3.org/TR/xhtml1/transitional" class=
8599: "filename">buildlink3.mk</code> files, their
8600: <code class="varname">BUILDLINK_DEPENDS.<em class=
8601: "replaceable"><code>pkg</code></em></code> adjusted,
8602: too. This is needed so that binary packages made using
8603: it will require the correct package dependency and not
8604: settle for an older one which will not contain the
8605: necessary shared libraries.</p>
1.1 grant 8606:
8607: <p>Please take careful consideration before adjusting
1.14 xtraeme 8608: <code class="varname">BUILDLINK_DEPENDS.<em class=
8609: "replaceable"><code>pkg</code></em></code> as we don't
8610: want to cause unneeded package deletions and rebuilds.
8611: In many cases, new versions of packages work just fine
8612: with older dependencies. See <a href="#dependencies"
1.55 ! rillig 8613: title="15.1.4. Handling dependencies">Section
! 8614: 15.1.4, “Handling dependencies”</a> for
! 8615: more information about dependencies on other packages,
1.25 rillig 8616: including the <code class=
8617: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8618: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8619: </div>
8620: </div>
8621:
1.55 ! rillig 8622: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8623: <div class="titlepage">
8624: <div>
8625: <div>
8626: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 8627: "writing-builtin.mk" id=
1.38 dillo 8628: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8629: <code xmlns=
8630: "http://www.w3.org/TR/xhtml1/transitional" class=
8631: "filename">builtin.mk</code> files</h2>
1.1 grant 8632: </div>
8633: </div>
8634: </div>
8635:
8636: <p>Some packages in pkgsrc install headers and libraries
8637: that coincide with headers and libraries present in the
1.45 wiz 8638: base system. Aside from a <code xmlns=
8639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8640: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8641: should also include a <code xmlns=
8642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8643: "filename">builtin.mk</code> file that includes the
8644: necessary checks to decide whether using the built-in
8645: software or the pkgsrc software is appropriate.</p>
1.1 grant 8646:
8647: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8648: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8649:
8650: <div class="orderedlist">
8651: <ol type="1">
8652: <li>
1.14 xtraeme 8653: <p>It should set <code class=
8654: "varname">USE_BUILTIN.<em class=
8655: "replaceable"><code>pkg</code></em></code> to
8656: either “<span class="quote">yes</span>”
8657: or “<span class="quote">no</span>”
8658: after it is included.</p>
1.1 grant 8659: </li>
8660:
8661: <li>
8662: <p>It should <span class=
8663: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8664: <code class="varname">USE_BUILTIN.<em class=
8665: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8666: already set before the <code xmlns=
8667: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8668: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8669: </li>
8670:
8671: <li>
8672: <p>It should be written to allow multiple
8673: inclusion. This is <span class=
8674: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8675: careful attention to <code xmlns=
8676: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8677: "filename">Makefile</code> coding.</p>
1.1 grant 8678: </li>
8679: </ol>
8680: </div>
8681:
1.55 ! rillig 8682: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8683: <div class="titlepage">
8684: <div>
8685: <div>
1.55 ! rillig 8686: <h3 class="title"><a name="anatomy-of-builtin.mk"
! 8687: id=
1.38 dillo 8688: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8689: of a <code xmlns=
8690: "http://www.w3.org/TR/xhtml1/transitional" class=
8691: "filename">builtin.mk</code> file</h3>
1.1 grant 8692: </div>
8693: </div>
8694: </div>
8695:
8696: <p>The following is the recommended template for
8697: builtin.mk files:</p>
8698: <pre class="programlisting">
1.51 rillig 8699: .if !defined(IS_BUILTIN.foo)
8700: #
8701: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8702: # genuinely exists in the system or not.
8703: #
8704: IS_BUILTIN.foo?= no
8705:
8706: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8707: # version can be determined.
8708: #
8709: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8710: BUILTIN_PKG.foo?= foo-1.0
8711: . endif
8712: .endif # IS_BUILTIN.foo
8713:
8714: .if !defined(USE_BUILTIN.foo)
8715: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8716: . if defined(BUILTIN_PKG.foo)
8717: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8718: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8719: USE_BUILTIN.foo!= \
8720: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8721: ${ECHO} "yes"; \
8722: else \
8723: ${ECHO} "no"; \
8724: fi
8725: . endif
8726: . endfor
8727: . endif
8728: .endif # USE_BUILTIN.foo
8729:
8730: CHECK_BUILTIN.foo?= no
8731: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8732: #
8733: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8734: # "yes" or "no".
8735: #
8736: .endif # CHECK_BUILTIN.foo
1.1 grant 8737: </pre>
8738:
1.14 xtraeme 8739: <p>The first section sets <code class=
8740: "varname">IS_BUILTIN.<em class=
8741: "replaceable"><code>pkg</code></em></code> depending on
8742: if <em class="replaceable"><code>pkg</code></em> really
8743: exists in the base system. This should not be a base
8744: system software with similar functionality to
8745: <em class="replaceable"><code>pkg</code></em>; it
8746: should only be “<span class=
8747: "quote">yes</span>” if the actual package is
8748: included as part of the base system. This variable is
1.45 wiz 8749: only used internally within the <code xmlns=
8750: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8751: "filename">builtin.mk</code> file.</p>
8752:
8753: <p>The second section sets <code class=
8754: "varname">BUILTIN_PKG.<em class=
8755: "replaceable"><code>pkg</code></em></code> to the
8756: version of <em class=
8757: "replaceable"><code>pkg</code></em> in the base system
8758: if it exists (if <code class=
8759: "varname">IS_BUILTIN.<em class=
8760: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8761: “<span class="quote">yes</span>”). This
1.14 xtraeme 8762: variable is only used internally within the
1.45 wiz 8763: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8764: class="filename">builtin.mk</code> file.</p>
1.1 grant 8765:
1.14 xtraeme 8766: <p>The third section sets <code class=
8767: "varname">USE_BUILTIN.<em class=
8768: "replaceable"><code>pkg</code></em></code> and is
8769: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8770: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8771: class="filename">builtin.mk</code> files. The code in
8772: this section must make the determination whether the
8773: built-in software is adequate to satisfy the
8774: dependencies listed in <code class=
1.14 xtraeme 8775: "varname">BUILDLINK_DEPENDS.<em class=
8776: "replaceable"><code>pkg</code></em></code>. This is
8777: typically done by comparing <code class=
8778: "varname">BUILTIN_PKG.<em class=
8779: "replaceable"><code>pkg</code></em></code> against each
8780: of the dependencies in <code class=
8781: "varname">BUILDLINK_DEPENDS.<em class=
8782: "replaceable"><code>pkg</code></em></code>.
8783: <code class="varname">USE_BUILTIN.<em class=
8784: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8785: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8786: value by the end of the <code xmlns=
8787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8788: "filename">builtin.mk</code> file. Note that
8789: <code class="varname">USE_BUILTIN.<em class=
8790: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8791: “<span class="quote">yes</span>” even if
1.14 xtraeme 8792: <code class="varname">IS_BUILTIN.<em class=
8793: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8794: “<span class="quote">no</span>” because we
8795: may make the determination that the built-in version of
8796: the software is similar enough to be used as a
8797: replacement.</p>
8798:
1.14 xtraeme 8799: <p>The last section is guarded by <code class=
8800: "varname">CHECK_BUILTIN.<em class=
8801: "replaceable"><code>pkg</code></em></code>, and
8802: includes code that uses the value of <code class=
8803: "varname">USE_BUILTIN.<em class=
8804: "replaceable"><code>pkg</code></em></code> set in the
8805: previous section. This typically includes, e.g., adding
1.1 grant 8806: additional dependency restrictions and listing
1.45 wiz 8807: additional files to symlink into <code xmlns=
8808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8809: "filename">${BUILDLINK_DIR}</code> (via <code class=
8810: "varname">BUILDLINK_FILES.<em class=
8811: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8812: </div>
8813:
1.55 ! rillig 8814: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8815: <div class="titlepage">
8816: <div>
8817: <div>
1.30 wiz 8818: <h3 class="title"><a name=
1.55 ! rillig 8819: "native-or-pkgsrc-preference" id=
1.38 dillo 8820: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8821: preferences for native or pkgsrc software</h3>
1.1 grant 8822: </div>
8823: </div>
8824: </div>
8825:
8826: <p>When building packages, it's possible to choose
8827: whether to set a global preference for using either the
8828: built-in (native) version or the pkgsrc version of
8829: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8830: setting <code class="varname">PREFER_PKGSRC</code> and
8831: <code class="varname">PREFER_NATIVE</code>. These
8832: variables take values of either “<span class=
1.1 grant 8833: "quote">yes</span>”, “<span class=
8834: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8835: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8836: to use the pkgsrc versions of software, while
8837: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8838: to use the built-in versions. Preferences are
8839: determined by the most specific instance of the package
8840: in either <code class="varname">PREFER_PKGSRC</code> or
8841: <code class="varname">PREFER_NATIVE</code>. If a
8842: package is specified in neither or in both variables,
8843: then <code class="varname">PREFER_PKGSRC</code> has
8844: precedence over <code class=
8845: "varname">PREFER_NATIVE</code>. For example, to require
8846: using pkgsrc versions of software for all but the most
8847: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8848: <pre class="programlisting">
1.51 rillig 8849: PREFER_PKGSRC= yes
8850: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 8851: </pre>
8852:
8853: <p>A package <span class=
1.45 wiz 8854: "emphasis"><em>must</em></span> have a <code xmlns=
8855: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8856: "filename">builtin.mk</code> file to be listed in
8857: <code class="varname">PREFER_NATIVE</code>, otherwise
8858: it is simply ignored in that list.</p>
1.1 grant 8859: </div>
8860: </div>
8861: </div>
8862:
1.55 ! rillig 8863: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 8864: <div class="titlepage">
8865: <div>
8866: <div>
1.55 ! rillig 8867: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 8868: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8869: framework</h2>
1.1 grant 8870: </div>
8871: </div>
8872: </div>
8873:
8874: <div class="toc">
8875: <p><b>Table of Contents</b></p>
8876:
8877: <dl>
1.30 wiz 8878: <dt><span class="sect1"><a href=
1.38 dillo 8879: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8880: directories outside the installation
8881: prefix</a></span></dt>
8882:
8883: <dd>
8884: <dl>
8885: <dt><span class="sect2"><a href=
1.38 dillo 8886: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8887: manipulation</a></span></dt>
8888:
8889: <dt><span class="sect2"><a href=
1.38 dillo 8890: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8891: manipulation</a></span></dt>
8892: </dl>
8893: </dd>
8894:
1.38 dillo 8895: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8896: Configuration files</a></span></dt>
8897:
8898: <dd>
8899: <dl>
8900: <dt><span class="sect2"><a href=
1.38 dillo 8901: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8902: "varname">PKG_SYSCONFDIR</code> is
8903: set</a></span></dt>
8904:
8905: <dt><span class="sect2"><a href=
1.38 dillo 8906: "#conf-files-configure">12.2.2. Telling the
1.47 reed 8907: software where configuration files
1.35 jmmv 8908: are</a></span></dt>
8909:
8910: <dt><span class="sect2"><a href=
1.38 dillo 8911: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8912: installations</a></span></dt>
8913:
8914: <dt><span class="sect2"><a href=
1.38 dillo 8915: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8916: configuration files</a></span></dt>
8917: </dl>
8918: </dd>
8919:
1.38 dillo 8920: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8921: System startup scripts</a></span></dt>
8922:
8923: <dd>
8924: <dl>
8925: <dt><span class="sect2"><a href=
1.38 dillo 8926: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8927: of system startup scripts</a></span></dt>
8928: </dl>
8929: </dd>
1.1 grant 8930:
1.30 wiz 8931: <dt><span class="sect1"><a href=
1.38 dillo 8932: "#users-and-groups">12.4. System users and
1.35 jmmv 8933: groups</a></span></dt>
8934:
1.38 dillo 8935: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8936: shells</a></span></dt>
8937:
8938: <dd>
8939: <dl>
8940: <dt><span class="sect2"><a href=
1.38 dillo 8941: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8942: configuration files</a></span></dt>
8943: </dl>
8944: </dd>
1.1 grant 8945: </dl>
8946: </div>
8947:
1.35 jmmv 8948: <p>This chapter describes the framework known as
8949: <code class="literal">pkginstall</code>, whose key features
8950: are:</p>
8951:
8952: <div class="itemizedlist">
8953: <ul type="disc">
8954: <li>
8955: <p>Generic installation and manipulation of
8956: directories and files outside the pkgsrc-handled
8957: tree, <code class="varname">LOCALBASE</code>.</p>
8958: </li>
8959:
8960: <li>
8961: <p>Automatic handling of configuration files during
8962: installation, provided that packages are correctly
8963: designed.</p>
8964: </li>
8965:
8966: <li>
8967: <p>Generation and installation of system startup
8968: scripts.</p>
8969: </li>
8970:
8971: <li>
8972: <p>Registration of system users and groups.</p>
8973: </li>
8974:
8975: <li>
8976: <p>Registration of system shells.</p>
8977: </li>
8978: </ul>
8979: </div>
8980:
8981: <p>The following sections inspect each of the above points
1.47 reed 8982: in detail. Note that in order to use any of the described
1.35 jmmv 8983: functionalities, you must add the following to your
1.45 wiz 8984: package's <code xmlns=
8985: "http://www.w3.org/TR/xhtml1/transitional" class=
8986: "filename">Makefile</code>:</p>
1.35 jmmv 8987: <pre class="programlisting">
1.51 rillig 8988: USE_PKGINSTALL= YES
1.35 jmmv 8989: </pre>
8990:
8991: <p>You may be thinking that many of the things described
8992: here could be easily done with simple code in the package's
8993: post-installation target (<code class=
8994: "literal">post-install</code>). <span class=
8995: "emphasis"><em>This is incorrect</em></span>, as the code
8996: in them is only executed when building from source.
8997: Machines using binary packages could not benefit from it at
8998: all (as the code itself could be unavailable). Therefore,
8999: the only way to achieve any of the items described above is
9000: by means of the installation scripts, which are
9001: automatically generated by pkginstall.</p>
1.1 grant 9002:
1.55 ! rillig 9003: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 9004: <div class="titlepage">
9005: <div>
9006: <div>
9007: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9008: "files-and-dirs-outside-prefix" id=
! 9009: "files-and-dirs-outside-prefix"></a>12.1. Files and
! 9010: directories outside the installation prefix</h2>
1.1 grant 9011: </div>
9012: </div>
9013: </div>
9014:
1.45 wiz 9015: <p>As you already know, the <code xmlns=
9016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9017: "filename">PLIST</code> file holds a list of files and
9018: directories that belong to a package. The names used in
1.45 wiz 9019: it are relative to the installation prefix (<code xmlns=
9020: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9021: "filename">${PREFIX}</code>), which means that it cannot
9022: register files outside this directory (absolute path
9023: names are not allowed). Despite this restriction, some
9024: packages need to install files outside this location;
1.45 wiz 9025: e.g., under <code xmlns=
9026: "http://www.w3.org/TR/xhtml1/transitional" class=
9027: "filename">${VARBASE}</code> or <code xmlns=
9028: "http://www.w3.org/TR/xhtml1/transitional" class=
9029: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9030:
9031: <p>The only way to achieve this is to create such files
9032: during installation time by using the installation
9033: scripts. These scripts can run arbitrary commands, so
9034: they have the potential to create and manage files
1.47 reed 9035: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9036: comes into play: it provides generic scripts to abstract
9037: the manipulation of such files and directories based on
1.45 wiz 9038: variables set in the package's <code xmlns=
9039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9040: "filename">Makefile</code>. The rest of this section
1.47 reed 9041: describes these variables.</p>
1.1 grant 9042:
1.55 ! rillig 9043: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9044: <div class="titlepage">
1.1 grant 9045: <div>
1.35 jmmv 9046: <div>
1.55 ! rillig 9047: <h3 class="title"><a name="dirs-outside-prefix"
! 9048: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9049: manipulation</h3>
9050: </div>
1.1 grant 9051: </div>
9052: </div>
9053:
1.35 jmmv 9054: <p>The following variables can be set to request the
1.47 reed 9055: creation of directories anywhere in the file
9056: system:</p>
1.27 rillig 9057:
1.35 jmmv 9058: <div class="itemizedlist">
9059: <ul type="disc">
9060: <li>
9061: <p><code class="varname">MAKE_DIRS</code> and
9062: <code class="varname">OWN_DIRS</code> contain a
9063: list of directories that should be created and
9064: should attempt to be destroyed by the
9065: installation scripts. The difference between the
9066: two is that the latter prompts the administrator
9067: to remove any directories that may be left after
9068: deinstallation (because they were not empty),
9069: while the former does not.</p>
9070: </li>
1.1 grant 9071:
1.35 jmmv 9072: <li>
9073: <p><code class="varname">MAKE_DIRS_PERMS</code>
9074: and <code class="varname">OWN_DIRS_PERMS</code>
9075: contain a list of tuples describing which
9076: directories should be created and should attempt
9077: to be destroyed by the installation scripts. Each
9078: tuple holds the following values, separated by
9079: spaces: the directory name, its owner, its group
9080: and its numerical mode. For example:</p>
9081: <pre class="programlisting">
1.51 rillig 9082: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9083: </pre>
1.1 grant 9084:
1.35 jmmv 9085: <p>The difference between the two is exactly the
9086: same as their non-<code class=
9087: "varname">PERMS</code> counterparts.</p>
9088: </li>
9089: </ul>
9090: </div>
9091: </div>
9092:
1.55 ! rillig 9093: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9094: <div class="titlepage">
9095: <div>
9096: <div>
1.55 ! rillig 9097: <h3 class="title"><a name="files-outside-prefix"
! 9098: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9099: manipulation</h3>
9100: </div>
9101: </div>
9102: </div>
9103:
9104: <p>Creating non-empty files outside the installation
1.45 wiz 9105: prefix is tricky because the <code xmlns=
9106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9107: "filename">PLIST</code> forces all files to be inside
9108: it. To overcome this problem, the only solution is to
9109: extract the file in the known place (i.e., inside the
9110: installation prefix) and copy it to the appropriate
9111: location during installation (done by the installation
9112: scripts generated by pkginstall). We will call the
9113: former the <span class="emphasis"><em>master
9114: file</em></span> in the following paragraphs, which
9115: describe the variables that can be used to
9116: automatically and consistently handle files outside the
9117: installation prefix:</p>
9118:
9119: <div class="itemizedlist">
9120: <ul type="disc">
9121: <li>
9122: <p><code class="varname">CONF_FILES</code> and
9123: <code class="varname">SUPPORT_FILES</code> are
9124: pairs of master and target files. During
9125: installation time, the master file is copied to
9126: the target one if and only if the latter does not
9127: exist. Upon deinstallation, the target file is
9128: removed provided that it was not modified by the
9129: installation.</p>
9130:
9131: <p>The difference between the two is that the
9132: latter prompts the administrator to remove any
9133: files that may be left after deinstallation
9134: (because they were not empty), while the former
9135: does not.</p>
9136: </li>
9137:
9138: <li>
9139: <p><code class="varname">CONF_FILES_PERMS</code>
9140: and <code class=
9141: "varname">SUPPORT_FILES_PERMS</code> contain
9142: tuples describing master files as well as their
9143: target locations. For each of them, it also
9144: specifies their owner, their group and their
9145: numeric permissions, in this order. For
9146: example:</p>
9147: <pre class="programlisting">
1.51 rillig 9148: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9149: </pre>
9150:
9151: <p>The difference between the two is exactly the
9152: same as their non-<code class=
9153: "varname">PERMS</code> counterparts.</p>
9154: </li>
9155: </ul>
9156: </div>
9157: </div>
9158: </div>
9159:
1.55 ! rillig 9160: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9161: <div class="titlepage">
9162: <div>
9163: <div>
9164: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9165: "conf-files" id="conf-files"></a>12.2.
! 9166: Configuration files</h2>
1.35 jmmv 9167: </div>
9168: </div>
9169: </div>
9170:
9171: <p>Configuration files are special in the sense that they
9172: are installed in their own specific directory,
9173: <code class="varname">PKG_SYSCONFDIR</code>, and need
9174: special treatment during installation (most of which is
9175: automated by pkginstall). The main concept you must bear
1.36 wiz 9176: in mind is that files marked as configuration files are
1.35 jmmv 9177: automatically copied to the right place (somewhere inside
9178: <code class="varname">PKG_SYSCONFDIR</code>) during
9179: installation <span class="emphasis"><em>if and only
9180: if</em></span> they didn't exist before. Similarly, they
9181: will not be removed if they have local modifications.
1.36 wiz 9182: This ensures that administrators never lose any custom
1.35 jmmv 9183: changes they may have made.</p>
9184:
1.55 ! rillig 9185: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9186: <div class="titlepage">
9187: <div>
9188: <div>
1.55 ! rillig 9189: <h3 class="title"><a name="conf-files-sysconfdir"
! 9190: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9191: <code class="varname">PKG_SYSCONFDIR</code> is
9192: set</h3>
9193: </div>
9194: </div>
9195: </div>
9196:
9197: <p>As said before, the <code class=
9198: "varname">PKG_SYSCONFDIR</code> variable specifies
9199: where configuration files shall be installed. Its
9200: contents are set based upon the following
9201: variables:</p>
9202:
9203: <div class="itemizedlist">
9204: <ul type="disc">
9205: <li>
9206: <p><code class="varname">PKG_SYSCONFBASE</code>:
9207: The configuration's root directory. Defaults to
1.45 wiz 9208: <code xmlns=
9209: "http://www.w3.org/TR/xhtml1/transitional" class=
9210: "filename">${PREFIX}/etc</code> although it may
9211: be overridden by the user to point to his
9212: preferred location (e.g., <code xmlns=
9213: "http://www.w3.org/TR/xhtml1/transitional" class=
9214: "filename">/etc</code>, <code xmlns=
9215: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9216: "filename">/etc/pkg</code>, etc.). Packages must
9217: not use it directly.</p>
9218: </li>
9219:
9220: <li>
9221: <p><code class=
9222: "varname">PKG_SYSCONFSUBDIR</code>: A
9223: subdirectory of <code class=
9224: "varname">PKG_SYSCONFBASE</code> under which the
9225: configuration files for the package being built
9226: shall be installed. The definition of this
9227: variable only makes sense in the package's
1.45 wiz 9228: <code xmlns=
9229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9230: "filename">Makefile</code> (i.e., it is not
9231: user-customizable).</p>
1.35 jmmv 9232:
9233: <p>As an example, consider the Apache package,
9234: <a xmlns=
9235: "http://www.w3.org/TR/xhtml1/transitional" href=
9236: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9237: target="_top"><code xmlns="" class=
9238: "filename">www/apache2</code></a>, which places
9239: its configuration files under the <code xmlns=
9240: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9241: "filename">httpd/</code> subdirectory of
9242: <code class="varname">PKG_SYSCONFBASE</code>.
9243: This should be set in the package Makefile.</p>
9244: </li>
9245:
9246: <li>
9247: <p><code class="varname">PKG_SYSCONFVAR</code>:
9248: Specifies the name of the variable that holds
9249: this package's configuration directory (if
9250: different from <code class=
9251: "varname">PKG_SYSCONFBASE</code>). It defaults to
9252: <code class="varname">PKGBASE</code>'s value, and
9253: is always prefixed with <code class=
9254: "literal">PKG_SYSCONFDIR</code>.</p>
9255: </li>
9256:
9257: <li>
9258: <p><code class=
9259: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9260: Holds the directory where the configuration files
9261: for the package identified by <code class=
9262: "varname">PKG_SYSCONFVAR</code>'s shall be
9263: placed.</p>
9264: </li>
9265: </ul>
9266: </div>
9267:
9268: <p>Based on the above variables, pkginstall determines
9269: the value of <code class=
9270: "varname">PKG_SYSCONFDIR</code>, which is the
9271: <span class="emphasis"><em>only</em></span> variable
9272: that can be used within a package to refer to its
9273: configuration directory. The algorithm used to set its
9274: value is basically the following:</p>
9275:
9276: <div class="orderedlist">
9277: <ol type="1">
9278: <li>
9279: <p>If <code class=
9280: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9281: is set, its value is used.</p>
9282: </li>
9283:
9284: <li>
9285: <p>If the previous variable is not defined but
9286: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9287: set in the package's <code xmlns=
9288: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9289: "filename">Makefile</code>, the resulting value
1.45 wiz 9290: is <code xmlns=
9291: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9292: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9293: </li>
9294:
9295: <li>
1.45 wiz 9296: <p>Otherwise, it is set to <code xmlns=
9297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9298: "filename">${PKG_SYSCONFBASE}</code>.</p>
9299: </li>
9300: </ol>
9301: </div>
9302:
1.45 wiz 9303: <p>It is worth mentioning that <code xmlns=
9304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9305: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9306: added to <code xmlns=
9307: "http://www.w3.org/TR/xhtml1/transitional" class=
9308: "filename">OWN_DIRS</code>. See <a href=
9309: "#dirs-outside-prefix" title=
1.55 ! rillig 9310: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9311: “Directory manipulation”</a> what this
9312: means.</p>
9313: </div>
9314:
1.55 ! rillig 9315: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9316: <div class="titlepage">
9317: <div>
9318: <div>
1.55 ! rillig 9319: <h3 class="title"><a name="conf-files-configure"
! 9320: id="conf-files-configure"></a>12.2.2. Telling the
! 9321: software where configuration files are</h3>
1.35 jmmv 9322: </div>
9323: </div>
9324: </div>
9325:
9326: <p>Given that pkgsrc (and users!) expect configuration
9327: files to be in a known place, you need to teach each
1.36 wiz 9328: package where it shall install its files. In some cases
1.35 jmmv 9329: you will have to patch the package Makefiles to achieve
9330: it. If you are lucky, though, it may be as easy as
9331: passing an extra flag to the configuration script; this
1.47 reed 9332: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9333: <pre class="programlisting">
1.51 rillig 9334: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9335: </pre>
9336:
9337: <p>Note that this specifies where the package has to
9338: <span class="emphasis"><em>look for</em></span> its
9339: configuration files, not where they will be originally
9340: installed (although the difference is never explicit,
9341: unfortunately).</p>
9342: </div>
9343:
1.55 ! rillig 9344: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9345: <div class="titlepage">
9346: <div>
9347: <div>
1.55 ! rillig 9348: <h3 class="title"><a name="conf-files-patching"
! 9349: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9350: installations</h3>
9351: </div>
9352: </div>
9353: </div>
9354:
9355: <p>As said before, pkginstall automatically handles
9356: configuration files. This means that <span class=
9357: "strong"><strong>the packages themselves must not touch
1.45 wiz 9358: the contents of <code xmlns=
9359: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9360: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9361: directly</strong></span>. Bad news is that many
9362: software installation scripts will, out of the box,
9363: mess with the contents of that directory. So what is
9364: the correct procedure to fix this issue?</p>
1.35 jmmv 9365:
9366: <p>You must teach the package (usually by manually
9367: patching it) to install any configuration files under
1.45 wiz 9368: the examples hierarchy, <code xmlns=
9369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9370: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9371: the <code xmlns=
9372: "http://www.w3.org/TR/xhtml1/transitional" class=
9373: "filename">PLIST</code> registers them and the
9374: administrator always has the original copies
1.35 jmmv 9375: available.</p>
9376:
9377: <p>Once the required configuration files are in place
9378: (i.e., under the examples hierarchy), the pkginstall
9379: framework can use them as master copies during the
1.45 wiz 9380: package installation to update what is in <code xmlns=
9381: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9382: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9383: the variables <code class="varname">CONF_FILES</code>
9384: and <code class="varname">CONF_FILES_PERMS</code> are
9385: used. Check out <a href="#files-outside-prefix" title=
1.55 ! rillig 9386: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9387: “File manipulation”</a> for information
9388: about their syntax and their purpose. Here is an
9389: example, taken from the <a xmlns=
9390: "http://www.w3.org/TR/xhtml1/transitional" href=
9391: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9392: target="_top"><code xmlns="" class=
9393: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9394: <pre class="programlisting">
1.51 rillig 9395: EGDIR= ${PREFIX}/share/doc/mutt/samples
9396: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9397: </pre>
9398:
9399: <p>Note that the <code class="varname">EGDIR</code>
9400: variable is specific to that package and has no meaning
9401: outside it.</p>
9402: </div>
9403:
1.55 ! rillig 9404: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9405: <div class="titlepage">
9406: <div>
9407: <div>
1.55 ! rillig 9408: <h3 class="title"><a name="conf-files-disable"
! 9409: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9410: handling of configuration files</h3>
9411: </div>
9412: </div>
9413: </div>
9414:
9415: <p>The automatic copying of config files can be toggled
9416: by setting the environment variable <code class=
9417: "varname">PKG_CONFIG</code> prior to package
9418: installation.</p>
9419: </div>
9420: </div>
9421:
1.55 ! rillig 9422: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9423: <div class="titlepage">
9424: <div>
9425: <div>
9426: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9427: "rcd-scripts" id="rcd-scripts"></a>12.3. System
! 9428: startup scripts</h2>
1.35 jmmv 9429: </div>
9430: </div>
9431: </div>
9432:
9433: <p>System startup scripts are special files because they
9434: must be installed in a place known by the underlying OS,
9435: usually outside the installation prefix. Therefore, the
9436: same rules described in <a href=
9437: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9438: "12.1. Files and directories outside the installation prefix">
1.55 ! rillig 9439: Section 12.1, “Files and directories outside the
! 9440: installation prefix”</a> apply, and the same
1.35 jmmv 9441: solutions can be used. However, pkginstall provides a
1.36 wiz 9442: special mechanism to handle these files.</p>
1.35 jmmv 9443:
9444: <p>In order to provide system startup scripts, the
9445: package has to:</p>
9446:
9447: <div class="orderedlist">
9448: <ol type="1">
9449: <li>
1.45 wiz 9450: <p>Store the script inside <code xmlns=
9451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9452: "filename">${FILESDIR}</code>, with the
9453: <code class="literal">.sh</code> suffix appended.
9454: Considering the <a xmlns=
9455: "http://www.w3.org/TR/xhtml1/transitional" href=
9456: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9457: target="_top"><code xmlns="" class=
9458: "filename">print/cups</code></a> package as an
9459: example, it has a <code xmlns=
9460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9461: "filename">cupsd.sh</code> in its files
9462: directory.</p>
9463: </li>
9464:
9465: <li>
9466: <p>Tell pkginstall to handle it, appending the name
9467: of the script, without its extension, to the
9468: <code class="varname">RCD_SCRIPTS</code> variable.
9469: Continuing the previous example:</p>
9470: <pre class="programlisting">
1.51 rillig 9471: RCD_SCRIPTS+= cupsd
1.35 jmmv 9472: </pre>
9473: </li>
9474: </ol>
9475: </div>
9476:
9477: <p>Once this is done, pkginstall will do the following
9478: steps for each script in an automated fashion:</p>
9479:
9480: <div class="orderedlist">
9481: <ol type="1">
9482: <li>
9483: <p>Process the file found in the files directory
9484: applying all the substitutions described in the
1.45 wiz 9485: <code xmlns=
9486: "http://www.w3.org/TR/xhtml1/transitional" class=
9487: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9488: </li>
9489:
9490: <li>
9491: <p>Copy the script from the files directory to the
1.45 wiz 9492: examples hierarchy, <code xmlns=
9493: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9494: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9495: Note that this master file must be explicitly
1.45 wiz 9496: registered in the <code xmlns=
9497: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9498: "filename">PLIST</code>.</p>
9499: </li>
9500:
9501: <li>
9502: <p>Add code to the installation scripts to copy the
9503: startup script from the examples hierarchy into the
9504: system-wide startup scripts directory.</p>
9505: </li>
9506: </ol>
9507: </div>
9508:
1.55 ! rillig 9509: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9510: <div class="titlepage">
9511: <div>
9512: <div>
1.55 ! rillig 9513: <h3 class="title"><a name="rcd-scripts-disable"
! 9514: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9515: handling of system startup scripts</h3>
9516: </div>
9517: </div>
9518: </div>
9519:
9520: <p>The automatic copying of config files can be toggled
9521: by setting the environment variable <code class=
9522: "varname">PKG_RCD_SCRIPTS</code> prior to package
9523: installation. Note that the scripts will be always
1.45 wiz 9524: copied inside the examples hierarchy, <code xmlns=
9525: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9526: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9527: matter what the value of this variable is.</p>
9528: </div>
9529: </div>
9530:
1.55 ! rillig 9531: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9532: <div class="titlepage">
9533: <div>
9534: <div>
9535: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9536: "users-and-groups" id="users-and-groups"></a>12.4.
! 9537: System users and groups</h2>
1.35 jmmv 9538: </div>
9539: </div>
9540: </div>
9541:
9542: <p>If a package needs to create special users and/or
9543: groups during installation, it can do so by using the
9544: pkginstall framework.</p>
9545:
9546: <p>Users can be created by adding entries to the
9547: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9548: entry has the following syntax, which mimics <code xmlns=
9549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9550: "filename">/etc/passwd</code>:</p>
9551: <pre class="programlisting">
1.51 rillig 9552: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9553: </pre>
9554:
9555: <p>Only the user and group are required; everything else
9556: is optional, but the colons must be in the right places
9557: when specifying optional bits. By default, a new user
1.45 wiz 9558: will have home directory <code xmlns=
9559: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9560: "filename">/nonexistent</code>, and login shell
1.45 wiz 9561: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9562: class="filename">/sbin/nologin</code> unless they are
9563: specified as part of the user element. Note that if the
1.51 rillig 9564: description contains spaces, then spaces should be
1.45 wiz 9565: backslash-escaped, as in:</p>
1.35 jmmv 9566: <pre class="programlisting">
1.51 rillig 9567: foo:foogrp::The\ Foomister
1.35 jmmv 9568: </pre>
9569:
9570: <p>Similarly, groups can be created using the
9571: <code class="varname">PKG_GROUPS</code> variable, whose
9572: syntax is:</p>
9573: <pre class="programlisting">
1.51 rillig 9574: group[:groupid]
1.35 jmmv 9575: </pre>
9576:
9577: <p>As before, only the group name is required; the
9578: numeric identifier is optional.</p>
9579: </div>
9580:
1.55 ! rillig 9581: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9582: <div class="titlepage">
9583: <div>
9584: <div>
9585: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9586: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9587: </div>
9588: </div>
9589: </div>
9590:
9591: <p>Packages that install system shells should register
1.45 wiz 9592: them in the shell database, <code xmlns=
9593: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9594: "filename">/etc/shells</code>, to make things easier to
9595: the administrator. This must be done from the
9596: installation scripts to keep binary packages working on
9597: any system. pkginstall provides an easy way to accomplish
9598: this task.</p>
9599:
9600: <p>When a package provides a shell interpreter, it has to
9601: set the <code class="varname">PKG_SHELL</code> variable
9602: to its absolute file name. This will add some hooks to
9603: the installation scripts to handle it. Consider the
9604: following example, taken from <a xmlns=
9605: "http://www.w3.org/TR/xhtml1/transitional" href=
9606: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9607: target="_top"><code xmlns="" class=
9608: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9609: <pre class="programlisting">
1.51 rillig 9610: USE_PKGINSTALL= YES
9611: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9612: </pre>
9613:
1.55 ! rillig 9614: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9615: <div class="titlepage">
9616: <div>
9617: <div>
1.55 ! rillig 9618: <h3 class="title"><a name="shells-disable" id=
! 9619: "shells-disable"></a>12.5.1. Disabling handling
! 9620: of configuration files</h3>
1.35 jmmv 9621: </div>
9622: </div>
9623: </div>
9624:
9625: <p>The automatic registration of shell interpreters can
9626: be disabled by the administrator by setting the
1.45 wiz 9627: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9628: class="filename">PKG_REGISTER_SHELLS</code> environment
9629: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9630: </div>
9631: </div>
9632: </div>
9633:
1.55 ! rillig 9634: <div class="chapter" lang="en" xml:lang="en">
1.35 jmmv 9635: <div class="titlepage">
9636: <div>
9637: <div>
1.55 ! rillig 9638: <h2 class="title"><a name="options" id=
1.38 dillo 9639: "options"></a>Chapter 13. Options
1.35 jmmv 9640: handling</h2>
9641: </div>
9642: </div>
9643: </div>
9644:
9645: <div class="toc">
9646: <p><b>Table of Contents</b></p>
9647:
9648: <dl>
9649: <dt><span class="sect1"><a href=
1.38 dillo 9650: "#global-default-options">13.1. Global default
1.35 jmmv 9651: options</a></span></dt>
9652:
9653: <dt><span class="sect1"><a href=
1.38 dillo 9654: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9655: use <code xmlns=
9656: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9657: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9658:
9659: <dt><span class="sect1"><a href="#option-names">13.3.
9660: Option Names</a></span></dt>
1.35 jmmv 9661: </dl>
9662: </div>
9663:
9664: <p>Many packages have the ability to be built to support
1.45 wiz 9665: different sets of features. <code xmlns=
9666: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9667: "filename">bsd.options.mk</code> is a framework in pkgsrc
9668: that provides generic handling of those options that
9669: determine different ways in which the packages can be
9670: built. It's possible for the user to specify exactly which
9671: sets of options will be built into a package or to allow a
9672: set of global default options apply.</p>
9673:
1.55 ! rillig 9674: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9675: <div class="titlepage">
9676: <div>
9677: <div>
9678: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9679: "global-default-options" id=
1.38 dillo 9680: "global-default-options"></a>13.1. Global
1.35 jmmv 9681: default options</h2>
9682: </div>
9683: </div>
9684: </div>
9685:
9686: <p>Global default options are listed in <code class=
9687: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9688: the options that should be built into every package if
9689: that option is supported. This variable should be set in
1.45 wiz 9690: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9691: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9692: </div>
9693:
1.55 ! rillig 9694: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9695: <div class="titlepage">
9696: <div>
9697: <div>
9698: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9699: "converting-to-options" id=
1.38 dillo 9700: "converting-to-options"></a>13.2. Converting
1.45 wiz 9701: packages to use <code xmlns=
9702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9703: "filename">bsd.options.mk</code></h2>
9704: </div>
9705: </div>
9706: </div>
9707:
1.45 wiz 9708: <p>The following example shows how <code xmlns=
9709: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9710: "filename">bsd.options.mk</code> should be used by the
9711: hypothetical ``wibble'' package, either in the package
1.45 wiz 9712: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9713: class="filename">Makefile</code>, or in a file, e.g.
9714: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9715: class="filename">options.mk</code>, that is included by
9716: the main package <code xmlns=
9717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9718: "filename">Makefile</code>.</p>
9719: <pre class="programlisting">
1.51 rillig 9720: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9721: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9722: PKG_OPTIONS_OPTIONAL_GROUPS= database
9723: PKG_OPTIONS_GROUP.database= mysql pgsql
9724: PKG_SUGGESTED_OPTIONS= wibble-foo
9725: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9726: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9727:
9728: .include "../../mk/bsd.prefs.mk"
9729:
9730: # this package was previously named wibble2
9731: .if defined(PKG_OPTIONS.wibble2)
9732: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
9733: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
9734: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
9735: .endif
9736:
9737: .include "../../mk/bsd.options.mk"
9738:
9739: # Package-specific option-handling
9740:
9741: ###
9742: ### FOO support
9743: ###
9744: .if !empty(PKG_OPTIONS:Mwibble-foo)
9745: CONFIGURE_ARGS+= --enable-foo
9746: .endif
9747:
9748: ###
9749: ### LDAP support
9750: ###
9751: .if !empty(PKG_OPTIONS:Mldap)
9752: . include "../../databases/openldap/buildlink3.mk"
9753: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
9754: .endif
9755:
9756: ###
9757: ### database support
9758: ###
9759: .if !empty(PKG_OPTIONS:Mmysql)
9760: . include "../../mk/mysql.buildlink3.mk"
9761: .endif
9762: .if !empty(PKG_OPTIONS:Mpgsql)
9763: . include "../../mk/pgsql.buildlink3.mk"
9764: .endif
1.1 grant 9765: </pre>
9766:
1.28 rillig 9767: <p>The first section contains the information about which
9768: build options are supported by the package, and any
1.1 grant 9769: default options settings if needed.</p>
9770:
9771: <div class="orderedlist">
9772: <ol type="1">
9773: <li>
1.14 xtraeme 9774: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9775: the name of the <a href=
1.1 grant 9776: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9777: <span class="citerefentry"><span class=
1.27 rillig 9778: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9779: that the user can set to override the default
9780: options. It should be set to “<span class=
9781: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9782: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9783: </li>
9784:
9785: <li>
1.14 xtraeme 9786: <p><code class=
9787: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9788: build options supported by the package.</p>
9789: </li>
9790:
9791: <li>
9792: <p><code class=
9793: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9794: list of names of groups of mutually exclusive
9795: options. The options in each group are listed in
9796: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9797: "replaceable"><code>groupname</code></em></code>.
9798: The most specific setting of any option from the
9799: group takes precedence over all other options in
9800: the group. Options from the groups will be
9801: automatically added to <code class=
9802: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9803: </li>
9804:
9805: <li>
9806: <p><code class=
9807: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9808: like <code class=
9809: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9810: building the packages will fail if no option from
9811: the group is selected.</p>
1.1 grant 9812: </li>
9813:
9814: <li>
1.27 rillig 9815: <p><code class=
1.44 gdt 9816: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9817: list of names of sets of options. At least one
9818: option from each set must be selected. The options
9819: in each set are listed in <code class=
9820: "varname">PKG_OPTIONS_SET.<em class=
9821: "replaceable"><code>setname</code></em></code>.
9822: Options from the sets will be automatically added
9823: to <code class=
9824: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9825: the package will fail if no option from the set is
9826: selected.</p>
9827: </li>
9828:
9829: <li>
9830: <p><code class=
1.27 rillig 9831: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9832: build options which are enabled by default.</p>
9833: </li>
9834:
9835: <li>
1.37 dillo 9836: <p><code class=
9837: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9838: of “<span class="quote"><em class=
1.55 ! rillig 9839: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
! 9840: <code>option</code></em></span>” pairs that
! 9841: map legacy <code xmlns=
1.45 wiz 9842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9843: "filename">/etc/mk.conf</code> variables to their
9844: option counterparts. Pairs should be added with
9845: “<span class="quote">+=</span>” to keep
9846: the listing of global legacy variables. A warning
9847: will be issued if the user uses a legacy
9848: variable.</p>
9849: </li>
1.1 grant 9850:
1.37 dillo 9851: <li>
9852: <p><code class=
9853: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9854: of “<span class="quote"><em class=
1.55 ! rillig 9855: "replaceable"><code>old-option</code></em>:<em class="replaceable">
! 9856: <code>new-option</code></em></span>” pairs
! 9857: that map options that have been renamed to their
! 9858: new counterparts. Pairs should be added with
1.37 dillo 9859: “<span class="quote">+=</span>” to keep
9860: the listing of global legacy options. A warning
9861: will be issued if the user uses a legacy
9862: option.</p>
9863: </li>
1.1 grant 9864:
1.37 dillo 9865: <li>
9866: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9867: is a list of options implied by deprecated
9868: variables used. This can be used for cases that
9869: neither <code class=
9870: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9871: <code class=
9872: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9873: handle, e. g. when <code class=
9874: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9875: </li>
9876:
9877: <li>
1.37 dillo 9878: <p><code class=
9879: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9880: a list of warnings about deprecated variables or
9881: options used, and what to use instead.</p>
1.1 grant 9882: </li>
1.28 rillig 9883: </ol>
1.1 grant 9884: </div>
9885:
1.37 dillo 9886: <p>A package should never modify <code class=
9887: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9888: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9889: These are strictly user-settable. To suggest a default
9890: set of options, use <code class=
9891: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9892:
1.42 dillo 9893: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 9894: defined before including <code xmlns=
9895: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9896: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9897: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9898: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9899: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 9900: are defined (as can happen with platform-specific options
1.42 dillo 9901: if none of them is supported on the current platform),
9902: <code class="varname">PKG_OPTIONS</code> is set to the
9903: empty list and the package is otherwise treated as not
9904: using the options framework.</p>
1.37 dillo 9905:
1.45 wiz 9906: <p>After the inclusion of <code xmlns=
9907: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9908: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9909: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9910: list of selected build options, properly filtered to
1.28 rillig 9911: remove unsupported and duplicate options.</p>
9912:
1.1 grant 9913: <p>The remaining sections contain the logic that is
1.37 dillo 9914: specific to each option. The correct way to check for an
9915: option is to check whether it is listed in <code class=
9916: "varname">PKG_OPTIONS</code>:</p>
9917: <pre class="programlisting">
1.51 rillig 9918: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 9919: "replaceable"><code>option</code></em>)
9920: </pre>
1.48 dillo 9921: </div>
1.37 dillo 9922:
1.55 ! rillig 9923: <div class="sect1" lang="en" xml:lang="en">
1.48 dillo 9924: <div class="titlepage">
9925: <div>
9926: <div>
9927: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 9928: "option-names" id=
1.48 dillo 9929: "option-names"></a>13.3. Option Names</h2>
9930: </div>
9931: </div>
9932: </div>
9933:
9934: <p>Options that enable similar features in different
9935: packages (like optional support for a library) should use
9936: a common name in all packages that support it (like the
9937: name of the library). If another package already has an
9938: option with the same meaning, use the same name.</p>
9939:
9940: <p>Options that enable features specific to one package,
9941: where it's unlikely that another (unrelated) package has
9942: the same (or a similar) optional feature, should use a
9943: name prefixed with <code class="varname"><em class=
9944: "replaceable"><code>pkgname</code></em>-</code>.</p>
9945:
9946: <p>If a group of related packages share an optional
9947: feature specific to that group, prefix it with the name
9948: of the “<span class="quote">main</span>”
9949: package (e. g. <code class=
9950: "varname">djbware-errno-hack</code>).</p>
9951:
9952: <p>For new options, add a line to <code xmlns=
9953: "http://www.w3.org/TR/xhtml1/transitional" class=
9954: "filename">mk/defaults/options.description</code>. Lines
9955: have two fields, separated by tab. The first field is the
9956: option name, the second its description. The description
9957: should be a whole sentence (starting with an uppercase
9958: letter and ending with a period) that describes what
9959: enabling the option does. E. g. “<span class=
9960: "quote">Enable ispell support.</span>” The file is
9961: sorted by option names.</p>
1.1 grant 9962: </div>
9963: </div>
9964:
1.55 ! rillig 9965: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 9966: <div class="titlepage">
9967: <div>
9968: <div>
1.55 ! rillig 9969: <h2 class="title"><a name="build" id=
1.38 dillo 9970: "build"></a>Chapter 14. The build
1.1 grant 9971: process</h2>
9972: </div>
9973: </div>
9974: </div>
9975:
9976: <div class="toc">
9977: <p><b>Table of Contents</b></p>
9978:
9979: <dl>
1.38 dillo 9980: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 9981: Program location</a></span></dt>
9982:
1.38 dillo 9983: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 9984: Main targets</a></span></dt>
1.1 grant 9985:
9986: <dt><span class="sect1"><a href=
1.38 dillo 9987: "#build.helpful-targets">14.3. Other helpful
1.1 grant 9988: targets</a></span></dt>
9989: </dl>
9990: </div>
9991:
9992: <p>The basic steps for building a program are always the
9993: same. First the program's source (<span class=
9994: "emphasis"><em>distfile</em></span>) must be brought to the
9995: local system and then extracted. After any patches to
9996: compile properly on NetBSD are applied, the software can be
9997: configured, then built (usually by compiling), and finally
9998: the generated binaries, etc. can be put into place on the
9999: system. These are exactly the steps performed by the NetBSD
10000: package system, which is implemented as a series of targets
1.45 wiz 10001: in a central Makefile, <code xmlns=
10002: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10003: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 10004:
1.55 ! rillig 10005: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10006: <div class="titlepage">
10007: <div>
10008: <div>
10009: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 10010: "build.prefix" id=
1.38 dillo 10011: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 10012: </div>
10013: </div>
10014: </div>
10015:
10016: <p>Before outlining the process performed by the NetBSD
10017: package system in the next section, here's a brief
10018: discussion on where programs are installed, and which
10019: variables influence this.</p>
10020:
1.14 xtraeme 10021: <p>The automatic variable <code class=
10022: "varname">PREFIX</code> indicates where all files of the
10023: final program shall be installed. It is usually set to
1.45 wiz 10024: <code class="varname">LOCALBASE</code> (<code xmlns=
10025: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10026: "filename">/usr/pkg</code>), or <code class=
10027: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10028: “<span class="quote">cross</span>” category.
1.14 xtraeme 10029: The value of <code class="varname">PREFIX</code> needs to
10030: be put into the various places in the program's source
10031: where paths to these files are encoded. See <a href=
1.1 grant 10032: "#components.patches" title=
1.38 dillo 10033: "8.3. patches/*">Section 8.3,
1.1 grant 10034: “patches/*”</a> and <a href="#fixes.libtool"
10035: title=
1.38 dillo 10036: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 10037: “Shared libraries - libtool”</a> for more
10038: details.</p>
10039:
10040: <p>When choosing which of these variables to use, follow
10041: the following rules:</p>
10042:
10043: <div class="itemizedlist">
10044: <ul type="disc">
10045: <li>
1.14 xtraeme 10046: <p><code class="varname">PREFIX</code> always
10047: points to the location where the current pkg will
10048: be installed. When referring to a pkg's own
1.1 grant 10049: installation path, use “<span class=
10050: "quote">${PREFIX}</span>”.</p>
10051: </li>
10052:
10053: <li>
1.14 xtraeme 10054: <p><code class="varname">LOCALBASE</code> is where
10055: all non-X11 pkgs are installed. If you need to
1.1 grant 10056: construct a -I or -L argument to the compiler to
10057: find includes and libraries installed by another
10058: non-X11 pkg, use “<span class=
10059: "quote">${LOCALBASE}</span>”.</p>
10060: </li>
10061:
10062: <li>
1.14 xtraeme 10063: <p><code class="varname">X11BASE</code> is where
10064: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10065: installed. When looking for <span class=
10066: "emphasis"><em>standard</em></span> X11 includes
10067: (not those installed by a pkg), use
10068: “<span class=
10069: "quote">${X11BASE}</span>”.</p>
10070: </li>
10071:
10072: <li>
1.47 reed 10073: <p>X11-based packages are special in that they may
10074: be installed in either <code class=
1.14 xtraeme 10075: "varname">X11BASE</code> or <code class=
10076: "varname">LOCALBASE</code>.</p>
1.1 grant 10077:
10078: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10079: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10080: possible. Note that you will need to include
1.45 wiz 10081: <code xmlns=
10082: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10083: "filename">../../mk/x11.buildlink3.mk</code> in
10084: them to request the presence of X11 and to get the
10085: right compilation flags.</p>
1.1 grant 10086:
10087: <p>Even though, there are some packages that cannot
1.14 xtraeme 10088: be installed under <code class=
10089: "varname">LOCALBASE</code>: those that come with
1.1 grant 10090: app-defaults files. These packages are special and
1.14 xtraeme 10091: they must be placed under <code class=
10092: "varname">X11BASE</code>. To accomplish this, set
10093: either <code class="varname">USE_X11BASE</code> or
10094: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10095: package.</p>
10096:
1.34 wiz 10097: <p>Some notes: If you need to find includes or
1.14 xtraeme 10098: libraries installed by a pkg that has <code class=
10099: "varname">USE_IMAKE</code> or <code class=
10100: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10101: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10102: class="filename">Makefile</code>, you need to look
10103: in <span class="emphasis"><em>both</em></span>
10104: <code xmlns=
10105: "http://www.w3.org/TR/xhtml1/transitional" class=
10106: "filename">${X11BASE}</code> and <code xmlns=
10107: "http://www.w3.org/TR/xhtml1/transitional" class=
10108: "filename">${LOCALBASE}</code>. To force
10109: installation of all X11 packages in <code class=
10110: "varname">LOCALBASE</code>, the <a xmlns=
10111: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10112: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10113: target="_top"><code xmlns="" class=
10114: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10115: enabled by default.</p>
1.1 grant 10116: </li>
10117:
10118: <li>
1.14 xtraeme 10119: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10120: used to refer to the installed location of an X11
1.14 xtraeme 10121: package. <code class="varname">X11PREFIX</code>
10122: will be set to <code class="varname">X11BASE</code>
10123: if xpkgwedge is not installed, and to <code class=
10124: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10125: installed.</p>
10126: </li>
10127:
10128: <li>
10129: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10130: have some packages installed in <code class=
10131: "varname">X11BASE</code> and some in <code class=
10132: "varname">LOCALBASE</code>. To determine the prefix
10133: of an installed package, the <code class=
10134: "varname">EVAL_PREFIX</code> definition can be
10135: used. It takes pairs in the format
10136: “<span class=
1.1 grant 10137: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10138: the <a href=
10139: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10140: <span class="citerefentry"><span class=
10141: "refentrytitle">make</span>(1)</span></a> variable
10142: <code class="varname">DIRNAME</code> will be set to
10143: the prefix of the installed package
10144: <package>, or “<span class=
1.1 grant 10145: "quote">${X11PREFIX}</span>” if the package
10146: is not installed.</p>
10147:
10148: <p>This is best illustrated by example.</p>
10149:
1.45 wiz 10150: <p>The following lines are taken from <code xmlns=
10151: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10152: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10153: <pre class="programlisting">
1.51 rillig 10154: EVAL_PREFIX+= GTKDIR=gtk+
10155: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10156: --with-gtk-prefix="${GTKDIR}" \
10157: --enable-multibyte
1.1 grant 10158: </pre>
10159:
10160: <p>Specific defaults can be defined for the
1.14 xtraeme 10161: packages evaluated using <code class=
10162: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10163: of the form:</p>
10164: <pre class="programlisting">
1.51 rillig 10165: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10166: </pre>
10167:
1.14 xtraeme 10168: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10169: corresponds to the first definition in the
1.14 xtraeme 10170: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10171: </li>
10172:
10173: <li>
1.45 wiz 10174: <p>Within <code xmlns=
10175: "http://www.w3.org/TR/xhtml1/transitional" class=
10176: "filename">${PREFIX}</code>, packages should
10177: install files according to <a href=
1.24 wiz 10178: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10179: <span class="citerefentry"><span class=
10180: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10181: exception that manual pages go into <code xmlns=
10182: "http://www.w3.org/TR/xhtml1/transitional" class=
10183: "filename">${PREFIX}/man</code>, not <code xmlns=
10184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10185: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10186: </li>
10187: </ul>
10188: </div>
10189: </div>
10190:
1.55 ! rillig 10191: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10192: <div class="titlepage">
10193: <div>
10194: <div>
10195: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 10196: "main-targets" id=
1.38 dillo 10197: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 10198: </div>
10199: </div>
10200: </div>
10201:
10202: <p>The main targets used during the build process defined
1.45 wiz 10203: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10204: class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 10205:
10206: <div class="variablelist">
10207: <dl>
10208: <dt><span class="term">fetch</span></dt>
10209:
10210: <dd>
10211: <p>This will check if the file(s) given in the
1.14 xtraeme 10212: variables <code class="varname">DISTFILES</code>
10213: and <code class="varname">PATCHFILES</code> (as
10214: defined in the package's Makefile) are present on
1.45 wiz 10215: the local system in <code xmlns=
10216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10217: "filename">/usr/pkgsrc/distfiles</code>. If they
10218: are not present, an attempt will be made to fetch
10219: them using commands of the form:</p>
1.1 grant 10220: <pre class="programlisting">
1.51 rillig 10221: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10222: </pre>
10223:
10224: <p>where ${site} varies through several
1.14 xtraeme 10225: possibilities in turn: first, <code class=
10226: "varname">MASTER_SITE_OVERRIDE</code> is tried,
10227: then the sites specified in either <code class=
10228: "varname">SITES_file</code> if defined, else
10229: <code class="varname">MASTER_SITES</code> or
10230: <code class="varname">PATCH_SITES</code>, as
10231: applies, then finally the value of <code class=
10232: "varname">MASTER_SITE_BACKUP</code>. The order of
10233: all except the first can be optionally sorted by
10234: the user, via setting either <code class=
10235: "varname">MASTER_SORT_AWK</code> or <code class=
10236: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 10237: </dd>
10238:
10239: <dt><span class="term">checksum</span></dt>
10240:
10241: <dd>
10242: <p>After the distfile(s) are fetched, their
10243: checksum is generated and compared with the
10244: checksums stored in the distinfo file. If the
10245: checksums don't match, the build is aborted. This
10246: is to ensure the same distfile is used for
10247: building, and that the distfile wasn't changed,
10248: e.g. by some malign force, deliberately changed
10249: distfiles on the master distribution site or
10250: network lossage.</p>
10251: </dd>
10252:
10253: <dt><span class="term">extract</span></dt>
10254:
10255: <dd>
10256: <p>When the distfiles are present on the local
10257: system, they need to be extracted, as they are
10258: usually in the form of some compressed archive
1.45 wiz 10259: format, most commonly <code xmlns=
10260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10261: "filename">.tar.gz</code>.</p>
1.1 grant 10262:
10263: <p>If only some of the distfiles need to be
10264: uncompressed, the files to be uncompressed should
1.14 xtraeme 10265: be put into <code class=
10266: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10267:
1.45 wiz 10268: <p>If the distfiles are not in <code xmlns=
10269: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10270: "filename">.tar.gz</code> format, they can be
10271: extracted by setting either <code class=
10272: "varname">EXTRACT_SUFX</code>, or <code class=
10273: "varname">EXTRACT_CMD</code>, <code class=
10274: "varname">EXTRACT_BEFORE_ARGS</code> and
10275: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
10276: the former case, pkgsrc knows how to extract a
1.45 wiz 10277: number of suffixes (<code xmlns=
10278: "http://www.w3.org/TR/xhtml1/transitional" class=
10279: "filename">.tar.gz</code>, <code xmlns=
10280: "http://www.w3.org/TR/xhtml1/transitional" class=
10281: "filename">.tgz</code>, <code xmlns=
10282: "http://www.w3.org/TR/xhtml1/transitional" class=
10283: "filename">.tar.gz2</code>, <code xmlns=
10284: "http://www.w3.org/TR/xhtml1/transitional" class=
10285: "filename">.tbz</code>, <code xmlns=
10286: "http://www.w3.org/TR/xhtml1/transitional" class=
10287: "filename">.tar.Z</code>, <code xmlns=
10288: "http://www.w3.org/TR/xhtml1/transitional" class=
10289: "filename">.tar</code>, <code xmlns=
10290: "http://www.w3.org/TR/xhtml1/transitional" class=
10291: "filename">.shar.gz</code>, <code xmlns=
10292: "http://www.w3.org/TR/xhtml1/transitional" class=
10293: "filename">.shar.bz2</code>, <code xmlns=
10294: "http://www.w3.org/TR/xhtml1/transitional" class=
10295: "filename">.shar.Z</code>, <code xmlns=
10296: "http://www.w3.org/TR/xhtml1/transitional" class=
10297: "filename">.shar</code>, <code xmlns=
10298: "http://www.w3.org/TR/xhtml1/transitional" class=
10299: "filename">.Z</code>, <code xmlns=
10300: "http://www.w3.org/TR/xhtml1/transitional" class=
10301: "filename">.bz2</code> and <code xmlns=
10302: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10303: "filename">.gz</code>; see the definition of the
10304: various <code class="varname">DECOMPRESS_CMD</code>
1.47 reed 10305: variables in <code xmlns=
1.45 wiz 10306: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 10307: "filename">bsd.pkg.extract.mk</code> for a complete
10308: list). Here's an example on how to use the other
10309: variables for a program that comes with a
10310: compressed shell archive whose name ends in
10311: <code xmlns=
1.45 wiz 10312: "http://www.w3.org/TR/xhtml1/transitional" class=
10313: "filename">.msg.gz</code>:</p>
1.1 grant 10314: <pre class="programlisting">
1.51 rillig 10315: EXTRACT_SUFX= .msg.gz
10316: EXTRACT_CMD= zcat
10317: EXTRACT_BEFORE_ARGS=
10318: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10319: </pre>
10320: </dd>
10321:
10322: <dt><span class="term">patch</span></dt>
10323:
10324: <dd>
10325: <p>After extraction, all the patches named by the
1.14 xtraeme 10326: <code class="varname">PATCHFILES</code>, those
10327: present in the patches subdirectory of the package
10328: as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45 wiz 10329: <code xmlns=
10330: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10331: "filename">/usr/local/patches/graphics/png</code>)
1.45 wiz 10332: are applied. Patchfiles ending in <code xmlns=
10333: "http://www.w3.org/TR/xhtml1/transitional" class=
10334: "filename">.Z</code> or <code xmlns=
10335: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10336: "filename">.gz</code> are uncompressed before they
1.45 wiz 10337: are applied, files ending in <code xmlns=
10338: "http://www.w3.org/TR/xhtml1/transitional" class=
10339: "filename">.orig</code> or <code xmlns=
10340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10341: "filename">.rej</code> are ignored. Any special
1.24 wiz 10342: options to <a href=
10343: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10344: <span class="citerefentry"><span class=
10345: "refentrytitle">patch</span>(1)</span></a> can be
10346: handed in <code class=
1.14 xtraeme 10347: "varname">PATCH_DIST_ARGS</code>. See <a href=
10348: "#components.patches" title=
1.38 dillo 10349: "8.3. patches/*">Section 8.3,
1.1 grant 10350: “patches/*”</a> for more details.</p>
10351:
1.24 wiz 10352: <p>By default <a href=
10353: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10354: <span class="citerefentry"><span class=
10355: "refentrytitle">patch</span>(1)</span></a> is given
10356: special args to make it fail if the patches apply
10357: with some lines of fuzz. Please fix (regen) the
10358: patches so that they apply cleanly. The rationale
10359: behind this is that patches that don't apply
10360: cleanly may end up being applied in the wrong
10361: place, and cause severe harm there.</p>
1.1 grant 10362: </dd>
10363:
10364: <dt><span class="term">configure</span></dt>
10365:
10366: <dd>
10367: <p>Most pieces of software need information on the
10368: header files, system calls, and library routines
10369: which are available in NetBSD. This is the process
10370: known as configuration, and is usually automated.
10371: In most cases, a script is supplied with the
10372: source, and its invocation results in generation of
10373: header files, Makefiles, etc.</p>
10374:
10375: <p>If the program's distfile contains its own
10376: configure script, this can be invoked by setting
1.14 xtraeme 10377: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 10378: configure script is a GNU autoconf script,
1.14 xtraeme 10379: <code class="varname">GNU_CONFIGURE</code> should
10380: be specified instead. In either case, any arguments
10381: to the configure script can be specified in the
10382: <code class="varname">CONFIGURE_ARGS</code>
10383: variable, and the configure script's name can be
10384: set in <code class=
10385: "varname">CONFIGURE_SCRIPT</code> if it differs
10386: from the default “<span class=
1.1 grant 10387: "quote">configure</span>”. Here's an example
10388: from the <a xmlns=
10389: "http://www.w3.org/TR/xhtml1/transitional" href=
10390: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45 wiz 10391: target="_top"><code xmlns="" class=
10392: "filename">sysutils/top</code></a> package:</p>
1.1 grant 10393: <pre class="programlisting">
1.51 rillig 10394: HAS_CONFIGURE= yes
10395: CONFIGURE_SCRIPT= Configure
10396: CONFIGURE_ARGS+= netbsd13
1.1 grant 10397: </pre>
10398:
10399: <p>If the program uses an Imakefile for
10400: configuration, the appropriate steps can be invoked
1.14 xtraeme 10401: by setting <code class="varname">USE_IMAKE</code>
10402: to “<span class="quote">YES</span>”.
10403: (If you only want the package installed in
10404: <code class="varname">$X11PREFIX</code> but xmkmf
10405: not being run, set <code class=
10406: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 10407: </dd>
10408:
10409: <dt><span class="term">build</span></dt>
10410:
10411: <dd>
10412: <p>Once configuration has taken place, the software
1.14 xtraeme 10413: will be built by invoking <code class=
10414: "varname">$MAKE_PROGRAM</code> on <code class=
10415: "varname">$MAKEFILE</code> with <code class=
10416: "varname">$BUILD_TARGET</code> as the target to
10417: build. The default <code class=
10418: "varname">MAKE_PROGRAM</code> is
10419: “<span class="quote">gmake</span>” if
1.29 rillig 10420: <code class="varname">USE_TOOLS</code> contains
10421: “<span class="quote">gmake</span>”,
1.1 grant 10422: “<span class="quote">make</span>”
1.14 xtraeme 10423: otherwise. <code class="varname">MAKEFILE</code> is
10424: set to “<span class=
1.1 grant 10425: "quote">Makefile</span>” by default, and
1.14 xtraeme 10426: <code class="varname">BUILD_TARGET</code> defaults
10427: to “<span class="quote">all</span>”.
10428: Any of these variables can be set in the package's
1.1 grant 10429: Makefile to change the default build process.</p>
10430: </dd>
10431:
10432: <dt><span class="term">install</span></dt>
10433:
10434: <dd>
10435: <p>Once the build stage has completed, the final
10436: step is to install the software in public
10437: directories, so users can access the programs and
1.14 xtraeme 10438: files. As in the build-target, <code class=
10439: "varname">$MAKE_PROGRAM</code> is invoked on
10440: <code class="varname">$MAKEFILE</code> here, but
10441: with the <code class=
10442: "varname">$INSTALL_TARGET</code> instead, the
10443: latter defaulting to “<span class=
10444: "quote">install</span>” (plus
10445: “<span class=
10446: "quote">install.man</span>”, if <code class=
10447: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 10448: </dd>
10449: </dl>
10450: </div>
10451:
10452: <p>If no target is specified, the default is
10453: “<span class="quote">build</span>”. If a
10454: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 10455: e.g. <span><strong class="command">make
10456: build</strong></span> will also perform the equivalent
10457: of:</p>
1.1 grant 10458: <pre class="programlisting">
1.51 rillig 10459: make fetch
10460: make checksum
10461: make extract
10462: make patch
10463: make configure
10464: make build
1.1 grant 10465: </pre>
10466: </div>
10467:
1.55 ! rillig 10468: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10469: <div class="titlepage">
10470: <div>
10471: <div>
10472: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 10473: "build.helpful-targets" id=
1.38 dillo 10474: "build.helpful-targets"></a>14.3. Other
1.1 grant 10475: helpful targets</h2>
10476: </div>
10477: </div>
10478: </div>
10479:
10480: <div class="variablelist">
10481: <dl>
10482: <dt><span class="term">pre/post-*</span></dt>
10483:
10484: <dd>
10485: <p>For any of the main targets described in the
10486: previous section, two auxiliary targets exist with
10487: “<span class="quote">pre-</span>” and
10488: “<span class="quote">post-</span>” used
10489: as a prefix for the main target's name. These
10490: targets are invoked before and after the main
10491: target is called, allowing extra configuration or
10492: installation steps be performed from a package's
10493: Makefile, for example, which a program's configure
10494: script or install target omitted.</p>
10495: </dd>
10496:
10497: <dt><span class="term">do-*</span></dt>
10498:
10499: <dd>
10500: <p>Should one of the main targets do the wrong
10501: thing, and should there be no variable to fix this,
10502: you can redefine it with the do-* target. (Note
10503: that redefining the target itself instead of the
10504: do-* target is a bad idea, as the pre-* and post-*
10505: targets won't be called anymore, etc.) You will not
10506: usually need to do this.</p>
10507: </dd>
10508:
10509: <dt><span class="term">reinstall</span></dt>
10510:
10511: <dd>
1.14 xtraeme 10512: <p>If you did a <span><strong class="command">make
10513: install</strong></span> and you noticed some file
10514: was not installed properly, you can repeat the
1.1 grant 10515: installation with this target, which will ignore
10516: the “<span class="quote">already
10517: installed</span>” flag.</p>
10518: </dd>
10519:
10520: <dt><span class="term">deinstall</span></dt>
10521:
10522: <dd>
1.24 wiz 10523: <p>This target does a <a href=
10524: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10525: <span class="citerefentry"><span class=
10526: "refentrytitle">pkg_delete</span>(1)</span></a> in
10527: the current directory, effectively de-installing
10528: the package. The following variables can be used to
10529: tune the behaviour:</p>
1.1 grant 10530:
10531: <div class="variablelist">
10532: <dl>
1.14 xtraeme 10533: <dt><span class="term"><code class=
10534: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10535:
10536: <dd>
10537: <p>Add a "-v" to the <a href=
10538: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10539: <span class="citerefentry"><span class=
10540: "refentrytitle">pkg_delete</span>(1)</span></a>
10541: command.</p>
10542: </dd>
10543:
1.14 xtraeme 10544: <dt><span class="term"><code class=
10545: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10546:
10547: <dd>
10548: <p>Remove all packages that require (depend
10549: on) the given package. This can be used to
10550: remove any packages that may have been pulled
10551: in by a given package, e.g. if
1.14 xtraeme 10552: <span><strong class="command">make deinstall
10553: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10554: <code xmlns=
10555: "http://www.w3.org/TR/xhtml1/transitional"
10556: class="filename">pkgsrc/x11/kde</code>, this
10557: is likely to remove whole KDE. Works by
1.1 grant 10558: adding “<span class=
10559: "quote">-R</span>” to the <a href=
10560: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10561: <span class="citerefentry"><span class=
10562: "refentrytitle">pkg_delete</span>(1)</span></a>
10563: command line.</p>
10564: </dd>
10565: </dl>
10566: </div>
10567: </dd>
10568:
10569: <dt><span class="term">update</span></dt>
10570:
10571: <dd>
10572: <p>This target causes the current package to be
10573: updated to the latest version. The package and all
10574: depending packages first get de-installed, then
10575: current versions of the corresponding packages get
10576: compiled and installed. This is similar to manually
10577: noting which packages are currently installed, then
1.14 xtraeme 10578: performing a series of <span><strong class=
10579: "command">make deinstall</strong></span> and
10580: <span><strong class="command">make
10581: install</strong></span> (or whatever <code class=
10582: "varname">UPDATE_TARGET</code> is set to) for these
10583: packages.</p>
1.1 grant 10584:
10585: <p>You can use the “<span class=
10586: "quote">update</span>” target to resume
1.14 xtraeme 10587: package updating in case a previous
10588: <span><strong class="command">make
10589: update</strong></span> was interrupted for some
10590: reason. However, in this case, make sure you don't
10591: call <span><strong class="command">make
10592: clean</strong></span> or otherwise remove the list
10593: of dependent packages in <code class=
1.47 reed 10594: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 10595: ability to automatically update the current package
10596: along with the dependent packages you have
10597: installed.</p>
10598:
1.14 xtraeme 10599: <p>Resuming an interrupted <span><strong class=
10600: "command">make update</strong></span> will only
10601: work as long as the package tree remains unchanged.
10602: If the source code for one of the packages to be
10603: updated has been changed, resuming
10604: <span><strong class="command">make
10605: update</strong></span> will most certainly
10606: fail!</p>
1.1 grant 10607:
10608: <p>The following variables can be used either on
1.45 wiz 10609: the command line or in <code xmlns=
10610: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10611: "filename">/etc/mk.conf</code> to alter the
10612: behaviour of <span><strong class="command">make
10613: update</strong></span>:</p>
1.1 grant 10614:
10615: <div class="variablelist">
10616: <dl>
1.14 xtraeme 10617: <dt><span class="term"><code class=
10618: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10619:
10620: <dd>
10621: <p>Install target to recursively use for the
10622: updated package and the dependent packages.
1.14 xtraeme 10623: Defaults to <code class=
10624: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10625: “<span class=
10626: "quote">install</span>” otherwise for
1.14 xtraeme 10627: <span><strong class="command">make
10628: update</strong></span>. e.g.
10629: <span><strong class="command">make update
10630: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10631: </dd>
10632:
1.14 xtraeme 10633: <dt><span class="term"><code class=
10634: "varname">NOCLEAN</code></span></dt>
1.1 grant 10635:
10636: <dd>
10637: <p>Don't clean up after updating. Useful if
10638: you want to leave the work sources of the
10639: updated packages around for inspection or
10640: other purposes. Be sure you eventually clean
10641: up the source tree (see the
10642: “<span class=
10643: "quote">clean-update</span>” target
10644: below) or you may run into troubles with old
10645: source code still lying around on your next
1.14 xtraeme 10646: <span><strong class=
10647: "command">make</strong></span> or
10648: <span><strong class="command">make
10649: update</strong></span>.</p>
1.1 grant 10650: </dd>
10651:
1.14 xtraeme 10652: <dt><span class="term"><code class=
10653: "varname">REINSTALL</code></span></dt>
1.1 grant 10654:
10655: <dd>
10656: <p>Deinstall each package before installing
1.14 xtraeme 10657: (making <code class=
10658: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10659: necessary if the “<span class=
10660: "quote">clean-update</span>” target
10661: (see below) was called after interrupting a
1.14 xtraeme 10662: running <span><strong class="command">make
10663: update</strong></span>.</p>
1.1 grant 10664: </dd>
10665:
1.14 xtraeme 10666: <dt><span class="term"><code class=
10667: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10668:
10669: <dd>
10670: <p>Allows you to disable recursion and
10671: hardcode the target for packages. The default
10672: is “<span class=
10673: "quote">update</span>” for the update
10674: target, facilitating a recursive update of
1.14 xtraeme 10675: prerequisite packages. Only set <code class=
10676: "varname">DEPENDS_TARGET</code> if you want
10677: to disable recursive updates. Use
10678: <code class="varname">UPDATE_TARGET</code>
10679: instead to just set a specific target for
10680: each package to be installed during
10681: <span><strong class="command">make
10682: update</strong></span> (see above).</p>
1.1 grant 10683: </dd>
10684: </dl>
10685: </div>
10686: </dd>
10687:
10688: <dt><span class="term">clean-update</span></dt>
10689:
10690: <dd>
10691: <p>Clean the source tree for all packages that
1.14 xtraeme 10692: would get updated if <span><strong class=
10693: "command">make update</strong></span> was called
10694: from the current directory. This target should not
10695: be used if the current package (or any of its
10696: depending packages) have already been de-installed
10697: (e.g., after calling <span><strong class=
10698: "command">make update</strong></span>) or you may
10699: lose some packages you intended to update. As a
10700: rule of thumb: only use this target <span class=
10701: "emphasis"><em>before</em></span> the first time
10702: you run <span><strong class="command">make
10703: update</strong></span> and only if you have a dirty
10704: package tree (e.g., if you used <code class=
10705: "varname">NOCLEAN</code>).</p>
1.1 grant 10706:
1.47 reed 10707: <p>If you are unsure about whether your tree is
10708: clean, you can either perform a
1.14 xtraeme 10709: <span><strong class="command">make
1.47 reed 10710: clean</strong></span> at the top of the tree, or
10711: use the following sequence of commands from the
10712: directory of the package you want to update
10713: (<span class="emphasis"><em>before</em></span>
10714: running <span><strong class="command">make
1.14 xtraeme 10715: update</strong></span> for the first time,
10716: otherwise you lose all the packages you wanted to
10717: update!):</p>
1.1 grant 10718: <pre class="screen">
1.14 xtraeme 10719: <code class="prompt">#</code> <strong class=
10720: "userinput"><code>make clean-update</code></strong>
10721: <code class="prompt">#</code> <strong class=
10722: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
10723: <code class="prompt">#</code> <strong class=
10724: "userinput"><code>make update</code></strong>
1.1 grant 10725: </pre>
10726:
10727: <p>The following variables can be used either on
1.45 wiz 10728: the command line or in <code xmlns=
10729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10730: "filename">/etc/mk.conf</code> to alter the
10731: behaviour of <span><strong class="command">make
10732: clean-update</strong></span>:</p>
1.1 grant 10733:
10734: <div class="variablelist">
10735: <dl>
1.14 xtraeme 10736: <dt><span class="term"><code class=
10737: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 10738:
10739: <dd>
1.14 xtraeme 10740: <p>After <span><strong class="command">make
10741: clean</strong></span>, do not reconstruct the
10742: list of directories to update for this
10743: package. Only use this if
10744: <span><strong class="command">make
10745: update</strong></span> successfully installed
10746: all packages you wanted to update. Normally,
10747: this is done automatically on
10748: <span><strong class="command">make
10749: update</strong></span>, but may have been
10750: suppressed by the <code class=
10751: "varname">NOCLEAN</code> variable (see
1.1 grant 10752: above).</p>
10753: </dd>
10754: </dl>
10755: </div>
10756: </dd>
10757:
10758: <dt><span class="term">info</span></dt>
10759:
10760: <dd>
10761: <p>This target invokes <a href=
10762: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10763: <span class="citerefentry"><span class=
10764: "refentrytitle">pkg_info</span>(1)</span></a> for
10765: the current package. You can use this to check
10766: which version of a package is installed.</p>
10767: </dd>
10768:
10769: <dt><span class="term">readme</span></dt>
10770:
10771: <dd>
1.45 wiz 10772: <p>This target generates a <code xmlns=
10773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10774: "filename">README.html</code> file, which can be
1.1 grant 10775: viewed using a browser such as <a xmlns=
10776: "http://www.w3.org/TR/xhtml1/transitional" href=
10777: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 10778: target="_top"><code xmlns="" class=
10779: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 10780: "http://www.w3.org/TR/xhtml1/transitional" href=
10781: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 10782: target="_top"><code xmlns="" class=
10783: "filename">www/links</code></a>. The generated
10784: files contain references to any packages which are
10785: in the <code class="varname">PACKAGES</code>
10786: directory on the local host. The generated files
10787: can be made to refer to URLs based on <code class=
1.20 ben 10788: "varname">FTP_PKG_URL_HOST</code> and <code class=
10789: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 10790: wanted to generate <code xmlns=
10791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10792: "filename">README.html</code> files which pointed
10793: to binary packages on the local machine, in the
1.45 wiz 10794: directory <code xmlns=
10795: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10796: "filename">/usr/packages</code>, set <code class=
10797: "varname">FTP_PKG_URL_HOST=file://localhost</code>
10798: and <code class=
10799: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
10800: <code class="varname">${PACKAGES}</code> directory
10801: and its subdirectories will be searched for all the
10802: binary packages.</p>
1.1 grant 10803: </dd>
10804:
10805: <dt><span class="term">readme-all</span></dt>
10806:
10807: <dd>
1.45 wiz 10808: <p>Use this target to create a file <code xmlns=
10809: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10810: "filename">README-all.html</code> which contains a
1.1 grant 10811: list of all packages currently available in the
10812: NetBSD Packages Collection, together with the
10813: category they belong to and a short description.
1.45 wiz 10814: This file is compiled from the <code xmlns=
10815: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10816: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 10817: sure to run this <span class=
1.14 xtraeme 10818: "emphasis"><em>after</em></span> a
10819: <span><strong class="command">make
10820: readme</strong></span>.</p>
1.1 grant 10821: </dd>
10822:
10823: <dt><span class="term">cdrom-readme</span></dt>
10824:
10825: <dd>
10826: <p>This is very much the same as the
10827: “<span class="quote">readme</span>”
10828: target (see above), but is to be used when
10829: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 10830: This target also produces <code xmlns=
10831: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10832: "filename">README.html</code> files, and can be
10833: made to refer to URLs based on <code class=
10834: "varname">CDROM_PKG_URL_HOST</code> and
10835: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 10836: </dd>
10837:
10838: <dt><span class="term">show-distfiles</span></dt>
10839:
10840: <dd>
10841: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 10842: are needed to build the package. (<code class=
10843: "varname">DISTFILES</code> and <code class=
1.45 wiz 10844: "varname">PATCHFILES</code>, but not <code xmlns=
10845: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10846: "filename">patches/*</code>)</p>
1.1 grant 10847: </dd>
10848:
10849: <dt><span class="term">show-downlevel</span></dt>
10850:
10851: <dd>
10852: <p>This target shows nothing if the package is not
10853: installed. If a version of this package is
10854: installed, but is not the version provided in this
10855: version of pkgsrc, then a warning message is
10856: displayed. This target can be used to show which of
10857: your installed packages are downlevel, and so the
10858: old versions can be deleted, and the current ones
10859: added.</p>
10860: </dd>
10861:
10862: <dt><span class="term">show-pkgsrc-dir</span></dt>
10863:
10864: <dd>
10865: <p>This target shows the directory in the pkgsrc
10866: hierarchy from which the package can be built and
10867: installed. This may not be the same directory as
10868: the one from which the package was installed. This
10869: target is intended to be used by people who may
10870: wish to upgrade many packages on a single host, and
10871: can be invoked from the top-level pkgsrc Makefile
10872: by using the “<span class=
10873: "quote">show-host-specific-pkgs</span>”
10874: target.</p>
10875: </dd>
10876:
10877: <dt><span class=
10878: "term">show-installed-depends</span></dt>
10879:
10880: <dd>
10881: <p>This target shows which installed packages match
1.14 xtraeme 10882: the current package's <code class=
10883: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 10884: dependencies are causing build problems.</p>
10885: </dd>
10886:
10887: <dt><span class="term">check-shlibs</span></dt>
10888:
10889: <dd>
10890: <p>After a package is installed, check all its
10891: binaries and (on ELF platforms) shared libraries to
10892: see if they find the shared libs they need. Run by
1.14 xtraeme 10893: default if <code class=
10894: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 10895: <code xmlns=
10896: "http://www.w3.org/TR/xhtml1/transitional" class=
10897: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10898: </dd>
10899:
10900: <dt><span class="term">print-PLIST</span></dt>
10901:
10902: <dd>
10903: <p>After a “<span class="quote">make
10904: install</span>” from a new or upgraded pkg,
10905: this prints out an attempt to generate a new
1.45 wiz 10906: <code xmlns=
10907: "http://www.w3.org/TR/xhtml1/transitional" class=
10908: "filename">PLIST</code> from a <span><strong class=
10909: "command">find -newer
1.14 xtraeme 10910: work/.extract_done</strong></span>. An attempt is
10911: made to care for shared libs etc., but it is
1.1 grant 10912: <span class="emphasis"><em>strongly</em></span>
10913: recommended to review the result before putting it
1.45 wiz 10914: into <code xmlns=
10915: "http://www.w3.org/TR/xhtml1/transitional" class=
10916: "filename">PLIST</code>. On upgrades, it's useful
10917: to diff the output of this command against an
10918: already existing <code xmlns=
10919: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10920: "filename">PLIST</code> file.</p>
1.1 grant 10921:
1.24 wiz 10922: <p>If the package installs files via <a href=
10923: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
10924: <span class="citerefentry"><span class=
10925: "refentrytitle">tar</span>(1)</span></a> or other
10926: methods that don't update file access times, be
10927: sure to add these files manually to your
1.45 wiz 10928: <code xmlns=
10929: "http://www.w3.org/TR/xhtml1/transitional" class=
10930: "filename">PLIST</code>, as the “<span class=
10931: "quote">find -newer</span>” command used by
10932: this target won't catch them!</p>
1.1 grant 10933:
10934: <p>See <a href="#print-PLIST" title=
1.38 dillo 10935: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 10936: “Tweaking output of <span><strong class=
10937: "command">make
10938: print-PLIST</strong></span>”</a> for more
10939: information on this target.</p>
1.1 grant 10940: </dd>
10941:
10942: <dt><span class="term">bulk-package</span></dt>
10943:
10944: <dd>
10945: <p>Used to do bulk builds. If an appropriate binary
10946: package already exists, no action is taken. If not,
10947: this target will compile, install and package it
1.47 reed 10948: (and its depends, if <code class=
1.14 xtraeme 10949: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 10950: <a href="#binary.configuration" title=
1.38 dillo 10951: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 10952: “Configuration”</a>). After creating
10953: the binary package, the sources, the just-installed
10954: package and its required packages are removed,
1.1 grant 10955: preserving free disk space.</p>
10956:
10957: <p><span class="emphasis"><em>Beware that this
10958: target may deinstall all packages installed on a
10959: system!</em></span></p>
10960: </dd>
10961:
10962: <dt><span class="term">bulk-install</span></dt>
10963:
10964: <dd>
10965: <p>Used during bulk-installs to install required
1.47 reed 10966: packages. If an up-to-date binary package is
1.1 grant 10967: available, it will be installed via <a href=
10968: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10969: <span class="citerefentry"><span class=
10970: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 10971: not, <span><strong class="command">make
10972: bulk-package</strong></span> will be executed, but
1.47 reed 10973: the installed binary won't be removed.</p>
1.1 grant 10974:
10975: <p>A binary package is considered
1.47 reed 10976: “<span class="quote">up-to-date</span>”
1.1 grant 10977: to be installed via <a href=
10978: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10979: <span class="citerefentry"><span class=
10980: "refentrytitle">pkg_add</span>(1)</span></a>
10981: if:</p>
10982:
10983: <div class="itemizedlist">
10984: <ul type="disc">
10985: <li>
1.45 wiz 10986: <p>None of the package's files (<code xmlns=
10987: "http://www.w3.org/TR/xhtml1/transitional"
10988: class="filename">Makefile</code>, ...) were
1.14 xtraeme 10989: modified since it was built.</p>
1.1 grant 10990: </li>
10991:
10992: <li>
10993: <p>None of the package's required (binary)
10994: packages were modified since it was
10995: built.</p>
10996: </li>
10997: </ul>
10998: </div>
10999:
11000: <p><span class="emphasis"><em>Beware that this
11001: target may deinstall all packages installed on a
11002: system!</em></span></p>
11003: </dd>
11004: </dl>
11005: </div>
11006: </div>
11007: </div>
11008:
1.55 ! rillig 11009: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 11010: <div class="titlepage">
11011: <div>
11012: <div>
1.55 ! rillig 11013: <h2 class="title"><a name="fixes" id=
! 11014: "fixes"></a>Chapter 15. Making your package
! 11015: work</h2>
1.1 grant 11016: </div>
11017: </div>
11018: </div>
11019:
11020: <div class="toc">
11021: <p><b>Table of Contents</b></p>
11022:
11023: <dl>
1.30 wiz 11024: <dt><span class="sect1"><a href=
1.38 dillo 11025: "#general-operation">15.1. General
1.30 wiz 11026: operation</a></span></dt>
1.1 grant 11027:
11028: <dd>
11029: <dl>
11030: <dt><span class="sect2"><a href=
1.38 dillo 11031: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 11032: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11033:
11034: <dt><span class="sect2"><a href=
1.38 dillo 11035: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 11036: install documentation</a></span></dt>
11037:
11038: <dt><span class="sect2"><a href=
1.38 dillo 11039: "#restricted-packages">15.1.3. Restricted
1.1 grant 11040: packages</a></span></dt>
11041:
11042: <dt><span class="sect2"><a href=
1.38 dillo 11043: "#dependencies">15.1.4. Handling
1.1 grant 11044: dependencies</a></span></dt>
11045:
11046: <dt><span class="sect2"><a href=
1.38 dillo 11047: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 11048: packages</a></span></dt>
11049:
11050: <dt><span class="sect2"><a href=
1.38 dillo 11051: "#not-building-packages">15.1.6. Packages that
1.30 wiz 11052: cannot or should not be built</a></span></dt>
1.1 grant 11053:
11054: <dt><span class="sect2"><a href=
1.38 dillo 11055: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 11056: should not be deleted, once
11057: installed</a></span></dt>
1.1 grant 11058:
11059: <dt><span class="sect2"><a href=
1.38 dillo 11060: "#security-handling">15.1.8. Handling packages with
1.1 grant 11061: security problems</a></span></dt>
11062:
11063: <dt><span class="sect2"><a href=
1.38 dillo 11064: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 11065: bugs</a></span></dt>
11066:
11067: <dt><span class="sect2"><a href=
1.38 dillo 11068: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 11069: incrementing versions when fixing an existing
1.1 grant 11070: package</a></span></dt>
11071:
11072: <dt><span class="sect2"><a href=
1.38 dillo 11073: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11074: packages</a></span></dt>
11075: </dl>
11076: </dd>
11077:
1.30 wiz 11078: <dt><span class="sect1"><a href=
1.38 dillo 11079: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11080: issues</a></span></dt>
1.1 grant 11081:
11082: <dd>
11083: <dl>
11084: <dt><span class="sect2"><a href=
1.38 dillo 11085: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11086: distfiles aren't available for plain
1.1 grant 11087: downloading</a></span></dt>
11088:
11089: <dt><span class="sect2"><a href=
1.38 dillo 11090: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11091: handle modified distfiles with the 'old'
11092: name</a></span></dt>
1.1 grant 11093: </dl>
11094: </dd>
11095:
1.30 wiz 11096: <dt><span class="sect1"><a href=
1.38 dillo 11097: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11098: gotchas</a></span></dt>
1.1 grant 11099:
11100: <dd>
11101: <dl>
11102: <dt><span class="sect2"><a href=
1.38 dillo 11103: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11104: libtool</a></span></dt>
11105:
11106: <dt><span class="sect2"><a href=
1.38 dillo 11107: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11108: packages that already support
11109: libtool</a></span></dt>
1.1 grant 11110:
11111: <dt><span class="sect2"><a href=
1.38 dillo 11112: "#autoconf-automake">15.3.3. GNU
1.1 grant 11113: Autoconf/Automake</a></span></dt>
11114: </dl>
11115: </dd>
11116:
1.55 ! rillig 11117: <dt><span class="sect1"><a href="#fixes-build">15.4.
! 11118: Building the package</a></span></dt>
1.1 grant 11119:
11120: <dd>
11121: <dl>
11122: <dt><span class="sect2"><a href=
1.38 dillo 11123: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11124:
11125: <dt><span class="sect2"><a href="#cpp-list">15.4.2.
11126: Getting a list of CPP defines</a></span></dt>
1.1 grant 11127: </dl>
11128: </dd>
11129:
1.30 wiz 11130: <dt><span class="sect1"><a href=
1.38 dillo 11131: "#package-specific-actions">15.5. Package specific
1.30 wiz 11132: actions</a></span></dt>
1.1 grant 11133:
11134: <dd>
11135: <dl>
11136: <dt><span class="sect2"><a href=
1.38 dillo 11137: "#user-interaction">15.5.1. User
1.2 hubertf 11138: interaction</a></span></dt>
1.1 grant 11139:
11140: <dt><span class="sect2"><a href=
1.38 dillo 11141: "#handling-licenses">15.5.2. Handling
1.1 grant 11142: licenses</a></span></dt>
11143:
11144: <dt><span class="sect2"><a href=
1.38 dillo 11145: "#installing-score-files">15.5.3. Installing score
1.1 grant 11146: files</a></span></dt>
11147:
11148: <dt><span class="sect2"><a href=
1.38 dillo 11149: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11150: scripts</a></span></dt>
11151:
11152: <dt><span class="sect2"><a href=
1.38 dillo 11153: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11154: paths to other interpreters</a></span></dt>
1.1 grant 11155:
11156: <dt><span class="sect2"><a href=
1.38 dillo 11157: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11158: modules</a></span></dt>
11159:
11160: <dt><span class="sect2"><a href=
1.38 dillo 11161: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11162: files</a></span></dt>
11163:
11164: <dt><span class="sect2"><a href=
1.38 dillo 11165: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 11166: GConf2 data files</a></span></dt>
1.1 grant 11167:
11168: <dt><span class="sect2"><a href=
1.38 dillo 11169: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 11170: installing scrollkeeper data files</a></span></dt>
1.1 grant 11171:
11172: <dt><span class="sect2"><a href=
1.38 dillo 11173: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 11174: fonts</a></span></dt>
11175:
11176: <dt><span class="sect2"><a href=
1.38 dillo 11177: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 11178: modules</a></span></dt>
11179:
11180: <dt><span class="sect2"><a href=
1.38 dillo 11181: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 11182: or XML data</a></span></dt>
1.1 grant 11183:
11184: <dt><span class="sect2"><a href=
1.38 dillo 11185: "#mime-database">15.5.13. Packages installing
1.1 grant 11186: extensions to the MIME database</a></span></dt>
11187:
11188: <dt><span class="sect2"><a href=
1.38 dillo 11189: "#intltool">15.5.14. Packages using
1.1 grant 11190: intltool</a></span></dt>
1.18 xtraeme 11191:
11192: <dt><span class="sect2"><a href=
1.38 dillo 11193: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 11194: startup scripts</a></span></dt>
1.1 grant 11195: </dl>
11196: </dd>
11197:
1.30 wiz 11198: <dt><span class="sect1"><a href=
1.38 dillo 11199: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11200: author</a></span></dt>
1.1 grant 11201: </dl>
11202: </div>
11203:
1.55 ! rillig 11204: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 11205: <div class="titlepage">
11206: <div>
11207: <div>
11208: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 11209: "general-operation" id=
1.38 dillo 11210: "general-operation"></a>15.1. General
1.1 grant 11211: operation</h2>
11212: </div>
11213: </div>
11214: </div>
11215:
1.55 ! rillig 11216: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11217: <div class="titlepage">
11218: <div>
11219: <div>
1.30 wiz 11220: <h3 class="title"><a name=
1.55 ! rillig 11221: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11222: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11223: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11224: </div>
11225: </div>
11226: </div>
11227:
11228: <p>The problem with package-defined variables that can
1.14 xtraeme 11229: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11230: or <code xmlns=
11231: "http://www.w3.org/TR/xhtml1/transitional" class=
11232: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11233: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11234: <span class="citerefentry"><span class=
11235: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11236: variable as it is used, but evaluates preprocessor-like
1.1 grant 11237: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11238: So, to use any variable (which may be set in
1.45 wiz 11239: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11240: class="filename">/etc/mk.conf</code>) in one of the
11241: .if* statements, the file <code xmlns=
11242: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11243: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11244: that .if* statement.</p>
11245:
1.47 reed 11246: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11247: including <code xmlns=
11248: "http://www.w3.org/TR/xhtml1/transitional" class=
11249: "filename">/etc/mk.conf</code>, should it exist, or
11250: <code class="varname">MAKECONF</code>, should it exist,
11251: include the <code xmlns=
11252: "http://www.w3.org/TR/xhtml1/transitional" class=
11253: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11254: package Makefile before any preprocessor-like .if,
11255: .ifdef, or .ifndef statements:</p>
1.1 grant 11256: <pre class="programlisting">
1.51 rillig 11257: .include "../../mk/bsd.prefs.mk"
11258:
1.1 grant 11259: .if defined(USE_MENUS)
1.51 rillig 11260: # ...
1.1 grant 11261: .endif
11262: </pre>
11263:
1.14 xtraeme 11264: <p>If you wish to set the <code class=
1.45 wiz 11265: "varname">CFLAGS</code> variable in <code xmlns=
11266: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11267: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11268: use:</p>
11269: <pre class="programlisting">
1.51 rillig 11270: CFLAGS+= -your -flags
1.1 grant 11271: </pre>
11272:
1.14 xtraeme 11273: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11274: without the “<span class="quote">+</span>”)
11275: may lead to problems with packages that need to add
11276: their own flags. Also, you may want to take a look at
11277: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11278: href=
11279: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11280: target="_top"><code xmlns="" class=
11281: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11282: interested in optimization for the current CPU.</p>
1.1 grant 11283: </div>
11284:
1.55 ! rillig 11285: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11286: <div class="titlepage">
11287: <div>
11288: <div>
1.31 wiz 11289: <h3 class="title"><a name=
1.55 ! rillig 11290: "where-to-install-documentation" id=
1.38 dillo 11291: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11292: to install documentation</h3>
11293: </div>
11294: </div>
11295: </div>
11296:
1.45 wiz 11297: <p>Documentation should be installed into <code xmlns=
11298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11299: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11300: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11301: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11302: (the latter includes the version number of the
11303: package).</p>
1.31 wiz 11304: </div>
11305:
1.55 ! rillig 11306: <div class="sect2" lang="en" xml:lang="en">
1.31 wiz 11307: <div class="titlepage">
11308: <div>
11309: <div>
1.55 ! rillig 11310: <h3 class="title"><a name="restricted-packages"
! 11311: id=
1.38 dillo 11312: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11313: packages</h3>
11314: </div>
11315: </div>
11316: </div>
11317:
11318: <p>Some licenses restrict how software may be
11319: re-distributed. In order to satisfy these restrictions,
11320: the package system defines five make variables that can
11321: be set to note these restrictions:</p>
11322:
11323: <div class="itemizedlist">
11324: <ul type="disc">
11325: <li>
1.14 xtraeme 11326: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11327:
11328: <p>This variable should be set whenever a
11329: restriction exists (regardless of its kind). Set
11330: this variable to a string containing the reason
11331: for the restriction.</p>
11332: </li>
11333:
11334: <li>
1.14 xtraeme 11335: <p><code class=
11336: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11337:
11338: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11339: variable to <code class=
11340: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11341: package may not be included on a CD-ROM.</p>
11342: </li>
11343:
11344: <li>
1.14 xtraeme 11345: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11346:
11347: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11348: Set this variable to <code class=
11349: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11350: package may not not be made available on the
11351: Internet.</p>
11352: </li>
11353:
11354: <li>
1.14 xtraeme 11355: <p><code class=
11356: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11357:
11358: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11359: this variable to <code class=
11360: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11361: of the source code or other distfile(s) is not
11362: allowed on CD-ROMs.</p>
11363: </li>
11364:
11365: <li>
1.14 xtraeme 11366: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11367:
11368: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11369: variable to <code class=
11370: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11371: of the source code or other distfile(s) via the
11372: Internet is not allowed.</p>
11373: </li>
11374: </ul>
11375: </div>
11376:
1.14 xtraeme 11377: <p>Please note that the use of <code class=
11378: "varname">NO_PACKAGE</code>, <code class=
11379: "varname">IGNORE</code>, <code class=
11380: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11381: variables to denote restrictions is deprecated, because
11382: they unconditionally prevent users from generating
11383: binary packages!</p>
11384: </div>
11385:
1.55 ! rillig 11386: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11387: <div class="titlepage">
11388: <div>
11389: <div>
1.55 ! rillig 11390: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11391: "dependencies"></a>15.1.4. Handling
1.1 grant 11392: dependencies</h3>
11393: </div>
11394: </div>
11395: </div>
11396:
11397: <p>Your package may depend on some other package being
11398: present - and there are various ways of expressing this
1.14 xtraeme 11399: dependency. pkgsrc supports the <code class=
11400: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11401: "varname">DEPENDS</code> definitions, the <code class=
11402: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11403: dependencies via <code xmlns=
11404: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11405: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11406: way to handle dependencies, and which uses the
11407: variables named above. See <a href="#buildlink" title=
1.38 dillo 11408: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11409: <i>Buildlink methodology</i></a> for more
11410: information.</p>
11411:
11412: <p>The basic difference between the two variables is as
1.14 xtraeme 11413: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11414: definition registers that pre-requisite in the binary
11415: package so it will be pulled in when the binary package
1.14 xtraeme 11416: is later installed, whilst the <code class=
11417: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11418: marking a dependency that is only needed for building
11419: the package.</p>
11420:
11421: <p>This means that if you only need a package present
11422: whilst you are building, it should be noted as a
1.14 xtraeme 11423: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11424:
1.14 xtraeme 11425: <p>The format for a <code class=
11426: "varname">BUILD_DEPENDS</code> and a <code class=
11427: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11428: <pre class="programlisting">
1.51 rillig 11429: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11430: </pre>
11431:
11432: <p>Please note that the “<span class=
11433: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11434: any of the wildcard version numbers recognized by
1.1 grant 11435: <a href=
11436: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11437: <span class="citerefentry"><span class=
11438: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11439:
11440: <div class="orderedlist">
11441: <ol type="1">
11442: <li>
11443: <p>If your package needs another package's
11444: binaries or libraries to build or run, and if
1.45 wiz 11445: that package has a <code xmlns=
11446: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11447: "filename">buildlink3.mk</code> file available,
11448: use it:</p>
1.1 grant 11449: <pre class="programlisting">
11450: .include "../../graphics/jpeg/buildlink3.mk"
11451: </pre>
11452: </li>
11453:
11454: <li>
11455: <p>If your package needs to use another package
1.45 wiz 11456: to build itself and there is no <code xmlns=
11457: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11458: "filename">buildlink3.mk</code> file available,
11459: use the <code class=
11460: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11461: <pre class="programlisting">
1.51 rillig 11462: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 11463: </pre>
11464: </li>
11465:
11466: <li>
11467: <p>If your package needs a library with which to
1.45 wiz 11468: link and again there is no <code xmlns=
11469: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11470: "filename">buildlink3.mk</code> file available,
11471: this is specified using the <code class=
11472: "varname">DEPENDS</code> definition. An example
11473: of this is the <a xmlns=
1.1 grant 11474: "http://www.w3.org/TR/xhtml1/transitional" href=
11475: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11476: target="_top"><code xmlns="" class=
11477: "filename">print/lyx</code></a> package, which
11478: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11479: <pre class="programlisting">
1.51 rillig 11480: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 11481: </pre>
11482:
11483: <p>You can also use wildcards in package
11484: dependences:</p>
11485: <pre class="programlisting">
1.51 rillig 11486: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 11487: </pre>
11488:
11489: <p>Note that such wildcard dependencies are
11490: retained when creating binary packages. The
11491: dependency is checked when installing the binary
11492: package and any package which matches the pattern
11493: will be used. Wildcard dependencies should be
11494: used with care.</p>
11495:
11496: <p>The “<span class=
11497: "quote">-[0-9]*</span>” should be used
11498: instead of “<span class=
11499: "quote">-*</span>” to avoid potentially
11500: ambiguous matches such as “<span class=
11501: "quote">tk-postgresql</span>” matching a
11502: “<span class="quote">tk-*</span>”
1.14 xtraeme 11503: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11504:
11505: <p>Wildcards can also be used to specify that a
11506: package will only build against a certain minimum
11507: version of a pre-requisite:</p>
11508: <pre class="programlisting">
1.51 rillig 11509: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 11510: </pre>
11511:
11512: <p>This means that the package will build against
11513: version 3.5.4 of the tiff library or newer. Such
11514: a dependency may be warranted if, for example,
11515: the API of the library has changed with version
11516: 3.5.4 and a package would not compile against an
11517: earlier version of tiff.</p>
11518:
11519: <p>Please note that such dependencies should only
11520: be updated if a package requires a newer
11521: pre-requisite, but not to denote recommendations
11522: such as security updates or ABI changes that do
11523: not prevent a package from building correctly.
11524: Such recommendations can be expressed using
1.14 xtraeme 11525: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11526: <pre class="programlisting">
1.51 rillig 11527: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 11528: </pre>
11529:
1.14 xtraeme 11530: <p>In addition to the above <code class=
11531: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11532: while a package will build against
11533: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11534: recommended. <code class=
11535: "varname">RECOMMENDED</code> entries will be
11536: turned into dependencies unless explicitly
11537: ignored (in which case a warning will be
1.36 wiz 11538: printed).</p>
11539:
11540: <p>To ignore these dependency recommendations and
11541: just use the required <code class=
11542: "varname">DEPENDS</code>, set <code class=
11543: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11544: make it easier and faster to update packages
11545: built using pkgsrc, since older compatible
11546: dependencies can continue to be used. This is
11547: useful for people who watch their rebuilds very
11548: carefully; it is not very good as a
11549: general-purpose hammer. If you use it, you need
11550: to be mindful of possible ABI changes, including
11551: those from the underlying OS.</p>
11552:
11553: <p>Packages that are built with recommendations
11554: ignored may not be uploaded to ftp.NetBSD.org by
11555: developers and should not be used across
11556: different systems that may have different
11557: versions of binary packages installed.</p>
1.1 grant 11558:
11559: <p>For security fixes, please update the package
11560: vulnerabilities file as well as setting
1.14 xtraeme 11561: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11562: <a href="#security-handling" title=
1.38 dillo 11563: "15.1.8. Handling packages with security problems">
1.55 ! rillig 11564: Section 15.1.8, “Handling packages with
! 11565: security problems”</a> for more
1.1 grant 11566: information.</p>
11567: </li>
11568:
11569: <li>
11570: <p>If your package needs some executable to be
1.17 sketch 11571: able to run correctly and if there's no
1.45 wiz 11572: <code xmlns=
11573: "http://www.w3.org/TR/xhtml1/transitional" class=
11574: "filename">buildlink3.mk</code> file, this is
11575: specified using the <code class=
1.14 xtraeme 11576: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11577: "http://www.w3.org/TR/xhtml1/transitional" href=
11578: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11579: target="_top"><code xmlns="" class=
11580: "filename">print/lyx</code></a> package needs to
11581: be able to execute the latex binary from the
11582: teTeX package when it runs, and that is
11583: specified:</p>
1.1 grant 11584: <pre class="programlisting">
1.51 rillig 11585: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 11586: </pre>
11587:
11588: <p>The comment about wildcard dependencies from
11589: previous paragraph applies here, too.</p>
11590: </li>
11591: </ol>
11592: </div>
11593:
11594: <p>If your package needs files from another package to
11595: build, see the first part of the “<span class=
11596: "quote">do-configure</span>” target <a xmlns=
11597: "http://www.w3.org/TR/xhtml1/transitional" href=
11598: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11599: target="_top"><code xmlns="" class=
11600: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11601: relies on the jpeg sources being present in source form
11602: during the build):</p>
1.1 grant 11603: <pre class="programlisting">
1.51 rillig 11604: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11605: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 11606: fi
11607: </pre>
11608:
11609: <p>If you build any other packages that way, please
11610: make sure the working files are deleted too when this
11611: package's working files are cleaned up. The easiest way
11612: to do so is by adding a pre-clean target:</p>
11613: <pre class="programlisting">
1.51 rillig 11614: pre-clean:
11615: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 11616: </pre>
11617:
1.14 xtraeme 11618: <p>Please also note the <code class=
11619: "varname">BUILD_USES_MSGFMT</code> and <code class=
11620: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11621: which are provided as convenience definitions. The
1.24 wiz 11622: former works out whether <a href=
11623: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11624: <span class="citerefentry"><span class=
11625: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11626: the base system, and, if it isn't, installs the
11627: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11628: href=
1.1 grant 11629: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 11630: target="_top"><code xmlns="" class=
11631: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11632: adds a build dependency on either an installed version
11633: of an older gettext package, or if it isn't, installs
11634: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11635: href=
11636: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 11637: target="_top"><code xmlns="" class=
11638: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11639: </div>
11640:
1.55 ! rillig 11641: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11642: <div class="titlepage">
11643: <div>
11644: <div>
1.55 ! rillig 11645: <h3 class="title"><a name="conflicts" id=
1.38 dillo 11646: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11647: with other packages</h3>
11648: </div>
11649: </div>
11650: </div>
11651:
11652: <p>Your package may conflict with other packages a user
11653: might already have installed on his system, e.g. if
11654: your package installs the same set of files like
11655: another package in our pkgsrc tree.</p>
11656:
1.14 xtraeme 11657: <p>In this case you can set <code class=
1.47 reed 11658: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 11659: packages (including version string) your package
11660: conflicts with.</p>
11661:
1.47 reed 11662: <p>For example, <a xmlns=
1.1 grant 11663: "http://www.w3.org/TR/xhtml1/transitional" href=
11664: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 11665: target="_top"><code xmlns="" class=
11666: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11667: "http://www.w3.org/TR/xhtml1/transitional" href=
11668: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 11669: target="_top"><code xmlns="" class=
1.47 reed 11670: "filename">x11/Xaw-Xpm</code></a> install the same
11671: shared library, thus you set in <code xmlns=
1.45 wiz 11672: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11673: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 11674: <pre class="programlisting">
1.51 rillig 11675: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 11676: </pre>
11677:
1.45 wiz 11678: <p>and in <code xmlns=
11679: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11680: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 11681: <pre class="programlisting">
1.51 rillig 11682: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 11683: </pre>
11684:
11685: <p>Packages will automatically conflict with other
11686: packages with the name prefix and a different version
11687: string. “<span class=
11688: "quote">Xaw3d-1.5</span>” e.g. will automatically
11689: conflict with the older version “<span class=
11690: "quote">Xaw3d-1.3</span>”.</p>
11691: </div>
11692:
1.55 ! rillig 11693: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11694: <div class="titlepage">
11695: <div>
11696: <div>
1.55 ! rillig 11697: <h3 class="title"><a name="not-building-packages"
! 11698: id=
1.38 dillo 11699: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 11700: that cannot or should not be built</h3>
1.1 grant 11701: </div>
11702: </div>
11703: </div>
11704:
11705: <p>There are several reasons why a package might be
11706: instructed to not build under certain circumstances. If
11707: the package builds and runs on most platforms, the
1.14 xtraeme 11708: exceptions should be noted with <code class=
11709: "varname">NOT_FOR_PLATFORM</code>. If the package
11710: builds and runs on a small handful of platforms, set
11711: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 11712: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
11713: <code class="varname">NOT_FOR_PLATFORM</code> are OS
11714: triples (OS-version-platform) that can use glob-style
11715: wildcards.</p>
11716:
11717: <p>If the package should be skipped (for example,
11718: because it provides functionality already provided by
11719: the system), set <code class=
1.14 xtraeme 11720: "varname">PKG_SKIP_REASON</code> to a descriptive
11721: message. If the package should fail because some
11722: preconditions are not met, set <code class=
11723: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 11724: message.</p>
11725: </div>
11726:
1.55 ! rillig 11727: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11728: <div class="titlepage">
11729: <div>
11730: <div>
1.55 ! rillig 11731: <h3 class="title"><a name="undeletable-packages"
! 11732: id=
1.38 dillo 11733: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 11734: which should not be deleted, once installed</h3>
1.1 grant 11735: </div>
11736: </div>
11737: </div>
11738:
11739: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 11740: has been installed, the <code class=
11741: "varname">PKG_PRESERVE</code> definition should be set
11742: in the package Makefile. This will be carried into any
1.1 grant 11743: binary package that is made from this pkgsrc entry. A
11744: “<span class="quote">preserved</span>”
11745: package will not be deleted using <a href=
11746: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11747: <span class="citerefentry"><span class=
11748: "refentrytitle">pkg_delete</span>(1)</span></a> unless
11749: the “<span class="quote">-f</span>” option
11750: is used.</p>
11751: </div>
11752:
1.55 ! rillig 11753: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11754: <div class="titlepage">
11755: <div>
11756: <div>
1.55 ! rillig 11757: <h3 class="title"><a name="security-handling" id=
1.38 dillo 11758: "security-handling"></a>15.1.8. Handling
1.1 grant 11759: packages with security problems</h3>
11760: </div>
11761: </div>
11762: </div>
11763:
11764: <p>When a vulnerability is found, this should be noted
1.45 wiz 11765: in <code xmlns=
11766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11767: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 11768: and after committing that file, use
11769: <span><strong class="command">make
11770: upload</strong></span> in the same directory to update
11771: the file on ftp.NetBSD.org.</p>
11772:
11773: <p>After fixing the vulnerability by a patch, its
11774: <code class="varname">PKGREVISION</code> should be
11775: increased (this is of course not necessary if the
11776: problem is fixed by using a newer release of the
1.45 wiz 11777: software). In addition, if a <code xmlns=
11778: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11779: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 11780: affected package, a corresponding <code class=
1.14 xtraeme 11781: "varname">BUILDLINK_RECOMMENDED.<em class=
11782: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 11783: be added or updated in it.</p>
1.1 grant 11784:
11785: <p>Also, if the fix should be applied to the stable
11786: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 11787:
11788: <p>Binary packages already on ftp.NetBSD.org will be
11789: handled semi-automatically by a weekly cron job.</p>
1.1 grant 11790: </div>
11791:
1.55 ! rillig 11792: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11793: <div class="titlepage">
11794: <div>
11795: <div>
1.55 ! rillig 11796: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 11797: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 11798: compiler bugs</h3>
11799: </div>
11800: </div>
11801: </div>
11802:
11803: <p>Some source files trigger bugs in the compiler,
11804: based on combinations of compiler version and
11805: architecture and almost always relation to optimisation
11806: being enabled. Common symptoms are gcc internal errors
11807: or never finishing compiling a file.</p>
11808:
1.47 reed 11809: <p>Typically, a workaround involves testing the
1.14 xtraeme 11810: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 11811: version, disabling optimisation for that
1.14 xtraeme 11812: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 11813: combination, and documenting it in <code xmlns=
11814: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11815: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 11816: number of examples!</p>
11817: </div>
11818:
1.55 ! rillig 11819: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11820: <div class="titlepage">
11821: <div>
11822: <div>
1.55 ! rillig 11823: <h3 class="title"><a name="bumping-pkgrevision"
! 11824: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 11825: handle incrementing versions when fixing an
11826: existing package</h3>
1.1 grant 11827: </div>
11828: </div>
11829: </div>
11830:
11831: <p>When making fixes to an existing package it can be
1.14 xtraeme 11832: useful to change the version number in <code class=
11833: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 11834: future versions by the original author, a
11835: “<span class="quote">nb1</span>”,
11836: “<span class="quote">nb2</span>”, ...
11837: suffix can be used on package versions by setting
1.14 xtraeme 11838: <code class="varname">PKGREVISION=1</code> (2, ...).
11839: The “<span class="quote">nb</span>” is
11840: treated like a “<span class=
11841: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 11842: <pre class="programlisting">
1.51 rillig 11843: DISTNAME= foo-17.42
11844: PKGREVISION= 9
1.1 grant 11845: </pre>
11846:
1.14 xtraeme 11847: <p>will result in a <code class=
11848: "varname">PKGNAME</code> of “<span class=
1.1 grant 11849: "quote">foo-17.42nb9</span>”.</p>
11850:
11851: <p>When a new release of the package is released, the
1.14 xtraeme 11852: <code class="varname">PKGREVISION</code> should be
1.47 reed 11853: removed, e.g. on a new minor release of the above
1.14 xtraeme 11854: package, things should be like:</p>
1.1 grant 11855: <pre class="programlisting">
1.51 rillig 11856: DISTNAME= foo-17.43
1.1 grant 11857: </pre>
11858: </div>
11859:
1.55 ! rillig 11860: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11861: <div class="titlepage">
11862: <div>
11863: <div>
1.30 wiz 11864: <h3 class="title"><a name=
1.55 ! rillig 11865: "portability-of-packages" id=
1.38 dillo 11866: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 11867: of packages</h3>
1.1 grant 11868: </div>
11869: </div>
11870: </div>
11871:
11872: <p>One appealing feature of pkgsrc is that it runs on
11873: many different platforms. As a result, it is important
11874: to ensure, where possible, that packages in pkgsrc are
11875: portable. There are some particular details you should
11876: pay attention to while working on pkgsrc.</p>
11877:
1.55 ! rillig 11878: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 11879: <div class="titlepage">
11880: <div>
11881: <div>
1.55 ! rillig 11882: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 11883: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 11884: ${INSTALL_DATA_DIR}, ...</h4>
11885: </div>
11886: </div>
11887: </div>
11888:
1.14 xtraeme 11889: <p>The BSD-compatible <span><strong class=
11890: "command">install</strong></span> supplied with some
1.1 grant 11891: operating systems will not perform more than one
11892: operation at a time. As such, you should call
11893: “<span class="quote">${INSTALL}</span>”,
11894: etc. like this:</p>
11895: <pre class="programlisting">
1.51 rillig 11896: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
11897: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 11898: </pre>
11899: </div>
11900: </div>
11901: </div>
11902:
1.55 ! rillig 11903: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 11904: <div class="titlepage">
11905: <div>
11906: <div>
11907: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 11908: "downloading-issues" id=
1.38 dillo 11909: "downloading-issues"></a>15.2. Possible
1.1 grant 11910: downloading issues</h2>
11911: </div>
11912: </div>
11913: </div>
11914:
1.55 ! rillig 11915: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11916: <div class="titlepage">
11917: <div>
11918: <div>
1.55 ! rillig 11919: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 11920: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 11921: whose distfiles aren't available for plain
1.1 grant 11922: downloading</h3>
11923: </div>
11924: </div>
11925: </div>
11926:
11927: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 11928: set <code class="varname">DYNAMIC_MASTER_SITES</code>
11929: and a <span><strong class="command">make
1.45 wiz 11930: fetch</strong></span> will call <code xmlns=
11931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11932: "filename">files/getsite.sh</code> with the name of
11933: each file to download as an argument, expecting it to
11934: output the URL of the directory from which to download
11935: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11936: href=
1.1 grant 11937: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 11938: target="_top"><code xmlns="" class=
11939: "filename">graphics/ns-cult3d</code></a> is an example
11940: of this usage.</p>
1.1 grant 11941:
11942: <p>If the download can't be automated, because the user
11943: must submit personal information to apply for a
11944: password, or must pay for the source, or whatever, you
1.14 xtraeme 11945: can set <code class="varname">_FETCH_MESSAGE</code> to
11946: a macro which displays a message explaining the
11947: situation. <code class="varname">_FETCH_MESSAGE</code>
11948: must be executable shell commands, not just a message.
11949: (Generally, it executes <code class=
11950: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 11951: following packages use this: <a xmlns=
11952: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11953: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 11954: target="_top"><code xmlns="" class=
11955: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 11956: "http://www.w3.org/TR/xhtml1/transitional" href=
11957: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 11958: target="_top"><code xmlns="" class=
11959: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 11960: "http://www.w3.org/TR/xhtml1/transitional" href=
11961: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 11962: target="_top"><code xmlns="" class=
11963: "filename">emulators/vmware-module</code></a>,
11964: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11965: href=
1.20 ben 11966: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 11967: target="_top"><code xmlns="" class=
11968: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 11969: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 11970: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 11971: target="_top"><code xmlns="" class=
11972: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 11973: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 11975: target="_top"><code xmlns="" class=
11976: "filename">sysutils/storage-manager</code></a>,
11977: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11978: href=
1.20 ben 11979: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 11980: target="_top"><code xmlns="" class=
11981: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 11982: "http://www.w3.org/TR/xhtml1/transitional" href=
11983: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 11984: target="_top"><code xmlns="" class=
11985: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 11986: with them.</p>
1.1 grant 11987: </div>
11988:
1.55 ! rillig 11989: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11990: <div class="titlepage">
11991: <div>
11992: <div>
1.30 wiz 11993: <h3 class="title"><a name=
1.55 ! rillig 11994: "modified-distfiles-same-name" id=
1.38 dillo 11995: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 11996: to handle modified distfiles with the 'old'
11997: name</h3>
1.1 grant 11998: </div>
11999: </div>
12000: </div>
12001:
12002: <p>Sometimes authors of a software package make some
12003: modifications after the software was released, and they
12004: put up a new distfile without changing the package's
12005: version number. If a package is already in pkgsrc at
1.32 wiz 12006: that time, the checksum will no longer match. The
12007: contents of the new distfile should be compared against
12008: the old one before changing anything, to make sure the
12009: distfile was really updated on purpose, and that no
12010: trojan horse or so crept in. Then, the correct way to
12011: work around this is to set <code class=
12012: "varname">DIST_SUBDIR</code> to a unique directory
12013: name, usually based on <code class=
12014: "varname">PKGNAME_NOREV</code>. In case this happens
12015: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12016: used (thus including the <code xmlns=
12017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12018: "filename">nbX</code> suffix) or a date stamp can be
12019: appended, like <code class=
12020: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12021: forget regenerating the <code xmlns=
12022: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12023: "filename">distinfo</code> file after that, since it
12024: contains the <code class="varname">DIST_SUBDIR</code>
12025: path in the filenames. Furthermore, a mail to the
12026: package's authors seems appropriate telling them that
12027: changing distfiles after releases without changing the
12028: file names is not good practice.</p>
1.1 grant 12029: </div>
12030: </div>
12031:
1.55 ! rillig 12032: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12033: <div class="titlepage">
12034: <div>
12035: <div>
12036: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 12037: "configuration-gotchas" id=
1.38 dillo 12038: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 12039: gotchas</h2>
12040: </div>
12041: </div>
12042: </div>
12043:
1.55 ! rillig 12044: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12045: <div class="titlepage">
12046: <div>
12047: <div>
1.55 ! rillig 12048: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 12049: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 12050: - libtool</h3>
12051: </div>
12052: </div>
12053: </div>
12054:
12055: <p>pkgsrc supports many different machines, with
12056: different object formats like a.out and ELF, and
12057: varying abilities to do shared library and dynamic
12058: loading at all. To accompany this, varying commands and
12059: options have to be passed to the compiler, linker, etc.
12060: to get the Right Thing, which can be pretty annoying
12061: especially if you don't have all the machines at your
12062: hand to test things. The <a xmlns=
12063: "http://www.w3.org/TR/xhtml1/transitional" href=
12064: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 12065: target="_top"><code xmlns="" class=
12066: "filename">devel/libtool</code></a> pkg can help here,
12067: as it just “<span class=
12068: "quote">knows</span>” how to build both static
12069: and dynamic libraries from a set of source files, thus
1.47 reed 12070: being platform-independent.</p>
1.1 grant 12071:
12072: <p>Here's how to use libtool in a pkg in seven simple
12073: steps:</p>
12074:
12075: <div class="orderedlist">
12076: <ol type="1">
12077: <li>
1.14 xtraeme 12078: <p>Add <code class=
12079: "varname">USE_LIBTOOL=yes</code> to the package
12080: Makefile.</p>
1.1 grant 12081: </li>
12082:
12083: <li>
12084: <p>For library objects, use “<span class=
12085: "quote">${LIBTOOL} --mode=compile
12086: ${CC}</span>” in place of
12087: “<span class="quote">${CC}</span>”.
12088: You could even add it to the definition of
1.14 xtraeme 12089: <code class="varname">CC</code>, if only
12090: libraries are being built in a given Makefile.
12091: This one command will build both PIC and non-PIC
12092: library objects, so you need not have separate
12093: shared and non-shared library rules.</p>
1.1 grant 12094: </li>
12095:
12096: <li>
12097: <p>For the linking of the library, remove any
12098: “<span class="quote">ar</span>”,
12099: “<span class="quote">ranlib</span>”,
12100: and “<span class="quote">ld
12101: -Bshareable</span>” commands, and instead
12102: use:</p>
12103: <pre class="programlisting">
1.51 rillig 12104: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12105: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12106: </pre>
12107:
12108: <p>Note that the library is changed to have a
1.45 wiz 12109: <code xmlns=
12110: "http://www.w3.org/TR/xhtml1/transitional" class=
12111: "filename">.la</code> extension, and the objects
12112: are changed to have a <code xmlns=
12113: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12114: "filename">.lo</code> extension. Change
12115: <code class="varname">OBJS</code> as necessary.
12116: This automatically creates all of the
1.45 wiz 12117: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12118: class="filename">.a</code>, <code xmlns=
12119: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12120: "filename">.so.major.minor</code>, and ELF
12121: symlinks (if necessary) in the build directory.
12122: Be sure to include “<span class=
1.1 grant 12123: "quote">-version-info</span>”, especially
12124: when major and minor are zero, as libtool will
12125: otherwise strip off the shared library
12126: version.</p>
12127:
12128: <p>From the libtool manual:</p>
12129: <pre class="programlisting">
1.51 rillig 12130: So, libtool library versions are described by three integers:
1.1 grant 12131:
1.51 rillig 12132: CURRENT
12133: The most recent interface number that this library implements.
1.1 grant 12134:
1.51 rillig 12135: REVISION
12136: The implementation number of the CURRENT interface.
1.1 grant 12137:
1.51 rillig 12138: AGE
12139: The difference between the newest and oldest interfaces that
12140: this library implements. In other words, the library implements
12141: all the interface numbers in the range from number `CURRENT -
12142: AGE' to `CURRENT'.
1.1 grant 12143:
1.51 rillig 12144: If two libraries have identical CURRENT and AGE numbers, then the
12145: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12146: </pre>
12147:
12148: <p>The “<span class=
12149: "quote">-release</span>” option will
12150: produce different results for a.out and ELF
12151: (excluding symlinks) in only one case. An ELF
12152: library of the form “<span class=
12153: "quote">libfoo-release.so.<span class=
12154: "emphasis"><em>x</em></span>.<span class=
12155: "emphasis"><em>y</em></span></span>” will
12156: have a symlink of “<span class=
12157: "quote">libfoo.so.<span class=
12158: "emphasis"><em>x</em></span>.<span class=
12159: "emphasis"><em>y</em></span></span>” on an
12160: a.out platform. This is handled
12161: automatically.</p>
12162:
12163: <p>The “<span class="quote">-rpath
12164: argument</span>” is the install directory
12165: of the library being built.</p>
12166:
1.45 wiz 12167: <p>In the <code xmlns=
12168: "http://www.w3.org/TR/xhtml1/transitional" class=
12169: "filename">PLIST</code>, include only the
12170: <code xmlns=
12171: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12172: "filename">.la</code> file, the other files will
12173: be added automatically.</p>
1.1 grant 12174: </li>
12175:
12176: <li>
1.45 wiz 12177: <p>When linking shared object (<code xmlns=
12178: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12179: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12180: loaded via <a href=
12181: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12182: <span class="citerefentry"><span class=
12183: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12184: shared libraries, use “<span class=
12185: "quote">-module -avoid-version</span>” to
12186: prevent them getting version tacked on.</p>
1.1 grant 12187:
1.45 wiz 12188: <p>The <code xmlns=
12189: "http://www.w3.org/TR/xhtml1/transitional" class=
12190: "filename">PLIST</code> file gets the
12191: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12192: class="filename">foo.so</code> entry.</p>
1.1 grant 12193: </li>
12194:
12195: <li>
12196: <p>When linking programs that depend on these
12197: libraries <span class=
12198: "emphasis"><em>before</em></span> they are
12199: installed, preface the <a href=
12200: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12201: <span class="citerefentry"><span class=
12202: "refentrytitle">cc</span>(1)</span></a> or
12203: <a href=
12204: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12205: <span class="citerefentry"><span class=
12206: "refentrytitle">ld</span>(1)</span></a> line with
12207: “<span class="quote">${LIBTOOL}
12208: --mode=link</span>”, and it will find the
12209: correct libraries (static or shared), but please
12210: be aware that libtool will not allow you to
12211: specify a relative path in -L (such as
12212: “<span class=
12213: "quote">-L../somelib</span>”), because it
12214: expects you to change that argument to be the
1.45 wiz 12215: <code xmlns=
12216: "http://www.w3.org/TR/xhtml1/transitional" class=
12217: "filename">.la</code> file. e.g.</p>
1.1 grant 12218: <pre class="programlisting">
1.51 rillig 12219: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12220: </pre>
12221:
12222: <p>should be changed to:</p>
12223: <pre class="programlisting">
1.51 rillig 12224: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12225: "replaceable"><code>someprog</code></em> <em class=
12226: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12227: </pre>
12228:
12229: <p>and it will do the right thing with the
12230: libraries.</p>
12231: </li>
12232:
12233: <li>
12234: <p>When installing libraries, preface the
12235: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12236: <span class="citerefentry"><span class=
12237: "refentrytitle">install</span>(1)</span></a> or
12238: <a href=
12239: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12240: <span class="citerefentry"><span class=
12241: "refentrytitle">cp</span>(1)</span></a> command
12242: with “<span class="quote">${LIBTOOL}
12243: --mode=install</span>”, and change the
1.45 wiz 12244: library name to <code xmlns=
12245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12246: "filename">.la</code>. e.g.</p>
1.1 grant 12247: <pre class="programlisting">
1.51 rillig 12248: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12249: </pre>
12250:
1.45 wiz 12251: <p>This will install the static <code xmlns=
12252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12253: "filename">.a</code>, shared library, any needed
1.1 grant 12254: symlinks, and run <a href=
12255: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12256: <span class="citerefentry"><span class=
12257: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12258: </li>
12259:
12260: <li>
1.45 wiz 12261: <p>In your <code xmlns=
12262: "http://www.w3.org/TR/xhtml1/transitional" class=
12263: "filename">PLIST</code>, include only the
12264: <code xmlns=
12265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12266: "filename">.la</code> file (this is a change from
12267: previous behaviour).</p>
1.1 grant 12268: </li>
12269: </ol>
12270: </div>
12271: </div>
12272:
1.55 ! rillig 12273: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12274: <div class="titlepage">
12275: <div>
12276: <div>
1.55 ! rillig 12277: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12278: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12279: GNU packages that already support libtool</h3>
1.1 grant 12280: </div>
12281: </div>
12282: </div>
12283:
1.14 xtraeme 12284: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12285: the package Makefile. This will override the package's
12286: own libtool in most cases. For older libtool using
1.1 grant 12287: packages, libtool is made by ltconfig script during the
12288: do-configure step; you can check the libtool script
1.14 xtraeme 12289: location by doing <span><strong class="command">make
12290: configure; find work*/ -name
12291: libtool</strong></span>.</p>
12292:
12293: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12294: specifies which libtool scripts, relative to
12295: <code class="varname">WRKSRC</code>, to override. By
12296: default, it is set to “<span class=
12297: "quote">libtool */libtool */*/libtool</span>”. If
12298: this does not match the location of the package's
12299: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12300:
1.45 wiz 12301: <p>If you do not need <code xmlns=
12302: "http://www.w3.org/TR/xhtml1/transitional" class=
12303: "filename">*.a</code> static libraries built and
12304: installed, then use <code class=
12305: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12306:
1.47 reed 12307: <p>If your package makes use of the
12308: platform-independent library for loading dynamic shared
12309: objects, that comes with libtool (libltdl), you should
12310: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12311:
12312: <p>Some packages use libtool incorrectly so that the
12313: package may not work or build in some circumstances.
12314: Some of the more common errors are:</p>
12315:
12316: <div class="itemizedlist">
12317: <ul type="disc">
12318: <li>
12319: <p>The inclusion of a shared object (-module) as
12320: a dependent library in an executable or library.
12321: This in itself isn't a problem if one of two
12322: things has been done:</p>
12323:
12324: <div class="orderedlist">
12325: <ol type="1">
12326: <li>
12327: <p>The shared object is named correctly,
1.45 wiz 12328: i.e. <code xmlns=
12329: "http://www.w3.org/TR/xhtml1/transitional"
12330: class="filename">libfoo.la</code>, not
12331: <code xmlns=
12332: "http://www.w3.org/TR/xhtml1/transitional"
12333: class="filename">foo.la</code></p>
1.1 grant 12334: </li>
12335:
12336: <li>
12337: <p>The -dlopen option is used when linking
12338: an executable.</p>
12339: </li>
12340: </ol>
12341: </div>
12342: </li>
12343:
12344: <li>
12345: <p>The use of libltdl without the correct calls
12346: to initialisation routines. The function
12347: lt_dlinit() should be called and the macro
1.14 xtraeme 12348: <code class=
12349: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12350: included in executables.</p>
12351: </li>
12352: </ul>
12353: </div>
12354: </div>
12355:
1.55 ! rillig 12356: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12357: <div class="titlepage">
12358: <div>
12359: <div>
1.55 ! rillig 12360: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12361: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12362: Autoconf/Automake</h3>
12363: </div>
12364: </div>
12365: </div>
12366:
12367: <p>If a package needs GNU autoconf or automake to be
12368: executed to regenerate the configure script and
12369: Makefile.in makefile templates, then they should be
1.35 jmmv 12370: executed in a pre-configure target.</p>
1.1 grant 12371:
12372: <p>For packages that need only autoconf:</p>
12373: <pre class="programlisting">
1.51 rillig 12374: AUTOCONF_REQD= 2.50 # if default version is not good enough
12375: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12376: ...
1.1 grant 12377:
1.51 rillig 12378: pre-configure:
12379: cd ${WRKSRC}; autoconf
1.1 grant 12380:
1.51 rillig 12381: ...
1.1 grant 12382: </pre>
12383:
12384: <p>and for packages that need automake and
12385: autoconf:</p>
12386: <pre class="programlisting">
1.51 rillig 12387: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12388: USE_TOOLS+= automake # use "automake14" for automake-1.4
12389: ...
1.1 grant 12390:
1.51 rillig 12391: pre-configure:
12392: cd ${WRKSRC}; \
12393: aclocal; autoheader; \
12394: automake -a --foreign -i; autoconf
12395:
12396: ...
1.1 grant 12397: </pre>
12398:
12399: <p>Packages which use GNU Automake will almost
1.35 jmmv 12400: certainly require GNU Make.</p>
1.1 grant 12401:
12402: <p>There are times when the configure process makes
12403: additional changes to the generated files, which then
12404: causes the build process to try to re-execute the
12405: automake sequence. This is prevented by touching
12406: various files in the configure stage. If this causes
1.14 xtraeme 12407: problems with your package you can set <code class=
12408: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12409: Makefile.</p>
12410: </div>
12411: </div>
12412:
1.55 ! rillig 12413: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12414: <div class="titlepage">
12415: <div>
12416: <div>
12417: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 12418: "fixes-build" id=
! 12419: "fixes-build"></a>15.4. Building the
! 12420: package</h2>
1.1 grant 12421: </div>
12422: </div>
12423: </div>
12424:
1.55 ! rillig 12425: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12426: <div class="titlepage">
12427: <div>
12428: <div>
1.55 ! rillig 12429: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12430: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12431: </div>
12432: </div>
12433: </div>
12434:
1.55 ! rillig 12435: <p>Sometimes you need to compile different code
! 12436: depending on the target platform. The C preprocessor
! 12437: has a set of predefined macros that can be queried by
! 12438: using <code class="varname">#ifdef FOO</code> or
! 12439: <code class="varname">#if defined(FOO)</code>. Among
! 12440: these macros are usually ones that describe the target
! 12441: CPU and operating system. Depending of which of the
! 12442: macros are defined, you can write code that uses
! 12443: features unique to a specific platform. The best way to
! 12444: handle these differences is to use the GNU autotools
! 12445: (automake, autoconf, etc.) to check for specific
! 12446: features (like the existence of a header file, a
! 12447: function or a library).</p>
! 12448:
! 12449: <p>If that is not possible you can use the predefined
! 12450: macros below to configure your code to the platform it
! 12451: runs on. Almost every operating system, hardware
! 12452: architecture and compiler has its own macro. For
! 12453: example, if the macros <code class=
! 12454: "varname">__GNUC__</code>, <code class=
! 12455: "varname">__i386__</code> and <code class=
! 12456: "varname">__NetBSD__</code> are all defined, you know
! 12457: that you are using NetBSD on an Intel CPU, and your
! 12458: compiler is GCC.</p>
! 12459:
! 12460: <div class="sect3" lang="en" xml:lang="en">
! 12461: <div class="titlepage">
! 12462: <div>
! 12463: <div>
! 12464: <h4 class="title"><a name=
! 12465: "fixes-build-cpp-opsys" id=
! 12466: "fixes-build-cpp-opsys"></a>15.4.1.1. CPP
! 12467: defines for operating systems</h4>
! 12468: </div>
! 12469: </div>
! 12470: </div>
! 12471:
! 12472: <p>To distinguish between 4.4 BSD-derived systems and
! 12473: the rest of the world, you should use the following
! 12474: code.</p>
! 12475: <pre class="programlisting">
1.51 rillig 12476: #include <sys/param.h>
1.55 ! rillig 12477: #if (defined(BSD) && BSD >= 199306)
! 12478: /* your BSD-specific code goes here */
! 12479: #else
! 12480: /* non-BSD-specific code */
! 12481: #endif
1.1 grant 12482: </pre>
12483:
1.55 ! rillig 12484: <p>If this distinction is not fine enough, you can
! 12485: also use the following defines.</p>
! 12486: <pre class="programlisting">
! 12487: FreeBSD __FreeBSD__
! 12488: Linux linux, __linux, __linux__
! 12489: NetBSD __NetBSD__
! 12490: OpenBSD __OpenBSD__
! 12491: Solaris sun, __sun (GCC and SunPro), __sun__ (only GCC)
1.1 grant 12492: </pre>
1.55 ! rillig 12493: </div>
1.1 grant 12494:
1.55 ! rillig 12495: <div class="sect3" lang="en" xml:lang="en">
! 12496: <div class="titlepage">
! 12497: <div>
! 12498: <div>
! 12499: <h4 class="title"><a name="fixes-build-cpp-cpu"
! 12500: id="fixes-build-cpp-cpu"></a>15.4.1.2. CPP
! 12501: defines for CPUs</h4>
! 12502: </div>
! 12503: </div>
! 12504: </div>
! 12505: <pre class="programlisting">
! 12506: i386 i386, __i386, __i386__
! 12507: MIPS __mips
! 12508: SPARC sparc, __sparc
! 12509: </pre>
! 12510: </div>
! 12511:
! 12512: <div class="sect3" lang="en" xml:lang="en">
! 12513: <div class="titlepage">
! 12514: <div>
! 12515: <div>
! 12516: <h4 class="title"><a name=
! 12517: "fixes-build-cpp-compiler" id=
! 12518: "fixes-build-cpp-compiler"></a>15.4.1.3. CPP
! 12519: defines for compilers</h4>
! 12520: </div>
! 12521: </div>
! 12522: </div>
! 12523: <pre class="programlisting">
! 12524: GCC __GNUC__ (major version), __GNUC_MINOR__
! 12525: </pre>
! 12526: </div>
1.1 grant 12527: </div>
1.51 rillig 12528:
1.55 ! rillig 12529: <div class="sect2" lang="en" xml:lang="en">
1.51 rillig 12530: <div class="titlepage">
12531: <div>
12532: <div>
1.55 ! rillig 12533: <h3 class="title"><a name="cpp-list" id=
1.51 rillig 12534: "cpp-list"></a>15.4.2. Getting a list of CPP
12535: defines</h3>
12536: </div>
12537: </div>
12538: </div>
12539:
12540: <p>When your system uses the GNU C Compiler, you can
12541: get a list of symbols that are defined by default, e.g.
12542: to identify the platform, with the following
12543: command:</p>
12544: <pre class="programlisting">
12545: gcc -E -dM - < /dev/null
12546: </pre>
12547: </div>
1.1 grant 12548: </div>
12549:
1.55 ! rillig 12550: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12551: <div class="titlepage">
12552: <div>
12553: <div>
12554: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 12555: "package-specific-actions" id=
1.38 dillo 12556: "package-specific-actions"></a>15.5. Package
1.1 grant 12557: specific actions</h2>
12558: </div>
12559: </div>
12560: </div>
12561:
1.55 ! rillig 12562: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12563: <div class="titlepage">
12564: <div>
12565: <div>
1.55 ! rillig 12566: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 12567: "user-interaction"></a>15.5.1. User
1.2 hubertf 12568: interaction</h3>
1.1 grant 12569: </div>
12570: </div>
12571: </div>
12572:
12573: <p>Occasionally, packages require interaction from the
12574: user, and this can be in a number of ways:</p>
12575:
12576: <div class="itemizedlist">
12577: <ul type="disc">
12578: <li>
12579: <p>help in fetching the distfiles</p>
12580: </li>
12581:
12582: <li>
12583: <p>help to configure the package before it is
12584: built</p>
12585: </li>
12586:
12587: <li>
12588: <p>help during the build process</p>
12589: </li>
12590:
12591: <li>
12592: <p>help during the installation of a package</p>
12593: </li>
12594: </ul>
12595: </div>
12596:
1.14 xtraeme 12597: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12598: definition is provided to notify the pkgsrc mechanism
12599: of an interactive stage which will be needed, and this
1.45 wiz 12600: should be set in the package's <code xmlns=
12601: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12602: "filename">Makefile</code>, e.g.:</p>
1.1 grant 12603: <pre class="programlisting">
1.51 rillig 12604: INTERACTIVE_STAGE= build
1.1 grant 12605: </pre>
12606:
12607: <p>Multiple interactive stages can be specified:</p>
12608: <pre class="programlisting">
1.51 rillig 12609: INTERACTIVE_STAGE= configure install
1.1 grant 12610: </pre>
12611: </div>
12612:
1.55 ! rillig 12613: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12614: <div class="titlepage">
12615: <div>
12616: <div>
1.55 ! rillig 12617: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 12618: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12619: licenses</h3>
12620: </div>
12621: </div>
12622: </div>
12623:
1.44 gdt 12624: <p>A package may be covered by a license which the user
12625: has or has not agreed to accept. For these cases,
12626: pkgsrc contains a mechanism to note that a package is
12627: covered by a particular license, and the package cannot
12628: be built unless the user has accepted the license.
12629: (Installation of binary packages are not currently
12630: subject to this mechanism.) Packages with licenses that
12631: are either Open Source according to the Open Source
12632: Initiative or Free according to the Free Software
12633: Foundation will not be marked with a license tag.
12634: Packages with licenses that have not been determined to
12635: meet either definition will be marked with a license
12636: tag referring to the license. This will prevent
12637: building unless pkgsrc is informed that the license is
12638: acceptable, and enables displaying the license.</p>
12639:
12640: <p>The license tag mechanism is intended to address
12641: copyright-related issues surrounding building,
12642: installing and using a package, and not to address
12643: redistribution issues (see <code class=
12644: "varname">RESTRICTED</code> and <code class=
12645: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12646: above definition of licenses for which tags are not
12647: needed implies that packages with redistribution
12648: restrictions should have tags.</p>
12649:
12650: <p>Denoting that a package is covered by a particular
1.45 wiz 12651: license is done by placing the license in <code xmlns=
12652: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12653: "filename">pkgsrc/licenses</code> and setting the
12654: <code class="varname">LICENSE</code> variable to a
12655: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12656: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12657: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 12658: target="_top"><code xmlns="" class=
12659: "filename">graphics/xv</code></a>:</p>
1.1 grant 12660: <pre class="programlisting">
1.51 rillig 12661: LICENSE= xv-license
1.1 grant 12662: </pre>
12663:
12664: <p>When trying to build, the user will get a notice
1.44 gdt 12665: that the package is covered by a license which has not
12666: been accepted:</p>
1.1 grant 12667: <pre class="programlisting">
1.51 rillig 12668: <code class="prompt">%</code> <strong class=
1.14 xtraeme 12669: "userinput"><code>make</code></strong>
1.51 rillig 12670: ===> xv-3.10anb9 has an unacceptable license: xv-license.
12671: ===> To view the license, enter "/usr/bin/make show-license".
12672: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12673: ===> ACCEPTABLE_LICENSES+=xv-license
12674: *** Error code 1
1.1 grant 12675: </pre>
12676:
1.14 xtraeme 12677: <p>The license can be viewed with <span><strong class=
12678: "command">make show-license</strong></span>, and if it
12679: is considered appropriate, the line printed above can
1.45 wiz 12680: be added to <code xmlns=
12681: "http://www.w3.org/TR/xhtml1/transitional" class=
12682: "filename">/etc/mk.conf</code> to indicate acceptance
12683: of the particular license:</p>
1.1 grant 12684: <pre class="programlisting">
1.51 rillig 12685: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12686: </pre>
12687:
12688: <p>When adding a package with a new license, the
1.45 wiz 12689: license text should be added to <code xmlns=
12690: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12691: "filename">pkgsrc/licenses</code> for displaying. A
12692: list of known licenses can be seen in this directory as
12693: well as by looking at the list of (commented out)
12694: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 12695: variable settings in <code xmlns=
12696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12697: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 12698:
1.44 gdt 12699: <p>The use of <code class=
12700: "varname">LICENSE=shareware</code>, <code class=
12701: "varname">LICENSE=no-commercial-use</code>, and similar
12702: language is deprecated because it does not crisply
12703: refer to a particular license text. Another problem
12704: with such usage is that it does not enable a user to
12705: denote acceptance of the license for a single package
12706: without accepting the same license text for another
12707: package. In particular, this can be inappropriate when
12708: e.g. one accepts a particular license to indicate to
12709: pkgsrc that a fee has been paid.</p>
1.1 grant 12710: </div>
12711:
1.55 ! rillig 12712: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12713: <div class="titlepage">
12714: <div>
12715: <div>
1.30 wiz 12716: <h3 class="title"><a name=
1.55 ! rillig 12717: "installing-score-files" id=
1.38 dillo 12718: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 12719: score files</h3>
1.1 grant 12720: </div>
12721: </div>
12722: </div>
12723:
12724: <p>Certain packages, most of them in the games
12725: category, install a score file that allows all users on
12726: the system to record their highscores. In order for
12727: this to work, the binaries need to be installed setgid
12728: and the score files owned by the appropriate group
12729: and/or owner (traditionally the "games" user/group).
12730: The following variables, documented in more detail in
1.45 wiz 12731: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12732: class="filename">mk/defaults/mk.conf</code>, control
12733: this behaviour: <code class=
1.14 xtraeme 12734: "varname">SETGIDGAME</code>, <code class=
12735: "varname">GAMEDATAMODE</code>, <code class=
12736: "varname">GAMEGRP</code>, <code class=
12737: "varname">GAMEMODE</code>, <code class=
12738: "varname">GAMEOWN</code>.</p>
1.1 grant 12739:
12740: <p>Note that per default, setgid installation of games
1.14 xtraeme 12741: is disabled; setting <code class=
12742: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 12743: variables accordingly.</p>
12744:
12745: <p>A package should therefor never hard code file
1.14 xtraeme 12746: ownership or access permissions but rely on
12747: <code class="varname">INSTALL_GAME</code> and
12748: <code class="varname">INSTALL_GAME_DATA</code> to set
12749: these correctly.</p>
1.1 grant 12750: </div>
12751:
1.55 ! rillig 12752: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12753: <div class="titlepage">
12754: <div>
12755: <div>
1.55 ! rillig 12756: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 12757: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 12758: containing perl scripts</h3>
1.1 grant 12759: </div>
12760: </div>
12761: </div>
12762:
12763: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 12764: set <code class="varname">REPLACE_PERL</code> to ensure
12765: that the proper interpreter path is set. <code class=
12766: "varname">REPLACE_PERL</code> should contain a list of
12767: scripts, relative to <code class=
12768: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 12769: </div>
12770:
1.55 ! rillig 12771: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12772: <div class="titlepage">
12773: <div>
12774: <div>
1.55 ! rillig 12775: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 12776: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 12777: hardcoded paths to other interpreters</h3>
12778: </div>
12779: </div>
12780: </div>
12781:
12782: <p>Your package may also contain scripts with hardcoded
12783: paths to other interpreters besides (or as well as)
12784: perl. To correct the full pathname to the script
12785: interpreter, you need to set the following definitions
1.45 wiz 12786: in your <code xmlns=
12787: "http://www.w3.org/TR/xhtml1/transitional" class=
12788: "filename">Makefile</code> (we shall use
12789: <span><strong class="command">tclsh</strong></span> in
12790: this example):</p>
1.1 grant 12791: <pre class="programlisting">
1.51 rillig 12792: REPLACE_INTERPRETER+= tcl
12793: _REPLACE.tcl.old= .*/bin/tclsh
12794: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
12795: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
12796: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 12797: </pre>
12798: </div>
12799:
1.55 ! rillig 12800: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12801: <div class="titlepage">
12802: <div>
12803: <div>
1.55 ! rillig 12804: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 12805: "perl-modules"></a>15.5.6. Packages
1.30 wiz 12806: installing perl modules</h3>
1.1 grant 12807: </div>
12808: </div>
12809: </div>
12810:
12811: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 12812: include the Makefile fragment <code xmlns=
12813: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12814: "filename">../../lang/perl5/module.mk</code>. It
12815: provides a <span><strong class=
12816: "command">do-configure</strong></span> target for the
12817: standard perl configuration for such modules as well as
12818: various hooks to tune this configuration. See comments
12819: in this file for details.</p>
1.1 grant 12820:
12821: <p>Perl5 modules will install into different places
12822: depending on the version of perl used during the build
12823: process. To address this, pkgsrc will append lines to
1.45 wiz 12824: the <code xmlns=
12825: "http://www.w3.org/TR/xhtml1/transitional" class=
12826: "filename">PLIST</code> corresponding to the files
12827: listed in the installed <code xmlns=
12828: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12829: "filename">.packlist</code> file generated by most
12830: perl5 modules. This is invoked by defining <code class=
12831: "varname">PERL5_PACKLIST</code> to a space-separated
12832: list of paths to packlist files, e.g.:</p>
1.1 grant 12833: <pre class="programlisting">
1.51 rillig 12834: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 12835: </pre>
12836:
1.14 xtraeme 12837: <p>The variables <code class=
12838: "varname">PERL5_SITELIB</code>, <code class=
12839: "varname">PERL5_SITEARCH</code>, and <code class=
12840: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 12841: locations in which perl5 modules may be installed, and
12842: may be used by perl5 packages that don't have a
12843: packlist. These three variables are also substituted
1.45 wiz 12844: for in the <code xmlns=
12845: "http://www.w3.org/TR/xhtml1/transitional" class=
12846: "filename">PLIST</code>.</p>
1.1 grant 12847: </div>
12848:
1.55 ! rillig 12849: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12850: <div class="titlepage">
12851: <div>
12852: <div>
1.55 ! rillig 12853: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 12854: "faq.info-files"></a>15.5.7. Packages
1.1 grant 12855: installing info files</h3>
12856: </div>
12857: </div>
12858: </div>
12859:
12860: <p>Some packages install info files or use the
12861: “<span class="quote">makeinfo</span>” or
12862: “<span class="quote">install-info</span>”
12863: commands. Each of the info files:</p>
12864:
12865: <div class="itemizedlist">
12866: <ul type="disc">
12867: <li>
12868: <p>is considered to be installed in the directory
1.45 wiz 12869: <code xmlns=
12870: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12871: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 12872: </li>
12873:
12874: <li>
12875: <p>is registered in the Info directory file
1.45 wiz 12876: <code xmlns=
12877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12878: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 12879: </li>
12880:
12881: <li>
12882: <p>and must be listed as a filename in the
1.14 xtraeme 12883: <code class="varname">INFO_FILES</code> variable
12884: in the package Makefile.</p>
1.1 grant 12885: </li>
12886: </ul>
12887: </div>
12888:
1.14 xtraeme 12889: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 12890: “<span class="quote">info</span>” and can
1.45 wiz 12891: be overridden in the package Makefile. <code xmlns=
12892: "http://www.w3.org/TR/xhtml1/transitional" class=
12893: "filename">INSTALL</code> and <code xmlns=
12894: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12895: "filename">DEINSTALL</code> scripts will be generated
12896: to handle registration of the info files in the Info
1.1 grant 12897: directory file. The “<span class=
12898: "quote">install-info</span>” command used for the
12899: info files registration is either provided by the
12900: system, or by a special purpose package automatically
12901: added as dependency if needed.</p>
12902:
12903: <p>A package which needs the “<span class=
12904: "quote">makeinfo</span>” command at build time
1.14 xtraeme 12905: must define the variable <code class=
12906: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 12907: minimum version of the “<span class=
12908: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 12909: should be noted with the <code class=
12910: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 12911: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12912: class="filename">Makefile</code>. By default, a minimum
12913: version of 3.12 is required. If the system does not
12914: provide a <span><strong class=
1.14 xtraeme 12915: "command">makeinfo</strong></span> command or if it
12916: does not match the required minimum, a build dependency
12917: on the <a xmlns=
12918: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 12919: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 12920: target="_top"><code xmlns="" class=
12921: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 12922: added automatically.</p>
1.1 grant 12923:
12924: <p>The build and installation process of the software
12925: provided by the package should not use the
1.14 xtraeme 12926: <span><strong class=
12927: "command">install-info</strong></span> command as the
12928: registration of info files is the task of the package
1.45 wiz 12929: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12930: class="filename">INSTALL</code> script, and it must use
12931: the appropriate <span><strong class=
1.14 xtraeme 12932: "command">makeinfo</strong></span> command.</p>
1.1 grant 12933:
1.47 reed 12934: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 12935: creates overriding scripts for the <span><strong class=
12936: "command">install-info</strong></span> and
12937: <span><strong class="command">makeinfo</strong></span>
12938: commands in a directory listed early in <code class=
12939: "varname">PATH</code>.</p>
1.1 grant 12940:
1.14 xtraeme 12941: <p>The script overriding <span><strong class=
12942: "command">install-info</strong></span> has no effect
12943: except the logging of a message. The script overriding
12944: <span><strong class="command">makeinfo</strong></span>
12945: logs a message and according to the value of
12946: <code class="varname">USE_MAKEINFO</code> and
12947: <code class="varname">TEXINFO_REQD</code> either run
12948: the appropriate <span><strong class=
12949: "command">makeinfo</strong></span> command or exit on
12950: error.</p>
1.1 grant 12951: </div>
12952:
1.55 ! rillig 12953: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12954: <div class="titlepage">
12955: <div>
12956: <div>
1.55 ! rillig 12957: <h3 class="title"><a name="gconf2-data-files" id=
1.38 dillo 12958: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 12959: installing GConf2 data files</h3>
1.1 grant 12960: </div>
12961: </div>
12962: </div>
12963:
1.45 wiz 12964: <p>If a package installs <code xmlns=
12965: "http://www.w3.org/TR/xhtml1/transitional" class=
12966: "filename">.schemas</code> or <code xmlns=
12967: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12968: "filename">.entries</code> files, used by GConf2, you
1.1 grant 12969: need to take some extra steps to make sure they get
12970: registered in the database:</p>
12971:
12972: <div class="orderedlist">
12973: <ol type="1">
12974: <li>
1.45 wiz 12975: <p>Include <code xmlns=
12976: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12977: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 12978: instead of its <code xmlns=
12979: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12980: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12981: care of rebuilding the GConf2 database at
12982: installation and deinstallation time, and tells
12983: the package where to install GConf2 data files
12984: using some standard configure arguments. It also
12985: disallows any access to the database directly
12986: from the package.</p>
12987: </li>
12988:
12989: <li>
12990: <p>Ensure that the package installs its
1.45 wiz 12991: <code xmlns=
12992: "http://www.w3.org/TR/xhtml1/transitional" class=
12993: "filename">.schemas</code> files under
12994: <code xmlns=
12995: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12996: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 12997: If they get installed under <code xmlns=
12998: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12999: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 13000: manually patch the package.</p>
13001: </li>
13002:
13003: <li>
13004: <p>Check the PLIST and remove any entries under
13005: the etc/gconf directory, as they will be handled
13006: automatically. See <a href="#faq.conf" title=
1.38 dillo 13007: "7.14. How do I change the location of configuration files?">
13008: Section 7.14, “How do I change the
1.35 jmmv 13009: location of configuration files?”</a> for
13010: more information.</p>
1.1 grant 13011: </li>
13012:
13013: <li>
1.14 xtraeme 13014: <p>Define the <code class=
13015: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 13016: <code xmlns=
13017: "http://www.w3.org/TR/xhtml1/transitional" class=
13018: "filename">Makefile</code> with a list of all
13019: <code xmlns=
13020: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13021: "filename">.schemas</code> files installed by the
13022: package, if any. Names must not contain any
13023: directories in them.</p>
1.1 grant 13024: </li>
13025:
13026: <li>
1.14 xtraeme 13027: <p>Define the <code class=
13028: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 13029: <code xmlns=
13030: "http://www.w3.org/TR/xhtml1/transitional" class=
13031: "filename">Makefile</code> with a list of all
13032: <code xmlns=
13033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13034: "filename">.entries</code> files installed by the
13035: package, if any. Names must not contain any
13036: directories in them.</p>
1.1 grant 13037: </li>
13038: </ol>
13039: </div>
13040: </div>
13041:
1.55 ! rillig 13042: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13043: <div class="titlepage">
13044: <div>
13045: <div>
1.30 wiz 13046: <h3 class="title"><a name=
1.55 ! rillig 13047: "scrollkeeper-data-files" id=
1.38 dillo 13048: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 13049: installing scrollkeeper data files</h3>
1.1 grant 13050: </div>
13051: </div>
13052: </div>
13053:
1.45 wiz 13054: <p>If a package installs <code xmlns=
13055: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13056: "filename">.omf</code> files, used by scrollkeeper, you
13057: need to take some extra steps to make sure they get
13058: registered in the database:</p>
1.1 grant 13059:
13060: <div class="orderedlist">
13061: <ol type="1">
13062: <li>
1.45 wiz 13063: <p>Include <code xmlns=
13064: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13065: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 13066: instead of its <code xmlns=
13067: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13068: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13069: care of rebuilding the scrollkeeper database at
13070: installation and deinstallation time, and
13071: disallows any access to it directly from the
13072: package.</p>
13073: </li>
13074:
13075: <li>
13076: <p>Check the PLIST and remove any entries under
1.45 wiz 13077: the <code xmlns=
13078: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13079: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 13080: as they will be handled automatically.</p>
13081: </li>
13082:
13083: <li>
1.45 wiz 13084: <p>Remove the <code xmlns=
13085: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13086: "filename">share/omf</code> directory from the
13087: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 13088: </li>
13089: </ol>
13090: </div>
13091: </div>
13092:
1.55 ! rillig 13093: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13094: <div class="titlepage">
13095: <div>
13096: <div>
1.55 ! rillig 13097: <h3 class="title"><a name="x11-fonts" id=
1.38 dillo 13098: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 13099: X11 fonts</h3>
13100: </div>
13101: </div>
13102: </div>
13103:
13104: <p>If a package installs font files, you will need to
13105: rebuild the fonts database in the directory where they
13106: get installed at installation and deinstallation time.
1.45 wiz 13107: This can be automatically done by using <code xmlns=
13108: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13109: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 13110: include in your <code xmlns=
13111: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13112: "filename">Makefile</code>.</p>
1.1 grant 13113:
13114: <p>When the file is included, you can list the
1.14 xtraeme 13115: directories where fonts are installed in the
13116: <code class="varname">FONTS_<em class=
13117: "replaceable"><code>type</code></em>_DIRS</code>
13118: variables, where <em class=
13119: "replaceable"><code>type</code></em> can be one of
13120: “<span class="quote">TTF</span>”,
1.1 grant 13121: “<span class="quote">TYPE1</span>” or
13122: “<span class="quote">X11</span>”. Also make
1.45 wiz 13123: sure that the database file <code xmlns=
13124: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13125: "filename">fonts.dir</code> is not listed in the
1.1 grant 13126: PLIST.</p>
13127:
13128: <p>Note that you should not create new directories for
13129: fonts; instead use the standard ones to avoid that the
13130: user needs to manually configure his X server to find
13131: them.</p>
13132: </div>
13133:
1.55 ! rillig 13134: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13135: <div class="titlepage">
13136: <div>
13137: <div>
1.55 ! rillig 13138: <h3 class="title"><a name="gtk2-modules" id=
1.38 dillo 13139: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 13140: installing GTK2 modules</h3>
1.1 grant 13141: </div>
13142: </div>
13143: </div>
13144:
1.47 reed 13145: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 13146: need to take some extra steps to get them registered in
13147: the GTK2 database properly:</p>
13148:
13149: <div class="orderedlist">
13150: <ol type="1">
13151: <li>
1.45 wiz 13152: <p>Include <code xmlns=
13153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13154: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13155: instead of its <code xmlns=
13156: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13157: "filename">buildlink3.mk</code> file. This takes
13158: care of rebuilding the database at installation
13159: and deinstallation time.</p>
1.1 grant 13160: </li>
13161:
13162: <li>
1.14 xtraeme 13163: <p>Set <code class=
13164: "varname">GTK2_IMMODULES=YES</code> if your
13165: package installs GTK2 immodules.</p>
1.1 grant 13166: </li>
13167:
13168: <li>
1.14 xtraeme 13169: <p>Set <code class=
13170: "varname">GTK2_LOADERS=YES</code> if your package
13171: installs GTK2 loaders.</p>
1.1 grant 13172: </li>
13173:
13174: <li>
1.47 reed 13175: <p>Patch the package to not touch any of the GTK2
1.1 grant 13176: databases directly. These are:</p>
13177:
13178: <div class="itemizedlist">
13179: <ul type="disc">
13180: <li>
1.45 wiz 13181: <p><code xmlns=
13182: "http://www.w3.org/TR/xhtml1/transitional"
13183: class=
1.14 xtraeme 13184: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13185: </li>
13186:
13187: <li>
1.45 wiz 13188: <p><code xmlns=
13189: "http://www.w3.org/TR/xhtml1/transitional"
13190: class=
1.14 xtraeme 13191: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13192: </li>
13193: </ul>
13194: </div>
13195: </li>
13196:
13197: <li>
13198: <p>Check the PLIST and remove any entries under
1.45 wiz 13199: the <code xmlns=
13200: "http://www.w3.org/TR/xhtml1/transitional" class=
13201: "filename">libdata/gtk-2.0</code> directory, as
13202: they will be handled automatically.</p>
1.1 grant 13203: </li>
13204: </ol>
13205: </div>
13206: </div>
13207:
1.55 ! rillig 13208: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13209: <div class="titlepage">
13210: <div>
13211: <div>
1.55 ! rillig 13212: <h3 class="title"><a name="sgml-xml-data" id=
1.38 dillo 13213: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 13214: installing SGML or XML data</h3>
1.1 grant 13215: </div>
13216: </div>
13217: </div>
13218:
13219: <p>If a package installs SGML or XML data files that
13220: need to be registered in system-wide catalogs (like
13221: DTDs, sub-catalogs, etc.), you need to take some extra
13222: steps:</p>
13223:
13224: <div class="orderedlist">
13225: <ol type="1">
13226: <li>
1.45 wiz 13227: <p>Include <code xmlns=
13228: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13229: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13230: in your <code xmlns=
13231: "http://www.w3.org/TR/xhtml1/transitional" class=
13232: "filename">Makefile</code>, which takes care of
13233: registering those files in system-wide catalogs
13234: at installation and deinstallation time.</p>
1.1 grant 13235: </li>
13236:
13237: <li>
1.14 xtraeme 13238: <p>Set <code class="varname">SGML_CATALOGS</code>
13239: to the full path of any SGML catalogs installed
13240: by the package.</p>
1.1 grant 13241: </li>
13242:
13243: <li>
1.14 xtraeme 13244: <p>Set <code class="varname">XML_CATALOGS</code>
13245: to the full path of any XML catalogs installed by
1.1 grant 13246: the package.</p>
13247: </li>
13248:
13249: <li>
1.14 xtraeme 13250: <p>Set <code class="varname">SGML_ENTRIES</code>
13251: to individual entries to be added to the SGML
1.1 grant 13252: catalog. These come in groups of three strings;
13253: see xmlcatmgr(1) for more information
13254: (specifically, arguments recognized by the 'add'
13255: action). Note that you will normally not use this
13256: variable.</p>
13257: </li>
13258:
13259: <li>
1.14 xtraeme 13260: <p>Set <code class="varname">XML_ENTRIES</code>
13261: to individual entries to be added to the XML
1.1 grant 13262: catalog. These come in groups of three strings;
13263: see xmlcatmgr(1) for more information
13264: (specifically, arguments recognized by the 'add'
13265: action). Note that you will normally not use this
13266: variable.</p>
13267: </li>
13268: </ol>
13269: </div>
13270: </div>
13271:
1.55 ! rillig 13272: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13273: <div class="titlepage">
13274: <div>
13275: <div>
1.55 ! rillig 13276: <h3 class="title"><a name="mime-database" id=
1.38 dillo 13277: "mime-database"></a>15.5.13. Packages
1.30 wiz 13278: installing extensions to the MIME database</h3>
1.1 grant 13279: </div>
13280: </div>
13281: </div>
13282:
13283: <p>If a package provides extensions to the MIME
1.45 wiz 13284: database by installing <code xmlns=
13285: "http://www.w3.org/TR/xhtml1/transitional" class=
13286: "filename">.xml</code> files inside <code xmlns=
13287: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13288: "filename">${PREFIX}/share/mime/packages</code>, you
13289: need to take some extra steps to ensure that the
13290: database is kept consistent with respect to these new
13291: files:</p>
1.1 grant 13292:
13293: <div class="orderedlist">
13294: <ol type="1">
13295: <li>
1.45 wiz 13296: <p>Include <code xmlns=
13297: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13298: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13299: (avoid using the <code xmlns=
13300: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13301: "filename">buildlink3.mk</code> file from this
13302: same directory, which is reserved for inclusion
1.45 wiz 13303: from other <code xmlns=
13304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13305: "filename">buildlink3.mk</code> files). It takes
13306: care of rebuilding the MIME database at
13307: installation and deinstallation time, and
13308: disallows any access to it directly from the
1.1 grant 13309: package.</p>
13310: </li>
13311:
13312: <li>
13313: <p>Check the PLIST and remove any entries under
1.45 wiz 13314: the <code xmlns=
13315: "http://www.w3.org/TR/xhtml1/transitional" class=
13316: "filename">share/mime</code> directory,
13317: <span class="emphasis"><em>except</em></span> for
13318: files saved under <code xmlns=
13319: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13320: "filename">share/mime/packages</code>. The former
1.1 grant 13321: are handled automatically by the
1.47 reed 13322: update-mime-database program, but the latter are
1.1 grant 13323: package-dependent and must be removed by the
13324: package that installed them in the first
13325: place.</p>
13326: </li>
13327:
13328: <li>
1.45 wiz 13329: <p>Remove any <code xmlns=
13330: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13331: "filename">share/mime/*</code> directories from
13332: the PLIST. They will be handled by the
1.1 grant 13333: shared-mime-info package.</p>
13334: </li>
13335: </ol>
13336: </div>
13337: </div>
13338:
1.55 ! rillig 13339: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13340: <div class="titlepage">
13341: <div>
13342: <div>
1.55 ! rillig 13343: <h3 class="title"><a name="intltool" id=
1.38 dillo 13344: "intltool"></a>15.5.14. Packages using
1.1 grant 13345: intltool</h3>
13346: </div>
13347: </div>
13348: </div>
13349:
13350: <p>If a package uses intltool during its build, include
1.45 wiz 13351: the <code xmlns=
13352: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13353: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13354: file, which forces it to use the intltool package
13355: provided by pkgsrc, instead of the one bundled with the
13356: distribution file.</p>
13357:
13358: <p>This tracks intltool's build-time dependencies and
13359: uses the latest available version; this way, the
13360: package benefits of any bug fixes that may have
13361: appeared since it was released.</p>
13362: </div>
1.18 xtraeme 13363:
1.55 ! rillig 13364: <div class="sect2" lang="en" xml:lang="en">
1.18 xtraeme 13365: <div class="titlepage">
13366: <div>
13367: <div>
1.55 ! rillig 13368: <h3 class="title"><a name="startup-scripts" id=
1.38 dillo 13369: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13370: installing startup scripts</h3>
1.18 xtraeme 13371: </div>
13372: </div>
13373: </div>
13374:
13375: <p>If a package contains a rc.d script, it won't be
13376: copied into the startup directory by default, but you
13377: can enable it, by adding the option <code class=
1.45 wiz 13378: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13379: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13380: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13381: the scripts into <code xmlns=
13382: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13383: "filename">/etc/rc.d</code> when a package is
13384: installed, and it will automatically remove the scripts
13385: when the package is deinstalled.</p>
13386: </div>
1.1 grant 13387: </div>
13388:
1.55 ! rillig 13389: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13390: <div class="titlepage">
13391: <div>
13392: <div>
13393: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13394: "feedback-to-author" id=
1.38 dillo 13395: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13396: author</h2>
1.1 grant 13397: </div>
13398: </div>
13399: </div>
13400:
13401: <p>If you have found any bugs in the package you make
13402: available, if you had to do special steps to make it run
13403: under NetBSD or if you enhanced the software in various
13404: other ways, be sure to report these changes back to the
13405: original author of the program! With that kind of
13406: support, the next release of the program can incorporate
13407: these fixes, and people not using the NetBSD packages
13408: system can win from your efforts.</p>
13409:
13410: <p>Support the idea of free software!</p>
13411: </div>
13412: </div>
13413:
1.55 ! rillig 13414: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 13415: <div class="titlepage">
13416: <div>
13417: <div>
1.55 ! rillig 13418: <h2 class="title"><a name="debug" id=
1.38 dillo 13419: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13420: </div>
13421: </div>
13422: </div>
13423:
13424: <p>To check out all the gotchas when building a package,
13425: here are the steps that I do in order to get a package
13426: working. Please note this is basically the same as what was
13427: explained in the previous sections, only with some
13428: debugging aids.</p>
13429:
13430: <div class="itemizedlist">
13431: <ul type="disc">
13432: <li>
1.14 xtraeme 13433: <p>Be sure to set <code class=
1.45 wiz 13434: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13435: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13436: "filename">/etc/mk.conf</code></p>
1.1 grant 13437: </li>
13438:
13439: <li>
13440: <p>Install <a xmlns=
13441: "http://www.w3.org/TR/xhtml1/transitional" href=
13442: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13443: target="_top"><code xmlns="" class=
13444: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13445: directory for a new package, change into it, then run
13446: <span><strong class=
13447: "command">url2pkg</strong></span>:</p>
1.1 grant 13448: <pre class="screen">
1.14 xtraeme 13449: <code class="prompt">%</code> <strong class=
13450: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13451: "replaceable"><code>category</code></em>/<em class=
13452: "replaceable"><code>examplepkg</code></em></code></strong>
13453: <code class="prompt">%</code> <strong class=
13454: "userinput"><code>cd /usr/pkgsrc/<em class=
13455: "replaceable"><code>category</code></em>/<em class=
13456: "replaceable"><code>examplepkg</code></em></code></strong>
13457: <code class="prompt">%</code> <strong class=
13458: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13459: </pre>
13460: </li>
13461:
13462: <li>
1.45 wiz 13463: <p>Edit the <code xmlns=
13464: "http://www.w3.org/TR/xhtml1/transitional" class=
13465: "filename">Makefile</code> as requested.</p>
1.1 grant 13466: </li>
13467:
13468: <li>
1.45 wiz 13469: <p>Fill in the <code xmlns=
13470: "http://www.w3.org/TR/xhtml1/transitional" class=
13471: "filename">DESCR</code> file</p>
1.1 grant 13472: </li>
13473:
13474: <li>
1.14 xtraeme 13475: <p>Run <span><strong class="command">make
13476: configure</strong></span></p>
1.1 grant 13477: </li>
13478:
13479: <li>
13480: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13481: and the configure step to the package's <code xmlns=
13482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13483: "filename">Makefile</code>.</p>
1.1 grant 13484: </li>
13485:
13486: <li>
13487: <p>Make the package compile, doing multiple rounds
13488: of</p>
13489: <pre class="screen">
1.14 xtraeme 13490: <code class="prompt">%</code> <strong class=
13491: "userinput"><code>make</code></strong>
13492: <code class="prompt">%</code> <strong class=
13493: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13494: <code class="prompt">%</code> <strong class=
13495: "userinput"><code>mkpatches</code></strong>
13496: <code class="prompt">%</code> <strong class=
13497: "userinput"><code>patchdiff</code></strong>
13498: <code class="prompt">%</code> <strong class=
13499: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13500: <code class="prompt">%</code> <strong class=
13501: "userinput"><code>make mps</code></strong>
13502: <code class="prompt">%</code> <strong class=
13503: "userinput"><code>make clean</code></strong>
1.1 grant 13504: </pre>
13505:
13506: <p>Doing as non-root user will ensure that no files
13507: are modified that shouldn't be, especially during the
1.14 xtraeme 13508: build phase. <span><strong class=
13509: "command">mkpatches</strong></span>,
13510: <span><strong class=
13511: "command">patchdiff</strong></span> and
13512: <span><strong class="command">pkgvi</strong></span>
13513: are from the <a xmlns=
1.1 grant 13514: "http://www.w3.org/TR/xhtml1/transitional" href=
13515: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13516: target="_top"><code xmlns="" class=
13517: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13518: </li>
13519:
13520: <li>
1.45 wiz 13521: <p>Look at the <code xmlns=
13522: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13523: "filename">Makefile</code>, fix if necessary; see
13524: <a href="#components.Makefile" title=
1.38 dillo 13525: "8.1. Makefile">Section 8.1,
1.45 wiz 13526: “<code xmlns=
13527: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13528: "filename">Makefile</code>”</a>.</p>
1.1 grant 13529: </li>
13530:
13531: <li>
1.45 wiz 13532: <p>Generate a <code xmlns=
13533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13534: "filename">PLIST</code>:</p>
1.1 grant 13535: <pre class="screen">
1.14 xtraeme 13536: <code class="prompt">#</code> <strong class=
13537: "userinput"><code>make install</code></strong>
13538: <code class="prompt">#</code> <strong class=
13539: "userinput"><code>make print-PLIST >PLIST</code></strong>
13540: <code class="prompt">#</code> <strong class=
13541: "userinput"><code>make deinstall</code></strong>
13542: <code class="prompt">#</code> <strong class=
13543: "userinput"><code>make install</code></strong>
13544: <code class="prompt">#</code> <strong class=
13545: "userinput"><code>make deinstall</code></strong>
1.1 grant 13546: </pre>
13547:
1.45 wiz 13548: <p>You usually need to be <code xmlns=
13549: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13550: "username">root</code> to do this. Look if there are
1.1 grant 13551: any files left:</p>
13552: <pre class="screen">
1.14 xtraeme 13553: <code class="prompt">#</code> <strong class=
13554: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13555: </pre>
13556:
13557: <p>If this reveals any files that are missing in
1.45 wiz 13558: <code xmlns=
13559: "http://www.w3.org/TR/xhtml1/transitional" class=
13560: "filename">PLIST</code>, add them.</p>
1.1 grant 13561: </li>
13562:
13563: <li>
1.45 wiz 13564: <p>Now that the <code xmlns=
13565: "http://www.w3.org/TR/xhtml1/transitional" class=
13566: "filename">PLIST</code> is OK, install the package
13567: again and make a binary package:</p>
1.1 grant 13568: <pre class="screen">
1.14 xtraeme 13569: <code class="prompt">#</code> <strong class=
13570: "userinput"><code>make reinstall</code></strong>
13571: <code class="prompt">#</code> <strong class=
13572: "userinput"><code>make package</code></strong>
1.1 grant 13573: </pre>
13574: </li>
13575:
13576: <li>
13577: <p>Delete the installed package:</p>
13578: <pre class="screen">
1.14 xtraeme 13579: <code class="prompt">#</code> <strong class=
13580: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13581: </pre>
13582: </li>
13583:
13584: <li>
1.14 xtraeme 13585: <p>Repeat the above <span><strong class=
13586: "command">make print-PLIST</strong></span> command,
13587: which shouldn't find anything now:</p>
1.1 grant 13588: <pre class="screen">
1.14 xtraeme 13589: <code class="prompt">#</code> <strong class=
13590: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13591: </pre>
13592: </li>
13593:
13594: <li>
13595: <p>Reinstall the binary package:</p>
13596: <pre class="screen">
1.14 xtraeme 13597: <code class="prompt">#</code> <strong class=
13598: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13599: </pre>
13600: </li>
13601:
13602: <li>
13603: <p>Play with it. Make sure everything works.</p>
13604: </li>
13605:
13606: <li>
1.14 xtraeme 13607: <p>Run <span><strong class=
13608: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 13609: "http://www.w3.org/TR/xhtml1/transitional" href=
13610: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13611: target="_top"><code xmlns="" class=
13612: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 13613: problems it reports:</p>
1.1 grant 13614: <pre class="screen">
1.14 xtraeme 13615: <code class="prompt">#</code> <strong class=
13616: "userinput"><code>pkglint</code></strong>
1.1 grant 13617: </pre>
13618: </li>
13619:
13620: <li>
13621: <p>Submit (or commit, if you have cvs access); see
13622: <a href="#submit" title=
1.38 dillo 13623: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 13624: <i>Submitting and Committing</i></a>.</p>
13625: </li>
13626: </ul>
13627: </div>
13628: </div>
13629:
1.55 ! rillig 13630: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 13631: <div class="titlepage">
13632: <div>
13633: <div>
1.55 ! rillig 13634: <h2 class="title"><a name="submit" id=
1.38 dillo 13635: "submit"></a>Chapter 17. Submitting and
1.1 grant 13636: Committing</h2>
13637: </div>
13638: </div>
13639: </div>
13640:
13641: <div class="toc">
13642: <p><b>Table of Contents</b></p>
13643:
13644: <dl>
1.30 wiz 13645: <dt><span class="sect1"><a href=
1.38 dillo 13646: "#submitting-your-package">17.1. Submitting your
1.30 wiz 13647: packages</a></span></dt>
1.1 grant 13648:
1.30 wiz 13649: <dt><span class="sect1"><a href=
1.41 wiz 13650: "#general-notes-for-changes">17.2. General notes when
13651: adding, updating, or removing packages</a></span></dt>
13652:
13653: <dt><span class="sect1"><a href=
13654: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 13655: package into CVS</a></span></dt>
1.1 grant 13656:
1.30 wiz 13657: <dt><span class="sect1"><a href=
1.41 wiz 13658: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 13659: version</a></span></dt>
1.1 grant 13660:
1.41 wiz 13661: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 13662: Moving a package in pkgsrc</a></span></dt>
1.1 grant 13663: </dl>
13664: </div>
13665:
1.55 ! rillig 13666: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13667: <div class="titlepage">
13668: <div>
13669: <div>
13670: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13671: "submitting-your-package" id=
1.38 dillo 13672: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 13673: your packages</h2>
1.1 grant 13674: </div>
13675: </div>
13676: </div>
13677:
13678: <p>You have to separate between binary and
13679: “<span class="quote">normal</span>” (source)
13680: packages here:</p>
13681:
13682: <div class="itemizedlist">
13683: <ul type="disc">
13684: <li>
13685: <p>precompiled binary packages</p>
13686:
13687: <p>Our policy is that we accept binaries only from
13688: pkgsrc developers to guarantee that the packages
13689: don't contain any trojan horses etc. This is not to
1.13 hubertf 13690: annoy anyone but rather to protect our users!
1.1 grant 13691: You're still free to put up your home-made binary
1.13 hubertf 13692: packages and tell the world where to get them.
13693: NetBSD developers doing bulk builds and wanting to
13694: upload them please see <a href="#bulk-upload"
1.38 dillo 13695: title="6.3.8. Uploading results of a bulk build">
13696: Section 6.3.8, “Uploading results of a
1.13 hubertf 13697: bulk build”</a>.</p>
1.1 grant 13698: </li>
13699:
13700: <li>
13701: <p>packages</p>
13702:
13703: <p>First, check that your package is complete,
13704: compiles and runs well; see <a href="#debug" title=
1.38 dillo 13705: "Chapter 16. Debugging">Chapter 16,
1.1 grant 13706: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 13707: Next, generate an uuencoded gzipped <a href=
13708: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
13709: <span class="citerefentry"><span class=
13710: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 13711: preferably with all files in a single directory.
1.14 xtraeme 13712: Finally, <span><strong class=
13713: "command">send-pr</strong></span> with category
1.1 grant 13714: “<span class="quote">pkg</span>”, a
13715: synopsis which includes the package name and
13716: version number, a short description of your package
13717: (contents of the COMMENT variable or DESCR file are
13718: OK) and attach the archive to your PR.</p>
13719:
13720: <p>If you want to submit several packages, please
13721: send a separate PR for each one, it's easier for us
13722: to track things that way.</p>
13723:
13724: <p>Alternatively, you can also import new packages
13725: into pkgsrc-wip (“<span class="quote">pkgsrc
13726: work-in-progress</span>”); see the homepage
13727: at <a href="http://pkgsrc-wip.sourceforge.net/"
13728: target=
13729: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
13730: details.</p>
13731: </li>
13732: </ul>
13733: </div>
13734: </div>
13735:
1.55 ! rillig 13736: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13737: <div class="titlepage">
13738: <div>
13739: <div>
13740: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13741: "general-notes-for-changes" id=
1.41 wiz 13742: "general-notes-for-changes"></a>17.2. General
13743: notes when adding, updating, or removing
13744: packages</h2>
13745: </div>
13746: </div>
13747: </div>
13748:
13749: <p>Please note all package additions, updates, moves, and
1.45 wiz 13750: removals in <code xmlns=
13751: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13752: "filename">pkgsrc/doc/CHANGES</code>. It's very important
13753: to keep this file up to date and conforming to the
13754: existing format, because it will be used by scripts to
13755: automatically update pages on <a href=
13756: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 13757: and other sites. Additionally, check the <code xmlns=
13758: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13759: "filename">pkgsrc/doc/TODO</code> file and remove the
13760: entry for the package you updated or removed, in case it
13761: was mentioned there.</p>
13762:
13763: <p>There is a make target that helps in creating proper
1.45 wiz 13764: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13765: class="filename">CHANGES</code> entries:
1.41 wiz 13766: <span><strong class="command">make
13767: changes-entry</strong></span>. It uses the optional
13768: <code class="varname">CTYPE</code> and <code class=
13769: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 13770: usage is to first make sure that your <code xmlns=
13771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13772: "filename">CHANGES</code> file is up-to-date (to avoid
13773: having to resolve conflicts later-on) and then to
13774: <span><strong class="command">cd</strong></span> to the
13775: package directory. For package updates,
13776: <span><strong class="command">make
13777: changes-entry</strong></span> is enough. For new
13778: packages, or package moves or removals, set the
13779: <code class="varname">CTYPE</code> variable on the
13780: command line to "Added", "Moved", or "Removed". You can
13781: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 13782: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13783: class="filename">/etc/mk.conf</code> if your local login
13784: name is not the same as your NetBSD login name. Don't
13785: forget to commit the changes to <code xmlns=
13786: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13787: "filename">pkgsrc/doc/CHANGES</code>!</p>
13788: </div>
13789:
1.55 ! rillig 13790: <div class="sect1" lang="en" xml:lang="en">
1.41 wiz 13791: <div class="titlepage">
13792: <div>
13793: <div>
13794: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13795: "committing-importing" id=
1.41 wiz 13796: "committing-importing"></a>17.3. Committing:
1.30 wiz 13797: Importing a package into CVS</h2>
1.1 grant 13798: </div>
13799: </div>
13800: </div>
13801:
13802: <p>This section is only of interest for pkgsrc developers
13803: with write access to the pkgsrc repository. Please
13804: remember that cvs imports files relative to the current
13805: working directory, and that the pathname that you give
1.14 xtraeme 13806: the <span><strong class="command">cvs
13807: import</strong></span> command is so that it knows where
13808: to place the files in the repository. Newly created
13809: packages should be imported with a vendor tag of
13810: “<span class="quote">TNF</span>” and a
13811: release tag of “<span class=
13812: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 13813: <pre class="programlisting">
1.51 rillig 13814: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
13815: <code class=
13816: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 13817: </pre>
13818:
13819: <p>Remember to move the directory from which you imported
13820: out of the way, or cvs will complain the next time you
13821: “<span class="quote">cvs update</span>” your
13822: source tree. Also don't forget to add the new package to
1.45 wiz 13823: the category's <code xmlns=
13824: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13825: "filename">Makefile</code>.</p>
1.1 grant 13826:
13827: <p>The commit message of the initial import should
1.45 wiz 13828: include part of the <code xmlns=
13829: "http://www.w3.org/TR/xhtml1/transitional" class=
13830: "filename">DESCR</code> file, so people reading the
13831: mailing lists know what the package is/does.</p>
1.1 grant 13832:
13833: <p>For new packages, “<span class="quote">cvs
13834: import</span>” is preferred to “<span class=
13835: "quote">cvs add</span>” because the former gets
13836: everything with a single command, and provides a
13837: consistent tag.</p>
13838: </div>
13839:
1.55 ! rillig 13840: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13841: <div class="titlepage">
13842: <div>
13843: <div>
13844: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13845: "updating-package" id=
1.41 wiz 13846: "updating-package"></a>17.4. Updating a
1.30 wiz 13847: package to a newer version</h2>
1.1 grant 13848: </div>
13849: </div>
13850: </div>
13851:
13852: <p>Please always put a concise, appropriate and relevant
13853: summary of the changes between old and new versions into
13854: the commit log when updating a package. There are various
13855: reasons for this:</p>
13856:
13857: <div class="itemizedlist">
13858: <ul type="disc">
13859: <li>
13860: <p>A URL is volatile, and can change over time. It
13861: may go away completely or its information may be
13862: overwritten by newer information.</p>
13863: </li>
13864:
13865: <li>
13866: <p>Having the change information between old and
13867: new versions in our CVS repository is very useful
13868: for people who use either cvs or anoncvs.</p>
13869: </li>
13870:
13871: <li>
13872: <p>Having the change information between old and
13873: new versions in our CVS repository is very useful
13874: for people who read the pkgsrc-changes mailing
13875: list, so that they can make tactical decisions
13876: about when to upgrade the package.</p>
13877: </li>
13878: </ul>
13879: </div>
13880:
1.18 xtraeme 13881: <p>Please also recognize that, just because a new version
1.1 grant 13882: of a package has been released, it should not
13883: automatically be upgraded in the CVS repository. We
13884: prefer to be conservative in the packages that are
13885: included in pkgsrc - development or beta packages are not
13886: really the best thing for most places in which pkgsrc is
13887: used. Please use your judgement about what should go into
13888: pkgsrc, and bear in mind that stability is to be
13889: preferred above new and possibly untested features.</p>
13890: </div>
13891:
1.55 ! rillig 13892: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13893: <div class="titlepage">
13894: <div>
13895: <div>
13896: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 13897: "moving-package" id=
1.41 wiz 13898: "moving-package"></a>17.5. Moving a package in
1.30 wiz 13899: pkgsrc</h2>
1.1 grant 13900: </div>
13901: </div>
13902: </div>
13903:
13904: <div class="orderedlist">
13905: <ol type="1">
13906: <li>
13907: <p>Make a copy of the directory somewhere else.</p>
13908: </li>
13909:
13910: <li>
13911: <p>Remove all CVS dirs.</p>
13912:
13913: <p>Alternatively to the first two steps you can
13914: also do:</p>
13915: <pre class="screen">
1.14 xtraeme 13916: <code class="prompt">%</code> <strong class=
13917: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 13918: </pre>
13919:
13920: <p>and use that for further work.</p>
13921: </li>
13922:
13923: <li>
1.14 xtraeme 13924: <p>Fix <code class="varname">CATEGORIES</code> and
13925: any <code class="varname">DEPENDS</code> paths that
13926: just did “<span class=
1.1 grant 13927: "quote">../package</span>” instead of
13928: “<span class=
13929: "quote">../../category/package</span>”.</p>
13930: </li>
13931:
13932: <li>
1.14 xtraeme 13933: <p><span><strong class="command">cvs
13934: import</strong></span> the modified package in the
13935: new place.</p>
1.1 grant 13936: </li>
13937:
13938: <li>
13939: <p>Check if any package depends on it:</p>
13940: <pre class="screen">
1.14 xtraeme 13941: <code class="prompt">%</code> <strong class=
13942: "userinput"><code>cd /usr/pkgsrc</code></strong>
13943: <code class="prompt">%</code> <strong class=
13944: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 13945: </pre>
13946: </li>
13947:
13948: <li>
13949: <p>Fix paths in packages from step 5 to point to
13950: new location.</p>
13951: </li>
13952:
13953: <li>
1.14 xtraeme 13954: <p><span><strong class="command">cvs rm
13955: (-f)</strong></span> the package at the old
13956: location.</p>
1.1 grant 13957: </li>
13958:
13959: <li>
1.45 wiz 13960: <p>Remove from <code xmlns=
13961: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13962: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 13963: </li>
13964:
13965: <li>
1.45 wiz 13966: <p>Add to <code xmlns=
13967: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13968: "filename">newcategory/Makefile</code>.</p>
1.1 grant 13969: </li>
13970:
13971: <li>
13972: <p>Commit the changed and removed files:</p>
13973: <pre class="screen">
1.14 xtraeme 13974: <code class="prompt">%</code> <strong class=
13975: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 13976: </pre>
13977:
13978: <p>(and any packages from step 5, of course).</p>
13979: </li>
13980: </ol>
13981: </div>
13982: </div>
13983: </div>
13984: </div>
13985:
1.55 ! rillig 13986: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 13987: <div class="titlepage">
13988: <div>
13989: <div>
1.55 ! rillig 13990: <h2 class="title"><a name="examples" id=
1.46 gdt 13991: "examples"></a>Appendix A. A simple example
1.1 grant 13992: package: bison</h2>
13993: </div>
13994: </div>
13995: </div>
13996:
13997: <div class="toc">
13998: <p><b>Table of Contents</b></p>
13999:
14000: <dl>
1.46 gdt 14001: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 14002: files</a></span></dt>
14003:
14004: <dd>
14005: <dl>
1.30 wiz 14006: <dt><span class="sect2"><a href=
1.46 gdt 14007: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 14008:
1.30 wiz 14009: <dt><span class="sect2"><a href=
1.46 gdt 14010: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 14011:
1.30 wiz 14012: <dt><span class="sect2"><a href=
1.46 gdt 14013: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 14014:
1.30 wiz 14015: <dt><span class="sect2"><a href=
1.46 gdt 14016: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 14017: package with <span><strong class=
1.14 xtraeme 14018: "command">pkglint</strong></span></a></span></dt>
1.1 grant 14019: </dl>
14020: </dd>
14021:
1.46 gdt 14022: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 14023: Steps for building, installing, packaging</a></span></dt>
1.1 grant 14024: </dl>
14025: </div>
14026:
14027: <p>We checked to find a piece of software that wasn't in the
14028: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 14029: would want to have <span><strong class=
14030: "command">bison</strong></span> when Berkeley
14031: <span><strong class="command">yacc</strong></span> is already
14032: present in the tree is beyond us, but it's useful for the
14033: purposes of this exercise.</p>
1.1 grant 14034:
1.55 ! rillig 14035: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14036: <div class="titlepage">
14037: <div>
14038: <div>
14039: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 14040: "example-files" id=
1.46 gdt 14041: "example-files"></a>A.1. files</h2>
1.1 grant 14042: </div>
14043: </div>
14044: </div>
14045:
1.55 ! rillig 14046: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14047: <div class="titlepage">
14048: <div>
14049: <div>
1.55 ! rillig 14050: <h3 class="title"><a name="example-Makefile" id=
1.46 gdt 14051: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 14052: </div>
14053: </div>
14054: </div>
14055: <pre class="programlisting">
1.51 rillig 14056: # $NetBSD$
14057: #
1.1 grant 14058:
1.51 rillig 14059: DISTNAME= bison-1.25
14060: CATEGORIES= devel
14061: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 14062:
1.51 rillig 14063: MAINTAINER= thorpej@NetBSD.org
14064: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
14065: COMMENT= GNU yacc clone
1.1 grant 14066:
1.51 rillig 14067: GNU_CONFIGURE= yes
14068: INFO_FILES= bison.info
1.1 grant 14069:
1.51 rillig 14070: .include "../../mk/bsd.pkg.mk"
1.1 grant 14071: </pre>
14072: </div>
14073:
1.55 ! rillig 14074: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14075: <div class="titlepage">
14076: <div>
14077: <div>
1.55 ! rillig 14078: <h3 class="title"><a name="example-descr" id=
1.46 gdt 14079: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 14080: </div>
14081: </div>
14082: </div>
14083: <pre class="programlisting">
1.51 rillig 14084: GNU version of yacc. Can make re-entrant parsers, and numerous other
14085: improvements. Why you would want this when Berkeley <a href=
1.1 grant 14086: "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 14087: of the NetBSD source tree is beyond me.
1.1 grant 14088: </pre>
14089: </div>
14090:
1.55 ! rillig 14091: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14092: <div class="titlepage">
14093: <div>
14094: <div>
1.55 ! rillig 14095: <h3 class="title"><a name="example-plist" id=
1.46 gdt 14096: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 14097: </div>
14098: </div>
14099: </div>
14100: <pre class="programlisting">
1.51 rillig 14101: @comment $NetBSD$
14102: bin/bison
14103: man/man1/bison.1.gz
14104: share/bison.simple
14105: share/bison.hairy
1.1 grant 14106: </pre>
14107: </div>
14108:
1.55 ! rillig 14109: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14110: <div class="titlepage">
14111: <div>
14112: <div>
1.30 wiz 14113: <h3 class="title"><a name=
1.55 ! rillig 14114: "checking-package-with-pkglint" id=
1.46 gdt 14115: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 14116: a package with <span><strong class=
1.14 xtraeme 14117: "command">pkglint</strong></span></h3>
1.1 grant 14118: </div>
14119: </div>
14120: </div>
14121:
14122: <p>The NetBSD package system comes with <a xmlns=
14123: "http://www.w3.org/TR/xhtml1/transitional" href=
14124: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14125: target="_top"><code xmlns="" class=
14126: "filename">pkgtools/pkglint</code></a> which helps to
14127: check the contents of these files. After installation it
14128: is quite easy to use, just change to the directory of the
1.20 ben 14129: package you wish to examine and execute
14130: <span><strong class=
14131: "command">pkglint</strong></span>:</p>
1.1 grant 14132: <pre class="screen">
1.14 xtraeme 14133: <code class="prompt">$</code> <strong class=
14134: "userinput"><code>pkglint</code></strong>
1.1 grant 14135: looks fine.
14136: </pre>
14137:
14138: <p>Depending on the supplied command line arguments (see
1.47 reed 14139: pkglint(1)), more verbose checks will be performed. Use
1.14 xtraeme 14140: e.g. <span><strong class="command">pkglint
14141: -v</strong></span> for a very verbose check.</p>
1.1 grant 14142: </div>
14143: </div>
14144:
1.55 ! rillig 14145: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14146: <div class="titlepage">
14147: <div>
14148: <div>
14149: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 14150: "steps-for-b-i-p" id=
1.46 gdt 14151: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 14152: installing, packaging</h2>
1.1 grant 14153: </div>
14154: </div>
14155: </div>
14156:
14157: <p>Create the directory where the package lives, plus any
14158: auxiliary directories:</p>
14159: <pre class="screen">
1.14 xtraeme 14160: <code class="prompt">#</code> <strong class=
14161: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14162: <code class="prompt">#</code> <strong class=
14163: "userinput"><code>mkdir bison</code></strong>
14164: <code class="prompt">#</code> <strong class=
14165: "userinput"><code>cd bison</code></strong>
14166: <code class="prompt">#</code> <strong class=
14167: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14168: </pre>
14169:
1.45 wiz 14170: <p>Create <code xmlns=
14171: "http://www.w3.org/TR/xhtml1/transitional" class=
14172: "filename">Makefile</code>, <code xmlns=
14173: "http://www.w3.org/TR/xhtml1/transitional" class=
14174: "filename">DESCR</code> and <code xmlns=
14175: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14176: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14177: "Chapter 8. Package components - files, directories and contents">
1.55 ! rillig 14178: Chapter 8, <i>Package components - files, directories and
! 14179: contents</i></a>) then continue with fetching the
1.1 grant 14180: distfile:</p>
14181: <pre class="screen">
1.14 xtraeme 14182: <code class="prompt">#</code> <strong class=
14183: "userinput"><code>make fetch</code></strong>
1.1 grant 14184: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14185: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14186: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14187: ftp: Error retrieving file: 500 Internal error
14188:
14189: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14190: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14191: ftp: Error retrieving file: 500 Internal error
14192:
14193: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14194: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14195: Successfully retrieved file.
14196: </pre>
14197:
1.45 wiz 14198: <p>Generate the checksum of the distfile into <code xmlns=
14199: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14200: "filename">distinfo</code>:</p>
1.1 grant 14201: <pre class="screen">
1.14 xtraeme 14202: <code class="prompt">#</code> <strong class=
14203: "userinput"><code>make makesum</code></strong>
1.1 grant 14204: </pre>
14205:
14206: <p>Now compile:</p>
14207: <pre class="screen">
1.14 xtraeme 14208: <code class="prompt">#</code> <strong class=
14209: "userinput"><code>make</code></strong>
1.1 grant 14210: >> Checksum OK for bison-1.25.tar.gz.
14211: ===> Extracting for bison-1.25
14212: ===> Patching for bison-1.25
14213: ===> Ignoring empty patch directory
14214: ===> Configuring for bison-1.25
14215: creating cache ./config.cache
14216: checking for gcc... cc
14217: checking whether we are using GNU C... yes
14218: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14219: checking how to run the C preprocessor... cc -E
14220: checking for minix/config.h... no
14221: checking for POSIXized ISC... no
14222: checking whether cross-compiling... no
14223: checking for ANSI C header files... yes
14224: checking for string.h... yes
14225: checking for stdlib.h... yes
14226: checking for memory.h... yes
14227: checking for working const... yes
14228: checking for working alloca.h... no
14229: checking for alloca... yes
14230: checking for strerror... yes
14231: updating cache ./config.cache
14232: creating ./config.status
14233: creating Makefile
14234: ===> Building for bison-1.25
14235: 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
14236: 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
14237: 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
14238: 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
14239: 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
14240: 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
14241: 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
14242: 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
14243: 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
14244: 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
14245: 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
14246: 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
14247: 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
14248: 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
14249: 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
14250: 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
14251: 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
14252: 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
14253: 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
14254: 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
14255: 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
14256: 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
14257: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
14258: rm -f bison.s1
14259: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
14260: </pre>
14261:
14262: <p>Everything seems OK, so install the files:</p>
14263: <pre class="screen">
1.14 xtraeme 14264: <code class="prompt">#</code> <strong class=
14265: "userinput"><code>make install</code></strong>
1.1 grant 14266: >> Checksum OK for bison-1.25.tar.gz.
14267: ===> Installing for bison-1.25
14268: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14269: rm -f /usr/pkg/bin/bison
14270: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14271: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14272: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14273: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14274: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14275: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14276: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14277: ===> Registering installation for bison-1.25
14278: </pre>
14279:
14280: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14281: remove it with <span><strong class="command">pkg_delete
14282: bison</strong></span>. Should you decide that you want a
14283: binary package, do this now:</p>
1.1 grant 14284: <pre class="screen">
1.14 xtraeme 14285: <code class="prompt">#</code> <strong class=
14286: "userinput"><code>make package</code></strong>
1.1 grant 14287: >> Checksum OK for bison-1.25.tar.gz.
14288: ===> Building package for bison-1.25
14289: Creating package bison-1.25.tgz
14290: Registering depends:.
14291: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14292: </pre>
14293:
14294: <p>Now that you don't need the source and object files any
14295: more, clean up:</p>
14296: <pre class="screen">
1.14 xtraeme 14297: <code class="prompt">#</code> <strong class=
14298: "userinput"><code>make clean</code></strong>
1.1 grant 14299: ===> Cleaning for bison-1.25
14300: </pre>
14301: </div>
14302: </div>
14303:
1.55 ! rillig 14304: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14305: <div class="titlepage">
14306: <div>
14307: <div>
1.55 ! rillig 14308: <h2 class="title"><a name="logs" id=
1.46 gdt 14309: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14310: </div>
14311: </div>
14312: </div>
14313:
14314: <div class="toc">
14315: <p><b>Table of Contents</b></p>
14316:
14317: <dl>
1.46 gdt 14318: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14319: Building figlet</a></span></dt>
14320:
1.46 gdt 14321: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14322: Packaging figlet</a></span></dt>
14323: </dl>
14324: </div>
14325:
1.55 ! rillig 14326: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14327: <div class="titlepage">
14328: <div>
14329: <div>
14330: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 14331: "logs.building" id=
1.46 gdt 14332: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14333: </div>
14334: </div>
14335: </div>
14336: <pre class="screen">
1.14 xtraeme 14337: <code class="prompt">#</code> <strong class=
14338: "userinput"><code>make</code></strong>
1.1 grant 14339: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14340: => figlet221.tar.gz doesn't seem to exist on this system.
14341: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14342: => [172219 bytes]
14343: Connected to ftp.plig.net.
14344: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14345: 331 Guest login ok, send your complete e-mail address as password.
14346: 230-You are user #5 of 500 simultaneous users allowed.
14347: 230-
14348: 230- ___ _ _ _
14349: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14350: 230- | _| _| . |_| . | | | . |_| . | _| . |
14351: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14352: 230- |_| |_| |___| |___|
14353: 230-
14354: 230-** Welcome to ftp.plig.org **
14355: 230-
14356: 230-Please note that all transfers from this FTP site are logged. If you
14357: 230-do not like this, please disconnect now.
14358: 230-
14359: 230-This arhive is available via
14360: 230-
14361: 230-HTTP: http://ftp.plig.org/
14362: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14363: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14364: 230-
14365: 230-Please email comments, bug reports and requests for packages to be
14366: 230-mirrored to ftp-admin@plig.org.
14367: 230-
14368: 230-
14369: 230 Logged in anonymously.
14370: Remote system type is UNIX.
14371: Using binary mode to transfer files.
14372: 200 Type okay.
14373: 250 "/pub" is new cwd.
14374: 250-"/pub/figlet" is new cwd.
14375: 250-
14376: 250-Welcome to the figlet archive at ftp.figlet.org
14377: 250-
14378: 250- ftp://ftp.figlet.org/pub/figlet/
14379: 250-
14380: 250-The official FIGlet web page is:
14381: 250- http://www.figlet.org/
14382: 250-
14383: 250-If you have questions, please mailto:info@figlet.org. If you want to
14384: 250-contribute a font or something else, you can email us.
14385: 250
14386: 250 "/pub/figlet/program" is new cwd.
14387: 250 "/pub/figlet/program/unix" is new cwd.
14388: local: figlet221.tar.gz remote: figlet221.tar.gz
14389: 502 Unimplemented command.
14390: 227 Entering Passive Mode (195,40,6,41,246,104)
14391: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14392: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14393: 226 Transfer completed.
14394: 172219 bytes received in 00:02 (75.99 KB/s)
14395: 221 Goodbye.
14396: => Checksum OK for figlet221.tar.gz.
14397: ===> Extracting for figlet-2.2.1nb2
14398: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14399: ===> Patching for figlet-2.2.1nb2
14400: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14401: ===> Overriding tools for figlet-2.2.1nb2
14402: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14403: ===> Configuring for figlet-2.2.1nb2
14404: ===> Building for figlet-2.2.1nb2
14405: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14406: chmod a+x figlet
14407: gcc -O2 -o chkfont chkfont.c
14408: => Unwrapping files-to-be-installed.
1.14 xtraeme 14409: <code class="prompt">#</code>
14410: <code class="prompt">#</code> <strong class=
14411: "userinput"><code>make install</code></strong>
1.1 grant 14412: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14413: ===> Installing for figlet-2.2.1nb2
14414: install -d -o root -g wheel -m 755 /usr/pkg/bin
14415: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14416: mkdir -p /usr/pkg/share/figlet
14417: cp figlet /usr/pkg/bin
14418: cp chkfont /usr/pkg/bin
14419: chmod 555 figlist showfigfonts
14420: cp figlist /usr/pkg/bin
14421: cp showfigfonts /usr/pkg/bin
14422: cp fonts/*.flf /usr/pkg/share/figlet
14423: cp fonts/*.flc /usr/pkg/share/figlet
14424: cp figlet.6 /usr/pkg/man/man6
14425: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14426: <code class="prompt">#</code>
1.1 grant 14427: </pre>
14428: </div>
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: "logs.package" id=
1.46 gdt 14436: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14437: </div>
14438: </div>
14439: </div>
14440: <pre class="screen">
1.14 xtraeme 14441: <code class="prompt">#</code> <strong class=
14442: "userinput"><code>make package</code></strong>
1.1 grant 14443: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14444: ===> Packaging figlet-2.2.1nb2
14445: ===> Building binary package for figlet-2.2.1nb2
14446: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14447: Using SrcDir value of /usr/pkg
14448: Registering depends:.
1.14 xtraeme 14449: <code class="prompt">#</code>
1.1 grant 14450: </pre>
14451: </div>
14452: </div>
14453:
1.55 ! rillig 14454: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14455: <div class="titlepage">
14456: <div>
14457: <div>
1.55 ! rillig 14458: <h2 class="title"><a name="ftp-layout" id=
1.46 gdt 14459: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14460: FTP server's package archive</h2>
14461: </div>
14462: </div>
14463: </div>
14464:
14465: <p>Layout for precompiled binary packages on
14466: ftp.NetBSD.org:</p>
14467: <pre class="programlisting">
1.51 rillig 14468: /pub/NetBSD/packages/
14469: distfiles/
1.1 grant 14470:
1.51 rillig 14471: # Unpacked pkgsrc trees
14472: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14473: pkgsrc-2003Q4 -> N/A
14474: pkgsrc-2004Q1/pkgsrc
14475:
14476: # pkgsrc archives
14477: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14478: pkgsrc-2003Q4.tar.gz -> N/A
14479: pkgsrc-2004Q1.tar.gz -> N/A
14480:
14481: # Per pkgsrc-release/OS-release/arch package archives
14482: pkgsrc-2003Q4/
14483: NetBSD-1.6.2/
14484: i386/
14485: All/
14486: archivers/
14487: foo -> ../All/foo
14488: ...
14489: pkgsrc-2004Q1/
14490: NetBSD-1.6.2/
14491: i386/
14492: All/
14493: ...
14494: NetBSD-2.0/
14495: i386/
14496: All/
14497: ...
14498: SunOS-5.9/
14499: sparc/
14500: All/
14501: ...
14502: x86/
14503: All/
14504: ...
14505:
14506: # Per os-release package archive convenience links
14507: NetBSD-1.6.2 -> 1.6.2
14508: 1.6.2/
14509: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14510: m68k/
14511: All/
14512: archivers/
14513: foo -> ../All/foo
14514: ...
14515: amiga -> m68k
14516: atari -> m68k
14517: ...
14518:
14519: 2.0 -> NetBSD-2.0 # backward compat, historic
14520: NetBSD-2.0/
14521: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14522: SunOS-5.9/
14523: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14524: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 14525: </pre>
14526:
14527: <p>To create:</p>
14528:
14529: <div class="orderedlist">
14530: <ol type="1">
14531: <li>
14532: <p>Run bulk build, see <a href="#bulkbuild" title=
1.55 ! rillig 14533: "6.3. Doing a bulk build of all packages">Section
! 14534: 6.3, “Doing a bulk build of all
1.1 grant 14535: packages”</a></p>
14536: </li>
14537:
14538: <li>
14539: <p>Upload /usr/pkgsrc/packages to</p>
14540: <pre class="programlisting">
14541: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 14542: pkgsrc-2004Q4/\ # pkgsrc-branch
14543: `uname -s`-`uname -r`/\ # OS & version
14544: `uname -p` # architecture
1.1 grant 14545: </pre>
14546: </li>
14547:
14548: <li>
1.14 xtraeme 14549: <p>If necessary, create a symlink <span><strong class=
14550: "command">ln -s `uname -m` `uname -p`</strong></span>
14551: (amiga -> m68k, ...)</p>
1.1 grant 14552: </li>
14553: </ol>
14554: </div>
14555: </div>
1.2 hubertf 14556:
1.55 ! rillig 14557: <div class="appendix" lang="en" xml:lang="en">
1.2 hubertf 14558: <div class="titlepage">
14559: <div>
14560: <div>
1.55 ! rillig 14561: <h2 class="title"><a name="editing" id=
1.46 gdt 14562: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 14563: for the pkgsrc guide</h2>
14564: </div>
14565: </div>
14566: </div>
14567:
14568: <div class="toc">
14569: <p><b>Table of Contents</b></p>
14570:
14571: <dl>
1.46 gdt 14572: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 14573: Targets</a></span></dt>
14574:
1.46 gdt 14575: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 14576: Procedure</a></span></dt>
14577: </dl>
14578: </div>
14579:
14580: <p>This section contains information on editing the pkgsrc
14581: guide itself.</p>
14582:
1.55 ! rillig 14583: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 14584: <div class="titlepage">
14585: <div>
14586: <div>
14587: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 14588: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 14589: </div>
14590: </div>
14591: </div>
14592:
1.45 wiz 14593: <p>The pkgsrc guide's source code is stored in <code xmlns=
14594: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14595: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14596: are created from it:</p>
14597:
14598: <div class="itemizedlist">
14599: <ul type="disc">
14600: <li>
1.45 wiz 14601: <p><code xmlns=
14602: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14603: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14604: </li>
14605:
14606: <li>
1.45 wiz 14607: <p><code xmlns=
14608: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14609: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 14610: </li>
14611:
14612: <li>
1.45 wiz 14613: <p><code xmlns=
14614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14615: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 14616: the documentation on the NetBSD website will be built
14617: from pkgsrc and kept up to date on the web server
14618: itself. This means you <span class=
14619: "emphasis"><em>must</em></span> make sure that your
14620: changes haven't broken the build!</p>
14621: </li>
1.6 hubertf 14622:
14623: <li>
1.45 wiz 14624: <p><code xmlns=
14625: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14626: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 14627: PDF version of the pkgsrc guide.</p>
14628: </li>
14629:
14630: <li>
1.45 wiz 14631: <p><code xmlns=
14632: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14633: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 14634: PostScript version of the pkgsrc guide.</p>
14635: </li>
1.2 hubertf 14636: </ul>
14637: </div>
14638: </div>
14639:
1.55 ! rillig 14640: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 14641: <div class="titlepage">
14642: <div>
14643: <div>
14644: <h2 class="title" style="clear: both"><a name=
1.55 ! rillig 14645: "procedure" id=
1.46 gdt 14646: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 14647: </div>
14648: </div>
14649: </div>
14650:
14651: <p>The procedure to edit the pkgsrc guide is:</p>
14652:
14653: <div class="itemizedlist">
14654: <ul type="disc">
14655: <li>
1.6 hubertf 14656: <p>Make sure you have the packages needed to
14657: re-generate the pkgsrc guide (and other XML-based
14658: NetBSD documentation) installed. These are
1.11 ben 14659: “<span class="quote">netbsd-doc</span>”
1.47 reed 14660: for creating the ASCII and HTML versions, and
1.6 hubertf 14661: “<span class=
1.47 reed 14662: "quote">netbsd-doc-print</span>” for the
14663: PostScript and PDF versions. You will need both
1.6 hubertf 14664: packages installed, to make sure documentation is
14665: consistent across all formats. The packages can be
1.45 wiz 14666: found in <code xmlns=
14667: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14668: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 14669: <code xmlns=
14670: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14671: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 14672: </li>
14673:
14674: <li>
1.45 wiz 14675: <p>Edit the XML file(s) in <code xmlns=
14676: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14677: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 14678: </li>
14679:
14680: <li>
1.14 xtraeme 14681: <p>Run <span><strong class="command">make extract
14682: && make do-lint</strong></span> in
1.45 wiz 14683: <code xmlns=
14684: "http://www.w3.org/TR/xhtml1/transitional" class=
14685: "filename">pkgsrc/doc/guide</code> to check the XML
14686: syntax, and fix it if needed.</p>
1.4 hubertf 14687: </li>
14688:
14689: <li>
1.14 xtraeme 14690: <p>Run <span><strong class=
1.45 wiz 14691: "command">make</strong></span> in <code xmlns=
14692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14693: "filename">pkgsrc/doc/guide</code> to build the HTML
14694: and ASCII version.</p>
1.2 hubertf 14695: </li>
14696:
14697: <li>
1.14 xtraeme 14698: <p>If all is well, run <span><strong class=
14699: "command">make install-doc</strong></span> to put the
1.45 wiz 14700: generated files into <code xmlns=
14701: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14702: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 14703: </li>
14704:
14705: <li>
1.14 xtraeme 14706: <p><span><strong class="command">cvs commit
14707: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 14708: </li>
14709:
14710: <li>
1.14 xtraeme 14711: <p><span><strong class="command">cvs commit -m
14712: re-generate
14713: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 14714: </li>
1.4 hubertf 14715:
14716: <li>
14717: <p>Until the webserver on www.NetBSD.org is really
14718: updated automatically to pick up changes to the
1.14 xtraeme 14719: pkgsrc guide automatically, also run
1.18 xtraeme 14720: <span><strong class="command">make install-htdocs
1.14 xtraeme 14721: HTDOCSDIR=../../../htdocs</strong></span> (or
14722: similar, adjust <code class=
14723: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 14724: </li>
14725:
14726: <li>
1.14 xtraeme 14727: <p><span><strong class="command">cvs commit
14728: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 14729: </li>
1.2 hubertf 14730: </ul>
14731: </div>
14732: </div>
14733: </div>
1.1 grant 14734: </div>
14735: </body>
14736: </html>
CVSweb <webmaster@jp.NetBSD.org>