Annotation of pkgsrc/doc/pkgsrc.html, revision 1.52
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.52 ! tv 4: "HTML Tidy for NetBSD (vers 1 September 2005), 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.52 ! tv 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.52 ! tv 22: <h1 class="title"><a name="the-pkgsrc-guide"></a>The
! 23: 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.38 dillo 695: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 696: fixes for packages</a></span></dt>
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.38 dillo 795: "#building-considerations">15.4. Building
1.30 wiz 796: considerations</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.52 ! tv 982: <div class="chapter" lang="en">
1.1 grant 983: <div class="titlepage">
984: <div>
985: <div>
1.52 ! tv 986: <h2 class="title"><a name=
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.52 ! tv 1011: <div class="sect1" lang="en">
1.1 grant 1012: <div class="titlepage">
1013: <div>
1014: <div>
1015: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1016: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1017: </div>
1018: </div>
1019: </div>
1020:
1.47 reed 1021: <p>There is a lot of software freely available for
1022: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1023: Unix-flavoured systems, too, sometimes with some
1024: modifications. The NetBSD Packages Collection (pkgsrc)
1025: incorporates any such changes necessary to make that
1026: software run, and makes the installation (and
1027: de-installation) of the software package easy by means of a
1028: single command.</p>
1029:
1030: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1031: the <span><strong class="command">pkg_*</strong></span>
1032: tools so that installation and de-installation, printing of
1033: an inventory of all installed packages and retrieval of
1034: one-line comments or more verbose descriptions are all
1035: simple.</p>
1.1 grant 1036:
1037: <p>pkgsrc currently contains several thousand packages,
1038: including:</p>
1039:
1040: <div class="itemizedlist">
1041: <ul type="disc">
1042: <li>
1043: <p><a xmlns=
1044: "http://www.w3.org/TR/xhtml1/transitional" href=
1045: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1046: target="_top"><code xmlns="" class=
1047: "filename">www/apache</code></a> - The Apache web
1.20 ben 1048: server</p>
1.1 grant 1049: </li>
1050:
1051: <li>
1052: <p><a xmlns=
1053: "http://www.w3.org/TR/xhtml1/transitional" href=
1054: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1055: target="_top"><code xmlns="" class=
1056: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1057: browser</p>
1.1 grant 1058: </li>
1059:
1060: <li>
1061: <p><a xmlns=
1062: "http://www.w3.org/TR/xhtml1/transitional" href=
1063: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1064: target="_top"><code xmlns="" class=
1065: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1066: Desktop Environment</p>
1.1 grant 1067: </li>
1068:
1069: <li>
1070: <p><a xmlns=
1071: "http://www.w3.org/TR/xhtml1/transitional" href=
1072: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1073: target="_top"><code xmlns="" class=
1074: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1075: Environment</p>
1.1 grant 1076: </li>
1077: </ul>
1078: </div>
1079:
1080: <p>...just to name a few.</p>
1081:
1082: <p>pkgsrc has built-in support for handling varying
1083: dependencies, such as pthreads and X11, and extended
1084: features such as IPv6 support on a range of platforms.</p>
1085:
1086: <p>pkgsrc was derived from FreeBSD's ports system, and
1087: initially developed for NetBSD only. Since then, pkgsrc has
1088: grown a lot, and now supports the following platforms:</p>
1089:
1090: <div class="itemizedlist">
1091: <ul type="disc">
1092: <li>
1093: <p><a href="http://developer.apple.com/darwin/"
1094: target="_top">Darwin</a> (<a href=
1095: "http://www.apple.com/macosx/" target="_top">Mac OS
1096: X</a>)</p>
1097: </li>
1098:
1099: <li>
1.3 hubertf 1100: <p><a href="http://www.DragonFlyBSD.org/" target=
1101: "_top">DragonFlyBSD</a></p>
1102: </li>
1103:
1104: <li>
1.1 grant 1105: <p><a href="http://www.FreeBSD.org/" target=
1106: "_top">FreeBSD</a></p>
1107: </li>
1108:
1109: <li>
1.3 hubertf 1110: <p>Microsoft Windows, via <a href=
1111: "http://www.microsoft.com/windows/sfu/" target=
1112: "_top">Interix</a></p>
1.1 grant 1113: </li>
1114:
1115: <li>
1116: <p><a href="http://www.sgi.com/software/irix6.5/"
1117: target="_top">IRIX</a></p>
1118: </li>
1119:
1120: <li>
1121: <p><a href="http://www.linux.org/" target=
1122: "_top">Linux</a></p>
1123: </li>
1124:
1125: <li>
1126: <p><a href="http://www.NetBSD.org/" target=
1127: "_top">NetBSD</a> (of course)</p>
1128: </li>
1129:
1130: <li>
1.17 sketch 1131: <p><a href="http://h30097.www3.hp.com/" target=
1132: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1133: </li>
1134:
1135: <li>
1.1 grant 1136: <p><a href="http://www.openbsd.org/" target=
1137: "_top">OpenBSD</a></p>
1138: </li>
1139:
1140: <li>
1141: <p><a href="http://www.sun.com/solaris/" target=
1142: "_top">Solaris</a></p>
1143: </li>
1144: </ul>
1145: </div>
1146: </div>
1147:
1.52 ! tv 1148: <div class="sect1" lang="en">
1.1 grant 1149: <div class="titlepage">
1150: <div>
1151: <div>
1152: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 1153: "overview"></a>1.2. Overview</h2>
1.1 grant 1154: </div>
1155: </div>
1156: </div>
1157:
1158: <p>This document is divided into two parts. The first,
1159: <a href="#users-guide" title=
1.46 gdt 1160: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1161: user's guide</a>, describes how one can use one of the
1162: packages in the Package Collection, either by installing a
1163: precompiled binary package, or by building one's own copy
1164: using the NetBSD package system. The second part, <a href=
1.1 grant 1165: "#developers-guide" title=
1.46 gdt 1166: "Part II. The pkgsrc developer's guide">The
1167: pkgsrc developer's guide</a>, explains how to prepare a
1168: package so it can be easily built by other NetBSD users
1169: without knowing about the package's building details.</p>
1.1 grant 1170:
1171: <p>This document is available in various formats:</p>
1172:
1173: <div class="itemizedlist">
1174: <ul type="disc">
1175: <li>
1176: <p><a href="index.html" target="_top">HTML</a></p>
1177: </li>
1178:
1179: <li>
1180: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1181: </li>
1182:
1183: <li>
1184: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1185: </li>
1186:
1187: <li>
1188: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1189: </li>
1190: </ul>
1191: </div>
1192: </div>
1193:
1.52 ! tv 1194: <div class="sect1" lang="en">
1.1 grant 1195: <div class="titlepage">
1196: <div>
1197: <div>
1198: <h2 class="title" style="clear: both"><a name=
1199: "terminology"></a>1.3. Terminology</h2>
1200: </div>
1201: </div>
1202: </div>
1203:
1204: <p>There has been a lot of talk about “<span class=
1205: "quote">ports</span>”, “<span class=
1206: "quote">packages</span>”, etc. so far. Here is a
1207: description of all the terminology used within this
1208: document.</p>
1209:
1210: <div class="variablelist">
1211: <dl>
1212: <dt><span class="term">Package</span></dt>
1213:
1214: <dd>
1215: <p>A set of files and building instructions that
1216: describe what's necessary to build a certain piece of
1217: software using pkgsrc. Packages are traditionally
1.45 wiz 1218: stored under <code xmlns=
1219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1220: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1221: </dd>
1222:
1223: <dt><span class="term">The NetBSD package
1224: system</span></dt>
1225:
1226: <dd>
1227: <p>This is the former name of “<span class=
1228: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1229: NetBSD operating system and can be bootstrapped to
1230: run on non-NetBSD operating systems as well. It
1231: handles building (compiling), installing, and
1232: removing of packages.</p>
1.1 grant 1233: </dd>
1234:
1235: <dt><span class="term">Distfile</span></dt>
1236:
1237: <dd>
1238: <p>This term describes the file or files that are
1239: provided by the author of the piece of software to
1240: distribute his work. All the changes necessary to
1241: build on NetBSD are reflected in the corresponding
1242: package. Usually the distfile is in the form of a
1243: compressed tar-archive, but other types are possible,
1.45 wiz 1244: too. Distfiles are usually stored below <code xmlns=
1245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1246: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1247: </dd>
1248:
1249: <dt><span class="term">Port</span></dt>
1250:
1251: <dd>
1252: <p>This is the term used by FreeBSD and OpenBSD
1253: people for what we call a package. In NetBSD
1254: terminology, “<span class=
1255: "quote">port</span>” refers to a different
1256: architecture.</p>
1257: </dd>
1258:
1259: <dt><span class="term">Precompiled/binary
1260: package</span></dt>
1261:
1262: <dd>
1263: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1264: distfile and stuffed together in a single
1.45 wiz 1265: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1266: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1267: installed on machines of the same machine
1268: architecture without the need to recompile. Packages
1.45 wiz 1269: are usually generated in <code xmlns=
1270: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1271: "filename">/usr/pkgsrc/packages</code>; there is also
1272: an archive on <a href=
1.1 grant 1273: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1274: "_top">ftp.NetBSD.org</a>.</p>
1275:
1276: <p>Sometimes, this is referred to by the term
1277: “<span class="quote">package</span>” too,
1278: especially in the context of precompiled
1279: packages.</p>
1280: </dd>
1281:
1282: <dt><span class="term">Program</span></dt>
1283:
1284: <dd>
1285: <p>The piece of software to be installed which will
1.47 reed 1286: be constructed from all the files in the distfile by
1.1 grant 1287: the actions defined in the corresponding package.</p>
1288: </dd>
1289: </dl>
1290: </div>
1291: </div>
1292:
1.52 ! tv 1293: <div class="sect1" lang="en">
1.1 grant 1294: <div class="titlepage">
1295: <div>
1296: <div>
1297: <h2 class="title" style="clear: both"><a name=
1298: "typography"></a>1.4. Typography</h2>
1299: </div>
1300: </div>
1301: </div>
1302:
1303: <p>When giving examples for commands, shell prompts are
1304: used to show if the command should/can be issued as root,
1305: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1306: privileges are sufficient. We use a <code class=
1307: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1308: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1309: assuming they use the C-shell or tcsh.</p>
1.1 grant 1310: </div>
1311: </div>
1312:
1.52 ! tv 1313: <div class="part" lang="en">
1.1 grant 1314: <div class="titlepage">
1315: <div>
1316: <div>
1.52 ! tv 1317: <h1 class="title"><a name=
1.48 dillo 1318: "users-guide"></a>Part I. The pkgsrc user's
1319: guide</h1>
1.1 grant 1320: </div>
1321: </div>
1322: </div>
1323:
1324: <div class="toc">
1325: <p><b>Table of Contents</b></p>
1326:
1327: <dl>
1328: <dt><span class="chapter"><a href="#getting">2. Where to
1329: get pkgsrc</a></span></dt>
1330:
1331: <dd>
1332: <dl>
1.30 wiz 1333: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1334: As tar file</a></span></dt>
1.1 grant 1335:
1.30 wiz 1336: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1337: SUP</a></span></dt>
1338:
1.30 wiz 1339: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1340: CVS</a></span></dt>
1341: </dl>
1342: </dd>
1343:
1344: <dt><span class="chapter"><a href="#platforms">3. Using
1345: pkgsrc on systems other than NetBSD</a></span></dt>
1346:
1347: <dd>
1348: <dl>
1.30 wiz 1349: <dt><span class="sect1"><a href=
1350: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1351: pkgsrc</a></span></dt>
1.1 grant 1352:
1.30 wiz 1353: <dt><span class="sect1"><a href=
1.47 reed 1354: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1355: notes</a></span></dt>
1.1 grant 1356:
1357: <dd>
1358: <dl>
1.30 wiz 1359: <dt><span class="sect2"><a href="#darwin">3.2.1.
1360: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1361:
1.30 wiz 1362: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1363: FreeBSD</a></span></dt>
1.22 tv 1364:
1.30 wiz 1365: <dt><span class="sect2"><a href="#interix">3.2.3.
1366: Interix</a></span></dt>
1.1 grant 1367:
1.30 wiz 1368: <dt><span class="sect2"><a href="#irix">3.2.4.
1369: IRIX</a></span></dt>
1.1 grant 1370:
1.30 wiz 1371: <dt><span class="sect2"><a href="#linux">3.2.5.
1372: Linux</a></span></dt>
1.1 grant 1373:
1.30 wiz 1374: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1375: OpenBSD</a></span></dt>
1.1 grant 1376:
1.30 wiz 1377: <dt><span class="sect2"><a href="#solaris">3.2.7.
1378: Solaris</a></span></dt>
1.1 grant 1379: </dl>
1380: </dd>
1381: </dl>
1382: </dd>
1383:
1384: <dt><span class="chapter"><a href="#using">4. Using
1385: pkgsrc</a></span></dt>
1386:
1387: <dd>
1388: <dl>
1389: <dt><span class="sect1"><a href=
1390: "#getting-started">4.1. Working with binary
1391: packages</a></span></dt>
1392:
1393: <dd>
1394: <dl>
1395: <dt><span class="sect2"><a href=
1.30 wiz 1396: "#where-to-get-binary-packages">4.1.1. Where to
1397: get binary packages</a></span></dt>
1.1 grant 1398:
1399: <dt><span class="sect2"><a href=
1.30 wiz 1400: "#how-to-use-binary-packages">4.1.2. How to use
1401: binary packages</a></span></dt>
1.1 grant 1402:
1403: <dt><span class="sect2"><a href=
1.30 wiz 1404: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1405: warning</a></span></dt>
1406: </dl>
1407: </dd>
1408:
1.30 wiz 1409: <dt><span class="sect1"><a href=
1410: "#building-packages-from-source">4.2. Building
1411: packages from source</a></span></dt>
1.1 grant 1412:
1413: <dd>
1414: <dl>
1415: <dt><span class="sect2"><a href=
1.30 wiz 1416: "#requirements">4.2.1.
1417: Requirements</a></span></dt>
1.1 grant 1418:
1419: <dt><span class="sect2"><a href=
1.30 wiz 1420: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1421: distfiles</a></span></dt>
1422:
1423: <dt><span class="sect2"><a href=
1.30 wiz 1424: "#how-to-build-and-install">4.2.3. How to build
1425: and install</a></span></dt>
1.1 grant 1426:
1427: <dt><span class="sect2"><a href=
1.30 wiz 1428: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1429: compiler</a></span></dt>
1430: </dl>
1431: </dd>
1432: </dl>
1433: </dd>
1434:
1.38 dillo 1435: <dt><span class="chapter"><a href="#configuring">5.
1436: Configuring pkgsrc</a></span></dt>
1437:
1438: <dd>
1439: <dl>
1440: <dt><span class="sect1"><a href=
1.45 wiz 1441: "#general-configuration">5.1. General
1442: configuration</a></span></dt>
1443:
1444: <dt><span class="sect1"><a href=
1445: "#variables-affecting-build">5.2. Variables affecting
1446: the build process</a></span></dt>
1447:
1448: <dt><span class="sect1"><a href=
1449: "#developer-advanced-settings">5.3.
1450: Developer/advanced settings</a></span></dt>
1451:
1452: <dt><span class="sect1"><a href=
1453: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1454: Options</a></span></dt>
1.38 dillo 1455: </dl>
1456: </dd>
1457:
1458: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1459: binary packages</a></span></dt>
1460:
1461: <dd>
1462: <dl>
1.30 wiz 1463: <dt><span class="sect1"><a href=
1.38 dillo 1464: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1465: single binary package</a></span></dt>
1.1 grant 1466:
1.30 wiz 1467: <dt><span class="sect1"><a href=
1.38 dillo 1468: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1469: Settings for creation of binary
1470: packages</a></span></dt>
1471:
1.38 dillo 1472: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1473: Doing a bulk build of all packages</a></span></dt>
1474:
1475: <dd>
1476: <dl>
1477: <dt><span class="sect2"><a href=
1.38 dillo 1478: "#binary.configuration">6.3.1.
1.1 grant 1479: Configuration</a></span></dt>
1480:
1481: <dt><span class="sect2"><a href=
1.38 dillo 1482: "#other-environmental-considerations">6.3.2.
1.30 wiz 1483: Other environmental
1.1 grant 1484: considerations</a></span></dt>
1485:
1486: <dt><span class="sect2"><a href=
1.38 dillo 1487: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1488:
1489: <dt><span class="sect2"><a href=
1.38 dillo 1490: "#what-it-does">6.3.4. What it
1.30 wiz 1491: does</a></span></dt>
1.1 grant 1492:
1493: <dt><span class="sect2"><a href=
1.38 dillo 1494: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1495: requirements</a></span></dt>
1496:
1497: <dt><span class="sect2"><a href=
1.38 dillo 1498: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1499: sandbox for chrooted builds</a></span></dt>
1.1 grant 1500:
1501: <dt><span class="sect2"><a href=
1.38 dillo 1502: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1503: partial set of packages</a></span></dt>
1.13 hubertf 1504:
1505: <dt><span class="sect2"><a href=
1.38 dillo 1506: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1507: build</a></span></dt>
1.1 grant 1508: </dl>
1509: </dd>
1510:
1.30 wiz 1511: <dt><span class="sect1"><a href=
1.38 dillo 1512: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1513: packages collection</a></span></dt>
1.1 grant 1514:
1515: <dd>
1516: <dl>
1517: <dt><span class="sect2"><a href=
1.38 dillo 1518: "#cdpack-example">6.4.1. Example of
1.1 grant 1519: cdpack</a></span></dt>
1520: </dl>
1521: </dd>
1522: </dl>
1523: </dd>
1524:
1.38 dillo 1525: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1526: Asked Questions</a></span></dt>
1527:
1528: <dd>
1529: <dl>
1.30 wiz 1530: <dt><span class="sect1"><a href=
1.38 dillo 1531: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1532: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1533:
1.38 dillo 1534: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1535: Where's the pkgviews documentation?</a></span></dt>
1536:
1.38 dillo 1537: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1538: Utilities for package management
1539: (pkgtools)</a></span></dt>
1540:
1.30 wiz 1541: <dt><span class="sect1"><a href=
1.38 dillo 1542: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1543: non-root</a></span></dt>
1.1 grant 1544:
1.30 wiz 1545: <dt><span class="sect1"><a href=
1.38 dillo 1546: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1547: fetching distfiles?</a></span></dt>
1.14 xtraeme 1548:
1.30 wiz 1549: <dt><span class="sect1"><a href=
1.38 dillo 1550: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1551: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1552:
1.30 wiz 1553: <dt><span class="sect1"><a href=
1.38 dillo 1554: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1555: from pkgsrc?</a></span></dt>
1.1 grant 1556:
1.30 wiz 1557: <dt><span class="sect1"><a href=
1.38 dillo 1558: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1559: behind a firewall</a></span></dt>
1.1 grant 1560:
1.38 dillo 1561: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1562: How do I tell <span><strong class="command">make
1.14 xtraeme 1563: fetch</strong></span> to do passive
1.1 grant 1564: FTP?</a></span></dt>
1565:
1.30 wiz 1566: <dt><span class="sect1"><a href=
1.38 dillo 1567: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1568: distfiles at once</a></span></dt>
1.1 grant 1569:
1.30 wiz 1570: <dt><span class="sect1"><a href=
1.38 dillo 1571: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1572: “<span class="quote">Don't know how to make
1573: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1574: mean?</a></span></dt>
1.13 hubertf 1575:
1.30 wiz 1576: <dt><span class="sect1"><a href=
1.38 dillo 1577: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1578: “<span class="quote">Could not find
1.14 xtraeme 1579: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1580:
1.30 wiz 1581: <dt><span class="sect1"><a href=
1.38 dillo 1582: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1583: pkgsrc</a></span></dt>
1.1 grant 1584:
1.38 dillo 1585: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1586: do I change the location of configuration
1587: files?</a></span></dt>
1.1 grant 1588:
1589: <dt><span class="sect1"><a href=
1.38 dillo 1590: "#audit-packages">7.15. Automated security
1.1 grant 1591: checks</a></span></dt>
1592: </dl>
1593: </dd>
1594: </dl>
1595: </div>
1596:
1.52 ! tv 1597: <div class="chapter" lang="en">
1.1 grant 1598: <div class="titlepage">
1599: <div>
1600: <div>
1.52 ! tv 1601: <h2 class="title"><a name=
1.1 grant 1602: "getting"></a>Chapter 2. Where to get
1603: pkgsrc</h2>
1604: </div>
1605: </div>
1606: </div>
1607:
1608: <div class="toc">
1609: <p><b>Table of Contents</b></p>
1610:
1611: <dl>
1.30 wiz 1612: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1613: tar file</a></span></dt>
1614:
1.30 wiz 1615: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1616: SUP</a></span></dt>
1617:
1.30 wiz 1618: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1619: CVS</a></span></dt>
1620: </dl>
1621: </div>
1622:
1623: <p>There are three ways to get pkgsrc. Either as a tar
1624: file, via SUP, or via CVS. All three ways are described
1625: here.</p>
1626:
1.52 ! tv 1627: <div class="sect1" lang="en">
1.1 grant 1628: <div class="titlepage">
1629: <div>
1630: <div>
1631: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 1632: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1633: </div>
1634: </div>
1635: </div>
1636:
1637: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1638: file from <a href=
1.11 ben 1639: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1640: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1641: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1642: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1643: </div>
1644:
1.52 ! tv 1645: <div class="sect1" lang="en">
1.1 grant 1646: <div class="titlepage">
1647: <div>
1648: <div>
1649: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 1650: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1651: </div>
1652: </div>
1653: </div>
1654:
1655: <p>As an alternative to the tar file, you can get pkgsrc
1656: via the Software Update Protocol, SUP. To do so, make
1657: sure your supfile has a line</p>
1658: <pre class="programlisting">
1.51 rillig 1659: release=pkgsrc
1.1 grant 1660: </pre>
1661:
1.45 wiz 1662: <p>in it, see the examples in <code xmlns=
1663: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1664: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1665: the <code xmlns=
1666: "http://www.w3.org/TR/xhtml1/transitional" class=
1667: "filename">/usr/pkgsrc</code> directory exists. Then,
1668: simply run <span><strong class="command">sup -v
1669: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1670: </div>
1671:
1.52 ! tv 1672: <div class="sect1" lang="en">
1.1 grant 1673: <div class="titlepage">
1674: <div>
1675: <div>
1676: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 1677: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1678: </div>
1679: </div>
1680: </div>
1681:
1682: <p>To get pkgsrc via CVS, make sure you have
1683: “<span class="quote">cvs</span>” installed.
1.27 rillig 1684: To do an initial (full) checkout of pkgsrc, do the
1685: following steps:</p>
1.1 grant 1686: <pre class="screen">
1.14 xtraeme 1687: <code class="prompt">%</code> <strong class=
1688: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1689: <code class="prompt">%</code> <strong class=
1690: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1691: <code class="prompt">%</code> <strong class=
1692: "userinput"><code>cd /usr</code></strong>
1693: <code class="prompt">%</code> <strong class=
1694: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1695: </pre>
1696:
1.45 wiz 1697: <p>This will create the <code xmlns=
1698: "http://www.w3.org/TR/xhtml1/transitional" class=
1699: "filename">pkgsrc</code> directory in your <code xmlns=
1700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1701: "filename">/usr</code>, and all the package source will
1.45 wiz 1702: be stored under <code xmlns=
1703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1704: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1705: initial checkout, make sure you have <code class=
1706: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1707: <pre class="screen">
1.14 xtraeme 1708: <code class="prompt">%</code> <strong class=
1709: "userinput"><code>cd /usr/pkgsrc</code></strong>
1710: <code class="prompt">%</code> <strong class=
1711: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1712: </pre>
1713:
1714: <p>Please also note that it is possible to have multiple
1715: copies of the pkgsrc hierarchy in use at any one time -
1716: all work is done relatively within the pkgsrc tree.</p>
1717: </div>
1718: </div>
1719:
1.52 ! tv 1720: <div class="chapter" lang="en">
1.1 grant 1721: <div class="titlepage">
1722: <div>
1723: <div>
1.52 ! tv 1724: <h2 class="title"><a name=
1.1 grant 1725: "platforms"></a>Chapter 3. Using pkgsrc on
1726: systems other than NetBSD</h2>
1727: </div>
1728: </div>
1729: </div>
1730:
1731: <div class="toc">
1732: <p><b>Table of Contents</b></p>
1733:
1734: <dl>
1.30 wiz 1735: <dt><span class="sect1"><a href=
1736: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1737: pkgsrc</a></span></dt>
1.1 grant 1738:
1.30 wiz 1739: <dt><span class="sect1"><a href=
1.47 reed 1740: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1741: notes</a></span></dt>
1.1 grant 1742:
1743: <dd>
1744: <dl>
1.30 wiz 1745: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1746: Darwin (Mac OS X)</a></span></dt>
1747:
1.30 wiz 1748: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1749: FreeBSD</a></span></dt>
1750:
1.30 wiz 1751: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1752: Interix</a></span></dt>
1753:
1.30 wiz 1754: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1755: IRIX</a></span></dt>
1756:
1.30 wiz 1757: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1758: Linux</a></span></dt>
1759:
1.30 wiz 1760: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1761: OpenBSD</a></span></dt>
1762:
1.30 wiz 1763: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1764: Solaris</a></span></dt>
1765: </dl>
1766: </dd>
1767: </dl>
1768: </div>
1769:
1.52 ! tv 1770: <div class="sect1" lang="en">
1.1 grant 1771: <div class="titlepage">
1772: <div>
1773: <div>
1774: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1775: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1776: pkgsrc</h2>
1.1 grant 1777: </div>
1778: </div>
1779: </div>
1780:
1.27 rillig 1781: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1782: bootstrap kit to build the required tools to use pkgsrc
1783: on your platform. Besides support for native NetBSD,
1784: pkgsrc and the bootstrap kit have support for the
1785: following operating systems:</p>
1786:
1787: <div class="itemizedlist">
1788: <ul type="disc">
1789: <li>
1790: <p>Darwin (Mac OS X)</p>
1791: </li>
1792:
1793: <li>
1.16 grant 1794: <p>DragonFlyBSD</p>
1795: </li>
1796:
1797: <li>
1.1 grant 1798: <p>FreeBSD</p>
1799: </li>
1800:
1801: <li>
1802: <p>Interix (Windows 2000, XP, 2003)</p>
1803: </li>
1804:
1805: <li>
1806: <p>IRIX</p>
1807: </li>
1808:
1809: <li>
1810: <p>Linux</p>
1811: </li>
1812:
1813: <li>
1814: <p>OpenBSD</p>
1815: </li>
1816:
1817: <li>
1818: <p>Solaris</p>
1819: </li>
1.16 grant 1820:
1821: <li>
1822: <p>Tru64 (Digital UNIX/OSF1)</p>
1823: </li>
1.1 grant 1824: </ul>
1825: </div>
1826:
1827: <p>Support for other platforms is under development.</p>
1828:
1829: <p>Installing the bootstrap kit should be as simple
1830: as:</p>
1831: <pre class="screen">
1.14 xtraeme 1832: <code class="prompt">#</code> <strong class=
1833: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1834: <code class="prompt">#</code> <strong class=
1835: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1836: <code class="prompt">#</code> <strong class=
1837: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1838: </pre>
1839:
1840: <p>See <a href="#getting" title=
1.52 ! tv 1841: "Chapter 2. Where to get pkgsrc">Chapter 2,
1.1 grant 1842: <i>Where to get pkgsrc</i></a> for other ways to get
1.14 xtraeme 1843: pkgsrc before bootstrapping. The given
1844: <span><strong class="command">bootstrap</strong></span>
1.45 wiz 1845: command will use the defaults of <code xmlns=
1846: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1847: "filename">/usr/pkg</code> for the <span class=
1848: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1849: installed in, and <code xmlns=
1850: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1851: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1852: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1853: However, these can also be set using command-line
1.27 rillig 1854: arguments.</p>
1.1 grant 1855:
1856: <p>Binary packages for the pkgsrc tools and an initial
1857: set of packages is available for supported platforms. An
1858: up-to-date list of these can be found on <a href=
1859: "http://www.pkgsrc.org/" target=
1860: "_top">www.pkgsrc.org</a>.</p>
1.47 reed 1861:
1862: <div class="note" style=
1863: "margin-left: 0.5in; margin-right: 0.5in;">
1864: <h3 class="title">Note</h3>
1865:
1866: <p>The bootstrap installs a <span><strong class=
1867: "command">bmake</strong></span> tool. Use this
1868: <span><strong class="command">bmake</strong></span>
1869: when building via pkgsrc. For examples in this guide,
1870: use <span><strong class="command">bmake</strong></span>
1871: instead of “<span class=
1872: "quote">make</span>”.</p>
1873: </div>
1.1 grant 1874: </div>
1875:
1.52 ! tv 1876: <div class="sect1" lang="en">
1.1 grant 1877: <div class="titlepage">
1878: <div>
1879: <div>
1880: <h2 class="title" style="clear: both"><a name=
1.47 reed 1881: "platform-specific-notes"></a>3.2. Platform-specific
1882: notes</h2>
1.1 grant 1883: </div>
1884: </div>
1885: </div>
1886:
1887: <p>Here are some platform-specific notes you should be
1888: aware of.</p>
1889:
1.52 ! tv 1890: <div class="sect2" lang="en">
1.1 grant 1891: <div class="titlepage">
1892: <div>
1893: <div>
1.52 ! tv 1894: <h3 class="title"><a name=
1.30 wiz 1895: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 1896: </div>
1897: </div>
1898: </div>
1899:
1900: <p>Darwin 5.x and 6.x are supported. There are two
1901: methods of using pkgsrc on Mac OS X, by using a
1902: <a href="#platform.osx-image" title=
1903: "3.2.1.1. Using a disk image">disk image</a>, or a
1904: <a href="#platform.osx-ufs" title=
1905: "3.2.1.2. Using a UFS partition">UFS
1906: partition</a>.</p>
1907:
1908: <p>Before you start, you will need to download and
1909: install the Mac OS X Developer Tools from Apple's
1910: Developer Connection. See <a href=
1911: "http://developer.apple.com/macosx/" target=
1912: "_top">http://developer.apple.com/macosx/</a> for
1913: details. Also, make sure you install X11 for Mac OS X
1914: and the X11 SDK from <a href=
1915: "http://www.apple.com/macosx/x11/download/" target=
1916: "_top">http://www.apple.com/macosx/x11/download/</a> if
1917: you intend to build packages that use the X11 Window
1918: System.</p>
1919:
1920: <p>If you already have a UFS partition, or have a spare
1921: partition that you can format as UFS, it is recommended
1922: to use that instead of the disk image. It'll be
1923: somewhat faster and will mount automatically at boot
1924: time, where you must manually mount a disk image.</p>
1925:
1926: <div class="note" style=
1927: "margin-left: 0.5in; margin-right: 0.5in;">
1928: <h3 class="title">Note</h3>
1929:
1930: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 1931: because pkgsrc currently requires the file system to
1.1 grant 1932: be case-sensitive, and HFS+ is not.</p>
1933: </div>
1934:
1.52 ! tv 1935: <div class="sect3" lang="en">
1.1 grant 1936: <div class="titlepage">
1937: <div>
1938: <div>
1.52 ! tv 1939: <h4 class="title"><a name=
! 1940: "platform.osx-image"></a>3.2.1.1. Using a
! 1941: disk image</h4>
1.1 grant 1942: </div>
1943: </div>
1944: </div>
1945:
1946: <p>Create the disk image:</p>
1947: <pre class="screen">
1.14 xtraeme 1948: <code class="prompt">#</code> <strong class=
1949: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1950: <code class="prompt">#</code> <strong class=
1951: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
1952: <code class="prompt">#</code> <strong class=
1953: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
1954: <code class="prompt">#</code> <strong class=
1955: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 1956: </pre>
1957:
1958: <p>That's it!</p>
1959: </div>
1960:
1.52 ! tv 1961: <div class="sect3" lang="en">
1.1 grant 1962: <div class="titlepage">
1963: <div>
1964: <div>
1.52 ! tv 1965: <h4 class="title"><a name=
! 1966: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 1967: UFS partition</h4>
1968: </div>
1969: </div>
1970: </div>
1971:
1.45 wiz 1972: <p>By default, <code xmlns=
1973: "http://www.w3.org/TR/xhtml1/transitional" class=
1974: "filename">/usr</code> will be on your root file
1975: system, normally HFS+. It is possible to use the
1976: default <span class="emphasis"><em>prefix</em></span>
1977: of <code xmlns=
1978: "http://www.w3.org/TR/xhtml1/transitional" class=
1979: "filename">/usr/pkg</code> by symlinking <code xmlns=
1980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1981: "filename">/usr/pkg</code> to a directory on a UFS
1982: file system. Obviously, another symlink is required
1983: if you want to place the package database directory
1984: outside the <span class=
1985: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 1986: <pre class="screen">
1.14 xtraeme 1987: <code class="prompt">#</code> <strong class=
1.22 tv 1988: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1 grant 1989: </pre>
1990:
1991: <p>If you created your partitions at the time of
1992: installing Mac OS X and formatted the target
1993: partition as UFS, it should automatically mount on
1.45 wiz 1994: <code xmlns=
1995: "http://www.w3.org/TR/xhtml1/transitional" class=
1996: "filename">/Volumes/<volume name></code> when
1997: the machine boots. If you are (re)formatting a
1998: partition as UFS, you need to ensure that the
1999: partition map correctly reflects “<span class=
2000: "quote">Apple_UFS</span>” and not
2001: “<span class=
1.1 grant 2002: "quote">Apple_HFS</span>”.</p>
2003:
2004: <p>The problem is that none of the disk tools will
2005: let you touch a disk that is booted from. You can
2006: unmount the partition, but even if you newfs it, the
2007: partition type will be incorrect and the automounter
2008: won't mount it. It can be mounted manually, but it
2009: won't appear in Finder.</p>
2010:
2011: <p>You'll need to boot off of the OS X Installation
2012: (User) CD. When the Installation program starts, go
2013: up to the menu and select Disk Utility. Now, you will
2014: be able to select the partition you want to be UFS,
2015: and Format it Apple UFS. Quit the Disk Utility, quit
2016: the installer which will reboot your machine. The new
2017: UFS file system will appear in Finder.</p>
2018:
2019: <p>Be aware that the permissions on the new file
2020: system will be writable by root only.</p>
2021:
2022: <p>This note is as of 10.2 (Jaguar) and applies to
2023: earlier versions. Hopefully Apple will fix Disk
2024: Utility in 10.3 (Panther).</p>
2025: </div>
2026: </div>
2027:
1.52 ! tv 2028: <div class="sect2" lang="en">
1.1 grant 2029: <div class="titlepage">
2030: <div>
2031: <div>
1.52 ! tv 2032: <h3 class="title"><a name=
1.30 wiz 2033: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2034: </div>
2035: </div>
2036: </div>
2037:
2038: <p>FreeBSD 4.7 and 5.0 have been tested and are
2039: supported, other versions may work.</p>
2040:
2041: <p>Care should be taken so that the tools that this kit
2042: installs do not conflict with the FreeBSD userland
2043: tools. There are several steps:</p>
2044:
2045: <div class="orderedlist">
2046: <ol type="1">
2047: <li>
2048: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2049: <code xmlns=
2050: "http://www.w3.org/TR/xhtml1/transitional" class=
2051: "filename">/var/db/pkg</code>. It is therefore
2052: recommended that you choose a different location
2053: (e.g. <code xmlns=
2054: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2055: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2056: --pkgdbdir option to the bootstrap script.</p>
2057: </li>
2058:
2059: <li>
2060: <p>If you do not intend to use the FreeBSD ports
2061: tools, it's probably a good idea to move them out
2062: of the way to avoid confusion, e.g.</p>
2063: <pre class="screen">
1.14 xtraeme 2064: <code class="prompt">#</code> <strong class=
2065: "userinput"><code>cd /usr/sbin</code></strong>
2066: <code class="prompt">#</code> <strong class=
2067: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2068: <code class="prompt">#</code> <strong class=
2069: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2070: <code class="prompt">#</code> <strong class=
2071: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2072: <code class="prompt">#</code> <strong class=
2073: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2074: </pre>
2075: </li>
2076:
2077: <li>
1.45 wiz 2078: <p>An example <code xmlns=
2079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2080: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2081: placed in <code xmlns=
2082: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2083: "filename">/etc/mk.conf.example</code> file when
2084: you use the bootstrap script.</p>
1.1 grant 2085: </li>
2086: </ol>
2087: </div>
2088: </div>
2089:
1.52 ! tv 2090: <div class="sect2" lang="en">
1.1 grant 2091: <div class="titlepage">
2092: <div>
2093: <div>
1.52 ! tv 2094: <h3 class="title"><a name=
1.30 wiz 2095: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2096: </div>
2097: </div>
2098: </div>
2099:
1.47 reed 2100: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2101: Windows NT kernel, providing a Unix-like environment
2102: with a tighter kernel integration than available with
2103: Cygwin. It is part of the Windows Services for Unix
2104: package, available for free for any licensed copy of
1.22 tv 2105: Windows 2000, XP (not including XP Home), or 2003. SFU
2106: can be downloaded from <a href=
2107: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2108: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2109:
2110: <p>Services for Unix 3.5, current as of this writing,
2111: has been tested. 3.0 or 3.1 may work, but are not
2112: officially supported. (The main difference in 3.0/3.1
2113: is lack of pthreads.)</p>
2114:
1.52 ! tv 2115: <div class="sect3" lang="en">
1.1 grant 2116: <div class="titlepage">
2117: <div>
2118: <div>
2119: <h4 class="title"><a name=
2120: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2121: installing Interix/SFU</h4>
1.1 grant 2122: </div>
2123: </div>
2124: </div>
2125:
2126: <p>At an absolute minimum, the following packages
2127: must be installed from the Windows Services for Unix
2128: 3.5 distribution in order to use pkgsrc:</p>
2129:
2130: <div class="itemizedlist">
2131: <ul type="disc">
2132: <li>
2133: <p>Utilities -> Base Utilities</p>
2134: </li>
2135:
2136: <li>
2137: <p>Interix GNU Components -> (all)</p>
2138: </li>
2139:
2140: <li>
2141: <p>Remote Connectivity</p>
2142: </li>
2143:
2144: <li>
2145: <p>Interix SDK</p>
2146: </li>
2147: </ul>
2148: </div>
2149:
2150: <p>When using pkgsrc on Interix, DO NOT install the
2151: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2152: without shared module support, installed to
2153: /usr/local, and will only cause confusion. Instead,
2154: install Perl 5.8 from pkgsrc (or from a binary
2155: package).</p>
2156:
2157: <p>The Remote Connectivity subcomponent "Windows
2158: Remote Shell Service" does not need to be installed,
2159: but Remote Connectivity itself should be installed in
2160: order to have a working inetd.</p>
2161:
1.52 ! tv 2162: <p>During installation you may be asked whether to
! 2163: enable setuid behavior for Interix programs, and
! 2164: whether to make pathnames default to case-sensitive.
! 2165: Setuid should be enabled, and case-sensitivity MUST
! 2166: be enabled. (Without case-sensitivity, a large number
! 2167: of packages including perl will not build.)</p>
! 2168:
! 2169: <p>NOTE: Newer Windows service packs change the way
! 2170: binary execution works (via the Data Execution
! 2171: Prevention feature). In order to use pkgsrc and other
! 2172: gcc-compiled binaries reliably, a hotfix containing
! 2173: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
! 2174: (899522 or newer) must be installed. Hotfixes are
! 2175: available from Microsoft through a support contract;
! 2176: however, a NetBSD developer has made most Interix
! 2177: hotfixes available for personal use from <a href=
! 2178: "http://www.duh.org/interix/hotfixes.php" target=
! 2179: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2180: </div>
2181:
1.52 ! tv 2182: <div class="sect3" lang="en">
1.1 grant 2183: <div class="titlepage">
2184: <div>
2185: <div>
2186: <h4 class="title"><a name=
2187: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2188: to do if Interix/SFU is already installed</h4>
2189: </div>
2190: </div>
2191: </div>
2192:
2193: <p>If SFU is already installed and you wish to alter
2194: these settings to work with pkgsrc, note the
2195: following things.</p>
2196:
2197: <div class="itemizedlist">
2198: <ul type="disc">
2199: <li>
2200: <p>To uninstall UNIX Perl, use Add/Remove
2201: Programs, select Microsoft Windows Services for
2202: UNIX, then click Change. In the installer,
2203: choose Add or Remove, then uncheck
2204: Utilities->UNIX Perl.</p>
2205: </li>
2206:
2207: <li>
1.47 reed 2208: <p>To enable case-sensitivity for the file
2209: system, run REGEDIT.EXE, and change the
1.1 grant 2210: following registry key:</p>
2211:
2212: <p>
2213: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2214: Manager\kernel</p>
2215:
2216: <p>Set the DWORD value "obcaseinsensitive" to
2217: 0; then reboot.</p>
2218: </li>
2219:
2220: <li>
2221: <p>To enable setuid binaries (optional), run
2222: REGEDIT.EXE, and change the following registry
2223: key:</p>
2224:
2225: <p>
2226: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2227: for UNIX</p>
2228:
2229: <p>Set the DWORD value "EnableSetuidBinaries"
2230: to 1; then reboot.</p>
2231: </li>
2232: </ul>
2233: </div>
2234: </div>
2235:
1.52 ! tv 2236: <div class="sect3" lang="en">
1.1 grant 2237: <div class="titlepage">
2238: <div>
2239: <div>
2240: <h4 class="title"><a name=
2241: "platform.interix-notes"></a>3.2.3.3. Important
2242: notes for using pkgsrc</h4>
2243: </div>
2244: </div>
2245: </div>
2246:
1.52 ! tv 2247: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2248: or the user running "pkg_add") must be a member of
2249: the local Administrators group. Such a user must also
2250: be used to run the bootstrap. This is slightly
2251: relaxed from the normal pkgsrc requirement of
2252: "root".</p>
2253:
2254: <p>The package manager should use a umask of 002.
2255: "make install" will automatically complain if this is
2256: not the case. This ensures that directories written
2257: in /var/db/pkg are Administrators-group
2258: writeable.</p>
2259:
2260: <p>The popular Interix binary packages from
2261: http://www.interopsystems.com/ use an older version
2262: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2263: used in conjunction with pkgsrc. If you choose to use
2264: them at the same time as the pkgsrc packages, ensure
2265: that you use the proper pkg_* tools for each type of
2266: binary package.</p>
1.22 tv 2267:
2268: <p>The TERM setting used for DOS-type console windows
2269: (including those invoked by the csh and ksh startup
2270: shortcuts) is "interix". Most systems don't have a
2271: termcap/terminfo entry for it, but the following
2272: .termcap entry provides adequate emulation in most
2273: cases:</p>
2274: <pre class="programlisting">
1.51 rillig 2275: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2276: </pre>
1.1 grant 2277: </div>
1.52 ! tv 2278:
! 2279: <div class="sect3" lang="en">
! 2280: <div class="titlepage">
! 2281: <div>
! 2282: <div>
! 2283: <h4 class="title"><a name=
! 2284: "platform.interix-limits"></a>3.2.3.4. Limitations
! 2285: of the Interix platform</h4>
! 2286: </div>
! 2287: </div>
! 2288: </div>
! 2289:
! 2290: <p>Though Interix suffices as a familiar and flexible
! 2291: substitute for a full Unix-like platform, it has some
! 2292: drawbacks that should be noted for those desiring to
! 2293: make the most of Interix.</p>
! 2294:
! 2295: <div class="itemizedlist">
! 2296: <ul type="disc">
! 2297: <li>
! 2298: <span class=
! 2299: "strong"><strong>X-Windows:</strong></span>
! 2300:
! 2301: <p>Interix comes with the standard set of X11R6
! 2302: client libraries, and can run X-Windows based
! 2303: applications, but it does <span class=
! 2304: "emphasis"><em>not</em></span> come with an X
! 2305: server. Some options are <a href=
! 2306: "http://www.starnet.com/products/xwin32/"
! 2307: target="_top">StarNet X-Win32</a>, <a href=
! 2308: "http://connectivity.hummingbird.com/products/nc/exceed/"
! 2309: target="_top">Hummingbird Exceed</a>, and the
! 2310: free X-Windows server included with <a href=
! 2311: "http://x.cygwin.com/" target=
! 2312: "_top">Cygwin</a>.</p>
! 2313:
! 2314: <p>Also, StarNet Communications has graciously
! 2315: provided a free version of their X-Win32
! 2316: product that accepts connections only from
! 2317: localhost: <a href=
! 2318: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
! 2319: target="_top">X-Win32 LX</a>, recommended by
! 2320: the maintainer of Interix pkgsrc support.</p>
! 2321: </li>
! 2322:
! 2323: <li>
! 2324: <span class="strong"><strong>X-Windows
! 2325: acceleration:</strong></span>
! 2326:
! 2327: <p>Because Interix runs in a completely
! 2328: different NT subsystem from Win32 applications,
! 2329: it does not currently support various X11
! 2330: protocol extensions for acceleration (such as
! 2331: MIT-SHM or DGA). Most interactive applications
! 2332: to a local X server will run reasonably fast,
! 2333: but full motion video and other graphics
! 2334: intensive applications may require a
! 2335: faster-than-expected CPU.</p>
! 2336: </li>
! 2337:
! 2338: <li>
! 2339: <span class=
! 2340: "strong"><strong>Audio:</strong></span>
! 2341:
! 2342: <p>Interix has no native support for audio
! 2343: output. To provide audio support, pkgsrc uses
! 2344: the <span><strong class=
! 2345: "command">esound</strong></span> client/server
! 2346: audio system on Interix. Unlike on most
! 2347: platforms, the <a xmlns=
! 2348: "http://www.w3.org/TR/xhtml1/transitional"
! 2349: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
! 2350: target="_top"><code xmlns="" class=
! 2351: "filename">audio/esound</code></a> package does
! 2352: <span class="emphasis"><em>not</em></span>
! 2353: contain the <span><strong class=
! 2354: "command">esound</strong></span> server
! 2355: component. To output audio, the <a xmlns=
! 2356: "http://www.w3.org/TR/xhtml1/transitional"
! 2357: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
! 2358: target="_top"><code xmlns="" class=
! 2359: "filename">emulators/cygwin_esound</code></a>
! 2360: package must also be installed.</p>
! 2361: </li>
! 2362:
! 2363: <li>
! 2364: <span class="strong"><strong>CD/DVDs, USB, and
! 2365: SCSI:</strong></span>
! 2366:
! 2367: <p>Direct device access is not currently
! 2368: supported in Interix, so it is not currently
! 2369: possible to access CD/DVD drives, USB devices,
! 2370: or SCSI devices through non-filesystem means.
! 2371: Among other things, this makes it impossible to
! 2372: use Interix directly for CD/DVD burning.</p>
! 2373: </li>
! 2374:
! 2375: <li>
! 2376: <span class="strong"><strong>Tape
! 2377: drives:</strong></span>
! 2378:
! 2379: <p>Due to the same limitations as for CD-ROMs
! 2380: and SCSI devices, tape drives are also not
! 2381: directly accessible in Interix. However,
! 2382: support is in work to make tape drive access
! 2383: possible by using Cygwin as a bridge (similarly
! 2384: to audio bridged via Cygwin's esound
! 2385: server).</p>
! 2386: </li>
! 2387: </ul>
! 2388: </div>
! 2389: </div>
! 2390:
! 2391: <div class="sect3" lang="en">
! 2392: <div class="titlepage">
! 2393: <div>
! 2394: <div>
! 2395: <h4 class="title"><a name=
! 2396: "platform.interix-knownissues"></a>3.2.3.5. Known
! 2397: issues for pkgsrc on Interix</h4>
! 2398: </div>
! 2399: </div>
! 2400: </div>
! 2401:
! 2402: <p>It is not necessary, in general, to have a "root"
! 2403: user on the Windows system; any member of the local
! 2404: Administrators group will suffice. However, some
! 2405: packages currently assume that the user named "root"
! 2406: is the privileged user. To accommodate these, you may
! 2407: create such a user; make sure it is in the local
! 2408: group Administrators (or your language
! 2409: equivalent).</p>
! 2410:
! 2411: <p>"pkg_add" creates directories of mode 0755, not
! 2412: 0775, in $PKG_DBDIR. For the time being, install
! 2413: packages as the local Administrator (or your language
! 2414: equivalent), or run the following command after
! 2415: installing a package to work around the issue:</p>
! 2416: <pre class="screen">
! 2417: <code class="prompt">#</code> <strong class=
! 2418: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
! 2419: </pre>
! 2420: </div>
1.1 grant 2421: </div>
2422:
1.52 ! tv 2423: <div class="sect2" lang="en">
1.1 grant 2424: <div class="titlepage">
2425: <div>
2426: <div>
1.52 ! tv 2427: <h3 class="title"><a name=
1.30 wiz 2428: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2429: </div>
2430: </div>
2431: </div>
2432:
2433: <p>You will need a working C compiler, either gcc or
2434: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2435: the <code class="varname">CC</code> environment
2436: variable according to your preference. If you do not
2437: have a license for the MIPSpro compiler suite, you can
1.1 grant 2438: download a gcc tardist file from <a href=
2439: "http://freeware.sgi.com/" target=
2440: "_top">http://freeware.sgi.com/</a>.</p>
2441:
2442: <p>Please note that you will need IRIX 6.5.17 or
2443: higher, as this is the earliest version of IRIX
1.24 wiz 2444: providing support for <a href=
2445: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2446: <span class="citerefentry"><span class=
2447: "refentrytitle">if_indextoname</span>(3)</span></a>,
2448: <a href=
2449: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2450: <span class="citerefentry"><span class=
2451: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2452: etc.</p>
1.1 grant 2453:
1.27 rillig 2454: <p>At this point in time, pkgsrc only supports one ABI
2455: at a time. That is, you can not switch between the old
2456: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2457: you start out using "abi=n32", that's what all your
2458: packages will be built with.</p>
1.1 grant 2459:
2460: <p>Therefore, please make sure that you have no
1.14 xtraeme 2461: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2462: environment or the <code xmlns=
2463: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2464: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2465: that you do not try to link n32 object files with lib64
1.45 wiz 2466: or vice versa. Check your <code xmlns=
2467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2468: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2469:
2470: <p>If you have the actual pkgsrc tree mounted via NFS
2471: from a different host, please make sure to set
1.14 xtraeme 2472: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2473: directory, as it appears that IRIX linker occasionally
1.47 reed 2474: runs into issues when trying to link over a
2475: network-mounted file system.</p>
1.1 grant 2476:
2477: <p>The bootstrapping process should set all the right
2478: options for programs such as imake(1), but you may want
2479: to set some options depending on your local setup.
1.45 wiz 2480: Please see <code xmlns=
2481: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2482: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2483: course, your compiler's man pages for details.</p>
1.22 tv 2484:
2485: <p>If you are using SGI's MIPSPro compiler, please
2486: set</p>
2487: <pre class="programlisting">
1.51 rillig 2488: PKGSRC_COMPILER= mipspro
1.22 tv 2489: </pre>
2490:
1.45 wiz 2491: <p>in <code xmlns=
2492: "http://www.w3.org/TR/xhtml1/transitional" class=
2493: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2494: assume you are using gcc and may end up passing invalid
2495: flags to the compiler. Note that bootstrap should
2496: create an appropriate <code xmlns=
2497: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2498: "filename">mk.conf.example</code> by default.</p>
2499:
2500: <p>If you have both the MIPSPro compiler chain
2501: installed as well as gcc, but want to make sure that
2502: MIPRPro is used, please set your <code class=
2503: "varname">PATH</code> to <span class=
2504: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2505: gcc (often <code xmlns=
2506: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2507: "filename">/usr/freeware/bin</code>), and (important)
2508: pass the '--preserve-path' flag.</p>
1.1 grant 2509: </div>
2510:
1.52 ! tv 2511: <div class="sect2" lang="en">
1.1 grant 2512: <div class="titlepage">
2513: <div>
2514: <div>
1.52 ! tv 2515: <h3 class="title"><a name=
1.30 wiz 2516: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2517: </div>
2518: </div>
2519: </div>
2520:
2521: <p>Some versions of Linux (for example Debian
2522: GNU/Linux) need either libtermcap or libcurses
2523: (libncurses). Installing the distributions
2524: libncurses-dev package (or equivalent) should fix the
2525: problem.</p>
2526:
2527: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2528: and icc (Intel C++ Compiler). gcc is the default. icc
2529: 8.0 and 8.1 on i386 have been tested.</p>
2530:
2531: <p>To bootstrap using icc, assuming the default icc
2532: installation directory:</p>
2533: <pre class="programlisting">
1.51 rillig 2534: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2535: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2536: </pre>
2537:
2538: <div class="note" style=
2539: "margin-left: 0.5in; margin-right: 0.5in;">
2540: <h3 class="title">Note</h3>
2541:
2542: <p>icc 8.1 needs the `-i-static' argument instead of
2543: -static-libcxa.</p>
2544: </div>
2545:
2546: <p>icc supports __attribute__, but the GNU configure
2547: test uses a nested function, which icc does not
2548: support. #undef'ing __attribute__ has the unfortunate
2549: side-effect of breaking many of the Linux header files,
2550: which cannot be compiled properly without
2551: __attribute__. The test must be overridden so that
2552: __attribute__ is assumed supported by the compiler.</p>
2553:
2554: <p>After bootstrapping, you should set <code class=
1.45 wiz 2555: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2556: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2557: "filename">/etc/mk.conf</code>:</p>
2558: <pre class="programlisting">
1.51 rillig 2559: PKGSRC_COMPILER= icc
1.22 tv 2560: </pre>
2561:
2562: <p>The default installation directory for icc is
1.45 wiz 2563: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2564: class="filename">/opt/intel_cc_80</code>, which is also
2565: the pkgsrc default. If you have installed it into a
2566: different directory, set <code class=
2567: "varname">ICCBASE</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: ICCBASE= /opt/icc
1.22 tv 2572: </pre>
2573:
2574: <p>pkgsrc uses the static linking method of the runtime
2575: libraries provided by icc, so binaries can be run on
2576: other systems which do not have the shared libraries
2577: installed.</p>
2578:
2579: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2580: the <a href=
2581: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2582: <span class="citerefentry"><span class=
2583: "refentrytitle">ld</span>(1)</span></a> command run
2584: when linking a C++ shared library and records it,
2585: throwing away the -Bstatic and -Bdynamic options
2586: interspersed between the libraries. This means that
2587: libtool-linked C++ shared libraries will have a runtime
2588: dependency on the icc libraries until this is fixed in
2589: libtool.</p>
1.22 tv 2590: </div>
2591:
1.52 ! tv 2592: <div class="sect2" lang="en">
1.22 tv 2593: <div class="titlepage">
2594: <div>
2595: <div>
1.52 ! tv 2596: <h3 class="title"><a name=
1.30 wiz 2597: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2598: </div>
2599: </div>
2600: </div>
2601:
2602: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2603:
2604: <p>Care should be taken so that the tools that this kit
2605: installs do not conflict with the OpenBSD userland
2606: tools. There are several steps:</p>
2607:
2608: <div class="orderedlist">
2609: <ol type="1">
2610: <li>
2611: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2612: <code xmlns=
2613: "http://www.w3.org/TR/xhtml1/transitional" class=
2614: "filename">/var/db/pkg</code>. It is therefore
2615: recommended that you choose a different location
2616: (e.g. <code xmlns=
2617: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2618: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2619: --pkgdbdir option to the bootstrap script.</p>
2620: </li>
2621:
2622: <li>
2623: <p>If you do not intend to use the OpenBSD ports
2624: tools, it's probably a good idea to move them out
2625: of the way to avoid confusion, e.g.</p>
2626: <pre class="screen">
1.14 xtraeme 2627: <code class="prompt">#</code> <strong class=
2628: "userinput"><code>cd /usr/sbin</code></strong>
2629: <code class="prompt">#</code> <strong class=
2630: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2631: <code class="prompt">#</code> <strong class=
2632: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2633: <code class="prompt">#</code> <strong class=
2634: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2635: <code class="prompt">#</code> <strong class=
2636: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2637: </pre>
2638: </li>
2639:
2640: <li>
1.45 wiz 2641: <p>An example <code xmlns=
2642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2643: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2644: placed in <code xmlns=
2645: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2646: "filename">/etc/mk.conf.example</code> file when
2647: you use the bootstrap script. OpenBSD's make
1.45 wiz 2648: program uses <code xmlns=
2649: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2650: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2651: work around this by enclosing all the
2652: pkgsrc-specific parts of the file with:</p>
1.1 grant 2653: <pre class="programlisting">
1.51 rillig 2654: .ifdef BSD_PKG_MK
2655: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2656: .else
2657: # OpenBSD stuff
2658: .endif
1.1 grant 2659: </pre>
2660: </li>
2661: </ol>
2662: </div>
2663: </div>
2664:
1.52 ! tv 2665: <div class="sect2" lang="en">
1.1 grant 2666: <div class="titlepage">
2667: <div>
2668: <div>
1.52 ! tv 2669: <h3 class="title"><a name=
1.30 wiz 2670: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2671: </div>
2672: </div>
2673: </div>
2674:
2675: <p>Solaris 2.6 through 9 are supported on both x86 and
2676: sparc. You will need a working C compiler. Both gcc
2677: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2678:
2679: <p>The following packages are required on Solaris 8 for
2680: the bootstrap process and to build packages.</p>
2681:
2682: <div class="itemizedlist">
2683: <ul type="disc">
2684: <li>
2685: <p>SUNWsprot</p>
2686: </li>
2687:
2688: <li>
2689: <p>SUNWarc</p>
2690: </li>
2691:
2692: <li>
2693: <p>SUNWbtool</p>
2694: </li>
2695:
2696: <li>
2697: <p>SUNWtoo</p>
2698: </li>
2699:
2700: <li>
2701: <p>SUNWlibm</p>
2702: </li>
2703: </ul>
2704: </div>
2705:
2706: <p>Please note the use of GNU binutils on Solaris is
2707: <span class="emphasis"><em>not</em></span>
2708: supported.</p>
2709:
1.52 ! tv 2710: <div class="sect3" lang="en">
1.1 grant 2711: <div class="titlepage">
2712: <div>
2713: <div>
1.52 ! tv 2714: <h4 class="title"><a name=
! 2715: "solaris-gcc-note"></a>3.2.7.1. If you are
! 2716: using gcc</h4>
1.1 grant 2717: </div>
2718: </div>
2719: </div>
2720:
2721: <p>It makes life much simpler if you only use the
2722: same gcc consistently for building all packages.</p>
2723:
2724: <p>It is recommended that an external gcc be used
2725: only for bootstrapping, then either build gcc from
2726: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2727: href=
2728: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2729: target="_top"><code xmlns="" class=
2730: "filename">lang/gcc</code></a> or install a binary
2731: gcc package, then remove gcc used during
1.20 ben 2732: bootstrapping.</p>
1.1 grant 2733:
2734: <p>Binary packages of gcc can be found through
2735: <a href=
2736: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2737: target=
2738: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2739: </div>
2740:
1.52 ! tv 2741: <div class="sect3" lang="en">
1.1 grant 2742: <div class="titlepage">
2743: <div>
2744: <div>
1.30 wiz 2745: <h4 class="title"><a name=
2746: "solaris-sun-workshop-note"></a>3.2.7.2. If
2747: you are using Sun WorkShop</h4>
1.1 grant 2748: </div>
2749: </div>
2750: </div>
2751:
2752: <p>You will need at least the following packages
2753: installed (from WorkShop 5.0)</p>
2754:
2755: <div class="itemizedlist">
2756: <ul type="disc">
2757: <li>
2758: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2759: </li>
2760:
2761: <li>
2762: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2763: </li>
2764:
2765: <li>
2766: <p>SPROild - Sun WorkShop Incremental
2767: Linker</p>
2768: </li>
2769:
2770: <li>
2771: <p>SPROlang - Sun WorkShop Compilers common
2772: components</p>
2773: </li>
2774: </ul>
2775: </div>
2776:
1.14 xtraeme 2777: <p>You should set <code class="varname">CC</code>,
2778: <code class="varname">CXX</code> and optionally,
1.45 wiz 2779: <code class="varname">CPP</code> in <code xmlns=
2780: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2781: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2782: <pre class="programlisting">
1.51 rillig 2783: CC= cc
2784: CXX= CC
2785: CPP= /usr/ccs/lib/cpp
1.1 grant 2786: </pre>
2787:
2788: <p>You may also want to build 64-bit binaries,
1.47 reed 2789: e.g.:</p>
1.1 grant 2790: <pre class="programlisting">
1.51 rillig 2791: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2792: </pre>
2793:
2794: <p>Whichever compiler you use, please ensure the
2795: compiler tools and your $prefix are in your
1.14 xtraeme 2796: <code class="varname">PATH</code>. This includes
1.45 wiz 2797: <code xmlns=
2798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2799: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2800: <code xmlns=
2801: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2802: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2803: </div>
2804: </div>
2805: </div>
2806: </div>
2807:
1.52 ! tv 2808: <div class="chapter" lang="en">
1.1 grant 2809: <div class="titlepage">
2810: <div>
2811: <div>
1.52 ! tv 2812: <h2 class="title"><a name=
1.1 grant 2813: "using"></a>Chapter 4. Using pkgsrc</h2>
2814: </div>
2815: </div>
2816: </div>
2817:
2818: <div class="toc">
2819: <p><b>Table of Contents</b></p>
2820:
2821: <dl>
2822: <dt><span class="sect1"><a href="#getting-started">4.1.
2823: Working with binary packages</a></span></dt>
2824:
2825: <dd>
2826: <dl>
1.30 wiz 2827: <dt><span class="sect2"><a href=
2828: "#where-to-get-binary-packages">4.1.1. Where to get
2829: binary packages</a></span></dt>
1.1 grant 2830:
1.30 wiz 2831: <dt><span class="sect2"><a href=
2832: "#how-to-use-binary-packages">4.1.2. How to use
2833: binary packages</a></span></dt>
1.1 grant 2834:
1.30 wiz 2835: <dt><span class="sect2"><a href=
2836: "#a-word-of-warning">4.1.3. A word of
2837: warning</a></span></dt>
1.1 grant 2838: </dl>
2839: </dd>
2840:
1.30 wiz 2841: <dt><span class="sect1"><a href=
2842: "#building-packages-from-source">4.2. Building packages
2843: from source</a></span></dt>
1.1 grant 2844:
2845: <dd>
2846: <dl>
1.30 wiz 2847: <dt><span class="sect2"><a href=
2848: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2849:
1.30 wiz 2850: <dt><span class="sect2"><a href=
2851: "#fetching-distfiles">4.2.2. Fetching
2852: distfiles</a></span></dt>
1.1 grant 2853:
1.30 wiz 2854: <dt><span class="sect2"><a href=
2855: "#how-to-build-and-install">4.2.3. How to build and
2856: install</a></span></dt>
1.1 grant 2857:
1.30 wiz 2858: <dt><span class="sect2"><a href=
2859: "#selecting-the-compiler">4.2.4. Selecting the
2860: compiler</a></span></dt>
1.1 grant 2861: </dl>
2862: </dd>
2863: </dl>
2864: </div>
2865:
1.52 ! tv 2866: <div class="sect1" lang="en">
1.1 grant 2867: <div class="titlepage">
2868: <div>
2869: <div>
2870: <h2 class="title" style="clear: both"><a name=
2871: "getting-started"></a>4.1. Working with binary
2872: packages</h2>
2873: </div>
2874: </div>
2875: </div>
2876:
2877: <p>This section describes how to find, retrieve and
2878: install a precompiled binary package that someone else
2879: already prepared for your type of machine.</p>
2880:
1.52 ! tv 2881: <div class="sect2" lang="en">
1.1 grant 2882: <div class="titlepage">
2883: <div>
2884: <div>
1.30 wiz 2885: <h3 class="title"><a name=
2886: "where-to-get-binary-packages"></a>4.1.1. Where
2887: to get binary packages</h3>
1.1 grant 2888: </div>
2889: </div>
2890: </div>
2891:
2892: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 2893: and its mirrors in the directory <code xmlns=
2894: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2895: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
2896: for anonymous FTP access. <code class=
2897: "varname">OSVERSION</code> is the NetBSD version
2898: (<span><strong class="command">uname
2899: -r</strong></span>), <code class="varname">ARCH</code>
2900: is the architecture (<span><strong class=
2901: "command">uname -p</strong></span>). In that directory,
2902: there is a subdirectory for each category plus a
1.45 wiz 2903: subdirectory <code xmlns=
2904: "http://www.w3.org/TR/xhtml1/transitional" class=
2905: "filename">All</code> which includes the actual
2906: binaries in <code xmlns=
2907: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2908: "filename">.tgz</code> files. The category
2909: subdirectories use symbolic links to those files (this
1.45 wiz 2910: is the same directory layout as in <code xmlns=
2911: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2912: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 2913:
1.47 reed 2914: <p>This same directory layout applies for CD-ROM
1.1 grant 2915: distributions, only that the directory may be rooted
1.45 wiz 2916: somewhere else, probably somewhere below <code xmlns=
2917: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2918: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 2919: documentation for the exact location.</p>
2920: </div>
2921:
1.52 ! tv 2922: <div class="sect2" lang="en">
1.1 grant 2923: <div class="titlepage">
2924: <div>
2925: <div>
1.30 wiz 2926: <h3 class="title"><a name=
2927: "how-to-use-binary-packages"></a>4.1.2. How
2928: to use binary packages</h3>
1.1 grant 2929: </div>
2930: </div>
2931: </div>
2932:
1.47 reed 2933: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 2934: to your hard disk, you can install them with the
1.27 rillig 2935: following command (be sure to <span><strong class=
1.14 xtraeme 2936: "command">su</strong></span> to root first):</p>
1.1 grant 2937: <pre class="screen">
1.14 xtraeme 2938: <code class="prompt">#</code> <strong class=
2939: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 2940: </pre>
2941:
2942: <p>If you have FTP access and you don't want to
2943: download the packages via FTP prior to installation,
1.14 xtraeme 2944: you can do this automatically by giving
2945: <span><strong class="command">pkg_add</strong></span>
2946: an FTP URL:</p>
1.1 grant 2947: <pre class="screen">
1.14 xtraeme 2948: <code class="prompt">#</code> <strong class=
1.27 rillig 2949: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 2950: </pre>
2951:
1.27 rillig 2952: <p>Note that any prerequisite packages needed to run
2953: the package in question will be installed, too,
1.1 grant 2954: assuming they are present where you install from.</p>
2955:
1.23 wiz 2956: <p>To save some typing, you can set the <code class=
2957: "varname">PKG_PATH</code> environment variable to a
1.47 reed 2958: semicolon-separated list of paths (including remote
1.23 wiz 2959: URLs); trailing slashes are not allowed.</p>
2960:
1.45 wiz 2961: <p>Additionally to the <code xmlns=
2962: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 2963: "filename">All</code> directory there exists a
1.45 wiz 2964: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2965: class="filename">vulnerable</code> directory to which
2966: binary packages with known vulnerabilities are moved,
2967: since removing them could cause missing dependencies.
2968: To use these packages, add the <code xmlns=
2969: "http://www.w3.org/TR/xhtml1/transitional" class=
2970: "filename">vulnerable</code> directory to your
2971: <code class="varname">PKG_PATH</code>. However, you
2972: should run <a xmlns=
1.23 wiz 2973: "http://www.w3.org/TR/xhtml1/transitional" href=
2974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 2975: target="_top"><code xmlns="" class=
2976: "filename">security/audit-packages</code></a>
1.47 reed 2977: regularly, especially after installing new packages,
2978: and verify that the vulnerabilities are acceptable for
2979: your configuration. An example <code class=
2980: "varname">PKG_PATH</code> would be: <code xmlns=
2981: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 2982: "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 2983: Please note that semicolon (';') is a shell
2984: meta-character, so you'll probably have to quote
2985: it.</p>
2986:
1.1 grant 2987: <p>After you've installed packages, be sure to have
1.45 wiz 2988: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2989: class="filename">/usr/pkg/bin</code> and <code xmlns=
2990: "http://www.w3.org/TR/xhtml1/transitional" class=
2991: "filename">/usr/pkg/sbin</code> in your <code class=
2992: "varname">PATH</code> so you can actually start the
2993: just installed program.</p>
1.1 grant 2994: </div>
2995:
1.52 ! tv 2996: <div class="sect2" lang="en">
1.1 grant 2997: <div class="titlepage">
2998: <div>
2999: <div>
1.52 ! tv 3000: <h3 class="title"><a name=
1.30 wiz 3001: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3002: warning</h3>
3003: </div>
3004: </div>
3005: </div>
3006:
3007: <p>Please pay very careful attention to the warnings
3008: expressed in the <a href=
3009: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3010: <span class="citerefentry"><span class=
3011: "refentrytitle">pkg_add</span>(1)</span></a> manual
3012: page about the inherent dangers of installing binary
3013: packages which you did not create yourself, and the
3014: security holes that can be introduced onto your system
3015: by indiscriminate adding of such files.</p>
3016: </div>
3017: </div>
3018:
1.52 ! tv 3019: <div class="sect1" lang="en">
1.1 grant 3020: <div class="titlepage">
3021: <div>
3022: <div>
3023: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3024: "building-packages-from-source"></a>4.2. Building
1.1 grant 3025: packages from source</h2>
3026: </div>
3027: </div>
3028: </div>
3029:
3030: <p>This assumes that the package is already in pkgsrc. If
3031: it is not, see <a href="#developers-guide" title=
1.46 gdt 3032: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3033: “The pkgsrc developer's guide”</a> for
3034: instructions how to create your own packages.</p>
1.1 grant 3035:
1.52 ! tv 3036: <div class="sect2" lang="en">
1.1 grant 3037: <div class="titlepage">
3038: <div>
3039: <div>
1.52 ! tv 3040: <h3 class="title"><a name=
1.30 wiz 3041: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3042: </div>
3043: </div>
3044: </div>
3045:
3046: <p>To build packages from source on a NetBSD system the
3047: “<span class="quote">comp</span>” and the
3048: “<span class="quote">text</span>”
3049: distribution sets must be installed. If you want to
1.47 reed 3050: build X11-related packages the “<span class=
1.1 grant 3051: "quote">xbase</span>” and “<span class=
3052: "quote">xcomp</span>” distribution sets are
3053: required, too.</p>
3054: </div>
3055:
1.52 ! tv 3056: <div class="sect2" lang="en">
1.1 grant 3057: <div class="titlepage">
3058: <div>
3059: <div>
1.52 ! tv 3060: <h3 class="title"><a name=
! 3061: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3062: distfiles</h3>
3063: </div>
3064: </div>
3065: </div>
3066:
1.27 rillig 3067: <p>The first step for building a package is downloading
3068: the distfiles (i.e. the unmodified source). If they
3069: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3070: automatically.</p>
3071:
3072: <p>You can overwrite some of the major distribution
3073: sites to fit to sites that are close to your own. Have
1.45 wiz 3074: a look at <code xmlns=
3075: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3076: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3077: some examples — in particular, look for the
1.14 xtraeme 3078: <code class="varname">MASTER_SORT</code>, <code class=
3079: "varname">MASTER_SORT_REGEX</code> and <code class=
3080: "varname">INET_COUNTRY</code> definitions. This may
3081: save some of your bandwidth and time.</p>
1.1 grant 3082:
3083: <p>You can change these settings either in your shell's
3084: environment, or, if you want to keep the settings, by
1.45 wiz 3085: editing the <code xmlns=
3086: "http://www.w3.org/TR/xhtml1/transitional" class=
3087: "filename">/etc/mk.conf</code> file, and adding the
3088: definitions there.</p>
1.1 grant 3089:
3090: <p>If you don't have a permanent Internet connection
3091: and you want to know which files to download,
1.14 xtraeme 3092: <span><strong class="command">make
3093: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3094: need. Put these distfiles into <code xmlns=
3095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3096: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3097: </div>
3098:
1.52 ! tv 3099: <div class="sect2" lang="en">
1.1 grant 3100: <div class="titlepage">
3101: <div>
3102: <div>
1.30 wiz 3103: <h3 class="title"><a name=
3104: "how-to-build-and-install"></a>4.2.3. How to
3105: build and install</h3>
1.1 grant 3106: </div>
3107: </div>
3108: </div>
3109:
3110: <p>Assuming that the distfile has been fetched (see
3111: previous section), become root and change into the
1.47 reed 3112: relevant directory and run <span><strong class=
3113: "command">make</strong></span>.</p>
3114:
3115: <div class="note" style=
3116: "margin-left: 0.5in; margin-right: 0.5in;">
3117: <h3 class="title">Note</h3>
3118:
3119: <p>If using bootstrap or pkgsrc on a non-NetBSD
3120: system, use the pkgsrc <span><strong class=
3121: "command">bmake</strong></span> command instead of
3122: “<span class="quote">make</span>” in the
3123: examples in this guide.</p>
3124: </div>
3125:
3126: <p>For example, type</p>
1.1 grant 3127: <pre class="screen">
1.14 xtraeme 3128: <code class="prompt">%</code> <strong class=
3129: "userinput"><code>cd misc/figlet</code></strong>
3130: <code class="prompt">%</code> <strong class=
3131: "userinput"><code>make</code></strong>
1.1 grant 3132: </pre>
3133:
3134: <p>at the shell prompt to build the various components
3135: of the package, and</p>
3136: <pre class="screen">
1.14 xtraeme 3137: <code class="prompt">#</code> <strong class=
3138: "userinput"><code>make install</code></strong>
1.1 grant 3139: </pre>
3140:
3141: <p>to install the various components into the correct
3142: places on your system. Installing the package on your
3143: system requires you to be root. However, pkgsrc has a
3144: <span class="emphasis"><em>just-in-time-su</em></span>
3145: feature, which allows you to only become root for the
3146: actual installation step</p>
3147:
3148: <p>Taking the figlet utility as an example, we can
3149: install it on our system by building as shown in
3150: <a href="#logs" title=
1.52 ! tv 3151: "Appendix B. Build logs">Appendix B,
! 3152: <i>Build logs</i></a>.</p>
1.1 grant 3153:
3154: <p>The program is installed under the default root of
1.45 wiz 3155: the packages tree - <code xmlns=
3156: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3157: "filename">/usr/pkg</code>. Should this not conform to
3158: your tastes, set the <code class=
3159: "varname">LOCALBASE</code> variable in your
1.1 grant 3160: environment, and it will use that value as the root of
1.45 wiz 3161: your packages tree. So, to use <code xmlns=
3162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3163: "filename">/usr/local</code>, set <code class=
3164: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3165: environment. Please note that you should use a
3166: directory which is dedicated to packages and not shared
1.47 reed 3167: with other programs (i.e., do not try and use
1.14 xtraeme 3168: <code class="varname">LOCALBASE=/usr</code>). Also, you
3169: should not try to add any of your own files or
1.45 wiz 3170: directories (such as <code xmlns=
3171: "http://www.w3.org/TR/xhtml1/transitional" class=
3172: "filename">src/</code>, <code xmlns=
3173: "http://www.w3.org/TR/xhtml1/transitional" class=
3174: "filename">obj/</code>, or <code xmlns=
3175: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3176: "filename">pkgsrc/</code>) below the <code class=
3177: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3178: possible conflicts between programs and other files
3179: installed by the package system and whatever else may
3180: have been installed there.</p>
3181:
1.45 wiz 3182: <p>Some packages look in <code xmlns=
3183: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3184: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3185: configuration options at build time. Have a look at
1.45 wiz 3186: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3187: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3188: get an overview of what will be set there by default.
1.14 xtraeme 3189: Environment variables such as <code class=
1.45 wiz 3190: "varname">LOCALBASE</code> can be set in <code xmlns=
3191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3192: "filename">/etc/mk.conf</code> to save having to
3193: remember to set them each time you want to use
3194: pkgsrc.</p>
1.1 grant 3195:
3196: <p>Occasionally, people want to “<span class=
3197: "quote">look under the covers</span>” to see what
3198: is going on when a package is building or being
3199: installed. This may be for debugging purposes, or out
3200: of simple curiosity. A number of utility values have
3201: been added to help with this.</p>
3202:
3203: <div class="orderedlist">
3204: <ol type="1">
3205: <li>
3206: <p>If you invoke the <a href=
3207: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3208: <span class="citerefentry"><span class=
3209: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3210: with <code class=
3211: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3212: amount of information will be displayed. For
3213: example,</p>
1.1 grant 3214: <pre class="screen">
1.14 xtraeme 3215: <strong class=
3216: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3217: </pre>
3218:
3219: <p>will show all the commands that are invoked,
3220: up to and including the “<span class=
3221: "quote">patch</span>” stage.</p>
3222: </li>
3223:
3224: <li>
3225: <p>If you want to know the value of a certain
1.22 tv 3226: <a href=
3227: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3228: <span class="citerefentry"><span class=
3229: "refentrytitle">make</span>(1)</span></a>
3230: definition, then the <code class=
1.14 xtraeme 3231: "varname">VARNAME</code> definition should be
3232: used, in conjunction with the show-var target.
3233: e.g. to show the expansion of the <a href=
1.1 grant 3234: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3235: <span class="citerefentry"><span class=
3236: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3237: variable <code class=
1.22 tv 3238: "varname">LOCALBASE</code>:</p>
1.1 grant 3239: <pre class="screen">
1.14 xtraeme 3240: <code class="prompt">%</code> <strong class=
3241: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3242: /usr/pkg
1.14 xtraeme 3243: <code class="prompt">%</code>
1.1 grant 3244:
3245: </pre>
3246: </li>
3247: </ol>
3248: </div>
3249:
3250: <p>If you want to install a binary package that you've
3251: either created yourself (see next section), that you
3252: put into pkgsrc/packages manually or that is located on
1.8 wiz 3253: a remote FTP server, you can use the "bin-install"
1.1 grant 3254: target. This target will install a binary package - if
3255: available - via <a href=
3256: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3257: <span class="citerefentry"><span class=
3258: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3259: <span><strong class="command">make
3260: package</strong></span>. The list of remote FTP sites
3261: searched is kept in the variable <code class=
3262: "varname">BINPKG_SITES</code>, which defaults to
3263: ftp.NetBSD.org. Any flags that should be added to
3264: <a href=
1.1 grant 3265: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3266: <span class="citerefentry"><span class=
3267: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3268: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3269: See <code xmlns=
3270: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3271: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3272: details.</p>
1.1 grant 3273:
1.47 reed 3274: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3275: has a non-standard setting for <code class=
3276: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3277: any packages are installed, as you can not use several
3278: directories for the same purpose. Doing so will result
3279: in pkgsrc not being able to properly detect your
3280: installed packages, and fail miserably. Note also that
3281: precompiled binary packages are usually built with the
1.14 xtraeme 3282: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3283: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3284: class="filename">/usr/pkg</code>, and that you should
3285: <span class="emphasis"><em>not</em></span> install any
3286: if you use a non-standard <code class=
1.14 xtraeme 3287: "varname">LOCALBASE</code>.</p>
1.1 grant 3288: </div>
3289:
1.52 ! tv 3290: <div class="sect2" lang="en">
1.1 grant 3291: <div class="titlepage">
3292: <div>
3293: <div>
1.30 wiz 3294: <h3 class="title"><a name=
3295: "selecting-the-compiler"></a>4.2.4. Selecting
3296: the compiler</h3>
1.1 grant 3297: </div>
3298: </div>
3299: </div>
3300:
3301: <p>By default, pkgsrc will use GCC to build packages.
3302: This may be overridden by setting the following
3303: variables in /etc/mk.conf:</p>
3304:
3305: <div class="variablelist">
3306: <dl>
1.14 xtraeme 3307: <dt><span class="term"><code class=
3308: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3309:
3310: <dd>
3311: <p>This is a list of values specifying the chain
3312: of compilers to invoke when building packages.
3313: Valid values are:</p>
3314:
3315: <div class="itemizedlist">
3316: <ul type="disc">
3317: <li>
1.14 xtraeme 3318: <p><code class="varname">distcc</code>:
1.1 grant 3319: distributed C/C++ (chainable)</p>
3320: </li>
3321:
3322: <li>
1.14 xtraeme 3323: <p><code class="varname">ccache</code>:
1.1 grant 3324: compiler cache (chainable)</p>
3325: </li>
3326:
3327: <li>
1.14 xtraeme 3328: <p><code class="varname">gcc</code>: GNU
3329: C/C++ Compiler</p>
1.1 grant 3330: </li>
3331:
3332: <li>
1.14 xtraeme 3333: <p><code class="varname">mipspro</code>:
1.1 grant 3334: Silicon Graphics, Inc. MIPSpro
3335: (n32/n64)</p>
3336: </li>
3337:
3338: <li>
1.14 xtraeme 3339: <p><code class="varname">mipspro</code>:
1.1 grant 3340: Silicon Graphics, Inc. MIPSpro (o32)</p>
3341: </li>
3342:
3343: <li>
1.14 xtraeme 3344: <p><code class="varname">sunpro</code>:
1.1 grant 3345: Microsystems, Inc. WorkShip/Forte/Sun ONE
3346: Studio</p>
3347: </li>
3348: </ul>
3349: </div>
3350:
3351: <p>The default is “<span class=
1.14 xtraeme 3352: "quote"><code class=
3353: "varname">gcc</code></span>”. You can use
3354: <code class="varname">ccache</code> and/or
3355: <code class="varname">distcc</code> with an
3356: appropriate <code class=
3357: "varname">PKGSRC_COMPILER</code> setting, e.g.
3358: “<span class="quote"><code class=
3359: "varname">ccache gcc</code></span>”. This
1.1 grant 3360: variable should always be terminated with a value
3361: for a real compiler.</p>
3362: </dd>
3363:
1.14 xtraeme 3364: <dt><span class="term"><code class=
3365: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3366:
3367: <dd>
3368: <p>This specifies the minimum version of GCC to
3369: use when building packages. If the system GCC
3370: doesn't satisfy this requirement, then pkgsrc
3371: will build and install one of the GCC packages to
3372: use instead.</p>
3373: </dd>
3374: </dl>
3375: </div>
3376: </div>
3377: </div>
3378: </div>
3379:
1.52 ! tv 3380: <div class="chapter" lang="en">
1.1 grant 3381: <div class="titlepage">
3382: <div>
3383: <div>
1.52 ! tv 3384: <h2 class="title"><a name=
1.38 dillo 3385: "configuring"></a>Chapter 5. Configuring
3386: pkgsrc</h2>
3387: </div>
3388: </div>
3389: </div>
3390:
3391: <div class="toc">
3392: <p><b>Table of Contents</b></p>
3393:
3394: <dl>
3395: <dt><span class="sect1"><a href=
1.45 wiz 3396: "#general-configuration">5.1. General
3397: configuration</a></span></dt>
3398:
3399: <dt><span class="sect1"><a href=
3400: "#variables-affecting-build">5.2. Variables affecting
3401: the build process</a></span></dt>
3402:
3403: <dt><span class="sect1"><a href=
3404: "#developer-advanced-settings">5.3. Developer/advanced
3405: settings</a></span></dt>
3406:
3407: <dt><span class="sect1"><a href=
3408: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3409: Options</a></span></dt>
1.38 dillo 3410: </dl>
3411: </div>
3412:
1.52 ! tv 3413: <div class="sect1" lang="en">
1.38 dillo 3414: <div class="titlepage">
3415: <div>
3416: <div>
3417: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3418: "general-configuration"></a>5.1. General
3419: configuration</h2>
3420: </div>
3421: </div>
3422: </div>
3423:
1.47 reed 3424: <p>In this section, you can find some variables that
3425: apply to all pkgsrc packages. The preferred method of
3426: setting these variables is by setting them in
3427: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3428: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3429:
3430: <div class="itemizedlist">
3431: <ul type="disc">
3432: <li>
3433: <p><code class="varname">LOCALBASE</code>: Where
3434: packages will be installed. The default is
3435: <code xmlns=
3436: "http://www.w3.org/TR/xhtml1/transitional" class=
3437: "filename">/usr/pkg</code>. Do not mix binary
3438: packages with different <code class=
3439: "varname">LOCALBASE</code>s!</p>
3440: </li>
3441:
3442: <li>
3443: <p><code class="varname">CROSSBASE</code>: Where
3444: “<span class="quote">cross</span>”
3445: category packages will be installed. The default is
3446: <code xmlns=
3447: "http://www.w3.org/TR/xhtml1/transitional" class=
3448: "filename">${LOCALBASE}/cross</code>.</p>
3449: </li>
3450:
3451: <li>
3452: <p><code class="varname">X11BASE</code>: Where X11
3453: is installed on the system. The default is
3454: <code xmlns=
3455: "http://www.w3.org/TR/xhtml1/transitional" class=
3456: "filename">/usr/X11R6</code>.</p>
3457: </li>
3458:
3459: <li>
3460: <p><code class="varname">DISTDIR</code>: Where to
3461: store the downloaded copies of the original source
3462: distributions used for building pkgsrc packages.
3463: The default is <code xmlns=
3464: "http://www.w3.org/TR/xhtml1/transitional" class=
3465: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3466: </li>
3467:
3468: <li>
3469: <p><code class=
3470: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3471: override the packages' <code class=
3472: "varname">MASTER_SITES</code> with this value.</p>
3473: </li>
3474:
3475: <li>
3476: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3477: Backup location(s) for distribution files and patch
3478: files if not found locally or in <code xmlns=
3479: "http://www.w3.org/TR/xhtml1/transitional" class=
3480: "filename">${MASTER_SITES}</code> or <code xmlns=
3481: "http://www.w3.org/TR/xhtml1/transitional" class=
3482: "filename">${PATCH_SITES}</code> respectively. The
3483: defaults are <code xmlns=
3484: "http://www.w3.org/TR/xhtml1/transitional" class=
3485: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3486: and <code xmlns=
3487: "http://www.w3.org/TR/xhtml1/transitional" class=
3488: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3489: </li>
3490:
3491: <li>
3492: <p><code class="varname">BINPKG_SITES</code>: List
3493: of sites carrying binary pkgs.</p>
3494: </li>
3495: </ul>
3496: </div>
3497: </div>
3498:
1.52 ! tv 3499: <div class="sect1" lang="en">
1.45 wiz 3500: <div class="titlepage">
3501: <div>
3502: <div>
3503: <h2 class="title" style="clear: both"><a name=
3504: "variables-affecting-build"></a>5.2. Variables
3505: affecting the build process</h2>
3506: </div>
3507: </div>
3508: </div>
3509:
3510: <p>XXX</p>
3511:
3512: <div class="itemizedlist">
3513: <ul type="disc">
3514: <li>
3515: <p><code class="varname">PACKAGES</code>: The top
3516: level directory for the binary packages. The
3517: default is <code xmlns=
3518: "http://www.w3.org/TR/xhtml1/transitional" class=
3519: "filename">${PKGSRCDIR}/packages</code>.</p>
3520: </li>
3521:
3522: <li>
3523: <p><code class="varname">WRKOBJDIR</code>: The top
3524: level directory where, if defined, the separate
3525: working directories will get created, and
3526: symbolically linked to from <code xmlns=
3527: "http://www.w3.org/TR/xhtml1/transitional" class=
3528: "filename">${WRKDIR}</code> (see below). This is
3529: useful for building packages on several
3530: architectures, then <code xmlns=
3531: "http://www.w3.org/TR/xhtml1/transitional" class=
3532: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3533: while <code xmlns=
3534: "http://www.w3.org/TR/xhtml1/transitional" class=
3535: "filename">${WRKOBJDIR}</code> is local to every
3536: architecture. (It should be noted that <code class=
3537: "varname">PKGSRCDIR</code> should not be set by the
3538: user — it is an internal definition which
3539: refers to the root of the pkgsrc tree. It is
3540: possible to have many pkgsrc tree instances.)</p>
3541: </li>
3542:
3543: <li>
3544: <p><code class="varname">LOCALPATCHES</code>:
3545: Directory for local patches that aren't part of
3546: pkgsrc. See <a href="#components.patches" title=
3547: "8.3. patches/*">Section 8.3,
3548: “patches/*”</a> for more information.
3549: <em class="replaceable"><code>rel</code></em> and
3550: <em class="replaceable"><code>arch</code></em> are
3551: replaced with OS release (“<span class=
3552: "quote">2.0</span>”, etc.) and architecture
3553: (“<span class="quote">mipsel</span>”,
3554: etc.).</p>
3555: </li>
3556:
3557: <li>
3558: <p><code class="varname">PKGMAKECONF</code>:
3559: Location of the <code xmlns=
3560: "http://www.w3.org/TR/xhtml1/transitional" class=
3561: "filename">mk.conf</code> file used by a package's
3562: BSD-style Makefile. If this is not set,
3563: <code class="varname">MAKECONF</code> is set to
3564: <code xmlns=
3565: "http://www.w3.org/TR/xhtml1/transitional" class=
3566: "filename">/dev/null</code> to avoid picking up
3567: settings used by builds in <code xmlns=
3568: "http://www.w3.org/TR/xhtml1/transitional" class=
3569: "filename">/usr/src</code>.</p>
3570: </li>
3571: </ul>
3572: </div>
3573: </div>
3574:
1.52 ! tv 3575: <div class="sect1" lang="en">
1.45 wiz 3576: <div class="titlepage">
3577: <div>
3578: <div>
3579: <h2 class="title" style="clear: both"><a name=
3580: "developer-advanced-settings"></a>5.3. Developer/advanced
3581: settings</h2>
3582: </div>
3583: </div>
3584: </div>
3585:
3586: <p>XXX</p>
3587:
3588: <div class="itemizedlist">
3589: <ul type="disc">
3590: <li>
3591: <p><code class="varname">PKG_DEVELOPER</code>: Run
3592: some sanity checks that package developers
3593: want:</p>
3594:
3595: <div class="itemizedlist">
3596: <ul type="circle">
3597: <li>
3598: <p>make sure patches apply with zero fuzz</p>
3599: </li>
3600:
3601: <li>
3602: <p>run check-shlibs to see that all binaries
3603: will find their shared libs.</p>
3604: </li>
3605: </ul>
3606: </div>
3607: </li>
3608:
3609: <li>
3610: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3611: The level of debugging output which is displayed
3612: whilst making and installing the package. The
3613: default value for this is 0, which will not display
3614: the commands as they are executed (normal, default,
3615: quiet operation); the value 1 will display all
3616: shell commands before their invocation, and the
3617: value 2 will display both the shell commands before
3618: their invocation, and their actual execution
3619: progress with <span><strong class="command">set
3620: -x</strong></span> will be displayed.</p>
3621: </li>
3622: </ul>
3623: </div>
3624: </div>
3625:
1.52 ! tv 3626: <div class="sect1" lang="en">
1.45 wiz 3627: <div class="titlepage">
3628: <div>
3629: <div>
3630: <h2 class="title" style="clear: both"><a name=
3631: "selecting-build-options"></a>5.4. Selecting
3632: Build Options</h2>
1.38 dillo 3633: </div>
3634: </div>
3635: </div>
3636:
3637: <p>Some packages have build time options, usually to
3638: select between different dependencies, enable optional
3639: support for big dependencies or enable experimental
3640: features.</p>
3641:
3642: <p>To see which options, if any, a package supports, and
3643: which options are mutually exclusive, run
3644: <span><strong class="command">make
3645: show-options</strong></span>, for example:</p>
3646: <pre class="programlisting">
1.51 rillig 3647: The following options are supported by this package:
3648: ssl Enable SSL support.
3649: Exactly one of the following gecko options is required:
3650: firefox Use firefox as gecko rendering engine.
3651: mozilla Use mozilla as gecko rendering engine.
3652: At most one of the following database options may be selected:
3653: mysql Enable support for MySQL database.
3654: pgsql Enable support for PostgreSQL database.
3655:
3656: These options are enabled by default: firefox
3657: These options are currently enabled: mozilla ssl
1.38 dillo 3658: </pre>
3659:
1.45 wiz 3660: <p>The following variables can be defined in <code xmlns=
3661: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3662: "filename">/etc/mk.conf</code> to select which options to
3663: enable for a package: <code class=
3664: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3665: to select or disable options for all packages that
3666: support them, and <code class=
3667: "varname">PKG_OPTIONS.<em class=
3668: "replaceable"><code>pkgbase</code></em></code>, which can
3669: be used to select or disable options specifically for
3670: package <em class=
3671: "replaceable"><code>pkgbase</code></em>. Options listed
3672: in these variables are selected, options preceded by
3673: “<span class="quote">-</span>” are
3674: disabled.</p>
3675:
1.39 dillo 3676: <p>The following settings are consulted in the order
3677: given, and the last setting that selects or disables an
3678: option is used:</p>
1.38 dillo 3679:
3680: <div class="orderedlist">
3681: <ol type="1">
3682: <li>
3683: <p>the default options as suggested by the package
3684: maintainer</p>
3685: </li>
3686:
3687: <li>
3688: <p>the options implied by the settings of legacy
3689: variables (see below)</p>
3690: </li>
3691:
3692: <li>
3693: <p><code class=
3694: "varname">PKG_DEFAULT_OPTIONS</code></p>
3695: </li>
3696:
3697: <li>
3698: <p><code class="varname">PKG_OPTIONS.<em class=
3699: "replaceable"><code>pkgbase</code></em></code></p>
3700: </li>
3701: </ol>
3702: </div>
3703:
3704: <p>For groups of mutually exclusive options, the last
3705: option selected is used, all others are automatically
3706: disabled. If an option of the group is explicitly
3707: disabled, the previously selected option, if any, is
3708: used. It is an error if no option from a required group
3709: of options is selected, and building the package will
3710: fail.</p>
3711:
3712: <p>Before the options framework was introduced, build
3713: options were selected by setting a variable in
1.45 wiz 3714: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3715: class="filename">/etc/mk.conf</code> for each option. To
3716: ease transition to the options framework for the user,
3717: these legacy variables are converted to the appropriate
3718: options setting automatically. A warning is issued to
3719: prompt the user to update <code xmlns=
3720: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3721: "filename">/etc/mk.conf</code> to use the options
3722: framework directly. Support for these legacy variables
3723: will be removed eventually.</p>
3724: </div>
3725: </div>
3726:
1.52 ! tv 3727: <div class="chapter" lang="en">
1.38 dillo 3728: <div class="titlepage">
3729: <div>
3730: <div>
1.52 ! tv 3731: <h2 class="title"><a name=
1.38 dillo 3732: "binary"></a>Chapter 6. Creating binary
1.1 grant 3733: packages</h2>
3734: </div>
3735: </div>
3736: </div>
3737:
3738: <div class="toc">
3739: <p><b>Table of Contents</b></p>
3740:
3741: <dl>
1.30 wiz 3742: <dt><span class="sect1"><a href=
1.38 dillo 3743: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3744: single binary package</a></span></dt>
1.1 grant 3745:
1.30 wiz 3746: <dt><span class="sect1"><a href=
1.38 dillo 3747: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3748: Settings for creation of binary
3749: packages</a></span></dt>
3750:
1.38 dillo 3751: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3752: a bulk build of all packages</a></span></dt>
3753:
3754: <dd>
3755: <dl>
3756: <dt><span class="sect2"><a href=
1.38 dillo 3757: "#binary.configuration">6.3.1.
1.1 grant 3758: Configuration</a></span></dt>
3759:
1.30 wiz 3760: <dt><span class="sect2"><a href=
1.38 dillo 3761: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3762: environmental considerations</a></span></dt>
1.1 grant 3763:
1.38 dillo 3764: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3765: Operation</a></span></dt>
3766:
1.30 wiz 3767: <dt><span class="sect2"><a href=
1.38 dillo 3768: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3769:
1.30 wiz 3770: <dt><span class="sect2"><a href=
1.38 dillo 3771: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3772: requirements</a></span></dt>
1.1 grant 3773:
1.30 wiz 3774: <dt><span class="sect2"><a href=
1.38 dillo 3775: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3776: for chrooted builds</a></span></dt>
1.1 grant 3777:
1.30 wiz 3778: <dt><span class="sect2"><a href=
1.38 dillo 3779: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3780: set of packages</a></span></dt>
1.13 hubertf 3781:
3782: <dt><span class="sect2"><a href=
1.38 dillo 3783: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3784: build</a></span></dt>
1.1 grant 3785: </dl>
3786: </dd>
3787:
1.38 dillo 3788: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3789: Creating a multiple CD-ROM packages
3790: collection</a></span></dt>
3791:
3792: <dd>
3793: <dl>
1.30 wiz 3794: <dt><span class="sect2"><a href=
1.38 dillo 3795: "#cdpack-example">6.4.1. Example of
1.30 wiz 3796: cdpack</a></span></dt>
1.1 grant 3797: </dl>
3798: </dd>
3799: </dl>
3800: </div>
3801:
1.52 ! tv 3802: <div class="sect1" lang="en">
1.1 grant 3803: <div class="titlepage">
3804: <div>
3805: <div>
3806: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3807: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3808: a single binary package</h2>
1.1 grant 3809: </div>
3810: </div>
3811: </div>
3812:
3813: <p>Once you have built and installed a package, you can
3814: create a <span class="emphasis"><em>binary
3815: package</em></span> which can be installed on another
3816: system with <a href=
3817: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3818: <span class="citerefentry"><span class=
1.47 reed 3819: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3820: having to build the same package on a group of hosts and
3821: wasting CPU time. It also provides a simple means for
3822: others to install your package, should you distribute
3823: it.</p>
3824:
3825: <p>To create a binary package, change into the
1.14 xtraeme 3826: appropriate directory in pkgsrc, and run
3827: <span><strong class="command">make
3828: package</strong></span>:</p>
1.1 grant 3829: <pre class="screen">
1.14 xtraeme 3830: <code class="prompt">#</code> <strong class=
3831: "userinput"><code>cd misc/figlet</code></strong>
3832: <code class="prompt">#</code> <strong class=
3833: "userinput"><code>make package</code></strong>
1.1 grant 3834: </pre>
3835:
3836: <p>This will build and install your package (if not
3837: already done), and then build a binary package from what
1.14 xtraeme 3838: was installed. You can then use the <span><strong class=
3839: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 3840: Binary packages are created by default in <code xmlns=
3841: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3842: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 3843: gzipped tar file. See <a href="#logs.package" title=
1.52 ! tv 3844: "B.2. Packaging figlet">Section B.2,
1.1 grant 3845: “Packaging figlet”</a> for a continuation of
3846: the above <a xmlns=
3847: "http://www.w3.org/TR/xhtml1/transitional" href=
3848: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 3849: target="_top"><code xmlns="" class=
3850: "filename">misc/figlet</code></a> example.</p>
1.1 grant 3851:
3852: <p>See <a href="#submit" title=
1.52 ! tv 3853: "Chapter 17. Submitting and Committing">Chapter 17,
! 3854: <i>Submitting and Committing</i></a> for information on
! 3855: how to submit such a binary package.</p>
1.1 grant 3856: </div>
3857:
1.52 ! tv 3858: <div class="sect1" lang="en">
1.1 grant 3859: <div class="titlepage">
3860: <div>
3861: <div>
3862: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3863: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 3864: for creation of binary packages</h2>
3865: </div>
3866: </div>
3867: </div>
3868:
3869: <p>See <a href="#build.helpful-targets" title=
1.38 dillo 3870: "14.3. Other helpful targets">Section 14.3,
1.1 grant 3871: “Other helpful targets”</a>.</p>
3872: </div>
3873:
1.52 ! tv 3874: <div class="sect1" lang="en">
1.1 grant 3875: <div class="titlepage">
3876: <div>
3877: <div>
3878: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 3879: "bulkbuild"></a>6.3. Doing a bulk build of all
! 3880: packages</h2>
1.1 grant 3881: </div>
3882: </div>
3883: </div>
3884:
3885: <p>If you want to get a full set of precompiled binary
3886: packages, this section describes how to get them. Beware
3887: that the bulk build will remove all currently installed
1.23 wiz 3888: packages from your system! Having an FTP server
3889: configured either on the machine doing the bulk builds or
3890: on a nearby NFS server can help to make the packages
3891: available to everyone. See <a href=
1.1 grant 3892: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
3893: <span class="citerefentry"><span class=
3894: "refentrytitle">ftpd</span>(8)</span></a> for more
3895: information. If you use a remote NFS server's storage, be
3896: sure to not actually compile on NFS storage, as this
3897: slows things down a lot.</p>
3898:
1.52 ! tv 3899: <div class="sect2" lang="en">
1.1 grant 3900: <div class="titlepage">
3901: <div>
3902: <div>
1.52 ! tv 3903: <h3 class="title"><a name=
1.38 dillo 3904: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 3905: </div>
3906: </div>
3907: </div>
3908:
1.52 ! tv 3909: <div class="sect3" lang="en">
1.1 grant 3910: <div class="titlepage">
3911: <div>
3912: <div>
1.52 ! tv 3913: <h4 class="title"><a name=
1.38 dillo 3914: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 3915: </div>
3916: </div>
3917: </div>
3918:
1.45 wiz 3919: <p>You may want to set variables in <code xmlns=
3920: "http://www.w3.org/TR/xhtml1/transitional" class=
3921: "filename">/etc/mk.conf</code>. Look at <code xmlns=
3922: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3923: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 3924: details of the default settings. You will want to
1.14 xtraeme 3925: ensure that <code class=
3926: "varname">ACCEPTABLE_LICENSES</code> meet your local
3927: policy. As used in this example, <code class=
3928: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 3929: "emphasis"><em>all</em></span> licenses.</p>
3930: <pre class="programlisting">
1.51 rillig 3931: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
3932: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
3933: BSDSRCDIR= /usr/src
3934: BSDXSRCDIR= /usr/xsrc # for x11/xservers
3935: OBJHOSTNAME?= yes # use work.`hostname`
3936: FAILOVER_FETCH= yes # insist on the correct checksum
3937: PKG_DEVELOPER?= yes
3938: _ACCEPTABLE= yes
1.1 grant 3939: </pre>
3940: </div>
3941:
1.52 ! tv 3942: <div class="sect3" lang="en">
1.1 grant 3943: <div class="titlepage">
3944: <div>
3945: <div>
1.52 ! tv 3946: <h4 class="title"><a name=
1.45 wiz 3947: "build.conf"></a>6.3.1.2. <code xmlns=
3948: "http://www.w3.org/TR/xhtml1/transitional"
3949: class="filename">build.conf</code></h4>
1.1 grant 3950: </div>
3951: </div>
3952: </div>
3953:
1.45 wiz 3954: <p>In <code xmlns=
3955: "http://www.w3.org/TR/xhtml1/transitional" class=
3956: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
3957: "http://www.w3.org/TR/xhtml1/transitional" class=
3958: "filename">build.conf-example</code> to <code xmlns=
3959: "http://www.w3.org/TR/xhtml1/transitional" class=
3960: "filename">build.conf</code> and edit it, following
3961: the comments in that file. This is the config file
3962: that determines where log files are generated after
3963: the build, where to mail the build report to, where
3964: your pkgsrc tree is located and the user to which
3965: user to <a href=
1.1 grant 3966: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
3967: <span class="citerefentry"><span class=
1.23 wiz 3968: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 3969: <span><strong class="command">cvs
3970: update</strong></span>.</p>
1.1 grant 3971: </div>
3972:
1.52 ! tv 3973: <div class="sect3" lang="en">
1.1 grant 3974: <div class="titlepage">
3975: <div>
3976: <div>
1.52 ! tv 3977: <h4 class="title"><a name=
1.45 wiz 3978: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3979: class="filename">pre-build.local</code></h4>
1.1 grant 3980: </div>
3981: </div>
3982: </div>
3983:
3984: <p>It is possible to configure the bulk build to
1.47 reed 3985: perform certain site-specific tasks at the end of the
1.45 wiz 3986: pre-build stage. If the file <code xmlns=
3987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3988: "filename">pre-build.local</code> exists in
1.45 wiz 3989: <code xmlns=
3990: "http://www.w3.org/TR/xhtml1/transitional" class=
3991: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
3992: executed (as a <a href=
1.24 wiz 3993: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
3994: <span class="citerefentry"><span class=
3995: "refentrytitle">sh</span>(1)</span></a> script) at
3996: the end of the usual pre-build stage. An example use
1.45 wiz 3997: of <code xmlns=
3998: "http://www.w3.org/TR/xhtml1/transitional" class=
3999: "filename">pre-build.local</code> is to have the
4000: line:</p>
1.1 grant 4001: <pre class="screen">
1.14 xtraeme 4002: <code class="prompt">#</code> <strong class=
4003: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4004: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4005: </pre>
4006:
4007: <p>to prevent the system from trying to build a
4008: particular package which requires nearly 3 GB of disk
4009: space.</p>
4010: </div>
4011: </div>
4012:
1.52 ! tv 4013: <div class="sect2" lang="en">
1.1 grant 4014: <div class="titlepage">
4015: <div>
4016: <div>
1.30 wiz 4017: <h3 class="title"><a name=
1.38 dillo 4018: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4019: environmental considerations</h3>
1.1 grant 4020: </div>
4021: </div>
4022: </div>
4023:
1.45 wiz 4024: <p>As <code xmlns=
4025: "http://www.w3.org/TR/xhtml1/transitional" class=
4026: "filename">/usr/pkg</code> will be completely deleted
4027: at the start of bulk builds, make sure your login shell
4028: is placed somewhere else. Either drop it into
4029: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4030: class="filename">/usr/local/bin</code> (and adjust your
4031: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4032: <a href=
1.1 grant 4033: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4034: <span class="citerefentry"><span class=
4035: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4036: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4037: class="filename">/etc/rc.local</code>, so you can login
4038: after a reboot (remember that your current process
4039: won't die if the package is removed, you just can't
4040: start any new instances of the shell any more). Also,
4041: if you use NetBSD earlier than 1.5, or you still want
4042: to use the pkgsrc version of ssh for some reason, be
4043: sure to install ssh before starting it from
4044: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4045: class="filename">rc.local</code>:</p>
1.1 grant 4046: <pre class="programlisting">
1.51 rillig 4047: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4048: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4049: /usr/pkg/etc/rc.d/sshd
4050: fi
1.1 grant 4051: </pre>
4052:
4053: <p>Not doing so will result in you being not able to
4054: log in via ssh after the bulk build is finished or if
4055: the machine gets rebooted or crashes. You have been
4056: warned! :)</p>
4057: </div>
4058:
1.52 ! tv 4059: <div class="sect2" lang="en">
1.1 grant 4060: <div class="titlepage">
4061: <div>
4062: <div>
1.52 ! tv 4063: <h3 class="title"><a name=
1.38 dillo 4064: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4065: </div>
4066: </div>
4067: </div>
4068:
4069: <p>Make sure you don't need any of the packages still
4070: installed.</p>
4071:
4072: <div class="warning" style=
4073: "margin-left: 0.5in; margin-right: 0.5in;">
4074: <h3 class="title">Warning</h3>
4075:
4076: <p>During the bulk build, <span class=
4077: "emphasis"><em>all packages will be
4078: removed!</em></span></p>
4079: </div>
4080:
4081: <p>Be sure to remove all other things that might
4082: interfere with builds, like some libs installed in
1.45 wiz 4083: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4084: class="filename">/usr/local</code>, etc. then become
4085: root and type:</p>
1.1 grant 4086: <pre class="screen">
1.14 xtraeme 4087: <code class="prompt">#</code> <strong class=
4088: "userinput"><code>cd /usr/pkgsrc</code></strong>
4089: <code class="prompt">#</code> <strong class=
4090: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4091: </pre>
4092:
4093: <p>If for some reason your last build didn't complete
4094: (power failure, system panic, ...), you can continue it
4095: by running:</p>
4096: <pre class="screen">
1.14 xtraeme 4097: <code class="prompt">#</code> <strong class=
4098: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4099: </pre>
4100:
4101: <p>At the end of the bulk build, you will get a summary
4102: via mail, and find build logs in the directory
1.14 xtraeme 4103: specified by <code class="varname">FTP</code> in the
1.45 wiz 4104: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4105: class="filename">build.conf</code> file.</p>
1.1 grant 4106: </div>
4107:
1.52 ! tv 4108: <div class="sect2" lang="en">
1.1 grant 4109: <div class="titlepage">
4110: <div>
4111: <div>
1.52 ! tv 4112: <h3 class="title"><a name=
1.38 dillo 4113: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4114: </div>
4115: </div>
4116: </div>
4117:
4118: <p>The bulk builds consist of three steps:</p>
4119:
4120: <div class="variablelist">
4121: <dl>
4122: <dt><span class="term">1. pre-build</span></dt>
4123:
4124: <dd>
4125: <p>The script updates your pkgsrc tree via
4126: (anon)cvs, then cleans out any broken distfiles,
4127: and removes all packages installed.</p>
4128: </dd>
4129:
4130: <dt><span class="term">2. the bulk
4131: build</span></dt>
4132:
4133: <dd>
4134: <p>This is basically “<span class=
4135: "quote">make bulk-package</span>” with an
4136: optimised order in which packages will be built.
4137: Packages that don't require other packages will
4138: be built first, and packages with many
4139: dependencies will be built later.</p>
4140: </dd>
4141:
4142: <dt><span class="term">3. post-build</span></dt>
4143:
4144: <dd>
4145: <p>Generates a report that's placed in the
1.45 wiz 4146: directory specified in the <code xmlns=
4147: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4148: "filename">build.conf</code> file named
1.45 wiz 4149: <code xmlns=
4150: "http://www.w3.org/TR/xhtml1/transitional" class=
4151: "filename">broken.html</code>, a short version of
4152: that report will also be mailed to the build's
4153: admin.</p>
1.1 grant 4154: </dd>
4155: </dl>
4156: </div>
4157:
4158: <p>During the build, a list of broken packages will be
1.45 wiz 4159: compiled in <code xmlns=
4160: "http://www.w3.org/TR/xhtml1/transitional" class=
4161: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4163: "filename">.../.broken.${MACHINE}</code> if
4164: <code class="varname">OBJMACHINE</code> is set),
4165: individual build logs of broken builds can be found in
4166: the package's directory. These files are used by the
4167: bulk-targets to mark broken builds to not waste time
4168: trying to rebuild them, and they can be used to debug
4169: these broken package builds later.</p>
1.1 grant 4170: </div>
4171:
1.52 ! tv 4172: <div class="sect2" lang="en">
1.1 grant 4173: <div class="titlepage">
4174: <div>
4175: <div>
1.30 wiz 4176: <h3 class="title"><a name=
1.38 dillo 4177: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4178: space requirements</h3>
1.1 grant 4179: </div>
4180: </div>
4181: </div>
4182:
4183: <p>Currently, roughly the following requirements are
4184: valid for NetBSD 2.0/i386:</p>
4185:
4186: <div class="itemizedlist">
4187: <ul type="disc">
4188: <li>
4189: <p>10 GB - distfiles (NFS ok)</p>
4190: </li>
4191:
4192: <li>
4193: <p>8 GB - full set of all binaries (NFS ok)</p>
4194: </li>
4195:
4196: <li>
4197: <p>5 GB - temp space for compiling (local disk
4198: recommended)</p>
4199: </li>
4200: </ul>
4201: </div>
4202:
4203: <p>Note that all pkgs will be de-installed as soon as
4204: they are turned into a binary package, and that sources
4205: are removed, so there is no excessively huge demand to
4206: disk space. Afterwards, if the package is needed again,
4207: it will be installed via <a href=
4208: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4209: <span class="citerefentry"><span class=
4210: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4211: building again, so there are no cycles wasted by
4212: recompiling.</p>
4213: </div>
4214:
1.52 ! tv 4215: <div class="sect2" lang="en">
1.1 grant 4216: <div class="titlepage">
4217: <div>
4218: <div>
1.52 ! tv 4219: <h3 class="title"><a name=
! 4220: "setting-up-a-sandbox"></a>6.3.6. Setting up
! 4221: a sandbox for chrooted builds</h3>
1.1 grant 4222: </div>
4223: </div>
4224: </div>
4225:
1.12 agc 4226: <p>If you don't want all the packages nuked from a
4227: machine (rendering it useless for anything but pkg
1.23 wiz 4228: compiling), there is the possibility of doing the
4229: package bulk build inside a chroot environment.</p>
1.12 agc 4230:
4231: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4232: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4233: class="filename">/usr/sandbox</code>. This can be done
4234: by using null mounts, or manually.</p>
1.12 agc 4235:
1.45 wiz 4236: <p>There is a shell script called <code xmlns=
4237: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4238: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4239: set up the sandbox environment using null mounts. It
1.45 wiz 4240: will also create a script called <code xmlns=
4241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4242: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4243: environment, which will allow the null mounts to be
1.14 xtraeme 4244: activated using the <span><strong class=
4245: "command">sandbox mount</strong></span> command and
4246: deactivated using the <span><strong class=
4247: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4248:
4249: <p>To set up a sandbox environment by hand, after
4250: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4251: doing a <span><strong class="command">make distribution
1.45 wiz 4252: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4253: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4254: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4255: items are present and properly configured:</p>
1.1 grant 4256:
4257: <div class="procedure">
4258: <ol type="1">
4259: <li>
4260: <p>Kernel</p>
4261: <pre class="screen">
1.14 xtraeme 4262: <code class="prompt">#</code> <strong class=
4263: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4264: </pre>
4265: </li>
4266:
4267: <li>
1.45 wiz 4268: <p><code xmlns=
4269: "http://www.w3.org/TR/xhtml1/transitional" class=
4270: "filename">/dev/*</code></p>
1.1 grant 4271: <pre class="screen">
1.14 xtraeme 4272: <code class="prompt">#</code> <strong class=
4273: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4274: </pre>
4275: </li>
4276:
4277: <li>
1.45 wiz 4278: <p><code xmlns=
4279: "http://www.w3.org/TR/xhtml1/transitional" class=
4280: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4281: "http://www.w3.org/TR/xhtml1/transitional" href=
4282: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4283: target="_top"><code xmlns="" class=
4284: "filename">security/smtpd</code></a> and
4285: mail):</p>
1.1 grant 4286: <pre class="screen">
1.14 xtraeme 4287: <code class="prompt">#</code> <strong class=
4288: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4289: </pre>
4290: </li>
4291:
4292: <li>
4293: <p>Working(!) mail config (hostname,
4294: sendmail.cf):</p>
4295: <pre class="screen">
1.14 xtraeme 4296: <code class="prompt">#</code> <strong class=
4297: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4298: </pre>
4299: </li>
4300:
4301: <li>
1.45 wiz 4302: <p><code xmlns=
4303: "http://www.w3.org/TR/xhtml1/transitional" class=
4304: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4305: "http://www.w3.org/TR/xhtml1/transitional" href=
4306: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4307: target="_top"><code xmlns="" class=
4308: "filename">security/smtpd</code></a>):</p>
1.1 grant 4309: <pre class="screen">
1.14 xtraeme 4310: <code class="prompt">#</code> <strong class=
4311: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4312: </pre>
4313: </li>
4314:
4315: <li>
1.45 wiz 4316: <p><code xmlns=
4317: "http://www.w3.org/TR/xhtml1/transitional" class=
4318: "filename">/usr/src</code> (system sources, for
4319: <a xmlns=
1.1 grant 4320: "http://www.w3.org/TR/xhtml1/transitional" href=
4321: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4322: target="_top"><code xmlns="" class=
4323: "filename">sysutils/aperture</code></a>,
4324: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4325: href=
1.20 ben 4326: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4327: target="_top"><code xmlns="" class=
4328: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4329: <pre class="screen">
1.14 xtraeme 4330: <code class="prompt">#</code> <strong class=
4331: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4332: <code class="prompt">#</code> <strong class=
1.23 wiz 4333: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4334: </pre>
4335: </li>
4336:
4337: <li>
1.45 wiz 4338: <p>Create <code xmlns=
4339: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4340: "filename">/var/db/pkg</code> (not part of
4341: default install):</p>
1.1 grant 4342: <pre class="screen">
1.14 xtraeme 4343: <code class="prompt">#</code> <strong class=
4344: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4345: </pre>
4346: </li>
4347:
4348: <li>
1.45 wiz 4349: <p>Create <code xmlns=
4350: "http://www.w3.org/TR/xhtml1/transitional" class=
4351: "filename">/usr/pkg</code> (not part of default
4352: install):</p>
1.1 grant 4353: <pre class="screen">
1.14 xtraeme 4354: <code class="prompt">#</code> <strong class=
4355: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4356: </pre>
4357: </li>
4358:
4359: <li>
1.45 wiz 4360: <p>Checkout pkgsrc via cvs into <code xmlns=
4361: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4362: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4363: <pre class="screen">
1.14 xtraeme 4364: <code class="prompt">#</code> <strong class=
4365: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4366: <code class="prompt">#</code> <strong class=
4367: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4368: </pre>
4369:
4370: <p>Do not mount/link this to the copy of your
4371: pkgsrc tree you do development in, as this will
4372: likely cause problems!</p>
4373: </li>
4374:
4375: <li>
1.45 wiz 4376: <p>Make <code xmlns=
4377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4378: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4379: and <code xmlns=
4380: "http://www.w3.org/TR/xhtml1/transitional" class=
4381: "filename">.../distfiles</code> point somewhere
4382: appropriate. NFS- and/or nullfs-mounts may come
4383: in handy!</p>
1.1 grant 4384: </li>
4385:
4386: <li>
1.45 wiz 4387: <p>Edit <code xmlns=
4388: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4389: "filename">/etc/mk.conf</code>, see <a href=
4390: "#binary.mk.conf" title=
1.38 dillo 4391: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4392: “/etc/mk.conf”</a>.</p>
4393: </li>
4394:
4395: <li>
1.45 wiz 4396: <p>Adjust <code xmlns=
4397: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4398: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4399: needs.</p>
4400: </li>
4401:
4402: <li>
1.14 xtraeme 4403: <p>If you have set <code class=
1.45 wiz 4404: "varname">CVS_USER</code> in <code xmlns=
4405: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4406: "filename">build.conf</code>, make sure that
4407: account exists and can do a <span><strong class=
4408: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4409: properly!</p>
4410: </li>
4411: </ol>
4412: </div>
4413:
1.47 reed 4414: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4415: build with the following steps:</p>
4416: <pre class="screen">
1.14 xtraeme 4417: <code class="prompt">#</code> <strong class=
4418: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4419: <code class="prompt">#</code> <strong class=
4420: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4421: </pre>
4422:
4423: <p>This will just jump inside the sandbox and start
4424: building. At the end of the build, mail will be sent
4425: with the results of the build. Created binary pkgs will
1.45 wiz 4426: be in <code xmlns=
4427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4428: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4429: (wherever that points/mounts to/from).</p>
4430: </div>
4431:
1.52 ! tv 4432: <div class="sect2" lang="en">
1.1 grant 4433: <div class="titlepage">
4434: <div>
4435: <div>
1.30 wiz 4436: <h3 class="title"><a name=
1.38 dillo 4437: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4438: a partial set of packages</h3>
1.1 grant 4439: </div>
4440: </div>
4441: </div>
4442:
4443: <p>In addition to building a complete set of all
1.45 wiz 4444: packages in pkgsrc, the <code xmlns=
4445: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4446: "filename">pkgsrc/mk/bulk/build</code> script may be
4447: used to build a subset of the packages contained in
1.47 reed 4448: pkgsrc. By setting <code class=
1.45 wiz 4449: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4450: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4451: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4452:
4453: <div class="itemizedlist">
4454: <ul type="disc">
4455: <li>
4456: <p>SITE_SPECIFIC_PKGS</p>
4457: </li>
4458:
4459: <li>
4460: <p>HOST_SPECIFIC_PKGS</p>
4461: </li>
4462:
4463: <li>
4464: <p>GROUP_SPECIFIC_PKGS</p>
4465: </li>
4466:
4467: <li>
4468: <p>USER_SPECIFIC_PKGS</p>
4469: </li>
4470: </ul>
4471: </div>
4472:
4473: <p>will define the set of packages which should be
4474: built. The bulk build code will also include any
4475: packages which are needed as dependencies for the
4476: explicitly listed packages.</p>
4477:
4478: <p>One use of this is to do a bulk build with
1.14 xtraeme 4479: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4480: sandbox periodically to have a complete set of the
4481: binary packages needed for your site available without
4482: the overhead of building extra packages that are not
4483: needed.</p>
4484: </div>
1.13 hubertf 4485:
1.52 ! tv 4486: <div class="sect2" lang="en">
1.13 hubertf 4487: <div class="titlepage">
4488: <div>
4489: <div>
1.52 ! tv 4490: <h3 class="title"><a name=
1.38 dillo 4491: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4492: of a bulk build</h3>
4493: </div>
4494: </div>
4495: </div>
4496:
4497: <p>This section describes how pkgsrc developers can
4498: upload binary pkgs built by bulk builds to
4499: ftp.NetBSD.org.</p>
4500:
1.17 sketch 4501: <p>If you would like to automatically create checksum
4502: files for the binary packages you intend to upload,
4503: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4504: in your <code xmlns=
4505: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4506: "filename">mk/bulk/build.conf</code>.</p>
4507:
4508: <p>If you would like to PGP sign the checksum files
4509: (highly recommended!), remember to set <code class=
4510: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4511: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4512: class="filename">mk/bulk/build.conf</code>. This will
4513: prompt you for your GPG password to sign the files
1.17 sketch 4514: before uploading everything.</p>
4515:
4516: <p>Then, make sure that you have <code class=
1.14 xtraeme 4517: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4518: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4519: class="filename">mk/bulk/build.conf</code> file, i.e.
4520: adjust it to something like one of the following:</p>
1.13 hubertf 4521: <pre class="screen">
4522: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4523: </pre>
4524:
1.47 reed 4525: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4526: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4527: ftp.NetBSD.org is different from <code class=
4528: "varname">CVS_USER</code>, write your login directly
4529: into the variable, e.g. my local account is "feyrer",
4530: but for my login "hubertf", I use:</p>
1.13 hubertf 4531: <pre class="screen">
4532: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4533: </pre>
4534:
1.45 wiz 4535: <p>A separate <code xmlns=
4536: "http://www.w3.org/TR/xhtml1/transitional" class=
4537: "filename">upload</code> directory is used here to
4538: allow "closing" the directory during upload. To do so,
4539: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4540: <pre class="screen">
1.14 xtraeme 4541: nbftp% <strong class=
4542: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4543: </pre>
4544:
1.45 wiz 4545: <p>Please note that <code xmlns=
4546: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4547: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4548: appropriate for packages for the NetBSD operating
4549: system. Binary packages for other operating systems
1.45 wiz 4550: should go into <code xmlns=
4551: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4552: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4553:
4554: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4555: needs to be set up. This example shows how to set up
1.13 hubertf 4556: temporary keys for the root account <span class=
4557: "emphasis"><em>inside the sandbox</em></span> (assuming
4558: that no keys should be present there usually):</p>
4559: <pre class="screen">
1.14 xtraeme 4560: <code class="prompt">#</code> <strong class=
4561: "userinput"><code>chroot /usr/sandbox</code></strong>
4562: chroot-<code class="prompt">#</code> <strong class=
4563: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4564: chroot-<code class="prompt">#</code> <strong class=
4565: "userinput"><code>ssh-keygen -t dsa</code></strong>
4566: chroot-<code class="prompt">#</code> <strong class=
4567: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4568: </pre>
4569:
1.45 wiz 4570: <p>Now take the output of <code xmlns=
4571: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4572: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4573: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4574: class="filename">~/.ssh/authorized_keys</code> file on
4575: ftp.NetBSD.org. You can remove the key after the upload
4576: is done!</p>
1.13 hubertf 4577:
4578: <p>Next, test if your ssh connection really works:</p>
4579: <pre class="screen">
1.14 xtraeme 4580: chroot-<code class="prompt">#</code> <strong class=
4581: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4582: </pre>
4583:
4584: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4585:
4586: <p>Now after all this works, you can exit the sandbox
4587: and start the upload:</p>
4588: <pre class="screen">
1.14 xtraeme 4589: chroot-<code class="prompt">#</code> <strong class=
4590: "userinput"><code>exit</code></strong>
4591: <code class="prompt">#</code> <strong class=
4592: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4593: <code class="prompt">#</code> <strong class=
4594: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4595: </pre>
4596:
4597: <p>The upload process may take quite some time. Use
1.24 wiz 4598: <a href=
4599: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4600: <span class="citerefentry"><span class=
4601: "refentrytitle">ls</span>(1)</span></a> or <a href=
4602: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4603: <span class="citerefentry"><span class=
4604: "refentrytitle">du</span>(1)</span></a> on the FTP
4605: server to monitor progress of the upload. The upload
4606: script will take care of not uploading restricted
4607: packages and putting vulnerable packages into the
1.45 wiz 4608: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4609: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4610:
4611: <p>After the upload has ended, first thing is to revoke
4612: ssh access:</p>
4613: <pre class="screen">
1.14 xtraeme 4614: nbftp% <strong class=
4615: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4616: Gdd:x!
4617: </pre>
4618:
4619: <p>Use whatever is needed to remove the key you've
4620: entered before! Last, move the uploaded packages out of
1.45 wiz 4621: the <code xmlns=
4622: "http://www.w3.org/TR/xhtml1/transitional" class=
4623: "filename">upload</code> directory to have them
4624: accessible to everyone:</p>
1.13 hubertf 4625: <pre class="screen">
1.14 xtraeme 4626: nbftp% <strong class=
4627: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4628: nbftp% <strong class=
4629: "userinput"><code>mv upload/* .</code></strong>
4630: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4631: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4632: </pre>
4633: </div>
1.1 grant 4634: </div>
4635:
1.52 ! tv 4636: <div class="sect1" lang="en">
1.1 grant 4637: <div class="titlepage">
4638: <div>
4639: <div>
4640: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4641: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4642: CD-ROM packages collection</h2>
1.1 grant 4643: </div>
4644: </div>
4645: </div>
4646:
4647: <p>After your pkgsrc bulk-build has completed, you may
4648: wish to create a CD-ROM set of the resulting binary
4649: packages to assist in installing packages on other
4650: machines. The <a xmlns=
4651: "http://www.w3.org/TR/xhtml1/transitional" href=
4652: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4653: target="_top"><code xmlns="" class=
4654: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4655: simple tool for creating the ISO 9660 images.
4656: <span><strong class="command">cdpack</strong></span>
4657: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4658: all the dependencies for a given package on the same CD
4659: as that package.</p>
1.1 grant 4660:
1.52 ! tv 4661: <div class="sect2" lang="en">
1.1 grant 4662: <div class="titlepage">
4663: <div>
4664: <div>
1.52 ! tv 4665: <h3 class="title"><a name=
1.38 dillo 4666: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4667: cdpack</h3>
4668: </div>
4669: </div>
4670: </div>
4671:
4672: <p>Complete documentation for cdpack is found in the
1.47 reed 4673: cdpack(1) man page. The following short example assumes
1.45 wiz 4674: that the binary packages are left in <code xmlns=
4675: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4676: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4677: sufficient disk space exists in <code xmlns=
4678: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4679: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4680: <pre class="screen">
1.14 xtraeme 4681: <code class="prompt">#</code> <strong class=
4682: "userinput"><code>mkdir /u2/images</code></strong>
4683: <code class="prompt">#</code> <strong class=
4684: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4685: <code class="prompt">#</code> <strong class=
4686: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4687: </pre>
4688:
4689: <p>If you wish to include a common set of files
1.45 wiz 4690: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4691: class="filename">COPYRIGHT</code>, <code xmlns=
4692: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4693: "filename">README</code>, etc.) on each CD in the
1.1 grant 4694: collection, then you need to create a directory which
4695: contains these files. e.g.</p>
4696: <pre class="screen">
1.14 xtraeme 4697: <code class="prompt">#</code> <strong class=
4698: "userinput"><code>mkdir /tmp/common</code></strong>
4699: <code class="prompt">#</code> <strong class=
4700: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4701: <code class="prompt">#</code> <strong class=
4702: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4703: <code class="prompt">#</code> <strong class=
4704: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4705: <code class="prompt">#</code> <strong class=
4706: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4707: <code class="prompt">#</code> <strong class=
4708: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4709: <code class="prompt">#</code> <strong class=
4710: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4711: </pre>
4712:
4713: <p>Now create the images:</p>
4714: <pre class="screen">
1.14 xtraeme 4715: <code class="prompt">#</code> <strong class=
4716: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4717: </pre>
4718:
1.45 wiz 4719: <p>Each image will contain <code xmlns=
4720: "http://www.w3.org/TR/xhtml1/transitional" class=
4721: "filename">README</code>, <code xmlns=
4722: "http://www.w3.org/TR/xhtml1/transitional" class=
4723: "filename">COPYING</code>, and <code xmlns=
4724: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4725: "filename">bin/myscript</code> in their root
1.1 grant 4726: directories.</p>
4727: </div>
4728: </div>
4729: </div>
4730:
1.52 ! tv 4731: <div class="chapter" lang="en">
1.1 grant 4732: <div class="titlepage">
4733: <div>
4734: <div>
1.52 ! tv 4735: <h2 class="title"><a name=
1.38 dillo 4736: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4737: Questions</h2>
4738: </div>
4739: </div>
4740: </div>
4741:
4742: <div class="toc">
4743: <p><b>Table of Contents</b></p>
4744:
4745: <dl>
1.30 wiz 4746: <dt><span class="sect1"><a href=
1.38 dillo 4747: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4748: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4749:
1.38 dillo 4750: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4751: Where's the pkgviews documentation?</a></span></dt>
4752:
1.38 dillo 4753: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4754: Utilities for package management
4755: (pkgtools)</a></span></dt>
4756:
1.38 dillo 4757: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4758: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4759:
1.30 wiz 4760: <dt><span class="sect1"><a href=
1.38 dillo 4761: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4762: fetching distfiles?</a></span></dt>
1.14 xtraeme 4763:
1.30 wiz 4764: <dt><span class="sect1"><a href=
1.38 dillo 4765: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4766: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4767:
1.30 wiz 4768: <dt><span class="sect1"><a href=
1.38 dillo 4769: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4770: from pkgsrc?</a></span></dt>
1.1 grant 4771:
1.30 wiz 4772: <dt><span class="sect1"><a href=
1.38 dillo 4773: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4774: behind a firewall</a></span></dt>
1.1 grant 4775:
1.38 dillo 4776: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4777: do I tell <span><strong class="command">make
4778: fetch</strong></span> to do passive
4779: FTP?</a></span></dt>
1.1 grant 4780:
1.30 wiz 4781: <dt><span class="sect1"><a href=
1.38 dillo 4782: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4783: distfiles at once</a></span></dt>
1.1 grant 4784:
1.30 wiz 4785: <dt><span class="sect1"><a href=
1.38 dillo 4786: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4787: “<span class="quote">Don't know how to make
1.14 xtraeme 4788: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4789: mean?</a></span></dt>
4790:
1.30 wiz 4791: <dt><span class="sect1"><a href=
1.38 dillo 4792: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4793: “<span class="quote">Could not find
1.14 xtraeme 4794: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4795:
1.30 wiz 4796: <dt><span class="sect1"><a href=
1.38 dillo 4797: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4798: pkgsrc</a></span></dt>
1.1 grant 4799:
1.38 dillo 4800: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4801: do I change the location of configuration
4802: files?</a></span></dt>
1.1 grant 4803:
1.38 dillo 4804: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4805: Automated security checks</a></span></dt>
4806: </dl>
4807: </div>
4808:
4809: <p>This section contains hints, tips & tricks on
4810: special things in pkgsrc that we didn't find a better place
4811: for in the previous chapters, and it contains items for
4812: both pkgsrc users and developers.</p>
4813:
1.52 ! tv 4814: <div class="sect1" lang="en">
1.1 grant 4815: <div class="titlepage">
4816: <div>
4817: <div>
4818: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4819: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 4820: mailing lists for pkg-related discussion?</h2>
1.1 grant 4821: </div>
4822: </div>
4823: </div>
4824:
1.18 xtraeme 4825: <p>The following mailing lists may be of interest to
4826: pkgsrc users:</p>
4827:
4828: <div class="itemizedlist">
4829: <ul type="disc">
4830: <li>
4831: <p><a href=
4832: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 4833: target="_top">pkgsrc-bugs</a>: A list where problem
4834: reports related to pkgsrc are sent and
4835: discussed.</p>
1.18 xtraeme 4836: </li>
4837:
4838: <li>
4839: <p><a href=
4840: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 4841: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 4842: results of pkgsrc bulk builds are sent and
1.34 wiz 4843: discussed.</p>
1.18 xtraeme 4844: </li>
4845:
4846: <li>
4847: <p><a href=
4848: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 4849: target="_top">pkgsrc-changes</a>: A list where all
4850: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 4851: </li>
4852:
4853: <li>
4854: <p><a href=
4855: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 4856: target="_top">tech-pkg</a>: A general discussion
4857: list for all things related to pkgsrc.</p>
1.18 xtraeme 4858: </li>
4859: </ul>
4860: </div>
4861:
4862: <p>To subscribe, do:</p>
1.1 grant 4863: <pre class="programlisting">
1.51 rillig 4864: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 4865: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 4866: </pre>
4867:
1.18 xtraeme 4868: <p>Archives for all these mailing lists are available
4869: from <a href="http://mail-index.NetBSD.org/" target=
4870: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 4871: </div>
4872:
1.52 ! tv 4873: <div class="sect1" lang="en">
1.1 grant 4874: <div class="titlepage">
4875: <div>
4876: <div>
4877: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4878: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 4879: documentation?</h2>
1.1 grant 4880: </div>
4881: </div>
4882: </div>
4883:
4884: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 4885: find a pkgviews User's guide in <code xmlns=
4886: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4887: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 4888: </div>
4889:
1.52 ! tv 4890: <div class="sect1" lang="en">
1.1 grant 4891: <div class="titlepage">
4892: <div>
4893: <div>
4894: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4895: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 4896: management (pkgtools)</h2>
1.1 grant 4897: </div>
4898: </div>
4899: </div>
4900:
1.45 wiz 4901: <p>The <code xmlns=
4902: "http://www.w3.org/TR/xhtml1/transitional" class=
4903: "filename">pkgsrc/pkgtools</code> directory pkgtools
4904: contains a number of useful utilities for both users and
4905: developers of pkgsrc. This section attempts only to make
4906: the reader aware of the utilities and when they might be
4907: useful, and not to duplicate the documentation that comes
4908: with each package.</p>
1.1 grant 4909:
4910: <p>Utilities used by pkgsrc (automatically installed when
4911: needed):</p>
4912:
4913: <div class="itemizedlist">
4914: <ul type="disc">
4915: <li>
4916: <p><a xmlns=
4917: "http://www.w3.org/TR/xhtml1/transitional" href=
4918: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 4919: target="_top"><code xmlns="" class=
4920: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 4921: for use by buildlink.</p>
1.1 grant 4922: </li>
4923: </ul>
4924: </div>
4925:
4926: <p>OS tool augmentation (automatically installed when
4927: needed):</p>
4928:
4929: <div class="itemizedlist">
4930: <ul type="disc">
4931: <li>
4932: <p><a xmlns=
4933: "http://www.w3.org/TR/xhtml1/transitional" href=
4934: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 4935: target="_top"><code xmlns="" class=
4936: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 4937: various kinds of checksums (including SHA1).</p>
1.1 grant 4938: </li>
4939:
4940: <li>
4941: <p><a xmlns=
4942: "http://www.w3.org/TR/xhtml1/transitional" href=
4943: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 4944: target="_top"><code xmlns="" class=
4945: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 4946: Compatibility library for pkgsrc tools.</p>
1.1 grant 4947: </li>
4948:
4949: <li>
4950: <p><a xmlns=
4951: "http://www.w3.org/TR/xhtml1/transitional" href=
4952: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 4953: target="_top"><code xmlns="" class=
4954: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 4955: non-BSD systems due to lack of native mtree.</p>
1.1 grant 4956: </li>
4957:
4958: <li>
4959: <p><a xmlns=
4960: "http://www.w3.org/TR/xhtml1/transitional" href=
4961: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 4962: target="_top"><code xmlns="" class=
4963: "filename">pkgtools/pkg_install</code></a>:
4964: Up-to-date replacement for <code xmlns=
4965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 4966: "filename">/usr/sbin/pkg_install</code>, or for use
4967: on operating systems where pkg_install is not
4968: present.</p>
1.1 grant 4969: </li>
4970: </ul>
4971: </div>
4972:
4973: <p>Utilities used by pkgsrc (not automatically
4974: installed):</p>
4975:
4976: <div class="itemizedlist">
4977: <ul type="disc">
4978: <li>
4979: <p><a xmlns=
4980: "http://www.w3.org/TR/xhtml1/transitional" href=
4981: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 4982: target="_top"><code xmlns="" class=
4983: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 4984: binary package from an already-installed package.
1.34 wiz 4985: Used by <span><strong class="command">make
4986: replace</strong></span> to save the old
4987: package.</p>
1.1 grant 4988: </li>
4989:
4990: <li>
4991: <p><a xmlns=
4992: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 4993: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 4994: target="_top"><code xmlns="" class=
4995: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 4996: functionality to pkgsrc, allowing it to fetch
4997: distfiles from multiple locations. It currently
4998: supports the following methods: multiple CD-ROMs
4999: and network FTP/HTTP connections.</p>
1.5 hubertf 5000: </li>
5001:
5002: <li>
5003: <p><a xmlns=
5004: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5005: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5006: target="_top"><code xmlns="" class=
5007: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5008: packages someplace else (enabled by default).</p>
1.1 grant 5009: </li>
1.5 hubertf 5010:
5011: <li>
5012: <p><a xmlns=
5013: "http://www.w3.org/TR/xhtml1/transitional" href=
5014: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5015: target="_top"><code xmlns="" class=
5016: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5017: best compiler flags to optimise code for your
1.20 ben 5018: current CPU and compiler.</p>
1.5 hubertf 5019: </li>
1.1 grant 5020: </ul>
5021: </div>
5022:
5023: <p>Utilities for keeping track of installed packages,
5024: being up to date, etc:</p>
5025:
5026: <div class="itemizedlist">
5027: <ul type="disc">
5028: <li>
5029: <p><a xmlns=
5030: "http://www.w3.org/TR/xhtml1/transitional" href=
5031: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5032: target="_top"><code xmlns="" class=
5033: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5034: packages whose installed versions do not match the
1.34 wiz 5035: latest pkgsrc entries.</p>
1.1 grant 5036: </li>
5037:
5038: <li>
5039: <p><a xmlns=
5040: "http://www.w3.org/TR/xhtml1/transitional" href=
5041: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5042: target="_top"><code xmlns="" class=
5043: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5044: dependency graphs of packages, to aid in choosing a
1.34 wiz 5045: strategy for updating.</p>
1.1 grant 5046: </li>
5047:
5048: <li>
5049: <p><a xmlns=
5050: "http://www.w3.org/TR/xhtml1/transitional" href=
5051: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5052: target="_top"><code xmlns="" class=
5053: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5054: graphs from the output of <a xmlns=
5055: "http://www.w3.org/TR/xhtml1/transitional" href=
5056: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5057: target="_top"><code xmlns="" class=
5058: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5059: graphviz).</p>
1.1 grant 5060: </li>
5061:
5062: <li>
5063: <p><a xmlns=
5064: "http://www.w3.org/TR/xhtml1/transitional" href=
5065: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5066: target="_top"><code xmlns="" class=
5067: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5068: pkglint(1) program checks a pkgsrc entry for
5069: errors, lintpkgsrc(1) does various checks on the
5070: complete pkgsrc system.</p>
1.1 grant 5071: </li>
5072:
5073: <li>
5074: <p><a xmlns=
5075: "http://www.w3.org/TR/xhtml1/transitional" href=
5076: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5077: target="_top"><code xmlns="" class=
5078: "filename">pkgtools/pkgsurvey</code></a>: Report
5079: what packages you have installed.</p>
1.1 grant 5080: </li>
5081: </ul>
5082: </div>
5083:
5084: <p>Utilities for people maintaining or creating
5085: individual packages:</p>
5086:
5087: <div class="itemizedlist">
5088: <ul type="disc">
5089: <li>
5090: <p><a xmlns=
5091: "http://www.w3.org/TR/xhtml1/transitional" href=
5092: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5093: target="_top"><code xmlns="" class=
5094: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5095: making and maintaining patches for a package
1.34 wiz 5096: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5097: </li>
5098:
5099: <li>
5100: <p><a xmlns=
5101: "http://www.w3.org/TR/xhtml1/transitional" href=
5102: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5103: target="_top"><code xmlns="" class=
5104: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5105: "http://www.w3.org/TR/xhtml1/transitional" href=
5106: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5107: target="_top"><code xmlns="" class=
5108: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5109: converting to pkgsrc.</p>
1.1 grant 5110: </li>
5111:
5112: <li>
5113: <p><a xmlns=
5114: "http://www.w3.org/TR/xhtml1/transitional" href=
5115: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5116: target="_top"><code xmlns="" class=
5117: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5118: pkgsrc to a Solaris package.</p>
1.1 grant 5119: </li>
5120: </ul>
5121: </div>
5122:
1.47 reed 5123: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5124: obscure pkg utilities)</p>
5125:
5126: <div class="itemizedlist">
5127: <ul type="disc">
5128: <li>
5129: <p><a xmlns=
5130: "http://www.w3.org/TR/xhtml1/transitional" href=
5131: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5132: target="_top"><code xmlns="" class=
5133: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5134: packages in a chrooted area.</p>
1.1 grant 5135: </li>
5136:
5137: <li>
5138: <p><a xmlns=
5139: "http://www.w3.org/TR/xhtml1/transitional" href=
5140: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5141: target="_top"><code xmlns="" class=
5142: "filename">pkgtools/libkver</code></a>: Spoof
5143: kernel version for chrooted cross builds.</p>
1.1 grant 5144: </li>
5145: </ul>
5146: </div>
5147: </div>
5148:
1.52 ! tv 5149: <div class="sect1" lang="en">
1.1 grant 5150: <div class="titlepage">
5151: <div>
5152: <div>
5153: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5154: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5155: as non-root</h2>
1.1 grant 5156: </div>
5157: </div>
5158: </div>
5159:
5160: <p>If you want to use pkgsrc as non-root user, you can
5161: set some variables to make pkgsrc work under these
1.33 jmmv 5162: conditions. At the very least, you need to set
5163: <code class="varname">UNPRIVILEGED</code> to
5164: “<span class="quote">yes</span>”; this will
5165: turn on unprivileged mode and set multiple related
5166: variables to allow installation of packages as
5167: non-root.</p>
5168:
5169: <p>In case the defaults are not enough, you may want to
5170: tune some other variables used. For example, if the
5171: automatic user/group detection leads to incorrect values
5172: (or not the ones you would like to use), you can change
5173: them by setting <code class=
5174: "varname">UNPRIVILEGED_USER</code> and <code class=
5175: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5176:
5177: <p>As regards bootstrapping, please note that the
5178: <span><strong class="command">bootstrap</strong></span>
5179: script will ease non-root configuration when given the
5180: “<span class=
5181: "quote">--ignore-user-check</span>” flag, as it
5182: will choose and use multiple default directories under
1.45 wiz 5183: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5184: class="filename">~/pkg</code> as the installation
1.33 jmmv 5185: targets. These directories can be overriden by the
5186: “<span class="quote">--prefix</span>” flag
5187: provided by the script, as well as some others that allow
5188: finer tuning of the tree layout.</p>
1.14 xtraeme 5189: </div>
5190:
1.52 ! tv 5191: <div class="sect1" lang="en">
1.14 xtraeme 5192: <div class="titlepage">
5193: <div>
5194: <div>
5195: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5196: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5197: transfers when fetching distfiles?</h2>
1.14 xtraeme 5198: </div>
5199: </div>
5200: </div>
5201:
1.47 reed 5202: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5203: but you can enable this feature by adding the option
5204: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5205: into <code xmlns=
5206: "http://www.w3.org/TR/xhtml1/transitional" class=
5207: "filename">/etc/mk.conf</code>. If, during a fetch step,
5208: an incomplete distfile is found, pkgsrc will try to
5209: resume it.</p>
1.15 xtraeme 5210:
5211: <p>You can also use a different program than the default
1.24 wiz 5212: <a href=
5213: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5214: <span class="citerefentry"><span class=
5215: "refentrytitle">ftp</span>(1)</span></a> by changing the
5216: <code class="varname">FETCH_CMD</code> variable. Don't
5217: forget to set <code class=
5218: "varname">FETCH_RESUME_ARGS</code> and <code class=
5219: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5220: default values.</p>
1.14 xtraeme 5221:
1.45 wiz 5222: <p>For example, if you want to use <code xmlns=
5223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5224: "filename">wget</code> to resume downloads, you'll have
5225: to use something like:</p>
5226: <pre class="programlisting">
1.51 rillig 5227: FETCH_CMD= wget
5228: FETCH_BEFORE_ARGS= --passive-ftp
5229: FETCH_RESUME_ARGS= -c
5230: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5231: </pre>
1.1 grant 5232: </div>
5233:
1.52 ! tv 5234: <div class="sect1" lang="en">
1.1 grant 5235: <div class="titlepage">
5236: <div>
5237: <div>
5238: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5239: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5240: install/use XFree86 from pkgsrc?</h2>
5241: </div>
5242: </div>
5243: </div>
5244:
5245: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5246: system's own X11 (<code xmlns=
5247: "http://www.w3.org/TR/xhtml1/transitional" class=
5248: "filename">/usr/X11R6</code>, <code xmlns=
5249: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5250: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5251: add the following line into <code xmlns=
5252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5253: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5254: <pre class="programlisting">
1.51 rillig 5255: X11_TYPE=XFree86
1.1 grant 5256: </pre>
5257: </div>
5258:
1.52 ! tv 5259: <div class="sect1" lang="en">
1.1 grant 5260: <div class="titlepage">
5261: <div>
5262: <div>
5263: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5264: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5265: install/use X.org from pkgsrc?</h2>
5266: </div>
5267: </div>
5268: </div>
5269:
5270: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5271: system's own X11 (<code xmlns=
5272: "http://www.w3.org/TR/xhtml1/transitional" class=
5273: "filename">/usr/X11R6</code>, <code xmlns=
5274: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5275: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5276: the following line into <code xmlns=
5277: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5278: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5279: <pre class="programlisting">
1.51 rillig 5280: X11_TYPE=xorg
1.1 grant 5281: </pre>
5282: </div>
5283:
1.52 ! tv 5284: <div class="sect1" lang="en">
1.1 grant 5285: <div class="titlepage">
5286: <div>
5287: <div>
5288: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5289: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5290: files from behind a firewall</h2>
1.1 grant 5291: </div>
5292: </div>
5293: </div>
5294:
5295: <p>If you are sitting behind a firewall which does not
5296: allow direct connections to Internet hosts (i.e.
5297: non-NAT), you may specify the relevant proxy hosts. This
5298: is done using an environment variable in the form of a
1.47 reed 5299: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5300: "quote">orpheus.amdahl.com</span>” is one of the
5301: firewalls, and it uses port 80 as the proxy port number.
5302: So the proxy environment variables are:</p>
5303: <pre class="programlisting">
1.51 rillig 5304: ftp_proxy=ftp://orpheus.amdahl.com:80/
5305: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5306: </pre>
5307: </div>
5308:
1.52 ! tv 5309: <div class="sect1" lang="en">
1.1 grant 5310: <div class="titlepage">
5311: <div>
5312: <div>
5313: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 5314: "passive-ftp"></a>7.9. How do I tell
! 5315: <span><strong class="command">make
1.14 xtraeme 5316: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5317: </div>
5318: </div>
5319: </div>
5320:
5321: <p>This depends on which utility is used to retrieve
1.45 wiz 5322: distfiles. From <code xmlns=
5323: "http://www.w3.org/TR/xhtml1/transitional" class=
5324: "filename">bsd.pkg.mk</code>, <code class=
5325: "varname">FETCH_CMD</code> is assigned the first
5326: available command from the following list:</p>
1.34 wiz 5327:
5328: <div class="itemizedlist">
5329: <ul type="disc">
5330: <li>
1.45 wiz 5331: <p><code xmlns=
5332: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5333: "filename">${LOCALBASE}/bin/ftp</code></p>
5334: </li>
5335:
5336: <li>
1.45 wiz 5337: <p><code xmlns=
5338: "http://www.w3.org/TR/xhtml1/transitional" class=
5339: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5340: </li>
5341: </ul>
5342: </div>
1.1 grant 5343:
5344: <p>On a default NetBSD installation, this will be
1.45 wiz 5345: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5346: class="filename">/usr/bin/ftp</code>, which automatically
5347: tries passive connections first, and falls back to active
5348: connections if the server refuses to do passive. For the
5349: other tools, add the following to your <code xmlns=
5350: "http://www.w3.org/TR/xhtml1/transitional" class=
5351: "filename">/etc/mk.conf</code> file: <code class=
5352: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5353:
1.45 wiz 5354: <p>Having that option present will prevent <code xmlns=
5355: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5356: "filename">/usr/bin/ftp</code> from falling back to
5357: active transfers.</p>
1.1 grant 5358: </div>
5359:
1.52 ! tv 5360: <div class="sect1" lang="en">
1.1 grant 5361: <div class="titlepage">
5362: <div>
5363: <div>
5364: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5365: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5366: fetch all distfiles at once</h2>
5367: </div>
5368: </div>
5369: </div>
5370:
5371: <p>You would like to download all the distfiles in a
5372: single batch from work or university, where you can't run
1.14 xtraeme 5373: a <span><strong class="command">make
5374: fetch</strong></span>. There is an archive of distfiles
5375: on <a href=
1.1 grant 5376: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5377: target="_top">ftp.NetBSD.org</a>, but downloading the
5378: entire directory may not be appropriate.</p>
5379:
1.14 xtraeme 5380: <p>The answer here is to do a <span><strong class=
1.45 wiz 5381: "command">make fetch-list</strong></span> in <code xmlns=
5382: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5383: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5384: subdirectories, carry the resulting list to your machine
1.23 wiz 5385: at work/school and use it there. If you don't have a
1.24 wiz 5386: NetBSD-compatible <a href=
5387: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5388: <span class="citerefentry"><span class=
5389: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5390: at work, don't forget to set <code class=
5391: "varname">FETCH_CMD</code> to something that fetches a
5392: URL:</p>
1.1 grant 5393:
5394: <p>At home:</p>
5395: <pre class="screen">
1.14 xtraeme 5396: <code class="prompt">%</code> <strong class=
5397: "userinput"><code>cd /usr/pkgsrc</code></strong>
5398: <code class="prompt">%</code> <strong class=
5399: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5400: <code class="prompt">%</code> <strong class=
5401: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5402: </pre>
5403:
5404: <p>At work:</p>
5405: <pre class="screen">
1.14 xtraeme 5406: <code class="prompt">%</code> <strong class=
5407: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5408: </pre>
5409:
1.45 wiz 5410: <p>then tar up <code xmlns=
5411: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5412: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5413:
5414: <p>If you have a machine running NetBSD, and you want to
5415: get <span class="emphasis"><em>all</em></span> distfiles
5416: (even ones that aren't for your machine architecture),
5417: you can do so by using the above-mentioned
1.14 xtraeme 5418: <span><strong class="command">make
5419: fetch-list</strong></span> approach, or fetch the
5420: distfiles directly by running:</p>
1.1 grant 5421: <pre class="screen">
1.14 xtraeme 5422: <code class="prompt">%</code> <strong class=
5423: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5424: </pre>
5425:
1.14 xtraeme 5426: <p>If you even decide to ignore <code class=
5427: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5428: can get everything by running:</p>
1.1 grant 5429: <pre class="screen">
1.14 xtraeme 5430: <code class="prompt">%</code> <strong class=
5431: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5432: </pre>
5433: </div>
5434:
1.52 ! tv 5435: <div class="sect1" lang="en">
1.1 grant 5436: <div class="titlepage">
5437: <div>
5438: <div>
5439: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5440: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5441: “<span class="quote">Don't know how to make
5442: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5443: </div>
5444: </div>
5445: </div>
5446:
5447: <p>When compiling the <a xmlns=
5448: "http://www.w3.org/TR/xhtml1/transitional" href=
5449: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5450: target="_top"><code xmlns="" class=
5451: "filename">pkgtools/pkg_install</code></a> package, you
5452: get the error from make that it doesn't know how to make
5453: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5454: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5455: indicates that you don't have installed the
1.23 wiz 5456: “<span class="quote">text</span>” set (nroff,
5457: ...) from the NetBSD base distribution on your machine.
1.47 reed 5458: It is recommended to do that to format man pages.</p>
1.1 grant 5459:
5460: <p>In the case of the <a xmlns=
5461: "http://www.w3.org/TR/xhtml1/transitional" href=
5462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5463: target="_top"><code xmlns="" class=
5464: "filename">pkgtools/pkg_install</code></a> package, you
5465: can get away with setting <code class=
1.20 ben 5466: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5467: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5468: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5469: </div>
5470:
1.52 ! tv 5471: <div class="sect1" lang="en">
1.1 grant 5472: <div class="titlepage">
5473: <div>
5474: <div>
5475: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5476: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5477: “<span class="quote">Could not find
5478: bsd.own.mk</span>” mean?</h2>
5479: </div>
5480: </div>
5481: </div>
5482:
1.45 wiz 5483: <p>You didn't install the compiler set, <code xmlns=
5484: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5485: "filename">comp.tgz</code>, when you installed your
1.47 reed 5486: NetBSD machine. Please get and install it, by extracting
5487: it in <code xmlns=
1.45 wiz 5488: "http://www.w3.org/TR/xhtml1/transitional" class=
5489: "filename">/</code>:</p>
1.1 grant 5490: <pre class="screen">
1.14 xtraeme 5491: <code class="prompt">#</code> <strong class=
5492: "userinput"><code>cd /</code></strong>
5493: <code class="prompt">#</code> <strong class=
5494: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5495: </pre>
5496:
1.45 wiz 5497: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5498: class="filename">comp.tgz</code> is part of every NetBSD
5499: release. Get the one that corresponds to your release
5500: (determine via <span><strong class="command">uname
5501: -r</strong></span>).</p>
1.1 grant 5502: </div>
5503:
1.52 ! tv 5504: <div class="sect1" lang="en">
1.1 grant 5505: <div class="titlepage">
5506: <div>
5507: <div>
5508: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5509: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5510: 'sudo' with pkgsrc</h2>
5511: </div>
5512: </div>
5513: </div>
5514:
5515: <p>When installing packages as non-root user and using
1.24 wiz 5516: the just-in-time <a href=
5517: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5518: <span class="citerefentry"><span class=
5519: "refentrytitle">su</span>(1)</span></a> feature of
5520: pkgsrc, it can become annoying to type in the root
5521: password for each required package installed. To avoid
5522: this, the sudo package can be used, which does password
5523: caching over a limited time. To use it, install sudo
5524: (either as binary package or from <a xmlns=
5525: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5526: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5527: target="_top"><code xmlns="" class=
5528: "filename">security/sudo</code></a>) and then put the
5529: following into your <code xmlns=
5530: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5531: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5532: <pre class="programlisting">
1.51 rillig 5533: .if exists(${LOCALBASE}/bin/sudo)
5534: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5535: .endif
1.1 grant 5536: </pre>
5537: </div>
5538:
1.52 ! tv 5539: <div class="sect1" lang="en">
1.1 grant 5540: <div class="titlepage">
5541: <div>
5542: <div>
5543: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 5544: "faq.conf"></a>7.14. How do I change the
! 5545: location of configuration files?</h2>
1.1 grant 5546: </div>
5547: </div>
5548: </div>
5549:
1.35 jmmv 5550: <p>As the system administrator, you can choose where
5551: configuration files are installed. The default settings
1.45 wiz 5552: make all these files go into <code xmlns=
5553: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5554: "filename">${PREFIX}/etc</code> or some of its
5555: subdirectories; this may be suboptimal depending on your
5556: expectations (e.g., a read-only, NFS-exported
5557: <code class="varname">PREFIX</code> with a need of
5558: per-machine configuration of the provided packages).</p>
5559:
5560: <p>In order to change the defaults, you can modify the
5561: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5562: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5563: class="filename">/etc/mk.conf</code>) to point to your
5564: preferred configuration directory; some common examples
5565: include <code xmlns=
5566: "http://www.w3.org/TR/xhtml1/transitional" class=
5567: "filename">/etc</code> or <code xmlns=
5568: "http://www.w3.org/TR/xhtml1/transitional" class=
5569: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5570:
5571: <p>Furthermore, you can change this value on a
5572: per-package basis by setting the <code class=
5573: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5574: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5575: value usually matches the name of the package you would
5576: like to modify, that is, the contents of <code class=
5577: "varname">PKGBASE</code>.</p>
1.1 grant 5578:
1.47 reed 5579: <p>Note that after changing these settings, you must
1.35 jmmv 5580: rebuild and reinstall any affected packages.</p>
1.1 grant 5581: </div>
5582:
1.52 ! tv 5583: <div class="sect1" lang="en">
1.1 grant 5584: <div class="titlepage">
5585: <div>
5586: <div>
5587: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5588: "audit-packages"></a>7.15. Automated security
1.1 grant 5589: checks</h2>
5590: </div>
5591: </div>
5592: </div>
5593:
5594: <p>Please be aware that there can often be bugs in
5595: third-party software, and some of these bugs can leave a
5596: machine vulnerable to exploitation by attackers. In an
5597: effort to lessen the exposure, the NetBSD packages team
5598: maintains a database of known-exploits to packages which
5599: have at one time been included in pkgsrc. The database
5600: can be downloaded automatically, and a security audit of
5601: all packages installed on a system can take place. To do
5602: this, install the <a xmlns=
5603: "http://www.w3.org/TR/xhtml1/transitional" href=
5604: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5605: target="_top"><code xmlns="" class=
5606: "filename">security/audit-packages</code></a> package. It
1.20 ben 5607: has two components:</p>
1.1 grant 5608:
5609: <div class="orderedlist">
5610: <ol type="1">
5611: <li>
1.34 wiz 5612: <p><span><strong class=
5613: "command">download-vulnerability-list</strong></span>,
1.1 grant 5614: an easy way to download a list of the security
5615: vulnerabilities information. This list is kept up
5616: to date by the NetBSD security officer and the
5617: NetBSD packages team, and is distributed from the
5618: NetBSD ftp server:</p>
5619:
5620: <p><a href=
5621: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5622: target=
5623: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5624: </li>
5625:
5626: <li>
1.34 wiz 5627: <p><span><strong class=
5628: "command">audit-packages</strong></span>, an easy
5629: way to audit the current machine, checking each
1.1 grant 5630: vulnerability which is known. If a vulnerable
5631: package is installed, it will be shown by output to
5632: stdout, including a description of the type of
5633: vulnerability, and a URL containing more
5634: information.</p>
5635: </li>
5636: </ol>
5637: </div>
5638:
1.23 wiz 5639: <p>Use of the <a xmlns=
5640: "http://www.w3.org/TR/xhtml1/transitional" href=
5641: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5642: target="_top"><code xmlns="" class=
5643: "filename">security/audit-packages</code></a> package is
1.23 wiz 5644: strongly recommended! After “<span class=
5645: "quote">audit-packages</span>” is installed, please
5646: read the package's message, which you can get by running
5647: <strong class="userinput"><code>pkg_info -D
5648: audit-package</code></strong>.</p>
1.1 grant 5649: </div>
5650: </div>
5651: </div>
5652:
1.52 ! tv 5653: <div class="part" lang="en">
1.1 grant 5654: <div class="titlepage">
5655: <div>
5656: <div>
1.52 ! tv 5657: <h1 class="title"><a name=
1.48 dillo 5658: "developers-guide"></a>Part II. The pkgsrc
5659: developer's guide</h1>
1.1 grant 5660: </div>
5661: </div>
5662: </div>
5663:
5664: <div class="toc">
5665: <p><b>Table of Contents</b></p>
5666:
5667: <dl>
1.38 dillo 5668: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5669: Package components - files, directories and
5670: contents</a></span></dt>
5671:
5672: <dd>
5673: <dl>
5674: <dt><span class="sect1"><a href=
1.45 wiz 5675: "#components.Makefile">8.1. <code xmlns=
5676: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5677: "filename">Makefile</code></a></span></dt>
5678:
5679: <dt><span class="sect1"><a href=
1.45 wiz 5680: "#components.distinfo">8.2. <code xmlns=
5681: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5682: "filename">distinfo</code></a></span></dt>
5683:
5684: <dt><span class="sect1"><a href=
1.38 dillo 5685: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5686:
1.30 wiz 5687: <dt><span class="sect1"><a href=
1.38 dillo 5688: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5689: files</a></span></dt>
1.27 rillig 5690:
5691: <dt><span class="sect1"><a href=
1.38 dillo 5692: "#components.optional">8.5. Optional
1.27 rillig 5693: files</a></span></dt>
5694:
1.38 dillo 5695: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5696: <code xmlns=
5697: "http://www.w3.org/TR/xhtml1/transitional" class=
5698: "filename">work*</code></a></span></dt>
1.27 rillig 5699:
1.38 dillo 5700: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5701: <code xmlns=
5702: "http://www.w3.org/TR/xhtml1/transitional" class=
5703: "filename">files/*</code></a></span></dt>
1.27 rillig 5704: </dl>
5705: </dd>
5706:
1.38 dillo 5707: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5708: Programming in <code xmlns=
5709: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5710: "filename">Makefile</code>s</a></span></dt>
5711:
5712: <dd>
5713: <dl>
5714: <dt><span class="sect1"><a href=
1.45 wiz 5715: "#makefile.variables">9.1. <code xmlns=
5716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5717: "filename">Makefile</code> variables</a></span></dt>
5718:
1.27 rillig 5719: <dd>
5720: <dl>
5721: <dt><span class="sect2"><a href=
1.38 dillo 5722: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5723: conventions</a></span></dt>
5724: </dl>
5725: </dd>
5726:
1.38 dillo 5727: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5728: Code snippets</a></span></dt>
5729:
5730: <dd>
5731: <dl>
5732: <dt><span class="sect2"><a href=
1.38 dillo 5733: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5734: list</a></span></dt>
5735:
5736: <dt><span class="sect2"><a href=
1.38 dillo 5737: "#converting-internal-to-external">9.2.2.
1.30 wiz 5738: Converting an internal list into an external
5739: list</a></span></dt>
1.25 rillig 5740:
5741: <dt><span class="sect2"><a href=
1.38 dillo 5742: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5743: variables to a shell command</a></span></dt>
1.27 rillig 5744:
5745: <dt><span class="sect2"><a href=
1.38 dillo 5746: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5747: guideline</a></span></dt>
5748:
5749: <dt><span class="sect2"><a href=
1.38 dillo 5750: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5751: a bug in BSD Make</a></span></dt>
1.25 rillig 5752: </dl>
5753: </dd>
5754: </dl>
5755: </dd>
5756:
1.38 dillo 5757: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5758: issues</a></span></dt>
5759:
5760: <dd>
5761: <dl>
1.38 dillo 5762: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5763: ID</a></span></dt>
5764:
1.30 wiz 5765: <dt><span class="sect1"><a href=
1.38 dillo 5766: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5767: <code xmlns=
5768: "http://www.w3.org/TR/xhtml1/transitional" class=
5769: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5770:
1.38 dillo 5771: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5772: Tweaking output of <span><strong class="command">make
5773: print-PLIST</strong></span></a></span></dt>
1.1 grant 5774:
1.38 dillo 5775: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5776: Variable substitution in PLIST</a></span></dt>
5777:
1.30 wiz 5778: <dt><span class="sect1"><a href=
1.48 dillo 5779: "#manpage-compression">10.5. Man page
5780: compression</a></span></dt>
1.1 grant 5781:
1.30 wiz 5782: <dt><span class="sect1"><a href=
1.38 dillo 5783: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5784: <code class=
1.14 xtraeme 5785: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5786:
1.30 wiz 5787: <dt><span class="sect1"><a href=
1.47 reed 5788: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5789: and differing PLISTs</a></span></dt>
1.1 grant 5790:
5791: <dt><span class="sect1"><a href=
1.38 dillo 5792: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 5793: packages</a></span></dt>
5794: </dl>
5795: </dd>
5796:
1.38 dillo 5797: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 5798: Buildlink methodology</a></span></dt>
5799:
5800: <dd>
5801: <dl>
1.30 wiz 5802: <dt><span class="sect1"><a href=
1.38 dillo 5803: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 5804: to use buildlink3</a></span></dt>
1.1 grant 5805:
1.30 wiz 5806: <dt><span class="sect1"><a href=
1.45 wiz 5807: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
5808: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5809: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 5810:
5811: <dd>
5812: <dl>
5813: <dt><span class="sect2"><a href=
1.38 dillo 5814: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 5815: buildlink3.mk file</a></span></dt>
1.1 grant 5816:
5817: <dt><span class="sect2"><a href=
1.38 dillo 5818: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 5819: <code class=
1.52 ! tv 5820: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
! 5821: in <code xmlns=
1.45 wiz 5822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5823: "filename">buildlink3.mk</code>
1.1 grant 5824: files</a></span></dt>
5825: </dl>
5826: </dd>
5827:
1.30 wiz 5828: <dt><span class="sect1"><a href=
1.45 wiz 5829: "#writing-builtin.mk">11.3. Writing <code xmlns=
5830: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 5831: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 5832:
5833: <dd>
5834: <dl>
5835: <dt><span class="sect2"><a href=
1.38 dillo 5836: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 5837: <code xmlns=
5838: "http://www.w3.org/TR/xhtml1/transitional" class=
5839: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 5840:
5841: <dt><span class="sect2"><a href=
1.38 dillo 5842: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 5843: preferences for native or pkgsrc
5844: software</a></span></dt>
1.1 grant 5845: </dl>
5846: </dd>
5847: </dl>
5848: </dd>
5849:
1.38 dillo 5850: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 5851: pkginstall framework</a></span></dt>
5852:
5853: <dd>
5854: <dl>
5855: <dt><span class="sect1"><a href=
1.38 dillo 5856: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 5857: directories outside the installation
5858: prefix</a></span></dt>
5859:
5860: <dd>
5861: <dl>
5862: <dt><span class="sect2"><a href=
1.38 dillo 5863: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 5864: manipulation</a></span></dt>
5865:
5866: <dt><span class="sect2"><a href=
1.38 dillo 5867: "#files-outside-prefix">12.1.2. File
1.35 jmmv 5868: manipulation</a></span></dt>
5869: </dl>
5870: </dd>
5871:
1.38 dillo 5872: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 5873: Configuration files</a></span></dt>
5874:
5875: <dd>
5876: <dl>
5877: <dt><span class="sect2"><a href=
1.38 dillo 5878: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 5879: "varname">PKG_SYSCONFDIR</code> is
5880: set</a></span></dt>
5881:
5882: <dt><span class="sect2"><a href=
1.38 dillo 5883: "#conf-files-configure">12.2.2. Telling the
1.47 reed 5884: software where configuration files
1.35 jmmv 5885: are</a></span></dt>
5886:
5887: <dt><span class="sect2"><a href=
1.38 dillo 5888: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 5889: installations</a></span></dt>
5890:
5891: <dt><span class="sect2"><a href=
1.38 dillo 5892: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 5893: of configuration files</a></span></dt>
5894: </dl>
5895: </dd>
5896:
1.38 dillo 5897: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 5898: System startup scripts</a></span></dt>
5899:
5900: <dd>
5901: <dl>
5902: <dt><span class="sect2"><a href=
1.38 dillo 5903: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 5904: of system startup scripts</a></span></dt>
5905: </dl>
5906: </dd>
5907:
5908: <dt><span class="sect1"><a href=
1.38 dillo 5909: "#users-and-groups">12.4. System users and
1.35 jmmv 5910: groups</a></span></dt>
5911:
1.38 dillo 5912: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 5913: System shells</a></span></dt>
5914:
5915: <dd>
5916: <dl>
5917: <dt><span class="sect2"><a href=
1.38 dillo 5918: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 5919: configuration files</a></span></dt>
5920: </dl>
5921: </dd>
5922: </dl>
5923: </dd>
5924:
1.38 dillo 5925: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 5926: handling</a></span></dt>
5927:
5928: <dd>
5929: <dl>
1.30 wiz 5930: <dt><span class="sect1"><a href=
1.38 dillo 5931: "#global-default-options">13.1. Global default
1.30 wiz 5932: options</a></span></dt>
1.1 grant 5933:
1.30 wiz 5934: <dt><span class="sect1"><a href=
1.38 dillo 5935: "#converting-to-options">13.2. Converting packages to
1.45 wiz 5936: use <code xmlns=
5937: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5938: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 5939:
5940: <dt><span class="sect1"><a href="#option-names">13.3.
5941: Option Names</a></span></dt>
1.1 grant 5942: </dl>
5943: </dd>
5944:
1.38 dillo 5945: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 5946: process</a></span></dt>
5947:
5948: <dd>
5949: <dl>
1.38 dillo 5950: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 5951: Program location</a></span></dt>
5952:
1.38 dillo 5953: <dt><span class="sect1"><a href="#main-targets">14.2.
1.1 grant 5954: Main targets</a></span></dt>
5955:
5956: <dt><span class="sect1"><a href=
1.38 dillo 5957: "#build.helpful-targets">14.3. Other helpful
1.1 grant 5958: targets</a></span></dt>
5959: </dl>
5960: </dd>
5961:
1.38 dillo 5962: <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1 grant 5963: fixes for packages</a></span></dt>
5964:
5965: <dd>
5966: <dl>
1.30 wiz 5967: <dt><span class="sect1"><a href=
1.38 dillo 5968: "#general-operation">15.1. General
1.30 wiz 5969: operation</a></span></dt>
1.1 grant 5970:
5971: <dd>
5972: <dl>
5973: <dt><span class="sect2"><a href=
1.38 dillo 5974: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 5975: pull in variables from
5976: /etc/mk.conf</a></span></dt>
1.1 grant 5977:
5978: <dt><span class="sect2"><a href=
1.38 dillo 5979: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 5980: to install documentation</a></span></dt>
5981:
5982: <dt><span class="sect2"><a href=
1.38 dillo 5983: "#restricted-packages">15.1.3. Restricted
1.1 grant 5984: packages</a></span></dt>
5985:
5986: <dt><span class="sect2"><a href=
1.38 dillo 5987: "#dependencies">15.1.4. Handling
1.1 grant 5988: dependencies</a></span></dt>
5989:
5990: <dt><span class="sect2"><a href=
1.38 dillo 5991: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 5992: other packages</a></span></dt>
5993:
5994: <dt><span class="sect2"><a href=
1.38 dillo 5995: "#not-building-packages">15.1.6. Packages that
1.30 wiz 5996: cannot or should not be built</a></span></dt>
1.1 grant 5997:
5998: <dt><span class="sect2"><a href=
1.38 dillo 5999: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6000: should not be deleted, once
6001: installed</a></span></dt>
1.1 grant 6002:
6003: <dt><span class="sect2"><a href=
1.38 dillo 6004: "#security-handling">15.1.8. Handling packages
1.1 grant 6005: with security problems</a></span></dt>
6006:
6007: <dt><span class="sect2"><a href=
1.38 dillo 6008: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6009: bugs</a></span></dt>
6010:
6011: <dt><span class="sect2"><a href=
1.38 dillo 6012: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6013: incrementing versions when fixing an existing
1.1 grant 6014: package</a></span></dt>
6015:
6016: <dt><span class="sect2"><a href=
1.38 dillo 6017: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6018: of packages</a></span></dt>
1.1 grant 6019: </dl>
6020: </dd>
6021:
1.30 wiz 6022: <dt><span class="sect1"><a href=
1.38 dillo 6023: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6024: issues</a></span></dt>
1.1 grant 6025:
6026: <dd>
6027: <dl>
6028: <dt><span class="sect2"><a href=
1.38 dillo 6029: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6030: distfiles aren't available for plain
1.1 grant 6031: downloading</a></span></dt>
6032:
6033: <dt><span class="sect2"><a href=
1.38 dillo 6034: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6035: handle modified distfiles with the 'old'
6036: name</a></span></dt>
1.1 grant 6037: </dl>
6038: </dd>
6039:
1.30 wiz 6040: <dt><span class="sect1"><a href=
1.38 dillo 6041: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6042: gotchas</a></span></dt>
1.1 grant 6043:
6044: <dd>
6045: <dl>
6046: <dt><span class="sect2"><a href=
1.38 dillo 6047: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6048: libtool</a></span></dt>
6049:
6050: <dt><span class="sect2"><a href=
1.38 dillo 6051: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6052: packages that already support
6053: libtool</a></span></dt>
6054:
6055: <dt><span class="sect2"><a href=
1.38 dillo 6056: "#autoconf-automake">15.3.3. GNU
1.1 grant 6057: Autoconf/Automake</a></span></dt>
6058: </dl>
6059: </dd>
6060:
1.30 wiz 6061: <dt><span class="sect1"><a href=
1.38 dillo 6062: "#building-considerations">15.4. Building
1.30 wiz 6063: considerations</a></span></dt>
1.1 grant 6064:
6065: <dd>
6066: <dl>
6067: <dt><span class="sect2"><a href=
1.38 dillo 6068: "#cpp-defines">15.4.1. CPP
1.30 wiz 6069: defines</a></span></dt>
1.51 rillig 6070:
6071: <dt><span class="sect2"><a href=
6072: "#cpp-list">15.4.2. Getting a list of CPP
6073: defines</a></span></dt>
1.1 grant 6074: </dl>
6075: </dd>
6076:
1.30 wiz 6077: <dt><span class="sect1"><a href=
1.38 dillo 6078: "#package-specific-actions">15.5. Package specific
1.30 wiz 6079: actions</a></span></dt>
1.1 grant 6080:
6081: <dd>
6082: <dl>
6083: <dt><span class="sect2"><a href=
1.38 dillo 6084: "#user-interaction">15.5.1. User
1.2 hubertf 6085: interaction</a></span></dt>
1.1 grant 6086:
6087: <dt><span class="sect2"><a href=
1.38 dillo 6088: "#handling-licenses">15.5.2. Handling
1.1 grant 6089: licenses</a></span></dt>
6090:
6091: <dt><span class="sect2"><a href=
1.38 dillo 6092: "#installing-score-files">15.5.3. Installing
1.30 wiz 6093: score files</a></span></dt>
1.1 grant 6094:
6095: <dt><span class="sect2"><a href=
1.38 dillo 6096: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6097: scripts</a></span></dt>
6098:
6099: <dt><span class="sect2"><a href=
1.38 dillo 6100: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6101: hardcoded paths to other
6102: interpreters</a></span></dt>
1.1 grant 6103:
6104: <dt><span class="sect2"><a href=
1.38 dillo 6105: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6106: modules</a></span></dt>
6107:
6108: <dt><span class="sect2"><a href=
1.38 dillo 6109: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6110: info files</a></span></dt>
6111:
6112: <dt><span class="sect2"><a href=
1.38 dillo 6113: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 6114: GConf2 data files</a></span></dt>
1.1 grant 6115:
6116: <dt><span class="sect2"><a href=
1.38 dillo 6117: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 6118: installing scrollkeeper data
6119: files</a></span></dt>
1.1 grant 6120:
6121: <dt><span class="sect2"><a href=
1.38 dillo 6122: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 6123: fonts</a></span></dt>
6124:
6125: <dt><span class="sect2"><a href=
1.38 dillo 6126: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 6127: modules</a></span></dt>
6128:
6129: <dt><span class="sect2"><a href=
1.38 dillo 6130: "#sgml-xml-data">15.5.12. Packages installing
1.30 wiz 6131: SGML or XML data</a></span></dt>
1.1 grant 6132:
6133: <dt><span class="sect2"><a href=
1.38 dillo 6134: "#mime-database">15.5.13. Packages installing
1.1 grant 6135: extensions to the MIME database</a></span></dt>
6136:
6137: <dt><span class="sect2"><a href=
1.38 dillo 6138: "#intltool">15.5.14. Packages using
1.1 grant 6139: intltool</a></span></dt>
1.18 xtraeme 6140:
6141: <dt><span class="sect2"><a href=
1.38 dillo 6142: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 6143: startup scripts</a></span></dt>
1.1 grant 6144: </dl>
6145: </dd>
6146:
1.30 wiz 6147: <dt><span class="sect1"><a href=
1.38 dillo 6148: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6149: author</a></span></dt>
1.1 grant 6150: </dl>
6151: </dd>
6152:
1.38 dillo 6153: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6154: Debugging</a></span></dt>
6155:
1.38 dillo 6156: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6157: Submitting and Committing</a></span></dt>
6158:
6159: <dd>
6160: <dl>
1.30 wiz 6161: <dt><span class="sect1"><a href=
1.38 dillo 6162: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6163: packages</a></span></dt>
1.1 grant 6164:
1.30 wiz 6165: <dt><span class="sect1"><a href=
1.41 wiz 6166: "#general-notes-for-changes">17.2. General notes when
6167: adding, updating, or removing
6168: packages</a></span></dt>
6169:
6170: <dt><span class="sect1"><a href=
6171: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6172: package into CVS</a></span></dt>
1.1 grant 6173:
1.30 wiz 6174: <dt><span class="sect1"><a href=
1.41 wiz 6175: "#updating-package">17.4. Updating a package to a
1.30 wiz 6176: newer version</a></span></dt>
1.1 grant 6177:
1.30 wiz 6178: <dt><span class="sect1"><a href=
1.41 wiz 6179: "#moving-package">17.5. Moving a package in
1.30 wiz 6180: pkgsrc</a></span></dt>
1.1 grant 6181: </dl>
6182: </dd>
6183: </dl>
6184: </div>
6185:
1.52 ! tv 6186: <div class="chapter" lang="en">
1.1 grant 6187: <div class="titlepage">
6188: <div>
6189: <div>
1.52 ! tv 6190: <h2 class="title"><a name=
1.38 dillo 6191: "components"></a>Chapter 8. Package
1.27 rillig 6192: components - files, directories and contents</h2>
1.25 rillig 6193: </div>
6194: </div>
6195: </div>
6196:
6197: <div class="toc">
6198: <p><b>Table of Contents</b></p>
6199:
6200: <dl>
6201: <dt><span class="sect1"><a href=
1.45 wiz 6202: "#components.Makefile">8.1. <code xmlns=
6203: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6204: "filename">Makefile</code></a></span></dt>
6205:
6206: <dt><span class="sect1"><a href=
1.45 wiz 6207: "#components.distinfo">8.2. <code xmlns=
6208: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6209: "filename">distinfo</code></a></span></dt>
6210:
6211: <dt><span class="sect1"><a href=
1.38 dillo 6212: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6213:
1.30 wiz 6214: <dt><span class="sect1"><a href=
1.38 dillo 6215: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6216: files</a></span></dt>
1.25 rillig 6217:
1.27 rillig 6218: <dt><span class="sect1"><a href=
1.38 dillo 6219: "#components.optional">8.5. Optional
1.27 rillig 6220: files</a></span></dt>
1.25 rillig 6221:
1.38 dillo 6222: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6223: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6224: class="filename">work*</code></a></span></dt>
1.25 rillig 6225:
1.38 dillo 6226: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6227: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6228: class="filename">files/*</code></a></span></dt>
1.25 rillig 6229: </dl>
6230: </div>
6231:
1.27 rillig 6232: <p>Whenever you're preparing a package, there are a number
6233: of files involved which are described in the following
6234: sections.</p>
1.25 rillig 6235:
1.52 ! tv 6236: <div class="sect1" lang="en">
1.25 rillig 6237: <div class="titlepage">
6238: <div>
6239: <div>
6240: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6241: "components.Makefile"></a>8.1. <code xmlns=
6242: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6243: "filename">Makefile</code></h2>
1.25 rillig 6244: </div>
6245: </div>
6246: </div>
6247:
1.27 rillig 6248: <p>Building, installation and creation of a binary
1.45 wiz 6249: package are all controlled by the package's <code xmlns=
6250: "http://www.w3.org/TR/xhtml1/transitional" class=
6251: "filename">Makefile</code>. The <code xmlns=
6252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6253: "filename">Makefile</code> describes various things about
6254: a package, for example from where to get it, how to
6255: configure, build, and install it.</p>
6256:
1.45 wiz 6257: <p>A package <code xmlns=
6258: "http://www.w3.org/TR/xhtml1/transitional" class=
6259: "filename">Makefile</code> contains several sections that
6260: describe the package.</p>
1.25 rillig 6261:
1.27 rillig 6262: <p>In the first section there are the following
6263: variables, which should appear exactly in the order given
6264: here.</p>
1.25 rillig 6265:
6266: <div class="itemizedlist">
6267: <ul type="disc">
6268: <li>
1.27 rillig 6269: <p><code class="varname">DISTNAME</code> is the
6270: basename of the distribution file to be downloaded
6271: from the package's website.</p>
6272: </li>
6273:
6274: <li>
6275: <p><code class="varname">PKGNAME</code> is the name
6276: of the package, as used by pkgsrc. You only need to
1.50 rillig 6277: provide it if it differs from <code class=
6278: "varname">DISTNAME</code>. Usually it is the
6279: directory name together with the version number. It
6280: must match the regular expression <code class=
1.27 rillig 6281: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6282: that is, it starts with a letter or digit, and
6283: contains only letters, digits, dashes, underscores,
6284: dots and plus signs.</p>
1.25 rillig 6285: </li>
6286:
6287: <li>
1.27 rillig 6288: <p><code class="varname">CATEGORIES</code> is a
6289: list of categories which the package fits in. You
6290: can choose any of the top-level directories of
6291: pkgsrc for it.</p>
1.45 wiz 6292:
6293: <p>Currently the following values are available for
6294: <code class="varname">CATEGORIES</code>. If more
6295: than one is used, they need to be separated by
6296: spaces:</p>
6297: <pre class="programlisting">
1.51 rillig 6298: archivers cross geography meta-pkgs security
6299: audio databases graphics misc shells
6300: benchmarks devel ham multimedia sysutils
6301: biology editors inputmethod net textproc
6302: cad emulators lang news time
6303: chat finance mail parallel wm
6304: comms fonts math pkgtools www
6305: converters games mbone print x11
1.45 wiz 6306: </pre>
1.25 rillig 6307: </li>
6308:
6309: <li>
1.27 rillig 6310: <p><code class="varname">MASTER_SITES</code> is a
6311: list of URLs where the distribution files can be
6312: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6313:
6314: <p>The <code class="varname">MASTER_SITES</code>
6315: may make use of the following predefined sites:</p>
6316: <pre class="programlisting">
1.51 rillig 6317: ${MASTER_SITE_APACHE}
6318: ${MASTER_SITE_BACKUP}
6319: ${MASTER_SITE_CYGWIN}
6320: ${MASTER_SITE_DEBIAN}
6321: ${MASTER_SITE_FREEBSD}
6322: ${MASTER_SITE_FREEBSD_LOCAL}
6323: ${MASTER_SITE_GNOME}
6324: ${MASTER_SITE_GNU}
6325: ${MASTER_SITE_GNUSTEP}
6326: ${MASTER_SITE_IFARCHIVE}
6327: ${MASTER_SITE_MOZILLA}
6328: ${MASTER_SITE_OPENOFFICE}
6329: ${MASTER_SITE_PERL_CPAN}
6330: ${MASTER_SITE_R_CRAN}
6331: ${MASTER_SITE_SOURCEFORGE}
6332: ${MASTER_SITE_SUNSITE}
6333: ${MASTER_SITE_SUSE}
6334: ${MASTER_SITE_TEX_CTAN}
6335: ${MASTER_SITE_XCONTRIB}
6336: ${MASTER_SITE_XEMACS}
1.45 wiz 6337: </pre>
6338:
6339: <p>If one of these predefined sites is chosen, you
6340: may want to specify a subdirectory of that site.
6341: Since these macros may expand to more than one
6342: actual site, you <span class=
6343: "emphasis"><em>must</em></span> use the following
6344: construct to specify a subdirectory:</p>
6345: <pre class="programlisting">
1.51 rillig 6346: ${MASTER_SITE_GNU:=subdirectory/name/}
6347: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6348: </pre>
6349:
6350: <p>Note the trailing slash after the subdirectory
6351: name.</p>
6352:
6353: <p>If the package has multiple <code class=
6354: "varname">DISTFILES</code> or multiple <code class=
6355: "varname">PATCHFILES</code> from different sites,
6356: set <code class="varname">SITES_foo</code> to a
1.47 reed 6357: list of URIs where file “<span class=
1.45 wiz 6358: "quote">foo</span>” may be found.
6359: “<span class="quote">foo</span>”
1.47 reed 6360: includes the suffix, e.g.:</p>
1.45 wiz 6361: <pre class="programlisting">
1.51 rillig 6362: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6363: DISTFILES+= foo-file.tar.gz
6364: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6365: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6366: </pre>
6367: </li>
6368:
6369: <li>
6370: <p><code class="varname">DISTFILES</code>: Name(s)
6371: of archive file(s) containing distribution. The
6372: default is <code xmlns=
6373: "http://www.w3.org/TR/xhtml1/transitional" class=
6374: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6375: Should only be set if you have more than one
6376: distfile.</p>
6377:
6378: <p>Note that the normal default setting of
6379: <code class="varname">DISTFILES</code> must be made
6380: explicit if you want to add to it (rather than
6381: replace it), as you usually would.</p>
6382: </li>
6383:
6384: <li>
6385: <p><code class="varname">EXTRACT_SUFX</code>:
6386: Suffix of the distribution file, will be appended
6387: to <code class="varname">DISTNAME</code>. Defaults
6388: to <code xmlns=
6389: "http://www.w3.org/TR/xhtml1/transitional" class=
6390: "filename">.tar.gz</code>.</p>
6391: </li>
6392: </ul>
6393: </div>
6394:
6395: <p>The second section contains information about
6396: separately downloaded patches, if any.</p>
6397:
6398: <div class="itemizedlist">
6399: <ul type="disc">
6400: <li>
1.47 reed 6401: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6402: of additional files that contain distribution
6403: patches. There is no default. pkgsrc will look for
6404: them at <code class="varname">PATCH_SITES</code>.
6405: They will automatically be uncompressed before
6406: patching if the names end with <code xmlns=
6407: "http://www.w3.org/TR/xhtml1/transitional" class=
6408: "filename">.gz</code> or <code xmlns=
6409: "http://www.w3.org/TR/xhtml1/transitional" class=
6410: "filename">.Z</code>.</p>
6411: </li>
6412:
6413: <li>
6414: <p><code class="varname">PATCH_SITES</code>:
6415: Primary location(s) for distribution patch files
6416: (see <code class="varname">PATCHFILES</code> below)
6417: if not found locally.</p>
1.25 rillig 6418: </li>
6419: </ul>
6420: </div>
6421:
1.45 wiz 6422: <p>The third section contains the following
1.27 rillig 6423: variables.</p>
1.25 rillig 6424:
1.27 rillig 6425: <div class="itemizedlist">
6426: <ul type="disc">
6427: <li>
6428: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6429: email address of the person who feels responsible
6430: for this package, and who is most likely to look at
6431: problems or questions regarding this package which
6432: have been reported with <a href=
1.45 wiz 6433: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6434: <span class="citerefentry"><span class=
1.50 rillig 6435: "refentrytitle">send-pr</span>(1)</span></a>. Other
6436: developers should contact the <code class=
6437: "varname">MAINTAINER</code> before making major
6438: changes to the package. When packaging a new
6439: program, set <code class=
6440: "varname">MAINTAINER</code> to yourself. If you
6441: really can't maintain the package for future
6442: updates, set it to <code class="email"><<a href=
1.45 wiz 6443: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6444: </li>
1.25 rillig 6445:
1.27 rillig 6446: <li>
6447: <p><code class="varname">HOMEPAGE</code> is a URL
6448: where users can find more information about the
1.23 wiz 6449: package.</p>
6450: </li>
1.1 grant 6451:
1.23 wiz 6452: <li>
6453: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6454: one-line description of the package (should not
6455: include the package name).</p>
1.23 wiz 6456: </li>
6457: </ul>
6458: </div>
1.1 grant 6459:
1.45 wiz 6460: <p>Other variables that affect the build:</p>
1.1 grant 6461:
1.45 wiz 6462: <div class="itemizedlist">
6463: <ul type="disc">
6464: <li>
6465: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6466: directory where the interesting distribution files
6467: of the package are found. The default is
6468: <code xmlns=
6469: "http://www.w3.org/TR/xhtml1/transitional" class=
6470: "filename">${WRKDIR}/${DISTNAME}</code>, which
6471: works for most packages.</p>
6472:
6473: <p>If a package doesn't create a subdirectory for
6474: itself (most GNU software does, for instance), but
6475: extracts itself in the current directory, you
6476: should set <code class="varname">WRKSRC=
6477: ${WRKDIR}</code>.</p>
6478:
6479: <p>If a package doesn't create a subdirectory with
6480: the name of <code class="varname">DISTNAME</code>
6481: but some different name, set <code class=
6482: "varname">WRKSRC</code> to point to the proper name
6483: in <code xmlns=
6484: "http://www.w3.org/TR/xhtml1/transitional" class=
6485: "filename">${WRKDIR}</code>, for example
6486: <code class="varname">WRKSRC=
6487: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6488: "http://www.w3.org/TR/xhtml1/transitional" href=
6489: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6490: target="_top"><code xmlns="" class=
6491: "filename">lang/tcl</code></a> and <a xmlns=
6492: "http://www.w3.org/TR/xhtml1/transitional" href=
6493: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6494: target="_top"><code xmlns="" class=
6495: "filename">x11/tk</code></a> for other
6496: examples.</p>
6497:
6498: <p>The name of the working directory created by
6499: pkgsrc is taken from the <code class=
6500: "varname">WRKDIR_BASENAME</code> variable. By
6501: default, its value is <code xmlns=
6502: "http://www.w3.org/TR/xhtml1/transitional" class=
6503: "filename">work</code>. If you want to use the same
6504: pkgsrc tree for building different kinds of binary
6505: packages, you can change the variable according to
6506: your needs. Two other variables handle common cases
6507: of setting <code class=
6508: "varname">WRKDIR_BASENAME</code> individually. If
6509: <code class="varname">OBJHOSTNAME</code> is defined
6510: in <code xmlns=
1.45 wiz 6511: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6512: "filename">/etc/mk.conf</code>, the first component
6513: of the host's name is attached to the directory
6514: name. If <code class="varname">OBJMACHINE</code> is
6515: defined, the platform name is attached, which might
6516: look like <code xmlns=
6517: "http://www.w3.org/TR/xhtml1/transitional" class=
6518: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6520: "filename">work.sparc</code>.</p>
1.45 wiz 6521: </li>
6522: </ul>
1.1 grant 6523: </div>
6524:
6525: <p>Please pay attention to the following gotchas:</p>
6526:
6527: <div class="itemizedlist">
6528: <ul type="disc">
6529: <li>
1.14 xtraeme 6530: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6531: if man pages are installed in compressed form by
6532: the package; see comment in <code xmlns=
1.45 wiz 6533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6534: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6535: </li>
6536:
6537: <li>
1.45 wiz 6538: <p>Replace <code xmlns=
6539: "http://www.w3.org/TR/xhtml1/transitional" class=
6540: "filename">/usr/local</code> with
6541: “<span class="quote">${PREFIX}</span>”
6542: in all files (see patches, below).</p>
1.1 grant 6543: </li>
6544:
6545: <li>
6546: <p>If the package installs any info files, see
6547: <a href="#faq.info-files" title=
1.45 wiz 6548: "15.5.7. Packages installing info files">Section 15.5.7,
6549: “Packages installing info
1.1 grant 6550: files”</a>.</p>
6551: </li>
6552: </ul>
6553: </div>
6554: </div>
6555:
1.52 ! tv 6556: <div class="sect1" lang="en">
1.1 grant 6557: <div class="titlepage">
6558: <div>
6559: <div>
6560: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6561: "components.distinfo"></a>8.2. <code xmlns=
6562: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6563: "filename">distinfo</code></h2>
1.1 grant 6564: </div>
6565: </div>
6566: </div>
6567:
1.50 rillig 6568: <p>The <code xmlns=
6569: "http://www.w3.org/TR/xhtml1/transitional" class=
6570: "filename">distinfo</code> file contains the message
6571: digest, or checksum, of each distfile needed for the
6572: package. This ensures that the distfiles retrieved from
6573: the Internet have not been corrupted during transfer or
6574: altered by a malign force to introduce a security hole.
6575: Due to recent rumor about weaknesses of digest
6576: algorithms, all distfiles are protected using both SHA1
6577: and RMD160 message digests, as well as the file size.</p>
6578:
6579: <p>The <code xmlns=
6580: "http://www.w3.org/TR/xhtml1/transitional" class=
6581: "filename">distinfo</code> file also contains the
6582: checksums for all the patches found in the <code xmlns=
6583: "http://www.w3.org/TR/xhtml1/transitional" class=
6584: "filename">patches</code> directory (see <a href=
6585: "#components.patches" title=
6586: "8.3. patches/*">Section 8.3,
6587: “patches/*”</a>).</p>
6588:
6589: <p>To regenerate the <code xmlns=
6590: "http://www.w3.org/TR/xhtml1/transitional" class=
6591: "filename">distinfo</code> file, use the
1.14 xtraeme 6592: <span><strong class="command">make
1.50 rillig 6593: makedistinfo</strong></span> or <span><strong class=
6594: "command">make mdi</strong></span> command.</p>
1.1 grant 6595:
1.50 rillig 6596: <p>Some packages have different sets of distfiles
6597: depending on the platform, for example <a xmlns=
1.1 grant 6598: "http://www.w3.org/TR/xhtml1/transitional" href=
6599: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6600: target="_top"><code xmlns="" class=
6601: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6602: the same <code xmlns=
1.45 wiz 6603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6604: "filename">distinfo</code> file and care should be taken
6605: when upgrading such a package to ensure distfile
6606: information is not lost.</p>
1.1 grant 6607: </div>
6608:
1.52 ! tv 6609: <div class="sect1" lang="en">
1.1 grant 6610: <div class="titlepage">
6611: <div>
6612: <div>
6613: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6614: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6615: </div>
6616: </div>
6617: </div>
6618:
6619: <p>This directory contains files that are used by the
6620: <a href=
6621: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6622: <span class="citerefentry"><span class=
6623: "refentrytitle">patch</span>(1)</span></a> command to
6624: modify the sources as distributed in the distribution
6625: file into a form that will compile and run perfectly on
6626: NetBSD. The files are applied successively in alphabetic
6627: order (as returned by a shell “<span class=
6628: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6629: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6630: class="filename">patch-aa</code> is applied before
6631: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6632: class="filename">patch-ab</code>, etc.</p>
6633:
6634: <p>The <code xmlns=
6635: "http://www.w3.org/TR/xhtml1/transitional" class=
6636: "filename">patch-*</code> files should be in
6637: <span><strong class="command">diff -bu</strong></span>
6638: format, and apply without a fuzz to avoid problems. (To
6639: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6640: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6641: not put changes for more than one file into a single
1.47 reed 6642: patch file, as this will make future modifications more
1.1 grant 6643: difficult.</p>
6644:
6645: <p>Similar, a file should be patched at most once, not
6646: several times by several different patches. If a file
6647: needs several patches, they should be combined into one
6648: file.</p>
6649:
6650: <p>One important thing to mention is to pay attention
6651: that no RCS IDs get stored in the patch files, as these
6652: will cause problems when later checked into the NetBSD
1.14 xtraeme 6653: CVS tree. Use the <span><strong class=
6654: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6655: "http://www.w3.org/TR/xhtml1/transitional" href=
6656: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6657: target="_top"><code xmlns="" class=
6658: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6659: these problems.</p>
1.1 grant 6660:
6661: <p>For even more automation, we recommend using
1.14 xtraeme 6662: <span><strong class="command">mkpatches</strong></span>
6663: from the same package to make a whole set of patches. You
6664: just have to backup files before you edit them to
1.45 wiz 6665: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6666: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6667: <span><strong class="command">cp -p filename
6668: filename.orig</strong></span> or, easier, by using
6669: <span><strong class="command">pkgvi</strong></span> again
6670: from the same package. If you upgrade a package this way,
6671: you can easily compare the new set of patches with the
6672: previously existing one with <span><strong class=
6673: "command">patchdiff</strong></span>.</p>
1.1 grant 6674:
6675: <p>When you have finished a package, remember to generate
6676: the checksums for the patch files by using the
1.14 xtraeme 6677: <span><strong class="command">make
6678: makepatchsum</strong></span> command, see <a href=
6679: "#components.distinfo" title=
1.38 dillo 6680: "8.2. distinfo">Section 8.2,
1.45 wiz 6681: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6682: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6683:
1.46 gdt 6684: <p>When adding a patch that corrects a problem in the
6685: distfile (rather than e.g. enforcing pkgsrc's view of
6686: where man pages should go), send the patch as a bug
6687: report to the maintainer. This benefits non-pkgsrc users
6688: of the package, and usually enables removing the patch in
6689: future version.</p>
6690:
1.1 grant 6691: <p>Patch files that are distributed by the author or
1.14 xtraeme 6692: other maintainers can be listed in <code class=
6693: "varname">$PATCHFILES</code>.</p>
1.1 grant 6694:
6695: <p>If it is desired to store any patches that should not
6696: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6697: pkgsrc tree in the <code xmlns=
6698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6699: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6700: tree there is expected to have the same
6701: “<span class="quote">category/package</span>”
6702: structure as pkgsrc, and patches are expected to be
1.45 wiz 6703: stored inside these dirs (also known as <code xmlns=
6704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6705: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
6706: if you want to keep a private patch for <code xmlns=
1.45 wiz 6707: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6708: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6709: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6710: class=
1.14 xtraeme 6711: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6712: files in the named directory are expected to be patch
1.1 grant 6713: files, and <span class="emphasis"><em>they are applied
6714: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6715: </div>
6716:
1.52 ! tv 6717: <div class="sect1" lang="en">
1.27 rillig 6718: <div class="titlepage">
6719: <div>
6720: <div>
6721: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6722: "other-mandatory-files"></a>8.4. Other
1.27 rillig 6723: mandatory files</h2>
6724: </div>
6725: </div>
6726: </div>
6727:
6728: <div class="variablelist">
6729: <dl>
1.45 wiz 6730: <dt><span class="term"><code xmlns=
6731: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6732: "filename">DESCR</code></span></dt>
6733:
6734: <dd>
6735: <p>A multi-line description of the piece of
6736: software. This should include any credits where
6737: they are due. Please bear in mind that others do
6738: not share your sense of humour (or spelling
6739: idiosyncrasies), and that others will read
6740: everything that you write here.</p>
6741: </dd>
6742:
1.45 wiz 6743: <dt><span class="term"><code xmlns=
6744: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6745: "filename">PLIST</code></span></dt>
6746:
6747: <dd>
6748: <p>This file governs the files that are installed
6749: on your system: all the binaries, manual pages,
6750: etc. There are other directives which may be
6751: entered in this file, to control the creation and
6752: deletion of directories, and the location of
6753: inserted files. See <a href="#plist" title=
1.38 dillo 6754: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 6755: <i>PLIST issues</i></a> for more information.</p>
6756: </dd>
6757: </dl>
6758: </div>
6759: </div>
6760:
1.52 ! tv 6761: <div class="sect1" lang="en">
1.27 rillig 6762: <div class="titlepage">
6763: <div>
6764: <div>
6765: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6766: "components.optional"></a>8.5. Optional
1.27 rillig 6767: files</h2>
6768: </div>
6769: </div>
6770: </div>
6771:
6772: <div class="variablelist">
6773: <dl>
1.45 wiz 6774: <dt><span class="term"><code xmlns=
6775: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6776: "filename">INSTALL</code></span></dt>
6777:
6778: <dd>
6779: <p>This shell script is invoked twice by <a href=
6780: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6781: <span class="citerefentry"><span class=
6782: "refentrytitle">pkg_add</span>(1)</span></a>. First
6783: time after package extraction and before files are
6784: moved in place, the second time after the files to
6785: install are moved in place. This can be used to do
6786: any custom procedures not possible with @exec
1.45 wiz 6787: commands in <code xmlns=
6788: "http://www.w3.org/TR/xhtml1/transitional" class=
6789: "filename">PLIST</code>. See <a href=
1.27 rillig 6790: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
6791: <span class="citerefentry"><span class=
6792: "refentrytitle">pkg_add</span>(1)</span></a> and
6793: <a href=
6794: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6795: <span class="citerefentry"><span class=
6796: "refentrytitle">pkg_create</span>(1)</span></a> for
6797: more information.</p>
6798: </dd>
6799:
1.45 wiz 6800: <dt><span class="term"><code xmlns=
6801: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6802: "filename">DEINSTALL</code></span></dt>
6803:
6804: <dd>
6805: <p>This script is executed before and after any
6806: files are removed. It is this script's
6807: responsibility to clean up any additional messy
6808: details around the package's installation, since
6809: all pkg_delete knows is how to delete the files
6810: created in the original distribution. See <a href=
6811: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
6812: <span class="citerefentry"><span class=
6813: "refentrytitle">pkg_delete</span>(1)</span></a> and
6814: <a href=
6815: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
6816: <span class="citerefentry"><span class=
6817: "refentrytitle">pkg_create</span>(1)</span></a> for
6818: more information.</p>
6819: </dd>
6820:
1.45 wiz 6821: <dt><span class="term"><code xmlns=
6822: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6823: "filename">MESSAGE</code></span></dt>
6824:
6825: <dd>
1.50 rillig 6826: <p>This file is displayed after installation of the
1.27 rillig 6827: package. Useful for things like legal notices on
6828: almost-free software and hints for updating config
6829: files after installing modules for apache, PHP etc.
6830: Please note that you can modify variables in it
6831: easily by using <code class=
6832: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 6833: <code xmlns=
6834: "http://www.w3.org/TR/xhtml1/transitional" class=
6835: "filename">Makefile</code>:</p>
1.27 rillig 6836: <pre class="programlisting">
1.51 rillig 6837: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 6838: </pre>
6839:
6840: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 6841: "quote">somevalue</span>” in <code xmlns=
6842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6843: "filename">MESSAGE</code>.</p>
6844: </dd>
6845: </dl>
6846: </div>
6847: </div>
6848:
1.52 ! tv 6849: <div class="sect1" lang="en">
1.27 rillig 6850: <div class="titlepage">
6851: <div>
6852: <div>
6853: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 6854: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 6855: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6856: "filename">work*</code></h2>
6857: </div>
6858: </div>
6859: </div>
6860:
6861: <p>When you type <span><strong class=
1.47 reed 6862: "command">make</strong></span>, the distribution files
6863: are unpacked into the directory denoted by <code class=
1.45 wiz 6864: "varname">WRKDIR</code>. It can be removed by running
6865: <span><strong class="command">make clean</strong></span>.
6866: Besides the sources, this directory is also used to keep
6867: various timestamp files. The directory gets <span class=
6868: "emphasis"><em>removed completely</em></span> on clean.
6869: The default is <code xmlns=
6870: "http://www.w3.org/TR/xhtml1/transitional" class=
6871: "filename">${.CURDIR}/work</code> or <code xmlns=
6872: "http://www.w3.org/TR/xhtml1/transitional" class=
6873: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
6874: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 6875: </div>
6876:
1.52 ! tv 6877: <div class="sect1" lang="en">
1.27 rillig 6878: <div class="titlepage">
6879: <div>
6880: <div>
6881: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6882: "files-dir"></a>8.7. <code xmlns=
6883: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6884: "filename">files/*</code></h2>
6885: </div>
6886: </div>
6887: </div>
6888:
6889: <p>If you have any files that you wish to be placed in
6890: the package prior to configuration or building, you could
6891: place these files here and use a “<span class=
6892: "quote">${CP}</span>” command in the
6893: “<span class="quote">pre-configure</span>”
6894: target to achieve this. Alternatively, you could simply
1.45 wiz 6895: diff the file against <code xmlns=
6896: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6897: "filename">/dev/null</code> and use the patch mechanism
6898: to manage the creation of this file.</p>
6899: </div>
6900: </div>
6901:
1.52 ! tv 6902: <div class="chapter" lang="en">
1.27 rillig 6903: <div class="titlepage">
6904: <div>
6905: <div>
1.52 ! tv 6906: <h2 class="title"><a name=
1.38 dillo 6907: "makefile"></a>Chapter 9. Programming in
1.45 wiz 6908: <code xmlns=
6909: "http://www.w3.org/TR/xhtml1/transitional" class=
6910: "filename">Makefile</code>s</h2>
1.27 rillig 6911: </div>
6912: </div>
6913: </div>
6914:
6915: <div class="toc">
6916: <p><b>Table of Contents</b></p>
6917:
6918: <dl>
6919: <dt><span class="sect1"><a href=
1.45 wiz 6920: "#makefile.variables">9.1. <code xmlns=
6921: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6922: "filename">Makefile</code> variables</a></span></dt>
6923:
6924: <dd>
6925: <dl>
6926: <dt><span class="sect2"><a href=
1.38 dillo 6927: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 6928: conventions</a></span></dt>
6929: </dl>
6930: </dd>
6931:
1.38 dillo 6932: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 6933: Code snippets</a></span></dt>
6934:
6935: <dd>
6936: <dl>
1.30 wiz 6937: <dt><span class="sect2"><a href=
1.38 dillo 6938: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 6939: list</a></span></dt>
1.27 rillig 6940:
1.30 wiz 6941: <dt><span class="sect2"><a href=
1.38 dillo 6942: "#converting-internal-to-external">9.2.2.
1.27 rillig 6943: Converting an internal list into an external
6944: list</a></span></dt>
6945:
1.30 wiz 6946: <dt><span class="sect2"><a href=
1.38 dillo 6947: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 6948: variables to a shell command</a></span></dt>
1.27 rillig 6949:
1.30 wiz 6950: <dt><span class="sect2"><a href=
1.38 dillo 6951: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 6952: guideline</a></span></dt>
1.27 rillig 6953:
1.30 wiz 6954: <dt><span class="sect2"><a href=
1.38 dillo 6955: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 6956: bug in BSD Make</a></span></dt>
1.27 rillig 6957: </dl>
6958: </dd>
6959: </dl>
6960: </div>
6961:
1.45 wiz 6962: <p>Pkgsrc consists of many <code xmlns=
6963: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6964: "filename">Makefile</code> fragments, each of which forms a
6965: well-defined part of the pkgsrc system. Using the <a href=
6966: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
6967: <span class="citerefentry"><span class=
6968: "refentrytitle">make</span>(1)</span></a> system as a
6969: programming language for a big system like pkgsrc requires
6970: some discipline to keep the code correct and
6971: understandable.</p>
6972:
1.45 wiz 6973: <p>The basic ingredients for <code xmlns=
6974: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6975: "filename">Makefile</code> programming are variables (which
6976: are actually macros) and shell commands. Among these shell
6977: commands may even be more complex ones like <a href=
6978: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
6979: <span class="citerefentry"><span class=
6980: "refentrytitle">awk</span>(1)</span></a> programs. To make
6981: sure that every shell command runs as intended it is
6982: necessary to quote all variables correctly when they are
6983: used.</p>
6984:
6985: <p>This chapter describes some patterns, that appear quite
1.45 wiz 6986: often in <code xmlns=
6987: "http://www.w3.org/TR/xhtml1/transitional" class=
6988: "filename">Makefile</code>s, including the pitfalls that
6989: come along with them.</p>
1.27 rillig 6990:
1.52 ! tv 6991: <div class="sect1" lang="en">
1.27 rillig 6992: <div class="titlepage">
6993: <div>
6994: <div>
6995: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6996: "makefile.variables"></a>9.1. <code xmlns=
6997: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6998: "filename">Makefile</code> variables</h2>
6999: </div>
7000: </div>
7001: </div>
7002:
1.45 wiz 7003: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7004: class="filename">Makefile</code> variables contain
7005: strings that can be processed using the five operators
7006: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7007: described in the <a href=
1.27 rillig 7008: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7009: <span class="citerefentry"><span class=
7010: "refentrytitle">make</span>(1)</span></a> man page.</p>
7011:
1.45 wiz 7012: <p>When a variable's value is parsed from a <code xmlns=
7013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7014: "filename">Makefile</code>, the hash character ``#'' and
7015: the backslash character ``\'' are handled specially. If a
7016: backslash is followed by a newline, any whitespace
7017: immediately in front of the backslash, the backslash, the
7018: newline, and any whitespace immediately behind the
7019: newline are replaced with a single space. A backspace
7020: character and an immediately following hash character are
1.47 reed 7021: replaced with a single hash character. Otherwise, the
1.27 rillig 7022: backslash is passed as is. In a variable assignment, any
7023: hash character that is not preceded by a backslash starts
7024: a comment that continues upto the end of the logical
7025: line.</p>
7026:
7027: <p><span class="emphasis"><em>Note:</em></span> Because
7028: of this parsing algorithm the only way to create a
7029: variable consisting of a single backslash is using the
7030: ``!='' operator, for example: <code class=
7031: "varname">BACKSLASH!=echo "\\"</code>.</p>
7032:
7033: <p>So far for defining variables. The other thing you can
7034: do with variables is evaluating them. A variable is
7035: evaluated when it is part of the right side of the ``:=''
7036: or the ``!='' operator, or directly before executing a
7037: shell command which the variable is part of. In all other
1.47 reed 7038: cases, <a href=
1.27 rillig 7039: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7040: <span class="citerefentry"><span class=
7041: "refentrytitle">make</span>(1)</span></a> performs lazy
7042: evaluation, that is, variables are not evaluated until
7043: there's no other way. The ``modifiers'' mentioned in the
7044: man page also evaluate the variable.</p>
7045:
7046: <p>Some of the modifiers split the string into words and
7047: then operate on the words, others operate on the string
1.47 reed 7048: as a whole. When a string is split into words, it is
7049: split as you would expect it from <a href=
1.27 rillig 7050: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7051: <span class="citerefentry"><span class=
7052: "refentrytitle">sh</span>(1)</span></a>.</p>
7053:
7054: <p>No rule without exception—the
7055: <span><strong class="command">.for</strong></span> loop
7056: does not follow the shell quoting rules but splits at
7057: sequences of whitespace.</p>
7058:
7059: <p>There are several types of variables that should be
7060: handled differently. Strings and two types of lists.</p>
7061:
7062: <div class="itemizedlist">
7063: <ul type="disc">
7064: <li>
7065: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7066: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7067: should restrict yourself to only using printable
7068: characters. Examples are <code class=
7069: "varname">PREFIX</code> and <code class=
7070: "varname">COMMENT</code>.</p>
7071: </li>
7072:
7073: <li>
7074: <p><span class="emphasis"><em>Internal
7075: lists</em></span> are lists that are never exported
7076: to any shell command. Their elements are separated
1.47 reed 7077: by whitespace. Therefore, the elements themselves
1.27 rillig 7078: cannot have embedded whitespace. Any other
7079: characters are allowed. Internal lists can be used
7080: in <span><strong class=
7081: "command">.for</strong></span> loops. Examples are
7082: <code class="varname">DEPENDS</code> and
7083: <code class="varname">BUILD_DEPENDS</code>.</p>
7084: </li>
7085:
7086: <li>
7087: <p><span class="emphasis"><em>External
7088: lists</em></span> are lists that may be exported to
7089: a shell command. Their elements can contain any
7090: characters, including whitespace. That's why they
7091: cannot be used in <span><strong class=
7092: "command">.for</strong></span> loops. Examples are
7093: <code class="varname">DISTFILES</code> and
7094: <code class="varname">MASTER_SITES</code>.</p>
7095: </li>
7096: </ul>
7097: </div>
7098:
1.52 ! tv 7099: <div class="sect2" lang="en">
1.27 rillig 7100: <div class="titlepage">
7101: <div>
7102: <div>
7103: <h3 class="title"><a name=
1.38 dillo 7104: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7105: conventions</h3>
7106: </div>
7107: </div>
7108: </div>
7109:
7110: <div class="itemizedlist">
7111: <ul type="disc">
7112: <li>
7113: <p>All variable names starting with an underscore
7114: are reserved for use by the pkgsrc
7115: infrastructure. They shall not be used by package
1.45 wiz 7116: <code xmlns=
7117: "http://www.w3.org/TR/xhtml1/transitional" class=
7118: "filename">Makefile</code>s.</p>
1.27 rillig 7119: </li>
7120:
7121: <li>
7122: <p>In <span><strong class=
7123: "command">.for</strong></span> loops you should
7124: use lowercase variable names for the iteration
7125: variables.</p>
7126: </li>
7127:
7128: <li>
7129: <p>All list variables should have a ``plural''
7130: name, e.g. <code class=
7131: "varname">PKG_OPTIONS</code> or <code class=
7132: "varname">DISTFILES</code>.</p>
7133: </li>
7134: </ul>
7135: </div>
7136: </div>
7137: </div>
7138:
1.52 ! tv 7139: <div class="sect1" lang="en">
1.27 rillig 7140: <div class="titlepage">
7141: <div>
7142: <div>
7143: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7144: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7145: </div>
7146: </div>
7147: </div>
7148:
7149: <p>This section presents you with some code snippets you
7150: should use in your own code. If you don't find anything
7151: appropriate here, you should test your code and add it
7152: here.</p>
7153:
1.52 ! tv 7154: <div class="sect2" lang="en">
1.27 rillig 7155: <div class="titlepage">
7156: <div>
7157: <div>
1.52 ! tv 7158: <h3 class="title"><a name=
1.38 dillo 7159: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7160: a list</h3>
1.27 rillig 7161: </div>
7162: </div>
7163: </div>
7164: <pre class="programlisting">
1.51 rillig 7165: STRING= foo * bar `date`
7166: INT_LIST= # empty
7167: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7168: EXT_LIST= # empty
7169: ANOTHER_EXT_LIST= a=b c=d
7170:
7171: INT_LIST+= ${STRING} # 1
7172: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7173: EXT_LIST+= ${STRING:Q} # 3
7174: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7175: </pre>
7176:
7177: <p>When you add a string to an external list (example
7178: 3), it must be quoted. In all other cases, you must not
7179: add a quoting level. You must not merge internal and
7180: external lists, unless you are sure that all entries
7181: are correctly interpreted in both lists.</p>
7182: </div>
7183:
1.52 ! tv 7184: <div class="sect2" lang="en">
1.27 rillig 7185: <div class="titlepage">
7186: <div>
7187: <div>
1.30 wiz 7188: <h3 class="title"><a name=
1.38 dillo 7189: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7190: an internal list into an external list</h3>
1.27 rillig 7191: </div>
7192: </div>
7193: </div>
7194: <pre class="programlisting">
1.51 rillig 7195: EXT_LIST= # empty
7196: .for i in ${INT_LIST}
7197: EXT_LIST+= ${i:Q}""
7198: .endfor
1.27 rillig 7199: </pre>
7200:
7201: <p>This code converts the internal list <code class=
7202: "varname">INT_LIST</code> into the external list
7203: <code class="varname">EXT_LIST</code>. As the elements
7204: of an internal list are unquoted they must be quoted
7205: here. The reason for appending <code class=
7206: "varname">""</code> is explained below.</p>
7207: </div>
1.1 grant 7208:
1.52 ! tv 7209: <div class="sect2" lang="en">
1.27 rillig 7210: <div class="titlepage">
1.1 grant 7211: <div>
1.27 rillig 7212: <div>
1.30 wiz 7213: <h3 class="title"><a name=
1.38 dillo 7214: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7215: variables to a shell command</h3>
1.27 rillig 7216: </div>
1.1 grant 7217: </div>
7218: </div>
1.27 rillig 7219: <pre class="programlisting">
1.51 rillig 7220: STRING= foo bar < > * `date` $$HOME ' "
7221: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7222:
1.51 rillig 7223: all:
7224: echo ${STRING} # 1
7225: echo "${STRING}" # 2
7226: echo "${STRING:Q}" # 3
7227: echo ${STRING:Q} # 4
7228: echo x${STRING:Q} | sed 1s,.,, # 5
7229: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7230: </pre>
7231:
7232: <p>Example 1 leads to a syntax error in the shell, as
7233: the characters are just copied.</p>
7234:
7235: <p>Example 2 leads to a syntax error too, and if you
7236: leave out the last " character from <code class=
7237: "varname">${STRING}</code>, <a href=
7238: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7239: <span class="citerefentry"><span class=
7240: "refentrytitle">date</span>(1)</span></a> will be
7241: executed. The <code class="varname">$HOME</code> shell
7242: variable would be evaluated, too.</p>
7243:
7244: <p>Example 3 outputs each space character preceded by a
7245: backslash (or not), depending on the implementation of
7246: the <a href=
7247: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7248: <span class="citerefentry"><span class=
7249: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7250:
1.27 rillig 7251: <p>Example 4 handles correctly every string that does
7252: not start with a dash. In that case, the result depends
7253: on the implementation of the <a href=
7254: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7255: <span class="citerefentry"><span class=
7256: "refentrytitle">echo</span>(1)</span></a> command. As
7257: long as you can guarantee that your input does not
1.47 reed 7258: start with a dash, this form is appropriate.</p>
1.1 grant 7259:
1.27 rillig 7260: <p>Example 5 handles even the case of a leading dash
7261: correctly.</p>
1.1 grant 7262:
1.27 rillig 7263: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7264: need to be quoted because the quoting has already been
1.27 rillig 7265: done when adding elements to the list.</p>
1.1 grant 7266:
1.27 rillig 7267: <p>As internal lists shall not be passed to the shell,
7268: there is no example for it.</p>
1.1 grant 7269: </div>
7270:
1.52 ! tv 7271: <div class="sect2" lang="en">
1.27 rillig 7272: <div class="titlepage">
1.1 grant 7273: <div>
1.27 rillig 7274: <div>
1.52 ! tv 7275: <h3 class="title"><a name=
1.38 dillo 7276: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7277: guideline</h3>
7278: </div>
1.1 grant 7279: </div>
7280: </div>
7281:
1.27 rillig 7282: <p>There are many possible sources of wrongly quoted
7283: variables. This section lists some of the commonly
7284: known ones.</p>
1.1 grant 7285:
1.27 rillig 7286: <div class="itemizedlist">
7287: <ul type="disc">
7288: <li>
7289: <p>Whenever you use the value of a list, think
7290: about what happens to leading or trailing
7291: whitespace. If the list is a well-formed shell
1.47 reed 7292: expression, you can apply the <code class=
1.27 rillig 7293: "varname">:M*</code> modifier to strip leading
7294: and trailing whitespace from each word. The
7295: <code class="varname">:M</code> operator first
7296: splits its argument according to the rules of the
7297: shell, and then creates a new list consisting of
7298: all words that match the shell glob expression
7299: <code class="varname">*</code>, that is: all. One
7300: class of situations where this is needed is when
7301: adding a variable like <code class=
7302: "varname">CPPFLAGS</code> to <code class=
7303: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7304: script invokes other configure scripts, it strips
1.27 rillig 7305: the leading and trailing whitespace from the
7306: variable and then passes it to the other
7307: configure scripts. But these configure scripts
7308: expect the (child) <code class=
7309: "varname">CPPFLAGS</code> variable to be the same
7310: as the parent <code class=
7311: "varname">CPPFLAGS</code>. That's why we better
7312: pass the <code class="varname">CPPFLAGS</code>
7313: value properly trimmed. And here is how we do
7314: it:</p>
7315: <pre class="programlisting">
1.51 rillig 7316: CPPFLAGS= # empty
7317: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7318: CPPFLAGS+= ${MY_CPPFLAGS}
7319:
7320: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7321:
7322: all:
7323: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7324: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7325: </pre>
7326: </li>
1.1 grant 7327:
1.27 rillig 7328: <li>
7329: <p>The example above contains one bug: The
7330: <code class="varname">${PREFIX}</code> is a
7331: properly quoted shell expression, but there is
7332: the C compiler after it, which also expects a
7333: properly quoted string (this time in C syntax).
7334: The version above is therefore only correct if
7335: <code class="varname">${PREFIX}</code> does not
7336: have embedded backslashes or double quotes. If
7337: you want to allow these, you have to add another
7338: layer of quoting to each variable that is used as
7339: a C string literal. You cannot use the
7340: <code class="varname">:Q</code> operator for it,
7341: as this operator only works for the shell.</p>
7342: </li>
1.1 grant 7343:
1.27 rillig 7344: <li>
1.47 reed 7345: <p>Whenever a variable can be empty, the
1.27 rillig 7346: <code class="varname">:Q</code> operator can have
7347: surprising results. Here are two completely
7348: different cases which can be solved with the same
7349: trick.</p>
7350: <pre class="programlisting">
1.51 rillig 7351: EMPTY= # empty
7352: empty_test:
7353: for i in a ${EMPTY:Q} c; do \
7354: echo "$$i"; \
7355: done
7356:
7357: for_test:
7358: .for i in a:\ a:\test.txt
7359: echo ${i:Q}
7360: echo "foo"
7361: .endfor
1.1 grant 7362: </pre>
7363:
1.27 rillig 7364: <p>The first example will only print two of the
7365: three lines we might have expected. This is
7366: because <code class="varname">${EMPTY:Q}</code>
7367: expands to the empty string, which the shell
7368: cannot see. The workaround is to write
7369: <code class="varname">${EMPTY:Q}""</code>. This
7370: pattern can be often found as <code class=
7371: "varname">${TEST} -z ${VAR:Q}</code> or as
7372: <code class="varname">${TEST} -f
7373: ${FNAME:Q}</code> (both of these are wrong).</p>
7374:
7375: <p>The second example will only print three lines
7376: instead of four. The first line looks like
7377: <code class="varname">a:\ echo foo</code>. This
7378: is because the backslash of the value
7379: <code class="varname">a:\</code> is interpreted
7380: as a line-continuation by <a href=
7381: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7382: <span class="citerefentry"><span class=
7383: "refentrytitle">make</span>(1)</span></a>, which
7384: makes the second line the arguments of the
7385: <a href=
7386: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7387: <span class="citerefentry"><span class=
7388: "refentrytitle">echo</span>(1)</span></a> command
7389: from the first line. To avoid this, write
7390: <code class="varname">${i:Q}""</code>.</p>
7391: </li>
7392: </ul>
7393: </div>
1.1 grant 7394: </div>
7395:
1.52 ! tv 7396: <div class="sect2" lang="en">
1.27 rillig 7397: <div class="titlepage">
1.1 grant 7398: <div>
1.27 rillig 7399: <div>
1.30 wiz 7400: <h3 class="title"><a name=
1.38 dillo 7401: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7402: for a bug in BSD Make</h3>
1.27 rillig 7403: </div>
1.1 grant 7404: </div>
7405: </div>
7406:
1.27 rillig 7407: <p>The pkgsrc bmake program does not handle the
7408: following assignment correctly. In case <code class=
7409: "varname">_othervar_</code> contains a ``-'' character,
7410: one of the closing braces is included in <code class=
7411: "varname">${VAR}</code> after this code executes.</p>
7412: <pre class="programlisting">
1.51 rillig 7413: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7414: </pre>
7415:
1.27 rillig 7416: <p>For a more complex code snippet and a workaround,
7417: see the package <a xmlns=
7418: "http://www.w3.org/TR/xhtml1/transitional" href=
7419: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7420: target="_top"><code xmlns="" class=
7421: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7422: <code class="varname">bug1</code>.</p>
1.1 grant 7423: </div>
7424: </div>
7425: </div>
7426:
1.52 ! tv 7427: <div class="chapter" lang="en">
1.1 grant 7428: <div class="titlepage">
7429: <div>
7430: <div>
1.52 ! tv 7431: <h2 class="title"><a name=
1.38 dillo 7432: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7433: </div>
7434: </div>
7435: </div>
7436:
7437: <div class="toc">
7438: <p><b>Table of Contents</b></p>
7439:
7440: <dl>
1.38 dillo 7441: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7442: ID</a></span></dt>
7443:
1.30 wiz 7444: <dt><span class="sect1"><a href=
1.38 dillo 7445: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7446: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7447: class="filename">PLIST</code>
1.14 xtraeme 7448: generation</a></span></dt>
1.1 grant 7449:
1.38 dillo 7450: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7451: Tweaking output of <span><strong class="command">make
7452: print-PLIST</strong></span></a></span></dt>
1.1 grant 7453:
1.38 dillo 7454: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7455: Variable substitution in PLIST</a></span></dt>
7456:
1.30 wiz 7457: <dt><span class="sect1"><a href=
1.48 dillo 7458: "#manpage-compression">10.5. Man page
7459: compression</a></span></dt>
1.1 grant 7460:
1.38 dillo 7461: <dt><span class="sect1"><a href=
7462: "#using-PLIST_SRC">10.6. Changing PLIST source with
7463: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7464:
1.30 wiz 7465: <dt><span class="sect1"><a href=
1.47 reed 7466: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7467: differing PLISTs</a></span></dt>
1.1 grant 7468:
1.38 dillo 7469: <dt><span class="sect1"><a href=
7470: "#faq.common-dirs">10.8. Sharing directories between
7471: packages</a></span></dt>
1.1 grant 7472: </dl>
7473: </div>
7474:
1.45 wiz 7475: <p>The <code xmlns=
7476: "http://www.w3.org/TR/xhtml1/transitional" class=
7477: "filename">PLIST</code> file contains a package's
7478: “<span class="quote">packing list</span>”, i.e.
7479: a list of files that belong to the package (relative to the
7480: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7481: class="filename">${PREFIX}</code> directory it's been
7482: installed in) plus some additional statements - see the
7483: <a href=
1.1 grant 7484: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7485: <span class="citerefentry"><span class=
1.47 reed 7486: "refentrytitle">pkg_create</span>(1)</span></a> man page
7487: for a full list. This chapter addresses some issues that
7488: need attention when dealing with the <code xmlns=
1.45 wiz 7489: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7490: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7491:
1.52 ! tv 7492: <div class="sect1" lang="en">
1.1 grant 7493: <div class="titlepage">
7494: <div>
7495: <div>
7496: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 7497: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7498: </div>
7499: </div>
7500: </div>
7501:
7502: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7503: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7504: class="filename">PLIST</code> file you write:</p>
1.1 grant 7505: <pre class="programlisting">
1.51 rillig 7506: @comment $NetBSD$
1.1 grant 7507: </pre>
7508: </div>
7509:
1.52 ! tv 7510: <div class="sect1" lang="en">
1.1 grant 7511: <div class="titlepage">
7512: <div>
7513: <div>
7514: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7515: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7516: <code xmlns=
7517: "http://www.w3.org/TR/xhtml1/transitional" class=
7518: "filename">PLIST</code> generation</h2>
1.1 grant 7519: </div>
7520: </div>
7521: </div>
7522:
1.14 xtraeme 7523: <p>You can use the <span><strong class="command">make
7524: print-PLIST</strong></span> command to output a PLIST
7525: that matches any new files since the package was
7526: extracted. See <a href="#build.helpful-targets" title=
1.38 dillo 7527: "14.3. Other helpful targets">Section 14.3,
1.1 grant 7528: “Other helpful targets”</a> for more
7529: information on this target.</p>
7530: </div>
7531:
1.52 ! tv 7532: <div class="sect1" lang="en">
1.1 grant 7533: <div class="titlepage">
7534: <div>
7535: <div>
7536: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7537: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7538: <span><strong class="command">make
7539: print-PLIST</strong></span></h2>
1.1 grant 7540: </div>
7541: </div>
7542: </div>
7543:
7544: <p>If you have used any of the *-dirs packages, as
7545: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7546: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7547: “Sharing directories between packages”</a>,
1.14 xtraeme 7548: you may have noticed that <span><strong class=
7549: "command">make print-PLIST</strong></span> outputs a set
7550: of <code class="varname">@comment</code>s instead of real
7551: <code class="varname">@dirrm</code> lines. You can also
7552: do this for specific directories and files, so that the
7553: results of that command are very close to reality. This
7554: helps <span class="emphasis"><em>a lot</em></span> during
7555: the update of packages.</p>
7556:
7557: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7558: variable takes a set of AWK patterns and actions that are
7559: used to filter the output of print-PLIST. You can
7560: <span class="emphasis"><em>append</em></span> any chunk
7561: of AWK scripting you like to it, but be careful with
1.1 grant 7562: quoting.</p>
7563:
1.45 wiz 7564: <p>For example, to get all files inside the <code xmlns=
7565: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7566: "filename">libdata/foo</code> directory removed from the
1.1 grant 7567: resulting PLIST:</p>
7568: <pre class="programlisting">
1.51 rillig 7569: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7570: </pre>
7571:
1.14 xtraeme 7572: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7573: lines referring to a specific (shared) directory
1.14 xtraeme 7574: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7575: <pre class="programlisting">
1.51 rillig 7576: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7577: </pre>
7578: </div>
7579:
1.52 ! tv 7580: <div class="sect1" lang="en">
1.1 grant 7581: <div class="titlepage">
7582: <div>
7583: <div>
7584: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7585: "plist.misc"></a>10.4. Variable substitution
7586: in PLIST</h2>
1.1 grant 7587: </div>
7588: </div>
7589: </div>
7590:
7591: <p>A number of variables are substituted automatically in
7592: PLISTs when a package is installed on a system. This
7593: includes the following variables:</p>
7594:
7595: <div class="variablelist">
7596: <dl>
1.14 xtraeme 7597: <dt><span class="term"><code class=
7598: "varname">${MACHINE_ARCH}</code>, <code class=
7599: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7600:
7601: <dd>
7602: <p>Some packages like emacs and perl embed
7603: information about which architecture they were
7604: built on into the pathnames where they install
1.47 reed 7605: their files. To handle this case, PLIST will be
1.1 grant 7606: preprocessed before actually used, and the symbol
1.14 xtraeme 7607: “<span class="quote"><code class=
7608: "varname">${MACHINE_ARCH}</code></span>” will
7609: be replaced by what <span><strong class=
7610: "command">uname -p</strong></span> gives. The same
7611: is done if the string <code class=
7612: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7613: PLIST somewhere - use this on packages that have
1.47 reed 7614: GNU autoconf-created configure scripts.</p>
1.1 grant 7615:
7616: <div class="note" style=
7617: "margin-left: 0.5in; margin-right: 0.5in;">
7618: <h3 class="title">Legacy note</h3>
7619:
7620: <p>There used to be a symbol “<span class=
1.14 xtraeme 7621: "quote"><code class=
7622: "varname">$ARCH</code></span>” that was
7623: replaced by the output of <span><strong class=
7624: "command">uname -m</strong></span>, but that's no
1.1 grant 7625: longer supported and has been removed.</p>
7626: </div>
7627: </dd>
7628:
1.14 xtraeme 7629: <dt><span class="term"><code class=
7630: "varname">${OPSYS}</code>, <code class=
7631: "varname">${LOWER_OPSYS}</code>, <code class=
7632: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7633:
7634: <dd>
7635: <p>Some packages want to embed the OS name and
7636: version into some paths. To do this, use these
1.45 wiz 7637: variables in the <code xmlns=
7638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7639: "filename">PLIST</code>:</p>
1.1 grant 7640:
7641: <div class="itemizedlist">
7642: <ul type="disc">
7643: <li>
1.14 xtraeme 7644: <p><code class="varname">${OPSYS}</code> -
7645: output of “<span class=
7646: "quote"><span><strong class="command">uname
7647: -s</strong></span></span>”</p>
1.1 grant 7648: </li>
7649:
7650: <li>
1.14 xtraeme 7651: <p><code class=
7652: "varname">${LOWER_OPSYS}</code> - lowercase
7653: common name (eg. “<span class=
7654: "quote">solaris</span>”)</p>
1.1 grant 7655: </li>
7656:
7657: <li>
1.14 xtraeme 7658: <p><code class="varname">${OS_VERSION}</code>
7659: - “<span class=
7660: "quote"><span><strong class="command">uname
7661: -r</strong></span></span>”</p>
1.1 grant 7662: </li>
7663: </ul>
7664: </div>
7665: </dd>
7666:
1.14 xtraeme 7667: <dt><span class="term"><code class=
7668: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7669:
7670: <dd>
7671: <p>Packages that install locale files should list
7672: them in the PLIST as “<span class=
7673: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7674: instead of “<span class=
7675: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7676: This properly handles the fact that different
7677: operating systems expect locale files to be either
1.45 wiz 7678: in <code xmlns=
7679: "http://www.w3.org/TR/xhtml1/transitional" class=
7680: "filename">share</code> or <code xmlns=
7681: "http://www.w3.org/TR/xhtml1/transitional" class=
7682: "filename">lib</code> by default.</p>
1.1 grant 7683: </dd>
7684: </dl>
7685: </div>
7686:
7687: <p>For a complete list of values which are replaced by
1.45 wiz 7688: default, please look in <code xmlns=
7689: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7690: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7691: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7692:
7693: <p>If you want to change other variables not listed
7694: above, you can add variables and their expansions to this
1.14 xtraeme 7695: variable in the following way, similar to <code class=
7696: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7697: "#components.optional" title=
1.38 dillo 7698: "8.5. Optional files">Section 8.5,
1.1 grant 7699: “Optional files”</a>):</p>
7700: <pre class="programlisting">
1.51 rillig 7701: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 7702: </pre>
7703:
7704: <p>This replaces all occurrences of “<span class=
7705: "quote">${SOMEVAR}</span>” in the PLIST with
7706: “<span class="quote">somevalue</span>”.</p>
7707: </div>
7708:
1.52 ! tv 7709: <div class="sect1" lang="en">
1.1 grant 7710: <div class="titlepage">
7711: <div>
7712: <div>
7713: <h2 class="title" style="clear: both"><a name=
1.48 dillo 7714: "manpage-compression"></a>10.5. Man page
7715: compression</h2>
1.1 grant 7716: </div>
7717: </div>
7718: </div>
7719:
1.47 reed 7720: <p>Man pages should be installed in compressed form if
1.45 wiz 7721: <code class="varname">MANZ</code> is set (in <code xmlns=
7722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7723: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 7724: otherwise. To handle this in the <code xmlns=
7725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7726: "filename">PLIST</code> file, the suffix
7727: “<span class="quote">.gz</span>” is
1.47 reed 7728: appended/removed automatically for man pages according to
1.14 xtraeme 7729: <code class="varname">MANZ</code> and <code class=
7730: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 7731: above for details. This modification of the <code xmlns=
7732: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7733: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 7734: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7735: class="filename">PLIST</code> itself.</p>
1.1 grant 7736: </div>
7737:
1.52 ! tv 7738: <div class="sect1" lang="en">
1.1 grant 7739: <div class="titlepage">
7740: <div>
7741: <div>
7742: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7743: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 7744: source with <code class=
1.14 xtraeme 7745: "varname">PLIST_SRC</code></h2>
1.1 grant 7746: </div>
7747: </div>
7748: </div>
7749:
1.14 xtraeme 7750: <p>To use one or more files as source for the
1.45 wiz 7751: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7752: class="filename">PLIST</code> used in generating the
7753: binary package, set the variable <code class=
1.14 xtraeme 7754: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 7755: The files are later concatenated using <a href=
7756: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
7757: <span class="citerefentry"><span class=
7758: "refentrytitle">cat</span>(1)</span></a>, and order of
7759: things is important.</p>
1.1 grant 7760: </div>
7761:
1.52 ! tv 7762: <div class="sect1" lang="en">
1.1 grant 7763: <div class="titlepage">
7764: <div>
7765: <div>
7766: <h2 class="title" style="clear: both"><a name=
1.47 reed 7767: "platform-specific-plist"></a>10.7. Platform-specific
7768: and differing PLISTs</h2>
1.1 grant 7769: </div>
7770: </div>
7771: </div>
7772:
7773: <p>Some packages decide to install a different set of
7774: files based on the operating system being used. These
7775: differences can be automatically handled by using the
7776: following files:</p>
7777:
7778: <div class="itemizedlist">
7779: <ul type="disc">
7780: <li>
1.45 wiz 7781: <p><code xmlns=
7782: "http://www.w3.org/TR/xhtml1/transitional" class=
7783: "filename">PLIST.common</code></p>
1.1 grant 7784: </li>
7785:
7786: <li>
1.45 wiz 7787: <p><code xmlns=
7788: "http://www.w3.org/TR/xhtml1/transitional" class=
7789: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 7790: </li>
7791:
7792: <li>
1.45 wiz 7793: <p><code xmlns=
7794: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7795: "filename">PLIST.${MACHINE_ARCH}</code></p>
7796: </li>
7797:
7798: <li>
1.45 wiz 7799: <p><code xmlns=
7800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 7801: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
7802: </li>
7803:
7804: <li>
1.45 wiz 7805: <p><code xmlns=
7806: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7807: "filename">PLIST.common_end</code></p>
1.1 grant 7808: </li>
7809: </ul>
7810: </div>
7811: </div>
7812:
1.52 ! tv 7813: <div class="sect1" lang="en">
1.1 grant 7814: <div class="titlepage">
7815: <div>
7816: <div>
7817: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7818: "faq.common-dirs"></a>10.8. Sharing
7819: directories between packages</h2>
1.1 grant 7820: </div>
7821: </div>
7822: </div>
7823:
7824: <p>A “<span class="quote">shared
7825: directory</span>” is a directory where multiple
7826: (and unrelated) packages install files. These directories
7827: are problematic because you have to add special tricks in
7828: the PLIST to conditionally remove them, or have some
7829: centralized package handle them.</p>
7830:
7831: <p>Within pkgsrc, you'll find both approaches. If a
7832: directory is shared by a few unrelated packages, it's
7833: often not worth to add an extra package to remove it.
7834: Therefore, one simply does:</p>
7835: <pre class="programlisting">
1.51 rillig 7836: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 7837: </pre>
7838:
7839: <p>in the PLISTs of all affected packages, instead of the
7840: regular "@dirrm" line.</p>
7841:
7842: <p>However, if the directory is shared across many
7843: packages, two different solutions are available:</p>
7844:
7845: <div class="orderedlist">
7846: <ol type="1">
7847: <li>
7848: <p>If the packages have a common dependency, the
7849: directory can be removed in that. For example, see
7850: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
7851: href=
7852: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 7853: target="_top"><code xmlns="" class=
7854: "filename">textproc/scrollkeeper</code></a>, which
7855: removes the shared directory <code xmlns=
7856: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 7857: "filename">share/omf</code>.</p>
1.1 grant 7858: </li>
7859:
7860: <li>
7861: <p>If the packages using the directory are not
7862: related at all (they have no common dependencies),
7863: a *-dirs package is used.</p>
7864: </li>
7865: </ol>
7866: </div>
7867:
7868: <p>From now on, we'll discuss the second solution. To get
7869: an idea of the *-dirs packages available, issue:</p>
7870: <pre class="programlisting">
1.51 rillig 7871: <code class="prompt">%</code> cd .../pkgsrc
7872: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 7873: </pre>
7874:
7875: <p>Their use from other packages is very simple. The
1.14 xtraeme 7876: <code class="varname">USE_DIRS</code> variable takes a
7877: list of package names (without the “<span class=
1.1 grant 7878: "quote">-dirs</span>” part) together with the
7879: required version number (always pick the latest one when
1.34 wiz 7880: writing new packages).</p>
1.1 grant 7881:
7882: <p>For example, if a package installs files under
1.45 wiz 7883: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7884: class="filename">share/applications</code>, it should
7885: have the following line in it:</p>
1.1 grant 7886: <pre class="programlisting">
1.51 rillig 7887: USE_DIRS+= xdg-1.1
1.1 grant 7888: </pre>
7889:
1.14 xtraeme 7890: <p>After regenerating the PLIST using
7891: <span><strong class="command">make
7892: print-PLIST</strong></span>, you should get the right
7893: (commented out) lines.</p>
1.1 grant 7894:
1.47 reed 7895: <p>Note that even if your package is using <code xmlns=
1.45 wiz 7896: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7897: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 7898: *-x11-dirs packages. Just specify the name without that
1.45 wiz 7899: part and pkgsrc (in particular, <code xmlns=
7900: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7901: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 7902: </div>
7903: </div>
7904:
1.52 ! tv 7905: <div class="chapter" lang="en">
1.1 grant 7906: <div class="titlepage">
7907: <div>
7908: <div>
1.52 ! tv 7909: <h2 class="title"><a name=
1.38 dillo 7910: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 7911: methodology</h2>
7912: </div>
7913: </div>
7914: </div>
7915:
7916: <div class="toc">
7917: <p><b>Table of Contents</b></p>
7918:
7919: <dl>
1.30 wiz 7920: <dt><span class="sect1"><a href=
1.38 dillo 7921: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 7922: to use buildlink3</a></span></dt>
1.1 grant 7923:
1.30 wiz 7924: <dt><span class="sect1"><a href=
1.45 wiz 7925: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
7926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7927: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 7928:
7929: <dd>
7930: <dl>
1.25 rillig 7931: <dt><span class="sect2"><a href=
1.38 dillo 7932: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 7933: buildlink3.mk file</a></span></dt>
1.1 grant 7934:
1.25 rillig 7935: <dt><span class="sect2"><a href=
1.38 dillo 7936: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 7937: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 7938: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 7939: <code xmlns=
7940: "http://www.w3.org/TR/xhtml1/transitional" class=
7941: "filename">buildlink3.mk</code>
1.1 grant 7942: files</a></span></dt>
7943: </dl>
7944: </dd>
7945:
1.30 wiz 7946: <dt><span class="sect1"><a href=
1.45 wiz 7947: "#writing-builtin.mk">11.3. Writing <code xmlns=
7948: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 7949: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 7950:
7951: <dd>
7952: <dl>
1.25 rillig 7953: <dt><span class="sect2"><a href=
1.38 dillo 7954: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 7955: <code xmlns=
7956: "http://www.w3.org/TR/xhtml1/transitional" class=
7957: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 7958:
1.25 rillig 7959: <dt><span class="sect2"><a href=
1.38 dillo 7960: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 7961: preferences for native or pkgsrc
7962: software</a></span></dt>
1.1 grant 7963: </dl>
7964: </dd>
7965: </dl>
7966: </div>
7967:
7968: <p>Buildlink is a framework in pkgsrc that controls what
7969: headers and libraries are seen by a package's configure and
7970: build processes. This is implemented in a two step
7971: process:</p>
7972:
7973: <div class="orderedlist">
7974: <ol type="1">
7975: <li>
7976: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 7977: into <code class="varname">BUILDLINK_DIR</code>,
7978: which by default is a subdirectory of <code class=
7979: "varname">WRKDIR</code>.</p>
1.1 grant 7980: </li>
7981:
7982: <li>
7983: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 7984: the normal compiler tools that translate <code class=
7985: "option">-I${LOCALBASE}/include</code> and
7986: <code class="option">-L${LOCALBASE}/lib</code> into
7987: references to <code class=
7988: "varname">BUILDLINK_DIR</code>. The wrapper scripts
7989: also make native compiler on some operating systems
7990: look like GCC, so that packages that expect GCC won't
7991: require modifications to build with those native
7992: compilers.</p>
1.1 grant 7993: </li>
7994: </ol>
7995: </div>
7996:
7997: <p>This normalizes the environment in which a package is
7998: built so that the package may be built consistently despite
7999: what other software may be installed. Please note that the
1.45 wiz 8000: normal system header and library paths, e.g. <code xmlns=
8001: "http://www.w3.org/TR/xhtml1/transitional" class=
8002: "filename">/usr/include</code>, <code xmlns=
8003: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8004: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8005: buildlink3 is designed to insulate the package build from
8006: non-system-supplied software.</p>
8007:
1.52 ! tv 8008: <div class="sect1" lang="en">
1.1 grant 8009: <div class="titlepage">
8010: <div>
8011: <div>
8012: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8013: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8014: packages to use buildlink3</h2>
1.1 grant 8015: </div>
8016: </div>
8017: </div>
8018:
8019: <p>The process of converting packages to use the
8020: buildlink3 framework (“<span class=
8021: "quote">bl3ifying</span>”) is fairly
8022: straightforward. The things to keep in mind are:</p>
8023:
8024: <div class="orderedlist">
8025: <ol type="1">
8026: <li>
8027: <p>Ensure that the build always calls the wrapper
8028: scripts instead of the actual toolchain. Some
8029: packages are tricky, and the only way to know for
1.45 wiz 8030: sure is the check <code xmlns=
8031: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8032: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8033: wrappers are being invoked.</p>
8034: </li>
8035:
8036: <li>
1.14 xtraeme 8037: <p>Don't override <code class=
8038: "varname">PREFIX</code> from within the package
8039: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8040: because the code to symlink files into <code xmlns=
8041: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8042: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8043: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8044: <em class=
8045: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8046: </li>
8047:
8048: <li>
8049: <p>Remember that <span class=
1.45 wiz 8050: "emphasis"><em>only</em></span> the <code xmlns=
8051: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8052: "filename">buildlink3.mk</code> files that you list
1.1 grant 8053: in a package's Makefile are added as dependencies
8054: for that package.</p>
8055: </li>
8056: </ol>
8057: </div>
8058:
8059: <p>If a dependency on a particular package is required
8060: for its libraries and headers, then we replace:</p>
8061: <pre class="programlisting">
1.51 rillig 8062: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8063: </pre>
8064:
8065: <p>with</p>
8066: <pre class="programlisting">
1.51 rillig 8067: .include "../../category/foo/buildlink3.mk"
1.1 grant 8068: </pre>
8069:
1.47 reed 8070: <p>The buildlink3.mk files usually define the required
8071: dependencies. If you need a newer version of the
8072: dependency when using buildlink3.mk files, then you can
8073: define it in your Makefile; for example:</p>
8074: <pre class="programlisting">
1.51 rillig 8075: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8076: .include "../../category/foo/buildlink3.mk"
1.47 reed 8077: </pre>
8078:
1.45 wiz 8079: <p>There are several <code xmlns=
8080: "http://www.w3.org/TR/xhtml1/transitional" class=
8081: "filename">buildlink3.mk</code> files in <code xmlns=
8082: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8083: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8084: issues:</p>
8085:
8086: <div class="itemizedlist">
8087: <ul type="disc">
8088: <li>
1.45 wiz 8089: <p><code xmlns=
8090: "http://www.w3.org/TR/xhtml1/transitional" class=
8091: "filename">bdb.buildlink3.mk</code> chooses either
8092: the native or a pkgsrc Berkeley DB implementation
8093: based on the values of <code class=
1.14 xtraeme 8094: "varname">BDB_ACCEPTED</code> and <code class=
8095: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8096: </li>
8097:
8098: <li>
1.45 wiz 8099: <p><code xmlns=
8100: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8101: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8102: system comes with neither Curses nor NCurses, this
8103: will take care to install the <a xmlns=
8104: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8105: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8106: target="_top"><code xmlns="" class=
8107: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8108: </li>
8109:
8110: <li>
1.45 wiz 8111: <p><code xmlns=
8112: "http://www.w3.org/TR/xhtml1/transitional" class=
8113: "filename">krb5.buildlink3.mk</code> uses the value
8114: of <code class="varname">KRB5_ACCEPTED</code> to
8115: choose between adding a dependency on Heimdal or
8116: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8117: implementation.</p>
8118: </li>
8119:
8120: <li>
1.45 wiz 8121: <p><code xmlns=
8122: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8123: "filename">motif.buildlink3.mk</code> checks for a
8124: system-provided Motif installation or adds a
8125: dependency on <a xmlns=
1.1 grant 8126: "http://www.w3.org/TR/xhtml1/transitional" href=
8127: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8128: target="_top"><code xmlns="" class=
8129: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8130: "http://www.w3.org/TR/xhtml1/transitional" href=
8131: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8132: target="_top"><code xmlns="" class=
1.47 reed 8133: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8134: </li>
8135:
8136: <li>
1.45 wiz 8137: <p><code xmlns=
8138: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8139: "filename">ossaudio.buildlink3.mk</code> defines
8140: several variables that may be used by packages that
1.47 reed 8141: use the Open Sound System (OSS) API.</p>
1.1 grant 8142: </li>
8143:
8144: <li>
1.45 wiz 8145: <p><code xmlns=
8146: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8147: "filename">pgsql.buildlink3.mk</code> will accept
8148: either Postgres 7.3 or 7.4, whichever is found
8149: installed. See the file for more information.</p>
1.1 grant 8150: </li>
8151:
8152: <li>
1.45 wiz 8153: <p><code xmlns=
8154: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8155: "filename">pthread.buildlink3.mk</code> uses the
8156: value of <code class="varname">PTHREAD_OPTS</code>
8157: and checks for native pthreads or adds a dependency
8158: on <a xmlns=
1.1 grant 8159: "http://www.w3.org/TR/xhtml1/transitional" href=
8160: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8161: target="_top"><code xmlns="" class=
1.47 reed 8162: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8163: </li>
8164:
8165: <li>
1.45 wiz 8166: <p><code xmlns=
8167: "http://www.w3.org/TR/xhtml1/transitional" class=
8168: "filename">xaw.buildlink3.mk</code> uses the value
8169: of <code class="varname">XAW_TYPE</code> to choose
8170: a particular Athena widgets library.</p>
1.1 grant 8171: </li>
8172: </ul>
8173: </div>
8174:
1.45 wiz 8175: <p>The comments in those <code xmlns=
8176: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8177: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8178: complete description of how to use them properly.</p>
8179: </div>
8180:
1.52 ! tv 8181: <div class="sect1" lang="en">
1.1 grant 8182: <div class="titlepage">
8183: <div>
8184: <div>
8185: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8186: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8187: <code xmlns=
8188: "http://www.w3.org/TR/xhtml1/transitional" class=
8189: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8190: </div>
8191: </div>
8192: </div>
8193:
1.45 wiz 8194: <p>A package's <code xmlns=
8195: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8196: "filename">buildlink3.mk</code> file is included by
8197: Makefiles to indicate the need to compile and link
8198: against header files and libraries provided by the
1.45 wiz 8199: package. A <code xmlns=
8200: "http://www.w3.org/TR/xhtml1/transitional" class=
8201: "filename">buildlink3.mk</code> file should always
8202: provide enough information to add the correct type of
8203: dependency relationship and include any other
8204: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8205: class="filename">buildlink3.mk</code> files that it needs
8206: to find headers and libraries that it needs in turn.</p>
1.1 grant 8207:
1.45 wiz 8208: <p>To generate an initial <code xmlns=
8209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8210: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8211: Rene Hexel's <a xmlns=
8212: "http://www.w3.org/TR/xhtml1/transitional" href=
8213: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8214: target="_top"><code xmlns="" class=
8215: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8216: highly recommended. For most packages, the following
8217: command will generate a good starting point for
1.45 wiz 8218: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8219: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8220: <pre class="screen">
1.14 xtraeme 8221: <code class="prompt">%</code> <strong class=
8222: "userinput"><code>cd pkgsrc/<em class=
8223: "replaceable"><code>category</code></em>/<em class=
8224: "replaceable"><code>pkgdir</code></em>
8225: <code class=
1.49 rillig 8226: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8227: </pre>
8228:
1.52 ! tv 8229: <div class="sect2" lang="en">
1.1 grant 8230: <div class="titlepage">
8231: <div>
8232: <div>
1.52 ! tv 8233: <h3 class="title"><a name=
! 8234: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8235: buildlink3.mk file</h3>
1.1 grant 8236: </div>
8237: </div>
8238: </div>
8239:
1.45 wiz 8240: <p>The following real-life example <code xmlns=
8241: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8242: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8243: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8244: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8245: <pre class="programlisting">
1.51 rillig 8246: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8247:
1.51 rillig 8248: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8249: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8250:
1.51 rillig 8251: .if !empty(BUILDLINK_DEPTH:M+)
8252: BUILDLINK_DEPENDS+= tiff
8253: .endif
1.1 grant 8254:
1.51 rillig 8255: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8256: BUILDLINK_PACKAGES+= tiff
1.1 grant 8257:
1.51 rillig 8258: .if !empty(TIFF_BUILDLINK3_MK:M+)
8259: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8260: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8261: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8262:
1.51 rillig 8263: .include "../../devel/zlib/buildlink3.mk"
8264: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8265:
1.51 rillig 8266: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8267: </pre>
8268:
1.14 xtraeme 8269: <p>The header and footer manipulate <code class=
8270: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8271: across all <code xmlns=
8272: "http://www.w3.org/TR/xhtml1/transitional" class=
8273: "filename">buildlink3.mk</code> files and is used to
8274: track at what depth we are including <code xmlns=
8275: "http://www.w3.org/TR/xhtml1/transitional" class=
8276: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8277:
8278: <p>The first section controls if the dependency on
1.14 xtraeme 8279: <em class="replaceable"><code>pkg</code></em> is added.
8280: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8281: global list of packages for which dependencies are
8282: added by buildlink3.</p>
8283:
8284: <p>The second section advises pkgsrc that the
1.45 wiz 8285: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8286: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8287: <em class="replaceable"><code>pkg</code></em> has been
8288: included at some point. <code class=
8289: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8290: of packages for which <code xmlns=
8291: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8292: "filename">buildlink3.mk</code> files have been
8293: included. It must <span class=
8294: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8295: a <code xmlns=
8296: "http://www.w3.org/TR/xhtml1/transitional" class=
8297: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8298:
8299: <p>The third section is protected from multiple
1.14 xtraeme 8300: inclusion and controls how the dependency on <em class=
8301: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8302: important variables are set in the section:</p>
8303:
8304: <div class="itemizedlist">
8305: <ul type="disc">
8306: <li>
1.14 xtraeme 8307: <p><code class=
8308: "varname">BUILDLINK_DEPENDS.<em class=
8309: "replaceable"><code>pkg</code></em></code> is the
8310: actual dependency recorded in the installed
8311: package; this should always be set using
8312: <span><strong class="command">+=</strong></span>
8313: to ensure that we're appending to any
8314: pre-existing list of values. This variable should
8315: be set to the first version of the package that
8316: had the last change in the major number of a
8317: shared library or that had a major API
8318: change.</p>
1.1 grant 8319: </li>
8320:
8321: <li>
1.14 xtraeme 8322: <p><code class=
8323: "varname">BUILDLINK_PKGSRCDIR.<em class=
8324: "replaceable"><code>pkg</code></em></code> is the
8325: location of the <em class=
8326: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8327: directory.</p>
1.1 grant 8328: </li>
8329:
8330: <li>
1.14 xtraeme 8331: <p><code class=
8332: "varname">BUILDLINK_DEPMETHOD.<em class=
8333: "replaceable"><code>pkg</code></em></code> (not
8334: shown above) controls whether we use <code class=
8335: "varname">BUILD_DEPENDS</code> or <code class=
8336: "varname">DEPENDS</code> to add the dependency on
8337: <em class="replaceable"><code>pkg</code></em>.
8338: The build dependency is selected by setting
8339: <code class=
8340: "varname">BUILDLINK_DEPMETHOD.<em class=
8341: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8342: “<span class="quote">build</span>”.
8343: By default, the full dependency is used.</p>
8344: </li>
8345:
8346: <li>
1.14 xtraeme 8347: <p><code class=
8348: "varname">BUILDLINK_INCDIRS.<em class=
8349: "replaceable"><code>pkg</code></em></code> and
8350: <code class=
1.52 ! tv 8351: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
! 8352: (not shown above) are lists of subdirectories of
! 8353: <code xmlns=
1.45 wiz 8354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8355: "filename">${BUILDLINK_PREFIX.<em class=
8356: "replaceable"><code>pkg</code></em>}</code> to
8357: add to the header and library search paths. These
1.1 grant 8358: default to “<span class=
8359: "quote">include</span>” and
8360: “<span class="quote">lib</span>”
8361: respectively.</p>
8362: </li>
8363:
8364: <li>
1.14 xtraeme 8365: <p><code class=
8366: "varname">BUILDLINK_CPPFLAGS.<em class=
8367: "replaceable"><code>pkg</code></em></code> (not
8368: shown above) is the list of preprocessor flags to
8369: add to <code class="varname">CPPFLAGS</code>,
8370: which are passed on to the configure and build
8371: phases. The “<span class=
8372: "quote">-I</span>” option should be avoided
8373: and instead be handled using <code class=
8374: "varname">BUILDLINK_INCDIRS.<em class=
8375: "replaceable"><code>pkg</code></em></code> as
8376: above.</p>
1.1 grant 8377: </li>
8378: </ul>
8379: </div>
8380:
8381: <p>The following variables are all optionally defined
8382: within this second section (protected against multiple
8383: inclusion) and control which package files are
1.45 wiz 8384: symlinked into <code xmlns=
8385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8386: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8387: are transformed during the symlinking:</p>
8388:
8389: <div class="itemizedlist">
8390: <ul type="disc">
8391: <li>
1.14 xtraeme 8392: <p><code class=
8393: "varname">BUILDLINK_FILES.<em class=
8394: "replaceable"><code>pkg</code></em></code> (not
8395: shown above) is a shell glob pattern relative to
1.45 wiz 8396: <code xmlns=
8397: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8398: "filename">${BUILDLINK_PREFIX.<em class=
8399: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8400: symlinked into <code xmlns=
8401: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8402: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8403: <code xmlns=
8404: "http://www.w3.org/TR/xhtml1/transitional" class=
8405: "filename">include/*.h</code>.</p>
1.1 grant 8406: </li>
8407:
8408: <li>
1.14 xtraeme 8409: <p><code class=
8410: "varname">BUILDLINK_FILES_CMD.<em class=
8411: "replaceable"><code>pkg</code></em></code> (not
8412: shown above) is a shell pipeline that outputs to
1.45 wiz 8413: stdout a list of files relative to <code xmlns=
8414: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8415: "filename">${BUILDLINK_PREFIX.<em class=
8416: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8417: resulting files are to be symlinked into
1.45 wiz 8418: <code xmlns=
8419: "http://www.w3.org/TR/xhtml1/transitional" class=
8420: "filename">${BUILDLINK_DIR}</code>. By default,
8421: this takes the <code xmlns=
8422: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8423: "filename">+CONTENTS</code> of a <em class=
8424: "replaceable"><code>pkg</code></em> and filters
8425: it through <code class=
8426: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8427: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8428: </li>
8429:
8430: <li>
1.14 xtraeme 8431: <p><code class=
8432: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8433: "replaceable"><code>pkg</code></em></code> (not
8434: shown above) is a filter command that filters
1.45 wiz 8435: <code xmlns=
8436: "http://www.w3.org/TR/xhtml1/transitional" class=
8437: "filename">+CONTENTS</code> input into a list of
8438: files relative to <code xmlns=
8439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8440: "filename">${BUILDLINK_PREFIX.<em class=
8441: "replaceable"><code>pkg</code></em>}</code> on
8442: stdout. By default for overwrite packages,
8443: <code class=
8444: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8445: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8446: outputs the contents of the <code xmlns=
8447: "http://www.w3.org/TR/xhtml1/transitional" class=
8448: "filename">include</code> and <code xmlns=
8449: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8450: "filename">lib</code> directories in the package
1.45 wiz 8451: <code xmlns=
8452: "http://www.w3.org/TR/xhtml1/transitional" class=
8453: "filename">+CONTENTS</code>, and for pkgviews
8454: packages, it outputs any libtool archives in
8455: <code xmlns=
8456: "http://www.w3.org/TR/xhtml1/transitional" class=
8457: "filename">lib</code> directories.</p>
1.1 grant 8458: </li>
8459:
8460: <li>
1.14 xtraeme 8461: <p><code class=
8462: "varname">BUILDLINK_TRANSFORM.<em class=
8463: "replaceable"><code>pkg</code></em></code> (not
8464: shown above) is a list of sed arguments used to
1.1 grant 8465: transform the name of the source filename into a
1.14 xtraeme 8466: destination filename, e.g. <span><strong class=
1.1 grant 8467: "command">-e
1.14 xtraeme 8468: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8469: </li>
8470: </ul>
8471: </div>
8472:
1.45 wiz 8473: <p>The last section includes any <code xmlns=
8474: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8475: "filename">buildlink3.mk</code> needed for <em class=
8476: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8477: dependencies. Including these <code xmlns=
8478: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8479: "filename">buildlink3.mk</code> files means that the
8480: headers and libraries for these dependencies are also
1.45 wiz 8481: symlinked into <code xmlns=
8482: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8483: "filename">${BUILDLINK_DIR}</code> whenever the
8484: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8485: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8486: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8487: included.</p>
1.1 grant 8488: </div>
8489:
1.52 ! tv 8490: <div class="sect2" lang="en">
1.1 grant 8491: <div class="titlepage">
8492: <div>
8493: <div>
1.30 wiz 8494: <h3 class="title"><a name=
1.52 ! tv 8495: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8496: <code class=
1.52 ! tv 8497: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
! 8498: in <code xmlns=
1.45 wiz 8499: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8500: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8501: </div>
8502: </div>
8503: </div>
8504:
8505: <p>There are two situations that require increasing the
1.14 xtraeme 8506: dependency listed in <code class=
8507: "varname">BUILDLINK_DEPENDS.<em class=
8508: "replaceable"><code>pkg</code></em></code> after a
8509: package update:</p>
1.1 grant 8510:
8511: <div class="orderedlist">
8512: <ol type="1">
8513: <li>
8514: <p>if the sonames (major number of the library
8515: version) of any installed shared libraries
1.47 reed 8516: change.</p>
1.1 grant 8517: </li>
8518:
8519: <li>
8520: <p>if the API or interface to the header files
8521: change.</p>
8522: </li>
8523: </ol>
8524: </div>
8525:
1.14 xtraeme 8526: <p>In these cases, <code class=
8527: "varname">BUILDLINK_DEPENDS.<em class=
8528: "replaceable"><code>pkg</code></em></code> should be
8529: adjusted to require at least the new package version.
8530: In some cases, the packages that depend on this new
8531: version may need their <code class=
8532: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8533: have <code xmlns=
8534: "http://www.w3.org/TR/xhtml1/transitional" class=
8535: "filename">buildlink3.mk</code> files, their
8536: <code class="varname">BUILDLINK_DEPENDS.<em class=
8537: "replaceable"><code>pkg</code></em></code> adjusted,
8538: too. This is needed so that binary packages made using
8539: it will require the correct package dependency and not
8540: settle for an older one which will not contain the
8541: necessary shared libraries.</p>
1.1 grant 8542:
8543: <p>Please take careful consideration before adjusting
1.14 xtraeme 8544: <code class="varname">BUILDLINK_DEPENDS.<em class=
8545: "replaceable"><code>pkg</code></em></code> as we don't
8546: want to cause unneeded package deletions and rebuilds.
8547: In many cases, new versions of packages work just fine
8548: with older dependencies. See <a href="#dependencies"
1.52 ! tv 8549: title=
! 8550: "15.1.4. Handling dependencies">Section 15.1.4,
! 8551: “Handling dependencies”</a> for more
! 8552: information about dependencies on other packages,
1.25 rillig 8553: including the <code class=
8554: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8555: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8556: </div>
8557: </div>
8558:
1.52 ! tv 8559: <div class="sect1" lang="en">
1.1 grant 8560: <div class="titlepage">
8561: <div>
8562: <div>
8563: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8564: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8565: <code xmlns=
8566: "http://www.w3.org/TR/xhtml1/transitional" class=
8567: "filename">builtin.mk</code> files</h2>
1.1 grant 8568: </div>
8569: </div>
8570: </div>
8571:
8572: <p>Some packages in pkgsrc install headers and libraries
8573: that coincide with headers and libraries present in the
1.45 wiz 8574: base system. Aside from a <code xmlns=
8575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8576: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8577: should also include a <code xmlns=
8578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8579: "filename">builtin.mk</code> file that includes the
8580: necessary checks to decide whether using the built-in
8581: software or the pkgsrc software is appropriate.</p>
1.1 grant 8582:
8583: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8584: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8585:
8586: <div class="orderedlist">
8587: <ol type="1">
8588: <li>
1.14 xtraeme 8589: <p>It should set <code class=
8590: "varname">USE_BUILTIN.<em class=
8591: "replaceable"><code>pkg</code></em></code> to
8592: either “<span class="quote">yes</span>”
8593: or “<span class="quote">no</span>”
8594: after it is included.</p>
1.1 grant 8595: </li>
8596:
8597: <li>
8598: <p>It should <span class=
8599: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8600: <code class="varname">USE_BUILTIN.<em class=
8601: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8602: already set before the <code xmlns=
8603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8604: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8605: </li>
8606:
8607: <li>
8608: <p>It should be written to allow multiple
8609: inclusion. This is <span class=
8610: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8611: careful attention to <code xmlns=
8612: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8613: "filename">Makefile</code> coding.</p>
1.1 grant 8614: </li>
8615: </ol>
8616: </div>
8617:
1.52 ! tv 8618: <div class="sect2" lang="en">
1.1 grant 8619: <div class="titlepage">
8620: <div>
8621: <div>
1.52 ! tv 8622: <h3 class="title"><a name=
1.38 dillo 8623: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8624: of a <code xmlns=
8625: "http://www.w3.org/TR/xhtml1/transitional" class=
8626: "filename">builtin.mk</code> file</h3>
1.1 grant 8627: </div>
8628: </div>
8629: </div>
8630:
8631: <p>The following is the recommended template for
8632: builtin.mk files:</p>
8633: <pre class="programlisting">
1.51 rillig 8634: .if !defined(IS_BUILTIN.foo)
8635: #
8636: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8637: # genuinely exists in the system or not.
8638: #
8639: IS_BUILTIN.foo?= no
8640:
8641: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8642: # version can be determined.
8643: #
8644: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8645: BUILTIN_PKG.foo?= foo-1.0
8646: . endif
8647: .endif # IS_BUILTIN.foo
8648:
8649: .if !defined(USE_BUILTIN.foo)
8650: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8651: . if defined(BUILTIN_PKG.foo)
8652: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8653: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8654: USE_BUILTIN.foo!= \
8655: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8656: ${ECHO} "yes"; \
8657: else \
8658: ${ECHO} "no"; \
8659: fi
8660: . endif
8661: . endfor
8662: . endif
8663: .endif # USE_BUILTIN.foo
8664:
8665: CHECK_BUILTIN.foo?= no
8666: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8667: #
8668: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8669: # "yes" or "no".
8670: #
8671: .endif # CHECK_BUILTIN.foo
1.1 grant 8672: </pre>
8673:
1.14 xtraeme 8674: <p>The first section sets <code class=
8675: "varname">IS_BUILTIN.<em class=
8676: "replaceable"><code>pkg</code></em></code> depending on
8677: if <em class="replaceable"><code>pkg</code></em> really
8678: exists in the base system. This should not be a base
8679: system software with similar functionality to
8680: <em class="replaceable"><code>pkg</code></em>; it
8681: should only be “<span class=
8682: "quote">yes</span>” if the actual package is
8683: included as part of the base system. This variable is
1.45 wiz 8684: only used internally within the <code xmlns=
8685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8686: "filename">builtin.mk</code> file.</p>
8687:
8688: <p>The second section sets <code class=
8689: "varname">BUILTIN_PKG.<em class=
8690: "replaceable"><code>pkg</code></em></code> to the
8691: version of <em class=
8692: "replaceable"><code>pkg</code></em> in the base system
8693: if it exists (if <code class=
8694: "varname">IS_BUILTIN.<em class=
8695: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8696: “<span class="quote">yes</span>”). This
1.14 xtraeme 8697: variable is only used internally within the
1.45 wiz 8698: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8699: class="filename">builtin.mk</code> file.</p>
1.1 grant 8700:
1.14 xtraeme 8701: <p>The third section sets <code class=
8702: "varname">USE_BUILTIN.<em class=
8703: "replaceable"><code>pkg</code></em></code> and is
8704: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 8705: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8706: class="filename">builtin.mk</code> files. The code in
8707: this section must make the determination whether the
8708: built-in software is adequate to satisfy the
8709: dependencies listed in <code class=
1.14 xtraeme 8710: "varname">BUILDLINK_DEPENDS.<em class=
8711: "replaceable"><code>pkg</code></em></code>. This is
8712: typically done by comparing <code class=
8713: "varname">BUILTIN_PKG.<em class=
8714: "replaceable"><code>pkg</code></em></code> against each
8715: of the dependencies in <code class=
8716: "varname">BUILDLINK_DEPENDS.<em class=
8717: "replaceable"><code>pkg</code></em></code>.
8718: <code class="varname">USE_BUILTIN.<em class=
8719: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 8720: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 8721: value by the end of the <code xmlns=
8722: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8723: "filename">builtin.mk</code> file. Note that
8724: <code class="varname">USE_BUILTIN.<em class=
8725: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 8726: “<span class="quote">yes</span>” even if
1.14 xtraeme 8727: <code class="varname">IS_BUILTIN.<em class=
8728: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8729: “<span class="quote">no</span>” because we
8730: may make the determination that the built-in version of
8731: the software is similar enough to be used as a
8732: replacement.</p>
8733:
1.14 xtraeme 8734: <p>The last section is guarded by <code class=
8735: "varname">CHECK_BUILTIN.<em class=
8736: "replaceable"><code>pkg</code></em></code>, and
8737: includes code that uses the value of <code class=
8738: "varname">USE_BUILTIN.<em class=
8739: "replaceable"><code>pkg</code></em></code> set in the
8740: previous section. This typically includes, e.g., adding
1.1 grant 8741: additional dependency restrictions and listing
1.45 wiz 8742: additional files to symlink into <code xmlns=
8743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8744: "filename">${BUILDLINK_DIR}</code> (via <code class=
8745: "varname">BUILDLINK_FILES.<em class=
8746: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 8747: </div>
8748:
1.52 ! tv 8749: <div class="sect2" lang="en">
1.1 grant 8750: <div class="titlepage">
8751: <div>
8752: <div>
1.30 wiz 8753: <h3 class="title"><a name=
1.38 dillo 8754: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 8755: preferences for native or pkgsrc software</h3>
1.1 grant 8756: </div>
8757: </div>
8758: </div>
8759:
8760: <p>When building packages, it's possible to choose
8761: whether to set a global preference for using either the
8762: built-in (native) version or the pkgsrc version of
8763: software to satisfy a dependency. This is controlled by
1.14 xtraeme 8764: setting <code class="varname">PREFER_PKGSRC</code> and
8765: <code class="varname">PREFER_NATIVE</code>. These
8766: variables take values of either “<span class=
1.1 grant 8767: "quote">yes</span>”, “<span class=
8768: "quote">no</span>”, or a list of packages.
1.14 xtraeme 8769: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
8770: to use the pkgsrc versions of software, while
8771: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
8772: to use the built-in versions. Preferences are
8773: determined by the most specific instance of the package
8774: in either <code class="varname">PREFER_PKGSRC</code> or
8775: <code class="varname">PREFER_NATIVE</code>. If a
8776: package is specified in neither or in both variables,
8777: then <code class="varname">PREFER_PKGSRC</code> has
8778: precedence over <code class=
8779: "varname">PREFER_NATIVE</code>. For example, to require
8780: using pkgsrc versions of software for all but the most
8781: basic bits on a NetBSD system, you can set:</p>
1.1 grant 8782: <pre class="programlisting">
1.51 rillig 8783: PREFER_PKGSRC= yes
8784: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 8785: </pre>
8786:
8787: <p>A package <span class=
1.45 wiz 8788: "emphasis"><em>must</em></span> have a <code xmlns=
8789: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8790: "filename">builtin.mk</code> file to be listed in
8791: <code class="varname">PREFER_NATIVE</code>, otherwise
8792: it is simply ignored in that list.</p>
1.1 grant 8793: </div>
8794: </div>
8795: </div>
8796:
1.52 ! tv 8797: <div class="chapter" lang="en">
1.1 grant 8798: <div class="titlepage">
8799: <div>
8800: <div>
1.52 ! tv 8801: <h2 class="title"><a name=
1.38 dillo 8802: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 8803: framework</h2>
1.1 grant 8804: </div>
8805: </div>
8806: </div>
8807:
8808: <div class="toc">
8809: <p><b>Table of Contents</b></p>
8810:
8811: <dl>
1.30 wiz 8812: <dt><span class="sect1"><a href=
1.38 dillo 8813: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 8814: directories outside the installation
8815: prefix</a></span></dt>
8816:
8817: <dd>
8818: <dl>
8819: <dt><span class="sect2"><a href=
1.38 dillo 8820: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 8821: manipulation</a></span></dt>
8822:
8823: <dt><span class="sect2"><a href=
1.38 dillo 8824: "#files-outside-prefix">12.1.2. File
1.35 jmmv 8825: manipulation</a></span></dt>
8826: </dl>
8827: </dd>
8828:
1.38 dillo 8829: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 8830: Configuration files</a></span></dt>
8831:
8832: <dd>
8833: <dl>
8834: <dt><span class="sect2"><a href=
1.38 dillo 8835: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 8836: "varname">PKG_SYSCONFDIR</code> is
8837: set</a></span></dt>
8838:
8839: <dt><span class="sect2"><a href=
1.38 dillo 8840: "#conf-files-configure">12.2.2. Telling the
1.47 reed 8841: software where configuration files
1.35 jmmv 8842: are</a></span></dt>
8843:
8844: <dt><span class="sect2"><a href=
1.38 dillo 8845: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 8846: installations</a></span></dt>
8847:
8848: <dt><span class="sect2"><a href=
1.38 dillo 8849: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 8850: configuration files</a></span></dt>
8851: </dl>
8852: </dd>
8853:
1.38 dillo 8854: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 8855: System startup scripts</a></span></dt>
8856:
8857: <dd>
8858: <dl>
8859: <dt><span class="sect2"><a href=
1.38 dillo 8860: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 8861: of system startup scripts</a></span></dt>
8862: </dl>
8863: </dd>
1.1 grant 8864:
1.30 wiz 8865: <dt><span class="sect1"><a href=
1.38 dillo 8866: "#users-and-groups">12.4. System users and
1.35 jmmv 8867: groups</a></span></dt>
8868:
1.38 dillo 8869: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 8870: shells</a></span></dt>
8871:
8872: <dd>
8873: <dl>
8874: <dt><span class="sect2"><a href=
1.38 dillo 8875: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 8876: configuration files</a></span></dt>
8877: </dl>
8878: </dd>
1.1 grant 8879: </dl>
8880: </div>
8881:
1.35 jmmv 8882: <p>This chapter describes the framework known as
8883: <code class="literal">pkginstall</code>, whose key features
8884: are:</p>
8885:
8886: <div class="itemizedlist">
8887: <ul type="disc">
8888: <li>
8889: <p>Generic installation and manipulation of
8890: directories and files outside the pkgsrc-handled
8891: tree, <code class="varname">LOCALBASE</code>.</p>
8892: </li>
8893:
8894: <li>
8895: <p>Automatic handling of configuration files during
8896: installation, provided that packages are correctly
8897: designed.</p>
8898: </li>
8899:
8900: <li>
8901: <p>Generation and installation of system startup
8902: scripts.</p>
8903: </li>
8904:
8905: <li>
8906: <p>Registration of system users and groups.</p>
8907: </li>
8908:
8909: <li>
8910: <p>Registration of system shells.</p>
8911: </li>
8912: </ul>
8913: </div>
8914:
8915: <p>The following sections inspect each of the above points
1.47 reed 8916: in detail. Note that in order to use any of the described
1.35 jmmv 8917: functionalities, you must add the following to your
1.45 wiz 8918: package's <code xmlns=
8919: "http://www.w3.org/TR/xhtml1/transitional" class=
8920: "filename">Makefile</code>:</p>
1.35 jmmv 8921: <pre class="programlisting">
1.51 rillig 8922: USE_PKGINSTALL= YES
1.35 jmmv 8923: </pre>
8924:
8925: <p>You may be thinking that many of the things described
8926: here could be easily done with simple code in the package's
8927: post-installation target (<code class=
8928: "literal">post-install</code>). <span class=
8929: "emphasis"><em>This is incorrect</em></span>, as the code
8930: in them is only executed when building from source.
8931: Machines using binary packages could not benefit from it at
8932: all (as the code itself could be unavailable). Therefore,
8933: the only way to achieve any of the items described above is
8934: by means of the installation scripts, which are
8935: automatically generated by pkginstall.</p>
1.1 grant 8936:
1.52 ! tv 8937: <div class="sect1" lang="en">
1.1 grant 8938: <div class="titlepage">
8939: <div>
8940: <div>
8941: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 8942: "files-and-dirs-outside-prefix"></a>12.1. Files
! 8943: and directories outside the installation
! 8944: prefix</h2>
1.1 grant 8945: </div>
8946: </div>
8947: </div>
8948:
1.45 wiz 8949: <p>As you already know, the <code xmlns=
8950: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8951: "filename">PLIST</code> file holds a list of files and
8952: directories that belong to a package. The names used in
1.45 wiz 8953: it are relative to the installation prefix (<code xmlns=
8954: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8955: "filename">${PREFIX}</code>), which means that it cannot
8956: register files outside this directory (absolute path
8957: names are not allowed). Despite this restriction, some
8958: packages need to install files outside this location;
1.45 wiz 8959: e.g., under <code xmlns=
8960: "http://www.w3.org/TR/xhtml1/transitional" class=
8961: "filename">${VARBASE}</code> or <code xmlns=
8962: "http://www.w3.org/TR/xhtml1/transitional" class=
8963: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 8964:
8965: <p>The only way to achieve this is to create such files
8966: during installation time by using the installation
8967: scripts. These scripts can run arbitrary commands, so
8968: they have the potential to create and manage files
1.47 reed 8969: anywhere in the file system. Here is where pkginstall
1.35 jmmv 8970: comes into play: it provides generic scripts to abstract
8971: the manipulation of such files and directories based on
1.45 wiz 8972: variables set in the package's <code xmlns=
8973: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 8974: "filename">Makefile</code>. The rest of this section
1.47 reed 8975: describes these variables.</p>
1.1 grant 8976:
1.52 ! tv 8977: <div class="sect2" lang="en">
1.35 jmmv 8978: <div class="titlepage">
1.1 grant 8979: <div>
1.35 jmmv 8980: <div>
1.52 ! tv 8981: <h3 class="title"><a name=
! 8982: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 8983: manipulation</h3>
8984: </div>
1.1 grant 8985: </div>
8986: </div>
8987:
1.35 jmmv 8988: <p>The following variables can be set to request the
1.47 reed 8989: creation of directories anywhere in the file
8990: system:</p>
1.27 rillig 8991:
1.35 jmmv 8992: <div class="itemizedlist">
8993: <ul type="disc">
8994: <li>
8995: <p><code class="varname">MAKE_DIRS</code> and
8996: <code class="varname">OWN_DIRS</code> contain a
8997: list of directories that should be created and
8998: should attempt to be destroyed by the
8999: installation scripts. The difference between the
9000: two is that the latter prompts the administrator
9001: to remove any directories that may be left after
9002: deinstallation (because they were not empty),
9003: while the former does not.</p>
9004: </li>
1.1 grant 9005:
1.35 jmmv 9006: <li>
9007: <p><code class="varname">MAKE_DIRS_PERMS</code>
9008: and <code class="varname">OWN_DIRS_PERMS</code>
9009: contain a list of tuples describing which
9010: directories should be created and should attempt
9011: to be destroyed by the installation scripts. Each
9012: tuple holds the following values, separated by
9013: spaces: the directory name, its owner, its group
9014: and its numerical mode. For example:</p>
9015: <pre class="programlisting">
1.51 rillig 9016: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9017: </pre>
1.1 grant 9018:
1.35 jmmv 9019: <p>The difference between the two is exactly the
9020: same as their non-<code class=
9021: "varname">PERMS</code> counterparts.</p>
9022: </li>
9023: </ul>
9024: </div>
9025: </div>
9026:
1.52 ! tv 9027: <div class="sect2" lang="en">
1.35 jmmv 9028: <div class="titlepage">
9029: <div>
9030: <div>
1.52 ! tv 9031: <h3 class="title"><a name=
! 9032: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9033: manipulation</h3>
9034: </div>
9035: </div>
9036: </div>
9037:
9038: <p>Creating non-empty files outside the installation
1.45 wiz 9039: prefix is tricky because the <code xmlns=
9040: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9041: "filename">PLIST</code> forces all files to be inside
9042: it. To overcome this problem, the only solution is to
9043: extract the file in the known place (i.e., inside the
9044: installation prefix) and copy it to the appropriate
9045: location during installation (done by the installation
9046: scripts generated by pkginstall). We will call the
9047: former the <span class="emphasis"><em>master
9048: file</em></span> in the following paragraphs, which
9049: describe the variables that can be used to
9050: automatically and consistently handle files outside the
9051: installation prefix:</p>
9052:
9053: <div class="itemizedlist">
9054: <ul type="disc">
9055: <li>
9056: <p><code class="varname">CONF_FILES</code> and
9057: <code class="varname">SUPPORT_FILES</code> are
9058: pairs of master and target files. During
9059: installation time, the master file is copied to
9060: the target one if and only if the latter does not
9061: exist. Upon deinstallation, the target file is
9062: removed provided that it was not modified by the
9063: installation.</p>
9064:
9065: <p>The difference between the two is that the
9066: latter prompts the administrator to remove any
9067: files that may be left after deinstallation
9068: (because they were not empty), while the former
9069: does not.</p>
9070: </li>
9071:
9072: <li>
9073: <p><code class="varname">CONF_FILES_PERMS</code>
9074: and <code class=
9075: "varname">SUPPORT_FILES_PERMS</code> contain
9076: tuples describing master files as well as their
9077: target locations. For each of them, it also
9078: specifies their owner, their group and their
9079: numeric permissions, in this order. For
9080: example:</p>
9081: <pre class="programlisting">
1.51 rillig 9082: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9083: </pre>
9084:
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: </div>
9093:
1.52 ! tv 9094: <div class="sect1" lang="en">
1.35 jmmv 9095: <div class="titlepage">
9096: <div>
9097: <div>
9098: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 9099: "conf-files"></a>12.2. Configuration
! 9100: files</h2>
1.35 jmmv 9101: </div>
9102: </div>
9103: </div>
9104:
9105: <p>Configuration files are special in the sense that they
9106: are installed in their own specific directory,
9107: <code class="varname">PKG_SYSCONFDIR</code>, and need
9108: special treatment during installation (most of which is
9109: automated by pkginstall). The main concept you must bear
1.36 wiz 9110: in mind is that files marked as configuration files are
1.35 jmmv 9111: automatically copied to the right place (somewhere inside
9112: <code class="varname">PKG_SYSCONFDIR</code>) during
9113: installation <span class="emphasis"><em>if and only
9114: if</em></span> they didn't exist before. Similarly, they
9115: will not be removed if they have local modifications.
1.36 wiz 9116: This ensures that administrators never lose any custom
1.35 jmmv 9117: changes they may have made.</p>
9118:
1.52 ! tv 9119: <div class="sect2" lang="en">
1.35 jmmv 9120: <div class="titlepage">
9121: <div>
9122: <div>
1.52 ! tv 9123: <h3 class="title"><a name=
! 9124: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9125: <code class="varname">PKG_SYSCONFDIR</code> is
9126: set</h3>
9127: </div>
9128: </div>
9129: </div>
9130:
9131: <p>As said before, the <code class=
9132: "varname">PKG_SYSCONFDIR</code> variable specifies
9133: where configuration files shall be installed. Its
9134: contents are set based upon the following
9135: variables:</p>
9136:
9137: <div class="itemizedlist">
9138: <ul type="disc">
9139: <li>
9140: <p><code class="varname">PKG_SYSCONFBASE</code>:
9141: The configuration's root directory. Defaults to
1.45 wiz 9142: <code xmlns=
9143: "http://www.w3.org/TR/xhtml1/transitional" class=
9144: "filename">${PREFIX}/etc</code> although it may
9145: be overridden by the user to point to his
9146: preferred location (e.g., <code xmlns=
9147: "http://www.w3.org/TR/xhtml1/transitional" class=
9148: "filename">/etc</code>, <code xmlns=
9149: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9150: "filename">/etc/pkg</code>, etc.). Packages must
9151: not use it directly.</p>
9152: </li>
9153:
9154: <li>
9155: <p><code class=
9156: "varname">PKG_SYSCONFSUBDIR</code>: A
9157: subdirectory of <code class=
9158: "varname">PKG_SYSCONFBASE</code> under which the
9159: configuration files for the package being built
9160: shall be installed. The definition of this
9161: variable only makes sense in the package's
1.45 wiz 9162: <code xmlns=
9163: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9164: "filename">Makefile</code> (i.e., it is not
9165: user-customizable).</p>
1.35 jmmv 9166:
9167: <p>As an example, consider the Apache package,
9168: <a xmlns=
9169: "http://www.w3.org/TR/xhtml1/transitional" href=
9170: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9171: target="_top"><code xmlns="" class=
9172: "filename">www/apache2</code></a>, which places
9173: its configuration files under the <code xmlns=
9174: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9175: "filename">httpd/</code> subdirectory of
9176: <code class="varname">PKG_SYSCONFBASE</code>.
9177: This should be set in the package Makefile.</p>
9178: </li>
9179:
9180: <li>
9181: <p><code class="varname">PKG_SYSCONFVAR</code>:
9182: Specifies the name of the variable that holds
9183: this package's configuration directory (if
9184: different from <code class=
9185: "varname">PKG_SYSCONFBASE</code>). It defaults to
9186: <code class="varname">PKGBASE</code>'s value, and
9187: is always prefixed with <code class=
9188: "literal">PKG_SYSCONFDIR</code>.</p>
9189: </li>
9190:
9191: <li>
9192: <p><code class=
9193: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9194: Holds the directory where the configuration files
9195: for the package identified by <code class=
9196: "varname">PKG_SYSCONFVAR</code>'s shall be
9197: placed.</p>
9198: </li>
9199: </ul>
9200: </div>
9201:
9202: <p>Based on the above variables, pkginstall determines
9203: the value of <code class=
9204: "varname">PKG_SYSCONFDIR</code>, which is the
9205: <span class="emphasis"><em>only</em></span> variable
9206: that can be used within a package to refer to its
9207: configuration directory. The algorithm used to set its
9208: value is basically the following:</p>
9209:
9210: <div class="orderedlist">
9211: <ol type="1">
9212: <li>
9213: <p>If <code class=
9214: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9215: is set, its value is used.</p>
9216: </li>
9217:
9218: <li>
9219: <p>If the previous variable is not defined but
9220: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9221: set in the package's <code xmlns=
9222: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9223: "filename">Makefile</code>, the resulting value
1.45 wiz 9224: is <code xmlns=
9225: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9226: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9227: </li>
9228:
9229: <li>
1.45 wiz 9230: <p>Otherwise, it is set to <code xmlns=
9231: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9232: "filename">${PKG_SYSCONFBASE}</code>.</p>
9233: </li>
9234: </ol>
9235: </div>
9236:
1.45 wiz 9237: <p>It is worth mentioning that <code xmlns=
9238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9239: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9240: added to <code xmlns=
9241: "http://www.w3.org/TR/xhtml1/transitional" class=
9242: "filename">OWN_DIRS</code>. See <a href=
9243: "#dirs-outside-prefix" title=
1.52 ! tv 9244: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9245: “Directory manipulation”</a> what this
9246: means.</p>
9247: </div>
9248:
1.52 ! tv 9249: <div class="sect2" lang="en">
1.35 jmmv 9250: <div class="titlepage">
9251: <div>
9252: <div>
1.52 ! tv 9253: <h3 class="title"><a name=
! 9254: "conf-files-configure"></a>12.2.2. Telling
! 9255: the software where configuration files are</h3>
1.35 jmmv 9256: </div>
9257: </div>
9258: </div>
9259:
9260: <p>Given that pkgsrc (and users!) expect configuration
9261: files to be in a known place, you need to teach each
1.36 wiz 9262: package where it shall install its files. In some cases
1.35 jmmv 9263: you will have to patch the package Makefiles to achieve
9264: it. If you are lucky, though, it may be as easy as
9265: passing an extra flag to the configuration script; this
1.47 reed 9266: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9267: <pre class="programlisting">
1.51 rillig 9268: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9269: </pre>
9270:
9271: <p>Note that this specifies where the package has to
9272: <span class="emphasis"><em>look for</em></span> its
9273: configuration files, not where they will be originally
9274: installed (although the difference is never explicit,
9275: unfortunately).</p>
9276: </div>
9277:
1.52 ! tv 9278: <div class="sect2" lang="en">
1.35 jmmv 9279: <div class="titlepage">
9280: <div>
9281: <div>
1.52 ! tv 9282: <h3 class="title"><a name=
! 9283: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9284: installations</h3>
9285: </div>
9286: </div>
9287: </div>
9288:
9289: <p>As said before, pkginstall automatically handles
9290: configuration files. This means that <span class=
9291: "strong"><strong>the packages themselves must not touch
1.45 wiz 9292: the contents of <code xmlns=
9293: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9294: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9295: directly</strong></span>. Bad news is that many
9296: software installation scripts will, out of the box,
9297: mess with the contents of that directory. So what is
9298: the correct procedure to fix this issue?</p>
1.35 jmmv 9299:
9300: <p>You must teach the package (usually by manually
9301: patching it) to install any configuration files under
1.45 wiz 9302: the examples hierarchy, <code xmlns=
9303: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9304: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9305: the <code xmlns=
9306: "http://www.w3.org/TR/xhtml1/transitional" class=
9307: "filename">PLIST</code> registers them and the
9308: administrator always has the original copies
1.35 jmmv 9309: available.</p>
9310:
9311: <p>Once the required configuration files are in place
9312: (i.e., under the examples hierarchy), the pkginstall
9313: framework can use them as master copies during the
1.45 wiz 9314: package installation to update what is in <code xmlns=
9315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9316: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9317: the variables <code class="varname">CONF_FILES</code>
9318: and <code class="varname">CONF_FILES_PERMS</code> are
9319: used. Check out <a href="#files-outside-prefix" title=
1.52 ! tv 9320: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9321: “File manipulation”</a> for information
9322: about their syntax and their purpose. Here is an
9323: example, taken from the <a xmlns=
9324: "http://www.w3.org/TR/xhtml1/transitional" href=
9325: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9326: target="_top"><code xmlns="" class=
9327: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9328: <pre class="programlisting">
1.51 rillig 9329: EGDIR= ${PREFIX}/share/doc/mutt/samples
9330: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9331: </pre>
9332:
9333: <p>Note that the <code class="varname">EGDIR</code>
9334: variable is specific to that package and has no meaning
9335: outside it.</p>
9336: </div>
9337:
1.52 ! tv 9338: <div class="sect2" lang="en">
1.35 jmmv 9339: <div class="titlepage">
9340: <div>
9341: <div>
1.52 ! tv 9342: <h3 class="title"><a name=
! 9343: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9344: handling of configuration files</h3>
9345: </div>
9346: </div>
9347: </div>
9348:
9349: <p>The automatic copying of config files can be toggled
9350: by setting the environment variable <code class=
9351: "varname">PKG_CONFIG</code> prior to package
9352: installation.</p>
9353: </div>
9354: </div>
9355:
1.52 ! tv 9356: <div class="sect1" lang="en">
1.35 jmmv 9357: <div class="titlepage">
9358: <div>
9359: <div>
9360: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 9361: "rcd-scripts"></a>12.3. System startup
! 9362: scripts</h2>
1.35 jmmv 9363: </div>
9364: </div>
9365: </div>
9366:
9367: <p>System startup scripts are special files because they
9368: must be installed in a place known by the underlying OS,
9369: usually outside the installation prefix. Therefore, the
9370: same rules described in <a href=
9371: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9372: "12.1. Files and directories outside the installation prefix">
1.52 ! tv 9373: Section 12.1, “Files and directories outside
! 9374: the installation prefix”</a> apply, and the same
1.35 jmmv 9375: solutions can be used. However, pkginstall provides a
1.36 wiz 9376: special mechanism to handle these files.</p>
1.35 jmmv 9377:
9378: <p>In order to provide system startup scripts, the
9379: package has to:</p>
9380:
9381: <div class="orderedlist">
9382: <ol type="1">
9383: <li>
1.45 wiz 9384: <p>Store the script inside <code xmlns=
9385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9386: "filename">${FILESDIR}</code>, with the
9387: <code class="literal">.sh</code> suffix appended.
9388: Considering the <a xmlns=
9389: "http://www.w3.org/TR/xhtml1/transitional" href=
9390: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9391: target="_top"><code xmlns="" class=
9392: "filename">print/cups</code></a> package as an
9393: example, it has a <code xmlns=
9394: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9395: "filename">cupsd.sh</code> in its files
9396: directory.</p>
9397: </li>
9398:
9399: <li>
9400: <p>Tell pkginstall to handle it, appending the name
9401: of the script, without its extension, to the
9402: <code class="varname">RCD_SCRIPTS</code> variable.
9403: Continuing the previous example:</p>
9404: <pre class="programlisting">
1.51 rillig 9405: RCD_SCRIPTS+= cupsd
1.35 jmmv 9406: </pre>
9407: </li>
9408: </ol>
9409: </div>
9410:
9411: <p>Once this is done, pkginstall will do the following
9412: steps for each script in an automated fashion:</p>
9413:
9414: <div class="orderedlist">
9415: <ol type="1">
9416: <li>
9417: <p>Process the file found in the files directory
9418: applying all the substitutions described in the
1.45 wiz 9419: <code xmlns=
9420: "http://www.w3.org/TR/xhtml1/transitional" class=
9421: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9422: </li>
9423:
9424: <li>
9425: <p>Copy the script from the files directory to the
1.45 wiz 9426: examples hierarchy, <code xmlns=
9427: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9428: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9429: Note that this master file must be explicitly
1.45 wiz 9430: registered in the <code xmlns=
9431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9432: "filename">PLIST</code>.</p>
9433: </li>
9434:
9435: <li>
9436: <p>Add code to the installation scripts to copy the
9437: startup script from the examples hierarchy into the
9438: system-wide startup scripts directory.</p>
9439: </li>
9440: </ol>
9441: </div>
9442:
1.52 ! tv 9443: <div class="sect2" lang="en">
1.35 jmmv 9444: <div class="titlepage">
9445: <div>
9446: <div>
1.52 ! tv 9447: <h3 class="title"><a name=
! 9448: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9449: handling of system startup scripts</h3>
9450: </div>
9451: </div>
9452: </div>
9453:
9454: <p>The automatic copying of config files can be toggled
9455: by setting the environment variable <code class=
9456: "varname">PKG_RCD_SCRIPTS</code> prior to package
9457: installation. Note that the scripts will be always
1.45 wiz 9458: copied inside the examples hierarchy, <code xmlns=
9459: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9460: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9461: matter what the value of this variable is.</p>
9462: </div>
9463: </div>
9464:
1.52 ! tv 9465: <div class="sect1" lang="en">
1.35 jmmv 9466: <div class="titlepage">
9467: <div>
9468: <div>
9469: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 9470: "users-and-groups"></a>12.4. System users and
! 9471: groups</h2>
1.35 jmmv 9472: </div>
9473: </div>
9474: </div>
9475:
9476: <p>If a package needs to create special users and/or
9477: groups during installation, it can do so by using the
9478: pkginstall framework.</p>
9479:
9480: <p>Users can be created by adding entries to the
9481: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9482: entry has the following syntax, which mimics <code xmlns=
9483: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9484: "filename">/etc/passwd</code>:</p>
9485: <pre class="programlisting">
1.51 rillig 9486: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9487: </pre>
9488:
9489: <p>Only the user and group are required; everything else
9490: is optional, but the colons must be in the right places
9491: when specifying optional bits. By default, a new user
1.45 wiz 9492: will have home directory <code xmlns=
9493: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9494: "filename">/nonexistent</code>, and login shell
1.45 wiz 9495: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9496: class="filename">/sbin/nologin</code> unless they are
9497: specified as part of the user element. Note that if the
1.51 rillig 9498: description contains spaces, then spaces should be
1.45 wiz 9499: backslash-escaped, as in:</p>
1.35 jmmv 9500: <pre class="programlisting">
1.51 rillig 9501: foo:foogrp::The\ Foomister
1.35 jmmv 9502: </pre>
9503:
9504: <p>Similarly, groups can be created using the
9505: <code class="varname">PKG_GROUPS</code> variable, whose
9506: syntax is:</p>
9507: <pre class="programlisting">
1.51 rillig 9508: group[:groupid]
1.35 jmmv 9509: </pre>
9510:
9511: <p>As before, only the group name is required; the
9512: numeric identifier is optional.</p>
9513: </div>
9514:
1.52 ! tv 9515: <div class="sect1" lang="en">
1.35 jmmv 9516: <div class="titlepage">
9517: <div>
9518: <div>
9519: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 9520: "shells"></a>12.5. System shells</h2>
1.35 jmmv 9521: </div>
9522: </div>
9523: </div>
9524:
9525: <p>Packages that install system shells should register
1.45 wiz 9526: them in the shell database, <code xmlns=
9527: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9528: "filename">/etc/shells</code>, to make things easier to
9529: the administrator. This must be done from the
9530: installation scripts to keep binary packages working on
9531: any system. pkginstall provides an easy way to accomplish
9532: this task.</p>
9533:
9534: <p>When a package provides a shell interpreter, it has to
9535: set the <code class="varname">PKG_SHELL</code> variable
9536: to its absolute file name. This will add some hooks to
9537: the installation scripts to handle it. Consider the
9538: following example, taken from <a xmlns=
9539: "http://www.w3.org/TR/xhtml1/transitional" href=
9540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9541: target="_top"><code xmlns="" class=
9542: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9543: <pre class="programlisting">
1.51 rillig 9544: USE_PKGINSTALL= YES
9545: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9546: </pre>
9547:
1.52 ! tv 9548: <div class="sect2" lang="en">
1.35 jmmv 9549: <div class="titlepage">
9550: <div>
9551: <div>
1.52 ! tv 9552: <h3 class="title"><a name=
! 9553: "shells-disable"></a>12.5.1. Disabling
! 9554: handling of configuration files</h3>
1.35 jmmv 9555: </div>
9556: </div>
9557: </div>
9558:
9559: <p>The automatic registration of shell interpreters can
9560: be disabled by the administrator by setting the
1.45 wiz 9561: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9562: class="filename">PKG_REGISTER_SHELLS</code> environment
9563: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9564: </div>
9565: </div>
9566: </div>
9567:
1.52 ! tv 9568: <div class="chapter" lang="en">
1.35 jmmv 9569: <div class="titlepage">
9570: <div>
9571: <div>
1.52 ! tv 9572: <h2 class="title"><a name=
1.38 dillo 9573: "options"></a>Chapter 13. Options
1.35 jmmv 9574: handling</h2>
9575: </div>
9576: </div>
9577: </div>
9578:
9579: <div class="toc">
9580: <p><b>Table of Contents</b></p>
9581:
9582: <dl>
9583: <dt><span class="sect1"><a href=
1.38 dillo 9584: "#global-default-options">13.1. Global default
1.35 jmmv 9585: options</a></span></dt>
9586:
9587: <dt><span class="sect1"><a href=
1.38 dillo 9588: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9589: use <code xmlns=
9590: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9591: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9592:
9593: <dt><span class="sect1"><a href="#option-names">13.3.
9594: Option Names</a></span></dt>
1.35 jmmv 9595: </dl>
9596: </div>
9597:
9598: <p>Many packages have the ability to be built to support
1.45 wiz 9599: different sets of features. <code xmlns=
9600: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9601: "filename">bsd.options.mk</code> is a framework in pkgsrc
9602: that provides generic handling of those options that
9603: determine different ways in which the packages can be
9604: built. It's possible for the user to specify exactly which
9605: sets of options will be built into a package or to allow a
9606: set of global default options apply.</p>
9607:
1.52 ! tv 9608: <div class="sect1" lang="en">
1.35 jmmv 9609: <div class="titlepage">
9610: <div>
9611: <div>
9612: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9613: "global-default-options"></a>13.1. Global
1.35 jmmv 9614: default options</h2>
9615: </div>
9616: </div>
9617: </div>
9618:
9619: <p>Global default options are listed in <code class=
9620: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9621: the options that should be built into every package if
9622: that option is supported. This variable should be set in
1.45 wiz 9623: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9624: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9625: </div>
9626:
1.52 ! tv 9627: <div class="sect1" lang="en">
1.35 jmmv 9628: <div class="titlepage">
9629: <div>
9630: <div>
9631: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9632: "converting-to-options"></a>13.2. Converting
1.45 wiz 9633: packages to use <code xmlns=
9634: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9635: "filename">bsd.options.mk</code></h2>
9636: </div>
9637: </div>
9638: </div>
9639:
1.45 wiz 9640: <p>The following example shows how <code xmlns=
9641: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9642: "filename">bsd.options.mk</code> should be used by the
9643: hypothetical ``wibble'' package, either in the package
1.45 wiz 9644: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9645: class="filename">Makefile</code>, or in a file, e.g.
9646: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9647: class="filename">options.mk</code>, that is included by
9648: the main package <code xmlns=
9649: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9650: "filename">Makefile</code>.</p>
9651: <pre class="programlisting">
1.51 rillig 9652: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9653: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9654: PKG_OPTIONS_OPTIONAL_GROUPS= database
9655: PKG_OPTIONS_GROUP.database= mysql pgsql
9656: PKG_SUGGESTED_OPTIONS= wibble-foo
9657: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9658: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9659:
9660: .include "../../mk/bsd.prefs.mk"
9661:
9662: # this package was previously named wibble2
9663: .if defined(PKG_OPTIONS.wibble2)
9664: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
9665: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
9666: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
9667: .endif
9668:
9669: .include "../../mk/bsd.options.mk"
9670:
9671: # Package-specific option-handling
9672:
9673: ###
9674: ### FOO support
9675: ###
9676: .if !empty(PKG_OPTIONS:Mwibble-foo)
9677: CONFIGURE_ARGS+= --enable-foo
9678: .endif
9679:
9680: ###
9681: ### LDAP support
9682: ###
9683: .if !empty(PKG_OPTIONS:Mldap)
9684: . include "../../databases/openldap/buildlink3.mk"
9685: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
9686: .endif
9687:
9688: ###
9689: ### database support
9690: ###
9691: .if !empty(PKG_OPTIONS:Mmysql)
9692: . include "../../mk/mysql.buildlink3.mk"
9693: .endif
9694: .if !empty(PKG_OPTIONS:Mpgsql)
9695: . include "../../mk/pgsql.buildlink3.mk"
9696: .endif
1.1 grant 9697: </pre>
9698:
1.28 rillig 9699: <p>The first section contains the information about which
9700: build options are supported by the package, and any
1.1 grant 9701: default options settings if needed.</p>
9702:
9703: <div class="orderedlist">
9704: <ol type="1">
9705: <li>
1.14 xtraeme 9706: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 9707: the name of the <a href=
1.1 grant 9708: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
9709: <span class="citerefentry"><span class=
1.27 rillig 9710: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 9711: that the user can set to override the default
9712: options. It should be set to “<span class=
9713: "quote">PKG_OPTIONS.<em class=
1.38 dillo 9714: "replaceable"><code>pkgbase</code></em></span>”.</p>
1.1 grant 9715: </li>
9716:
9717: <li>
1.14 xtraeme 9718: <p><code class=
9719: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 9720: build options supported by the package.</p>
9721: </li>
9722:
9723: <li>
9724: <p><code class=
9725: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
9726: list of names of groups of mutually exclusive
9727: options. The options in each group are listed in
9728: <code class="varname">PKG_OPTIONS_GROUP.<em class=
9729: "replaceable"><code>groupname</code></em></code>.
9730: The most specific setting of any option from the
9731: group takes precedence over all other options in
9732: the group. Options from the groups will be
9733: automatically added to <code class=
9734: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
9735: </li>
9736:
9737: <li>
9738: <p><code class=
9739: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
9740: like <code class=
9741: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
9742: building the packages will fail if no option from
9743: the group is selected.</p>
1.1 grant 9744: </li>
9745:
9746: <li>
1.27 rillig 9747: <p><code class=
1.44 gdt 9748: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
9749: list of names of sets of options. At least one
9750: option from each set must be selected. The options
9751: in each set are listed in <code class=
9752: "varname">PKG_OPTIONS_SET.<em class=
9753: "replaceable"><code>setname</code></em></code>.
9754: Options from the sets will be automatically added
9755: to <code class=
9756: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
9757: the package will fail if no option from the set is
9758: selected.</p>
9759: </li>
9760:
9761: <li>
9762: <p><code class=
1.27 rillig 9763: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
9764: build options which are enabled by default.</p>
9765: </li>
9766:
9767: <li>
1.37 dillo 9768: <p><code class=
9769: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
9770: of “<span class="quote"><em class=
1.52 ! tv 9771: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
! 9772: pairs that map legacy <code xmlns=
1.45 wiz 9773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9774: "filename">/etc/mk.conf</code> variables to their
9775: option counterparts. Pairs should be added with
9776: “<span class="quote">+=</span>” to keep
9777: the listing of global legacy variables. A warning
9778: will be issued if the user uses a legacy
9779: variable.</p>
9780: </li>
1.1 grant 9781:
1.37 dillo 9782: <li>
9783: <p><code class=
9784: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
9785: of “<span class="quote"><em class=
1.52 ! tv 9786: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
! 9787: pairs that map options that have been renamed to
! 9788: their new counterparts. Pairs should be added with
1.37 dillo 9789: “<span class="quote">+=</span>” to keep
9790: the listing of global legacy options. A warning
9791: will be issued if the user uses a legacy
9792: option.</p>
9793: </li>
1.1 grant 9794:
1.37 dillo 9795: <li>
9796: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
9797: is a list of options implied by deprecated
9798: variables used. This can be used for cases that
9799: neither <code class=
9800: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
9801: <code class=
9802: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
9803: handle, e. g. when <code class=
9804: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 9805: </li>
9806:
9807: <li>
1.37 dillo 9808: <p><code class=
9809: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
9810: a list of warnings about deprecated variables or
9811: options used, and what to use instead.</p>
1.1 grant 9812: </li>
1.28 rillig 9813: </ol>
1.1 grant 9814: </div>
9815:
1.37 dillo 9816: <p>A package should never modify <code class=
9817: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
9818: named in <code class="varname">PKG_OPTIONS_VAR</code>.
9819: These are strictly user-settable. To suggest a default
9820: set of options, use <code class=
9821: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
9822:
1.42 dillo 9823: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 9824: defined before including <code xmlns=
9825: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 9826: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 9827: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
9828: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
9829: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 9830: are defined (as can happen with platform-specific options
1.42 dillo 9831: if none of them is supported on the current platform),
9832: <code class="varname">PKG_OPTIONS</code> is set to the
9833: empty list and the package is otherwise treated as not
9834: using the options framework.</p>
1.37 dillo 9835:
1.45 wiz 9836: <p>After the inclusion of <code xmlns=
9837: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 9838: "filename">bsd.options.mk</code>, the variable
1.28 rillig 9839: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 9840: list of selected build options, properly filtered to
1.28 rillig 9841: remove unsupported and duplicate options.</p>
9842:
1.1 grant 9843: <p>The remaining sections contain the logic that is
1.37 dillo 9844: specific to each option. The correct way to check for an
9845: option is to check whether it is listed in <code class=
9846: "varname">PKG_OPTIONS</code>:</p>
9847: <pre class="programlisting">
1.51 rillig 9848: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 9849: "replaceable"><code>option</code></em>)
9850: </pre>
1.48 dillo 9851: </div>
1.37 dillo 9852:
1.52 ! tv 9853: <div class="sect1" lang="en">
1.48 dillo 9854: <div class="titlepage">
9855: <div>
9856: <div>
9857: <h2 class="title" style="clear: both"><a name=
9858: "option-names"></a>13.3. Option Names</h2>
9859: </div>
9860: </div>
9861: </div>
9862:
9863: <p>Options that enable similar features in different
9864: packages (like optional support for a library) should use
9865: a common name in all packages that support it (like the
9866: name of the library). If another package already has an
9867: option with the same meaning, use the same name.</p>
9868:
9869: <p>Options that enable features specific to one package,
9870: where it's unlikely that another (unrelated) package has
9871: the same (or a similar) optional feature, should use a
9872: name prefixed with <code class="varname"><em class=
9873: "replaceable"><code>pkgname</code></em>-</code>.</p>
9874:
9875: <p>If a group of related packages share an optional
9876: feature specific to that group, prefix it with the name
9877: of the “<span class="quote">main</span>”
9878: package (e. g. <code class=
9879: "varname">djbware-errno-hack</code>).</p>
9880:
9881: <p>For new options, add a line to <code xmlns=
9882: "http://www.w3.org/TR/xhtml1/transitional" class=
9883: "filename">mk/defaults/options.description</code>. Lines
9884: have two fields, separated by tab. The first field is the
9885: option name, the second its description. The description
9886: should be a whole sentence (starting with an uppercase
9887: letter and ending with a period) that describes what
9888: enabling the option does. E. g. “<span class=
9889: "quote">Enable ispell support.</span>” The file is
9890: sorted by option names.</p>
1.1 grant 9891: </div>
9892: </div>
9893:
1.52 ! tv 9894: <div class="chapter" lang="en">
1.1 grant 9895: <div class="titlepage">
9896: <div>
9897: <div>
1.52 ! tv 9898: <h2 class="title"><a name=
1.38 dillo 9899: "build"></a>Chapter 14. The build
1.1 grant 9900: process</h2>
9901: </div>
9902: </div>
9903: </div>
9904:
9905: <div class="toc">
9906: <p><b>Table of Contents</b></p>
9907:
9908: <dl>
1.38 dillo 9909: <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1 grant 9910: Program location</a></span></dt>
9911:
1.38 dillo 9912: <dt><span class="sect1"><a href="#main-targets">14.2.
1.30 wiz 9913: Main targets</a></span></dt>
1.1 grant 9914:
9915: <dt><span class="sect1"><a href=
1.38 dillo 9916: "#build.helpful-targets">14.3. Other helpful
1.1 grant 9917: targets</a></span></dt>
9918: </dl>
9919: </div>
9920:
9921: <p>The basic steps for building a program are always the
9922: same. First the program's source (<span class=
9923: "emphasis"><em>distfile</em></span>) must be brought to the
9924: local system and then extracted. After any patches to
9925: compile properly on NetBSD are applied, the software can be
9926: configured, then built (usually by compiling), and finally
9927: the generated binaries, etc. can be put into place on the
9928: system. These are exactly the steps performed by the NetBSD
9929: package system, which is implemented as a series of targets
1.45 wiz 9930: in a central Makefile, <code xmlns=
9931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9932: "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1 grant 9933:
1.52 ! tv 9934: <div class="sect1" lang="en">
1.1 grant 9935: <div class="titlepage">
9936: <div>
9937: <div>
9938: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9939: "build.prefix"></a>14.1. Program location</h2>
1.1 grant 9940: </div>
9941: </div>
9942: </div>
9943:
9944: <p>Before outlining the process performed by the NetBSD
9945: package system in the next section, here's a brief
9946: discussion on where programs are installed, and which
9947: variables influence this.</p>
9948:
1.14 xtraeme 9949: <p>The automatic variable <code class=
9950: "varname">PREFIX</code> indicates where all files of the
9951: final program shall be installed. It is usually set to
1.45 wiz 9952: <code class="varname">LOCALBASE</code> (<code xmlns=
9953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9954: "filename">/usr/pkg</code>), or <code class=
9955: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 9956: “<span class="quote">cross</span>” category.
1.14 xtraeme 9957: The value of <code class="varname">PREFIX</code> needs to
9958: be put into the various places in the program's source
9959: where paths to these files are encoded. See <a href=
1.1 grant 9960: "#components.patches" title=
1.38 dillo 9961: "8.3. patches/*">Section 8.3,
1.1 grant 9962: “patches/*”</a> and <a href="#fixes.libtool"
9963: title=
1.38 dillo 9964: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 9965: “Shared libraries - libtool”</a> for more
9966: details.</p>
9967:
9968: <p>When choosing which of these variables to use, follow
9969: the following rules:</p>
9970:
9971: <div class="itemizedlist">
9972: <ul type="disc">
9973: <li>
1.14 xtraeme 9974: <p><code class="varname">PREFIX</code> always
9975: points to the location where the current pkg will
9976: be installed. When referring to a pkg's own
1.1 grant 9977: installation path, use “<span class=
9978: "quote">${PREFIX}</span>”.</p>
9979: </li>
9980:
9981: <li>
1.14 xtraeme 9982: <p><code class="varname">LOCALBASE</code> is where
9983: all non-X11 pkgs are installed. If you need to
1.1 grant 9984: construct a -I or -L argument to the compiler to
9985: find includes and libraries installed by another
9986: non-X11 pkg, use “<span class=
9987: "quote">${LOCALBASE}</span>”.</p>
9988: </li>
9989:
9990: <li>
1.14 xtraeme 9991: <p><code class="varname">X11BASE</code> is where
9992: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 9993: installed. When looking for <span class=
9994: "emphasis"><em>standard</em></span> X11 includes
9995: (not those installed by a pkg), use
9996: “<span class=
9997: "quote">${X11BASE}</span>”.</p>
9998: </li>
9999:
10000: <li>
1.47 reed 10001: <p>X11-based packages are special in that they may
10002: be installed in either <code class=
1.14 xtraeme 10003: "varname">X11BASE</code> or <code class=
10004: "varname">LOCALBASE</code>.</p>
1.1 grant 10005:
10006: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10007: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10008: possible. Note that you will need to include
1.45 wiz 10009: <code xmlns=
10010: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10011: "filename">../../mk/x11.buildlink3.mk</code> in
10012: them to request the presence of X11 and to get the
10013: right compilation flags.</p>
1.1 grant 10014:
10015: <p>Even though, there are some packages that cannot
1.14 xtraeme 10016: be installed under <code class=
10017: "varname">LOCALBASE</code>: those that come with
1.1 grant 10018: app-defaults files. These packages are special and
1.14 xtraeme 10019: they must be placed under <code class=
10020: "varname">X11BASE</code>. To accomplish this, set
10021: either <code class="varname">USE_X11BASE</code> or
10022: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10023: package.</p>
10024:
1.34 wiz 10025: <p>Some notes: If you need to find includes or
1.14 xtraeme 10026: libraries installed by a pkg that has <code class=
10027: "varname">USE_IMAKE</code> or <code class=
10028: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10029: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10030: class="filename">Makefile</code>, you need to look
10031: in <span class="emphasis"><em>both</em></span>
10032: <code xmlns=
10033: "http://www.w3.org/TR/xhtml1/transitional" class=
10034: "filename">${X11BASE}</code> and <code xmlns=
10035: "http://www.w3.org/TR/xhtml1/transitional" class=
10036: "filename">${LOCALBASE}</code>. To force
10037: installation of all X11 packages in <code class=
10038: "varname">LOCALBASE</code>, the <a xmlns=
10039: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10040: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10041: target="_top"><code xmlns="" class=
10042: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10043: enabled by default.</p>
1.1 grant 10044: </li>
10045:
10046: <li>
1.14 xtraeme 10047: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10048: used to refer to the installed location of an X11
1.14 xtraeme 10049: package. <code class="varname">X11PREFIX</code>
10050: will be set to <code class="varname">X11BASE</code>
10051: if xpkgwedge is not installed, and to <code class=
10052: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10053: installed.</p>
10054: </li>
10055:
10056: <li>
10057: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10058: have some packages installed in <code class=
10059: "varname">X11BASE</code> and some in <code class=
10060: "varname">LOCALBASE</code>. To determine the prefix
10061: of an installed package, the <code class=
10062: "varname">EVAL_PREFIX</code> definition can be
10063: used. It takes pairs in the format
10064: “<span class=
1.1 grant 10065: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10066: the <a href=
10067: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10068: <span class="citerefentry"><span class=
10069: "refentrytitle">make</span>(1)</span></a> variable
10070: <code class="varname">DIRNAME</code> will be set to
10071: the prefix of the installed package
10072: <package>, or “<span class=
1.1 grant 10073: "quote">${X11PREFIX}</span>” if the package
10074: is not installed.</p>
10075:
10076: <p>This is best illustrated by example.</p>
10077:
1.45 wiz 10078: <p>The following lines are taken from <code xmlns=
10079: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10080: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10081: <pre class="programlisting">
1.51 rillig 10082: EVAL_PREFIX+= GTKDIR=gtk+
10083: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10084: --with-gtk-prefix="${GTKDIR}" \
10085: --enable-multibyte
1.1 grant 10086: </pre>
10087:
10088: <p>Specific defaults can be defined for the
1.14 xtraeme 10089: packages evaluated using <code class=
10090: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10091: of the form:</p>
10092: <pre class="programlisting">
1.51 rillig 10093: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10094: </pre>
10095:
1.14 xtraeme 10096: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10097: corresponds to the first definition in the
1.14 xtraeme 10098: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10099: </li>
10100:
10101: <li>
1.45 wiz 10102: <p>Within <code xmlns=
10103: "http://www.w3.org/TR/xhtml1/transitional" class=
10104: "filename">${PREFIX}</code>, packages should
10105: install files according to <a href=
1.24 wiz 10106: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10107: <span class="citerefentry"><span class=
10108: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10109: exception that manual pages go into <code xmlns=
10110: "http://www.w3.org/TR/xhtml1/transitional" class=
10111: "filename">${PREFIX}/man</code>, not <code xmlns=
10112: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10113: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10114: </li>
10115: </ul>
10116: </div>
10117: </div>
10118:
1.52 ! tv 10119: <div class="sect1" lang="en">
1.1 grant 10120: <div class="titlepage">
10121: <div>
10122: <div>
10123: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10124: "main-targets"></a>14.2. Main targets</h2>
1.1 grant 10125: </div>
10126: </div>
10127: </div>
10128:
10129: <p>The main targets used during the build process defined
1.45 wiz 10130: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10131: class="filename">bsd.pkg.mk</code> are:</p>
1.1 grant 10132:
10133: <div class="variablelist">
10134: <dl>
10135: <dt><span class="term">fetch</span></dt>
10136:
10137: <dd>
10138: <p>This will check if the file(s) given in the
1.14 xtraeme 10139: variables <code class="varname">DISTFILES</code>
10140: and <code class="varname">PATCHFILES</code> (as
10141: defined in the package's Makefile) are present on
1.45 wiz 10142: the local system in <code xmlns=
10143: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10144: "filename">/usr/pkgsrc/distfiles</code>. If they
10145: are not present, an attempt will be made to fetch
10146: them using commands of the form:</p>
1.1 grant 10147: <pre class="programlisting">
1.51 rillig 10148: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10149: </pre>
10150:
10151: <p>where ${site} varies through several
1.14 xtraeme 10152: possibilities in turn: first, <code class=
10153: "varname">MASTER_SITE_OVERRIDE</code> is tried,
10154: then the sites specified in either <code class=
10155: "varname">SITES_file</code> if defined, else
10156: <code class="varname">MASTER_SITES</code> or
10157: <code class="varname">PATCH_SITES</code>, as
10158: applies, then finally the value of <code class=
10159: "varname">MASTER_SITE_BACKUP</code>. The order of
10160: all except the first can be optionally sorted by
10161: the user, via setting either <code class=
10162: "varname">MASTER_SORT_AWK</code> or <code class=
10163: "varname">MASTER_SORT_REGEX</code>.</p>
1.1 grant 10164: </dd>
10165:
10166: <dt><span class="term">checksum</span></dt>
10167:
10168: <dd>
10169: <p>After the distfile(s) are fetched, their
10170: checksum is generated and compared with the
10171: checksums stored in the distinfo file. If the
10172: checksums don't match, the build is aborted. This
10173: is to ensure the same distfile is used for
10174: building, and that the distfile wasn't changed,
10175: e.g. by some malign force, deliberately changed
10176: distfiles on the master distribution site or
10177: network lossage.</p>
10178: </dd>
10179:
10180: <dt><span class="term">extract</span></dt>
10181:
10182: <dd>
10183: <p>When the distfiles are present on the local
10184: system, they need to be extracted, as they are
10185: usually in the form of some compressed archive
1.45 wiz 10186: format, most commonly <code xmlns=
10187: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10188: "filename">.tar.gz</code>.</p>
1.1 grant 10189:
10190: <p>If only some of the distfiles need to be
10191: uncompressed, the files to be uncompressed should
1.14 xtraeme 10192: be put into <code class=
10193: "varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10194:
1.45 wiz 10195: <p>If the distfiles are not in <code xmlns=
10196: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10197: "filename">.tar.gz</code> format, they can be
10198: extracted by setting either <code class=
10199: "varname">EXTRACT_SUFX</code>, or <code class=
10200: "varname">EXTRACT_CMD</code>, <code class=
10201: "varname">EXTRACT_BEFORE_ARGS</code> and
10202: <code class="varname">EXTRACT_AFTER_ARGS</code>. In
10203: the former case, pkgsrc knows how to extract a
1.45 wiz 10204: number of suffixes (<code xmlns=
10205: "http://www.w3.org/TR/xhtml1/transitional" class=
10206: "filename">.tar.gz</code>, <code xmlns=
10207: "http://www.w3.org/TR/xhtml1/transitional" class=
10208: "filename">.tgz</code>, <code xmlns=
10209: "http://www.w3.org/TR/xhtml1/transitional" class=
10210: "filename">.tar.gz2</code>, <code xmlns=
10211: "http://www.w3.org/TR/xhtml1/transitional" class=
10212: "filename">.tbz</code>, <code xmlns=
10213: "http://www.w3.org/TR/xhtml1/transitional" class=
10214: "filename">.tar.Z</code>, <code xmlns=
10215: "http://www.w3.org/TR/xhtml1/transitional" class=
10216: "filename">.tar</code>, <code xmlns=
10217: "http://www.w3.org/TR/xhtml1/transitional" class=
10218: "filename">.shar.gz</code>, <code xmlns=
10219: "http://www.w3.org/TR/xhtml1/transitional" class=
10220: "filename">.shar.bz2</code>, <code xmlns=
10221: "http://www.w3.org/TR/xhtml1/transitional" class=
10222: "filename">.shar.Z</code>, <code xmlns=
10223: "http://www.w3.org/TR/xhtml1/transitional" class=
10224: "filename">.shar</code>, <code xmlns=
10225: "http://www.w3.org/TR/xhtml1/transitional" class=
10226: "filename">.Z</code>, <code xmlns=
10227: "http://www.w3.org/TR/xhtml1/transitional" class=
10228: "filename">.bz2</code> and <code xmlns=
10229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10230: "filename">.gz</code>; see the definition of the
10231: various <code class="varname">DECOMPRESS_CMD</code>
1.47 reed 10232: variables in <code xmlns=
1.45 wiz 10233: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 10234: "filename">bsd.pkg.extract.mk</code> for a complete
10235: list). Here's an example on how to use the other
10236: variables for a program that comes with a
10237: compressed shell archive whose name ends in
10238: <code xmlns=
1.45 wiz 10239: "http://www.w3.org/TR/xhtml1/transitional" class=
10240: "filename">.msg.gz</code>:</p>
1.1 grant 10241: <pre class="programlisting">
1.51 rillig 10242: EXTRACT_SUFX= .msg.gz
10243: EXTRACT_CMD= zcat
10244: EXTRACT_BEFORE_ARGS=
10245: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10246: </pre>
10247: </dd>
10248:
10249: <dt><span class="term">patch</span></dt>
10250:
10251: <dd>
10252: <p>After extraction, all the patches named by the
1.14 xtraeme 10253: <code class="varname">PATCHFILES</code>, those
10254: present in the patches subdirectory of the package
10255: as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45 wiz 10256: <code xmlns=
10257: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10258: "filename">/usr/local/patches/graphics/png</code>)
1.45 wiz 10259: are applied. Patchfiles ending in <code xmlns=
10260: "http://www.w3.org/TR/xhtml1/transitional" class=
10261: "filename">.Z</code> or <code xmlns=
10262: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10263: "filename">.gz</code> are uncompressed before they
1.45 wiz 10264: are applied, files ending in <code xmlns=
10265: "http://www.w3.org/TR/xhtml1/transitional" class=
10266: "filename">.orig</code> or <code xmlns=
10267: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10268: "filename">.rej</code> are ignored. Any special
1.24 wiz 10269: options to <a href=
10270: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10271: <span class="citerefentry"><span class=
10272: "refentrytitle">patch</span>(1)</span></a> can be
10273: handed in <code class=
1.14 xtraeme 10274: "varname">PATCH_DIST_ARGS</code>. See <a href=
10275: "#components.patches" title=
1.38 dillo 10276: "8.3. patches/*">Section 8.3,
1.1 grant 10277: “patches/*”</a> for more details.</p>
10278:
1.24 wiz 10279: <p>By default <a href=
10280: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10281: <span class="citerefentry"><span class=
10282: "refentrytitle">patch</span>(1)</span></a> is given
10283: special args to make it fail if the patches apply
10284: with some lines of fuzz. Please fix (regen) the
10285: patches so that they apply cleanly. The rationale
10286: behind this is that patches that don't apply
10287: cleanly may end up being applied in the wrong
10288: place, and cause severe harm there.</p>
1.1 grant 10289: </dd>
10290:
10291: <dt><span class="term">configure</span></dt>
10292:
10293: <dd>
10294: <p>Most pieces of software need information on the
10295: header files, system calls, and library routines
10296: which are available in NetBSD. This is the process
10297: known as configuration, and is usually automated.
10298: In most cases, a script is supplied with the
10299: source, and its invocation results in generation of
10300: header files, Makefiles, etc.</p>
10301:
10302: <p>If the program's distfile contains its own
10303: configure script, this can be invoked by setting
1.14 xtraeme 10304: <code class="varname">HAS_CONFIGURE</code>. If the
1.1 grant 10305: configure script is a GNU autoconf script,
1.14 xtraeme 10306: <code class="varname">GNU_CONFIGURE</code> should
10307: be specified instead. In either case, any arguments
10308: to the configure script can be specified in the
10309: <code class="varname">CONFIGURE_ARGS</code>
10310: variable, and the configure script's name can be
10311: set in <code class=
10312: "varname">CONFIGURE_SCRIPT</code> if it differs
10313: from the default “<span class=
1.1 grant 10314: "quote">configure</span>”. Here's an example
10315: from the <a xmlns=
10316: "http://www.w3.org/TR/xhtml1/transitional" href=
10317: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45 wiz 10318: target="_top"><code xmlns="" class=
10319: "filename">sysutils/top</code></a> package:</p>
1.1 grant 10320: <pre class="programlisting">
1.51 rillig 10321: HAS_CONFIGURE= yes
10322: CONFIGURE_SCRIPT= Configure
10323: CONFIGURE_ARGS+= netbsd13
1.1 grant 10324: </pre>
10325:
10326: <p>If the program uses an Imakefile for
10327: configuration, the appropriate steps can be invoked
1.14 xtraeme 10328: by setting <code class="varname">USE_IMAKE</code>
10329: to “<span class="quote">YES</span>”.
10330: (If you only want the package installed in
10331: <code class="varname">$X11PREFIX</code> but xmkmf
10332: not being run, set <code class=
10333: "varname">USE_X11BASE</code> instead!)</p>
1.1 grant 10334: </dd>
10335:
10336: <dt><span class="term">build</span></dt>
10337:
10338: <dd>
10339: <p>Once configuration has taken place, the software
1.14 xtraeme 10340: will be built by invoking <code class=
10341: "varname">$MAKE_PROGRAM</code> on <code class=
10342: "varname">$MAKEFILE</code> with <code class=
10343: "varname">$BUILD_TARGET</code> as the target to
10344: build. The default <code class=
10345: "varname">MAKE_PROGRAM</code> is
10346: “<span class="quote">gmake</span>” if
1.29 rillig 10347: <code class="varname">USE_TOOLS</code> contains
10348: “<span class="quote">gmake</span>”,
1.1 grant 10349: “<span class="quote">make</span>”
1.14 xtraeme 10350: otherwise. <code class="varname">MAKEFILE</code> is
10351: set to “<span class=
1.1 grant 10352: "quote">Makefile</span>” by default, and
1.14 xtraeme 10353: <code class="varname">BUILD_TARGET</code> defaults
10354: to “<span class="quote">all</span>”.
10355: Any of these variables can be set in the package's
1.1 grant 10356: Makefile to change the default build process.</p>
10357: </dd>
10358:
10359: <dt><span class="term">install</span></dt>
10360:
10361: <dd>
10362: <p>Once the build stage has completed, the final
10363: step is to install the software in public
10364: directories, so users can access the programs and
1.14 xtraeme 10365: files. As in the build-target, <code class=
10366: "varname">$MAKE_PROGRAM</code> is invoked on
10367: <code class="varname">$MAKEFILE</code> here, but
10368: with the <code class=
10369: "varname">$INSTALL_TARGET</code> instead, the
10370: latter defaulting to “<span class=
10371: "quote">install</span>” (plus
10372: “<span class=
10373: "quote">install.man</span>”, if <code class=
10374: "varname">USE_IMAKE</code> is set).</p>
1.1 grant 10375: </dd>
10376: </dl>
10377: </div>
10378:
10379: <p>If no target is specified, the default is
10380: “<span class="quote">build</span>”. If a
10381: subsequent stage is requested, all prior stages are made:
1.14 xtraeme 10382: e.g. <span><strong class="command">make
10383: build</strong></span> will also perform the equivalent
10384: of:</p>
1.1 grant 10385: <pre class="programlisting">
1.51 rillig 10386: make fetch
10387: make checksum
10388: make extract
10389: make patch
10390: make configure
10391: make build
1.1 grant 10392: </pre>
10393: </div>
10394:
1.52 ! tv 10395: <div class="sect1" lang="en">
1.1 grant 10396: <div class="titlepage">
10397: <div>
10398: <div>
10399: <h2 class="title" style="clear: both"><a name=
1.38 dillo 10400: "build.helpful-targets"></a>14.3. Other
1.1 grant 10401: helpful targets</h2>
10402: </div>
10403: </div>
10404: </div>
10405:
10406: <div class="variablelist">
10407: <dl>
10408: <dt><span class="term">pre/post-*</span></dt>
10409:
10410: <dd>
10411: <p>For any of the main targets described in the
10412: previous section, two auxiliary targets exist with
10413: “<span class="quote">pre-</span>” and
10414: “<span class="quote">post-</span>” used
10415: as a prefix for the main target's name. These
10416: targets are invoked before and after the main
10417: target is called, allowing extra configuration or
10418: installation steps be performed from a package's
10419: Makefile, for example, which a program's configure
10420: script or install target omitted.</p>
10421: </dd>
10422:
10423: <dt><span class="term">do-*</span></dt>
10424:
10425: <dd>
10426: <p>Should one of the main targets do the wrong
10427: thing, and should there be no variable to fix this,
10428: you can redefine it with the do-* target. (Note
10429: that redefining the target itself instead of the
10430: do-* target is a bad idea, as the pre-* and post-*
10431: targets won't be called anymore, etc.) You will not
10432: usually need to do this.</p>
10433: </dd>
10434:
10435: <dt><span class="term">reinstall</span></dt>
10436:
10437: <dd>
1.14 xtraeme 10438: <p>If you did a <span><strong class="command">make
10439: install</strong></span> and you noticed some file
10440: was not installed properly, you can repeat the
1.1 grant 10441: installation with this target, which will ignore
10442: the “<span class="quote">already
10443: installed</span>” flag.</p>
10444: </dd>
10445:
10446: <dt><span class="term">deinstall</span></dt>
10447:
10448: <dd>
1.24 wiz 10449: <p>This target does a <a href=
10450: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10451: <span class="citerefentry"><span class=
10452: "refentrytitle">pkg_delete</span>(1)</span></a> in
10453: the current directory, effectively de-installing
10454: the package. The following variables can be used to
10455: tune the behaviour:</p>
1.1 grant 10456:
10457: <div class="variablelist">
10458: <dl>
1.14 xtraeme 10459: <dt><span class="term"><code class=
10460: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 10461:
10462: <dd>
10463: <p>Add a "-v" to the <a href=
10464: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10465: <span class="citerefentry"><span class=
10466: "refentrytitle">pkg_delete</span>(1)</span></a>
10467: command.</p>
10468: </dd>
10469:
1.14 xtraeme 10470: <dt><span class="term"><code class=
10471: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 10472:
10473: <dd>
10474: <p>Remove all packages that require (depend
10475: on) the given package. This can be used to
10476: remove any packages that may have been pulled
10477: in by a given package, e.g. if
1.14 xtraeme 10478: <span><strong class="command">make deinstall
10479: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 10480: <code xmlns=
10481: "http://www.w3.org/TR/xhtml1/transitional"
10482: class="filename">pkgsrc/x11/kde</code>, this
10483: is likely to remove whole KDE. Works by
1.1 grant 10484: adding “<span class=
10485: "quote">-R</span>” to the <a href=
10486: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
10487: <span class="citerefentry"><span class=
10488: "refentrytitle">pkg_delete</span>(1)</span></a>
10489: command line.</p>
10490: </dd>
10491: </dl>
10492: </div>
10493: </dd>
10494:
10495: <dt><span class="term">update</span></dt>
10496:
10497: <dd>
10498: <p>This target causes the current package to be
10499: updated to the latest version. The package and all
10500: depending packages first get de-installed, then
10501: current versions of the corresponding packages get
10502: compiled and installed. This is similar to manually
10503: noting which packages are currently installed, then
1.14 xtraeme 10504: performing a series of <span><strong class=
10505: "command">make deinstall</strong></span> and
10506: <span><strong class="command">make
10507: install</strong></span> (or whatever <code class=
10508: "varname">UPDATE_TARGET</code> is set to) for these
10509: packages.</p>
1.1 grant 10510:
10511: <p>You can use the “<span class=
10512: "quote">update</span>” target to resume
1.14 xtraeme 10513: package updating in case a previous
10514: <span><strong class="command">make
10515: update</strong></span> was interrupted for some
10516: reason. However, in this case, make sure you don't
10517: call <span><strong class="command">make
10518: clean</strong></span> or otherwise remove the list
10519: of dependent packages in <code class=
1.47 reed 10520: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 10521: ability to automatically update the current package
10522: along with the dependent packages you have
10523: installed.</p>
10524:
1.14 xtraeme 10525: <p>Resuming an interrupted <span><strong class=
10526: "command">make update</strong></span> will only
10527: work as long as the package tree remains unchanged.
10528: If the source code for one of the packages to be
10529: updated has been changed, resuming
10530: <span><strong class="command">make
10531: update</strong></span> will most certainly
10532: fail!</p>
1.1 grant 10533:
10534: <p>The following variables can be used either on
1.45 wiz 10535: the command line or in <code xmlns=
10536: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10537: "filename">/etc/mk.conf</code> to alter the
10538: behaviour of <span><strong class="command">make
10539: update</strong></span>:</p>
1.1 grant 10540:
10541: <div class="variablelist">
10542: <dl>
1.14 xtraeme 10543: <dt><span class="term"><code class=
10544: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 10545:
10546: <dd>
10547: <p>Install target to recursively use for the
10548: updated package and the dependent packages.
1.14 xtraeme 10549: Defaults to <code class=
10550: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 10551: “<span class=
10552: "quote">install</span>” otherwise for
1.14 xtraeme 10553: <span><strong class="command">make
10554: update</strong></span>. e.g.
10555: <span><strong class="command">make update
10556: UPDATE_TARGET=package</strong></span></p>
1.1 grant 10557: </dd>
10558:
1.14 xtraeme 10559: <dt><span class="term"><code class=
10560: "varname">NOCLEAN</code></span></dt>
1.1 grant 10561:
10562: <dd>
10563: <p>Don't clean up after updating. Useful if
10564: you want to leave the work sources of the
10565: updated packages around for inspection or
10566: other purposes. Be sure you eventually clean
10567: up the source tree (see the
10568: “<span class=
10569: "quote">clean-update</span>” target
10570: below) or you may run into troubles with old
10571: source code still lying around on your next
1.14 xtraeme 10572: <span><strong class=
10573: "command">make</strong></span> or
10574: <span><strong class="command">make
10575: update</strong></span>.</p>
1.1 grant 10576: </dd>
10577:
1.14 xtraeme 10578: <dt><span class="term"><code class=
10579: "varname">REINSTALL</code></span></dt>
1.1 grant 10580:
10581: <dd>
10582: <p>Deinstall each package before installing
1.14 xtraeme 10583: (making <code class=
10584: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 10585: necessary if the “<span class=
10586: "quote">clean-update</span>” target
10587: (see below) was called after interrupting a
1.14 xtraeme 10588: running <span><strong class="command">make
10589: update</strong></span>.</p>
1.1 grant 10590: </dd>
10591:
1.14 xtraeme 10592: <dt><span class="term"><code class=
10593: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 10594:
10595: <dd>
10596: <p>Allows you to disable recursion and
10597: hardcode the target for packages. The default
10598: is “<span class=
10599: "quote">update</span>” for the update
10600: target, facilitating a recursive update of
1.14 xtraeme 10601: prerequisite packages. Only set <code class=
10602: "varname">DEPENDS_TARGET</code> if you want
10603: to disable recursive updates. Use
10604: <code class="varname">UPDATE_TARGET</code>
10605: instead to just set a specific target for
10606: each package to be installed during
10607: <span><strong class="command">make
10608: update</strong></span> (see above).</p>
1.1 grant 10609: </dd>
10610: </dl>
10611: </div>
10612: </dd>
10613:
10614: <dt><span class="term">clean-update</span></dt>
10615:
10616: <dd>
10617: <p>Clean the source tree for all packages that
1.14 xtraeme 10618: would get updated if <span><strong class=
10619: "command">make update</strong></span> was called
10620: from the current directory. This target should not
10621: be used if the current package (or any of its
10622: depending packages) have already been de-installed
10623: (e.g., after calling <span><strong class=
10624: "command">make update</strong></span>) or you may
10625: lose some packages you intended to update. As a
10626: rule of thumb: only use this target <span class=
10627: "emphasis"><em>before</em></span> the first time
10628: you run <span><strong class="command">make
10629: update</strong></span> and only if you have a dirty
10630: package tree (e.g., if you used <code class=
10631: "varname">NOCLEAN</code>).</p>
1.1 grant 10632:
1.47 reed 10633: <p>If you are unsure about whether your tree is
10634: clean, you can either perform a
1.14 xtraeme 10635: <span><strong class="command">make
1.47 reed 10636: clean</strong></span> at the top of the tree, or
10637: use the following sequence of commands from the
10638: directory of the package you want to update
10639: (<span class="emphasis"><em>before</em></span>
10640: running <span><strong class="command">make
1.14 xtraeme 10641: update</strong></span> for the first time,
10642: otherwise you lose all the packages you wanted to
10643: update!):</p>
1.1 grant 10644: <pre class="screen">
1.14 xtraeme 10645: <code class="prompt">#</code> <strong class=
10646: "userinput"><code>make clean-update</code></strong>
10647: <code class="prompt">#</code> <strong class=
10648: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
10649: <code class="prompt">#</code> <strong class=
10650: "userinput"><code>make update</code></strong>
1.1 grant 10651: </pre>
10652:
10653: <p>The following variables can be used either on
1.45 wiz 10654: the command line or in <code xmlns=
10655: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10656: "filename">/etc/mk.conf</code> to alter the
10657: behaviour of <span><strong class="command">make
10658: clean-update</strong></span>:</p>
1.1 grant 10659:
10660: <div class="variablelist">
10661: <dl>
1.14 xtraeme 10662: <dt><span class="term"><code class=
10663: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 10664:
10665: <dd>
1.14 xtraeme 10666: <p>After <span><strong class="command">make
10667: clean</strong></span>, do not reconstruct the
10668: list of directories to update for this
10669: package. Only use this if
10670: <span><strong class="command">make
10671: update</strong></span> successfully installed
10672: all packages you wanted to update. Normally,
10673: this is done automatically on
10674: <span><strong class="command">make
10675: update</strong></span>, but may have been
10676: suppressed by the <code class=
10677: "varname">NOCLEAN</code> variable (see
1.1 grant 10678: above).</p>
10679: </dd>
10680: </dl>
10681: </div>
10682: </dd>
10683:
10684: <dt><span class="term">info</span></dt>
10685:
10686: <dd>
10687: <p>This target invokes <a href=
10688: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
10689: <span class="citerefentry"><span class=
10690: "refentrytitle">pkg_info</span>(1)</span></a> for
10691: the current package. You can use this to check
10692: which version of a package is installed.</p>
10693: </dd>
10694:
10695: <dt><span class="term">readme</span></dt>
10696:
10697: <dd>
1.45 wiz 10698: <p>This target generates a <code xmlns=
10699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10700: "filename">README.html</code> file, which can be
1.1 grant 10701: viewed using a browser such as <a xmlns=
10702: "http://www.w3.org/TR/xhtml1/transitional" href=
10703: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 10704: target="_top"><code xmlns="" class=
10705: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 10706: "http://www.w3.org/TR/xhtml1/transitional" href=
10707: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 10708: target="_top"><code xmlns="" class=
10709: "filename">www/links</code></a>. The generated
10710: files contain references to any packages which are
10711: in the <code class="varname">PACKAGES</code>
10712: directory on the local host. The generated files
10713: can be made to refer to URLs based on <code class=
1.20 ben 10714: "varname">FTP_PKG_URL_HOST</code> and <code class=
10715: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 10716: wanted to generate <code xmlns=
10717: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10718: "filename">README.html</code> files which pointed
10719: to binary packages on the local machine, in the
1.45 wiz 10720: directory <code xmlns=
10721: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 10722: "filename">/usr/packages</code>, set <code class=
10723: "varname">FTP_PKG_URL_HOST=file://localhost</code>
10724: and <code class=
10725: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
10726: <code class="varname">${PACKAGES}</code> directory
10727: and its subdirectories will be searched for all the
10728: binary packages.</p>
1.1 grant 10729: </dd>
10730:
10731: <dt><span class="term">readme-all</span></dt>
10732:
10733: <dd>
1.45 wiz 10734: <p>Use this target to create a file <code xmlns=
10735: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10736: "filename">README-all.html</code> which contains a
1.1 grant 10737: list of all packages currently available in the
10738: NetBSD Packages Collection, together with the
10739: category they belong to and a short description.
1.45 wiz 10740: This file is compiled from the <code xmlns=
10741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10742: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 10743: sure to run this <span class=
1.14 xtraeme 10744: "emphasis"><em>after</em></span> a
10745: <span><strong class="command">make
10746: readme</strong></span>.</p>
1.1 grant 10747: </dd>
10748:
10749: <dt><span class="term">cdrom-readme</span></dt>
10750:
10751: <dd>
10752: <p>This is very much the same as the
10753: “<span class="quote">readme</span>”
10754: target (see above), but is to be used when
10755: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 10756: This target also produces <code xmlns=
10757: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10758: "filename">README.html</code> files, and can be
10759: made to refer to URLs based on <code class=
10760: "varname">CDROM_PKG_URL_HOST</code> and
10761: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 10762: </dd>
10763:
10764: <dt><span class="term">show-distfiles</span></dt>
10765:
10766: <dd>
10767: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 10768: are needed to build the package. (<code class=
10769: "varname">DISTFILES</code> and <code class=
1.45 wiz 10770: "varname">PATCHFILES</code>, but not <code xmlns=
10771: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10772: "filename">patches/*</code>)</p>
1.1 grant 10773: </dd>
10774:
10775: <dt><span class="term">show-downlevel</span></dt>
10776:
10777: <dd>
10778: <p>This target shows nothing if the package is not
10779: installed. If a version of this package is
10780: installed, but is not the version provided in this
10781: version of pkgsrc, then a warning message is
10782: displayed. This target can be used to show which of
10783: your installed packages are downlevel, and so the
10784: old versions can be deleted, and the current ones
10785: added.</p>
10786: </dd>
10787:
10788: <dt><span class="term">show-pkgsrc-dir</span></dt>
10789:
10790: <dd>
10791: <p>This target shows the directory in the pkgsrc
10792: hierarchy from which the package can be built and
10793: installed. This may not be the same directory as
10794: the one from which the package was installed. This
10795: target is intended to be used by people who may
10796: wish to upgrade many packages on a single host, and
10797: can be invoked from the top-level pkgsrc Makefile
10798: by using the “<span class=
10799: "quote">show-host-specific-pkgs</span>”
10800: target.</p>
10801: </dd>
10802:
10803: <dt><span class=
10804: "term">show-installed-depends</span></dt>
10805:
10806: <dd>
10807: <p>This target shows which installed packages match
1.14 xtraeme 10808: the current package's <code class=
10809: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 10810: dependencies are causing build problems.</p>
10811: </dd>
10812:
10813: <dt><span class="term">check-shlibs</span></dt>
10814:
10815: <dd>
10816: <p>After a package is installed, check all its
10817: binaries and (on ELF platforms) shared libraries to
10818: see if they find the shared libs they need. Run by
1.14 xtraeme 10819: default if <code class=
10820: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 10821: <code xmlns=
10822: "http://www.w3.org/TR/xhtml1/transitional" class=
10823: "filename">/etc/mk.conf</code>.</p>
1.1 grant 10824: </dd>
10825:
10826: <dt><span class="term">print-PLIST</span></dt>
10827:
10828: <dd>
10829: <p>After a “<span class="quote">make
10830: install</span>” from a new or upgraded pkg,
10831: this prints out an attempt to generate a new
1.45 wiz 10832: <code xmlns=
10833: "http://www.w3.org/TR/xhtml1/transitional" class=
10834: "filename">PLIST</code> from a <span><strong class=
10835: "command">find -newer
1.14 xtraeme 10836: work/.extract_done</strong></span>. An attempt is
10837: made to care for shared libs etc., but it is
1.1 grant 10838: <span class="emphasis"><em>strongly</em></span>
10839: recommended to review the result before putting it
1.45 wiz 10840: into <code xmlns=
10841: "http://www.w3.org/TR/xhtml1/transitional" class=
10842: "filename">PLIST</code>. On upgrades, it's useful
10843: to diff the output of this command against an
10844: already existing <code xmlns=
10845: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10846: "filename">PLIST</code> file.</p>
1.1 grant 10847:
1.24 wiz 10848: <p>If the package installs files via <a href=
10849: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
10850: <span class="citerefentry"><span class=
10851: "refentrytitle">tar</span>(1)</span></a> or other
10852: methods that don't update file access times, be
10853: sure to add these files manually to your
1.45 wiz 10854: <code xmlns=
10855: "http://www.w3.org/TR/xhtml1/transitional" class=
10856: "filename">PLIST</code>, as the “<span class=
10857: "quote">find -newer</span>” command used by
10858: this target won't catch them!</p>
1.1 grant 10859:
10860: <p>See <a href="#print-PLIST" title=
1.38 dillo 10861: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 10862: “Tweaking output of <span><strong class=
10863: "command">make
10864: print-PLIST</strong></span>”</a> for more
10865: information on this target.</p>
1.1 grant 10866: </dd>
10867:
10868: <dt><span class="term">bulk-package</span></dt>
10869:
10870: <dd>
10871: <p>Used to do bulk builds. If an appropriate binary
10872: package already exists, no action is taken. If not,
10873: this target will compile, install and package it
1.47 reed 10874: (and its depends, if <code class=
1.14 xtraeme 10875: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 10876: <a href="#binary.configuration" title=
1.38 dillo 10877: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 10878: “Configuration”</a>). After creating
10879: the binary package, the sources, the just-installed
10880: package and its required packages are removed,
1.1 grant 10881: preserving free disk space.</p>
10882:
10883: <p><span class="emphasis"><em>Beware that this
10884: target may deinstall all packages installed on a
10885: system!</em></span></p>
10886: </dd>
10887:
10888: <dt><span class="term">bulk-install</span></dt>
10889:
10890: <dd>
10891: <p>Used during bulk-installs to install required
1.47 reed 10892: packages. If an up-to-date binary package is
1.1 grant 10893: available, it will be installed via <a href=
10894: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10895: <span class="citerefentry"><span class=
10896: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 10897: not, <span><strong class="command">make
10898: bulk-package</strong></span> will be executed, but
1.47 reed 10899: the installed binary won't be removed.</p>
1.1 grant 10900:
10901: <p>A binary package is considered
1.47 reed 10902: “<span class="quote">up-to-date</span>”
1.1 grant 10903: to be installed via <a href=
10904: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
10905: <span class="citerefentry"><span class=
10906: "refentrytitle">pkg_add</span>(1)</span></a>
10907: if:</p>
10908:
10909: <div class="itemizedlist">
10910: <ul type="disc">
10911: <li>
1.45 wiz 10912: <p>None of the package's files (<code xmlns=
10913: "http://www.w3.org/TR/xhtml1/transitional"
10914: class="filename">Makefile</code>, ...) were
1.14 xtraeme 10915: modified since it was built.</p>
1.1 grant 10916: </li>
10917:
10918: <li>
10919: <p>None of the package's required (binary)
10920: packages were modified since it was
10921: built.</p>
10922: </li>
10923: </ul>
10924: </div>
10925:
10926: <p><span class="emphasis"><em>Beware that this
10927: target may deinstall all packages installed on a
10928: system!</em></span></p>
10929: </dd>
10930: </dl>
10931: </div>
10932: </div>
10933: </div>
10934:
1.52 ! tv 10935: <div class="chapter" lang="en">
1.1 grant 10936: <div class="titlepage">
10937: <div>
10938: <div>
1.52 ! tv 10939: <h2 class="title"><a name=
1.38 dillo 10940: "fixes"></a>Chapter 15. Notes on fixes for
1.1 grant 10941: packages</h2>
10942: </div>
10943: </div>
10944: </div>
10945:
10946: <div class="toc">
10947: <p><b>Table of Contents</b></p>
10948:
10949: <dl>
1.30 wiz 10950: <dt><span class="sect1"><a href=
1.38 dillo 10951: "#general-operation">15.1. General
1.30 wiz 10952: operation</a></span></dt>
1.1 grant 10953:
10954: <dd>
10955: <dl>
10956: <dt><span class="sect2"><a href=
1.38 dillo 10957: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 10958: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 10959:
10960: <dt><span class="sect2"><a href=
1.38 dillo 10961: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 10962: install documentation</a></span></dt>
10963:
10964: <dt><span class="sect2"><a href=
1.38 dillo 10965: "#restricted-packages">15.1.3. Restricted
1.1 grant 10966: packages</a></span></dt>
10967:
10968: <dt><span class="sect2"><a href=
1.38 dillo 10969: "#dependencies">15.1.4. Handling
1.1 grant 10970: dependencies</a></span></dt>
10971:
10972: <dt><span class="sect2"><a href=
1.38 dillo 10973: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 10974: packages</a></span></dt>
10975:
10976: <dt><span class="sect2"><a href=
1.38 dillo 10977: "#not-building-packages">15.1.6. Packages that
1.30 wiz 10978: cannot or should not be built</a></span></dt>
1.1 grant 10979:
10980: <dt><span class="sect2"><a href=
1.38 dillo 10981: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 10982: should not be deleted, once
10983: installed</a></span></dt>
1.1 grant 10984:
10985: <dt><span class="sect2"><a href=
1.38 dillo 10986: "#security-handling">15.1.8. Handling packages with
1.1 grant 10987: security problems</a></span></dt>
10988:
10989: <dt><span class="sect2"><a href=
1.38 dillo 10990: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 10991: bugs</a></span></dt>
10992:
10993: <dt><span class="sect2"><a href=
1.38 dillo 10994: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 10995: incrementing versions when fixing an existing
1.1 grant 10996: package</a></span></dt>
10997:
10998: <dt><span class="sect2"><a href=
1.38 dillo 10999: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11000: packages</a></span></dt>
11001: </dl>
11002: </dd>
11003:
1.30 wiz 11004: <dt><span class="sect1"><a href=
1.38 dillo 11005: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11006: issues</a></span></dt>
1.1 grant 11007:
11008: <dd>
11009: <dl>
11010: <dt><span class="sect2"><a href=
1.38 dillo 11011: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11012: distfiles aren't available for plain
1.1 grant 11013: downloading</a></span></dt>
11014:
11015: <dt><span class="sect2"><a href=
1.38 dillo 11016: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11017: handle modified distfiles with the 'old'
11018: name</a></span></dt>
1.1 grant 11019: </dl>
11020: </dd>
11021:
1.30 wiz 11022: <dt><span class="sect1"><a href=
1.38 dillo 11023: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11024: gotchas</a></span></dt>
1.1 grant 11025:
11026: <dd>
11027: <dl>
11028: <dt><span class="sect2"><a href=
1.38 dillo 11029: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11030: libtool</a></span></dt>
11031:
11032: <dt><span class="sect2"><a href=
1.38 dillo 11033: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11034: packages that already support
11035: libtool</a></span></dt>
1.1 grant 11036:
11037: <dt><span class="sect2"><a href=
1.38 dillo 11038: "#autoconf-automake">15.3.3. GNU
1.1 grant 11039: Autoconf/Automake</a></span></dt>
11040: </dl>
11041: </dd>
11042:
1.30 wiz 11043: <dt><span class="sect1"><a href=
1.38 dillo 11044: "#building-considerations">15.4. Building
1.30 wiz 11045: considerations</a></span></dt>
1.1 grant 11046:
11047: <dd>
11048: <dl>
11049: <dt><span class="sect2"><a href=
1.38 dillo 11050: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11051:
11052: <dt><span class="sect2"><a href="#cpp-list">15.4.2.
11053: Getting a list of CPP defines</a></span></dt>
1.1 grant 11054: </dl>
11055: </dd>
11056:
1.30 wiz 11057: <dt><span class="sect1"><a href=
1.38 dillo 11058: "#package-specific-actions">15.5. Package specific
1.30 wiz 11059: actions</a></span></dt>
1.1 grant 11060:
11061: <dd>
11062: <dl>
11063: <dt><span class="sect2"><a href=
1.38 dillo 11064: "#user-interaction">15.5.1. User
1.2 hubertf 11065: interaction</a></span></dt>
1.1 grant 11066:
11067: <dt><span class="sect2"><a href=
1.38 dillo 11068: "#handling-licenses">15.5.2. Handling
1.1 grant 11069: licenses</a></span></dt>
11070:
11071: <dt><span class="sect2"><a href=
1.38 dillo 11072: "#installing-score-files">15.5.3. Installing score
1.1 grant 11073: files</a></span></dt>
11074:
11075: <dt><span class="sect2"><a href=
1.38 dillo 11076: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11077: scripts</a></span></dt>
11078:
11079: <dt><span class="sect2"><a href=
1.38 dillo 11080: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11081: paths to other interpreters</a></span></dt>
1.1 grant 11082:
11083: <dt><span class="sect2"><a href=
1.38 dillo 11084: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11085: modules</a></span></dt>
11086:
11087: <dt><span class="sect2"><a href=
1.38 dillo 11088: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11089: files</a></span></dt>
11090:
11091: <dt><span class="sect2"><a href=
1.38 dillo 11092: "#gconf2-data-files">15.5.8. Packages installing
1.30 wiz 11093: GConf2 data files</a></span></dt>
1.1 grant 11094:
11095: <dt><span class="sect2"><a href=
1.38 dillo 11096: "#scrollkeeper-data-files">15.5.9. Packages
1.30 wiz 11097: installing scrollkeeper data files</a></span></dt>
1.1 grant 11098:
11099: <dt><span class="sect2"><a href=
1.38 dillo 11100: "#x11-fonts">15.5.10. Packages installing X11
1.1 grant 11101: fonts</a></span></dt>
11102:
11103: <dt><span class="sect2"><a href=
1.38 dillo 11104: "#gtk2-modules">15.5.11. Packages installing GTK2
1.1 grant 11105: modules</a></span></dt>
11106:
11107: <dt><span class="sect2"><a href=
1.38 dillo 11108: "#sgml-xml-data">15.5.12. Packages installing SGML
1.30 wiz 11109: or XML data</a></span></dt>
1.1 grant 11110:
11111: <dt><span class="sect2"><a href=
1.38 dillo 11112: "#mime-database">15.5.13. Packages installing
1.1 grant 11113: extensions to the MIME database</a></span></dt>
11114:
11115: <dt><span class="sect2"><a href=
1.38 dillo 11116: "#intltool">15.5.14. Packages using
1.1 grant 11117: intltool</a></span></dt>
1.18 xtraeme 11118:
11119: <dt><span class="sect2"><a href=
1.38 dillo 11120: "#startup-scripts">15.5.15. Packages installing
1.30 wiz 11121: startup scripts</a></span></dt>
1.1 grant 11122: </dl>
11123: </dd>
11124:
1.30 wiz 11125: <dt><span class="sect1"><a href=
1.38 dillo 11126: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11127: author</a></span></dt>
1.1 grant 11128: </dl>
11129: </div>
11130:
1.52 ! tv 11131: <div class="sect1" lang="en">
1.1 grant 11132: <div class="titlepage">
11133: <div>
11134: <div>
11135: <h2 class="title" style="clear: both"><a name=
1.38 dillo 11136: "general-operation"></a>15.1. General
1.1 grant 11137: operation</h2>
11138: </div>
11139: </div>
11140: </div>
11141:
1.52 ! tv 11142: <div class="sect2" lang="en">
1.1 grant 11143: <div class="titlepage">
11144: <div>
11145: <div>
1.30 wiz 11146: <h3 class="title"><a name=
1.38 dillo 11147: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11148: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11149: </div>
11150: </div>
11151: </div>
11152:
11153: <p>The problem with package-defined variables that can
1.14 xtraeme 11154: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11155: or <code xmlns=
11156: "http://www.w3.org/TR/xhtml1/transitional" class=
11157: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11158: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11159: <span class="citerefentry"><span class=
11160: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11161: variable as it is used, but evaluates preprocessor-like
1.1 grant 11162: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11163: So, to use any variable (which may be set in
1.45 wiz 11164: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11165: class="filename">/etc/mk.conf</code>) in one of the
11166: .if* statements, the file <code xmlns=
11167: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11168: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11169: that .if* statement.</p>
11170:
1.47 reed 11171: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11172: including <code xmlns=
11173: "http://www.w3.org/TR/xhtml1/transitional" class=
11174: "filename">/etc/mk.conf</code>, should it exist, or
11175: <code class="varname">MAKECONF</code>, should it exist,
11176: include the <code xmlns=
11177: "http://www.w3.org/TR/xhtml1/transitional" class=
11178: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11179: package Makefile before any preprocessor-like .if,
11180: .ifdef, or .ifndef statements:</p>
1.1 grant 11181: <pre class="programlisting">
1.51 rillig 11182: .include "../../mk/bsd.prefs.mk"
11183:
1.1 grant 11184: .if defined(USE_MENUS)
1.51 rillig 11185: # ...
1.1 grant 11186: .endif
11187: </pre>
11188:
1.14 xtraeme 11189: <p>If you wish to set the <code class=
1.45 wiz 11190: "varname">CFLAGS</code> variable in <code xmlns=
11191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11192: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11193: use:</p>
11194: <pre class="programlisting">
1.51 rillig 11195: CFLAGS+= -your -flags
1.1 grant 11196: </pre>
11197:
1.14 xtraeme 11198: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11199: without the “<span class="quote">+</span>”)
11200: may lead to problems with packages that need to add
11201: their own flags. Also, you may want to take a look at
11202: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11203: href=
11204: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11205: target="_top"><code xmlns="" class=
11206: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11207: interested in optimization for the current CPU.</p>
1.1 grant 11208: </div>
11209:
1.52 ! tv 11210: <div class="sect2" lang="en">
1.1 grant 11211: <div class="titlepage">
11212: <div>
11213: <div>
1.31 wiz 11214: <h3 class="title"><a name=
1.38 dillo 11215: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11216: to install documentation</h3>
11217: </div>
11218: </div>
11219: </div>
11220:
1.45 wiz 11221: <p>Documentation should be installed into <code xmlns=
11222: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11223: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11224: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11225: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11226: (the latter includes the version number of the
11227: package).</p>
1.31 wiz 11228: </div>
11229:
1.52 ! tv 11230: <div class="sect2" lang="en">
1.31 wiz 11231: <div class="titlepage">
11232: <div>
11233: <div>
1.52 ! tv 11234: <h3 class="title"><a name=
1.38 dillo 11235: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11236: packages</h3>
11237: </div>
11238: </div>
11239: </div>
11240:
11241: <p>Some licenses restrict how software may be
11242: re-distributed. In order to satisfy these restrictions,
11243: the package system defines five make variables that can
11244: be set to note these restrictions:</p>
11245:
11246: <div class="itemizedlist">
11247: <ul type="disc">
11248: <li>
1.14 xtraeme 11249: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11250:
11251: <p>This variable should be set whenever a
11252: restriction exists (regardless of its kind). Set
11253: this variable to a string containing the reason
11254: for the restriction.</p>
11255: </li>
11256:
11257: <li>
1.14 xtraeme 11258: <p><code class=
11259: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11260:
11261: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11262: variable to <code class=
11263: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11264: package may not be included on a CD-ROM.</p>
11265: </li>
11266:
11267: <li>
1.14 xtraeme 11268: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11269:
11270: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11271: Set this variable to <code class=
11272: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11273: package may not not be made available on the
11274: Internet.</p>
11275: </li>
11276:
11277: <li>
1.14 xtraeme 11278: <p><code class=
11279: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11280:
11281: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11282: this variable to <code class=
11283: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11284: of the source code or other distfile(s) is not
11285: allowed on CD-ROMs.</p>
11286: </li>
11287:
11288: <li>
1.14 xtraeme 11289: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11290:
11291: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11292: variable to <code class=
11293: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11294: of the source code or other distfile(s) via the
11295: Internet is not allowed.</p>
11296: </li>
11297: </ul>
11298: </div>
11299:
1.14 xtraeme 11300: <p>Please note that the use of <code class=
11301: "varname">NO_PACKAGE</code>, <code class=
11302: "varname">IGNORE</code>, <code class=
11303: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11304: variables to denote restrictions is deprecated, because
11305: they unconditionally prevent users from generating
11306: binary packages!</p>
11307: </div>
11308:
1.52 ! tv 11309: <div class="sect2" lang="en">
1.1 grant 11310: <div class="titlepage">
11311: <div>
11312: <div>
1.52 ! tv 11313: <h3 class="title"><a name=
1.38 dillo 11314: "dependencies"></a>15.1.4. Handling
1.1 grant 11315: dependencies</h3>
11316: </div>
11317: </div>
11318: </div>
11319:
11320: <p>Your package may depend on some other package being
11321: present - and there are various ways of expressing this
1.14 xtraeme 11322: dependency. pkgsrc supports the <code class=
11323: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11324: "varname">DEPENDS</code> definitions, the <code class=
11325: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11326: dependencies via <code xmlns=
11327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11328: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11329: way to handle dependencies, and which uses the
11330: variables named above. See <a href="#buildlink" title=
1.38 dillo 11331: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11332: <i>Buildlink methodology</i></a> for more
11333: information.</p>
11334:
11335: <p>The basic difference between the two variables is as
1.14 xtraeme 11336: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11337: definition registers that pre-requisite in the binary
11338: package so it will be pulled in when the binary package
1.14 xtraeme 11339: is later installed, whilst the <code class=
11340: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11341: marking a dependency that is only needed for building
11342: the package.</p>
11343:
11344: <p>This means that if you only need a package present
11345: whilst you are building, it should be noted as a
1.14 xtraeme 11346: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11347:
1.14 xtraeme 11348: <p>The format for a <code class=
11349: "varname">BUILD_DEPENDS</code> and a <code class=
11350: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11351: <pre class="programlisting">
1.51 rillig 11352: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11353: </pre>
11354:
11355: <p>Please note that the “<span class=
11356: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11357: any of the wildcard version numbers recognized by
1.1 grant 11358: <a href=
11359: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11360: <span class="citerefentry"><span class=
11361: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11362:
11363: <div class="orderedlist">
11364: <ol type="1">
11365: <li>
11366: <p>If your package needs another package's
11367: binaries or libraries to build or run, and if
1.45 wiz 11368: that package has a <code xmlns=
11369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11370: "filename">buildlink3.mk</code> file available,
11371: use it:</p>
1.1 grant 11372: <pre class="programlisting">
11373: .include "../../graphics/jpeg/buildlink3.mk"
11374: </pre>
11375: </li>
11376:
11377: <li>
11378: <p>If your package needs to use another package
1.45 wiz 11379: to build itself and there is no <code xmlns=
11380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11381: "filename">buildlink3.mk</code> file available,
11382: use the <code class=
11383: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11384: <pre class="programlisting">
1.51 rillig 11385: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 11386: </pre>
11387: </li>
11388:
11389: <li>
11390: <p>If your package needs a library with which to
1.45 wiz 11391: link and again there is no <code xmlns=
11392: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11393: "filename">buildlink3.mk</code> file available,
11394: this is specified using the <code class=
11395: "varname">DEPENDS</code> definition. An example
11396: of this is the <a xmlns=
1.1 grant 11397: "http://www.w3.org/TR/xhtml1/transitional" href=
11398: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11399: target="_top"><code xmlns="" class=
11400: "filename">print/lyx</code></a> package, which
11401: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11402: <pre class="programlisting">
1.51 rillig 11403: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 11404: </pre>
11405:
11406: <p>You can also use wildcards in package
11407: dependences:</p>
11408: <pre class="programlisting">
1.51 rillig 11409: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 11410: </pre>
11411:
11412: <p>Note that such wildcard dependencies are
11413: retained when creating binary packages. The
11414: dependency is checked when installing the binary
11415: package and any package which matches the pattern
11416: will be used. Wildcard dependencies should be
11417: used with care.</p>
11418:
11419: <p>The “<span class=
11420: "quote">-[0-9]*</span>” should be used
11421: instead of “<span class=
11422: "quote">-*</span>” to avoid potentially
11423: ambiguous matches such as “<span class=
11424: "quote">tk-postgresql</span>” matching a
11425: “<span class="quote">tk-*</span>”
1.14 xtraeme 11426: <code class="varname">DEPENDS</code>.</p>
1.1 grant 11427:
11428: <p>Wildcards can also be used to specify that a
11429: package will only build against a certain minimum
11430: version of a pre-requisite:</p>
11431: <pre class="programlisting">
1.51 rillig 11432: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 11433: </pre>
11434:
11435: <p>This means that the package will build against
11436: version 3.5.4 of the tiff library or newer. Such
11437: a dependency may be warranted if, for example,
11438: the API of the library has changed with version
11439: 3.5.4 and a package would not compile against an
11440: earlier version of tiff.</p>
11441:
11442: <p>Please note that such dependencies should only
11443: be updated if a package requires a newer
11444: pre-requisite, but not to denote recommendations
11445: such as security updates or ABI changes that do
11446: not prevent a package from building correctly.
11447: Such recommendations can be expressed using
1.14 xtraeme 11448: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 11449: <pre class="programlisting">
1.51 rillig 11450: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 11451: </pre>
11452:
1.14 xtraeme 11453: <p>In addition to the above <code class=
11454: "varname">DEPENDS</code> line, this denotes that
1.1 grant 11455: while a package will build against
11456: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 11457: recommended. <code class=
11458: "varname">RECOMMENDED</code> entries will be
11459: turned into dependencies unless explicitly
11460: ignored (in which case a warning will be
1.36 wiz 11461: printed).</p>
11462:
11463: <p>To ignore these dependency recommendations and
11464: just use the required <code class=
11465: "varname">DEPENDS</code>, set <code class=
11466: "varname">IGNORE_RECOMMENDED=YES</code>. This may
11467: make it easier and faster to update packages
11468: built using pkgsrc, since older compatible
11469: dependencies can continue to be used. This is
11470: useful for people who watch their rebuilds very
11471: carefully; it is not very good as a
11472: general-purpose hammer. If you use it, you need
11473: to be mindful of possible ABI changes, including
11474: those from the underlying OS.</p>
11475:
11476: <p>Packages that are built with recommendations
11477: ignored may not be uploaded to ftp.NetBSD.org by
11478: developers and should not be used across
11479: different systems that may have different
11480: versions of binary packages installed.</p>
1.1 grant 11481:
11482: <p>For security fixes, please update the package
11483: vulnerabilities file as well as setting
1.14 xtraeme 11484: <code class="varname">RECOMMENDED</code>, see
1.1 grant 11485: <a href="#security-handling" title=
1.38 dillo 11486: "15.1.8. Handling packages with security problems">
1.52 ! tv 11487: Section 15.1.8, “Handling packages
! 11488: with security problems”</a> for more
1.1 grant 11489: information.</p>
11490: </li>
11491:
11492: <li>
11493: <p>If your package needs some executable to be
1.17 sketch 11494: able to run correctly and if there's no
1.45 wiz 11495: <code xmlns=
11496: "http://www.w3.org/TR/xhtml1/transitional" class=
11497: "filename">buildlink3.mk</code> file, this is
11498: specified using the <code class=
1.14 xtraeme 11499: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 11500: "http://www.w3.org/TR/xhtml1/transitional" href=
11501: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11502: target="_top"><code xmlns="" class=
11503: "filename">print/lyx</code></a> package needs to
11504: be able to execute the latex binary from the
11505: teTeX package when it runs, and that is
11506: specified:</p>
1.1 grant 11507: <pre class="programlisting">
1.51 rillig 11508: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 11509: </pre>
11510:
11511: <p>The comment about wildcard dependencies from
11512: previous paragraph applies here, too.</p>
11513: </li>
11514: </ol>
11515: </div>
11516:
11517: <p>If your package needs files from another package to
11518: build, see the first part of the “<span class=
11519: "quote">do-configure</span>” target <a xmlns=
11520: "http://www.w3.org/TR/xhtml1/transitional" href=
11521: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 11522: target="_top"><code xmlns="" class=
11523: "filename">print/ghostscript5</code></a> package (it
1.20 ben 11524: relies on the jpeg sources being present in source form
11525: during the build):</p>
1.1 grant 11526: <pre class="programlisting">
1.51 rillig 11527: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
11528: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 11529: fi
11530: </pre>
11531:
11532: <p>If you build any other packages that way, please
11533: make sure the working files are deleted too when this
11534: package's working files are cleaned up. The easiest way
11535: to do so is by adding a pre-clean target:</p>
11536: <pre class="programlisting">
1.51 rillig 11537: pre-clean:
11538: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 11539: </pre>
11540:
1.14 xtraeme 11541: <p>Please also note the <code class=
11542: "varname">BUILD_USES_MSGFMT</code> and <code class=
11543: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
11544: which are provided as convenience definitions. The
1.24 wiz 11545: former works out whether <a href=
11546: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
11547: <span class="citerefentry"><span class=
11548: "refentrytitle">msgfmt</span>(1)</span></a> is part of
11549: the base system, and, if it isn't, installs the
11550: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11551: href=
1.1 grant 11552: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 11553: target="_top"><code xmlns="" class=
11554: "filename">devel/gettext</code></a> package. The latter
1.20 ben 11555: adds a build dependency on either an installed version
11556: of an older gettext package, or if it isn't, installs
11557: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11558: href=
11559: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 11560: target="_top"><code xmlns="" class=
11561: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 11562: </div>
11563:
1.52 ! tv 11564: <div class="sect2" lang="en">
1.1 grant 11565: <div class="titlepage">
11566: <div>
11567: <div>
1.52 ! tv 11568: <h3 class="title"><a name=
1.38 dillo 11569: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 11570: with other packages</h3>
11571: </div>
11572: </div>
11573: </div>
11574:
11575: <p>Your package may conflict with other packages a user
11576: might already have installed on his system, e.g. if
11577: your package installs the same set of files like
11578: another package in our pkgsrc tree.</p>
11579:
1.14 xtraeme 11580: <p>In this case you can set <code class=
1.47 reed 11581: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 11582: packages (including version string) your package
11583: conflicts with.</p>
11584:
1.47 reed 11585: <p>For example, <a xmlns=
1.1 grant 11586: "http://www.w3.org/TR/xhtml1/transitional" href=
11587: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 11588: target="_top"><code xmlns="" class=
11589: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 11590: "http://www.w3.org/TR/xhtml1/transitional" href=
11591: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 11592: target="_top"><code xmlns="" class=
1.47 reed 11593: "filename">x11/Xaw-Xpm</code></a> install the same
11594: shared library, thus you set in <code xmlns=
1.45 wiz 11595: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11596: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 11597: <pre class="programlisting">
1.51 rillig 11598: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 11599: </pre>
11600:
1.45 wiz 11601: <p>and in <code xmlns=
11602: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11603: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 11604: <pre class="programlisting">
1.51 rillig 11605: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 11606: </pre>
11607:
11608: <p>Packages will automatically conflict with other
11609: packages with the name prefix and a different version
11610: string. “<span class=
11611: "quote">Xaw3d-1.5</span>” e.g. will automatically
11612: conflict with the older version “<span class=
11613: "quote">Xaw3d-1.3</span>”.</p>
11614: </div>
11615:
1.52 ! tv 11616: <div class="sect2" lang="en">
1.1 grant 11617: <div class="titlepage">
11618: <div>
11619: <div>
1.52 ! tv 11620: <h3 class="title"><a name=
1.38 dillo 11621: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 11622: that cannot or should not be built</h3>
1.1 grant 11623: </div>
11624: </div>
11625: </div>
11626:
11627: <p>There are several reasons why a package might be
11628: instructed to not build under certain circumstances. If
11629: the package builds and runs on most platforms, the
1.14 xtraeme 11630: exceptions should be noted with <code class=
11631: "varname">NOT_FOR_PLATFORM</code>. If the package
11632: builds and runs on a small handful of platforms, set
11633: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 11634: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
11635: <code class="varname">NOT_FOR_PLATFORM</code> are OS
11636: triples (OS-version-platform) that can use glob-style
11637: wildcards.</p>
11638:
11639: <p>If the package should be skipped (for example,
11640: because it provides functionality already provided by
11641: the system), set <code class=
1.14 xtraeme 11642: "varname">PKG_SKIP_REASON</code> to a descriptive
11643: message. If the package should fail because some
11644: preconditions are not met, set <code class=
11645: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 11646: message.</p>
11647: </div>
11648:
1.52 ! tv 11649: <div class="sect2" lang="en">
1.1 grant 11650: <div class="titlepage">
11651: <div>
11652: <div>
1.52 ! tv 11653: <h3 class="title"><a name=
1.38 dillo 11654: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 11655: which should not be deleted, once installed</h3>
1.1 grant 11656: </div>
11657: </div>
11658: </div>
11659:
11660: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 11661: has been installed, the <code class=
11662: "varname">PKG_PRESERVE</code> definition should be set
11663: in the package Makefile. This will be carried into any
1.1 grant 11664: binary package that is made from this pkgsrc entry. A
11665: “<span class="quote">preserved</span>”
11666: package will not be deleted using <a href=
11667: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11668: <span class="citerefentry"><span class=
11669: "refentrytitle">pkg_delete</span>(1)</span></a> unless
11670: the “<span class="quote">-f</span>” option
11671: is used.</p>
11672: </div>
11673:
1.52 ! tv 11674: <div class="sect2" lang="en">
1.1 grant 11675: <div class="titlepage">
11676: <div>
11677: <div>
1.52 ! tv 11678: <h3 class="title"><a name=
1.38 dillo 11679: "security-handling"></a>15.1.8. Handling
1.1 grant 11680: packages with security problems</h3>
11681: </div>
11682: </div>
11683: </div>
11684:
11685: <p>When a vulnerability is found, this should be noted
1.45 wiz 11686: in <code xmlns=
11687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11688: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 11689: and after committing that file, use
11690: <span><strong class="command">make
11691: upload</strong></span> in the same directory to update
11692: the file on ftp.NetBSD.org.</p>
11693:
11694: <p>After fixing the vulnerability by a patch, its
11695: <code class="varname">PKGREVISION</code> should be
11696: increased (this is of course not necessary if the
11697: problem is fixed by using a newer release of the
1.45 wiz 11698: software). In addition, if a <code xmlns=
11699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11700: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 11701: affected package, a corresponding <code class=
1.14 xtraeme 11702: "varname">BUILDLINK_RECOMMENDED.<em class=
11703: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 11704: be added or updated in it.</p>
1.1 grant 11705:
11706: <p>Also, if the fix should be applied to the stable
11707: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 11708:
11709: <p>Binary packages already on ftp.NetBSD.org will be
11710: handled semi-automatically by a weekly cron job.</p>
1.1 grant 11711: </div>
11712:
1.52 ! tv 11713: <div class="sect2" lang="en">
1.1 grant 11714: <div class="titlepage">
11715: <div>
11716: <div>
1.52 ! tv 11717: <h3 class="title"><a name=
1.38 dillo 11718: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 11719: compiler bugs</h3>
11720: </div>
11721: </div>
11722: </div>
11723:
11724: <p>Some source files trigger bugs in the compiler,
11725: based on combinations of compiler version and
11726: architecture and almost always relation to optimisation
11727: being enabled. Common symptoms are gcc internal errors
11728: or never finishing compiling a file.</p>
11729:
1.47 reed 11730: <p>Typically, a workaround involves testing the
1.14 xtraeme 11731: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 11732: version, disabling optimisation for that
1.14 xtraeme 11733: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 11734: combination, and documenting it in <code xmlns=
11735: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11736: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 11737: number of examples!</p>
11738: </div>
11739:
1.52 ! tv 11740: <div class="sect2" lang="en">
1.1 grant 11741: <div class="titlepage">
11742: <div>
11743: <div>
1.52 ! tv 11744: <h3 class="title"><a name=
! 11745: "bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 11746: handle incrementing versions when fixing an
11747: existing package</h3>
1.1 grant 11748: </div>
11749: </div>
11750: </div>
11751:
11752: <p>When making fixes to an existing package it can be
1.14 xtraeme 11753: useful to change the version number in <code class=
11754: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 11755: future versions by the original author, a
11756: “<span class="quote">nb1</span>”,
11757: “<span class="quote">nb2</span>”, ...
11758: suffix can be used on package versions by setting
1.14 xtraeme 11759: <code class="varname">PKGREVISION=1</code> (2, ...).
11760: The “<span class="quote">nb</span>” is
11761: treated like a “<span class=
11762: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 11763: <pre class="programlisting">
1.51 rillig 11764: DISTNAME= foo-17.42
11765: PKGREVISION= 9
1.1 grant 11766: </pre>
11767:
1.14 xtraeme 11768: <p>will result in a <code class=
11769: "varname">PKGNAME</code> of “<span class=
1.1 grant 11770: "quote">foo-17.42nb9</span>”.</p>
11771:
11772: <p>When a new release of the package is released, the
1.14 xtraeme 11773: <code class="varname">PKGREVISION</code> should be
1.47 reed 11774: removed, e.g. on a new minor release of the above
1.14 xtraeme 11775: package, things should be like:</p>
1.1 grant 11776: <pre class="programlisting">
1.51 rillig 11777: DISTNAME= foo-17.43
1.1 grant 11778: </pre>
11779: </div>
11780:
1.52 ! tv 11781: <div class="sect2" lang="en">
1.1 grant 11782: <div class="titlepage">
11783: <div>
11784: <div>
1.30 wiz 11785: <h3 class="title"><a name=
1.38 dillo 11786: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 11787: of packages</h3>
1.1 grant 11788: </div>
11789: </div>
11790: </div>
11791:
11792: <p>One appealing feature of pkgsrc is that it runs on
11793: many different platforms. As a result, it is important
11794: to ensure, where possible, that packages in pkgsrc are
11795: portable. There are some particular details you should
11796: pay attention to while working on pkgsrc.</p>
11797:
1.52 ! tv 11798: <div class="sect3" lang="en">
1.1 grant 11799: <div class="titlepage">
11800: <div>
11801: <div>
1.52 ! tv 11802: <h4 class="title"><a name=
1.38 dillo 11803: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 11804: ${INSTALL_DATA_DIR}, ...</h4>
11805: </div>
11806: </div>
11807: </div>
11808:
1.14 xtraeme 11809: <p>The BSD-compatible <span><strong class=
11810: "command">install</strong></span> supplied with some
1.1 grant 11811: operating systems will not perform more than one
11812: operation at a time. As such, you should call
11813: “<span class="quote">${INSTALL}</span>”,
11814: etc. like this:</p>
11815: <pre class="programlisting">
1.51 rillig 11816: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
11817: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 11818: </pre>
11819: </div>
11820: </div>
11821: </div>
11822:
1.52 ! tv 11823: <div class="sect1" lang="en">
1.1 grant 11824: <div class="titlepage">
11825: <div>
11826: <div>
11827: <h2 class="title" style="clear: both"><a name=
1.38 dillo 11828: "downloading-issues"></a>15.2. Possible
1.1 grant 11829: downloading issues</h2>
11830: </div>
11831: </div>
11832: </div>
11833:
1.52 ! tv 11834: <div class="sect2" lang="en">
1.1 grant 11835: <div class="titlepage">
11836: <div>
11837: <div>
1.52 ! tv 11838: <h3 class="title"><a name=
1.38 dillo 11839: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 11840: whose distfiles aren't available for plain
1.1 grant 11841: downloading</h3>
11842: </div>
11843: </div>
11844: </div>
11845:
11846: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 11847: set <code class="varname">DYNAMIC_MASTER_SITES</code>
11848: and a <span><strong class="command">make
1.45 wiz 11849: fetch</strong></span> will call <code xmlns=
11850: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11851: "filename">files/getsite.sh</code> with the name of
11852: each file to download as an argument, expecting it to
11853: output the URL of the directory from which to download
11854: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11855: href=
1.1 grant 11856: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 11857: target="_top"><code xmlns="" class=
11858: "filename">graphics/ns-cult3d</code></a> is an example
11859: of this usage.</p>
1.1 grant 11860:
11861: <p>If the download can't be automated, because the user
11862: must submit personal information to apply for a
11863: password, or must pay for the source, or whatever, you
1.14 xtraeme 11864: can set <code class="varname">_FETCH_MESSAGE</code> to
11865: a macro which displays a message explaining the
11866: situation. <code class="varname">_FETCH_MESSAGE</code>
11867: must be executable shell commands, not just a message.
11868: (Generally, it executes <code class=
11869: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 11870: following packages use this: <a xmlns=
11871: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11872: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 11873: target="_top"><code xmlns="" class=
11874: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 11875: "http://www.w3.org/TR/xhtml1/transitional" href=
11876: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 11877: target="_top"><code xmlns="" class=
11878: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 11879: "http://www.w3.org/TR/xhtml1/transitional" href=
11880: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 11881: target="_top"><code xmlns="" class=
11882: "filename">emulators/vmware-module</code></a>,
11883: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11884: href=
1.20 ben 11885: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 11886: target="_top"><code xmlns="" class=
11887: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 11888: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 11889: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 11890: target="_top"><code xmlns="" class=
11891: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 11892: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 11893: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 11894: target="_top"><code xmlns="" class=
11895: "filename">sysutils/storage-manager</code></a>,
11896: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
11897: href=
1.20 ben 11898: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 11899: target="_top"><code xmlns="" class=
11900: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 11901: "http://www.w3.org/TR/xhtml1/transitional" href=
11902: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 11903: target="_top"><code xmlns="" class=
11904: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 11905: with them.</p>
1.1 grant 11906: </div>
11907:
1.52 ! tv 11908: <div class="sect2" lang="en">
1.1 grant 11909: <div class="titlepage">
11910: <div>
11911: <div>
1.30 wiz 11912: <h3 class="title"><a name=
1.38 dillo 11913: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 11914: to handle modified distfiles with the 'old'
11915: name</h3>
1.1 grant 11916: </div>
11917: </div>
11918: </div>
11919:
11920: <p>Sometimes authors of a software package make some
11921: modifications after the software was released, and they
11922: put up a new distfile without changing the package's
11923: version number. If a package is already in pkgsrc at
1.32 wiz 11924: that time, the checksum will no longer match. The
11925: contents of the new distfile should be compared against
11926: the old one before changing anything, to make sure the
11927: distfile was really updated on purpose, and that no
11928: trojan horse or so crept in. Then, the correct way to
11929: work around this is to set <code class=
11930: "varname">DIST_SUBDIR</code> to a unique directory
11931: name, usually based on <code class=
11932: "varname">PKGNAME_NOREV</code>. In case this happens
11933: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 11934: used (thus including the <code xmlns=
11935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11936: "filename">nbX</code> suffix) or a date stamp can be
11937: appended, like <code class=
11938: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 11939: forget regenerating the <code xmlns=
11940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 11941: "filename">distinfo</code> file after that, since it
11942: contains the <code class="varname">DIST_SUBDIR</code>
11943: path in the filenames. Furthermore, a mail to the
11944: package's authors seems appropriate telling them that
11945: changing distfiles after releases without changing the
11946: file names is not good practice.</p>
1.1 grant 11947: </div>
11948: </div>
11949:
1.52 ! tv 11950: <div class="sect1" lang="en">
1.1 grant 11951: <div class="titlepage">
11952: <div>
11953: <div>
11954: <h2 class="title" style="clear: both"><a name=
1.38 dillo 11955: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 11956: gotchas</h2>
11957: </div>
11958: </div>
11959: </div>
11960:
1.52 ! tv 11961: <div class="sect2" lang="en">
1.1 grant 11962: <div class="titlepage">
11963: <div>
11964: <div>
1.52 ! tv 11965: <h3 class="title"><a name=
1.38 dillo 11966: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 11967: - libtool</h3>
11968: </div>
11969: </div>
11970: </div>
11971:
11972: <p>pkgsrc supports many different machines, with
11973: different object formats like a.out and ELF, and
11974: varying abilities to do shared library and dynamic
11975: loading at all. To accompany this, varying commands and
11976: options have to be passed to the compiler, linker, etc.
11977: to get the Right Thing, which can be pretty annoying
11978: especially if you don't have all the machines at your
11979: hand to test things. The <a xmlns=
11980: "http://www.w3.org/TR/xhtml1/transitional" href=
11981: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 11982: target="_top"><code xmlns="" class=
11983: "filename">devel/libtool</code></a> pkg can help here,
11984: as it just “<span class=
11985: "quote">knows</span>” how to build both static
11986: and dynamic libraries from a set of source files, thus
1.47 reed 11987: being platform-independent.</p>
1.1 grant 11988:
11989: <p>Here's how to use libtool in a pkg in seven simple
11990: steps:</p>
11991:
11992: <div class="orderedlist">
11993: <ol type="1">
11994: <li>
1.14 xtraeme 11995: <p>Add <code class=
11996: "varname">USE_LIBTOOL=yes</code> to the package
11997: Makefile.</p>
1.1 grant 11998: </li>
11999:
12000: <li>
12001: <p>For library objects, use “<span class=
12002: "quote">${LIBTOOL} --mode=compile
12003: ${CC}</span>” in place of
12004: “<span class="quote">${CC}</span>”.
12005: You could even add it to the definition of
1.14 xtraeme 12006: <code class="varname">CC</code>, if only
12007: libraries are being built in a given Makefile.
12008: This one command will build both PIC and non-PIC
12009: library objects, so you need not have separate
12010: shared and non-shared library rules.</p>
1.1 grant 12011: </li>
12012:
12013: <li>
12014: <p>For the linking of the library, remove any
12015: “<span class="quote">ar</span>”,
12016: “<span class="quote">ranlib</span>”,
12017: and “<span class="quote">ld
12018: -Bshareable</span>” commands, and instead
12019: use:</p>
12020: <pre class="programlisting">
1.51 rillig 12021: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12022: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12023: </pre>
12024:
12025: <p>Note that the library is changed to have a
1.45 wiz 12026: <code xmlns=
12027: "http://www.w3.org/TR/xhtml1/transitional" class=
12028: "filename">.la</code> extension, and the objects
12029: are changed to have a <code xmlns=
12030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12031: "filename">.lo</code> extension. Change
12032: <code class="varname">OBJS</code> as necessary.
12033: This automatically creates all of the
1.45 wiz 12034: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12035: class="filename">.a</code>, <code xmlns=
12036: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12037: "filename">.so.major.minor</code>, and ELF
12038: symlinks (if necessary) in the build directory.
12039: Be sure to include “<span class=
1.1 grant 12040: "quote">-version-info</span>”, especially
12041: when major and minor are zero, as libtool will
12042: otherwise strip off the shared library
12043: version.</p>
12044:
12045: <p>From the libtool manual:</p>
12046: <pre class="programlisting">
1.51 rillig 12047: So, libtool library versions are described by three integers:
1.1 grant 12048:
1.51 rillig 12049: CURRENT
12050: The most recent interface number that this library implements.
1.1 grant 12051:
1.51 rillig 12052: REVISION
12053: The implementation number of the CURRENT interface.
1.1 grant 12054:
1.51 rillig 12055: AGE
12056: The difference between the newest and oldest interfaces that
12057: this library implements. In other words, the library implements
12058: all the interface numbers in the range from number `CURRENT -
12059: AGE' to `CURRENT'.
1.1 grant 12060:
1.51 rillig 12061: If two libraries have identical CURRENT and AGE numbers, then the
12062: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12063: </pre>
12064:
12065: <p>The “<span class=
12066: "quote">-release</span>” option will
12067: produce different results for a.out and ELF
12068: (excluding symlinks) in only one case. An ELF
12069: library of the form “<span class=
12070: "quote">libfoo-release.so.<span class=
12071: "emphasis"><em>x</em></span>.<span class=
12072: "emphasis"><em>y</em></span></span>” will
12073: have a symlink of “<span class=
12074: "quote">libfoo.so.<span class=
12075: "emphasis"><em>x</em></span>.<span class=
12076: "emphasis"><em>y</em></span></span>” on an
12077: a.out platform. This is handled
12078: automatically.</p>
12079:
12080: <p>The “<span class="quote">-rpath
12081: argument</span>” is the install directory
12082: of the library being built.</p>
12083:
1.45 wiz 12084: <p>In the <code xmlns=
12085: "http://www.w3.org/TR/xhtml1/transitional" class=
12086: "filename">PLIST</code>, include only the
12087: <code xmlns=
12088: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12089: "filename">.la</code> file, the other files will
12090: be added automatically.</p>
1.1 grant 12091: </li>
12092:
12093: <li>
1.45 wiz 12094: <p>When linking shared object (<code xmlns=
12095: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12096: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12097: loaded via <a href=
12098: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12099: <span class="citerefentry"><span class=
12100: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12101: shared libraries, use “<span class=
12102: "quote">-module -avoid-version</span>” to
12103: prevent them getting version tacked on.</p>
1.1 grant 12104:
1.45 wiz 12105: <p>The <code xmlns=
12106: "http://www.w3.org/TR/xhtml1/transitional" class=
12107: "filename">PLIST</code> file gets the
12108: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12109: class="filename">foo.so</code> entry.</p>
1.1 grant 12110: </li>
12111:
12112: <li>
12113: <p>When linking programs that depend on these
12114: libraries <span class=
12115: "emphasis"><em>before</em></span> they are
12116: installed, preface the <a href=
12117: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12118: <span class="citerefentry"><span class=
12119: "refentrytitle">cc</span>(1)</span></a> or
12120: <a href=
12121: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12122: <span class="citerefentry"><span class=
12123: "refentrytitle">ld</span>(1)</span></a> line with
12124: “<span class="quote">${LIBTOOL}
12125: --mode=link</span>”, and it will find the
12126: correct libraries (static or shared), but please
12127: be aware that libtool will not allow you to
12128: specify a relative path in -L (such as
12129: “<span class=
12130: "quote">-L../somelib</span>”), because it
12131: expects you to change that argument to be the
1.45 wiz 12132: <code xmlns=
12133: "http://www.w3.org/TR/xhtml1/transitional" class=
12134: "filename">.la</code> file. e.g.</p>
1.1 grant 12135: <pre class="programlisting">
1.51 rillig 12136: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12137: </pre>
12138:
12139: <p>should be changed to:</p>
12140: <pre class="programlisting">
1.51 rillig 12141: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12142: "replaceable"><code>someprog</code></em> <em class=
12143: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12144: </pre>
12145:
12146: <p>and it will do the right thing with the
12147: libraries.</p>
12148: </li>
12149:
12150: <li>
12151: <p>When installing libraries, preface the
12152: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12153: <span class="citerefentry"><span class=
12154: "refentrytitle">install</span>(1)</span></a> or
12155: <a href=
12156: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12157: <span class="citerefentry"><span class=
12158: "refentrytitle">cp</span>(1)</span></a> command
12159: with “<span class="quote">${LIBTOOL}
12160: --mode=install</span>”, and change the
1.45 wiz 12161: library name to <code xmlns=
12162: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12163: "filename">.la</code>. e.g.</p>
1.1 grant 12164: <pre class="programlisting">
1.51 rillig 12165: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12166: </pre>
12167:
1.45 wiz 12168: <p>This will install the static <code xmlns=
12169: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12170: "filename">.a</code>, shared library, any needed
1.1 grant 12171: symlinks, and run <a href=
12172: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12173: <span class="citerefentry"><span class=
12174: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12175: </li>
12176:
12177: <li>
1.45 wiz 12178: <p>In your <code xmlns=
12179: "http://www.w3.org/TR/xhtml1/transitional" class=
12180: "filename">PLIST</code>, include only the
12181: <code xmlns=
12182: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12183: "filename">.la</code> file (this is a change from
12184: previous behaviour).</p>
1.1 grant 12185: </li>
12186: </ol>
12187: </div>
12188: </div>
12189:
1.52 ! tv 12190: <div class="sect2" lang="en">
1.1 grant 12191: <div class="titlepage">
12192: <div>
12193: <div>
1.52 ! tv 12194: <h3 class="title"><a name=
1.38 dillo 12195: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12196: GNU packages that already support libtool</h3>
1.1 grant 12197: </div>
12198: </div>
12199: </div>
12200:
1.14 xtraeme 12201: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12202: the package Makefile. This will override the package's
12203: own libtool in most cases. For older libtool using
1.1 grant 12204: packages, libtool is made by ltconfig script during the
12205: do-configure step; you can check the libtool script
1.14 xtraeme 12206: location by doing <span><strong class="command">make
12207: configure; find work*/ -name
12208: libtool</strong></span>.</p>
12209:
12210: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12211: specifies which libtool scripts, relative to
12212: <code class="varname">WRKSRC</code>, to override. By
12213: default, it is set to “<span class=
12214: "quote">libtool */libtool */*/libtool</span>”. If
12215: this does not match the location of the package's
12216: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12217:
1.45 wiz 12218: <p>If you do not need <code xmlns=
12219: "http://www.w3.org/TR/xhtml1/transitional" class=
12220: "filename">*.a</code> static libraries built and
12221: installed, then use <code class=
12222: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12223:
1.47 reed 12224: <p>If your package makes use of the
12225: platform-independent library for loading dynamic shared
12226: objects, that comes with libtool (libltdl), you should
12227: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12228:
12229: <p>Some packages use libtool incorrectly so that the
12230: package may not work or build in some circumstances.
12231: Some of the more common errors are:</p>
12232:
12233: <div class="itemizedlist">
12234: <ul type="disc">
12235: <li>
12236: <p>The inclusion of a shared object (-module) as
12237: a dependent library in an executable or library.
12238: This in itself isn't a problem if one of two
12239: things has been done:</p>
12240:
12241: <div class="orderedlist">
12242: <ol type="1">
12243: <li>
12244: <p>The shared object is named correctly,
1.45 wiz 12245: i.e. <code xmlns=
12246: "http://www.w3.org/TR/xhtml1/transitional"
12247: class="filename">libfoo.la</code>, not
12248: <code xmlns=
12249: "http://www.w3.org/TR/xhtml1/transitional"
12250: class="filename">foo.la</code></p>
1.1 grant 12251: </li>
12252:
12253: <li>
12254: <p>The -dlopen option is used when linking
12255: an executable.</p>
12256: </li>
12257: </ol>
12258: </div>
12259: </li>
12260:
12261: <li>
12262: <p>The use of libltdl without the correct calls
12263: to initialisation routines. The function
12264: lt_dlinit() should be called and the macro
1.14 xtraeme 12265: <code class=
12266: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12267: included in executables.</p>
12268: </li>
12269: </ul>
12270: </div>
12271: </div>
12272:
1.52 ! tv 12273: <div class="sect2" lang="en">
1.1 grant 12274: <div class="titlepage">
12275: <div>
12276: <div>
1.52 ! tv 12277: <h3 class="title"><a name=
1.38 dillo 12278: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12279: Autoconf/Automake</h3>
12280: </div>
12281: </div>
12282: </div>
12283:
12284: <p>If a package needs GNU autoconf or automake to be
12285: executed to regenerate the configure script and
12286: Makefile.in makefile templates, then they should be
1.35 jmmv 12287: executed in a pre-configure target.</p>
1.1 grant 12288:
12289: <p>For packages that need only autoconf:</p>
12290: <pre class="programlisting">
1.51 rillig 12291: AUTOCONF_REQD= 2.50 # if default version is not good enough
12292: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12293: ...
1.1 grant 12294:
1.51 rillig 12295: pre-configure:
12296: cd ${WRKSRC}; autoconf
1.1 grant 12297:
1.51 rillig 12298: ...
1.1 grant 12299: </pre>
12300:
12301: <p>and for packages that need automake and
12302: autoconf:</p>
12303: <pre class="programlisting">
1.51 rillig 12304: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12305: USE_TOOLS+= automake # use "automake14" for automake-1.4
12306: ...
1.1 grant 12307:
1.51 rillig 12308: pre-configure:
12309: cd ${WRKSRC}; \
12310: aclocal; autoheader; \
12311: automake -a --foreign -i; autoconf
12312:
12313: ...
1.1 grant 12314: </pre>
12315:
12316: <p>Packages which use GNU Automake will almost
1.35 jmmv 12317: certainly require GNU Make.</p>
1.1 grant 12318:
12319: <p>There are times when the configure process makes
12320: additional changes to the generated files, which then
12321: causes the build process to try to re-execute the
12322: automake sequence. This is prevented by touching
12323: various files in the configure stage. If this causes
1.14 xtraeme 12324: problems with your package you can set <code class=
12325: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12326: Makefile.</p>
12327: </div>
12328: </div>
12329:
1.52 ! tv 12330: <div class="sect1" lang="en">
1.1 grant 12331: <div class="titlepage">
12332: <div>
12333: <div>
12334: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12335: "building-considerations"></a>15.4. Building
1.1 grant 12336: considerations</h2>
12337: </div>
12338: </div>
12339: </div>
12340:
1.52 ! tv 12341: <div class="sect2" lang="en">
1.1 grant 12342: <div class="titlepage">
12343: <div>
12344: <div>
1.52 ! tv 12345: <h3 class="title"><a name=
1.38 dillo 12346: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12347: </div>
12348: </div>
12349: </div>
12350:
12351: <p>To port an application to NetBSD, it's usually
12352: necessary for the compiler to be able to judge the
12353: system on which it's compiling, and we use definitions
12354: so that the C pre-processor can do this.</p>
12355:
12356: <p>To test whether you are working on a 4.4 BSD-derived
12357: system, you should use the BSD definition, which is
1.45 wiz 12358: defined in <code xmlns=
12359: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12360: "filename"><sys/param.h></code> on said
1.1 grant 12361: systems.</p>
12362: <pre class="programlisting">
1.51 rillig 12363: #include <sys/param.h>
1.1 grant 12364: </pre>
12365:
12366: <p>and then you can surround the BSD-specific parts of
12367: your package's C/C++ code using this conditional:</p>
12368: <pre class="programlisting">
1.51 rillig 12369: #if (defined(BSD) && BSD >= 199306)
1.1 grant 12370: ...
1.51 rillig 12371: #endif
1.1 grant 12372: </pre>
12373:
12374: <p>Please use the “<span class=
12375: "quote">__NetBSD__</span>” definition sparingly -
12376: it should only apply to features of NetBSD that are not
1.47 reed 12377: present in other 4.4-lite-derived BSDs.</p>
1.1 grant 12378: </div>
1.51 rillig 12379:
1.52 ! tv 12380: <div class="sect2" lang="en">
1.51 rillig 12381: <div class="titlepage">
12382: <div>
12383: <div>
1.52 ! tv 12384: <h3 class="title"><a name=
1.51 rillig 12385: "cpp-list"></a>15.4.2. Getting a list of CPP
12386: defines</h3>
12387: </div>
12388: </div>
12389: </div>
12390:
12391: <p>When your system uses the GNU C Compiler, you can
12392: get a list of symbols that are defined by default, e.g.
12393: to identify the platform, with the following
12394: command:</p>
12395: <pre class="programlisting">
12396: gcc -E -dM - < /dev/null
12397: </pre>
12398: </div>
1.1 grant 12399: </div>
12400:
1.52 ! tv 12401: <div class="sect1" lang="en">
1.1 grant 12402: <div class="titlepage">
12403: <div>
12404: <div>
12405: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12406: "package-specific-actions"></a>15.5. Package
1.1 grant 12407: specific actions</h2>
12408: </div>
12409: </div>
12410: </div>
12411:
1.52 ! tv 12412: <div class="sect2" lang="en">
1.1 grant 12413: <div class="titlepage">
12414: <div>
12415: <div>
1.52 ! tv 12416: <h3 class="title"><a name=
1.38 dillo 12417: "user-interaction"></a>15.5.1. User
1.2 hubertf 12418: interaction</h3>
1.1 grant 12419: </div>
12420: </div>
12421: </div>
12422:
12423: <p>Occasionally, packages require interaction from the
12424: user, and this can be in a number of ways:</p>
12425:
12426: <div class="itemizedlist">
12427: <ul type="disc">
12428: <li>
12429: <p>help in fetching the distfiles</p>
12430: </li>
12431:
12432: <li>
12433: <p>help to configure the package before it is
12434: built</p>
12435: </li>
12436:
12437: <li>
12438: <p>help during the build process</p>
12439: </li>
12440:
12441: <li>
12442: <p>help during the installation of a package</p>
12443: </li>
12444: </ul>
12445: </div>
12446:
1.14 xtraeme 12447: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 12448: definition is provided to notify the pkgsrc mechanism
12449: of an interactive stage which will be needed, and this
1.45 wiz 12450: should be set in the package's <code xmlns=
12451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 12452: "filename">Makefile</code>, e.g.:</p>
1.1 grant 12453: <pre class="programlisting">
1.51 rillig 12454: INTERACTIVE_STAGE= build
1.1 grant 12455: </pre>
12456:
12457: <p>Multiple interactive stages can be specified:</p>
12458: <pre class="programlisting">
1.51 rillig 12459: INTERACTIVE_STAGE= configure install
1.1 grant 12460: </pre>
12461: </div>
12462:
1.52 ! tv 12463: <div class="sect2" lang="en">
1.1 grant 12464: <div class="titlepage">
12465: <div>
12466: <div>
1.52 ! tv 12467: <h3 class="title"><a name=
1.38 dillo 12468: "handling-licenses"></a>15.5.2. Handling
1.1 grant 12469: licenses</h3>
12470: </div>
12471: </div>
12472: </div>
12473:
1.44 gdt 12474: <p>A package may be covered by a license which the user
12475: has or has not agreed to accept. For these cases,
12476: pkgsrc contains a mechanism to note that a package is
12477: covered by a particular license, and the package cannot
12478: be built unless the user has accepted the license.
12479: (Installation of binary packages are not currently
12480: subject to this mechanism.) Packages with licenses that
12481: are either Open Source according to the Open Source
12482: Initiative or Free according to the Free Software
12483: Foundation will not be marked with a license tag.
12484: Packages with licenses that have not been determined to
12485: meet either definition will be marked with a license
12486: tag referring to the license. This will prevent
12487: building unless pkgsrc is informed that the license is
12488: acceptable, and enables displaying the license.</p>
12489:
12490: <p>The license tag mechanism is intended to address
12491: copyright-related issues surrounding building,
12492: installing and using a package, and not to address
12493: redistribution issues (see <code class=
12494: "varname">RESTRICTED</code> and <code class=
12495: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
12496: above definition of licenses for which tags are not
12497: needed implies that packages with redistribution
12498: restrictions should have tags.</p>
12499:
12500: <p>Denoting that a package is covered by a particular
1.45 wiz 12501: license is done by placing the license in <code xmlns=
12502: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 12503: "filename">pkgsrc/licenses</code> and setting the
12504: <code class="varname">LICENSE</code> variable to a
12505: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 12506: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 12507: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 12508: target="_top"><code xmlns="" class=
12509: "filename">graphics/xv</code></a>:</p>
1.1 grant 12510: <pre class="programlisting">
1.51 rillig 12511: LICENSE= xv-license
1.1 grant 12512: </pre>
12513:
12514: <p>When trying to build, the user will get a notice
1.44 gdt 12515: that the package is covered by a license which has not
12516: been accepted:</p>
1.1 grant 12517: <pre class="programlisting">
1.51 rillig 12518: <code class="prompt">%</code> <strong class=
1.14 xtraeme 12519: "userinput"><code>make</code></strong>
1.51 rillig 12520: ===> xv-3.10anb9 has an unacceptable license: xv-license.
12521: ===> To view the license, enter "/usr/bin/make show-license".
12522: ===> To indicate acceptance, add this line to your /etc/mk.conf:
12523: ===> ACCEPTABLE_LICENSES+=xv-license
12524: *** Error code 1
1.1 grant 12525: </pre>
12526:
1.14 xtraeme 12527: <p>The license can be viewed with <span><strong class=
12528: "command">make show-license</strong></span>, and if it
12529: is considered appropriate, the line printed above can
1.45 wiz 12530: be added to <code xmlns=
12531: "http://www.w3.org/TR/xhtml1/transitional" class=
12532: "filename">/etc/mk.conf</code> to indicate acceptance
12533: of the particular license:</p>
1.1 grant 12534: <pre class="programlisting">
1.51 rillig 12535: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 12536: </pre>
12537:
12538: <p>When adding a package with a new license, the
1.45 wiz 12539: license text should be added to <code xmlns=
12540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12541: "filename">pkgsrc/licenses</code> for displaying. A
12542: list of known licenses can be seen in this directory as
12543: well as by looking at the list of (commented out)
12544: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 12545: variable settings in <code xmlns=
12546: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12547: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 12548:
1.44 gdt 12549: <p>The use of <code class=
12550: "varname">LICENSE=shareware</code>, <code class=
12551: "varname">LICENSE=no-commercial-use</code>, and similar
12552: language is deprecated because it does not crisply
12553: refer to a particular license text. Another problem
12554: with such usage is that it does not enable a user to
12555: denote acceptance of the license for a single package
12556: without accepting the same license text for another
12557: package. In particular, this can be inappropriate when
12558: e.g. one accepts a particular license to indicate to
12559: pkgsrc that a fee has been paid.</p>
1.1 grant 12560: </div>
12561:
1.52 ! tv 12562: <div class="sect2" lang="en">
1.1 grant 12563: <div class="titlepage">
12564: <div>
12565: <div>
1.30 wiz 12566: <h3 class="title"><a name=
1.38 dillo 12567: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 12568: score files</h3>
1.1 grant 12569: </div>
12570: </div>
12571: </div>
12572:
12573: <p>Certain packages, most of them in the games
12574: category, install a score file that allows all users on
12575: the system to record their highscores. In order for
12576: this to work, the binaries need to be installed setgid
12577: and the score files owned by the appropriate group
12578: and/or owner (traditionally the "games" user/group).
12579: The following variables, documented in more detail in
1.45 wiz 12580: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12581: class="filename">mk/defaults/mk.conf</code>, control
12582: this behaviour: <code class=
1.14 xtraeme 12583: "varname">SETGIDGAME</code>, <code class=
12584: "varname">GAMEDATAMODE</code>, <code class=
12585: "varname">GAMEGRP</code>, <code class=
12586: "varname">GAMEMODE</code>, <code class=
12587: "varname">GAMEOWN</code>.</p>
1.1 grant 12588:
12589: <p>Note that per default, setgid installation of games
1.14 xtraeme 12590: is disabled; setting <code class=
12591: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 12592: variables accordingly.</p>
12593:
12594: <p>A package should therefor never hard code file
1.14 xtraeme 12595: ownership or access permissions but rely on
12596: <code class="varname">INSTALL_GAME</code> and
12597: <code class="varname">INSTALL_GAME_DATA</code> to set
12598: these correctly.</p>
1.1 grant 12599: </div>
12600:
1.52 ! tv 12601: <div class="sect2" lang="en">
1.1 grant 12602: <div class="titlepage">
12603: <div>
12604: <div>
1.52 ! tv 12605: <h3 class="title"><a name=
1.38 dillo 12606: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 12607: containing perl scripts</h3>
1.1 grant 12608: </div>
12609: </div>
12610: </div>
12611:
12612: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 12613: set <code class="varname">REPLACE_PERL</code> to ensure
12614: that the proper interpreter path is set. <code class=
12615: "varname">REPLACE_PERL</code> should contain a list of
12616: scripts, relative to <code class=
12617: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 12618: </div>
12619:
1.52 ! tv 12620: <div class="sect2" lang="en">
1.1 grant 12621: <div class="titlepage">
12622: <div>
12623: <div>
1.52 ! tv 12624: <h3 class="title"><a name=
1.38 dillo 12625: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 12626: hardcoded paths to other interpreters</h3>
12627: </div>
12628: </div>
12629: </div>
12630:
12631: <p>Your package may also contain scripts with hardcoded
12632: paths to other interpreters besides (or as well as)
12633: perl. To correct the full pathname to the script
12634: interpreter, you need to set the following definitions
1.45 wiz 12635: in your <code xmlns=
12636: "http://www.w3.org/TR/xhtml1/transitional" class=
12637: "filename">Makefile</code> (we shall use
12638: <span><strong class="command">tclsh</strong></span> in
12639: this example):</p>
1.1 grant 12640: <pre class="programlisting">
1.51 rillig 12641: REPLACE_INTERPRETER+= tcl
12642: _REPLACE.tcl.old= .*/bin/tclsh
12643: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
12644: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
12645: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 12646: </pre>
12647: </div>
12648:
1.52 ! tv 12649: <div class="sect2" lang="en">
1.1 grant 12650: <div class="titlepage">
12651: <div>
12652: <div>
1.52 ! tv 12653: <h3 class="title"><a name=
1.38 dillo 12654: "perl-modules"></a>15.5.6. Packages
1.30 wiz 12655: installing perl modules</h3>
1.1 grant 12656: </div>
12657: </div>
12658: </div>
12659:
12660: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 12661: include the Makefile fragment <code xmlns=
12662: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12663: "filename">../../lang/perl5/module.mk</code>. It
12664: provides a <span><strong class=
12665: "command">do-configure</strong></span> target for the
12666: standard perl configuration for such modules as well as
12667: various hooks to tune this configuration. See comments
12668: in this file for details.</p>
1.1 grant 12669:
12670: <p>Perl5 modules will install into different places
12671: depending on the version of perl used during the build
12672: process. To address this, pkgsrc will append lines to
1.45 wiz 12673: the <code xmlns=
12674: "http://www.w3.org/TR/xhtml1/transitional" class=
12675: "filename">PLIST</code> corresponding to the files
12676: listed in the installed <code xmlns=
12677: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12678: "filename">.packlist</code> file generated by most
12679: perl5 modules. This is invoked by defining <code class=
12680: "varname">PERL5_PACKLIST</code> to a space-separated
12681: list of paths to packlist files, e.g.:</p>
1.1 grant 12682: <pre class="programlisting">
1.51 rillig 12683: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 12684: </pre>
12685:
1.14 xtraeme 12686: <p>The variables <code class=
12687: "varname">PERL5_SITELIB</code>, <code class=
12688: "varname">PERL5_SITEARCH</code>, and <code class=
12689: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 12690: locations in which perl5 modules may be installed, and
12691: may be used by perl5 packages that don't have a
12692: packlist. These three variables are also substituted
1.45 wiz 12693: for in the <code xmlns=
12694: "http://www.w3.org/TR/xhtml1/transitional" class=
12695: "filename">PLIST</code>.</p>
1.1 grant 12696: </div>
12697:
1.52 ! tv 12698: <div class="sect2" lang="en">
1.1 grant 12699: <div class="titlepage">
12700: <div>
12701: <div>
1.52 ! tv 12702: <h3 class="title"><a name=
1.38 dillo 12703: "faq.info-files"></a>15.5.7. Packages
1.1 grant 12704: installing info files</h3>
12705: </div>
12706: </div>
12707: </div>
12708:
12709: <p>Some packages install info files or use the
12710: “<span class="quote">makeinfo</span>” or
12711: “<span class="quote">install-info</span>”
12712: commands. Each of the info files:</p>
12713:
12714: <div class="itemizedlist">
12715: <ul type="disc">
12716: <li>
12717: <p>is considered to be installed in the directory
1.45 wiz 12718: <code xmlns=
12719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12720: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 12721: </li>
12722:
12723: <li>
12724: <p>is registered in the Info directory file
1.45 wiz 12725: <code xmlns=
12726: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12727: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 12728: </li>
12729:
12730: <li>
12731: <p>and must be listed as a filename in the
1.14 xtraeme 12732: <code class="varname">INFO_FILES</code> variable
12733: in the package Makefile.</p>
1.1 grant 12734: </li>
12735: </ul>
12736: </div>
12737:
1.14 xtraeme 12738: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 12739: “<span class="quote">info</span>” and can
1.45 wiz 12740: be overridden in the package Makefile. <code xmlns=
12741: "http://www.w3.org/TR/xhtml1/transitional" class=
12742: "filename">INSTALL</code> and <code xmlns=
12743: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12744: "filename">DEINSTALL</code> scripts will be generated
12745: to handle registration of the info files in the Info
1.1 grant 12746: directory file. The “<span class=
12747: "quote">install-info</span>” command used for the
12748: info files registration is either provided by the
12749: system, or by a special purpose package automatically
12750: added as dependency if needed.</p>
12751:
12752: <p>A package which needs the “<span class=
12753: "quote">makeinfo</span>” command at build time
1.14 xtraeme 12754: must define the variable <code class=
12755: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 12756: minimum version of the “<span class=
12757: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 12758: should be noted with the <code class=
12759: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 12760: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12761: class="filename">Makefile</code>. By default, a minimum
12762: version of 3.12 is required. If the system does not
12763: provide a <span><strong class=
1.14 xtraeme 12764: "command">makeinfo</strong></span> command or if it
12765: does not match the required minimum, a build dependency
12766: on the <a xmlns=
12767: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 12768: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 12769: target="_top"><code xmlns="" class=
12770: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 12771: added automatically.</p>
1.1 grant 12772:
12773: <p>The build and installation process of the software
12774: provided by the package should not use the
1.14 xtraeme 12775: <span><strong class=
12776: "command">install-info</strong></span> command as the
12777: registration of info files is the task of the package
1.45 wiz 12778: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12779: class="filename">INSTALL</code> script, and it must use
12780: the appropriate <span><strong class=
1.14 xtraeme 12781: "command">makeinfo</strong></span> command.</p>
1.1 grant 12782:
1.47 reed 12783: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 12784: creates overriding scripts for the <span><strong class=
12785: "command">install-info</strong></span> and
12786: <span><strong class="command">makeinfo</strong></span>
12787: commands in a directory listed early in <code class=
12788: "varname">PATH</code>.</p>
1.1 grant 12789:
1.14 xtraeme 12790: <p>The script overriding <span><strong class=
12791: "command">install-info</strong></span> has no effect
12792: except the logging of a message. The script overriding
12793: <span><strong class="command">makeinfo</strong></span>
12794: logs a message and according to the value of
12795: <code class="varname">USE_MAKEINFO</code> and
12796: <code class="varname">TEXINFO_REQD</code> either run
12797: the appropriate <span><strong class=
12798: "command">makeinfo</strong></span> command or exit on
12799: error.</p>
1.1 grant 12800: </div>
12801:
1.52 ! tv 12802: <div class="sect2" lang="en">
1.1 grant 12803: <div class="titlepage">
12804: <div>
12805: <div>
1.52 ! tv 12806: <h3 class="title"><a name=
1.38 dillo 12807: "gconf2-data-files"></a>15.5.8. Packages
1.30 wiz 12808: installing GConf2 data files</h3>
1.1 grant 12809: </div>
12810: </div>
12811: </div>
12812:
1.45 wiz 12813: <p>If a package installs <code xmlns=
12814: "http://www.w3.org/TR/xhtml1/transitional" class=
12815: "filename">.schemas</code> or <code xmlns=
12816: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12817: "filename">.entries</code> files, used by GConf2, you
1.1 grant 12818: need to take some extra steps to make sure they get
12819: registered in the database:</p>
12820:
12821: <div class="orderedlist">
12822: <ol type="1">
12823: <li>
1.45 wiz 12824: <p>Include <code xmlns=
12825: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12826: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 12827: instead of its <code xmlns=
12828: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12829: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12830: care of rebuilding the GConf2 database at
12831: installation and deinstallation time, and tells
12832: the package where to install GConf2 data files
12833: using some standard configure arguments. It also
12834: disallows any access to the database directly
12835: from the package.</p>
12836: </li>
12837:
12838: <li>
12839: <p>Ensure that the package installs its
1.45 wiz 12840: <code xmlns=
12841: "http://www.w3.org/TR/xhtml1/transitional" class=
12842: "filename">.schemas</code> files under
12843: <code xmlns=
12844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12845: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 12846: If they get installed under <code xmlns=
12847: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12848: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 12849: manually patch the package.</p>
12850: </li>
12851:
12852: <li>
12853: <p>Check the PLIST and remove any entries under
12854: the etc/gconf directory, as they will be handled
12855: automatically. See <a href="#faq.conf" title=
1.38 dillo 12856: "7.14. How do I change the location of configuration files?">
12857: Section 7.14, “How do I change the
1.35 jmmv 12858: location of configuration files?”</a> for
12859: more information.</p>
1.1 grant 12860: </li>
12861:
12862: <li>
1.14 xtraeme 12863: <p>Define the <code class=
12864: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 12865: <code xmlns=
12866: "http://www.w3.org/TR/xhtml1/transitional" class=
12867: "filename">Makefile</code> with a list of all
12868: <code xmlns=
12869: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12870: "filename">.schemas</code> files installed by the
12871: package, if any. Names must not contain any
12872: directories in them.</p>
1.1 grant 12873: </li>
12874:
12875: <li>
1.14 xtraeme 12876: <p>Define the <code class=
12877: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 12878: <code xmlns=
12879: "http://www.w3.org/TR/xhtml1/transitional" class=
12880: "filename">Makefile</code> with a list of all
12881: <code xmlns=
12882: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12883: "filename">.entries</code> files installed by the
12884: package, if any. Names must not contain any
12885: directories in them.</p>
1.1 grant 12886: </li>
12887: </ol>
12888: </div>
12889: </div>
12890:
1.52 ! tv 12891: <div class="sect2" lang="en">
1.1 grant 12892: <div class="titlepage">
12893: <div>
12894: <div>
1.30 wiz 12895: <h3 class="title"><a name=
1.38 dillo 12896: "scrollkeeper-data-files"></a>15.5.9. Packages
1.30 wiz 12897: installing scrollkeeper data files</h3>
1.1 grant 12898: </div>
12899: </div>
12900: </div>
12901:
1.45 wiz 12902: <p>If a package installs <code xmlns=
12903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12904: "filename">.omf</code> files, used by scrollkeeper, you
12905: need to take some extra steps to make sure they get
12906: registered in the database:</p>
1.1 grant 12907:
12908: <div class="orderedlist">
12909: <ol type="1">
12910: <li>
1.45 wiz 12911: <p>Include <code xmlns=
12912: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12913: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 12914: instead of its <code xmlns=
12915: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12916: "filename">buildlink3.mk</code> file. This takes
1.1 grant 12917: care of rebuilding the scrollkeeper database at
12918: installation and deinstallation time, and
12919: disallows any access to it directly from the
12920: package.</p>
12921: </li>
12922:
12923: <li>
12924: <p>Check the PLIST and remove any entries under
1.45 wiz 12925: the <code xmlns=
12926: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12927: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 12928: as they will be handled automatically.</p>
12929: </li>
12930:
12931: <li>
1.45 wiz 12932: <p>Remove the <code xmlns=
12933: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12934: "filename">share/omf</code> directory from the
12935: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 12936: </li>
12937: </ol>
12938: </div>
12939: </div>
12940:
1.52 ! tv 12941: <div class="sect2" lang="en">
1.1 grant 12942: <div class="titlepage">
12943: <div>
12944: <div>
1.52 ! tv 12945: <h3 class="title"><a name=
1.38 dillo 12946: "x11-fonts"></a>15.5.10. Packages installing
1.1 grant 12947: X11 fonts</h3>
12948: </div>
12949: </div>
12950: </div>
12951:
12952: <p>If a package installs font files, you will need to
12953: rebuild the fonts database in the directory where they
12954: get installed at installation and deinstallation time.
1.45 wiz 12955: This can be automatically done by using <code xmlns=
12956: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12957: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 12958: include in your <code xmlns=
12959: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12960: "filename">Makefile</code>.</p>
1.1 grant 12961:
12962: <p>When the file is included, you can list the
1.14 xtraeme 12963: directories where fonts are installed in the
12964: <code class="varname">FONTS_<em class=
12965: "replaceable"><code>type</code></em>_DIRS</code>
12966: variables, where <em class=
12967: "replaceable"><code>type</code></em> can be one of
12968: “<span class="quote">TTF</span>”,
1.1 grant 12969: “<span class="quote">TYPE1</span>” or
12970: “<span class="quote">X11</span>”. Also make
1.45 wiz 12971: sure that the database file <code xmlns=
12972: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12973: "filename">fonts.dir</code> is not listed in the
1.1 grant 12974: PLIST.</p>
12975:
12976: <p>Note that you should not create new directories for
12977: fonts; instead use the standard ones to avoid that the
12978: user needs to manually configure his X server to find
12979: them.</p>
12980: </div>
12981:
1.52 ! tv 12982: <div class="sect2" lang="en">
1.1 grant 12983: <div class="titlepage">
12984: <div>
12985: <div>
1.52 ! tv 12986: <h3 class="title"><a name=
1.38 dillo 12987: "gtk2-modules"></a>15.5.11. Packages
1.30 wiz 12988: installing GTK2 modules</h3>
1.1 grant 12989: </div>
12990: </div>
12991: </div>
12992:
1.47 reed 12993: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 12994: need to take some extra steps to get them registered in
12995: the GTK2 database properly:</p>
12996:
12997: <div class="orderedlist">
12998: <ol type="1">
12999: <li>
1.45 wiz 13000: <p>Include <code xmlns=
13001: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13002: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13003: instead of its <code xmlns=
13004: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13005: "filename">buildlink3.mk</code> file. This takes
13006: care of rebuilding the database at installation
13007: and deinstallation time.</p>
1.1 grant 13008: </li>
13009:
13010: <li>
1.14 xtraeme 13011: <p>Set <code class=
13012: "varname">GTK2_IMMODULES=YES</code> if your
13013: package installs GTK2 immodules.</p>
1.1 grant 13014: </li>
13015:
13016: <li>
1.14 xtraeme 13017: <p>Set <code class=
13018: "varname">GTK2_LOADERS=YES</code> if your package
13019: installs GTK2 loaders.</p>
1.1 grant 13020: </li>
13021:
13022: <li>
1.47 reed 13023: <p>Patch the package to not touch any of the GTK2
1.1 grant 13024: databases directly. These are:</p>
13025:
13026: <div class="itemizedlist">
13027: <ul type="disc">
13028: <li>
1.45 wiz 13029: <p><code xmlns=
13030: "http://www.w3.org/TR/xhtml1/transitional"
13031: class=
1.14 xtraeme 13032: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13033: </li>
13034:
13035: <li>
1.45 wiz 13036: <p><code xmlns=
13037: "http://www.w3.org/TR/xhtml1/transitional"
13038: class=
1.14 xtraeme 13039: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13040: </li>
13041: </ul>
13042: </div>
13043: </li>
13044:
13045: <li>
13046: <p>Check the PLIST and remove any entries under
1.45 wiz 13047: the <code xmlns=
13048: "http://www.w3.org/TR/xhtml1/transitional" class=
13049: "filename">libdata/gtk-2.0</code> directory, as
13050: they will be handled automatically.</p>
1.1 grant 13051: </li>
13052: </ol>
13053: </div>
13054: </div>
13055:
1.52 ! tv 13056: <div class="sect2" lang="en">
1.1 grant 13057: <div class="titlepage">
13058: <div>
13059: <div>
1.52 ! tv 13060: <h3 class="title"><a name=
1.38 dillo 13061: "sgml-xml-data"></a>15.5.12. Packages
1.30 wiz 13062: installing SGML or XML data</h3>
1.1 grant 13063: </div>
13064: </div>
13065: </div>
13066:
13067: <p>If a package installs SGML or XML data files that
13068: need to be registered in system-wide catalogs (like
13069: DTDs, sub-catalogs, etc.), you need to take some extra
13070: steps:</p>
13071:
13072: <div class="orderedlist">
13073: <ol type="1">
13074: <li>
1.45 wiz 13075: <p>Include <code xmlns=
13076: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13077: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13078: in your <code xmlns=
13079: "http://www.w3.org/TR/xhtml1/transitional" class=
13080: "filename">Makefile</code>, which takes care of
13081: registering those files in system-wide catalogs
13082: at installation and deinstallation time.</p>
1.1 grant 13083: </li>
13084:
13085: <li>
1.14 xtraeme 13086: <p>Set <code class="varname">SGML_CATALOGS</code>
13087: to the full path of any SGML catalogs installed
13088: by the package.</p>
1.1 grant 13089: </li>
13090:
13091: <li>
1.14 xtraeme 13092: <p>Set <code class="varname">XML_CATALOGS</code>
13093: to the full path of any XML catalogs installed by
1.1 grant 13094: the package.</p>
13095: </li>
13096:
13097: <li>
1.14 xtraeme 13098: <p>Set <code class="varname">SGML_ENTRIES</code>
13099: to individual entries to be added to the SGML
1.1 grant 13100: catalog. These come in groups of three strings;
13101: see xmlcatmgr(1) for more information
13102: (specifically, arguments recognized by the 'add'
13103: action). Note that you will normally not use this
13104: variable.</p>
13105: </li>
13106:
13107: <li>
1.14 xtraeme 13108: <p>Set <code class="varname">XML_ENTRIES</code>
13109: to individual entries to be added to the XML
1.1 grant 13110: catalog. These come in groups of three strings;
13111: see xmlcatmgr(1) for more information
13112: (specifically, arguments recognized by the 'add'
13113: action). Note that you will normally not use this
13114: variable.</p>
13115: </li>
13116: </ol>
13117: </div>
13118: </div>
13119:
1.52 ! tv 13120: <div class="sect2" lang="en">
1.1 grant 13121: <div class="titlepage">
13122: <div>
13123: <div>
1.52 ! tv 13124: <h3 class="title"><a name=
1.38 dillo 13125: "mime-database"></a>15.5.13. Packages
1.30 wiz 13126: installing extensions to the MIME database</h3>
1.1 grant 13127: </div>
13128: </div>
13129: </div>
13130:
13131: <p>If a package provides extensions to the MIME
1.45 wiz 13132: database by installing <code xmlns=
13133: "http://www.w3.org/TR/xhtml1/transitional" class=
13134: "filename">.xml</code> files inside <code xmlns=
13135: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13136: "filename">${PREFIX}/share/mime/packages</code>, you
13137: need to take some extra steps to ensure that the
13138: database is kept consistent with respect to these new
13139: files:</p>
1.1 grant 13140:
13141: <div class="orderedlist">
13142: <ol type="1">
13143: <li>
1.45 wiz 13144: <p>Include <code xmlns=
13145: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13146: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13147: (avoid using the <code xmlns=
13148: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13149: "filename">buildlink3.mk</code> file from this
13150: same directory, which is reserved for inclusion
1.45 wiz 13151: from other <code xmlns=
13152: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13153: "filename">buildlink3.mk</code> files). It takes
13154: care of rebuilding the MIME database at
13155: installation and deinstallation time, and
13156: disallows any access to it directly from the
1.1 grant 13157: package.</p>
13158: </li>
13159:
13160: <li>
13161: <p>Check the PLIST and remove any entries under
1.45 wiz 13162: the <code xmlns=
13163: "http://www.w3.org/TR/xhtml1/transitional" class=
13164: "filename">share/mime</code> directory,
13165: <span class="emphasis"><em>except</em></span> for
13166: files saved under <code xmlns=
13167: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13168: "filename">share/mime/packages</code>. The former
1.1 grant 13169: are handled automatically by the
1.47 reed 13170: update-mime-database program, but the latter are
1.1 grant 13171: package-dependent and must be removed by the
13172: package that installed them in the first
13173: place.</p>
13174: </li>
13175:
13176: <li>
1.45 wiz 13177: <p>Remove any <code xmlns=
13178: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13179: "filename">share/mime/*</code> directories from
13180: the PLIST. They will be handled by the
1.1 grant 13181: shared-mime-info package.</p>
13182: </li>
13183: </ol>
13184: </div>
13185: </div>
13186:
1.52 ! tv 13187: <div class="sect2" lang="en">
1.1 grant 13188: <div class="titlepage">
13189: <div>
13190: <div>
1.52 ! tv 13191: <h3 class="title"><a name=
1.38 dillo 13192: "intltool"></a>15.5.14. Packages using
1.1 grant 13193: intltool</h3>
13194: </div>
13195: </div>
13196: </div>
13197:
13198: <p>If a package uses intltool during its build, include
1.45 wiz 13199: the <code xmlns=
13200: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13201: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13202: file, which forces it to use the intltool package
13203: provided by pkgsrc, instead of the one bundled with the
13204: distribution file.</p>
13205:
13206: <p>This tracks intltool's build-time dependencies and
13207: uses the latest available version; this way, the
13208: package benefits of any bug fixes that may have
13209: appeared since it was released.</p>
13210: </div>
1.18 xtraeme 13211:
1.52 ! tv 13212: <div class="sect2" lang="en">
1.18 xtraeme 13213: <div class="titlepage">
13214: <div>
13215: <div>
1.52 ! tv 13216: <h3 class="title"><a name=
1.38 dillo 13217: "startup-scripts"></a>15.5.15. Packages
1.30 wiz 13218: installing startup scripts</h3>
1.18 xtraeme 13219: </div>
13220: </div>
13221: </div>
13222:
13223: <p>If a package contains a rc.d script, it won't be
13224: copied into the startup directory by default, but you
13225: can enable it, by adding the option <code class=
1.45 wiz 13226: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
13227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13228: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 13229: the scripts into <code xmlns=
13230: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 13231: "filename">/etc/rc.d</code> when a package is
13232: installed, and it will automatically remove the scripts
13233: when the package is deinstalled.</p>
13234: </div>
1.1 grant 13235: </div>
13236:
1.52 ! tv 13237: <div class="sect1" lang="en">
1.1 grant 13238: <div class="titlepage">
13239: <div>
13240: <div>
13241: <h2 class="title" style="clear: both"><a name=
1.38 dillo 13242: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 13243: author</h2>
1.1 grant 13244: </div>
13245: </div>
13246: </div>
13247:
13248: <p>If you have found any bugs in the package you make
13249: available, if you had to do special steps to make it run
13250: under NetBSD or if you enhanced the software in various
13251: other ways, be sure to report these changes back to the
13252: original author of the program! With that kind of
13253: support, the next release of the program can incorporate
13254: these fixes, and people not using the NetBSD packages
13255: system can win from your efforts.</p>
13256:
13257: <p>Support the idea of free software!</p>
13258: </div>
13259: </div>
13260:
1.52 ! tv 13261: <div class="chapter" lang="en">
1.1 grant 13262: <div class="titlepage">
13263: <div>
13264: <div>
1.52 ! tv 13265: <h2 class="title"><a name=
1.38 dillo 13266: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 13267: </div>
13268: </div>
13269: </div>
13270:
13271: <p>To check out all the gotchas when building a package,
13272: here are the steps that I do in order to get a package
13273: working. Please note this is basically the same as what was
13274: explained in the previous sections, only with some
13275: debugging aids.</p>
13276:
13277: <div class="itemizedlist">
13278: <ul type="disc">
13279: <li>
1.14 xtraeme 13280: <p>Be sure to set <code class=
1.45 wiz 13281: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
13282: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13283: "filename">/etc/mk.conf</code></p>
1.1 grant 13284: </li>
13285:
13286: <li>
13287: <p>Install <a xmlns=
13288: "http://www.w3.org/TR/xhtml1/transitional" href=
13289: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 13290: target="_top"><code xmlns="" class=
13291: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 13292: directory for a new package, change into it, then run
13293: <span><strong class=
13294: "command">url2pkg</strong></span>:</p>
1.1 grant 13295: <pre class="screen">
1.14 xtraeme 13296: <code class="prompt">%</code> <strong class=
13297: "userinput"><code>mkdir /usr/pkgsrc/<em class=
13298: "replaceable"><code>category</code></em>/<em class=
13299: "replaceable"><code>examplepkg</code></em></code></strong>
13300: <code class="prompt">%</code> <strong class=
13301: "userinput"><code>cd /usr/pkgsrc/<em class=
13302: "replaceable"><code>category</code></em>/<em class=
13303: "replaceable"><code>examplepkg</code></em></code></strong>
13304: <code class="prompt">%</code> <strong class=
13305: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 13306: </pre>
13307: </li>
13308:
13309: <li>
1.45 wiz 13310: <p>Edit the <code xmlns=
13311: "http://www.w3.org/TR/xhtml1/transitional" class=
13312: "filename">Makefile</code> as requested.</p>
1.1 grant 13313: </li>
13314:
13315: <li>
1.45 wiz 13316: <p>Fill in the <code xmlns=
13317: "http://www.w3.org/TR/xhtml1/transitional" class=
13318: "filename">DESCR</code> file</p>
1.1 grant 13319: </li>
13320:
13321: <li>
1.14 xtraeme 13322: <p>Run <span><strong class="command">make
13323: configure</strong></span></p>
1.1 grant 13324: </li>
13325:
13326: <li>
13327: <p>Add any dependencies glimpsed from documentation
1.45 wiz 13328: and the configure step to the package's <code xmlns=
13329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13330: "filename">Makefile</code>.</p>
1.1 grant 13331: </li>
13332:
13333: <li>
13334: <p>Make the package compile, doing multiple rounds
13335: of</p>
13336: <pre class="screen">
1.14 xtraeme 13337: <code class="prompt">%</code> <strong class=
13338: "userinput"><code>make</code></strong>
13339: <code class="prompt">%</code> <strong class=
13340: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
13341: <code class="prompt">%</code> <strong class=
13342: "userinput"><code>mkpatches</code></strong>
13343: <code class="prompt">%</code> <strong class=
13344: "userinput"><code>patchdiff</code></strong>
13345: <code class="prompt">%</code> <strong class=
13346: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
13347: <code class="prompt">%</code> <strong class=
13348: "userinput"><code>make mps</code></strong>
13349: <code class="prompt">%</code> <strong class=
13350: "userinput"><code>make clean</code></strong>
1.1 grant 13351: </pre>
13352:
13353: <p>Doing as non-root user will ensure that no files
13354: are modified that shouldn't be, especially during the
1.14 xtraeme 13355: build phase. <span><strong class=
13356: "command">mkpatches</strong></span>,
13357: <span><strong class=
13358: "command">patchdiff</strong></span> and
13359: <span><strong class="command">pkgvi</strong></span>
13360: are from the <a xmlns=
1.1 grant 13361: "http://www.w3.org/TR/xhtml1/transitional" href=
13362: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 13363: target="_top"><code xmlns="" class=
13364: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 13365: </li>
13366:
13367: <li>
1.45 wiz 13368: <p>Look at the <code xmlns=
13369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13370: "filename">Makefile</code>, fix if necessary; see
13371: <a href="#components.Makefile" title=
1.38 dillo 13372: "8.1. Makefile">Section 8.1,
1.45 wiz 13373: “<code xmlns=
13374: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13375: "filename">Makefile</code>”</a>.</p>
1.1 grant 13376: </li>
13377:
13378: <li>
1.45 wiz 13379: <p>Generate a <code xmlns=
13380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13381: "filename">PLIST</code>:</p>
1.1 grant 13382: <pre class="screen">
1.14 xtraeme 13383: <code class="prompt">#</code> <strong class=
13384: "userinput"><code>make install</code></strong>
13385: <code class="prompt">#</code> <strong class=
13386: "userinput"><code>make print-PLIST >PLIST</code></strong>
13387: <code class="prompt">#</code> <strong class=
13388: "userinput"><code>make deinstall</code></strong>
13389: <code class="prompt">#</code> <strong class=
13390: "userinput"><code>make install</code></strong>
13391: <code class="prompt">#</code> <strong class=
13392: "userinput"><code>make deinstall</code></strong>
1.1 grant 13393: </pre>
13394:
1.45 wiz 13395: <p>You usually need to be <code xmlns=
13396: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13397: "username">root</code> to do this. Look if there are
1.1 grant 13398: any files left:</p>
13399: <pre class="screen">
1.14 xtraeme 13400: <code class="prompt">#</code> <strong class=
13401: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13402: </pre>
13403:
13404: <p>If this reveals any files that are missing in
1.45 wiz 13405: <code xmlns=
13406: "http://www.w3.org/TR/xhtml1/transitional" class=
13407: "filename">PLIST</code>, add them.</p>
1.1 grant 13408: </li>
13409:
13410: <li>
1.45 wiz 13411: <p>Now that the <code xmlns=
13412: "http://www.w3.org/TR/xhtml1/transitional" class=
13413: "filename">PLIST</code> is OK, install the package
13414: again and make a binary package:</p>
1.1 grant 13415: <pre class="screen">
1.14 xtraeme 13416: <code class="prompt">#</code> <strong class=
13417: "userinput"><code>make reinstall</code></strong>
13418: <code class="prompt">#</code> <strong class=
13419: "userinput"><code>make package</code></strong>
1.1 grant 13420: </pre>
13421: </li>
13422:
13423: <li>
13424: <p>Delete the installed package:</p>
13425: <pre class="screen">
1.14 xtraeme 13426: <code class="prompt">#</code> <strong class=
13427: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 13428: </pre>
13429: </li>
13430:
13431: <li>
1.14 xtraeme 13432: <p>Repeat the above <span><strong class=
13433: "command">make print-PLIST</strong></span> command,
13434: which shouldn't find anything now:</p>
1.1 grant 13435: <pre class="screen">
1.14 xtraeme 13436: <code class="prompt">#</code> <strong class=
13437: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 13438: </pre>
13439: </li>
13440:
13441: <li>
13442: <p>Reinstall the binary package:</p>
13443: <pre class="screen">
1.14 xtraeme 13444: <code class="prompt">#</code> <strong class=
13445: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 13446: </pre>
13447: </li>
13448:
13449: <li>
13450: <p>Play with it. Make sure everything works.</p>
13451: </li>
13452:
13453: <li>
1.14 xtraeme 13454: <p>Run <span><strong class=
13455: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 13456: "http://www.w3.org/TR/xhtml1/transitional" href=
13457: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13458: target="_top"><code xmlns="" class=
13459: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 13460: problems it reports:</p>
1.1 grant 13461: <pre class="screen">
1.14 xtraeme 13462: <code class="prompt">#</code> <strong class=
13463: "userinput"><code>pkglint</code></strong>
1.1 grant 13464: </pre>
13465: </li>
13466:
13467: <li>
13468: <p>Submit (or commit, if you have cvs access); see
13469: <a href="#submit" title=
1.38 dillo 13470: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 13471: <i>Submitting and Committing</i></a>.</p>
13472: </li>
13473: </ul>
13474: </div>
13475: </div>
13476:
1.52 ! tv 13477: <div class="chapter" lang="en">
1.1 grant 13478: <div class="titlepage">
13479: <div>
13480: <div>
1.52 ! tv 13481: <h2 class="title"><a name=
1.38 dillo 13482: "submit"></a>Chapter 17. Submitting and
1.1 grant 13483: Committing</h2>
13484: </div>
13485: </div>
13486: </div>
13487:
13488: <div class="toc">
13489: <p><b>Table of Contents</b></p>
13490:
13491: <dl>
1.30 wiz 13492: <dt><span class="sect1"><a href=
1.38 dillo 13493: "#submitting-your-package">17.1. Submitting your
1.30 wiz 13494: packages</a></span></dt>
1.1 grant 13495:
1.30 wiz 13496: <dt><span class="sect1"><a href=
1.41 wiz 13497: "#general-notes-for-changes">17.2. General notes when
13498: adding, updating, or removing packages</a></span></dt>
13499:
13500: <dt><span class="sect1"><a href=
13501: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 13502: package into CVS</a></span></dt>
1.1 grant 13503:
1.30 wiz 13504: <dt><span class="sect1"><a href=
1.41 wiz 13505: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 13506: version</a></span></dt>
1.1 grant 13507:
1.41 wiz 13508: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 13509: Moving a package in pkgsrc</a></span></dt>
1.1 grant 13510: </dl>
13511: </div>
13512:
1.52 ! tv 13513: <div class="sect1" lang="en">
1.1 grant 13514: <div class="titlepage">
13515: <div>
13516: <div>
13517: <h2 class="title" style="clear: both"><a name=
1.38 dillo 13518: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 13519: your packages</h2>
1.1 grant 13520: </div>
13521: </div>
13522: </div>
13523:
13524: <p>You have to separate between binary and
13525: “<span class="quote">normal</span>” (source)
13526: packages here:</p>
13527:
13528: <div class="itemizedlist">
13529: <ul type="disc">
13530: <li>
13531: <p>precompiled binary packages</p>
13532:
13533: <p>Our policy is that we accept binaries only from
13534: pkgsrc developers to guarantee that the packages
13535: don't contain any trojan horses etc. This is not to
1.13 hubertf 13536: annoy anyone but rather to protect our users!
1.1 grant 13537: You're still free to put up your home-made binary
1.13 hubertf 13538: packages and tell the world where to get them.
13539: NetBSD developers doing bulk builds and wanting to
13540: upload them please see <a href="#bulk-upload"
1.38 dillo 13541: title="6.3.8. Uploading results of a bulk build">
13542: Section 6.3.8, “Uploading results of a
1.13 hubertf 13543: bulk build”</a>.</p>
1.1 grant 13544: </li>
13545:
13546: <li>
13547: <p>packages</p>
13548:
13549: <p>First, check that your package is complete,
13550: compiles and runs well; see <a href="#debug" title=
1.38 dillo 13551: "Chapter 16. Debugging">Chapter 16,
1.1 grant 13552: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 13553: Next, generate an uuencoded gzipped <a href=
13554: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
13555: <span class="citerefentry"><span class=
13556: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 13557: preferably with all files in a single directory.
1.14 xtraeme 13558: Finally, <span><strong class=
13559: "command">send-pr</strong></span> with category
1.1 grant 13560: “<span class="quote">pkg</span>”, a
13561: synopsis which includes the package name and
13562: version number, a short description of your package
13563: (contents of the COMMENT variable or DESCR file are
13564: OK) and attach the archive to your PR.</p>
13565:
13566: <p>If you want to submit several packages, please
13567: send a separate PR for each one, it's easier for us
13568: to track things that way.</p>
13569:
13570: <p>Alternatively, you can also import new packages
13571: into pkgsrc-wip (“<span class="quote">pkgsrc
13572: work-in-progress</span>”); see the homepage
13573: at <a href="http://pkgsrc-wip.sourceforge.net/"
13574: target=
13575: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
13576: details.</p>
13577: </li>
13578: </ul>
13579: </div>
13580: </div>
13581:
1.52 ! tv 13582: <div class="sect1" lang="en">
1.1 grant 13583: <div class="titlepage">
13584: <div>
13585: <div>
13586: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13587: "general-notes-for-changes"></a>17.2. General
13588: notes when adding, updating, or removing
13589: packages</h2>
13590: </div>
13591: </div>
13592: </div>
13593:
13594: <p>Please note all package additions, updates, moves, and
1.45 wiz 13595: removals in <code xmlns=
13596: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13597: "filename">pkgsrc/doc/CHANGES</code>. It's very important
13598: to keep this file up to date and conforming to the
13599: existing format, because it will be used by scripts to
13600: automatically update pages on <a href=
13601: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 13602: and other sites. Additionally, check the <code xmlns=
13603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13604: "filename">pkgsrc/doc/TODO</code> file and remove the
13605: entry for the package you updated or removed, in case it
13606: was mentioned there.</p>
13607:
13608: <p>There is a make target that helps in creating proper
1.45 wiz 13609: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13610: class="filename">CHANGES</code> entries:
1.41 wiz 13611: <span><strong class="command">make
13612: changes-entry</strong></span>. It uses the optional
13613: <code class="varname">CTYPE</code> and <code class=
13614: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 13615: usage is to first make sure that your <code xmlns=
13616: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13617: "filename">CHANGES</code> file is up-to-date (to avoid
13618: having to resolve conflicts later-on) and then to
13619: <span><strong class="command">cd</strong></span> to the
13620: package directory. For package updates,
13621: <span><strong class="command">make
13622: changes-entry</strong></span> is enough. For new
13623: packages, or package moves or removals, set the
13624: <code class="varname">CTYPE</code> variable on the
13625: command line to "Added", "Moved", or "Removed". You can
13626: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 13627: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13628: class="filename">/etc/mk.conf</code> if your local login
13629: name is not the same as your NetBSD login name. Don't
13630: forget to commit the changes to <code xmlns=
13631: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 13632: "filename">pkgsrc/doc/CHANGES</code>!</p>
13633: </div>
13634:
1.52 ! tv 13635: <div class="sect1" lang="en">
1.41 wiz 13636: <div class="titlepage">
13637: <div>
13638: <div>
13639: <h2 class="title" style="clear: both"><a name=
13640: "committing-importing"></a>17.3. Committing:
1.30 wiz 13641: Importing a package into CVS</h2>
1.1 grant 13642: </div>
13643: </div>
13644: </div>
13645:
13646: <p>This section is only of interest for pkgsrc developers
13647: with write access to the pkgsrc repository. Please
13648: remember that cvs imports files relative to the current
13649: working directory, and that the pathname that you give
1.14 xtraeme 13650: the <span><strong class="command">cvs
13651: import</strong></span> command is so that it knows where
13652: to place the files in the repository. Newly created
13653: packages should be imported with a vendor tag of
13654: “<span class="quote">TNF</span>” and a
13655: release tag of “<span class=
13656: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 13657: <pre class="programlisting">
1.51 rillig 13658: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
13659: <code class=
13660: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 13661: </pre>
13662:
13663: <p>Remember to move the directory from which you imported
13664: out of the way, or cvs will complain the next time you
13665: “<span class="quote">cvs update</span>” your
13666: source tree. Also don't forget to add the new package to
1.45 wiz 13667: the category's <code xmlns=
13668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13669: "filename">Makefile</code>.</p>
1.1 grant 13670:
13671: <p>The commit message of the initial import should
1.45 wiz 13672: include part of the <code xmlns=
13673: "http://www.w3.org/TR/xhtml1/transitional" class=
13674: "filename">DESCR</code> file, so people reading the
13675: mailing lists know what the package is/does.</p>
1.1 grant 13676:
13677: <p>For new packages, “<span class="quote">cvs
13678: import</span>” is preferred to “<span class=
13679: "quote">cvs add</span>” because the former gets
13680: everything with a single command, and provides a
13681: consistent tag.</p>
13682: </div>
13683:
1.52 ! tv 13684: <div class="sect1" lang="en">
1.1 grant 13685: <div class="titlepage">
13686: <div>
13687: <div>
13688: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13689: "updating-package"></a>17.4. Updating a
1.30 wiz 13690: package to a newer version</h2>
1.1 grant 13691: </div>
13692: </div>
13693: </div>
13694:
13695: <p>Please always put a concise, appropriate and relevant
13696: summary of the changes between old and new versions into
13697: the commit log when updating a package. There are various
13698: reasons for this:</p>
13699:
13700: <div class="itemizedlist">
13701: <ul type="disc">
13702: <li>
13703: <p>A URL is volatile, and can change over time. It
13704: may go away completely or its information may be
13705: overwritten by newer information.</p>
13706: </li>
13707:
13708: <li>
13709: <p>Having the change information between old and
13710: new versions in our CVS repository is very useful
13711: for people who use either cvs or anoncvs.</p>
13712: </li>
13713:
13714: <li>
13715: <p>Having the change information between old and
13716: new versions in our CVS repository is very useful
13717: for people who read the pkgsrc-changes mailing
13718: list, so that they can make tactical decisions
13719: about when to upgrade the package.</p>
13720: </li>
13721: </ul>
13722: </div>
13723:
1.18 xtraeme 13724: <p>Please also recognize that, just because a new version
1.1 grant 13725: of a package has been released, it should not
13726: automatically be upgraded in the CVS repository. We
13727: prefer to be conservative in the packages that are
13728: included in pkgsrc - development or beta packages are not
13729: really the best thing for most places in which pkgsrc is
13730: used. Please use your judgement about what should go into
13731: pkgsrc, and bear in mind that stability is to be
13732: preferred above new and possibly untested features.</p>
13733: </div>
13734:
1.52 ! tv 13735: <div class="sect1" lang="en">
1.1 grant 13736: <div class="titlepage">
13737: <div>
13738: <div>
13739: <h2 class="title" style="clear: both"><a name=
1.41 wiz 13740: "moving-package"></a>17.5. Moving a package in
1.30 wiz 13741: pkgsrc</h2>
1.1 grant 13742: </div>
13743: </div>
13744: </div>
13745:
13746: <div class="orderedlist">
13747: <ol type="1">
13748: <li>
13749: <p>Make a copy of the directory somewhere else.</p>
13750: </li>
13751:
13752: <li>
13753: <p>Remove all CVS dirs.</p>
13754:
13755: <p>Alternatively to the first two steps you can
13756: also do:</p>
13757: <pre class="screen">
1.14 xtraeme 13758: <code class="prompt">%</code> <strong class=
13759: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 13760: </pre>
13761:
13762: <p>and use that for further work.</p>
13763: </li>
13764:
13765: <li>
1.14 xtraeme 13766: <p>Fix <code class="varname">CATEGORIES</code> and
13767: any <code class="varname">DEPENDS</code> paths that
13768: just did “<span class=
1.1 grant 13769: "quote">../package</span>” instead of
13770: “<span class=
13771: "quote">../../category/package</span>”.</p>
13772: </li>
13773:
13774: <li>
1.14 xtraeme 13775: <p><span><strong class="command">cvs
13776: import</strong></span> the modified package in the
13777: new place.</p>
1.1 grant 13778: </li>
13779:
13780: <li>
13781: <p>Check if any package depends on it:</p>
13782: <pre class="screen">
1.14 xtraeme 13783: <code class="prompt">%</code> <strong class=
13784: "userinput"><code>cd /usr/pkgsrc</code></strong>
13785: <code class="prompt">%</code> <strong class=
13786: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 13787: </pre>
13788: </li>
13789:
13790: <li>
13791: <p>Fix paths in packages from step 5 to point to
13792: new location.</p>
13793: </li>
13794:
13795: <li>
1.14 xtraeme 13796: <p><span><strong class="command">cvs rm
13797: (-f)</strong></span> the package at the old
13798: location.</p>
1.1 grant 13799: </li>
13800:
13801: <li>
1.45 wiz 13802: <p>Remove from <code xmlns=
13803: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13804: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 13805: </li>
13806:
13807: <li>
1.45 wiz 13808: <p>Add to <code xmlns=
13809: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13810: "filename">newcategory/Makefile</code>.</p>
1.1 grant 13811: </li>
13812:
13813: <li>
13814: <p>Commit the changed and removed files:</p>
13815: <pre class="screen">
1.14 xtraeme 13816: <code class="prompt">%</code> <strong class=
13817: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 13818: </pre>
13819:
13820: <p>(and any packages from step 5, of course).</p>
13821: </li>
13822: </ol>
13823: </div>
13824: </div>
13825: </div>
13826: </div>
13827:
1.52 ! tv 13828: <div class="appendix" lang="en">
1.1 grant 13829: <div class="titlepage">
13830: <div>
13831: <div>
1.52 ! tv 13832: <h2 class="title"><a name=
1.46 gdt 13833: "examples"></a>Appendix A. A simple example
1.1 grant 13834: package: bison</h2>
13835: </div>
13836: </div>
13837: </div>
13838:
13839: <div class="toc">
13840: <p><b>Table of Contents</b></p>
13841:
13842: <dl>
1.46 gdt 13843: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 13844: files</a></span></dt>
13845:
13846: <dd>
13847: <dl>
1.30 wiz 13848: <dt><span class="sect2"><a href=
1.46 gdt 13849: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 13850:
1.30 wiz 13851: <dt><span class="sect2"><a href=
1.46 gdt 13852: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 13853:
1.30 wiz 13854: <dt><span class="sect2"><a href=
1.46 gdt 13855: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 13856:
1.30 wiz 13857: <dt><span class="sect2"><a href=
1.46 gdt 13858: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 13859: package with <span><strong class=
1.14 xtraeme 13860: "command">pkglint</strong></span></a></span></dt>
1.1 grant 13861: </dl>
13862: </dd>
13863:
1.46 gdt 13864: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 13865: Steps for building, installing, packaging</a></span></dt>
1.1 grant 13866: </dl>
13867: </div>
13868:
13869: <p>We checked to find a piece of software that wasn't in the
13870: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 13871: would want to have <span><strong class=
13872: "command">bison</strong></span> when Berkeley
13873: <span><strong class="command">yacc</strong></span> is already
13874: present in the tree is beyond us, but it's useful for the
13875: purposes of this exercise.</p>
1.1 grant 13876:
1.52 ! tv 13877: <div class="sect1" lang="en">
1.1 grant 13878: <div class="titlepage">
13879: <div>
13880: <div>
13881: <h2 class="title" style="clear: both"><a name=
1.46 gdt 13882: "example-files"></a>A.1. files</h2>
1.1 grant 13883: </div>
13884: </div>
13885: </div>
13886:
1.52 ! tv 13887: <div class="sect2" lang="en">
1.1 grant 13888: <div class="titlepage">
13889: <div>
13890: <div>
1.52 ! tv 13891: <h3 class="title"><a name=
1.46 gdt 13892: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 13893: </div>
13894: </div>
13895: </div>
13896: <pre class="programlisting">
1.51 rillig 13897: # $NetBSD$
13898: #
1.1 grant 13899:
1.51 rillig 13900: DISTNAME= bison-1.25
13901: CATEGORIES= devel
13902: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 13903:
1.51 rillig 13904: MAINTAINER= thorpej@NetBSD.org
13905: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
13906: COMMENT= GNU yacc clone
1.1 grant 13907:
1.51 rillig 13908: GNU_CONFIGURE= yes
13909: INFO_FILES= bison.info
1.1 grant 13910:
1.51 rillig 13911: .include "../../mk/bsd.pkg.mk"
1.1 grant 13912: </pre>
13913: </div>
13914:
1.52 ! tv 13915: <div class="sect2" lang="en">
1.1 grant 13916: <div class="titlepage">
13917: <div>
13918: <div>
1.52 ! tv 13919: <h3 class="title"><a name=
1.46 gdt 13920: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 13921: </div>
13922: </div>
13923: </div>
13924: <pre class="programlisting">
1.51 rillig 13925: GNU version of yacc. Can make re-entrant parsers, and numerous other
13926: improvements. Why you would want this when Berkeley <a href=
1.1 grant 13927: "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 13928: of the NetBSD source tree is beyond me.
1.1 grant 13929: </pre>
13930: </div>
13931:
1.52 ! tv 13932: <div class="sect2" lang="en">
1.1 grant 13933: <div class="titlepage">
13934: <div>
13935: <div>
1.52 ! tv 13936: <h3 class="title"><a name=
1.46 gdt 13937: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 13938: </div>
13939: </div>
13940: </div>
13941: <pre class="programlisting">
1.51 rillig 13942: @comment $NetBSD$
13943: bin/bison
13944: man/man1/bison.1.gz
13945: share/bison.simple
13946: share/bison.hairy
1.1 grant 13947: </pre>
13948: </div>
13949:
1.52 ! tv 13950: <div class="sect2" lang="en">
1.1 grant 13951: <div class="titlepage">
13952: <div>
13953: <div>
1.30 wiz 13954: <h3 class="title"><a name=
1.46 gdt 13955: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 13956: a package with <span><strong class=
1.14 xtraeme 13957: "command">pkglint</strong></span></h3>
1.1 grant 13958: </div>
13959: </div>
13960: </div>
13961:
13962: <p>The NetBSD package system comes with <a xmlns=
13963: "http://www.w3.org/TR/xhtml1/transitional" href=
13964: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 13965: target="_top"><code xmlns="" class=
13966: "filename">pkgtools/pkglint</code></a> which helps to
13967: check the contents of these files. After installation it
13968: is quite easy to use, just change to the directory of the
1.20 ben 13969: package you wish to examine and execute
13970: <span><strong class=
13971: "command">pkglint</strong></span>:</p>
1.1 grant 13972: <pre class="screen">
1.14 xtraeme 13973: <code class="prompt">$</code> <strong class=
13974: "userinput"><code>pkglint</code></strong>
1.1 grant 13975: looks fine.
13976: </pre>
13977:
13978: <p>Depending on the supplied command line arguments (see
1.47 reed 13979: pkglint(1)), more verbose checks will be performed. Use
1.14 xtraeme 13980: e.g. <span><strong class="command">pkglint
13981: -v</strong></span> for a very verbose check.</p>
1.1 grant 13982: </div>
13983: </div>
13984:
1.52 ! tv 13985: <div class="sect1" lang="en">
1.1 grant 13986: <div class="titlepage">
13987: <div>
13988: <div>
13989: <h2 class="title" style="clear: both"><a name=
1.46 gdt 13990: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 13991: installing, packaging</h2>
1.1 grant 13992: </div>
13993: </div>
13994: </div>
13995:
13996: <p>Create the directory where the package lives, plus any
13997: auxiliary directories:</p>
13998: <pre class="screen">
1.14 xtraeme 13999: <code class="prompt">#</code> <strong class=
14000: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14001: <code class="prompt">#</code> <strong class=
14002: "userinput"><code>mkdir bison</code></strong>
14003: <code class="prompt">#</code> <strong class=
14004: "userinput"><code>cd bison</code></strong>
14005: <code class="prompt">#</code> <strong class=
14006: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14007: </pre>
14008:
1.45 wiz 14009: <p>Create <code xmlns=
14010: "http://www.w3.org/TR/xhtml1/transitional" class=
14011: "filename">Makefile</code>, <code xmlns=
14012: "http://www.w3.org/TR/xhtml1/transitional" class=
14013: "filename">DESCR</code> and <code xmlns=
14014: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14015: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14016: "Chapter 8. Package components - files, directories and contents">
1.52 ! tv 14017: Chapter 8, <i>Package components - files, directories
! 14018: and contents</i></a>) then continue with fetching the
1.1 grant 14019: distfile:</p>
14020: <pre class="screen">
1.14 xtraeme 14021: <code class="prompt">#</code> <strong class=
14022: "userinput"><code>make fetch</code></strong>
1.1 grant 14023: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14024: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14025: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14026: ftp: Error retrieving file: 500 Internal error
14027:
14028: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14029: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14030: ftp: Error retrieving file: 500 Internal error
14031:
14032: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14033: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14034: Successfully retrieved file.
14035: </pre>
14036:
1.45 wiz 14037: <p>Generate the checksum of the distfile into <code xmlns=
14038: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14039: "filename">distinfo</code>:</p>
1.1 grant 14040: <pre class="screen">
1.14 xtraeme 14041: <code class="prompt">#</code> <strong class=
14042: "userinput"><code>make makesum</code></strong>
1.1 grant 14043: </pre>
14044:
14045: <p>Now compile:</p>
14046: <pre class="screen">
1.14 xtraeme 14047: <code class="prompt">#</code> <strong class=
14048: "userinput"><code>make</code></strong>
1.1 grant 14049: >> Checksum OK for bison-1.25.tar.gz.
14050: ===> Extracting for bison-1.25
14051: ===> Patching for bison-1.25
14052: ===> Ignoring empty patch directory
14053: ===> Configuring for bison-1.25
14054: creating cache ./config.cache
14055: checking for gcc... cc
14056: checking whether we are using GNU C... yes
14057: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14058: checking how to run the C preprocessor... cc -E
14059: checking for minix/config.h... no
14060: checking for POSIXized ISC... no
14061: checking whether cross-compiling... no
14062: checking for ANSI C header files... yes
14063: checking for string.h... yes
14064: checking for stdlib.h... yes
14065: checking for memory.h... yes
14066: checking for working const... yes
14067: checking for working alloca.h... no
14068: checking for alloca... yes
14069: checking for strerror... yes
14070: updating cache ./config.cache
14071: creating ./config.status
14072: creating Makefile
14073: ===> Building for bison-1.25
14074: 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
14075: 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
14076: 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
14077: 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
14078: 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
14079: 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
14080: 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
14081: 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
14082: 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
14083: 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
14084: 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
14085: 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
14086: 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
14087: 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
14088: 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
14089: 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
14090: 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
14091: 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
14092: 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
14093: 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
14094: 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
14095: 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
14096: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
14097: rm -f bison.s1
14098: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
14099: </pre>
14100:
14101: <p>Everything seems OK, so install the files:</p>
14102: <pre class="screen">
1.14 xtraeme 14103: <code class="prompt">#</code> <strong class=
14104: "userinput"><code>make install</code></strong>
1.1 grant 14105: >> Checksum OK for bison-1.25.tar.gz.
14106: ===> Installing for bison-1.25
14107: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14108: rm -f /usr/pkg/bin/bison
14109: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14110: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14111: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14112: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14113: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14114: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14115: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14116: ===> Registering installation for bison-1.25
14117: </pre>
14118:
14119: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14120: remove it with <span><strong class="command">pkg_delete
14121: bison</strong></span>. Should you decide that you want a
14122: binary package, do this now:</p>
1.1 grant 14123: <pre class="screen">
1.14 xtraeme 14124: <code class="prompt">#</code> <strong class=
14125: "userinput"><code>make package</code></strong>
1.1 grant 14126: >> Checksum OK for bison-1.25.tar.gz.
14127: ===> Building package for bison-1.25
14128: Creating package bison-1.25.tgz
14129: Registering depends:.
14130: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14131: </pre>
14132:
14133: <p>Now that you don't need the source and object files any
14134: more, clean up:</p>
14135: <pre class="screen">
1.14 xtraeme 14136: <code class="prompt">#</code> <strong class=
14137: "userinput"><code>make clean</code></strong>
1.1 grant 14138: ===> Cleaning for bison-1.25
14139: </pre>
14140: </div>
14141: </div>
14142:
1.52 ! tv 14143: <div class="appendix" lang="en">
1.1 grant 14144: <div class="titlepage">
14145: <div>
14146: <div>
1.52 ! tv 14147: <h2 class="title"><a name=
1.46 gdt 14148: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 14149: </div>
14150: </div>
14151: </div>
14152:
14153: <div class="toc">
14154: <p><b>Table of Contents</b></p>
14155:
14156: <dl>
1.46 gdt 14157: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 14158: Building figlet</a></span></dt>
14159:
1.46 gdt 14160: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 14161: Packaging figlet</a></span></dt>
14162: </dl>
14163: </div>
14164:
1.52 ! tv 14165: <div class="sect1" lang="en">
1.1 grant 14166: <div class="titlepage">
14167: <div>
14168: <div>
14169: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14170: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 14171: </div>
14172: </div>
14173: </div>
14174: <pre class="screen">
1.14 xtraeme 14175: <code class="prompt">#</code> <strong class=
14176: "userinput"><code>make</code></strong>
1.1 grant 14177: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14178: => figlet221.tar.gz doesn't seem to exist on this system.
14179: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
14180: => [172219 bytes]
14181: Connected to ftp.plig.net.
14182: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
14183: 331 Guest login ok, send your complete e-mail address as password.
14184: 230-You are user #5 of 500 simultaneous users allowed.
14185: 230-
14186: 230- ___ _ _ _
14187: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
14188: 230- | _| _| . |_| . | | | . |_| . | _| . |
14189: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
14190: 230- |_| |_| |___| |___|
14191: 230-
14192: 230-** Welcome to ftp.plig.org **
14193: 230-
14194: 230-Please note that all transfers from this FTP site are logged. If you
14195: 230-do not like this, please disconnect now.
14196: 230-
14197: 230-This arhive is available via
14198: 230-
14199: 230-HTTP: http://ftp.plig.org/
14200: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
14201: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
14202: 230-
14203: 230-Please email comments, bug reports and requests for packages to be
14204: 230-mirrored to ftp-admin@plig.org.
14205: 230-
14206: 230-
14207: 230 Logged in anonymously.
14208: Remote system type is UNIX.
14209: Using binary mode to transfer files.
14210: 200 Type okay.
14211: 250 "/pub" is new cwd.
14212: 250-"/pub/figlet" is new cwd.
14213: 250-
14214: 250-Welcome to the figlet archive at ftp.figlet.org
14215: 250-
14216: 250- ftp://ftp.figlet.org/pub/figlet/
14217: 250-
14218: 250-The official FIGlet web page is:
14219: 250- http://www.figlet.org/
14220: 250-
14221: 250-If you have questions, please mailto:info@figlet.org. If you want to
14222: 250-contribute a font or something else, you can email us.
14223: 250
14224: 250 "/pub/figlet/program" is new cwd.
14225: 250 "/pub/figlet/program/unix" is new cwd.
14226: local: figlet221.tar.gz remote: figlet221.tar.gz
14227: 502 Unimplemented command.
14228: 227 Entering Passive Mode (195,40,6,41,246,104)
14229: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
14230: 38% |************** | 65800 64.16 KB/s 00:01 ETA
14231: 226 Transfer completed.
14232: 172219 bytes received in 00:02 (75.99 KB/s)
14233: 221 Goodbye.
14234: => Checksum OK for figlet221.tar.gz.
14235: ===> Extracting for figlet-2.2.1nb2
14236: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
14237: ===> Patching for figlet-2.2.1nb2
14238: ===> Applying pkgsrc patches for figlet-2.2.1nb2
14239: ===> Overriding tools for figlet-2.2.1nb2
14240: ===> Creating toolchain wrappers for figlet-2.2.1nb2
14241: ===> Configuring for figlet-2.2.1nb2
14242: ===> Building for figlet-2.2.1nb2
14243: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
14244: chmod a+x figlet
14245: gcc -O2 -o chkfont chkfont.c
14246: => Unwrapping files-to-be-installed.
1.14 xtraeme 14247: <code class="prompt">#</code>
14248: <code class="prompt">#</code> <strong class=
14249: "userinput"><code>make install</code></strong>
1.1 grant 14250: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14251: ===> Installing for figlet-2.2.1nb2
14252: install -d -o root -g wheel -m 755 /usr/pkg/bin
14253: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
14254: mkdir -p /usr/pkg/share/figlet
14255: cp figlet /usr/pkg/bin
14256: cp chkfont /usr/pkg/bin
14257: chmod 555 figlist showfigfonts
14258: cp figlist /usr/pkg/bin
14259: cp showfigfonts /usr/pkg/bin
14260: cp fonts/*.flf /usr/pkg/share/figlet
14261: cp fonts/*.flc /usr/pkg/share/figlet
14262: cp figlet.6 /usr/pkg/man/man6
14263: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 14264: <code class="prompt">#</code>
1.1 grant 14265: </pre>
14266: </div>
14267:
1.52 ! tv 14268: <div class="sect1" lang="en">
1.1 grant 14269: <div class="titlepage">
14270: <div>
14271: <div>
14272: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14273: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 14274: </div>
14275: </div>
14276: </div>
14277: <pre class="screen">
1.14 xtraeme 14278: <code class="prompt">#</code> <strong class=
14279: "userinput"><code>make package</code></strong>
1.1 grant 14280: ===> Checking for vulnerabilities in figlet-2.2.1nb2
14281: ===> Packaging figlet-2.2.1nb2
14282: ===> Building binary package for figlet-2.2.1nb2
14283: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
14284: Using SrcDir value of /usr/pkg
14285: Registering depends:.
1.14 xtraeme 14286: <code class="prompt">#</code>
1.1 grant 14287: </pre>
14288: </div>
14289: </div>
14290:
1.52 ! tv 14291: <div class="appendix" lang="en">
1.1 grant 14292: <div class="titlepage">
14293: <div>
14294: <div>
1.52 ! tv 14295: <h2 class="title"><a name=
1.46 gdt 14296: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 14297: FTP server's package archive</h2>
14298: </div>
14299: </div>
14300: </div>
14301:
14302: <p>Layout for precompiled binary packages on
14303: ftp.NetBSD.org:</p>
14304: <pre class="programlisting">
1.51 rillig 14305: /pub/NetBSD/packages/
14306: distfiles/
1.1 grant 14307:
1.51 rillig 14308: # Unpacked pkgsrc trees
14309: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
14310: pkgsrc-2003Q4 -> N/A
14311: pkgsrc-2004Q1/pkgsrc
14312:
14313: # pkgsrc archives
14314: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
14315: pkgsrc-2003Q4.tar.gz -> N/A
14316: pkgsrc-2004Q1.tar.gz -> N/A
14317:
14318: # Per pkgsrc-release/OS-release/arch package archives
14319: pkgsrc-2003Q4/
14320: NetBSD-1.6.2/
14321: i386/
14322: All/
14323: archivers/
14324: foo -> ../All/foo
14325: ...
14326: pkgsrc-2004Q1/
14327: NetBSD-1.6.2/
14328: i386/
14329: All/
14330: ...
14331: NetBSD-2.0/
14332: i386/
14333: All/
14334: ...
14335: SunOS-5.9/
14336: sparc/
14337: All/
14338: ...
14339: x86/
14340: All/
14341: ...
14342:
14343: # Per os-release package archive convenience links
14344: NetBSD-1.6.2 -> 1.6.2
14345: 1.6.2/
14346: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
14347: m68k/
14348: All/
14349: archivers/
14350: foo -> ../All/foo
14351: ...
14352: amiga -> m68k
14353: atari -> m68k
14354: ...
14355:
14356: 2.0 -> NetBSD-2.0 # backward compat, historic
14357: NetBSD-2.0/
14358: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
14359: SunOS-5.9/
14360: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
14361: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 14362: </pre>
14363:
14364: <p>To create:</p>
14365:
14366: <div class="orderedlist">
14367: <ol type="1">
14368: <li>
14369: <p>Run bulk build, see <a href="#bulkbuild" title=
1.52 ! tv 14370: "6.3. Doing a bulk build of all packages">Section 6.3,
! 14371: “Doing a bulk build of all
1.1 grant 14372: packages”</a></p>
14373: </li>
14374:
14375: <li>
14376: <p>Upload /usr/pkgsrc/packages to</p>
14377: <pre class="programlisting">
14378: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 14379: pkgsrc-2004Q4/\ # pkgsrc-branch
14380: `uname -s`-`uname -r`/\ # OS & version
14381: `uname -p` # architecture
1.1 grant 14382: </pre>
14383: </li>
14384:
14385: <li>
1.14 xtraeme 14386: <p>If necessary, create a symlink <span><strong class=
14387: "command">ln -s `uname -m` `uname -p`</strong></span>
14388: (amiga -> m68k, ...)</p>
1.1 grant 14389: </li>
14390: </ol>
14391: </div>
14392: </div>
1.2 hubertf 14393:
1.52 ! tv 14394: <div class="appendix" lang="en">
1.2 hubertf 14395: <div class="titlepage">
14396: <div>
14397: <div>
1.52 ! tv 14398: <h2 class="title"><a name=
1.46 gdt 14399: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 14400: for the pkgsrc guide</h2>
14401: </div>
14402: </div>
14403: </div>
14404:
14405: <div class="toc">
14406: <p><b>Table of Contents</b></p>
14407:
14408: <dl>
1.46 gdt 14409: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 14410: Targets</a></span></dt>
14411:
1.46 gdt 14412: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 14413: Procedure</a></span></dt>
14414: </dl>
14415: </div>
14416:
14417: <p>This section contains information on editing the pkgsrc
14418: guide itself.</p>
14419:
1.52 ! tv 14420: <div class="sect1" lang="en">
1.2 hubertf 14421: <div class="titlepage">
14422: <div>
14423: <div>
14424: <h2 class="title" style="clear: both"><a name=
1.52 ! tv 14425: "targets"></a>D.1. Targets</h2>
1.2 hubertf 14426: </div>
14427: </div>
14428: </div>
14429:
1.45 wiz 14430: <p>The pkgsrc guide's source code is stored in <code xmlns=
14431: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14432: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 14433: are created from it:</p>
14434:
14435: <div class="itemizedlist">
14436: <ul type="disc">
14437: <li>
1.45 wiz 14438: <p><code xmlns=
14439: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 14440: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 14441: </li>
14442:
14443: <li>
1.45 wiz 14444: <p><code xmlns=
14445: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14446: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 14447: </li>
14448:
14449: <li>
1.45 wiz 14450: <p><code xmlns=
14451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14452: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 14453: the documentation on the NetBSD website will be built
14454: from pkgsrc and kept up to date on the web server
14455: itself. This means you <span class=
14456: "emphasis"><em>must</em></span> make sure that your
14457: changes haven't broken the build!</p>
14458: </li>
1.6 hubertf 14459:
14460: <li>
1.45 wiz 14461: <p><code xmlns=
14462: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14463: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 14464: PDF version of the pkgsrc guide.</p>
14465: </li>
14466:
14467: <li>
1.45 wiz 14468: <p><code xmlns=
14469: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14470: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 14471: PostScript version of the pkgsrc guide.</p>
14472: </li>
1.2 hubertf 14473: </ul>
14474: </div>
14475: </div>
14476:
1.52 ! tv 14477: <div class="sect1" lang="en">
1.2 hubertf 14478: <div class="titlepage">
14479: <div>
14480: <div>
14481: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14482: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 14483: </div>
14484: </div>
14485: </div>
14486:
14487: <p>The procedure to edit the pkgsrc guide is:</p>
14488:
14489: <div class="itemizedlist">
14490: <ul type="disc">
14491: <li>
1.6 hubertf 14492: <p>Make sure you have the packages needed to
14493: re-generate the pkgsrc guide (and other XML-based
14494: NetBSD documentation) installed. These are
1.11 ben 14495: “<span class="quote">netbsd-doc</span>”
1.47 reed 14496: for creating the ASCII and HTML versions, and
1.6 hubertf 14497: “<span class=
1.47 reed 14498: "quote">netbsd-doc-print</span>” for the
14499: PostScript and PDF versions. You will need both
1.6 hubertf 14500: packages installed, to make sure documentation is
14501: consistent across all formats. The packages can be
1.45 wiz 14502: found in <code xmlns=
14503: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14504: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 14505: <code xmlns=
14506: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14507: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 14508: </li>
14509:
14510: <li>
1.45 wiz 14511: <p>Edit the XML file(s) in <code xmlns=
14512: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14513: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 14514: </li>
14515:
14516: <li>
1.14 xtraeme 14517: <p>Run <span><strong class="command">make extract
14518: && make do-lint</strong></span> in
1.45 wiz 14519: <code xmlns=
14520: "http://www.w3.org/TR/xhtml1/transitional" class=
14521: "filename">pkgsrc/doc/guide</code> to check the XML
14522: syntax, and fix it if needed.</p>
1.4 hubertf 14523: </li>
14524:
14525: <li>
1.14 xtraeme 14526: <p>Run <span><strong class=
1.45 wiz 14527: "command">make</strong></span> in <code xmlns=
14528: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14529: "filename">pkgsrc/doc/guide</code> to build the HTML
14530: and ASCII version.</p>
1.2 hubertf 14531: </li>
14532:
14533: <li>
1.14 xtraeme 14534: <p>If all is well, run <span><strong class=
14535: "command">make install-doc</strong></span> to put the
1.45 wiz 14536: generated files into <code xmlns=
14537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14538: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 14539: </li>
14540:
14541: <li>
1.14 xtraeme 14542: <p><span><strong class="command">cvs commit
14543: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 14544: </li>
14545:
14546: <li>
1.14 xtraeme 14547: <p><span><strong class="command">cvs commit -m
14548: re-generate
14549: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 14550: </li>
1.4 hubertf 14551:
14552: <li>
14553: <p>Until the webserver on www.NetBSD.org is really
14554: updated automatically to pick up changes to the
1.14 xtraeme 14555: pkgsrc guide automatically, also run
1.18 xtraeme 14556: <span><strong class="command">make install-htdocs
1.14 xtraeme 14557: HTDOCSDIR=../../../htdocs</strong></span> (or
14558: similar, adjust <code class=
14559: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 14560: </li>
14561:
14562: <li>
1.14 xtraeme 14563: <p><span><strong class="command">cvs commit
14564: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 14565: </li>
1.2 hubertf 14566: </ul>
14567: </div>
14568: </div>
14569: </div>
1.1 grant 14570: </div>
14571: </body>
14572: </html>
CVSweb <webmaster@jp.NetBSD.org>